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
// Get arbitrary loadings | |
// Data | |
sysuse auto.dta , clear | |
local variables length mpg price rep78 | |
// Get labels | |
foreach var of varlist `variables' { | |
local `var' : var label `var' | |
} |
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
tempname a b c | |
tw (function 1.4*sqrt((2/x)+(2/x)) , range(300 600) lc(red)) /// | |
(function 1.4*sqrt((3/x)+(3/(2*x))) , range(300 600) lc(red) lp(dash)) /// | |
(function sqrt(1/x) , range(300 600) lc(black) ) /// | |
, yscale(r(0)) ytit(" ") xtit("Number of Providers") /// | |
title("Within Case") /// | |
ylab(0 .05 "5p.p." .1 "10p.p." .15 "15p.p." .2 "20p.p.") /// | |
legend(on c(1) pos(9) /// | |
order( /// |
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
clear | |
set obs 100 | |
gen y = runiform() * 3 | |
gen x = runiform() * 3 | |
tw /// | |
(scatter x y) /// | |
(scatter x y , m(none) yaxis(2) xaxis(2)) /// |
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
// Demo code for creating simple regression table | |
sysuse auto.dta, clear | |
// Run regressions | |
reg price weight | |
su price if e(sample) | |
estadd scalar mean = r(mean) | |
est sto reg1 |
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
// Simulation 1: Big effects from small RCTs | |
cap mat drop results | |
qui forv iter = 1/1000 { | |
clear | |
set obs 10000 | |
gen x = rnormal() > 0 | |
gen e = rnormal() * 4 |
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 I* | |
*** Setup | |
clear all //clear any open datasets | |
cls //clear the screen | |
version 15 | |
set more off | |
set linesize 255 | |
*** Generating a random varibale | |
set obs 100000 |
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
forv i = 1/26 { | |
local theLetter : word `i' of `c(ALPHA)' | |
di "`theLetter'" | |
} |
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
// [ritest] example | |
// Create randomization program ------------------------------------------------ | |
cap prog drop my_randomization | |
prog def my_randomization | |
syntax , [*] | |
// Must drop the variable for [ritest]. Make sure to keep it saved somewhere | |
cap drop treatment |
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
######################################################################## | |
# | |
# .gitignore DIME template | |
# https://github.com/worldbank/dime-github-trainings/tree/master/GitHub-resources/DIME-GitHub-Templates | |
# | |
# We recommend that you create a .gitignore file using GitHub's tools and | |
# replace the content of that file with the content of this file. Otherwise | |
# you have to rename this file .gitignore. But if you rename the fine in a |