Dear R-expert I'm fitting a non linear model (energy allocation model to individual growth data) using your nlme routine. For each individual I have thus a number of observations (age and size) to which I fit the nonlinear function, with random effects for the individuals on the estimated parameters (individual as the grouping factor). The sampling of these individuals was stratified (size stratified) and the observations are thus not representative for the population. But as we know the true size distributions over the strata, we can compute a statistical weight for each individual, given by the frequency of the size at age of that individual in the true population distribution. To obtain representative estimates in the nlme, I would therefore preferably weight the fitting by these statistical weights. In each group (which is the individual) a different weighting factor would apply (I guess that the individual estimation will not be much affected by these weights, but the population mean). I don't quite see how to do this weighting by nlme-group. I think what I need is something that multiplies these weights to the residual variance. My first hint would be something as it is described by the function varIdent or varFixed, but it is not quite clear to me what is being done by these (e.g. what is meant by variance covariate etc.?). I thank you very much in advance if you could briefly comment on that and point out the function for the weighting that should be applied. All the best Fabian Mollet [[alternative HTML version deleted]]
Mollet, Fabian <Fabian.Mollet <at> wur.nl> writes:> I'm fitting a non linear model (energy allocation model to individual > growth data) using your nlme routine. For each individual I have thus a > number of observations (age and size) to which I fit the nonlinear > function, with random effects for the individuals on the estimated > parameters (individual as the grouping factor). The sampling of these...> I think what I need is something that multiplies these weights to the > residual variance. My first hint would be something as it is described > by the function varIdent or varFixed, but it is not quite clear to me > what is being done by these (e.g. what is meant by variance covariate > etc.?).In most other R regression packages, most notably lm, weights works the way you think it should, but the philosophy is different in lme, where a function is executed to compute weights, for example to handle heteroscedasticity. I found this strange in the beginning, but as often Douglas Bates has a hidden agenda telling his users: don't do that. Don't average first and it later, use the raw data instead, and all the weights will be correct. And use the liberated parameter for more important things. Dieter