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

View source: R/lm_betaselect_methods.R

anova.lm_betaselectR Documentation

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 class 'lm_betaselect'
anova(object, ..., type = c("beta", "standardized", "raw", "unstandardized"))

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

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.

Value

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

Author(s)

Shu Fai Cheung https://orcid.org/0000-0002-9871-9448

See Also

lm_betaselect()

Examples


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")


betaselectr documentation built on June 8, 2025, 10:31 a.m.