about Cox-Box transformation

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

about Cox-Box transformation

Stefano Sofia
Dear R-users,
I am using R version 1.8.0-1 under Suse 8.2.
I need to use the boxcox command because I want to apply a Cox-Box
transformation to a vector of rainfall values.
Within the libraries, the MASS library is present, but I don't know
whether this means that is automatically installed or not.
The command doesn't work. What do I have to do in order to make it
working? Is just a problem of installation or simply of recalling the
right command?

thank you for your help
Stefano

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: about Cox-Box transformation

Brian Ripley
On Thu, 9 Feb 2006, Stefano Sofia wrote:

> Dear R-users,
> I am using R version 1.8.0-1 under Suse 8.2.

That is *really* old.

> I need to use the boxcox command because I want to apply a Cox-Box
> transformation to a vector of rainfall values.
> Within the libraries, the MASS library is present, but I don't know
> whether this means that is automatically installed or not.
> The command doesn't work. What do I have to do in order to make it
> working? Is just a problem of installation or simply of recalling the
> right command?

library(MASS), I presume.

--
Brian D. Ripley,                  [hidden email]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: about Cox-Box transformation

PIKAL Petr
In reply to this post by Stefano Sofia
Hi

1. upgrade
2. read Introduction to R shipped with the distribution
3. read documentation to MASS
4. packages not libraries
5. use library(MASS) to make functions from MASS package available
6. now you can use boxcox() but not on vectors AFAIK

probably not completely correct but this

box.cox <- function(x, lambda,inv=F)
{ if (!inv)
                {if(missing(lambda))
                        log(x)
                else (x^lambda - 1)/lambda}
        else (lambda*x+1)^(1/lambda)
}

you can use to perform Box-Cox transformation on vectors.

HTH
Petr


On 9 Feb 2006 at 11:51, Stefano Sofia wrote:

From:           Stefano Sofia <[hidden email]>
To:             [hidden email]
Date sent:       Thu, 09 Feb 2006 11:51:02 +0000
Subject:         [R] about Cox-Box transformation

> Dear R-users,
> I am using R version 1.8.0-1 under Suse 8.2.
> I need to use the boxcox command because I want to apply a Cox-Box
> transformation to a vector of rainfall values. Within the libraries,
> the MASS library is present, but I don't know whether this means that
> is automatically installed or not. The command doesn't work. What do I
> have to do in order to make it working? Is just a problem of
> installation or simply of recalling the right command?
>
> thank you for your help
> Stefano
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
[hidden email]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: about Cox-Box transformation

Brian Ripley
On Thu, 9 Feb 2006, Petr Pikal wrote:

> Hi
>
> 1. upgrade
> 2. read Introduction to R shipped with the distribution
> 3. read documentation to MASS
> 4. packages not libraries
> 5. use library(MASS) to make functions from MASS package available
> 6. now you can use boxcox() but not on vectors AFAIK

You can by

boxcox(y ~ 1)

but car's box.cox does similar things.  (I did not mention that as adding
packages to R 1.8.0 is unlikely to be easy.)

> probably not completely correct but this
>
> box.cox <- function(x, lambda,inv=F)
> { if (!inv)
> {if(missing(lambda))
> log(x)
> else (x^lambda - 1)/lambda}
> else (lambda*x+1)^(1/lambda)
> }
>
> you can use to perform Box-Cox transformation on vectors.
>
> HTH
> Petr
>
>
> On 9 Feb 2006 at 11:51, Stefano Sofia wrote:
>
> From:           Stefano Sofia <[hidden email]>
> To:             [hidden email]
> Date sent:       Thu, 09 Feb 2006 11:51:02 +0000
> Subject:         [R] about Cox-Box transformation
>
>> Dear R-users,
>> I am using R version 1.8.0-1 under Suse 8.2.
>> I need to use the boxcox command because I want to apply a Cox-Box
>> transformation to a vector of rainfall values. Within the libraries,
>> the MASS library is present, but I don't know whether this means that
>> is automatically installed or not. The command doesn't work. What do I
>> have to do in order to make it working? Is just a problem of
>> installation or simply of recalling the right command?
>>
>> thank you for your help
>> Stefano

--
Brian D. Ripley,                  [hidden email]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: about Cox-Box transformation

Stefano Sofia
In reply to this post by Stefano Sofia
Paulo,
thank you for the straightforward hint.
But then, I should use the Box-Cox transformation to a set of data,
whose class at the moment is data.frame.
The help says only lm and aov objects can be handled. What should I do?


thank you
Stefano


On Thu, 2006-02-09 at 10:56 -0200, Paulo Justiniano Ribeiro Jr wrote:

> first load the package with:
>
> require(MASS)
>
> and then use the boxcox() function
>
>
> On Thu, 9 Feb 2006, Stefano Sofia wrote:
>
> > Date: Thu, 09 Feb 2006 11:51:02 +0000
> > From: Stefano Sofia <[hidden email]>
> > To: [hidden email]
> > Subject: [R] about Cox-Box transformation
> >
> > Dear R-users,
> > I am using R version 1.8.0-1 under Suse 8.2.
> > I need to use the boxcox command because I want to apply a Cox-Box
> > transformation to a vector of rainfall values.
> > Within the libraries, the MASS library is present, but I don't know
> > whether this means that is automatically installed or not.
> > The command doesn't work. What do I have to do in order to make it
> > working? Is just a problem of installation or simply of recalling the
> > right command?
> >
> > thank you for your help
> > Stefano
> >
> > ______________________________________________
> > [hidden email] mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> >
> >
>
> Paulo Justiniano Ribeiro Jr
> LEG (Laboratório de Estatística e Geoinformação)
> Departamento de Estatística
> Universidade Federal do Paraná
> Caixa Postal 19.081
> CEP 81.531-990
> Curitiba, PR  -  Brasil
> Tel: (+55) 41 3361 3573
> Fax: (+55) 41 3361 3141
> e-mail: [hidden email]
> http://www.est.ufpr.br/~paulojus

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html