[R] Problem with logtrans, from library MASS

Peter Dalgaard p.dalgaard at biostat.ku.dk
Fri May 14 11:36:44 CEST 2004


Murray Jorgensen <maj at stats.waikato.ac.nz> writes:

> Greetings all!
> 
> This problem occurs using R 1.8.1 on Windows XP. I downloaded the
> binaries for R and all packages, including the VR bundle, in December
> 2003.
> 
> The data consists of NZ$ prices and attributes for 643 cars.
> 
>  > summary(price)
>     Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's
>    14290   35800   48990   65400   79000  285000       2
>  > library(MASS)
>  > boxcox(price ~ doors+CC+KW+KG+LENGTH, lambda=seq(-0.1,0.5,length=30))
>  > boxcox(price ~ doors+CC+KW+KG+LENGTH, lambda=seq(-0.5,0.1,length=30))
> 
> This all works fine, I get a fairly sharp peak near lambda=-0.25, but then:
> 
>  > logtrans(price ~ doors+CC+KW+KG+LENGTH, alpha=seq(-10000,0,length=30))
> Error in eval(expr, envir, enclos) : Object "price" not found
> 

The issue is that logtrans has a 'data' argument that defaults to NULL
(the author(s) may have a reason for having this inconsistent with
boxplot?). Adding data=.GlobalEnv seems to work.

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907




More information about the R-help mailing list