Hi all, I
am trying to run a linear mixed effect models in lmer() from the lme4
package using the weights option.
I am using the
R version 2.7.2 (2008-08-25) and lmer version in lme4_0.999375-26, which I
think it is the latest version!
I am getting and error message when I add the
option "weights" in the lmer function. This is the error message I
get "Error en mer_finalize(ans) : Calculated PWRSS for a LMM is
negative".
I have been
reading in the last few weeks all the forum questions and answers about this
issue. Certainly this has been discussed MANY times before especially with
older versions of lmer (much less in the newer versions). I have been trying
different things following peoples advice with not happy end, even I tried older
version of lmer where the weight option was not giving an error message but it
was not affecting the model at all, hoping maybe It did work some time in the
past.
This is an simple
example of one of my models with varying intercept and slope. I am
looking how
the mean size of fish has been changing over time in different stocks.
This is a simple model but it will get more complicated in the future.
I just need to make the option of weights to work before the model
becomes more complex.
MODEL WITH
NO WEIGHTS
> M1<- lmer(meansize_scaled~year + (year |stock ), data=cas) # two
levels
>
> M1
Linear
mixed model fit by REML
Formula:
meansize_scaled ~ year + (year | stock)
Data: cas
AIC
BIC logLik deviance REMLdev
-2777 -2742
1395 -2807 -2789
Random
effects:
Groups
Name Variance Std.Dev.
Corr
stock
(Intercept) 1.0964e-02 0.1047097
year 3.2435e-06 0.0018010 -0.273
Residual 2.0193e-02 0.1421010
Number of
obs: 2692, groups: stock, 9
Fixed
effects:
Estimate Std. Error t value
(Intercept)
0.4869771 0.0360736 13.500
year 0.0001034 0.0006642
0.156
Correlation
of Fixed Effects:
(Intr)
year -0.341
>
MODEL WITH
WEIGHTS.
>
M2<- lmer(meansize_scaled~year + (year |stock ), data=cas,
weights=N_fish) # two level model
Error en
mer_finalize(ans) : Calculated PWRSS for a LMM is negative
As you see above I get the message error.
I read read
read in the [R] and [R-sig-ME] and I did not get any clear solutions to the
weight problem in lmer. My feeling is that the weight option in lmer just not
work! At least at the present time, maybe in the future it will change.
Can anybody
share with me how they have deal with this issue?
Should I
give up with lmer and try to do this analysis using other tools? maybe try to
learn the function lme from nlme package?
I just
would like to know if I need to give up with weight option in lmer or if I am
missing something obvious but I did not find it yet.
I want to emphasize that I really appreciate all the hard work of everybody
(specially Douglas Bates)
for always working hard answering everybody´s questions and improving the lmer
function!!
SincerelyMaria
>))):) >))):) >))):) >))):) >))):) >))):)
>))):) >))):)
Maria Jose Juan Jorda
Phd Student
AZTI - Tecnalia / Unidad de Investigación Marina
Herrera Kaia Portualde z/g
20110 Pasaia, Gipuzkoa, Spain
Recursos Marinos y Pesquerias
Depart. Biologia Animal, Vegetal y Ecologia
Universidade A Coruña
Campus A Zapateira s/n
15071, A Coruña, Spain
Tel. +34981167000 ext. 2204
Fax. +34981167065
mjuanjorda@faneca.net
_________________________________________________________________
[[elided Hotmail spam]]
[[alternative HTML version deleted]]