[R] [R ] Query : problems with the arithmetic operator "^" with function "lme" and "lmList"

Carlos Ortega carlos.ortega at minorplanet.com
Wed May 7 14:56:58 CEST 2003


Hello,

Check also function "AsIs"  ( Usage:  I(x) ).

Regards,
Carlos.


-----Mensaje original-----
De: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] En nombre de Bashir Saghir
(Aztek Global)
Enviado el: miércoles, 07 de mayo de 2003 14:33
Para: 'MARTIN  Ludovic'
CC: 'r-help at stat.math.ethz.ch'
Asunto: RE: [R] [R ] Query : problems with the arithmetic operator "^"
with function "lme" and "lmList"


Dear Martin,

Have you try to create a new variable for age squared, say agesq? If you
fit the model using this new variable you should get the coefficients.
So your new model is something like height~age+agesq

I hope this helps,
Saghir



> -----Original Message-----
> From:	MARTIN   Ludovic [SMTP:martinl at mathinfo.ens.univ-reims.fr]
> Sent:	Wednesday, 07 May, 2003 2:02 PM
> To:	r-help at stat.math.ethz.ch
> Subject:	[R] [R ] Query : problems with the arithmetic operator
"^"
> with function "lme" and "lmList"
> 
> Dear all,
> 
> I've got a problem in including square variables in lme and lmlist
> functions. I've tried to work on Oxboys data of Pinheiro and 
> Bates'book, which consist of the heights of 26 boys, each mesured on 
> nine different occasions :
> 
>  > Oxboys
> Grouped Data: height ~ age | Subject
>     Subject     age height Occasion
> 1         1 -1.0000 140.50        1
> 2         1 -0.7479 143.40        2
> 3         1 -0.4630 144.80        3
> 4         1 -0.1643 147.10        4
> 5         1 -0.0027 147.70        5
> ...
> 
> A quadratic model in "age" would be fit with lmList 
> (height~age+age^2,Oxboys).
> 
> We obtain:
>  
> > fm2Oxboys.lis<-lmList(height~age+age^2,Oxboys)
> > fm2Oxboys.lis
> Call:
>   Model: height ~ age + age^2 | Subject 
>    Data: Oxboys
> 
> Coefficients:
>    (Intercept)      age
> 10    130.2616 3.722915
> 26    137.9927 5.588783
> 25    139.2105 4.024081
> 9     138.1369 6.009057
> 2     142.8584 5.440176
> ...
> 19    164.5761 9.065620
> 4     165.0724 9.360561
> 
> Degrees of freedom: 234 total; 182 residual
> Residual standard error: 0.6598878
> 
> They are not coefficients associated with the covariate "age^2" !
> However, the model called is " Height~age+age^2 | Subject " .
> 
> I would be grateful if anyone could help me.
> 
> Cordially,
> 
> Martin Ludovic.
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list 
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> 
> 
--------------------------------------------------------- 
Legal Notice: This electronic mail and its attachments are inten... {{dropped}}




More information about the R-help mailing list