View quick-binomial-power.do
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
power oneproportion 0.62 0.5 , n(50(1)150) graph(recast(line) plotopts(lw(thick) lc(red)) xline(100 131,lc(black)) ylab(0 "0%" 0.5 "50%" 0.8 "80%" 0.69 "69%" 1 "100%") yline(.69 .8,lc(black)) note("") title("") subtitle("") ) |
View bias-controls.co
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Part 1: De-biasing a parameter estimate using controls | |
// Develop some data generating process for data X’s and for outcome Y, with some (potentially multi-armed) treatment variable and treatment effect. Like last week, you should strongly consider "simulating" data along the lines of your group project. | |
// This DGP should include strata groups and continuous covariates, as well as random noise. Make sure that the strata groups affect the outcome Y and are of different sizes, and make the probability that an individual unit receives treatment vary across strata groups. You will want to create the strata groups first, then use a command like expand or merge to add them to an individual-level data set. | |
cap prog drop runregs | |
prog def runregs, rclass | |
syntax anything // sample size goes here (divided by ten) |
View data.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
id | latitude | longitude | type | |
---|---|---|---|---|
1 | 38.922893 | -77.06741979 | T | |
2 | 38.92846854 | -77.03038385 | T | |
3 | 38.90462752 | -77.0336025 | C | |
4 | 38.90776671 | -77.00978448 | C | |
5 | 38.87686969 | -77.01313188 | T |
View import-infill.do
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global data "${wd}/ppol_528_GuzmanLidia/data/Data_exp" | |
local data : dir "${data}/xlsx/" files * | |
clear | |
tempfile allData | |
save `allData' , emptyok | |
cap prog drop infill | |
prog def infill | |
syntax anything | |
qui foreach var of varlist `anything' { |
View graph-combine.do
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local graphs "" | |
local x = 1 | |
foreach var of varlist /// | |
diarrhea_history_duration tb_history_sputum /// | |
malaria_history_fevertype pph_history_pph /// | |
diabetes_history_numblimb { | |
local title : var lab `var' | |
local graphs `"`graphs' "\``var''" "' | |
tempfile `var' |
View percent-graph-bar.do
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local nb=`.Graph.plotregion1.barlabels.arrnels' | |
forval i=1/`nb' { | |
di "`.Graph.plotregion1.barlabels[`i'].text[1]'" | |
.Graph.plotregion1.barlabels[`i'].text[1]="`.Graph.plotregion1.barlabels[`i'].text[1]'%" | |
} | |
.Graph.drawgraph |
View latex-pdf.tex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\usepackage{pdfpages} % Allow PDF insert for non-TeX elements | |
\includepdf[noautoscale=true, pages=1]{pdf/15633-Analytics_coverFINAL_print.pdf} | |
\includepdf[noautoscale=true, pages=2]{pdf/15633-Analytics_coverFINAL_print.pdf} |
View bar-compare.do
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sysuse auto.dta, clear | |
local style "s(0) w(1) lc(none) discrete frac" | |
tw /// | |
(histogram rep78 if foreign == 1 /// | |
, fc(black%50) barwidth(0.9) `style') /// | |
(histogram rep78 if foreign == 0 /// | |
, fc(red%50) barwidth(0.8) `style') |
View regression-margins.do
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Regression margins visualizer | |
cap prog drop regmargins | |
prog def regmargins | |
// Syntax command | |
syntax anything | |
// Expected syntax is like regress | |
// Second entry should be factor variable (i.) and we will visualize levels |
View posty.do
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sysuse auto.dta , clear | |
levelsof foreign, local(levels) | |
tempfile posty | |
postfile posty str10(a) b c d using `posty' , replace | |
foreach level in `levels' { | |
local l : label (foreign) `level' | |
post posty ("`l'") (2) (3) (4) |
NewerOlder