*error* problem solved
post to delete
post to delete
generate d_time = 0 if date < date("20071101","YMD") & date > date("20051101","YMD") replace d_time = 1 if date > date("20071101","YMD") & date < date("20091101","YMD") generate d_treat_all = 0 & date < date("20091101","YMD") replace d_treat_all = 1 if country <10 & date < date("20091101","YMD") replace d_treat_all = 1 if country == 11 & date < date("20091101","YMD")
xtset id xtset id date xtreg netfundflow i.costs d_time##d_treat, cluster(id)
Linear regression Number of obs = 35916 F( 5, 1446) = 7.42 Prob > F = 0.0000 R-squared = 0.0006 Root MSE = 548.99 (Std. Err. adjusted for 1447 clusters in id) Robust netfundflow Coef. Std. Err. t P>t [95% Conf. Interval] costs High -16.27294 5.539093 -2.94 0.003 -27.13846 -5.407421 Equal -6.636716 6.54486 -1.01 0.311 -19.47515 6.201721 1.d_time 33.29411 12.3204 2.70 0.007 9.126352 57.46187 1.d_treat 6.112733 5.944947 1.03 0.304 -5.548909 17.77438 d_time#d_treat 1 1 -27.25072 12.22966 -2.23 0.026 -51.2405 -3.260937 _cons 5.901751 5.675747 1.04 0.299 -5.231828 17.03533
bysort costs: xtreg netfundflow i.costs d_time##d_treat, cluster(id)
xtreg netfundflow i.costs d_time##d_treat, cluster(id) fe
reghdfe netfundflow i.costs i.d_treat##i.d_time, absorb(id) vce(cluster id costs)
(dropped 66 singleton observations) (converged in 1 iterations) note: 1.d_treat omitted because of collinearity Warning: VCV matrix was non-positive semi-definite; adjustment from Cameron, Gelbach & Miller applied. WARNING: Missing F statistic (dropped variables due to collinearity or too few clusters). HDFE Linear regression Number of obs = 35,850 Absorbing 1 HDFE group F( 3, 2) = . Statistics robust to heteroskedasticity Prob > F = . R-squared = 0.0137 Adj R-squared = -0.0260 Number of clusters (id) = 1,381 Within R-sq. = 0.0009 Number of clusters (costs) = 3 Root MSE = 556.7085 (Std. Err. adjusted for 3 clusters in id costs) Robust netfundflow Coef. Std. Err. t P>t [95% Conf. Interval] costs High -61.58262 49.06534 -1.26 0.336 -272.6937 149.5285 Equal -80.7145 58.56219 -1.38 0.302 -332.6873 171.2583 1.d_treat 0 (empty) 1.d_time 45.10881 25.86124 1.74 0.223 -66.16312 156.3807 d_treat#d_time 1 1 -38.66821 21.77473 -1.78 0.218 -132.3573 55.02087 Absorbed degrees of freedom: Absorbed FE Num. Coefs. = Categories - Redundant id 0 1381 1381 * * = fixed effect nested within cluster; treated as redundant for DoF computation
graph bar (mean) stv2, over(IT_d) ytitle(Output-Inflation Tradeoff)
svyset IDNUMR [pw=WEIGHT_CATI], strata(stratacross)
svy, subpop(DX_aut_11 if nomiss==1): khb logit causes_genetic /// hispanic black otherrace parented_aboveHS FPL100to199 FPL200to399 FPL400andup /// || all_limit sdq_CATI_high DX_dev_11 DX_int_11 pervasivedevdis autisticdis /// multipledx autyp_unknown, concomitant(male AGE) disentangle ape summary or
khb logit causes_genetic /// hispanic black otherrace parented_aboveHS FPL100to199 FPL200to399 FPL400andup /// || all_limit sdq_CATI_high DX_dev_11 DX_int_11 pervasivedevdis autisticdis /// multipledx autyp_unknown if DX_aut_11==1 & nomiss==1 [pweight=WEIGHT_CATI], concomitant(male AGE) disentangle ape summary or
PID | Year | DID | Doc_Var1 |
1 | 2001 | 100 | 2 |
5 | 2003 | 100 | 2 |
1 | 2002 | 110 | . |
5 | 2004 | 110 | . |
2 | 2002 | 120 | 1 |
3 | 2003 | 120 | 1 |
4 | 2002 | 120 | 1 |
4 | 2003 | 120 | 1 |
3 | 2002 | 120 | 2 |
4 | 2004 | 120 | . |
5 | 2000 | 120 | . |
5 | 2002 | 130 | . |
1 | 2003 | 150 | 1 |
2 | 2003 | 150 | . |
3 | 2000 | 150 | . |
2 | 2001 | 200 | 2 |
1 | 2000 | 200 | . |
2 | 2000 | 200 | . |
4 | 2000 | 200 | . |
3 | 2001 | 310 | 1 |
3 | 2004 | 310 | . |
2 | 2004 | 400 | 2 |
4 | 2001 | 400 | . |
1 | 2004 | 500 | 2 |
5 | 2001 | 500 | 2 |
seqlogit drugtrans i.respsex i.arst, tree (1:2) | ||
Transition tree: | ||
Transition 1: 1 : 2 | ||
Computing starting values for: | ||
Transition 1 | ||
Iteration 0: log likelihood = -249.33364 | ||
Iteration 1: log likelihood = -249.33364 | ||
Number of obs = | 1,649 | |
LR chi2(3) = | 16.75 | |
Log likelihood = -249.33364 | Prob > chi2 = | 0.0008 |
drugtrans Coef. Std. Err. z | P>z [95% Conf. | Interval] |
respsex | ||
female .1750619 .2702427 0.65 | 0.517 -.3546041 | .7047279 |
arst | ||
2 -.5273682 1.163988 -0.45 | 0.650 -2.808742 | 1.754006 |
3 -2.129618 .4539332 -4.69 | 0.000 -3.019311 | -1.239925 |
_cons -1.367098 .4349749 -3.14 | 0.002 -2.219633 | -.5145628 |
meologit selfconcept c.age##c.age i.group [pw = wt_sa1] || StudentID:, pweight(??) mle cluster(Cluster)
univar QA_PTA PTR LNTA
global brfss obese foreach var in $brfss { capture noisily svy, subpop(if year==2010): tab mracealpha `var', row ci percent obs format (%7.1f) esttab ., cells("obs b(fmt(1)) lb(fmt(1)) ub(fmt(1)) se(fmt(1))")unstack noobs matlist r(coefs) matrix results=r(coefs) matlist results *return list matselrc results r1 , r(10/17) c(1/5) matlist r1 putexcel set draftresults.xlsx, sheet(ModelSum`var'1) modify putexcel set draftresults.xlsx, sheet(ModelSumsmoker1) modify putexcel B2=matrix(r1) }
(running tabulate on estimation sample) Number of strata = 18 Number of obs = 18,559 Number of PSUs = 18,559 Population size = 8,238,102 Subpop. no. obs = 18,559 Subpop. size = 8,238,102 Design df = 18,541 ------------------------------------------------- mracealph | obese, BMI>=30 a | No Yes Total ----------+-------------------------------------- AIAN | 53.5 46.5 100.0 | [42.3,64.3] [35.7,57.7] | 85.0 61.0 146.0 | Asian | 92.3 7.7 100.0 | [90.3,93.9] [6.1,9.7] | 1195.0 94.0 1289.0 | Black | 66.1 33.9 100.0 | [61.1,70.8] [29.2,38.9] | 429.0 212.0 641.0 | Multiple | 76.3 23.7 100.0 | [70.9,80.9] [19.1,29.1] | 294.0 111.0 405.0 | NHPI | 70.9 29.1 100.0 | [58.5,80.8] [19.2,41.5] | 64.0 33.0 97.0 | White | 76.7 23.3 100.0 | [75.7,77.7] [22.3,24.3] | 12401.0 3580.0 15981.0 | Total | 78.2 21.8 100.0 | [77.3,79.1] [20.9,22.7] | 14468.0 4091.0 18559.0 ------------------------------------------------- Key: row percentage [95% confidence interval for row percentage] number of observations Pearson: Uncorrected chi2(5) = 528.8654 Design-based F(4.92, 91168.18)= 37.7259 P = 0.0000 Note: 23 strata omitted because they contain no subpopulation members. ------------ ------------ ------------ . end of do-file . matlist r(coefs) | active | obs b lb ub se -------------+------------------------------------------------------- p11 | .y .53501 .y .y .0571526 p12 | .y .46499 .y .y .0571526 p21 | .y .9228453 .y .y .009021 p22 | .y .0771547 .y .y .009021 p31 | .y .6612203 .y .y .02494 p32 | .y .3387797 .y .y .02494 p41 | .y .7629963 .y .y .0255429 p42 | .y .2370037 .y .y .0255429 p51 | .y .7087532 .y .y .0576917 p52 | .y .2912468 .y .y .0576917 p61 | .y .7671453 .y .y .0051494 p62 | .y .2328547 .y .y .0051494