Announcement

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

  • SEM constraints

    Hi everyone,

    I am trying to constrain one of my variables to -1 in my SEM model.

    Shadow is my latent variable. I want to constrain i_GDPpercap to negative one. I am able to constrain i_GDPpercap to positive one like this:

    sem ( c_burden c_ffree c_unemp c_bfree c_reg c_reg -> Shadow) (Shadow -> i_GDPpercap@1 i_laborforceparrate i_m0m1), standardized

    But I am unsure how to constrain it to be negative. Any suggestions would be greatly appreciated!

    Thanks!
    Beckie

  • #2
    Positive or negative values of the constraint make no difference. Just use i_GDPpercap@-1 in your model.

    Comment


    • #3
      Thanks, Clyde. I tried this and it generated iterations continuously that were non concave and I had to exit. Any idea on why this would be? Thanks so much!

      Comment


      • #4
        Originally posted by Beckie Garvin View Post
        it generated iterations continuously that were non concave and I had to exit. Any idea on why this would be?
        Prime suspect: model misspecification.

        You can try playing with starting values, but if the iterations had converged to a maximum before, then I would place my bet on the prime suspect.

        Comment


        • #5
          Hi Joseph,

          Thanks so much for your response! I am following a MIMIC model procedure for the shadow economy. I am trying to duplicate another report from IMF. Any suggestions on why the model might not be working?

          Thanks so much!
          Beckie

          Comment


          • #6
            Without seeing your model and data it is hard to be sure. Is there some other constraint that might be causing problems, e.g. if something else is constrained to 1 then the -1 constraint might cause problems if it forces a negative correlation between variables that are positively correlated.

            I have found that seemingly trivial changes in parameterizations can cause Stata sem to have problems,

            Do you really need it to be -1? Isn't it just going to be a matter of sign flips?

            You could try adding the -difficult- option to sem. It helps occasionally.

            If you can't share the data itself, you might be able to use the ssd commands to create the summary statistics that can be used with sem.
            -------------------------------------------
            Richard Williams, Notre Dame Dept of Sociology
            StataNow Version: 19.5 MP (2 processor)

            EMAIL: [email protected]
            WWW: https://www3.nd.edu/~rwilliam

            Comment


            • #7
              Hi again,

              I am attempting to estimate the shadow economy (a latent variable) for 150 countries from 2000-2016. I am basing my data off several papers which follow the following general framework:


              Click image for larger version

Name:	Capture.PNG
Views:	1
Size:	50.4 KB
ID:	1447263


              Here is my code:

              sem (burden goveff unemp bfree reg -> Shadow)(Shadow -> realgdppercap@1 laborforcepartrate broadmoneypercentgdp), standardized

              where my causal variables tax burden, government effectiveness, unemployment, business freedom index, and regulatory burden and my indicator variables are real GDP per capita, broad money as a percent of GDP, and labor force participation rate. I fixed the real GDP per capita to 1 because I am unable to fix it to -1 without error.

              I then predict the latent variable:

              predict x, latent(Shadow)

              I am hoping to use the latent variable estimation and index it from 2000 to 2016 to understand the relative change in the latent variable over time.

              The issue that I am most concerned with is that I have this data for 150 countries from 2000-2016, how do I indicate these fixed effects to STATA using the SEM model? It seems that my predicted latent variable will not be correct if I do not somehow control for the fact that there are specific countries in the data?

              Should I be using something like GLLAMM instead? Any help would be greatly appreciated!

              Thanks,
              Beckie

              Comment


              • #8
                Originally posted by Beckie Garvin View Post
                ...

                I am attempting to estimate the shadow economy (a latent variable) for 150 countries from 2000-2016. I am basing my data off several papers which follow the following general framework:

                ...
                Code:
                sem (burden goveff unemp bfree reg -> Shadow)(Shadow -> realgdppercap@1 laborforcepartrate broadmoneypercentgdp), standardized
                where my causal variables tax burden, government effectiveness, unemployment, business freedom index, and regulatory burden and my indicator variables are real GDP per capita, broad money as a percent of GDP, and labor force participation rate. I fixed the real GDP per capita to 1 because I am unable to fix it to -1 without error.

                ...
                I am still concerned over why you decided to fix the effect of the shadow economy on real GDP (growth?) per capita at -1.

                You said you're following some previous papers that estimated this. Did they also constrain the effect of the (standardized) size of the shadow economy on (standardized) real GPD/capital at -1? When you constrain something, you are telling Stata, this is what the value is, and don't estimate anything. If so, then I assume there's some theoretical reason for this that I can't begin to imagine, and I will leave this alone (I'm a health services researcher and have little insight into this). But if there's no theoretical reason to make this constraint, then why are you making it?

                It's already been explained, but if your model doesn't converge if you issue the constraint at -1, then it's not identified, and one probably reason is that the constraint simply doesn't work - it causes a mathematical impossibility. Again, do you really need that correlation to be -1? What happens if it's freely estimated?
                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
                  Hi Weiwen,

                  Thanks again for your reply. The idea for setting gdp per capita or gdp to negative 1 is that there is a negative relationship between gdp and the latent variable. Other papers set currency to positive 1.

                  My main concern is the idea that I have 150 countries with panel data. Do you know how to deal with this in the -sem- framework? I want to make sure STATA can differentiate between the countries. Any ideas?

                  thanks again so much!!
                  Beckie

                  Comment


                  • #10
                    Originally posted by Beckie Garvin View Post
                    Hi Weiwen,

                    Thanks again for your reply. The idea for setting gdp per capita or gdp to negative 1 is that there is a negative relationship between gdp and the latent variable. Other papers set currency to positive 1.

                    My main concern is the idea that I have 150 countries with panel data. Do you know how to deal with this in the -sem- framework? I want to make sure STATA can differentiate between the countries. Any ideas?

                    thanks again so much!!
                    Beckie
                    As to your question, I think most people would use either a fixed or a random effect for country. Economists tend to strongly prefer fixed effects. Other disciplines are more agnostic or prefer random effects. SEM example 38 offers a syntax example. Drawing from that,

                    Code:
                    use http://www.stata-press.com/data/r15/gsem_nlsy
                    mixed ln_wage i.union grade || idcode:
                    estimates store mixed
                    gsem (ln_wage <- i.union grade M1[idcode])
                    estimates store gsem
                    estimates table mixed gsem
                    As you can see, you can fit that particular model with the -mixed- command, and you will get identical results to -gsem-.

                    Back to your original question.

                    I had forgotten that in MIMIC models, and in SEM in general, there are some default constraints that are made for identification. By default, Stata constrains the beta for one of the variables on the measurement side (that is, the things that are indicators of the latent variable) to +1. Drawing on example 10,

                    Code:
                    use http://www.stata-press.com/data/r15/sem_mimic1
                    sem (SubjSES -> s_income s_occpres s_socstat) (SubjSES <- income occpres)
                    estimates store sem_default
                    sem (SubjSES -> s_income@-1 s_occpres s_socstat) (SubjSES <- income occpres)
                    estimates store sem_alternate
                    estimates table sem_default sem_alternate
                    
                    ----------------------------------------
                        Variable | sem_defa~t   sem_alte~e  
                    -------------+--------------------------
                    SubjSES      |
                          income |  .08273201   -.08273261  
                         occpres |  .00462754   -.00462754  
                    -------------+--------------------------
                    s_income     |
                         SubjSES |          1           -1  
                           _cons |  .96120912    .96120619  
                    -------------+--------------------------
                    s_occpres    |
                         SubjSES |  .73013519   -.73013169  
                           _cons |   1.114563    1.1145632  
                    -------------+--------------------------
                    s_socstat    |
                         SubjSES |  .94051608   -.94051097  
                           _cons |  1.0021134     1.002114  
                    -------------+--------------------------
                    var(e.s_in~e)|  .20875465    .20875348  
                    var(e.s_oc~s)|  .28118516    .28118554  
                    var(e.s_so~t)|  .18071295    .18071393  
                    var(e.Subj~S)|  .18600966    .18601182  
                    ----------------------------------------
                    
                    
                    estimates stats sem_default sem_alternate
                    
                    -----------------------------------------------------------------------------
                           Model |        Obs  ll(null)  ll(model)      df         AIC        BIC
                    -------------+---------------------------------------------------------------
                     sem_default |        432         .  -3971.924      11    7965.847     8010.6
                    sem_altern~e |        432         .  -3971.924      11    7965.847     8010.6
                    -----------------------------------------------------------------------------
                    Basically, SEM constrained the beta for subjective SES to +1 by default. When I flipped the sign of the constraint, nothing major happens. It's the same model. A bunch of other coefficient signs flipped with it. The log-likelihood is identical. So, I'm surprised your model isn't estimating when you constrain an indicator to -1.

                    Your constraint could have caused one parameter estimate to bump up against the boundary of the parameter space, e.g. some variance could be going to 0. In my experience with different types of SEM models, some cases of convergence trouble can be a result of that. For example, let's go and constrain the beta of one of the structural variables to -1.

                    Code:
                    sem (SubjSES -> s_income s_occpres s_socstat) (SubjSES <- income@-1 occpres), iterate(20)
                    
                    ---------------------------------------------------------------------------------
                                    |                 OIM
                                    |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                    ----------------+----------------------------------------------------------------
                    Structural      |
                      SubjSES       |
                             income |         -1  (constrained)
                            occpres |   .0355522   .0065144     5.46   0.000     .0227842    .0483203
                    ----------------+----------------------------------------------------------------
                    Measurement     |
                      s_income      |
                            SubjSES |          1  (constrained)
                              _cons |   5.284307   .2889692    18.29   0.000     4.717938    5.850676
                      --------------+----------------------------------------------------------------
                      s_occpres     |
                            SubjSES |   .0454169   .0565313     0.80   0.422    -.0653824    .1562162
                              _cons |   1.686641   .2097473     8.04   0.000     1.275544    2.097738
                      --------------+----------------------------------------------------------------
                      s_socstat     |
                            SubjSES |   .0227817   .0775198     0.29   0.769    -.1291543    .1747177
                              _cons |   1.611901   .2903614     5.55   0.000     1.042803    2.180999
                    ----------------+----------------------------------------------------------------
                     var(e.s_income)|   2.50e-09          .                             .           .
                    var(e.s_occpres)|   .3983163   .0320458                      .3402093    .4663478
                    var(e.s_socstat)|    .389884   .0439924                      .3125291    .4863852
                      var(e.SubjSES)|   5.956677   .4143811                       5.19744    6.826822
                    ---------------------------------------------------------------------------------
                    Note: The LR test of model vs. saturated is not reported because the fitted
                          model is not full rank.
                    Warning: convergence not achieved
                    I limited the estimation to 20 iterations because I would have had an infinite iteration log otherwise. Try it if you like. Either way, the estimate of the variance for the error term for subjective income is butting up against 0 (i.e. it's near or at the boundary of the parameter space). In my experience with different types of structural equation models, maximum likelihood estimation in general can have trouble in cases like that. It's possible that when you issued the constraint you did, that you had something like this happen. One thing to do is that you can limit the number of iterations (choose an iteration number where the log likelihood has ceased to change from iteration to iteration; that was 20 iterations for the model above), then check your estimates. Any parameter with a missing standard error is suspect.

                    If you do need that measurement variable's beta constrained at -1, rather than simply 1, then you could go and run the above exercise and see if anything obvious has gone awry as a result of your constraint (look for missing standard errors). What you do about that is in your court; you could see if anyone here has any advice, though.
                    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


                    • #11
                      it looks like you get issue with likelihood maximum estimate in fitting the model . look this closely (the note message of stata at the end) and tell me how you give rmsea, cfi, tli, statistic about quality of the model
                      The LR test of model vs. saturated is not reported because the fitted model is not full rank.

                      Comment


                      • #12
                        Dear Zara,

                        I also experienced the similar problem that convergence not achieved. I am using the MIMIC model to estimate the informal economy. Would you have further suggestions to solve this?

                        Thank you very much, Rattiya

                        Comment


                        • #13
                          Some generic suggestions for dealing with convergence problems are outlined at

                          https://www3.nd.edu/~rwilliam/stats3/L02.pdf
                          -------------------------------------------
                          Richard Williams, Notre Dame Dept of Sociology
                          StataNow Version: 19.5 MP (2 processor)

                          EMAIL: [email protected]
                          WWW: https://www3.nd.edu/~rwilliam

                          Comment

                          Working...
                          X