[R-sig-ME] nlme

Douglas Bates bates at stat.wisc.edu
Tue Mar 30 15:51:14 CEST 2010


May I suggest sending inquiries like this to the
R-SIG-Mixed-Models at R-project.org mailing list.  I have taken the
liberty of cc:'ing the list on this reply.


On Tue, Mar 30, 2010 at 3:21 AM, TOPPET Valérie <valerie.toppet at unine.ch> wrote:
> Dear  Mr Bates,
>
>
> I'm working with the Mixed-Effects Models, and i have some questions about the code in the package  NLME:
>
> I have to test the effect of a food additive(XTract) on the production of dairy cow(AvgYield)
> I have several races(breed4) , i coded the race as a categorical variable.
> I want to isolate the effect of the treatment on every level of the categorical variable?
>
>
> 1)Is the following code correct ?Would you give me more information about this codification?
>
>
> model1 <- lme(AvgYield~XTract+NPrevLac+WIM0cat+Tot2007+breed4+Age0+ XTract:(NPrevLac+WIM0cat+Tot2007+breed4+Age0)+I(Time-12)+  I(Time-12):(XTract+NPrevLac+WIM0cat+Tot2007+breed4+Age0)+
>  I(Time-12):XTract:(NPrevLac+WIM0cat+Tot2007+breed4+Age0),
>  data=nomiss,random=~I(Time-12)|Cow,method="ML", control=list(msMaxIter=100,opt= "optim"))
>
>
>  model10 <- update(model1,
>  AvgYield~XTract+WIM0cat+Tot2007+Age0+ I(XTract==1 & breed4=="Holstein")+ I(XTract==1 & breed4=="Jersey")+
>  I(Time-12)+ I(Time-12):(XTract+NPrevLac+WIM0cat+Tot2007+Age0)+ I(I(Time-12)&breed4=="Holstein")+ I(I(Time-12)&breed4=="Jersey")+ I(I(Time-12)&breed4=="OTHER"))
>
> 2)Why  the model10's deviance is smaller than the model1's deviance in spite of the fact that the model 1 is the most complex model? Normally it should be the opposite?
> The model with more parameters is supposed to fit better the data?
>
>
>
>
>                        Model       df      AIC                     BIC                   logLik                               Test  L.Ratio      p-value
> model1             1              44     49290.05           49619.54          -24601.03
> model10           2              24     48785.30           48965.02          -24368.65 1       vs 2       464.7512            <.0001
>
>
>
>
> Thanks for the information.
>
> Valérie Toppet
>
>
>
>
>
>
>
>
>
>




More information about the R-sig-mixed-models mailing list