Announcement

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

  • Correlation Matrix using SEM command

    Hello everyone,

    I would like to ask for your feedback on whether my approach to deriving a correlation matrix is appropriate.

    I am working with a dataset that includes survey weights, and I want to create a correlation matrix of key variables and covariates.

    I have been referring to this document for guidance: https://www.stata.com/manuals13/semexample16.pdf

    This is the command I used:
    Code:
    svy,subpop(if lfl7spdied == -1 & dementia_community == 1):sem ( <- black_dummy_2015 others_dummy_2015 burden_con_2015 pp_sumscore_2015 ss_sumscore_2015 overall_caregiver_support_2015 gad2_cont_2017_new age_2015 gender_2015 income_middle_dummy_2015 income_highest_dummy_2015 education_nodegree_dummy_2015 education_degree_dummy_2015), standardized
    This is the result:

    Code:
    ----------------------------------------------------------------------------------------------------------------------------------
                                                                     |             Linearized
                                                        Standardized | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
    -----------------------------------------------------------------+----------------------------------------------------------------
                                               mean(black_dummy_2015)|   .5414392   .0487681    11.10   0.000      .443579    .6392995
                                              mean(others_dummy_2015)|   .6343626   .0856316     7.41   0.000     .4625302     .806195
                                                mean(burden_con_2015)|   .7306887    .055289    13.22   0.000     .6197431    .8416343
                                               mean(pp_sumscore_2015)|   1.728036     .09571    18.05   0.000      1.53598    1.920092
                                               mean(ss_sumscore_2015)|   .6739034    .053707    12.55   0.000     .5661323    .7816744
                                 mean(overall_caregiver_support_2015)|   1.916074   .1180063    16.24   0.000     1.679277    2.152871
                                             mean(gad2_cont_2017_new)|   2.129797   .0886936    24.01   0.000      1.95182    2.307774
                                                       mean(age_2015)|   4.576868   .3258994    14.04   0.000     3.922903    5.230833
                                                    mean(gender_2015)|   1.516775   .1235758    12.27   0.000     1.268803    1.764748
                                       mean(income_middle_dummy_2015)|   .7021273    .058886    11.92   0.000     .5839639    .8202907
                                      mean(income_highest_dummy_2015)|   .5947066   .0601872     9.88   0.000     .4739321    .7154811
                                  mean(education_nodegree_dummy_2015)|   .5710484    .041928    13.62   0.000     .4869137     .655183
                                    mean(education_degree_dummy_2015)|   .7127419   .0675735    10.55   0.000     .5771457    .8483381
    -----------------------------------------------------------------+----------------------------------------------------------------
                                                var(black_dummy_2015)|          1          .                             .           .
                                               var(others_dummy_2015)|          1          .                             .           .
                                                 var(burden_con_2015)|          1          .                             .           .
                                                var(pp_sumscore_2015)|          1          .                             .           .
                                                var(ss_sumscore_2015)|          1          .                             .           .
                                  var(overall_caregiver_support_2015)|          1          .                             .           .
                                              var(gad2_cont_2017_new)|          1          .                             .           .
                                                        var(age_2015)|          1          .                             .           .
                                                     var(gender_2015)|          1          .                             .           .
                                        var(income_middle_dummy_2015)|          1          .                             .           .
                                       var(income_highest_dummy_2015)|          1          .                             .           .
                                   var(education_nodegree_dummy_2015)|          1          .                             .           .
                                     var(education_degree_dummy_2015)|          1          .                             .           .
    -----------------------------------------------------------------+----------------------------------------------------------------
                              cov(black_dummy_2015,others_dummy_2015)|  -.3434688   .0442519    -7.76   0.000    -.4322668   -.2546708
                                cov(black_dummy_2015,burden_con_2015)|   -.117412   .0518461    -2.26   0.028    -.2214488   -.0133752
                               cov(black_dummy_2015,pp_sumscore_2015)|  -.0012803   .0516276    -0.02   0.980    -.1048787    .1023182
                               cov(black_dummy_2015,ss_sumscore_2015)|  -.0395679   .0519593    -0.76   0.450    -.1438319    .0646961
                 cov(black_dummy_2015,overall_caregiver_support_2015)|   .0541054    .061301     0.88   0.382     -.068904    .1771148
                             cov(black_dummy_2015,gad2_cont_2017_new)|  -.0531249   .0568641    -0.93   0.354    -.1672311    .0609812
                                       cov(black_dummy_2015,age_2015)|  -.0975533   .0563254    -1.73   0.089    -.2105784    .0154718
                                    cov(black_dummy_2015,gender_2015)|  -.0685557   .0728298    -0.94   0.351    -.2146995     .077588
                       cov(black_dummy_2015,income_middle_dummy_2015)|  -.0545097   .0650997    -0.84   0.406    -.1851418    .0761223
                      cov(black_dummy_2015,income_highest_dummy_2015)|  -.1398925   .0596025    -2.35   0.023    -.2594938   -.0202913
                  cov(black_dummy_2015,education_nodegree_dummy_2015)|   .0581537   .0560732     1.04   0.304    -.0543654    .1706728
                    cov(black_dummy_2015,education_degree_dummy_2015)|  -.1593424   .0691944    -2.30   0.025    -.2981912   -.0204936
                               cov(others_dummy_2015,burden_con_2015)|   .0797901   .0993774     0.80   0.426    -.1196252    .2792055
                              cov(others_dummy_2015,pp_sumscore_2015)|  -.1247267   .0887315    -1.41   0.166    -.3027796    .0533261
                              cov(others_dummy_2015,ss_sumscore_2015)|   -.035729   .0967696    -0.37   0.713    -.2299114    .1584534
                cov(others_dummy_2015,overall_caregiver_support_2015)|  -.0673187    .102811    -0.65   0.515    -.2736242    .1389867
                            cov(others_dummy_2015,gad2_cont_2017_new)|  -.1657358    .053944    -3.07   0.003    -.2739823   -.0574894
                                      cov(others_dummy_2015,age_2015)|  -.1552277   .0806392    -1.92   0.060     -.317042    .0065867
                                   cov(others_dummy_2015,gender_2015)|   .0549183   .0876185     0.63   0.534     -.120901    .2307377
                      cov(others_dummy_2015,income_middle_dummy_2015)|   -.060682    .083535    -0.73   0.471    -.2283072    .1069432
                     cov(others_dummy_2015,income_highest_dummy_2015)|   -.067295   .0919531    -0.73   0.468    -.2518124    .1172224
                 cov(others_dummy_2015,education_nodegree_dummy_2015)|  -.0326265    .072867    -0.45   0.656    -.1788448    .1135918
                   cov(others_dummy_2015,education_degree_dummy_2015)|   .1237474   .1123541     1.10   0.276    -.1017077    .3492025
                                cov(burden_con_2015,pp_sumscore_2015)|   -.126503   .0744729    -1.70   0.095    -.2759438    .0229378
                                cov(burden_con_2015,ss_sumscore_2015)|     .20376   .0970496     2.10   0.041     .0090158    .3985042
                  cov(burden_con_2015,overall_caregiver_support_2015)|   .0965205   .1091871     0.88   0.381    -.1225794    .3156205
                              cov(burden_con_2015,gad2_cont_2017_new)|      .1958   .0644432     3.04   0.004     .0664854    .3251147
                                        cov(burden_con_2015,age_2015)|  -.0381358   .0640562    -0.60   0.554    -.1666741    .0904024
                                     cov(burden_con_2015,gender_2015)|   .2020486   .0474854     4.25   0.000     .1067622     .297335
                        cov(burden_con_2015,income_middle_dummy_2015)|  -.0383833   .0649882    -0.59   0.557    -.1687916     .092025
                       cov(burden_con_2015,income_highest_dummy_2015)|   -.006801   .0652831    -0.10   0.917    -.1378012    .1241992
                   cov(burden_con_2015,education_nodegree_dummy_2015)|   .2010744     .06941     2.90   0.006      .061793    .3403558
                     cov(burden_con_2015,education_degree_dummy_2015)|   .0311916   .0835083     0.37   0.710      -.13638    .1987632
                               cov(pp_sumscore_2015,ss_sumscore_2015)|   .2213706   .0584951     3.78   0.000     .1039917    .3387496
                 cov(pp_sumscore_2015,overall_caregiver_support_2015)|   .2787945   .0636334     4.38   0.000     .1511047    .4064843
                             cov(pp_sumscore_2015,gad2_cont_2017_new)|   -.039442   .0651151    -0.61   0.547     -.170105     .091221
                                       cov(pp_sumscore_2015,age_2015)|  -.1182591   .0736004    -1.61   0.114    -.2659491    .0294309
                                    cov(pp_sumscore_2015,gender_2015)|  -.0255948   .0583083    -0.44   0.663    -.1425989    .0914094
                       cov(pp_sumscore_2015,income_middle_dummy_2015)|   .0562742    .073771     0.76   0.449    -.0917581    .2043064
                      cov(pp_sumscore_2015,income_highest_dummy_2015)|   .3520238   .0650717     5.41   0.000      .221448    .4825996
                  cov(pp_sumscore_2015,education_nodegree_dummy_2015)|   -.005251   .0915988    -0.06   0.955    -.1890575    .1785555
                    cov(pp_sumscore_2015,education_degree_dummy_2015)|   .2114563   .0919304     2.30   0.025     .0269845    .3959281
                 cov(ss_sumscore_2015,overall_caregiver_support_2015)|   .7286871   .0341241    21.35   0.000     .6602121    .7971622
                             cov(ss_sumscore_2015,gad2_cont_2017_new)|    .070241    .072094     0.97   0.334    -.0744263    .2149083
                                       cov(ss_sumscore_2015,age_2015)|  -.0880865   .0726559    -1.21   0.231    -.2338812    .0577082
                                    cov(ss_sumscore_2015,gender_2015)|  -.0208017   .0605459    -0.34   0.733    -.1422961    .1006926
                       cov(ss_sumscore_2015,income_middle_dummy_2015)|  -.0317639   .0597881    -0.53   0.597    -.1517375    .0882097
                      cov(ss_sumscore_2015,income_highest_dummy_2015)|   .1711175   .0582504     2.94   0.005     .0542296    .2880054
                  cov(ss_sumscore_2015,education_nodegree_dummy_2015)|  -.0420811    .060744    -0.69   0.492    -.1639729    .0798107
                    cov(ss_sumscore_2015,education_degree_dummy_2015)|   .1768812   .0816779     2.17   0.035     .0129824      .34078
               cov(overall_caregiver_support_2015,gad2_cont_2017_new)|   .1104752   .0808636     1.37   0.178    -.0517896    .2727399
                         cov(overall_caregiver_support_2015,age_2015)|  -.1764987   .0869611    -2.03   0.048    -.3509989   -.0019985
                      cov(overall_caregiver_support_2015,gender_2015)|  -.1115753   .0605257    -1.84   0.071     -.233029    .0098784
         cov(overall_caregiver_support_2015,income_middle_dummy_2015)|  -.0430981   .0693295    -0.62   0.537    -.1822179    .0960218
        cov(overall_caregiver_support_2015,income_highest_dummy_2015)|   .2019868   .0465227     4.34   0.000     .1086322    .2953414
    cov(overall_caregiver_support_2015,education_nodegree_dummy_2015)|  -.0289982   .0655182    -0.44   0.660    -.1604701    .1024737
      cov(overall_caregiver_support_2015,education_degree_dummy_2015)|   .1504074   .0916671     1.64   0.107    -.0335361    .3343508
                                     cov(gad2_cont_2017_new,age_2015)|   .0533754   .0584003     0.91   0.365    -.0638134    .1705643
                                  cov(gad2_cont_2017_new,gender_2015)|   .0673104   .0650918     1.03   0.306    -.0633058    .1979266
                     cov(gad2_cont_2017_new,income_middle_dummy_2015)|   .0156109   .0631985     0.25   0.806    -.1112062     .142428
                    cov(gad2_cont_2017_new,income_highest_dummy_2015)|  -.0855794   .0545082    -1.57   0.122    -.1949582    .0237993
                cov(gad2_cont_2017_new,education_nodegree_dummy_2015)|  -.0389021   .0632003    -0.62   0.541    -.1657228    .0879186
                  cov(gad2_cont_2017_new,education_degree_dummy_2015)|  -.1231722   .0621899    -1.98   0.053    -.2479654    .0016209
                                            cov(age_2015,gender_2015)|  -.0073641   .0607158    -0.12   0.904    -.1291993    .1144711
                               cov(age_2015,income_middle_dummy_2015)|  -.0747732   .0739356    -1.01   0.317    -.2231359    .0735896
                              cov(age_2015,income_highest_dummy_2015)|   .0447633   .0718098     0.62   0.536    -.0993335    .1888602
                          cov(age_2015,education_nodegree_dummy_2015)|  -.0734998   .0797145    -0.92   0.361    -.2334587    .0864591
                            cov(age_2015,education_degree_dummy_2015)|  -.1114566   .0829494    -1.34   0.185    -.2779068    .0549936
                            cov(gender_2015,income_middle_dummy_2015)|  -.0492902   .0757511    -0.65   0.518    -.2012958    .1027154
                           cov(gender_2015,income_highest_dummy_2015)|  -.0094492   .0878228    -0.11   0.915    -.1856786    .1667802
                       cov(gender_2015,education_nodegree_dummy_2015)|   .0541409   .0658622     0.82   0.415    -.0780213    .1863032
                         cov(gender_2015,education_degree_dummy_2015)|   .0093998   .0659914     0.14   0.887    -.1230216    .1418213
              cov(income_middle_dummy_2015,income_highest_dummy_2015)|  -.4175598   .0478969    -8.72   0.000     -.513672   -.3214475
          cov(income_middle_dummy_2015,education_nodegree_dummy_2015)|   .1096786    .083194     1.32   0.193    -.0572624    .2766196
            cov(income_middle_dummy_2015,education_degree_dummy_2015)|  -.0362842   .0907088    -0.40   0.691    -.2183048    .1457364
         cov(income_highest_dummy_2015,education_nodegree_dummy_2015)|  -.0546737   .0745125    -0.73   0.466    -.2041939    .0948465
           cov(income_highest_dummy_2015,education_degree_dummy_2015)|   .3685904   .0895839     4.11   0.000     .1888272    .5483536
       cov(education_nodegree_dummy_2015,education_degree_dummy_2015)|  -.4070101   .0374472   -10.87   0.000    -.4821535   -.3318667
    ----------------------------------------------------------------------------------------------------------------------------------
    For my understanding, SEM treats dummy variables as continuous, ranging from 0 to 1, and calculates means for these variables in the output (e.g., in the first row of the correlation matrix).

    I would like to seek your insights on whether my approach is appropriate. If it is, how should I interpret the correlations between two dummy variables, or between a dummy variable and a continuous variable?

    If this approach is not suitable, could you kindly share any alternative methods for deriving a correlation matrix that would be appropriate for survey-weighted data and datasets including both continuous and categorical variables?


    Thank you very much for your time and guidance.

  • #2
    What do you want to do with the correlation matrix? Or: Why don't you want to use correlate? Another question (which may be related): What is the nature of your variables? If the dichotomous variables are artificially dichotomous (i.e., if they measure a continuous construct that has been reduced to two values) and you want to estimate how the continuous construct “behind” the dichotomous variables correlates, you could consider tetrachoric correlation coefficients for the correlation between dichotomous variables or, more generally, polychoric correlation coefficients for the correlation between continuous and dichotomous variables.

    How to obtain tetrachoric or polychoric correlation coefficients with sem is beyond my expertise, but if you just want to obtain a correlation matrix, check out findit polychoric (in Stata). It seems to allow for weights (I don't know which kind of weights), but the help says "The standard error for the Pearson moment correlation does not account for weights properly. That will be fixed later if anybody needs that standard error."

    Comment


    • #3
      Dirk Enzmann Thank you so much for your invaluable insights!

      Comment

      Working...
      X