[R] Help with mixed effects models

Spencer Graves spencer.graves at pdf.com
Sat Jan 21 08:49:07 CET 2006

	  To understand an error message like you reported, someone recently 
suggested using "traceback()".  That's worth trying.  If that is not 
adequate, I've had good luck using "debug" to trace through code line by 
line.  With "lme", however, it's not completely transparent how to do 
that, because the function consists of only one line, 
'UseMethod("lme")'.  The function 'methods("lme")' gives us the following:

[1] lme.formula      lme.groupedData* lme.lmList

This tells us that 'UseMethod("lme")' calls 'lme.formula' if the first 
argument is of class 'formula', which covers your example.  You can then 
walk through the code line by line until you find the line that produces 
your error message.  Then you can study that statement by itself, read 
its documentation and try different things until you figure out what you 
need to make it do what you want.

	  If you had provided a replicable example, as suggested in the posting 
guide (www.R-project.org/posting-guide.html), I might have been able to 
help more -- or someone else might have answered your question sooner.

	  hope this helps,
	  spencer graves

Pryseley Assam wrote:

> Dear R-users
>   I have problems using lme
>   The model i want to fit can be viewed as a two-level bivariate model 
> Two-level bivariate: bivariate (S coded as -1,T coded as 1) endpoint within trial
>   OR
>   It can equivalently be considered as a three-level model.Three-level: endpoint within patient, patient within trial. 
> My code tries to model the levels through a RANDOM statement and a within group correlation structure.
> ----------------------------------------------------------------------------------------------------------
> Now then, i used the following R code:
>   bm <- lme (outcome~ -1 + as.factor(endpoint)+ as.factor(endpoint):trt, data=datt,
>        random=~-1 + as.factor(endpoint) + as.factor(endpoint):trt |as.factor(Trial),
>        corr = corSymm(form~-1+as.factor(endpoint)|trial/subject))
> I beleive the fixed effects part of the code is okay. My intention for the 
random effects part is to estimate an intercept and treatment effect for 
endpoint at the trial level. The correlation structure should produce a 
correlation matrix for the enpoints at the subject level.
>   Thus the random effects matrix is 4 by 4 and the within correlation matrix is 2 by 2
>   When i run the code in R, i get the following error message
>   "Error in Initialize.corSymm(X[[2]], ...) : 
>         Initial value for corSymm parameters of wrong dimension"
>   I hope someone will correct my codes .
>   Kind regards
>   Pryseley
> ---------------------------------
>  Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.
> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-help at 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

More information about the R-help mailing list