[R-sig-ME] gls and lme?

Christoph Scherber Christoph.Scherber at agr.uni-goettingen.de
Fri Apr 13 09:04:58 CEST 2012


Dear Charles,

Your error comes because your lme model needs to have a random component.

You need to make sure that your correlation structure and your random 
effects structure match exactly:

fit.10=lme(met~group+Event_name+
	survival+group*Event_name,
	random=~1|ID,
	data=set1,
	corr=corSymm(form=~1|ID),
	weights=varIdent(form=~1|Event_name))

Best wishes
Christoph



On 11.04.2012 18:12, Charles Determan Jr wrote:
> Greetings R users,
>
> I have been trying to generate a mixed model of some data and I have run
> into a stumble.  I am trying to do what sas refers to as 'unstructured'
> variance structure.  The comparable correlation structure in the nlme
> package is corSymm().  I am able to run it generally just fine but when I
> try unstructured I run into this problem.  I am able to run a gls() script
> but when I try and run the same thing with lme(), I get the error shown
> below.
>
> In the simplest form, the model that works perfectly is:
>
> fit.7=lme(met~group+Event_name+
>      Survival+group*Event_name,
>      data=set1,
>      random=~1|ID/Event_name)
>
> The random is structured because the set is nested data.  I have been
> trying to run an unstructured version.
>
>
>
> The gls() version using corSymm works but I didn't think this was still a
> mixed model but a general least squares model instead.
>
> fit.10=gls(met~group+Event_name+
>      survival+group*Event_name,
>      data=set1,
>      corr=corSymm(form=~1|ID),
>      weights=varIdent(form=~1|Event_name))
>
>
> The model I wish to fit is with lme()
>
> fit.10=lme(met~group+Event_name+
>      survival+group*Event_name,
>      data=set1,
>      corr=corSymm(form=~1|ID),
>      weights=varIdent(form=~1|Event_name))
>
> Error in lme.formula(met ~ group + Event_name + survival + group *  :
>    Incompatible formulas for groups in "random" and "correlation"
> Done.
>
> Is there some syntax I have mistaken or coded incorrectly?  Why is it that
> the lme() script doesn't work?  Any general advice is appreciated.
>
> Charles
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>



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