[R-sig-ME] How obtain the estimated scale parameter as in older lmer function version

Douglas Bates bates at stat.wisc.edu
Mon May 31 00:03:21 CEST 2010


On Sat, May 29, 2010 at 5:23 PM, walmes zeviani
<walmeszeviani at yahoo.com.br> wrote:
> Hello,
>
> I read the article based on lme4
>
> Doran H, Bates D, Bliese P, Dowling M (2007). “Estimating the Multilevel Rasch Model: With
> the lme4 Package.” Journal of Statistical Software, 20(2). URL http://www.jstatsoft.
> org/v20/i02/.
>
> and I saw that the print of 'mer' class showed a estimated scale parameter. Nowadays, the print doesn't show this. I tried calculate by myself employing Pearson residuals and deviance() function but this didn't match the same result. In the article there was this output:
>
> R> data("lq2002", package = "multilevel")
> R> wrk <- lq2002
> R> for (i in 3:16) wrk[[i]] <- ordered(wrk[[i]])
> R> for (i in 17:21) wrk[[i]] <- ordered(5 - wrk[[i]])
> R> lql <- reshape(wrk, varying = list(names(lq2002)[3:21]),
> +     v.names = "fivelev", idvar = "subj", timevar = "item",
> +     drop = names(lq2002)[c(2, 22:27)], direction = "long")
> R> lql$itype <- with(lql, factor(ifelse(item < 12, "Leadership",
> +     ifelse(item < 15, "Task Sig.", "Hostility"))))
> R> for (i in c(1, 2, 4, 5)) lql[[i]] <- factor(lql[[i]])
> R> lql$dichot <- factor(ifelse(lql$fivelev < 4, 0, 1))
>
> R> (fm1 <- lmer(dichot ~ 0 + itype + (1 | subj) + (1 | COMPID) +
> +     (1 | item), lql, binomial))
> Generalized linear mixed model fit using Laplace
> Formula: dichot ~ 0 + itype + (1 | subj) + (1 | COMPID) + (1 | item)
>   Data: lql
>  Family: binomial(logit link)
>   AIC   BIC logLik deviance
>  40722 40773 -20355    40710
> Random effects:
>  Groups Name        Variance Std.Dev.
>  subj   (Intercept) 2.30528 1.51831
>  COMPID (Intercept) 0.25449 0.50447
>  item   (Intercept) 0.37700 0.61400
> number of obs: 38798, groups: subj, 2042; COMPID, 49; item, 19
>
> Estimated scale (compare to  1 )  0.9386558  #<---------------------------- this!

That quantity is the square root of the penalized residual sum of
squares divided by n, the number of observations, evaluated as

> sqrt(sum(c(fm1 at resid, fm1 at u)^2)/length(fm1 at resid))
[1] 0.9386649

> Fixed effects:
>                Estimate Std. Error z value Pr(>|z|)
> itypeHostility    1.6721     0.2883   5.801 6.6e-09
> itypeLeadership  -0.4921     0.2036 -2.417    0.0157
> itypeTask Sig.   -0.1308     0.3654 -0.358    0.7203
> Correlation of Fixed Effects:
>            itypHs itypLd
> itypeLdrshp 0.117
> itypeTskSg. 0.066 0.093
>
> My actual output is:
>
>> fm1
> Generalized linear mixed model fit by the Laplace approximation
> Formula: dichot ~ 0 + itype + (1 | subj) + (1 | COMPID) + (1 | item)
>   Data: lql
>   AIC   BIC logLik deviance
>  40722 40773 -20355    40710
> Random effects:
>  Groups Name        Variance Std.Dev.
>  subj   (Intercept) 2.30573  1.51846
>  COMPID (Intercept) 0.25416  0.50415
>  item   (Intercept) 0.37488  0.61227
> Number of obs: 38798, groups: subj, 2042; COMPID, 49; item, 19
>
> Fixed effects:
>                Estimate Std. Error z value Pr(>|z|)
> itypeHostility    1.6774     0.2875   5.834  5.4e-09 ***
> itypeLeadership  -0.4928     0.2031  -2.426   0.0153 *
> itypeTask Sig.   -0.1362     0.3644  -0.374   0.7086
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
> Correlation of Fixed Effects:
>            itypHs itypLd
> itypeLdrshp 0.118
> itypeTskSg. 0.066  0.093
>> sum(residuals(fm1, type="pearson")^2)/(nrow(lql)-3-3)
> [1] 0.8399116
>> deviance(fm1)/(nrow(lql)-3-3)
>      ML
> 1.049437
>>
>
> As you can see, I can't figure out the estimated scale parameter. How can I get it? Why was this information removed from the output in newer versions of the function?
>
> Thanks in advance.
>
>
>
>
>        [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
>




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