Skip to contents

stcolrm is used to calculate the standardised coefficients after fitting a logistic regression model for a wide variety of explanatory variables.

Usage

stcolrm(
  object,
  method = c("simple-preSTD", "simple-postEST", "partial", "full"),
  data,
  conf_level = 0.95,
  coef_conversion = exp
)

Arguments

object

an object of class "formula" (a symbolic description of the model to be fitted) or 'glm' (a pre-trained binomial model)

method

the method ("simple-preSTD", "simple-postEST", "partial", "full") to be used for estimating the standardised coefficients after fitting the model.

data

an optional data frame, list or environment (or object coercible by as.data.frame to a data frame) containing the variables in the model.

conf_level

a numeric value between 0 and 1 giving the confidence level for the intervals (default is 0.95).

coef_conversion

a function to convert the coefficients (default is exp for odds ratios).

Value

A numeric vector of standardised coefficients of the fitted logistic regression model.

Details

stcolrm produces standardised coefficients after fitting a logistic regression model for a wide variety of explanatory variables. It also shows the base results for glm fit, and also shows the odds ratios of the estimated coefficients. The odds ratios for standardised coefficients are calculated using delta method.

Examples

library(kmed)
heartdata <- heart
heartdata$classN <- ifelse(heart$class == 0, 0, 1)
mfit <- stcolrm(classN ~ age + sex + trestbps + chol + restecg, data=heartdata, "simple-preSTD")
mfit
#> Standardized Coefficients (simple-preSTD)
#>      age   sexTRUE  trestbps      chol  restecg1  restecg2  
#>     3.35      5.39      1.63      1.48      1.54      1.83  

mfit <- stcolrm(classN ~ age + sex + trestbps + chol + restecg, data=heartdata, "simple-postEST")
mfit
#> Standardized Coefficients (simple-postEST)
#>      age   sexTRUE  trestbps      chol  restecg1  restecg2  
#>    0.483     0.799     0.225     0.199     0.222     0.240  

mfit <- stcolrm(classN ~ age + sex + trestbps + chol + restecg, data=heartdata, "partial")
mfit
#> Standardized Coefficients (partial)
#>      age   sexTRUE  trestbps      chol  restecg1  restecg2  
#>    10.80     17.87      5.03      4.46      4.97      5.38  

mfit <- stcolrm(classN ~ age + sex + trestbps + chol + restecg, data=heartdata, "full")
mfit
#> Standardized Coefficients (full)
#>      age   sexTRUE  trestbps      chol  restecg1  restecg2  
#>    1.936     3.205     0.903     0.800     0.892     0.964