coef.lm_betaselect: Coefficients of Beta-Select in Linear Models

View source: R/lm_betaselect_methods.R

coef.lm_betaselectR Documentation

Coefficients of Beta-Select in Linear Models

Description

Return the estimates of coefficients in an lm_betaselect-class or glm_betaselect-class object.

Usage

## S3 method for class 'lm_betaselect'
coef(
  object,
  complete = FALSE,
  type = c("beta", "standardized", "raw", "unstandardized"),
  ...
)

## S3 method for class 'glm_betaselect'
coef(
  object,
  complete = FALSE,
  type = c("beta", "standardized", "raw", "unstandardized"),
  ...
)

Arguments

object

The output of lm_betaselect() or glm_betaselect(), or an lm_betaselect-class or glm_betaselect-class object.

complete

If TRUE, it returns the full vector of coefficients, including those of terms dropped in an over-determined system. See stats::coef() for further information. Default is FALSE.

type

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

...

Other arguments. Ignored.

Details

By default, it extracts the regression coefficients after the selected variables have been standardized. If requested, it can also return the regression coefficients before standardization.

Value

A numeric vector: The estimate of regression coefficients.

Author(s)

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

See Also

lm_betaselect() and glm_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")
coef(lm_beta_x)
coef(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")
coef(logistic_beta_x)
coef(logistic_beta_x, type = "raw")


betaselectr documentation built on April 3, 2025, 8:51 p.m.