Hey,
How can I import the result into Word with number of cases and pseudo r squared at the bottom of the table? Any help will be greatly appreciated!
How can I import the result into Word with number of cases and pseudo r squared at the bottom of the table? Any help will be greatly appreciated!
Code:
. ssc install dataex checking dataex consistency and verifying not already installed... all files already exist and are up to date. . do "C:\Users\sofiy\AppData\Local\Temp\STD890_000000.tmp" . ssc install mimrgns // for displaying Average Marginal Effect (AME) after imputation checking mimrgns consistency and verifying not already installed... all files already exist and are up to date. . . mi estimate: logit W1ExcludeYP i.W1ethgrpYP i.W1truantYP substance_use delinquency [pweight = Designweight], vce (cluster SampPSU) // Model 1 Multiple-imputation estimates Imputations = 20 Logistic regression Number of obs = 13,179 Average RVI = 0.2268 Largest FMI = 0.4353 DF adjustment: Large sample DF: min = 105.33 avg = 11,096.99 max = 76,605.03 Model F test: Equal FMI F( 10, 5083.8) = 83.88 Within VCE type: Robust Prob > F = 0.0000 (Within VCE adjusted for 657 clusters in SampPSU) ---------------------------------------------------------------------------------- W1ExcludeYP | Coef. Std. Err. t P>|t| [95% Conf. Interval] -----------------+---------------------------------------------------------------- W1ethgrpYP | Mixed | .3225374 .1657035 1.95 0.052 -.0022466 .6473215 Indian | -.4764003 .1930587 -2.47 0.014 -.8560952 -.0967054 Pakistani | .0960448 .1851026 0.52 0.604 -.2690901 .4611796 Bangladeshi | .1531705 .2124236 0.72 0.472 -.2680108 .5743518 Black Caribbean | .8547337 .1650894 5.18 0.000 .5311594 1.178308 Black African | .2310925 .221778 1.04 0.298 -.203797 .665982 Other | .2327155 .2701427 0.86 0.390 -.2986834 .7641145 | W1truantYP | Truancy | 1.120452 .0916305 12.23 0.000 .9406731 1.30023 substance_use | .445085 .0810841 5.49 0.000 .2860448 .6041252 delinquency | .4182767 .0571057 7.32 0.000 .3062813 .5302721 _cons | -3.662631 .1404941 -26.07 0.000 -3.938164 -3.387099 ---------------------------------------------------------------------------------- . mimrgns, dydx(W1ethgrpYP W1truantYP substance_use delinquency) predict(pr) // AVE Multiple-imputation estimates Imputations = 20 Average marginal effects Number of obs = 13,179 Average RVI = 0.2314 Largest FMI = 0.4339 DF adjustment: Large sample DF: min = 106.01 avg = 11,095.43 Within VCE type: Delta-method max = 64,520.55 Expression : Pr(W1ExcludeYP), predict(pr) dy/dx w.r.t. : 2.W1ethgrpYP 3.W1ethgrpYP 4.W1ethgrpYP 5.W1ethgrpYP 6.W1ethgrpYP 7.W1ethgrpYP 8.W1ethgrpYP 1.W1truantYP substance_use delinquency ---------------------------------------------------------------------------------- | dy/dx Std. Err. t P>|t| [95% Conf. Interval] -----------------+---------------------------------------------------------------- W1ethgrpYP | Mixed | .0291455 .016369 1.78 0.075 -.0029382 .0612292 Indian | -.0328235 .0115853 -2.83 0.005 -.0556046 -.0100424 Pakistani | .0083399 .0159678 0.52 0.602 -.0231682 .0398479 Bangladeshi | .0135808 .0189144 0.72 0.474 -.0239189 .0510805 Black Caribbean | .0915785 .0218707 4.19 0.000 .048712 .1344451 Black African | .0203579 .0207511 0.98 0.327 -.0203329 .0610488 Other | .0208727 .0255618 0.82 0.415 -.029425 .0711703 | W1truantYP | Truancy | .1205845 .012445 9.69 0.000 .0961747 .1449944 substance_use | .0366144 .0068251 5.36 0.000 .0232271 .0500017 delinquency | .0344023 .0046561 7.39 0.000 .0252716 .0435329 ---------------------------------------------------------------------------------- Note: dy/dx for factor levels is the discrete change from the base level. . mi describe Style: mlong last mi update 06mar2024 18:15:02, 23 seconds ago Obs.: complete 8,824 incomplete 4,715 (M = 20 imputations) --------------------- total 13,539 Vars.: imputed: 13; W1ethgrpYP(21) in_poverty(0) W1hiqualgMP(541) W1SOCMajorMP(1408) W1englangYP(191) IndSchool(0) gor(8) urbind(8) W1truantYP(1033) substance_use(936) delinquency(1168) school_disengagement(1835) W1heposs9YP(777) passive: 0 regular: 0 system: 3; _mi_m _mi_id _mi_miss (there are 2038 unregistered variables) . local mtotal = r(M) . local r2 = 0 . forvalues i = 1 / `mtotal' { 2. logit W1ExcludeYP i.W1ethgrpYP i.W1truantYP substance_use delinquency if _mi_m == `i' 3. local r2 = `r2' + e(r2_p) 4. } Iteration 0: log likelihood = -1837.0555 Iteration 1: log likelihood = -1660.4176 Iteration 2: log likelihood = -1610.7318 Iteration 3: log likelihood = -1610.4145 Iteration 4: log likelihood = -1610.4144 Logistic regression Number of obs = 4,715 LR chi2(10) = 453.28 Prob > chi2 = 0.0000 Log likelihood = -1610.4144 Pseudo R2 = 0.1234 ---------------------------------------------------------------------------------- W1ExcludeYP | Coef. Std. Err. z P>|z| [95% Conf. Interval] -----------------+---------------------------------------------------------------- W1ethgrpYP | Mixed | -.0561942 .2039112 -0.28 0.783 -.4558529 .3434645 Indian | -.7040989 .2671199 -2.64 0.008 -1.227644 -.1805534 Pakistani | -.0428148 .1726379 -0.25 0.804 -.3811789 .2955492 Bangladeshi | -.1157213 .1777028 -0.65 0.515 -.4640124 .2325699 Black Caribbean | .8962012 .2104676 4.26 0.000 .4836924 1.30871 Black African | -.0242819 .2409743 -0.10 0.920 -.4965828 .448019 Other | .3109313 .2596396 1.20 0.231 -.197953 .8198157 | W1truantYP | Truancy | .9902644 .1068622 9.27 0.000 .7808183 1.19971 substance_use | .375692 .09918 3.79 0.000 .1813029 .5700811 delinquency | .5234286 .0670979 7.80 0.000 .3919191 .654938 _cons | -3.598544 .1699888 -21.17 0.000 -3.931715 -3.265372 ---------------------------------------------------------------------------------- Iteration 0: log likelihood = -1866.995 Iteration 1: log likelihood = -1698.4839 Iteration 2: log likelihood = -1653.9004 Iteration 3: log likelihood = -1653.6321 Iteration 4: log likelihood = -1653.632 Logistic regression Number of obs = 4,715 LR chi2(10) = 426.73 Prob > chi2 = 0.0000 Log likelihood = -1653.632 Pseudo R2 = 0.1143 ---------------------------------------------------------------------------------- W1ExcludeYP | Coef. Std. Err. z P>|z| [95% Conf. Interval] -----------------+---------------------------------------------------------------- W1ethgrpYP | Mixed | .0129823 .2001656 0.06 0.948 -.3793352 .4052997 Indian | -.4582114 .2468794 -1.86 0.063 -.9420861 .0256633 Pakistani | .0876595 .1656657 0.53 0.597 -.2370393 .4123584 Bangladeshi | -.1864405 .1827914 -1.02 0.308 -.5447052 .1718241 Black Caribbean | .8487998 .2102945 4.04 0.000 .4366302 1.260969 Black African | .184924 .2255799 0.82 0.412 -.2572045 .6270525 Other | .5617009 .2448062 2.29 0.022 .0818897 1.041512 | W1truantYP | Truancy | .931942 .1067091 8.73 0.000 .7227959 1.141088 substance_use | .5379987 .0990777 5.43 0.000 .3438101 .7321874 delinquency | .3934377 .0673583 5.84 0.000 .2614179 .5254575 _cons | -3.294041 .1673816 -19.68 0.000 -3.622103 -2.965979 ---------------------------------------------------------------------------------- Iteration 0: log likelihood = -1844.5845 Iteration 1: log likelihood = -1672.1388 Iteration 2: log likelihood = -1625.2088 Iteration 3: log likelihood = -1624.9067 Iteration 4: log likelihood = -1624.9067 Logistic regression Number of obs = 4,715 LR chi2(10) = 439.36 Prob > chi2 = 0.0000 Log likelihood = -1624.9067 Pseudo R2 = 0.1191 ---------------------------------------------------------------------------------- W1ExcludeYP | Coef. Std. Err. z P>|z| [95% Conf. Interval] -----------------+---------------------------------------------------------------- W1ethgrpYP | Mixed | -.0564516 .2040956 -0.28 0.782 -.4564715 .3435684 Indian | -.5773157 .2606406 -2.21 0.027 -1.088162 -.0664694 Pakistani | .0561259 .1689183 0.33 0.740 -.2749479 .3871997 Bangladeshi | .2396301 .1620555 1.48 0.139 -.0779929 .5572531 Black Caribbean | .8811197 .2135294 4.13 0.000 .4626097 1.29963 Black African | -.211779 .2591963 -0.82 0.414 -.7197945 .2962364 Other | .3097087 .2602789 1.19 0.234 -.2004285 .819846 | W1truantYP | Truancy | .9310005 .1082325 8.60 0.000 .7188687 1.143132 substance_use | .3948941 .0990204 3.99 0.000 .2008177 .5889706 delinquency | .5302961 .0670966 7.90 0.000 .3987891 .661803 _cons | -3.618555 .1698609 -21.30 0.000 -3.951476 -3.285634 ---------------------------------------------------------------------------------- Iteration 0: log likelihood = -1798.9622 Iteration 1: log likelihood = -1618.6988 Iteration 2: log likelihood = -1559.9219 Iteration 3: log likelihood = -1559.3793 Iteration 4: log likelihood = -1559.3791 Iteration 5: log likelihood = -1559.3791 Logistic regression Number of obs = 4,715 LR chi2(10) = 479.17 Prob > chi2 = 0.0000 Log likelihood = -1559.3791 Pseudo R2 = 0.1332 ---------------------------------------------------------------------------------- W1ExcludeYP | Coef. Std. Err. z P>|z| [95% Conf. Interval] -----------------+---------------------------------------------------------------- W1ethgrpYP | Mixed | -.0342818 .2038641 -0.17 0.866 -.4338481 .3652844 Indian | -.747484 .2753555 -2.71 0.007 -1.287171 -.2077971 Pakistani | -.3367758 .1924594 -1.75 0.080 -.7139892 .0404376 Bangladeshi | .0455778 .1729121 0.26 0.792 -.2933237 .3844792 Black Caribbean | .8029016 .215135 3.73 0.000 .3812447 1.224559 Black African | -.0810632 .2496775 -0.32 0.745 -.570422 .4082956 Other | .1825072 .2727309 0.67 0.503 -.3520355 .7170499 | W1truantYP | Truancy | 1.09738 .1094849 10.02 0.000 .8827932 1.311966 substance_use | .2878147 .099593 2.89 0.004 .0926161 .4830134 delinquency | .5500065 .0682617 8.06 0.000 .4162161 .6837969 _cons | -3.690721 .1727497 -21.36 0.000 -4.029304 -3.352137 ---------------------------------------------------------------------------------- Iteration 0: log likelihood = -1840.8237 Iteration 1: log likelihood = -1672.6861 Iteration 2: log likelihood = -1625.8272 Iteration 3: log likelihood = -1625.5312 Iteration 4: log likelihood = -1625.5312 Logistic regression Number of obs = 4,715 LR chi2(10) = 430.59 Prob > chi2 = 0.0000 Log likelihood = -1625.5312 Pseudo R2 = 0.1170 ---------------------------------------------------------------------------------- W1ExcludeYP | Coef. Std. Err. z P>|z| [95% Conf. Interval] -----------------+---------------------------------------------------------------- W1ethgrpYP | Mixed | .0039647 .1999813 0.02 0.984 -.3879915 .3959209 Indian | -.6838362 .2653805 -2.58 0.010 -1.203972 -.1637 Pakistani | -.25032 .1829075 -1.37 0.171 -.608812 .1081721 Bangladeshi | .0800821 .1667861 0.48 0.631 -.2468126 .4069769 Black Caribbean | .8769927 .2102988 4.17 0.000 .4648147 1.289171 Black African | -.1405916 .2468781 -0.57 0.569 -.6244639 .3432807 Other | -.0038049 .2831061 -0.01 0.989 -.5586827 .5510729 | W1truantYP | Truancy | .8754454 .1079443 8.11 0.000 .6638784 1.087012 substance_use | .4294231 .0984971 4.36 0.000 .2363724 .6224739 delinquency | .495686 .0671439 7.38 0.000 .3640863 .6272857 _cons | -3.490939 .1689765 -20.66 0.000 -3.822126 -3.159751 ---------------------------------------------------------------------------------- Iteration 0: log likelihood = -1857.6893 Iteration 1: log likelihood = -1678.8291 Iteration 2: log likelihood = -1629.6489 Iteration 3: log likelihood = -1629.3129 Iteration 4: log likelihood = -1629.3129 Logistic regression Number of obs = 4,715 LR chi2(10) = 456.75 Prob > chi2 = 0.0000 Log likelihood = -1629.3129 Pseudo R2 = 0.1229 ---------------------------------------------------------------------------------- W1ExcludeYP | Coef. Std. Err. z P>|z| [95% Conf. Interval] -----------------+---------------------------------------------------------------- W1ethgrpYP | Mixed | .1173016 .1981742 0.59 0.554 -.2711126 .5057158 Indian | -.2123337 .2272383 -0.93 0.350 -.6577126 .2330453 Pakistani | .0080986 .1714339 0.05 0.962 -.3279057 .3441029 Bangladeshi | .0624273 .1690852 0.37 0.712 -.2689737 .3938282 Black Caribbean | .8059332 .2154008 3.74 0.000 .3837553 1.228111 Black African | -.1933331 .2542764 -0.76 0.447 -.6917057 .3050394 Other | .0994583 .2772876 0.36 0.720 -.4440154 .642932 | W1truantYP | Truancy | 1.007908 .105268 9.57 0.000 .8015865 1.21423 substance_use | .4602453 .097535 4.72 0.000 .2690801 .6514105 delinquency | .4814542 .0666349 7.23 0.000 .3508523 .6120562 _cons | -3.530009 .1680786 -21.00 0.000 -3.859437 -3.200581 ---------------------------------------------------------------------------------- Iteration 0: log likelihood = -1857.6893 Iteration 1: log likelihood = -1665.5824 Iteration 2: log likelihood = -1611.7253 Iteration 3: log likelihood = -1611.2282 Iteration 4: log likelihood = -1611.2278 Iteration 5: log likelihood = -1611.2278 Logistic regression Number of obs = 4,715 LR chi2(10) = 492.92 Prob > chi2 = 0.0000 Log likelihood = -1611.2278 Pseudo R2 = 0.1327 ---------------------------------------------------------------------------------- W1ExcludeYP | Coef. Std. Err. z P>|z| [95% Conf. Interval] -----------------+---------------------------------------------------------------- W1ethgrpYP | Mixed | -.0640202 .2044931 -0.31 0.754 -.4648192 .3367789 Indian | -.8638843 .292167 -2.96 0.003 -1.436521 -.2912476 Pakistani | .0604544 .1686397 0.36 0.720 -.2700733 .390982 Bangladeshi | .2143449 .1630354 1.31 0.189 -.1051987 .5338885 Black Caribbean | .8364777 .2138101 3.91 0.000 .4174175 1.255538 Black African | .0558075 .2377124 0.23 0.814 -.4101002 .5217152 Other | .2657904 .2661288 1.00 0.318 -.2558125 .7873933 | W1truantYP | Truancy | 1.063664 .1058193 10.05 0.000 .8562618 1.271066 substance_use | .4231122 .0984161 4.30 0.000 .2302201 .6160042 delinquency | .5255446 .0671495 7.83 0.000 .3939339 .6571553 _cons | -3.648775 .1703617 -21.42 0.000 -3.982678 -3.314872 ---------------------------------------------------------------------------------- Iteration 0: log likelihood = -1874.4068 Iteration 1: log likelihood = -1687.0233 Iteration 2: log likelihood = -1638.577 Iteration 3: log likelihood = -1638.2662 Iteration 4: log likelihood = -1638.2662 Logistic regression Number of obs = 4,715 LR chi2(10) = 472.28 Prob > chi2 = 0.0000 Log likelihood = -1638.2662 Pseudo R2 = 0.1260 ---------------------------------------------------------------------------------- W1ExcludeYP | Coef. Std. Err. z P>|z| [95% Conf. Interval] -----------------+---------------------------------------------------------------- W1ethgrpYP | Mixed | -.1256073 .2065792 -0.61 0.543 -.5304951 .2792806 Indian | -.4748216 .2493171 -1.90 0.057 -.9634742 .0138309 Pakistani | -.1752468 .1808212 -0.97 0.332 -.5296498 .1791563 Bangladeshi | .3044519 .1587631 1.92 0.055 -.0067182 .6156219 Black Caribbean | .9888162 .2096604 4.72 0.000 .5778893 1.399743 Black African | .2273561 .2229584 1.02 0.308 -.2096343 .6643466 Other | .4412831 .2559676 1.72 0.085 -.0604043 .9429704 | W1truantYP | Truancy | 1.134778 .1057825 10.73 0.000 .9274484 1.342108 substance_use | .3501975 .099011 3.54 0.000 .1561395 .5442554 delinquency | .5016658 .0660928 7.59 0.000 .3721263 .6312053 _cons | -3.56952 .1677609 -21.28 0.000 -3.898325 -3.240714 ---------------------------------------------------------------------------------- Iteration 0: log likelihood = -1840.8237 Iteration 1: log likelihood = -1652.3516 Iteration 2: log likelihood = -1596.187 Iteration 3: log likelihood = -1595.5838 Iteration 4: log likelihood = -1595.5837 Logistic regression Number of obs = 4,715 LR chi2(10) = 490.48 Prob > chi2 = 0.0000 Log likelihood = -1595.5837 Pseudo R2 = 0.1332 ---------------------------------------------------------------------------------- W1ExcludeYP | Coef. Std. Err. z P>|z| [95% Conf. Interval] -----------------+---------------------------------------------------------------- W1ethgrpYP | Mixed | .1747051 .1963637 0.89 0.374 -.2101607 .5595709 Indian | -.393535 .2451195 -1.61 0.108 -.8739603 .0868904 Pakistani | -.0511766 .1779345 -0.29 0.774 -.3999217 .2975685 Bangladeshi | .239316 .1644773 1.46 0.146 -.0830535 .5616855 Black Caribbean | .8265279 .2184194 3.78 0.000 .3984338 1.254622 Black African | .0970993 .2358773 0.41 0.681 -.3652117 .5594102 Other | -.0258635 .2924141 -0.09 0.930 -.5989845 .5472575 | W1truantYP | Truancy | 1.105012 .1067233 10.35 0.000 .895838 1.314185 substance_use | .4198164 .099101 4.24 0.000 .2255819 .6140508 delinquency | .505767 .0673682 7.51 0.000 .3737277 .6378062 _cons | -3.626437 .1700834 -21.32 0.000 -3.959794 -3.293079 ---------------------------------------------------------------------------------- Iteration 0: log likelihood = -1879.9468 Iteration 1: log likelihood = -1711.7163 Iteration 2: log likelihood = -1669.1982 Iteration 3: log likelihood = -1668.9662 Iteration 4: log likelihood = -1668.9661 Logistic regression Number of obs = 4,715 LR chi2(10) = 421.96 Prob > chi2 = 0.0000 Log likelihood = -1668.9661 Pseudo R2 = 0.1122 ---------------------------------------------------------------------------------- W1ExcludeYP | Coef. Std. Err. z P>|z| [95% Conf. Interval] -----------------+---------------------------------------------------------------- W1ethgrpYP | Mixed | -.0391626 .1989966 -0.20 0.844 -.4291887 .3508634 Indian | -.4922884 .247744 -1.99 0.047 -.9778577 -.0067191 Pakistani | -.0241932 .1680794 -0.14 0.886 -.3536227 .3052363 Bangladeshi | .0094297 .1668498 0.06 0.955 -.31759 .3364493 Black Caribbean | .7868209 .2095033 3.76 0.000 .376202 1.19744 Black African | -.0970611 .2387109 -0.41 0.684 -.564926 .3708037 Other | .1469765 .2694579 0.55 0.585 -.3811512 .6751043 | W1truantYP | Truancy | .9638149 .1061125 9.08 0.000 .7558382 1.171792 substance_use | .3828141 .0978606 3.91 0.000 .1910108 .5746173 delinquency | .4829539 .0663914 7.27 0.000 .352829 .6130787 _cons | -3.437054 .1665307 -20.64 0.000 -3.763449 -3.11066 ---------------------------------------------------------------------------------- Iteration 0: log likelihood = -1857.6893 Iteration 1: log likelihood = -1666.8763 Iteration 2: log likelihood = -1613.2844 Iteration 3: log likelihood = -1612.7446 Iteration 4: log likelihood = -1612.7444 Iteration 5: log likelihood = -1612.7444 Logistic regression Number of obs = 4,715 LR chi2(10) = 489.89 Prob > chi2 = 0.0000 Log likelihood = -1612.7444 Pseudo R2 = 0.1319 ---------------------------------------------------------------------------------- W1ExcludeYP | Coef. Std. Err. z P>|z| [95% Conf. Interval] -----------------+---------------------------------------------------------------- W1ethgrpYP | Mixed | -.0713213 .2075266 -0.34 0.731 -.4780659 .3354232 Indian | -.7454505 .2742179 -2.72 0.007 -1.282908 -.2079933 Pakistani | -.0202646 .1732724 -0.12 0.907 -.3598722 .3193431 Bangladeshi | .277475 .1609483 1.72 0.085 -.0379778 .5929278 Black Caribbean | .8768586 .2141316 4.09 0.000 .4571684 1.296549 Black African | -.1054676 .2494343 -0.42 0.672 -.5943499 .3834147 Other | .0508665 .2863384 0.18 0.859 -.5103466 .6120795 | W1truantYP | Truancy | 1.033875 .1069581 9.67 0.000 .8242406 1.243508 substance_use | .4905333 .0979874 5.01 0.000 .2984816 .6825849 delinquency | .4795226 .0672508 7.13 0.000 .3477134 .6113317 _cons | -3.529047 .1691795 -20.86 0.000 -3.860632 -3.197461 ---------------------------------------------------------------------------------- Iteration 0: log likelihood = -1868.8507 Iteration 1: log likelihood = -1694.1764 Iteration 2: log likelihood = -1647.3608 Iteration 3: log likelihood = -1647.0641 Iteration 4: log likelihood = -1647.064 Logistic regression Number of obs = 4,715 LR chi2(10) = 443.57 Prob > chi2 = 0.0000 Log likelihood = -1647.064 Pseudo R2 = 0.1187 ---------------------------------------------------------------------------------- W1ExcludeYP | Coef. Std. Err. z P>|z| [95% Conf. Interval] -----------------+---------------------------------------------------------------- W1ethgrpYP | Mixed | .0704776 .1992804 0.35 0.724 -.3201047 .46106 Indian | -.4149028 .2486194 -1.67 0.095 -.9021878 .0723822 Pakistani | .0152417 .1701385 0.09 0.929 -.3182237 .3487071 Bangladeshi | .2348144 .1626919 1.44 0.149 -.0840558 .5536846 Black Caribbean | .8816529 .2113914 4.17 0.000 .4673333 1.295972 Black African | .1090667 .2326722 0.47 0.639 -.3469624 .5650958 Other | .4904911 .2519187 1.95 0.052 -.0032605 .9842427 | W1truantYP | Truancy | 1.059737 .1056875 10.03 0.000 .852593 1.26688 substance_use | .4524165 .0982201 4.61 0.000 .2599086 .6449244 delinquency | .4410016 .0669473 6.59 0.000 .3097873 .5722159 _cons | -3.442627 .1687656 -20.40 0.000 -3.773402 -3.111853 ---------------------------------------------------------------------------------- . di `r2' / `mtotal' // the average pseudo R-squared over all imputed datasets (i.e., it averages the pseudo R-squares from the 20 regressions) = 11.94 .12179426 . end of do-file .