This function performs regression analysis to explore the influence of exogenous (external) variables on the latent class variables within an estimated slca
model. It utilizes logistic regression and employs a three-step approach.
Usage
regress(object, ...)
# S3 method for class 'slca'
regress(
object, formula, data = parent.frame(),
imputation = c("modal", "prob"),
method = c("naive", "BCH", "ML"), ...
)
Arguments
- object
an object of class
slca
andestimated
- ...
additional arguments.
- formula
a formula defining the regression model, including both latent class variables from the estimated model and any exogenous (external) variables.
- data
an optional data frame containing the exogenous variables of interest.
- imputation
the imputation method for imputing (assigning) latent class variables. Possible values are:
"modal": Assigns each individual to the latent class with the highest posterior probability.
"prob": Assigns classes to individuals randomly according to the distribution of posterior probabilities.
- method
the method used to adjust bias in the three-step approach, with options including "naive", "BCH", and "ML".
Value
A list
with following components:
- coefficients
a matrix of regression coefficients representing the odds ratios of each class against the baseline class (the last class).
- std.err
a matrix of standard errors corresponding to the regression coefficients.
- vcov
the calculated variance-covariance matrix for the regression coefficients.
- dim
the dimensions of the coefficients matrix.
- ll
the log likelihood of the regression model.
Using the summary
function, you can print coefficients, standard errors, corresponding Wald statistics, and p-values for these statistics.
References
Vermunt, J. K. (2010). Latent Class Modeling with Covariates: Two Improved Three-Step Approaches. Political Analysis, 18(4), 450–469. http://www.jstor.org/stable/25792024
Examples
library(magrittr)
names(nlsy97)
#> [1] "SEX" "RACE" "ESMK_98" "FSMK_98" "DSMK_98" "HSMK_98" "EDRK_98"
#> [8] "CDRK_98" "WDRK_98" "BDRK_98" "EMRJ_98" "CMRJ_98" "OMRJ_98" "SMRJ_98"
#> [15] "ESMK_03" "FSMK_03" "DSMK_03" "HSMK_03" "EDRK_03" "CDRK_03" "WDRK_03"
#> [22] "BDRK_03" "EMRJ_03" "CMRJ_03" "OMRJ_03" "SMRJ_03" "ESMK_08" "FSMK_08"
#> [29] "DSMK_08" "HSMK_08" "EDRK_08" "CDRK_08" "WDRK_08" "BDRK_08" "EMRJ_08"
#> [36] "CMRJ_08" "OMRJ_08" "SMRJ_08"
nlsy_jlcpa %>% regress(smk98 ~ SEX, nlsy97)
#> Coefficients:
#> class (Intercept) SEXFemale
#> 1/3 -0.6614 0.0804
#> 2/3 0.3983 -0.4445
nlsy_jlcpa %>% regress(drk98 ~ SEX, nlsy97)
#> Coefficients:
#> class (Intercept) SEXFemale
#> 1/3 -0.0676 0.5571
#> 2/3 -0.1342 -0.2022
nlsy_jlcpa %>% regress(mrj98 ~ SEX, nlsy97)
#> Coefficients:
#> class (Intercept) SEXFemale
#> 1/3 -1.517 -0.196
#> 2/3 -1.099 0.390
# \donttest{
nlsy_jlcpa %>% regress(use98 ~ SEX, nlsy97)
#> Coefficients:
#> class (Intercept) SEXFemale
#> 1/5 -1.8177 0.0329
#> 2/5 -2.5109 0.8061
#> 3/5 -0.8806 0.0449
#> 4/5 -0.3137 0.5978
nlsy_jlcpa %>% regress(prof ~ SEX, nlsy97)
#> Coefficients:
#> class (Intercept) SEXFemale
#> 1/4 0.3254 -0.0304
#> 2/4 -0.1178 -0.3801
#> 3/4 0.4083 -0.0635
# }