Announcement

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

  • LCA Stata 15 - estat lcgof doesn't display the likelihood-ratio test

    Hello,

    I am using Stata 15 for LCA models. To evaluate the goodness of fit of my models, I use the "estat lcgof" option.
    However, contrary to what I read in the manuel, the option just displays AIC and BIC results, but not the likelihood-ratio (chi2 and p value).

    Does anyone know what could be the reasons ?

    Thank you,

    Marie

  • #2
    Are all the covariates categorical? If you are talking about the likelihood ratio chi-square value, the manual does say that this statistic only applies if all indicators are categorical. If an indicator is continuous, then it has an infinite number (in principle) of possible values. Chi-square tests are based on observed to expected counts. This issue generalizes to other settings like the Pearson chi-square test for goodness of fit after logistic regression.
    Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

    When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

    Comment


    • #3
      Welcome to the Stata Forum/ Statalist,

      Please prefer to present what you typed , plus output and data. You may wish to take a look at the FAQ so as to best share data/output/command.

      That said, I wonder whether the variables are categorical or not.
      Best regards,

      Marcos

      Comment


      • #4
        There is no -estat lcgof- option. There is a command -estat lcgof- which can be run after gsem with a latent class variable. When I run it on my set up, I do get the likelihood ratio chi square and p-value along with the AIC and BIC. Is your Stata installation fully up to date, i.e. as of 21 Nov 2017? If not, run -update all- and try again. If you get the same results, then show an example of data that reproduces the problem, and also show the exact code you used and complete response from Stata that you got for further advice. Be sure to use the -dataex- command to show the example data, and be sure to put the commands and output within code delimiters to make everything as useful as possible. If you are not familiar with -dataex- and code delimiters, please read the Forum FAQ, with emphasis on #12.

        Comment


        • #5
          Hello

          Thank you for all your quick answers.

          Yes, all the variables are categorical.

          Here is an example for one of my models.
          gsem (mhi5_76 dlang_d2 <-, logit) ( srh_c dpal ddrktype socsupp_c <-, mlogit), lclass(A 2) startvalues(randompr, draws(20)) nonrtolerance
          estat lcgof



          And here is the output for the estat lcgof command.


          Fit statistic Value Description

          Information criteria
          AIC 5594.566 Akaike's information criterion
          BIC 5685.898 Bayesian information criterion

          Thanks,

          Comment


          • #6
            And I am sorry if my post doesn't correspond to what is required on statalist yet. I am working on that but I'm in a region where internet is really low and I still have a hard time loading an internet page.
            Last edited by Marie Baron; 27 Nov 2017, 16:36.

            Comment


            • #7
              Indeed, share a fraction of the data - under CODE delimiters or by using dataex command - may be helpful.

              That said, it striked me as odd that some variables end with ‘c’ , for this letter prompts to think it is a centered variable.
              Best regards,

              Marcos

              Comment


              • #8
                Originally posted by Marie Baron View Post
                Hello

                Thank you for all your quick answers.

                Yes, all the variables are categorical.

                Here is an example for one of my models.
                gsem (mhi5_76 dlang_d2 <-, logit) ( srh_c dpal ddrktype socsupp_c <-, mlogit), lclass(A 2) startvalues(randompr, draws(20)) nonrtolerance
                estat lcgof



                And here is the output for the estat lcgof command.


                Fit statistic Value Description

                Information criteria
                AIC 5594.566 Akaike's information criterion
                BIC 5685.898 Bayesian information criterion

                Thanks,
                Hmm. Not saying you are wrong, but so far, I can't replicate this using one of the stock Stata datasets using Stata 15.0.

                Code:
                use http://www.stata-press.com/data/r15/gsem_sysdsn1
                summarize
                gsem (site insure <-, mlogit) (male nonwhite <-, logit), lclass(C 2) nonrtolerance startvalues(randompr, draws(20))
                estat lcgof
                I did get the LR chi square and AIC/BIC. The issue doesn't appear to be mixing mlogit with logit (and yes, site and insure have 3 values). I tested initially without the nonrtolerance and startvalues options, but neither caused any issue in the end. Are you able to reproduce the error on the same stock dataset? If not, then we do need to see a data extract.
                Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

                When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

                Comment


                • #9
                  Hello,


                  I just tried the example you gave, Weiwen Ng, and I have the same issue.
                  I just get the Aic and Bic results, but not the LR chi square.
                  And I tested the "estat lcgof" command on two different computers with different Stata 15 licences, none of them give the LR qui square. So I don't think it comes from the installation of the software either.

                  It seems strange though.

                  Comment


                  • #10
                    Marie and Weiwen,

                    I just tried Weiwen's code from #8 on Stata/IC 15.1 with all current updates (under Windows 10, 64-bit), and I do not get the LR chi square either.

                    Red Owl
                    Stata/IC 15.1, Windows 10 (64-bit)

                    Comment


                    • #11
                      Hmm. Although I have never encountered this issue before, when I ran Weiwen's script, I, too, get only the IC's, no likelihood ratio test.

                      Stata/MP 15.1 for Windows (64-bit x86-64)
                      Revision 21 Nov 2017
                      Copyright 1985-2017 StataCorp LLC

                      Total physical memory: 8269900 KB
                      Available physical memory: 3834016 KB

                      Single-user 2-core Stata perpetual license:
                      Serial number: REDACTED
                      Licensed to: Clyde Schechter
                      Albert Einstein College of Medicine

                      Windows 7 (64-bit)

                      Comment


                      • #12
                        Originally posted by Marie Baron View Post
                        Hello,

                        I just tried the example you gave, Weiwen Ng, and I have the same issue.
                        I just get the Aic and Bic results, but not the LR chi square.
                        And I tested the "estat lcgof" command on two different computers with different Stata 15 licences, none of them give the LR qui square. So I don't think it comes from the installation of the software either.

                        It seems strange though.
                        Can you confirm which Stata version you are on, Marie? I am using a remote computer without admin privileges, which is why I am using 15.0. I am also running windows 10, Stata SE.
                        Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

                        When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

                        Comment


                        • #13
                          Hello everyone,

                          I use Stata/IC 15.1, Windows 10 (64-bit), revised Novembre 06. I tried to install the Novembre 21 version, but my internet connection is to slow for the moment, it will have to wait.

                          On the other computer, if I remember well, I use Stata 15.0 on Windows 7, with no admin privileges.

                          So if I understand well, only Weiwen gets the Chi square results, with the oldest verison of Stata 15.

                          Thanks,

                          Comment


                          • #14
                            There is an update in 15.1 which causes this bug. You should probably tip Technical Services

                            Code:
                            *Under version control
                            version 15.0
                            use http://www.stata-press.com/data/r15/gsem_sysdsn1
                             summarize
                            gsem (site insure <-, mlogit) (male nonwhite <-, logit), lclass(C 2) nonrtolerance startvalues(randompr, draws(20))
                            estat lcgof
                            So probably best to operate under version 15.0 at the moment.
                            Last edited by Andrew Musau; 29 Nov 2017, 09:44.

                            Comment


                            • #15
                              Originally posted by Andrew Musau View Post
                              There is an update in 15.1 which causes this bug. You should probably tip Technical Services

                              Code:
                              *Under version control
                              version 15.0
                              use http://www.stata-press.com/data/r15/gsem_sysdsn1
                              summarize
                              gsem (site insure <-, mlogit) (male nonwhite <-, logit), lclass(C 2) nonrtolerance startvalues(randompr, draws(20))
                              estat lcgof
                              So probably best to operate under version 15.0 at the moment.
                              I was about to say that it seems like this should be escalated to tech support, and I just did that.

                              For the record, I am operating under version 15.0, revised September 25, 2017. As I mentioned, I don't have admin privileges on that remote computer, so I haven't had the software updated in a while. I am glad that this allowed us to pinpoint a bug!
                              Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

                              When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

                              Comment

                              Working...
                              X