Hi, Dieter,

> sessionInfo()
R version 2.9.0 (2009-04-17)
i386-pc-mingw32

> str(cov)
'data.frame':   40 obs. of  13 variables:
 $ ID       : int  2 3 4 5 6 7 8 9 10 11 ...
 $ AMT      : num  50 50 50 50 50 50 50 50 25 25 ...
 $ Cmax     : num [1:40(1d)] 8901 5574 10496 10882 8130 ...
  ..- attr(*, "dimnames")=List of 1
  .. ..$ ID: chr  "2" "3" "4" "5" ...
 $ biomarker: num  3817 2542 5127 4478 3362 ...
 $ CRCL     : num  29.2 44.5 65.5 57.1 63.3 ...
 $ SEX      : chr  "male" "male" "male" "male" ...
 $ WT       : num  79.7 86.4 80.5 55.2 83.8 ...
 $ AGE      : int  48 21 20 61 67 24 60 36 23 22 ...
 $ AGE2     : num  0 0 0 1 1 0 1 0 0 0 ...
 $ SEX2     : num  1 1 1 1 1 0 1 0 0 0 ...
 $ AGE3     : num  1 0 0 1 1 0 1 1 0 0 ...
 $ CRCL2    : num  0 1 1 1 1 1 1 1 1 1 ...
 $ WT2      : num  0 0 0 0 0 0 0 1 0 1 ...

>lme(biomarker~Cmax+AGE,data=cov,method='ML',random=~1+AGE|ID,keep.data=T)->mod.lme2
Warning message:
In lme.formula(biomarker ~ Cmax + AGE, data = cov, method = "ML",  :
  Fewer observations than random effects in all level 1 groups

> stepAIC(mod.lme2,scope=list(upper=~Cmax+AGE+SEX2+WT+CRCL,lower=~1+Cmax))
Start:  AIC=637.53
biomarker ~ Cmax + AGE

Error in terms.formula(formula, data = data) :
  'data' argument is of the wrong type

I also wonder if stepAIC tests random effect to each covariate (e.g. AGE,
WT, CRCL...)

Thanks.

Jun

On Thu, May 7, 2009 at 11:37 AM, Dieter Menne
<dieter.menne@menne-biomed.de>wrote:

> Jun Shen <jun.shen.ut <at> gmail.com> writes:
>
> > I changed the "method" to ML for my lme call. Now I get a different error
> > when running the stepAIC
> >
> > Error in terms.formula(formula, data = data) :
> >   'data' argument is of the wrong type
> >
> > What does that mean?
> > The same dataset was used for an lm call and everything is fine to run
> > stepAIC.
>
> Show sessionInfo() (do you have the recent version?)
>
> Show str(yourdataset)
>
> Show lme(.... your formula)
>
> Dieter
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]


