问题
I am not understanding how does profile
work in lmer ? Sometimes it gives exactly same number of values as total number of observations, and sometimes fewer or higher than total number of observations. Also what is .zeta
in the output of profile?
(2) Again
pp <- profile(fitted,"theta_",quiet=TRUE)#fitted is a fitted model
is giving values for every random and fixed effects, but
cc <- confint(pp)
is producing confidence interval for only variance-components. Why ?
In ?profile
documentation, I didn't get the option quiet
. How does quiet
work ?
(3) Is there any advantage to run the command
confint(profile(fitted))
rather than running confint(fitted)
.
Thanks in advance.
回答1:
To give a reproducible example:
library("lme4")
fm1 <- lmer(Reaction~Days+(Days|Subject),sleepstudy)
Sometimes it [
profile
] gives exactly same number of values as total number of observations, and sometimes fewer or higher than total number of observations.
I'm not sure what that means.
Also what is
.zeta
in the output of profile?
The .zeta
column is the signed square root of the difference from the minimum deviance.
Specifying no value for which
(profile
) or parm
(confint
) profiles/gives CIs for all parameters; specifying "theta_"
only gives results for random effects variance-covariance and residual variance (if any).
## all parameters (random and fixed)
pp0 <- profile(fm1)
levels(pp0$.par)
## [1] "Days" "(Intercept)" ".sig01" ".sig02" ".sig03"
## [6] ".sigma"
# random effects only
pp1 <- profile(fm1,which="theta_")
levels(pp1$.par)
## [1] ".sig01" ".sig02" ".sig03" ".sigma"
Similarly for confint()
:
## all parameters
cc0 <- confint(pp0)
rownames(cc0)
## [1] ".sig01" ".sig02" ".sig03" ".sigma" "(Intercept)"
## [6] "Days"
## random-effects parameters only
cc1 <- confint(pp1)
## [1] ".sig01" ".sig02" ".sig03" ".sigma"
The quiet
parameter is for confint()
(not profile()
). By default, applying confint()
directly to a fitted model issues a message
Computing profile confidence intervals ...
to warn the user that a computationally intensive/slow process is taking place. Using quiet=TRUE
suppresses this message.
The Note in ?confint.merMod
says:
The default method ‘"profile"’ amounts to
confint(profile(object, which=parm), signames=oldNames, ...), level, zeta)
where the ‘profile’ method ‘profile.merMod’ does almost all the computations. Therefore it is typically advisable to store the profile(.) result, say in ‘pp’, and then use ‘confint(pp, level=*)’ e.g., for different levels.
In other words, if you are going to want to do anything else with the profile information (plot profiles, or compute confidence intervals for more than one alpha-level) it is more efficient to compute the profile and store it, rather than repeatedly computing the profile. If all you want are the default 95% confidence intervals then you might as well use confint(fitted_model)
.
来源:https://stackoverflow.com/questions/31944611/profile-for-mermod-objects-lme4