MATLAB Answers


How to keep a Fixed Effect constant in NLMEFIT and NLMEFITSA?

Asked by Andres
on 1 Jul 2012
Hi everyone
I'm following the example for NLMEFIT (<>),
and I would like to know if there is any way to keep the some of the beta parameters constant. in the example, they set beta0 = [100 100 100]; but the algorithm estimates all three and gives a final beta=[191.3189 723.7608 346.2517]. My idea is to estimate 2 of the parameters, but the other keep it equal to it's initial value.
I would also like to fix the variance of some of the parameters, anyone knows how to do that? In the example they explain how to set variance to 0 for one parameter, but what if I want an specific variance for a certain parameter?
Thanks in advance.
Use an anonymous function to specify a logistic growth model:
Fit the model using nlmefit with default settings (that is, assuming each parameter is the sum of a fixed and a random effect, with no correlation among the random effects):
TIME = repmat(time,5,1);
NUMS = repmat((1:5)',size(time));
beta0 = [100 100 100];
[beta1,PSI1,stats1] = nlmefit(TIME(:),CIRC(:),NUMS(:),... [],model,beta0)
beta1 = 191.3189 723.7608 346.2517
PSI1 = 962.1534 0 0 0 0.0000 0 0 0 297.9881
[beta2,PSI2,stats2,b2] = nlmefit(TIME(:),CIRC(:),... NUMS(:),[],model,beta0,'REParamsSelect',[1 3])
beta2 = 191.3194 723.7628 346.2548
PSI2 = 962.2114 0 0 298.3989
b2 = -28.5250 31.6063 -36.5070 39.0735 -5.6479 10.0097 -0.7638 6.0117 -9.4685 -5.7892


Sign in to comment.

1 Answer

Answer by Tom Lane
on 1 Jul 2012

I can't think of any way to fix the variance. To fix a parameter value, I suppose you could write a new function
newmodel=@(PHI,t) model([PHI(:,1),10*ones(size(PHI,1),1),PHI(:,3)],t)
I have not tried this out, so please forgive any typos -- just hoping this gives you an idea.


Hi Tom, thanks for your answer.
I was thinking in something like that too... but I'm intrigued because I cannot figure out then what is the functionality of having 'FEParamsSelect' 'FEConstDesign' 'FEGroupDesign' (and their RE counterparts). So far all I can see is that FEConstDesign can be used to add covariates and REParamsSelect can be used to set the variance of a parameter to zero. But I thought that somehow FEParamsSelect would be similar to REParamsSelect and allow me to tell NLMEFITSA to not estimate some parameter.
You are right, I believe. You could use FEParamsSelect to prevent estimating a fixed effect for a parameter. Then if you wrote the function using "(10+PHI(:,1))" in place of PHI(:,1), I suppose you would in essence be forcing the parameter to take the value 10. Good idea. Until now I had always thought of FEParamsSelect as providing the ability to do the relatively unusual thing of estimating a parameter as a random effect with a mean set exactly to zero, but your idea provides a better use for it.

Sign in to comment.