-------------------------------------------------------------------------------------------------- name: log: c:\Users\ccameron\Dropbox\Desktop\TEACHING\190\Causal Methods Slides\rct.txt log type: text opened on: 7 Oct 2023, 15:48:37 . . ********** OVERVIEW OF rct.do ********** . . * This is an example of a randomized control trial . . * Program by A. Colin Cameron Dept. of Economics Univ. of California - Davis . * Used for ECN 190 Research with Economics Data . . * To run you need file . * AED_HEALTHINSEXP.DTA . * in your directory . . * The dataset is used in chapter 13.5 of . * A. Colin Cameron Analysis of Economics Data: An Introduction to Econometics . * https://cameron.econ.ucdavis.edu/ . . * Original source is Aviva Aron-Dine, Liran Einav, and Amy Finkelstein (2013), . * "The RAND Health Insurance Experiment, Three Decades Later", . * Journal of Economics Perspectives, 27(1), pages 197-222. . * Data at http://doi.org/10.3886/E113919V1 . . ********** SETUP ********** . . clear all . set scheme s1mono /* Graphics scheme */ . . ************ RANDOMIZED CONTROL TRIAL . . use AED_HEALTHINSEXP.DTA, clear (Data for A. Colin Cameron (2022), ANALYSIS OF ECONOMIC DATA, Amazon) . . * Restrict to year 1 . keep if year==1 (14,564 observations deleted) . . describe Contains data from AED_HEALTHINSEXP.DTA Observations: 5,639 Data for A. Colin Cameron (2022), ANALYSIS OF ECONOMIC DATA, Amazon Variables: 29 22 Jan 2022 15:04 -------------------------------------------------------------------------------------------------- Variable Storage Display Value name type format label Variable label -------------------------------------------------------------------------------------------------- idperson float %9.0g person identifier as number 1, 2, .... idfamily float %9.0g family identifier as number 1, 2, .... year float %9.0g experiment year: 1, 2, 3, 4, or 5 site byte %17.0g site location of experiment (6 sites) plan float %14.0g rand_plan_group 1 if 0% coins, 2 if 25%, 3 if 25/50%, 4 if 50%, 5 if 95%, 6 if individual deduct mde double %10.0g major deductible expenditure in 1984$ coins0 float %9.0g = 1 if 0% coinsurance (free) and = 0 otherwise coins25 float %9.0g = 1 if 25%/50% mix coinsurance and = 0 otherwise coinsmixed float %9.0g coins50 float %9.0g = 1 if 50% coinsurance and = 0 otherwise coinsindiv float %9.0g = 1 if individual deductible and = 0 otherwise coins95 float %9.0g = 1 if 95% coinsurance and = 0 otherwise coinsrate float %9.0g coinsurance rate for plan spending double %9.0g inpatient + outpatient in 2011 $ inpat double %9.0g inpatient medical spending in 2011 $ outpat double %9.0g outpatient medical spending (out_rand+dental+mental) out_rand_infl double %9.0g outpatient spending excluding dental & mental dental double %9.0g dental services spending mental double %9.0g outpatient (ambulatory) mental health services drugs double %9.0g pharmaeceutical drugs outside hospital supplies double %9.0g medical supplies outside hospital oop double %9.0g out_of_pocket (spending not covered by insurance) age byte %10.0g age in years famincome float %9.0g family annual income in $ thousands gender float %9.0g = 1 if male and = 0 if female educ double %10.0g years of schooling badhealth float %9.0g = 1 if health is bad and = 0 otherwise goodhealth float %9.0g = 1 if health is good and = 0 otherwise exchealth float %9.0g = 1 if health is excellent and = 0 otherwise -------------------------------------------------------------------------------------------------- Sorted by: Note: Dataset has changed since last saved. . summarize Variable | Obs Mean Std. dev. Min Max -------------+--------------------------------------------------------- idperson | 5,639 2930.18 1704.36 1 5885 idfamily | 5,639 1274.33 574.8215 276 2205 year | 5,639 1 0 1 1 site | 5,639 3.364249 1.787279 1 6 plan | 5,639 3.310516 2.025611 1 6 -------------+--------------------------------------------------------- mde | 5,639 418.4664 381.1799 0 1000 coins0 | 5,639 .3321511 .4710266 0 1 coins25 | 5,639 .113318 .3170092 0 1 coinsmixed | 5,639 .0851215 .2790871 0 1 coins50 | 5,639 .0663238 .2488693 0 1 -------------+--------------------------------------------------------- coinsindiv | 5,639 .2156411 .4113028 0 1 coins95 | 5,639 .1874446 .3903026 0 1 coinsrate | 5,639 .3935136 .3508856 0 1 spending | 5,639 1679.472 4968.068 0 175831 inpat | 5,639 631.669 4404.281 0 174734 -------------+--------------------------------------------------------- outpat | 5,639 1047.803 1880.845 0 35034.65 out_rand_i~l | 5,639 506.1204 759.4385 0 10268.4 dental | 5,639 509.1095 1562.574 0 32598.4 mental | 5,639 32.573 346.193 0 9279.425 drugs | 5,639 94.9771 240.5459 0 4172.953 -------------+--------------------------------------------------------- supplies | 5,639 58.00242 149.6372 0 3120.42 oop | 5,639 228.6367 463.2244 0 4340.814 age | 5,638 24.53565 16.50465 0 62 famincome | 5,321 11.11545 5.872902 0 32.26296 gender | 5,639 .481823 .4997138 0 1 -------------+--------------------------------------------------------- educ | 3,363 11.99985 2.974822 0 25 badhealth | 5,381 .1018398 .3024656 0 1 goodhealth | 5,381 .3882178 .4873899 0 1 exchealth | 5,381 .5099424 .4999476 0 1 . tab plan 1 if 0% coins, | 2 if 25%, 3 if | 25/50%, 4 if | 50%, 5 if 95%, | 6 if | individual | deduct | Freq. Percent Cum. ---------------+----------------------------------- Free Care | 1,873 33.22 33.22 25% Coins | 639 11.33 44.55 Mixed Coins | 480 8.51 53.06 50% Coins | 374 6.63 59.69 95%/100% Coins | 1,057 18.74 78.44 Indv Deduct | 1,216 21.56 100.00 ---------------+----------------------------------- Total | 5,639 100.00 . . * Correct some mistakes in the labelling of variables . label variable coins25 "= 1 if 25% coinsurance and = 0 otherwise" . label variable coinsmixed "= 1 if 25%/50% mix coinsurance and = 0 otherwise" . describe spending coins0 coins25 coinsmixed coins50 coinsindiv coins95 /// > coinsrate mde spending oop Variable Storage Display Value name type format label Variable label -------------------------------------------------------------------------------------------------- spending double %9.0g inpatient + outpatient in 2011 $ coins0 float %9.0g = 1 if 0% coinsurance (free) and = 0 otherwise coins25 float %9.0g = 1 if 25% coinsurance and = 0 otherwise coinsmixed float %9.0g = 1 if 25%/50% mix coinsurance and = 0 otherwise coins50 float %9.0g = 1 if 50% coinsurance and = 0 otherwise coinsindiv float %9.0g = 1 if individual deductible and = 0 otherwise coins95 float %9.0g = 1 if 95% coinsurance and = 0 otherwise coinsrate float %9.0g coinsurance rate for plan mde double %10.0g major deductible expenditure in 1984$ spending double %9.0g inpatient + outpatient in 2011 $ oop double %9.0g out_of_pocket (spending not covered by insurance) . summarize spending plan year coins0 coins25 coinsmixed coins50 coinsindiv coins95 /// > coinsrate mde oop Variable | Obs Mean Std. dev. Min Max -------------+--------------------------------------------------------- spending | 5,639 1679.472 4968.068 0 175831 plan | 5,639 3.310516 2.025611 1 6 year | 5,639 1 0 1 1 coins0 | 5,639 .3321511 .4710266 0 1 coins25 | 5,639 .113318 .3170092 0 1 -------------+--------------------------------------------------------- coinsmixed | 5,639 .0851215 .2790871 0 1 coins50 | 5,639 .0663238 .2488693 0 1 coinsindiv | 5,639 .2156411 .4113028 0 1 coins95 | 5,639 .1874446 .3903026 0 1 coinsrate | 5,639 .3935136 .3508856 0 1 -------------+--------------------------------------------------------- mde | 5,639 418.4664 381.1799 0 1000 oop | 5,639 228.6367 463.2244 0 4340.814 . . * Note here that plan is not ordered by coinsurance rate . bysort plan: sum spending -------------------------------------------------------------------------------------------------- -> plan = Free Care Variable | Obs Mean Std. dev. Min Max -------------+--------------------------------------------------------- spending | 1,873 2153.57 4959.743 0 130387.6 -------------------------------------------------------------------------------------------------- -> plan = 25% Coins Variable | Obs Mean Std. dev. Min Max -------------+--------------------------------------------------------- spending | 639 1396.663 3458.96 0 54794.57 -------------------------------------------------------------------------------------------------- -> plan = Mixed Coins Variable | Obs Mean Std. dev. Min Max -------------+--------------------------------------------------------- spending | 480 1701.874 4328.166 0 47262.36 -------------------------------------------------------------------------------------------------- -> plan = 50% Coins Variable | Obs Mean Std. dev. Min Max -------------+--------------------------------------------------------- spending | 374 1785.845 11643.61 0 175831 -------------------------------------------------------------------------------------------------- -> plan = 95%/100% Coins Variable | Obs Mean Std. dev. Min Max -------------+--------------------------------------------------------- spending | 1,057 1045.82 2634.824 0 33317.99 -------------------------------------------------------------------------------------------------- -> plan = Indv Deduct Variable | Obs Mean Std. dev. Min Max -------------+--------------------------------------------------------- spending | 1,216 1607.071 3815.953 0 58875.71 . table plan, stat(mean spending) nformat(%10.0f) ---------------------------------------------------------------------------------------- | Mean ---------------------------------------------------------------------------------+------ 1 if 0% coins, 2 if 25%, 3 if 25/50%, 4 if 50%, 5 if 95%, 6 if individual deduct | Free Care | 2154 25% Coins | 1397 Mixed Coins | 1702 50% Coins | 1786 95%/100% Coins | 1046 Indv Deduct | 1607 Total | 1679 ---------------------------------------------------------------------------------------- . . * Mean spending by increasing coinsurance rate . regress spending coins0 coins25 coinsmixed coins50 coinsindiv coins95, /// > vce(cluster idfamily) noconstant noheader (Std. err. adjusted for 1,930 clusters in idfamily) ------------------------------------------------------------------------------ | Robust spending | Coefficient std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- coins0 | 2153.57 118.3146 18.20 0.000 1921.532 2385.608 coins25 | 1396.663 148.7189 9.39 0.000 1104.996 1688.33 coinsmixed | 1701.874 208.1482 8.18 0.000 1293.655 2110.093 coins50 | 1785.845 606.6138 2.94 0.003 596.1578 2975.533 coinsindiv | 1607.071 111.4304 14.42 0.000 1388.535 1825.608 coins95 | 1045.82 92.7984 11.27 0.000 863.8246 1227.816 ------------------------------------------------------------------------------ . . * Difference in two means: freecare (coins0=1) versus any other (coins0=0) . ttest spending, by(coins0) unequal reverse Two-sample t test with unequal variances ------------------------------------------------------------------------------ Group | Obs Mean Std. err. Std. dev. [95% conf. interval] ---------+-------------------------------------------------------------------- 1 | 1,873 2153.57 114.6015 4959.743 1928.81 2378.33 0 | 3,766 1443.681 80.75901 4955.998 1285.346 1602.017 ---------+-------------------------------------------------------------------- Combined | 5,639 1679.472 66.15863 4968.068 1549.775 1809.168 ---------+-------------------------------------------------------------------- diff | 709.8889 140.1981 435.0165 984.7613 ------------------------------------------------------------------------------ diff = mean(1) - mean(0) t = 5.0635 H0: diff = 0 Satterthwaite's degrees of freedom = 3734.93 Ha: diff < 0 Ha: diff != 0 Ha: diff > 0 Pr(T < t) = 1.0000 Pr(|T| > |t|) = 0.0000 Pr(T > t) = 0.0000 . . * Difference in two means: using OLS regression . regress spending coins0, vce(robust) Linear regression Number of obs = 5,639 F(1, 5637) = 25.64 Prob > F = 0.0000 R-squared = 0.0045 Root MSE = 4957.2 ------------------------------------------------------------------------------ | Robust spending | Coefficient std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- coins0 | 709.8889 140.1918 5.06 0.000 435.0589 984.7188 _cons | 1443.681 80.76261 17.88 0.000 1285.356 1602.007 ------------------------------------------------------------------------------ . . * Difference in two means: using OLS regression and cluster-robust standard errors . regress spending coins0, vce(cluster idfamily) Linear regression Number of obs = 5,639 F(1, 1929) = 24.04 Prob > F = 0.0000 R-squared = 0.0045 Root MSE = 4957.2 (Std. err. adjusted for 1,930 clusters in idfamily) ------------------------------------------------------------------------------ | Robust spending | Coefficient std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- coins0 | 709.8889 144.7927 4.90 0.000 425.9221 993.8556 _cons | 1443.681 83.76902 17.23 0.000 1279.394 1607.969 ------------------------------------------------------------------------------ . . * Difference in mean spending compared to 0% coinsurance (free care) . regress spending coins25 coinsmixed coins50 coinsindiv coins95, /// > vce(cluster idfamily) noheader (Std. err. adjusted for 1,930 clusters in idfamily) ------------------------------------------------------------------------------ | Robust spending | Coefficient std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- coins25 | -756.9073 190.0412 -3.98 0.000 -1129.615 -384.1996 coinsmixed | -451.6962 239.4243 -1.89 0.059 -921.2539 17.86156 coins50 | -367.7249 618.0442 -0.59 0.552 -1579.83 844.38 coinsindiv | -546.4989 162.1506 -3.37 0.001 -864.5077 -228.4901 coins95 | -1107.75 150.3658 -7.37 0.000 -1402.647 -812.8535 _cons | 2153.57 118.3146 18.20 0.000 1921.532 2385.608 ------------------------------------------------------------------------------ . test coins25 coinsmixed coins50 coinsindiv coins95 ( 1) coins25 = 0 ( 2) coinsmixed = 0 ( 3) coins50 = 0 ( 4) coinsindiv = 0 ( 5) coins95 = 0 F( 5, 1929) = 11.39 Prob > F = 0.0000 . . * Add some regressors . global xlist age gender badhealth goodhealth . regress spending coins25 coinsmixed coins50 coinsindiv coins95 $xlist, /// > vce(cluster idfamily) Linear regression Number of obs = 5,380 F(9, 1903) = 24.46 Prob > F = 0.0000 R-squared = 0.0310 Root MSE = 4973.4 (Std. err. adjusted for 1,904 clusters in idfamily) ------------------------------------------------------------------------------ | Robust spending | Coefficient std. err. t P>|t| [95% conf. interval] -------------+---------------------------------------------------------------- coins25 | -741.8633 190.5299 -3.89 0.000 -1115.533 -368.194 coinsmixed | -439.7628 240.2839 -1.83 0.067 -911.0103 31.48471 coins50 | -324.06 635.43 -0.51 0.610 -1570.273 922.1525 coinsindiv | -584.1019 165.5366 -3.53 0.000 -908.7542 -259.4497 coins95 | -1103.006 152.9932 -7.21 0.000 -1403.058 -802.9536 age | 39.95072 4.394389 9.09 0.000 31.33239 48.56904 gender | -354.5812 133.3922 -2.66 0.008 -616.1916 -92.97085 badhealth | 851.641 252.9403 3.37 0.001 355.5717 1347.71 goodhealth | 321.5212 162.0722 1.98 0.047 3.663321 639.3791 _cons | 1128.974 152.9424 7.38 0.000 829.0211 1428.926 ------------------------------------------------------------------------------ . test coins25 coinsmixed coins50 coinsindiv coins95 ( 1) coins25 = 0 ( 2) coinsmixed = 0 ( 3) coins50 = 0 ( 4) coinsindiv = 0 ( 5) coins95 = 0 F( 5, 1903) = 10.86 Prob > F = 0.0000 . . ********** CLOSE OUTPUT . log close name: log: c:\Users\ccameron\Dropbox\Desktop\TEACHING\190\Causal Methods Slides\rct.txt log type: text closed on: 7 Oct 2023, 15:48:38 --------------------------------------------------------------------------------------------------