[R-sig-ME] lmer model and mcmcsamp

Emma Jones stp08emj at sheffield.ac.uk
Wed Feb 23 11:31:25 CET 2011


Hi,

I am new to using the package lme4 and wondered if anyone can help me? I
have fitted a model (note the data is unbalanced)- see below with the
results:

> a=lmer(RW~1+(1|Year),chron,na.action=na.omit)
> a
Linear mixed model fit by REML
Formula: RW ~ 1 + (1 | Year)
   Data: chron
  AIC  BIC logLik deviance REMLdev
 8771 8790  -4383     8761    8765
Random effects:
 Groups   Name        Variance Std.Dev.
 Year     (Intercept) 0.48050  0.69318
 Residual             0.52704  0.72598
Number of obs: 3719, groups: Year, 239

Fixed effects:
            Estimate Std. Error t value
(Intercept) -0.02793    0.04803 -0.5815


This I am happy with and I know is correctly fitted- my problems don't
lie here.

What I would ideally like now is to produce 95% credible intervals on
the variance components. I have found some code on a help sheet online
and followed this...

samp=mcmcsamp(a,n=10000)
#gives a credible interval for mcmc
HPDinterval(VarCorr(samp,type="varcov"),prob=0.95)
         lower     upper
[1,] 0.1958900 0.2678522
[2,] 0.5317379 0.5853902
attr(,"Probability")
0.95

As it can be seen, both of my point estimates lie outside the credible
interval.

I am confused by this, can anyone advise??

Many thanks in advance,
Emma




More information about the R-sig-mixed-models mailing list