Announcement

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

  • Tetrad analysis: problem with estat framework

    Dear all,

    I am new to Stata.

    I am trying to run a confirmatory tetrad analysis using Bauldry and Bollen macro.

    Unfortunately, I got the following error message testing their macro. Can anyone help me with this problem. I put my syntax below.

    Many thanks in advance.


    . . qui sem estat framework, fitted
    variable estat not found;
    Perhaps you meant 'estat' to specify a latent variable.
    For 'estat' to be a valid latent variable specification, 'estat' must begin with a capital letter.
    r(111);

    . . mat sigma1 = r (Sigma)
    r not found
    r(111);

    My syntax :


    net install tetrad, from(https://github.com/sbauldry/tetrad/raw/master) replace

    clear all
    ssd init x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12
    ssd set obs 2000
    ssd set cov (ltd) 1 .02 1 .02 .02 1 .01 .01 .01 1 .01 .01 .01 .02 1 .01 .01 .01 .02 .02 1 .01 .01 .01 .01 .01 .01 1 .01 .01 .01 .01 .01 .01 .02 1 .01 .01 .01 .01 .01 .01 .02 .02 1 .01 .01 .01 .01 .01 .01 .01 .01 .01 1 .01 .01 .01 .01 .01 .01 .01 .01 .01 .02 1 .01 .01 .01 .01 .01 .01 .01 .01 .01 .02 .02 1
    . sem (A->x1 x2 x3) (B->x4 x5 x6) (C->x7 x8 x9) (D->x10 x11 x12) (x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12<-F), var (F@1 A@1 B@1 C@1 D@1) covariance (A*B@0 A*C@0 A*D@0 B*C@0 B*D@0 C*D@0) covariance (A*F@0 B*F@0 C*F@0 D*F@0)
    . estat framework
    . qui sem (A->x1 x2 x3) (B->x4 x5 x6) (C->x7 x8 x9) (D->x10 x11 x12) (x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12<-F), var (F@1 A@1 B@1 C@1 D@1) covariance (A*B@0 A*C@0 A*D@0 B*C@0 B*D@0 C*D@0) covariance (A*F@0 B*F@0 C*F@0 D*F@0)
    . qui sem estat framework, fitted
    . mat sigma1 = r (Sigma)


  • #2
    The command you want is -qui estat framework, fitted-, with no mention of -sem-. When -estat- commands are used, Stata automatically uses the results of the most recently run estimation command, so you don't have to (and, as you have learned, cannot) include the name of that estimation command in the -estat- command.

    Comment


    • #3
      Dear Clyde,

      Thank you very much for your helpful reply. I would have not find the problem without your help. I am disappointed with the use of Stata at the moment.

      Now it runes without the mention of "sem". Unfortunately after I got the following error with the last line. I do not manage to store the implied covariance matrix as "sigma".

      Can you please help me with this problem ?

      Many thanks in advance

      . . mat sigma1 = r (Sigma)
      r not found
      r(111);





      clear all
      ssd init x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12
      ssd set obs 2000
      ssd set cov (ltd) 1 .02 1 .02 .02 1 .01 .01 .01 1 .01 .01 .01 .02 1 .01 .01 .01 .02 .02 1 .01 .01 .01 .01 .01 .01 1 .01 .01 .01 .01 .01 .01 .02 1 .01 .01 .01 .01 .01 .01 .02 .02 1 .01 .01 .01 .01 .01 .01 .01 .01 .01 1 .01 .01 .01 .01 .01 .01 .01 .01 .01 .02 1 .01 .01 .01 .01 .01 .01 .01 .01 .01 .02 .02 1
      . sem (A->x1 x2 x3) (B->x4 x5 x6) (C->x7 x8 x9) (D->x10 x11 x12) (x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12<-F), var (F@1 A@1 B@1 C@1 D@1) covariance (A*B@0 A*C@0 A*D@0 B*C@0 B*D@0 C*D@0) covariance (A*F@0 B*F@0 C*F@0 D*F@0)
      . estat framework
      . qui sem (A->x1 x2 x3) (B->x4 x5 x6) (C->x7 x8 x9) (D->x10 x11 x12) (x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12<-F), var (F@1 A@1 B@1 C@1 D@1) covariance (A*F@0 B*F@0 C*F@0 D*F@0)
      . qui estat framework, fitted
      . mat sigma1 = r (Sigma)

      Comment


      • #4
        1
        Last edited by Raphael Lefranc; 12 Jul 2025, 03:45.

        Comment


        • #5
          You have r (Sigma). Get rid of the extra space and make it r(Sigma). Extraneous and missing spaces can often cause problems because the error messages don't tell you that the real problem is extraneous or missing spaces.

          Is the code you show the code you are actually running? When I run it, I get

          Code:
          Warning: The LR test of model vs. saturated is not reported because the
                   fitted model is not full rank. There appears to be 3 more fitted
                   parameters than the data can support.
          convergence not achieved
          r(430);
          When you present examples, run the examples yourself and make sure they actually work. Convergence may not be a problem with the real data, but I bet the real data still gives you the warning message about the LR test.
          -------------------------------------------
          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