Description Usage Arguments Details Value Author(s) References Examples
Fits cumulative link mixed models, i.e. cumulative link models with
random effects via the Laplace approximation or the standard and the
adaptive Gauss-Hermite quadrature approximation. The functionality in
clm2
is also implemented here. Currently only a single
random term is allowed in the location-part of the model.
A new implementation is available in clmm
that allows
for more than one random effect.
1 2 3 4 5 6 | clmm2(location, scale, nominal, random, data, weights, start, subset,
na.action, contrasts, Hess = FALSE, model = TRUE, sdFixed,
link = c("logistic", "probit", "cloglog", "loglog",
"cauchit", "Aranda-Ordaz", "log-gamma"), lambda,
doFit = TRUE, control, nAGQ = 1,
threshold = c("flexible", "symmetric", "equidistant"), ...)
|
location |
as in |
scale |
as in |
nominal |
as in |
random |
a factor for the random effects in the location-part of the model. |
data |
as in |
weights |
as in |
start |
initial values for the parameters in the format
|
subset |
as in |
na.action |
as in |
contrasts |
as in |
Hess |
logical for whether the Hessian (the inverse of the observed
information matrix) should be computed.
Use |
model |
as in |
sdFixed |
If |
link |
as in |
lambda |
as in |
doFit |
as in |
control |
a call to |
threshold |
as in |
nAGQ |
the number of quadrature points to be used in the adaptive
Gauss-Hermite quadrature approximation to the marginal
likelihood. Defaults to |
... |
additional arguments are passed on to |
There are methods for the standard model-fitting functions, including
summary
, vcov
,
profile
,
plot.profile
,
confint
,
anova
, logLik
,
predict
and an extractAIC
method.
A Newton scheme is used to obtain the conditional modes of the random
effects for Laplace and AGQ approximations, and a non-linear
optimization is performed over the fixed parameter set to get the
maximum likelihood estimates.
The Newton
scheme uses the observed Hessian rather than the expected as is done
in e.g. glmer
, so results from the Laplace
approximation for binomial fits should in general be more precise -
particularly for other links than the "logistic"
.
Core parts of the function are implemented in C-code for speed.
The function calls clm2
to up an
environment and to get starting values.
If doFit = FALSE
the result is an environment
representing the model ready to be optimized.
If doFit = TRUE
the result is an
object of class "clmm2"
with the following components:
stDev |
the standard deviation of the random effects. |
Niter |
the total number of iterations in the Newton updates of the conditional modes of the random effects. |
grFac |
the grouping factor defining the random effects. |
nAGQ |
the number of quadrature points used in the adaptive Gauss-Hermite Quadrature approximation to the marginal likelihood. |
ranef |
the conditional modes of the random effects, sometimes referred to as "random effect estimates". |
condVar |
the conditional variances of the random effects at their conditional modes. |
beta |
the parameter estimates of the location part. |
zeta |
the parameter estimates of the scale part on the log
scale; the scale parameter estimates on the original scale are given
by |
Alpha |
vector or matrix of the threshold parameters. |
Theta |
vector or matrix of the thresholds. |
xi |
vector of threshold parameters, which, given a
threshold function (e.g. |
lambda |
the value of lambda if lambda is supplied or estimated, otherwise missing. |
coefficients |
the coefficients of the intercepts
( |
df.residual |
the number of residual degrees of freedoms, calculated using the weights. |
fitted.values |
vector of fitted values conditional on the values
of the random effects. Use |
convergence |
|
gradient |
vector of gradients for the unit-variance random effects at their conditional modes. |
optRes |
list with results from the optimizer. The contents of the list depends on the choice of optimizer. |
logLik |
the log likelihood of the model at optimizer termination. |
Hessian |
if the model was fitted with |
scale |
|
location |
|
nominal |
|
edf |
the (effective) number of degrees of freedom used by the model. |
start |
the starting values. |
method |
character, the optimizer. |
y |
the response variable. |
lev |
the names of the levels of the response variable. |
nobs |
the (effective) number of observations, calculated as the sum of the weights. |
threshold |
character, the threshold function used in the model. |
estimLambda |
|
link |
character, the link function used in the model. |
call |
the matched call. |
contrasts |
contrasts applied to terms in location and scale models. |
na.action |
the function used to filter missing data. |
Rune Haubo B Christensen
Agresti, A. (2002) Categorical Data Analysis. Second edition. Wiley.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | options(contrasts = c("contr.treatment", "contr.poly"))
## More manageable data set:
dat <- subset(soup, as.numeric(as.character(RESP)) <= 24)
dat$RESP <- dat$RESP[drop=TRUE]
m1 <- clmm2(SURENESS ~ PROD, random = RESP, data = dat, link="probit",
Hess = TRUE, method="ucminf", threshold = "symmetric")
m1
summary(m1)
logLik(m1)
vcov(m1)
extractAIC(m1)
anova(m1, update(m1, location = SURENESS ~ 1, Hess = FALSE))
anova(m1, update(m1, random = NULL))
## Use adaptive Gauss-Hermite quadrature rather than the Laplace
## approximation:
update(m1, Hess = FALSE, nAGQ = 3)
## Use standard Gauss-Hermite quadrature:
update(m1, Hess = FALSE, nAGQ = -7)
##################################################################
## Binomial example with the cbpp data from the lme4-package:
if(require(lme4)) {
cbpp2 <- rbind(cbpp[,-(2:3)], cbpp[,-(2:3)])
cbpp2 <- within(cbpp2, {
incidence <- as.factor(rep(0:1, each=nrow(cbpp)))
freq <- with(cbpp, c(incidence, size - incidence))
})
## Fit with Laplace approximation:
fm1 <- clmm2(incidence ~ period, random = herd, weights = freq,
data = cbpp2, Hess = 1)
summary(fm1)
## Fit with the adaptive Gauss-Hermite quadrature approximation:
fm2 <- clmm2(incidence ~ period, random = herd, weights = freq,
data = cbpp2, Hess = 1, nAGQ = 7)
summary(fm2)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.