From: Marc Schwartz <MSchwartz_at_medanalytics.com>

Date: Sun 27 Mar 2005 - 07:37:31 EST

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sun Mar 27 07:42:09 2005

Date: Sun 27 Mar 2005 - 07:37:31 EST

On Sat, 2005-03-26 at 22:21 +0100, Montse Rue wrote:

> I tried to replicate in R the example that Pinheiro and Bates present

*> on section 1.5 of their mixed-effects book, the pixel intensity
**> example.
**>
**> > fm1Pixel<-lme(pixel~day+day^2,data=Pixel,random=list(Dog=~day,Side=~1))
**>
**> When I run it in R the second order term does not appear in the
**> estimated model. But, when I write
**>
**> > fm1Pixel<-lme(pixel~day+I(day^2),data=Pixel,random=list(Dog=~day,Side=~1))
**>
**> I get the same results as in the Pinheiro and Bates book, and the plot
**> of the augPred values is a quadratic function as in Figure 1.18. The
**> same happens with my data when I use the I(alcadakm^2) .
**>
**> Can it be that S accepts day^2 but R doesn't?
**>
**> Thanks again!
**>
**> Montse
*

<SNIP of prior exchange>

As per the main R FAQ "3.3.2 Models":

There are some differences in the modeling code, such as

- Whereas in S, you would use lm(y ~ x^3) to regress y on x^3, in R, you have to insulate powers of numeric vectors (using I()), i.e., you have to use lm(y ~ I(x^3))

Please read the FAQ's when comparing R and S[-PLUS] as this is but one of the important differences:

http://cran.r-project.org/doc/FAQ/R-FAQ.html#R-and-S

Marc Schwartz

R-help@stat.math.ethz.ch mailing list

https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sun Mar 27 07:42:09 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:30:56 EST
*