Learn R Programming

OPSR (version 1.0.1)

anova.opsr: ANOVA for OPSR Model Fits

Description

Conducts likelihood ratio tests for one or more OPSR model fits.

Usage

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

Value

An object of class "anova.opsr".

Arguments

object

an object of class "opsr".

...

additional objects of class "opsr". See also the 'Details' section.

Details

If only a single object is passed then the model is compared to the null model (opsr_null_model). If more than one object is specified, a likelihood ratio test is conducted for each pair of neighboring models. It is conventional to list the models from smallest to largest, but this is up to the user.

See Also

stats::anova, print.anova.opsr

Examples

Run this code
sim_dat <- opsr_simulate()
dat <- sim_dat$data
model <- ys | yo ~ xs1 + xs2 | xo1 + xo2
fit <- opsr(model, dat)
fit_null <- opsr_null_model(fit)
fit_intercept <- update(fit, ~ . | 1)

anova(fit)
anova(fit_null, fit_intercept, fit)

Run the code above in your browser using DataLab