Learn R Programming

betaselectr (version 0.1.3)

anova.lm_betaselect: ANOVA Tables For 'lm_betaselect' and 'glm_betaselect' Objects

Description

Return the analysis of variance tables for the outputs of lm_betaselect() and glm_betaselect().

Usage

# S3 method for lm_betaselect
anova(object, ..., type = c("beta", "standardized", "raw", "unstandardized"))

# S3 method for glm_betaselect anova( object, ..., type = c("beta", "standardized", "raw", "unstandardized"), dispersion = NULL, test = NULL )

Value

It returns an object of class anova, which is identical to the output of stats::anova() in structure.

Arguments

object

The output of lm_betaselect() or glm_betaselect().

...

Additional outputs of lm_betaselect() or glm_betaselect().

type

String. If "unstandardized" or "raw", the output before standardization are used If "beta" or "standardized", then the output after selected variables standardized are returned. Default is "beta".

dispersion

To be passed to stats::anova.glm(). The dispersion parameter. Default ia NULL and it is extracted from the model.

test

String. The test to be conducted. Please refer to stats::anova.glm() for details.

Details

By default, it calls stats::anova() on the results with selected variables standardized. By setting type to "raw" or "unstandardized", it calls stats::anova() on the results before standardization.

See Also

lm_betaselect()

Examples

Run this code

data(data_test_mod_cat)

lm_beta_x <- lm_betaselect(dv ~ iv*mod + cov1 + cat1,
                           data = data_test_mod_cat,
                           to_standardize = "iv",
                           do_boot = FALSE)
anova(lm_beta_x)
anova(lm_beta_x, type = "raw")


data_test_mod_cat$p <- scale(data_test_mod_cat$dv)[, 1]
data_test_mod_cat$p <- ifelse(data_test_mod_cat$p > 0,
                              yes = 1,
                              no = 0)
logistic_beta_x <- glm_betaselect(p ~ iv*mod + cov1 + cat1,
                                  data = data_test_mod_cat,
                                  family = binomial,
                                  to_standardize = "iv")
anova(logistic_beta_x)
anova(logistic_beta_x, type = "raw")

Run the code above in your browser using DataLab