Announcement

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

  • How to Export Standardized Results in SEM

    Dear Stata users,

    I recently performed a non-recursive structural equation model in Stata, which yielded successful results. However, I am encountering difficulties when attempting to export the standardized results into a Word document. I mean, even after adding the option "standardized", what I output is still the results before standardization. I'm not sure where the standardized results are stored, nor do I know how to export them. The command I used is as follows:
    Code:
    sem ($y1 <-  $y2 $x1 $x5 $x7) ($y2 <- $y1 $x2 $x6 $x7)($y3 <-  $y4 $y1 $y2 $x1 $x5 $x7) ($y4 <- $y3 $y1 $y2 $x2 $x6 $x7), cov(e.$y1*e.$y2) cov(e.$y3*e.$y4) nocapslatent standardized
        estimates store SEM
        outreg2 [SEM] using $root\Results\result1, word stats(coef se) replace dec(3) 2aster
    If any of you have experience with this or can offer advice on successfully exporting standardized results to a Word document, I would greatly appreciate your help.

    Thank you for taking the time to read this.

    Best regards,

    Mindy

  • #2
    Provide a reproducible example that illustrates what you mean by standardized results. See FAQ Advice #12 for how to do so.

    Comment


    • #3
      Dear Andrew Musau ,

      Thank you for your prompt response. Here is the data example:
      Code:
      * Example generated by -dataex-. To install: ssc install dataex
      clear
      input float(LS_w LS_h SWB_w SWB_h Trust_w Trust_h) double Age_w float(Edu_year_w Ethnicity_w Health_w Pension_w) double Age_h float(Edu_year_h Ethnicity_h Pension_h Familysize)
      4.3333335         5 4.1 4.1  3.333333 4.3333335 49 12 1 1 1 52 12 1 1 3
              4 4.3333335 4.1 4.3  3.333333 4.3333335 27 16 1 1 1 29 16 1 1 2
       3.666667         5 4.8 4.8  3.333333         2 28 12 1 1 1 37 11 1 1 2
       3.666667 4.3333335 3.8 4.8         4 4.3333335 25 16 1 0 1 27 16 1 1 4
              5         5   5 4.1  3.333333  3.333333 52 12 1 1 1 51 15 1 1 4
      4.6666665 4.6666665 4.1 4.1         4         3 48 15 1 1 1 50 12 1 1 3
       2.666667         4   3 4.3  3.666667         4 42 12 1 1 1 44 12 1 1 3
              5         5   5 4.5  3.333333         4 50 12 1 0 1 53 15 1 1 3
              5         5   5 4.5  3.333333  3.666667 45 12 1 1 1 58 12 1 1 6
      4.3333335         5   5 3.5  3.333333  2.666667 37 12 1 1 1 38 12 1 1 3
      4.6666665         5 4.3   3  3.333333         4 57 12 1 0 1 58 12 1 1 3
       3.666667         5 3.9 3.2         4  3.666667 30 15 1 1 1 32 15 1 1 5
       3.666667         5   5 4.5  2.666667         4 44 15 1 1 1 49  9 1 1 5
       3.666667  3.666667 4.8   5         4         3 39 15 1 1 1 40 12 1 1 4
      4.3333335         5 4.1 4.3  2.666667 4.6666665 34 15 1 1 1 35 15 1 1 4
              4         5 4.6 4.8         2 4.3333335 34 16 1 1 1 38 16 1 1 2
              3         5 4.1 4.1         3  3.333333 46 12 0 1 1 48 16 0 1 3
              4         4 4.1   2  3.333333  3.333333 36  6 1 0 1 40  9 1 1 4
              4         5   5 4.5 4.3333335  3.666667 32  0 1 1 1 32  9 1 1 2
              3         5 4.1 3.9  3.666667  3.666667 30 16 1 1 1 34 16 1 1 2
      end
      label values Age_w age
      label values Age_h age
      Here is the command I used:
      Code:
      global y1 LS_w
          global y2 LS_h
          global y3 SWB_w
          global y4 SWB_h
          global x1 Trust_w 
          global x2 Trust_h 
          global x3 Age_w Edu_year_w Ethnicity_w Health_w Pension_w 
          global x4 Age_h Edu_year_h Ethnicity_h  Health_w Pension_h 
          global x5 Familysize 
         
          sem ($y1 <-  $y2 $x1 $x3 $x5) ($y2 <- $y1 $x2 $x4 $x5)($y3 <-  $y4 $y1 $y2 $x1 $x3 $x5) ($y4 <- $y3 $y1 $y2 $x2 $x4 $x5), cov(e.$y1*e.$y2) cov(e.$y3*e.$y4) nocapslatent standardized
          ereturn list
      The results I am interested in are e(V_std) and e(b_std). After posting this question, I searched the forum and found a method recommended by you, which helped me obtain the desired results. Here is the command I used:
      Code:
       mat V= e(V_std)
          *PROGRAM TO REPLACE ESTIMATES IN e(V)
          program replaceV, eclass
          ereturn repost V = V
          end
          *RUN PROGRAM
          replaceV
          *NOW OUTPUT ESTIMATES
          estout * using $root\Results\result2.rtf, cells(b_std(star fmt(%9.3f)) se(par)) ///
          stats(N, fmt(%9.0g)) starlevels(* 0.05 ** 0.01) ///
          collabels(none) varlabels(_cons Constant) ///
          replace style(tab) order($y1 $y2 $y3 $y4 $x1 $x2 $x3 $x4 $x5)
      However, I encountered difficulties in perfectly exporting the entire table to a Word document. I primarily manually organize the data in Word to create tables similar to those in the Stata results window. If you have any suggestions or an easier method that could help me, I would greatly appreciate it.

      Thank you once again for your assistance.

      Best regards,
      Mindy

      Comment


      • #4


        Hi Andrew Musau ,

        I wanted to let you know that I've run into another problem while using the command. Either the standard errors of the output were incorrect (they remained pre-standardized), or there were inaccuracies in the significance levels in certain cases.

        I was wondering if you could provide some guidance on how to resolve these issues. Your help would be greatly appreciated.

        Thanks,
        Mindy

        Comment


        • #5


          Hi Andrew Musau ,

          I wanted to let you know that I've run into another problem while using the command. Either the standard errors of the output were incorrect (they remained pre-standardized), or there were inaccuracies in the significance levels in certain cases.

          I was wondering if you could provide some guidance on how to resolve these issues. Your help would be greatly appreciated.

          Thanks,
          Mindy

          Comment


          • #6
            Have you tested the code in #3 with the data presented? I get

            . sem ($y1 <- $y2 $x1 $x3) ($y2 <- $y1 $x2 $x4)($y3 <- $y4 $y1 $y2 $x1 $x3) ($y4 <- $y3 $y1 $y2 $x2 $x4), cov(e.$y1*e.$y2) cov(e.$y3
            > *e.$y4) nocapslatent standardized

            Endogenous variables

            Observed: LS_w LS_h SWB_w SWB_h

            Exogenous variables

            Observed: Trust_w Age_w Edu_year_w Ethnicity_w Health_w Pension_w Trust_h Age_h Edu_year_h Ethnicity_h Pension_h

            Fitting target model:

            initial values not feasible
            r(1400);

            end of do-file

            r(1400);

            .

            Comment


            • #7
              Hi Andrew Musau ,

              I apologize for the inconvenience. I attempted to run the code with the original data but didn't use the data I preovided to run. Maybe there is some trouble with the number of sample or variables. Consequently, I have incorporated new samples into the dataset. The revised data is provided below:
              Code:
              * Example generated by -dataex-. To install: ssc install dataex
              clear
              input float(LS_w LS_h SWB_w SWB_h Trust_w Trust2_w Trust3_w Trust_h Trust2_h Trust3_h) double Age_w float(Edu_year_w Ethnicity_w Health_w Pension_w) double Age_h float(Edu_year_h Ethnicity_h Pension_h Health_h Familysize Children_ratio Business Debt)
              4.3333335         5 4.1 4.1  3.333333 4.5 4.5 4.3333335   4 4.5 49 12 1 1 1 52 12 1 1 1 3         0 0 0
                      4 4.3333335 4.1 4.3  3.333333 2.5 3.5 4.3333335   4 4.5 27 16 1 1 1 29 16 1 1 0 2         0 0 1
               3.666667         5 4.8 4.8  3.333333   4   4         2   4   4 28 12 1 1 1 37 11 1 1 0 2  .3333333 0 0
               3.666667 4.3333335 3.8 4.8         4 4.5   4 4.3333335   5 4.5 25 16 1 0 1 27 16 1 1 1 4         0 0 1
                      5         5   5 4.1  3.333333   4   5  3.333333 4.5   5 52 12 1 1 1 51 15 1 1 1 4         0 0 1
              4.6666665 4.6666665 4.1 4.1         4   4   4         3   4   4 48 15 1 1 1 50 12 1 1 1 3         0 0 0
               2.666667         4   3 4.3  3.666667   3   4         4   4   4 42 12 1 1 1 44 12 1 1 1 3       .25 0 0
                      5         5   5 4.5  3.333333   4   5         4   4   4 50 12 1 0 1 53 15 1 1 1 3         0 0 0
                      5         5   5 4.5  3.333333   4   4  3.666667 4.5   5 45 12 1 1 1 58 12 1 1 1 6         0 0 0
              4.3333335         5   5 3.5  3.333333   4   4  2.666667 4.5   4 37 12 1 1 1 38 12 1 1 1 3         0 0 0
              4.6666665         5 4.3   3  3.333333 4.5 4.5         4 4.5 4.5 57 12 1 0 1 58 12 1 1 0 3         0 0 0
               3.666667         5 3.9 3.2         4 4.5   4  3.666667   4   4 30 15 1 1 1 32 15 1 1 1 5 .16666667 0 0
               3.666667         5   5 4.5  2.666667 4.5 4.5         4   4 4.5 44 15 1 1 1 49  9 1 1 1 5         0 0 0
               3.666667  3.666667 4.8   5         4   4   4         3 3.5   4 39 15 1 1 1 40 12 1 1 1 4        .2 0 0
              4.3333335         5 4.1 4.3  2.666667 4.5   5 4.6666665 4.5   5 34 15 1 1 1 35 15 1 1 1 4        .2 0 0
                      4         5 4.6 4.8         2   4   4 4.3333335   5 3.5 34 16 1 1 1 38 16 1 1 1 2  .3333333 0 1
                      3         5 4.1 4.1         3   4   4  3.333333   3   4 46 12 0 1 1 48 16 0 1 1 3         0 0 0
                      4         4 4.1   2  3.333333   3   4  3.333333 3.5 4.5 36  6 1 0 1 40  9 1 1 1 4  .3333333 0 0
                      4         5   5 4.5 4.3333335 4.5   5  3.666667   4   4 32  0 1 1 1 32  9 1 1 1 2        .5 1 0
                      3         5 4.1 3.9  3.666667   3 4.5  3.666667 4.5   4 30 16 1 1 1 34 16 1 1 0 2        .5 0 1
              1.6666666 4.6666665   3   5 4.3333335   4   3 4.6666665 4.5 4.5 39 12 1 1 1 43  7 1 1 1 2        .5 1 1
                      5         5   5   5         4 4.5 4.5         4 4.5   4 53  9 1 1 1 54 16 1 1 1 2         0 0 1
               3.666667         4 3.9 3.9         3   4   4         4   4 4.5 45 16 1 1 1 54 15 1 1 1 3         0 0 0
               3.666667         5 4.1   5         4   4   3  3.333333   4   4 37 16 1 1 1 38 15 1 1 1 2  .3333333 1 1
                      3         5 3.2 4.3 4.3333335 4.5   5         4   4   4 41 19 1 1 1 40 15 1 1 1 5         0 0 1
               3.666667         5 3.9 2.9         4 4.5   4         2   4   4 54 12 1 1 1 53 15 1 1 1 2         0 1 0
                      5 4.3333335 2.2 4.1         4   4   4  3.333333 4.5   5 42 16 1 1 1 48 15 1 1 1 2  .3333333 1 0
                      3         4 4.2   3         2   4   4         2   3   4 46 15 1 1 1 46 15 1 1 1 3         0 0 0
                      4 4.3333335 3.6 4.2 4.3333335   4   3  2.666667 3.5   3 35 12 1 1 0 38 12 0 1 1 2  .3333333 1 0
              4.3333335         4 4.1 3.6         4   4   4         4   4   4 41  9 1 1 1 46  9 1 1 1 3         0 1 1
                      4  3.666667 3.6   2         3   4   4  3.666667   4   4 35 15 1 1 1 36 15 1 1 1 3        .4 0 0
                      4         5 3.7   3         4   4 3.5  3.333333   4   5 47  6 1 1 0 52  9 1 1 1 2         0 1 1
              4.3333335         5 4.1   5  3.333333   4   4  2.666667   4   4 48 16 1 1 1 51  9 1 1 1 2         0 0 0
              4.6666665         5 4.1   5  2.666667   4   4         4   4 4.5 27 16 1 1 1 27 16 1 1 1 2         0 0 0
                      5         5 3.4 4.1  2.666667 3.5 4.5  3.333333   4   4 56  8 1 0 1 56  9 1 1 1 3         0 0 0
              4.6666665 4.3333335   5 3.9         2   4   4         4 4.5   4 40 16 1 1 1 38 16 1 1 1 3       .25 0 1
               3.666667         5 4.1   4         2   4 4.5  3.333333 3.5 3.5 43 12 1 1 1 45 12 1 1 1 3         0 0 1
                      5 4.3333335   5 4.2  3.666667   4   5  3.666667   4   4 55  9 1 0 0 53 12 1 1 1 3         0 0 1
              1.3333334         4 1.9   4         3   5   5         1 1.5   1 50  6 1 0 1 51  0 1 0 0 3       .25 0 0
               2.666667         5   3   3 4.3333335   5 4.5         4   4   4 52  9 1 0 1 51  8 1 0 1 3         0 0 1
              2.3333333         5   3   3 1.6666666 3.5 3.5 1.3333334   4   4 55  9 1 1 1 55  9 1 0 0 3         0 0 0
              1.3333334         5 4.1 4.1         4 4.5   5 2.3333333   4   4 44  9 1 1 1 44  9 1 0 1 5 .16666667 0 0
                      5         5 4.6   5         2   4   4  3.666667 4.5   4 37  9 1 1 1 38 12 1 1 1 3       .25 0 0
              4.3333335         4 4.1 3.4         3   4   4  3.333333   4   4 30 15 1 1 1 30 15 1 1 1 4  .3333333 0 1
               3.666667         5 4.1   5         4   5 4.5         4 4.5   4 53  9 1 0 1 52  0 1 1 1 6         0 0 1
               3.333333         5 3.7 4.1 1.3333334   4   3         4   3   5 54  9 1 1 1 54  9 1 1 1 7         0 0 0
                      4 4.3333335 4.1 4.6  3.666667   4 4.5         4   4 4.5 28 15 1 1 1 29 12 1 1 1 5  .2857143 0 0
                      5         4 3.6 4.1         3 3.5 3.5         4   4   4 42  9 1 1 1 43  9 1 0 0 3       .25 1 0
               3.666667         5 4.5   5  2.666667 4.5 4.5         3   3   3 38  6 1 1 1 40 15 1 1 1 5 .16666667 0 0
                      4  3.666667 3.7 4.1  3.666667 3.5 4.5         3   3   3 41 15 1 1 1 47 12 1 0 0 2  .3333333 1 1
              end
              label values Age_w age
              label values Age_h age
              And the new command is as follow:
              Code:
              global y1 LS_w
                  global y2 LS_h
                  global y3 SWB_w
                  global y4 SWB_h
                  global x1 Trust_w Trust2_w Trust3_w
                  global x2 Trust_h Trust2_h Trust3_h
                  global x3 Age_w Edu_year_w Ethnicity_w Health_w Pension_w Health_w 
                  global x4 Age_h Edu_year_h Ethnicity_h  Health_w Pension_h Health_h
                  global x5  Familysize Children_ratio  Business Debt 
                   
                  sem ($y1 <-  $y2 $x1 $x3 $x5) ($y2 <- $y1 $x2 $x4 $x5)($y3 <-  $y4 $y1 $y2 $x1 $x3 $x5) ($y4 <- $y3 $y1 $y2 $x2 $x4 $x5), cov(e.$y1*e.$y2) cov(e.$y3*e.$y4) nocapslatent standardized
                  ereturn list
                  
                  mat V= e(V_std)
                  *PROGRAM TO REPLACE ESTIMATES IN e(V)
                  program replaceV, eclass
                  ereturn repost V = V
                  end
                  *RUN PROGRAM
                  replaceV
                  *NOW OUTPUT ESTIMATES
                  estout  using $root\Results\result2.rtf, cells(b_std(star fmt(%9.3f)) se(par)) ///
                  stats(N, fmt(%9.0g)) starlevels(* 0.05 ** 0.01) ///
                  collabels(none) varlabels(_cons Constant) ///
                  replace style(tab) order($y1 $y2 $y3 $y4 $x1 $x2 $x3 $x4 $x5)
              This time I have tried it. I am really sorry for that.

              Best regards,
              Mindy

              Comment


              • #8
                Answered at https://www.statalist.org/forums/for...=1688398597329

                Comment

                Working...
                X