Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Obtaining log likelihood from gsem to calculate BIC

    Hello all,

    I am utilizing gsem in Stata 18.0 for a latent class analysis with multiply imputed data and survey weights.
    After I run my LCA, I am unable to get goodness of fit stats, receiving the error message "estat lcgof not valid." See my sample code for an example.

    Code:
     
     mi est, cmdok:gsem (var1 var2 var3 var4 var5 <-) [pweight= gsw5] , logit lclass(c 2)  estat lcgof  estat lcgof is not valid 
    I asked if there was a solution to this on another thread, but I got no response, so now I am trying to calculate the BIC on my own. To do so, I need to know what the log likelihood is for my model.
    So, my question is this: how can I determine the log likelihood for my model in order to calculate the BIC?
    Or, alternatively, is there another way to go about this?
    Thank you!

    Note: I realize that it is difficult to answer some questions without sample data. Due to the restricted status of my data and complexity of this analysis, I am unable to do so.

  • #2
    -mi est- is NOT an MLE so things that require the log-likelihood are not available; you can roll your own by using -mi xeq-, calculating what you want after each estimate and combine the estimate; I don't know whether Rubin's rules work well in this case; note also that -estat lcgof- is a command of its own to be used following the estimation; you have it as an option and it is certainly not valid there

    forgot to mention that I have posted code previously for obtaining the C statistic; see #6 in https://www.statalist.org/forums/for...ng-mi-estimate
    Last edited by Rich Goldstein; 22 May 2024, 14:20.

    Comment


    • #3
      Hi Rich, thank you for your response. I will look into Rubin's rule.
      I did not run -estat lcgof- as an option, that was a result of an error in copy and pasting my code. Thank you for your response.

      Comment

      Working...
      X