Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

mixed-effects models (nlmefit)

155 views
Skip to first unread message

Rogelio

unread,
May 9, 2009, 4:40:18 PM5/9/09
to
Hi,
Im using the nlmefit function for mixed effects models. Im trying to replicate some parameter estimations from a book (using same data set) but I do not get the same results, they are slightly different. I belive it is due some different specification of the model, where can I find examples of this function??? I have read the "idomethacin" example and the one about the "treegrowth" but they dont explain all different options available in the nlmefit function.
Any help will be appreciated!

Lucio Cetto

unread,
May 11, 2009, 9:21:01 AM5/11/09
to
Slight variations may be due to the tolerance of the algorithm, you set the tolerance using 'options' and 'statset'. What is the example that you are trying to replicate? I may be able to further assits you.
Lucio

"Rogelio" <rogelio.a....@student.bi.no> wrote in message <gu4pni$k0p$1...@fred.mathworks.com>...

Rogelio

unread,
May 11, 2009, 4:43:01 PM5/11/09
to
"Lucio Cetto" <lce...@nospam.mathworks.com> wrote in message <gu98nt$lrh$1...@fred.mathworks.com>...

Hi,
I have tried to specify 'Options' usig the statset and didnt work the nlmefit function. I can specify 'CovPattern','Covparameterization', 'ApproximationType' and 'OptimFun' but not 'Options'. I have wirtten options = statset('MaxIter',350,'TolX',1e-8), for example, and I can see that the structure has changed to the new values and then I write in the nlmefit function 'options' and doesnt work (I have tried with and without ' ' ) what Im doing wrong?

How can I get the covariance matrix for the fixed effects? Under stats I just get the standard errors for beta but if I want the covariance matrix of the coefficients??

The example that I want to replicate is from the book Applied Longitudinal Analysis of Fitzmaurice, Laird and Ware. You are right about the sligthly different results, but for some parameters (inside the same model) I can see that the difference is relatively bigger.

Thank you for helping me!

Lucio Cetto

unread,
May 12, 2009, 8:55:04 AM5/12/09
to
I am afraid I do not have such book, anyways here are some hints:

to use statset do:
options = statset('nlmefit')
options = statset(options,'MaxIter',350,'TolX',1e-8)
and then
nlmefit(x,y,grp,[],f,Beta0,'CovPat',CovPattern,'Options',options)

when doing mixed effects it is very easy to overparametrize the covariance structure, so make sure that you start with 'CovPat' set to eye(number of random effects).

Also trying to reduce the number of random effects in your model ('FEParamsSelect'), perhaps start with only one.

I recommend start with approximation type set to 'LME' and once you have a relative good idea of the covariance structure try FOCE for a more accurate estimation.

I am not sure what is what you mean to the "Covariance Matrix for the Fixed effects", are you refering to PSI? the second output of the function?

Feel free to send me your current 'm' file to my e-mail, I can take a look.

Lucio

Rogelio

unread,
May 12, 2009, 9:38:01 AM5/12/09
to
Thank you for the explenation about how to specify 'options'.

The covariance matrix that I mean is cov(B)={X'*COV*X)}^-1 (subscripts are missing). Where B is betahat (the estimated fixed effects), X must have a subscript i (where i indicates individuals) and is the design matrix and COV is the covarinace matrix of the response variable which is multinormal.
PSI is the covariance matrix for the random effects (b) but what about if I want the covariance matrix of the fixed effects (B). I dont know how to use R but in R you get the correlation matrix for the fixed effects.

Thank you again for your help

"Lucio Cetto" <lce...@nospam.mathworks.com> wrote in message <gubrj7$7r8$1...@fred.mathworks.com>...

Rogelio

unread,
May 12, 2009, 11:51:01 AM5/12/09
to
Hi Lucio,
I have managed to get the covariance matrix for the fixed effects parameters. In the example that Im working out, it turns out that the task is relatively 'easy'. However, It might be the case that the task, as I solve it, turns out to be, computationally, more difficult. I hope that it exists another solution. Let me write a bit more elegant my code and explain what Im doing on it and I can send it to you so you can see how I get the covariance matrix for fixed effects and see if you can help me to do it easier.
Rogelio
_____________________________________________________________

"Rogelio" <rogelio.a....@student.bi.no> wrote in message <gubu3p$53o$1...@fred.mathworks.com>...

0 new messages