Announcement

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

  • Help with SEM in Stata

    Hello! I am trying to run SEM on the model I have attached. I can't seem to figure out why it runs perfectly fine on everything except when I try to link the latent variable Behavioral to Intensity. Once I try to estimate to get this last relationship, it iterates nonstop. It is a constant loop. I am new to SEM, and I have tried using the dif option, tried different algorithms, and have used the matrix command to use the data from the latest model to converge with the addition of this variable. I could be using it incorrectly, but when I get the output from the model attached, I run "matrix b = e(b)". This is the following code I enter:

    sem (Cognitive -> poc_consciousness_raising, ) (Cognitive -> poc_dramatic_relief, ) (Cognitive -> poc_environmental_reevaluation, ) (Cognitive -> poc_self_reevaluation, ) (Cognitive -> poc_self_liberation, ) (Cognitive -> mean_hrpct, ) (Behavioral -> poc_social_liberation, ) (Behavioral -> poc_counterconditioning, ) (Behavioral -> poc_helping_relationships, ) (Behavioral -> poc_reinforcement_management, ) (Behavioral -> poc_stimulus_control, ) (Behavioral -> mean_hrpct, ) (age -> mean_hrpct, ) (gender -> mean_hrpct, ) (race_code -> mean_hrpct, ) (bmi -> mean_hrpct, ) (jp_fat -> mean_hrpct, ) if measurement==1 & removemean_hrpctz==0, covstruct(_lexogenous, diagonal) cov(_lexogenous*_oexogenous@0) method(mlmv) standardized latent(Cognitive Behavioral ) cov( Cognitive*Behavioral) nocapslatent from(b)

    I'm not sure why my other latent variable has no issue at all but this one does. I would appreciate any help I can get with this. When I run the command above, iterations 0-7 all have (not concave) beside the values, so I'm believing that this could be the issue.

    Thank you in advance for any input as I'm a beginner to SEM.

    (As a side note, is there a way in which I can remove the coefficients inside the variable shapes?)
    Attached Files
    Last edited by Matthew Jeans; 28 Nov 2018, 13:39.

  • #2
    Matthew,

    Please note the FAQ request for no screenshots and for code in code delimiters, like this.

    Code:
    sem (Cognitive -> poc_consciousness_raising, ) (Cognitive -> poc_dramatic_relief, ) (Cognitive -> poc_environmental_reevaluation, ) (Cognitive -> poc_self_reevaluation, ) (Cognitive -> poc_self_liberation, ) (Cognitive -> mean_hrpct, ) (Behavioral -> poc_social_liberation, ) (Behavioral -> poc_counterconditioning, ) (Behavioral -> poc_helping_relationships, ) (Behavioral -> poc_reinforcement_management, ) (Behavioral -> poc_stimulus_control, ) (Behavioral -> mean_hrpct, )(age -> mean_hrpct, ) (gender -> mean_hrpct, ) (race_code -> mean_hrpct, ) (bmi -> mean_hrpct, ) (jp_fat -> mean_hrpct, ) if measurement==1 & removemean_hrpctz==0, covstruct(_lexogenous, diagonal) cov(_lexogenous*_oexogenous@0) method(mlmv) standardized latent(Cognitive Behavioral ) cov( Cognitive*Behavioral) nocapslatent from(b)
    That said, I think you have an identification problem. Behavioral and cognitive have 5 indicators each, so they should be identified. However, while I can't tell which is your final code, it looks like you're only identifying Intensity through one variable, a latent variable at that. You are trying to use BMI, BFP, etc, as covariates in a regression with Intensity as the dependent variable, without enough information for you to estimate Intensity. Consider: for behavioral, you have 5 observed indicators. You assume that there's one latent construct, which you're calling behavioral, that influences responses to those indicators. That's workable. For intensity, you have one indicator, and it isn't even observed.

    I'd refer you to SEM intro 12, which deals with model identification problems. Also, this is a pretty complex model. With respect, if you are new to SEM, I would seek guidance from someone knowledgeable in latent variable methods before trying to fit a model like this.
    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
      Intensity is observed, and so I doubt that its identification is the problem.

      I suggest to remove the covariance between the Cognitive and Behavior latent factors before adding the arrow between the latter and Intensity.

      I'm with Peter Westfall on this. Here, I'd skip the two warm-and-fuzzy latent factors and just use multiple regression.

      Comment


      • #4
        Originally posted by Joseph Coveney View Post
        Intensity is observed, and so I doubt that its identification is the problem.

        I suggest to remove the covariance between the Cognitive and Behavior latent factors before adding the arrow between the latter and Intensity.

        I'm with Peter Westfall on this. Here, I'd skip the two warm-and-fuzzy latent factors and just use multiple regression.
        Because I'm not used to reading SEM diagrams in Stata, I saw that Intensity was capitalized, and thus I thought it was latent. Matthew, I'd suggest you post your actual Stata code where you try to link Behavioral to Intensity.

        Also, it helps me (and probably will help others) if you format your code like this, because it's easier to read what observed indicators go to what latent variable. /// is a line break. You can't type the code below line by line in the command window. You need to go to a do file, paste this in, and then run the whole chunk of code.

        Code:
        sem (Cognitive -> poc_consciousness_raising poc_dramatic_relief  poc_environmental_reevaluation poc_self_reevaluation poc_self_liberation mean_hrpct, ) ///
        (Behavioral -> poc_social_liberation poc_counterconditioning poc_helping_relationships poc_reinforcement_management poc_stimulus_control mean_hrpct,) ///
        (mean_hrpct -> age gender race_code bmi jp_fat) if measurement==1 & removemean_hrpctz==0, ///
        covstruct(_lexogenous, diagonal) cov(_lexogenous*_oexogenous@0) method(mlmv) standardized latent(Cognitive Behavioral) cov( Cognitive*Behavioral) nocapslatent from(b)
        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


        • #5
          I suspect Matthew used the sem builder which in turn generated the code. The code is functional but I don't think most humans would code it that way.

          I don't think Matthew needs to upload all or even part of the data. I think he could just do it with ssd commands, which would give the means, standard deviations, correlations, and # of cases. He could get all those with the ssd build command. Whether he is willing to share all that, I don't know.
          -------------------------------------------
          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