vcrpart (version 1.0-3)

olmm-methods: Methods for olmm objects

Description

Standard methods for computing on olmm objects.

Usage

# S3 method for olmm
anova(object, ...)

# S3 method for olmm coef(object, which = c("all", "fe"), ...)

# S3 method for olmm fixef(object, which = c("all", "ce", "ge"), ...)

# S3 method for olmm model.matrix(object, which = c("fe", "fe-ce", "fe-ge", "re", "re-ce", "re-ge"), ...)

# S3 method for olmm neglogLik2(object, ...)

# S3 method for olmm ranef(object, norm = FALSE, ...)

# S3 method for olmm ranefCov(object, ...)

# S3 method for olmm simulate(object, nsim = 1, seed = NULL, newdata = NULL, ranef = TRUE, ...)

# S3 method for olmm terms(x, which = c("fe-ce", "fe-ge", "re-ce", "re-ge"), ...)

# S3 method for olmm VarCorr(x, sigma = 1., ...)

# S3 method for olmm weights(object, level = c("observation", "subject"), ...)

Arguments

object, x

an olmm object.

which

optional character string. For coef and fixef, it indicates whether "all" coefficients, the fixed effects "fe", the category-specific fixed effects "ce" (i.e. non-proportional odds) or the global fixed effects "ge" (i.e. proportional odds) should be extracted. For model.matrix it indicates whether the model matrix of the fixed- ("fe") or the random effects ("re") should be extracted.

level

character string. Whether the results should be on the observation level (level = "observation") or on the subject level (level = "subject").

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 simulate

newdata

a data frame with predictor variables.

ranef

either a logical or a matrix (see predict.olmm). Whether the simulated responses should be conditional on random effects. If TRUE, the newdata data frame must contain the subject identification variable. Further, if all subjects in newdata are in object, the simulation will be based on the estimated random effects as obtained with ranef. If any subject in newdata is not in object the random effects are simulated.

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 is 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.

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.

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

olmm, predict.olmm, gefp.olmm

Examples

Run this code
# NOT RUN {
## --------------------------------------------------------- #
## 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"))
# }

Run the code above in your browser using DataCamp Workspace