Skip to content

Accessing parameter estimates + including binary and categorical variables as covariates #6

@huentelb

Description

@huentelb

Hi all,

thanks for this amazing initiative to make the use of 2- and 3-step LCA available on open-source platforms. I was able to fit some basic 1-, 2-, and 3-step LCA but I have two remaining questions:

  1. Stored parameter estimates.
    (How) is it possible to access parameter estimates after fitting the model? For instance, I fit a 3-step LCA with ML correction including covariates and would like to build a nice output table from my structural model including beta coefficients, SEs, p-values and CIs (thus, basically mirroring the output of a classic multinomial logistic regression (step 3)). Are these estimates stored anywhere? How can I access them? It seems as if this is fairly easily possible in Python but I could not find a solution in R, yet.

  2. Different scales of covariates
    I would like to estimate a 3-step LCA with ML correction and the inclusion of covariates that have all sorts of scales, that is, binary, continuous, and categorical. Including all covariates via

lc4_3step_Zp.df <- USA_lc %>%
  dplyr::select(anc_age,  # continuous
                female, mig,  # binary
                kin_cat, race, lfs, anc_eduall) # categorical

covariate_params = list(
  method = 'newton-raphson', 
  max_iter = as.integer(1), 
  intercept = TRUE )

m3 <- stepmix(n_components = 4,
              n_steps = 3, 
              correction = "ML", 
              measurement = "binary",
              structural = "covariate",
              structural_params = covariate_params,
              max_iter = m,
              n_init = 10, 
              verbose = 1, 
              random_state = seed)

resulted in all covariates being treated as continuous (as seen in the structural model parameters). Adjusting what I read in the Tutorial, I tried applying the mixed_descriptor function to the covariates like so:

md = mixed_descriptor(data = lc4_3step_Zp.df, 
                      continuous = 1, 
                      binary = 2:3,
                      categorical = 4:7)

and adjusted the above model through structural = md$descriptor like so:

m3 <- stepmix(n_components = 4,
              n_steps = 3, 
              correction = "ML", 
              measurement = "binary",
              structural = md$descriptor,
              structural_params = covariate_params,
              max_iter = m,
              n_init = 10, 
              verbose = 1, 
              random_state = seed)

However, it seems as if the variables included via the structural part and md$descriptor are not treated as covariates because not betas but 'pis' are estimated, etc.

I hope I clearly spelled out my questions and am happy to provide more detail, if needed. Any feedback or help is highly appreciated!!

Thanks again for all this work and any response I may get!

Best
Bettina

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions