olmm-methods {vcrpart} | R Documentation |
Methods for olmm
objects
Description
Standard methods for computing on olmm
objects.
Usage
## S3 method for class 'olmm'
anova(object, ...)
## S3 method for class 'olmm'
coef(object, which = c("all", "fe"), ...)
## S3 method for class 'olmm'
fixef(object, which = c("all", "ce", "ge"), ...)
## S3 method for class 'olmm'
model.matrix(object, which = c("fe", "fe-ce", "fe-ge",
"re", "re-ce", "re-ge"), ...)
## S3 method for class 'olmm'
neglogLik2(object, ...)
## S3 method for class 'olmm'
ranef(object, norm = FALSE, ...)
## S3 method for class 'olmm'
ranefCov(object, ...)
## S3 method for class 'olmm'
simulate(object, nsim = 1, seed = NULL,
newdata = NULL, ranef = TRUE, ...)
## S3 method for class 'olmm'
terms(x, which = c("fe-ce", "fe-ge", "re-ce", "re-ge"), ...)
## S3 method for class 'olmm'
VarCorr(x, sigma = 1., ...)
## S3 method for class 'olmm'
weights(object, level = c("observation", "subject"), ...)
Arguments
object , x |
an |
which |
optional character string. For |
level |
character string. Whether the results should be on the
observation level ( |
norm |
logical. Whether residuals should be divided by their standard deviation. |
nsim |
number of response vectors to simulate. Defaults to 1. |
seed |
an object specifying if and how the random number
generator should be initialized. See |
newdata |
a data frame with predictor variables. |
ranef |
either a logical or a matrix (see
|
sigma |
ignored but obligatory argument from original generic. |
... |
potential further arguments passed to methods. |
Details
anova
implements log-likelihood ratio tests for model
comparisons, based on the marginal likelihood. At the time being,
at least two models must be assigned.
neglogLik2
returns the marginal maximum likelihood of the
fitted model times minus 2.
ranefCov
extracts the variance-covariance matrix of
the random effects. Similarly, VarCorr
extracts the
estimated variances, standard deviations and correlations of the
random effects.
resid
extracts the residuals of Li and Sheperd
(2012). By default, the marginal outcome distribution is used to
compute these residuals. The conditional residuals can be computed by
assigning ranef = TRUE
as a supplementary argument.
simulate
simulates ordinal responses based on the
input model.
Further, undocumented methods are deviance
,
extractAIC
, fitted
,
formula
, getCall
,
logLik
, model.frame
,
nobs
, update
, vcov
.
The anova
implementation is based on codes of the
lme4 package. The authors are grateful for these codes.
Value
The anova.olmm
method returns an object of class
anova
, see also anova
.
The coef.olmm
, coefficients.olmm
,
fixef
, fixef.glm
and
fixef.olmm
methods return named numeric
vectors. See also coef
and
coefficients
.
The deviance.olmm
method returns a single numeric,
see also deviance
.
The formula.olmm
method extracts the model formula,
which is an object of class formula
. See also
formula
.
The getCall.olmm
method extracts the call for fitting
the model, which is an object of class call
. See also
call
.
The logLik.olmm
method returns an object of class
logLik
, which is a single numeric with a few attributes. See
also logLik
.
The neglogLik2
and neglogLik2.olmm
methods return a single numeric.
The model.frame.olmm
and
model.matrix.olmm
methods return the model frame and
the model matrix of the olmm
object. See also
model.frame
and model.matrix
.
The ranef
and ranef.olmm
methods
return a matrix with the estimated random effects.
The ranefCov
and ranefCov.olmm
methods return an object of class matrix
. The
VarCorr
and VarCorr.olmm
methods
return an object of class
VarCorr.olmm
. print.VarCorr.olmm
returns an
object of class VarCorr.olmm
.
The resid.olmm
and residuals.olmm
methods return a numeric vector.
The simulate.olmm
method returns a data.frame
including simulated responses based on the input model.
The terms.olmm
method returns an object of class
terms
. See also terms
.
The update.olmm
method will update and (by default)
re-fit a model. It returns an object of class olmm
. See also
update
.
The vcov.olmm
method extracts a matrix
with
the variances and covariances of the fixed effects of the model. See
also vcov
.
The weights.olmm
method extracts a numeric
vector with the model weights. See also weights
.
Author(s)
Reto Burgin
References
Agresti, A. (2010). Analysis of Ordinal Categorical Data (2 ed.). New Jersey, USA: John Wiley & Sons.
Tutz, G. (2012). Regression for Categorical Data. New York, USA: Cambridge Series in Statistical and Probabilistic Mathematics.
Li, C. and B. E. Sheperd (2012). A New Residual for Ordinal Outcomes, Biometrika, 99(2), 437–480.
Bates, D., M. Maechler, B. M. Bolker and S. Walker (2015). Fitting Linear Mixed-Effects Models Using lme4, Journal of Statistical Software, 67(1), 1–48.
See Also
Examples
## --------------------------------------------------------- #
## Example: Schizophrenia (see also example of 'olmm')
## --------------------------------------------------------- #
data(schizo)
schizo <- schizo[1:181,]
schizo$id <- droplevels(schizo$id)
## anova comparison
## ----------------
## fit two alternative models for the 'schizo' data
model.0 <- olmm(imps79o ~ tx + sqrt(week) + re(1|id), schizo)
model.1 <- olmm(imps79o ~ tx + sqrt(week)+tx*sqrt(week)+re(1|id),schizo)
anova(model.0, model.1)
## simulate responses
## ------------------
## simulate responses based on estimated random effects
simulate(model.0, newdata = schizo[1, ], ranef = TRUE, seed = 1)
simulate(model.0, newdata = schizo[1, ], seed = 1,
ranef = ranef(model.0)[schizo[1, "id"],,drop=FALSE])
## simulate responses based on simulated random effects
newdata <- schizo[1, ]
newdata$id <- factor("123456789")
simulate(model.0, newdata = newdata, ranef = TRUE)
## other methods
## -------------
coef(model.1)
fixef(model.1)
head(model.matrix(model.1, "fe-ge"))
head(weights(model.1))
ranefCov(model.1)
head(resid(model.1))
terms(model.1, "fe-ge")
VarCorr(model.1)
head(weights(model.1, "subject"))