Skip to contents

This function calculates beta statistics for a linear model fit.

Usage

beta_stats(lmfit, varnames, se = TRUE)

Arguments

lmfit

Fitted linear model object.

varnames

Vector of variable names.

se

Logical flag indicating whether to calculate standard errors (default: TRUE).

Value

A list containing the following elements:

  • estimate: Estimated beta coefficients.

  • stat: t-statistics of the beta coefficients (if se = TRUE).

  • se: Standard errors of the beta coefficients (if se = TRUE).

  • prob: Probabilities associated with the t-statistics (if se = TRUE).

  • stat_type: Type of the statistics calculated.

Examples

data(mtcars)
lm_fit <- lm(mpg ~ wt + qsec + am, data = mtcars)
beta_stats(lm_fit, c("Intercept", "wt", "qsec", "am"))
#> Error in beta_stats(lm_fit, c("Intercept", "wt", "qsec", "am")): could not find function "beta_stats"