| anova.sc_plm | R Documentation |
Model comparison for piecewise regression models fitted with plm(),
hplm(), or mplm() using likelihood ratio tests.
## S3 method for class 'sc_plm'
anova(object, ...)
## S3 method for class 'sc_hplm'
anova(object, ...)
## S3 method for class 'sc_mplm'
anova(object, ...)
object |
An object containing the results returned by |
... |
additional objects for model comparison. |
The function performs likelihood ratio tests to compare nested piecewise regression models. It extracts the underlying model from the sc_plm, sc_hplm, or sc_mplm object and passes them to the generic anova() function for model comparison.
An object of class anova containing the results of the model
comparison.
## For glm models with family = "gaussian"
mod1 <- plm(exampleAB$Johanna, level = FALSE, slope = FALSE)
mod2 <- plm(exampleAB$Johanna)
anova(mod1, mod2)
## For glm models with family = "poisson"
mod0 <- plm(example_A24, formula = injuries ~ 1, family = "poisson")
mod1 <- plm(example_A24, trend = FALSE, family = "poisson")
anova(mod0, mod1, mod2)
## For glm with family = "binomial"
mod0 <- plm(
exampleAB_score$Christiano,
formula = values ~ 1,
family = "binomial",
var_trials = "trials"
)
mod1 <- plm(
exampleAB_score$Christiano,
trend = FALSE,
family = "binomial",
var_trials = "trials"
)
anova(mod0, mod1)
## For multilevel models:
mod0 <- hplm(Leidig2018, trend = FALSE, slope = FALSE, level = FALSE)
mod1 <- hplm(Leidig2018, trend = FALSE)
mod2 <- hplm(Leidig2018)
anova(mod0, mod1, mod2)
## For mplm
mod0 <- mplm(
Leidig2018$`1a1`,
update = . ~ 1, dvar = c("academic_engagement", "disruptive_behavior")
)
mod1 <- mplm(
Leidig2018$`1a1`,
trend = FALSE,
dvar = c("academic_engagement", "disruptive_behavior")
)
mod2 <- mplm(
Leidig2018$`1a1`,
dvar = c("academic_engagement", "disruptive_behavior")
)
anova(mod0, mod1, mod2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.