Announcement

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

  • Error when estimating multigroup sem using difficult technique(nr bhhh dfp bfgs)

    Hi all! First time writing into statalist.

    I have been having difficulty using a multigroup structural equation model using Stata 17.0.
    I'm have had no problem running the multigroup structural equation model based on the Theory of Planned Behavior (TPB) for sustainable food consumption using the following syntax:
    sem (Att -> tpbc_att1_1 tpbc_att2_1 tpbc_att3_1 ) ///
    (PBC -> tpbc_pbc1_1 tpbc_pbc2_1 tpbc_pbc3_1 ) ///
    (Mobl -> tpbc_mobl1_1 tpbc_mobl2_1 tpbc_mobl3_1 ) ///
    (Subn -> tpbc_subn1_1 tpbc_subn2_1 tpbc_subn3_1 ) ///
    (Int -> tpbc_int1_1 tpbc_int2_1 tpbc_int3_1 ) ///
    (Att PBC Mobl Subn -> Int ), ///
    covstruct(_lexogenous, diagonal) group(cs1) ginvariant(mcoef mcons) method(mlmv) latent(Att PBC Mobl Subn Int) cov(Att*PBC Att*Mobl Att*Subn PBC*Mobl PBC*Subn Mobl*Subn) standardized nocapslatent

    However, when I try to apply the same model for sustainable garden management, the multigroup SEM, with the exact same syntax, does not converge.

    That's when I tried fitting the model with difficult technique(nr bhhh dfp bfgs) using the following syntax:
    sem (Att -> tpbg_att1_1 tpbg_att2_1 tpbg_att3_1 ) /// (PBC -> tpbg_pbc1_1 tpbg_pbc2_1 tpbg_pbc3_1 ) ///
    (Mobl -> tpbg_mobl1_1 tpbg_mobl2_1 tpbg_mobl3_1 ) ///
    (Subn -> tpbg_subn1_1 tpbg_subn2_1 tpbc_subn3_1 ) ///
    (Int -> tpbg_int1_1 tpbg_int2_1 tpbg_int3_1 ) ///
    (Att PBC Mobl Subn -> Int ), ///
    covstruct(_lexogenous, diagonal) group(cs1) ginvariant(mcoef mcons) method(mlmv) latent(Att PBC Mobl Subn Int) cov(Att*PBC Att*Mobl Att*Subn PBC*Mobl PBC*Subn Mobl*Subn) difficult technique (nr bhhh dfp bfgs) standardized nocapslatent

    I get the follwing error message:
    Fitting target model: (setting technique to nr)
    Iteration 0: log likelihood = -51013.424 (not concave)
    Iteration 1: log likelihood = -27388.496 (not concave)
    Iteration 2: log likelihood = -25269.469 (not concave)
    Iteration 3: log likelihood = -25261.388 (not concave)
    Iteration 4: log likelihood = -25260.881 (not concave)
    (switching technique to bhhh)
    Iteration 5: log likelihood = -25260.873
    Iteration 6: log likelihood = -25260.873 (backed up)
    Iteration 7: log likelihood = -25260.873 (backed up)
    Iteration 8: log likelihood = -25260.873 (backed up)
    Iteration 9: log likelihood = -25260.873 (backed up)
    (switching technique to dfp)
    Iteration 10: log likelihood = -25260.873 (backed up)
    Iteration 11: log likelihood = -25260.873 (backed up)
    Iteration 12: log likelihood = -25260.873 (backed up)
    Iteration 13: log likelihood = -25260.873 (backed up)
    Iteration 14: log likelihood = -25260.873 (backed up)
    (switching technique to bfgs)
    Iteration 15: log likelihood = -25260.873 (backed up)
    Iteration 16: log likelihood = -25260.873 (backed up)
    Iteration 17: log likelihood = -25256.278
    _sem_eval_mlmv_v2(): 3301 subscript
    invalid opt__calluser1_v(): - function returned error
    opt__eval_bfgs_v1(): - function returned error
    opt__eval_bfgs_v2(): - function returned error
    opt__eval_cycle(): - function returned error
    opt__eval(): - function returned error
    opt__steputil_backward(): - function returned error
    opt__step(): - function returned error
    opt__looputil_step(): - function returned error
    opt__loop_cycle(): - function returned error
    opt__loop(): - function returned error
    _optimize(): - function returned error
    _sem_fit(): - function returned error
    st_sem_fit(): - function returned error
    <istmt>: - function returned error
    r(3301);

    Is anyone aware of the mistake I might be making? Thank you!
    My sample size is 307 for group 1 and 541 for group 2, and the dataset has been cleaned to not contain more than 10% of missing values.
    Last edited by Birgit Vanden Berghen; 09 Oct 2024, 03:53.

  • #2
    Originally posted by Birgit Vanden Berghen View Post
    I get the follwing error message:
    . . . r(3301);
    From its return code, the error's description in the documentation is, "The subscript is out of range (refers to a row or column that does not exist) or contains the wrong number of elements."

    The following code shows a replicable case of this error in an analogous SEM fitting exercise. First, I try to fit the SEM without group(). (First model in the code below.) The algorithm converges, but gives a notice in the footnote,"The LR test of model vs. saturated is not reported because the saturated model is not full rank." Going ahead and fitting the same model but with two groups (second model in the code below) gives the same error that you get.
    Code:
    version 18.0
    
    clear *
    
    sysuse auto
    
    sem ///
        (price mpg rep78 displacement gear_ratio <- A) ///
        (headroom trunk weight length <- B), ///
            /* group(foreign) ginvariant(mcoef mcons) */ ///
            method(mlmv) ///
            difficult technique (nr bhhh dfp bfgs)
    
    sem ///
        (price mpg rep78 displacement gear_ratio <- A) ///
        (headroom trunk weight length <- B), ///
            group(foreign) ginvariant(mcoef mcons) ///
            method(mlmv) ///
            difficult technique (nr bhhh dfp bfgs)
    
    exit
    It might have to do with a rank-deficient matrix arising somewhere in the fitting process when you make more demands on the model than the data can support. What do you get when you omit (comment out) the group() option as in the first SEM in the code above?

    The error probably ought to be trapped so that the SEM-fitting algorithm can exit gracefully with a more user-friendly error message. You might want to contact Stata's technical support staff about it.

    Comment


    • #3
      Birgit has found a bug in sem with option method(mlmv) when it is having difficulty computing the log-likelihood for observations within one of the missing value pattern data subsets within a group. We hope to fix this bug in Stata 18 soon.

      Birgit, please write to tech support and mention my offer to help you with the fix for Stata 17. Note however, I can make no promise that the fix will result in sem being able to fit your model to your data.

      PS. Thanks to Joseph for providing a simple reproducible example that helped us find the bug.
      Last edited by Jeff Pitblado (StataCorp); 09 Oct 2024, 11:19.

      Comment


      • #4
        Hi Joseph and Jeff,

        When I omit the group option, the model does converge properly. The footnote does not indicate a rank-deficiency.
        LR test of model vs. saturated: chi2(80) = 1178.45 Prob > chi2 = 0.0000

        Running the code for group 1 and 2 seperately also works and results in a fitted model.
        So could it be that error is coming from (over)constraining the mcoef and mcons to be the same in both groups?

        Edit: However, running the model with the group option ginvariant(none) again results in the same error as before.
        Edit2: I will contact tech support.
        Last edited by Birgit Vanden Berghen; 09 Oct 2024, 11:28.

        Comment

        Working...
        X