Skip to content

Instantly share code, notes, and snippets.

View bbdaniels's full-sized avatar

Benjamin Daniels bbdaniels

View GitHub Profile
@bbdaniels
bbdaniels / Notes:
Last active July 28, 2023 18:05
Pandoc tex to docx
- Copy in cover page
- Move up references
- Remove images if necessary
@bbdaniels
bbdaniels / sensible-stata-axes.do
Created March 11, 2019 18:53
Include 0 and number of ticks explicitly
tw [anything] , yscale(r(0)) ylab(#6)
@bbdaniels
bbdaniels / round.do
Created April 18, 2019 17:08
Correct rounding in Stata
local `param' : di %3.2f ``param''
@bbdaniels
bbdaniels / figure.tex
Last active May 9, 2019 20:26
Simple figure in latex
\newpage
\section*{Figure: Title}
\newline
\includegraphics[width=1\textwidth]{filepath.eps}
\newline
\textbf{Notes:}
@bbdaniels
bbdaniels / boilerplate.tex
Last active May 10, 2019 18:45
Simple tex document
\documentclass[fleqn,10pt]{wlscirep}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{setspace}
\doublespacing
\title{Scientific Reports Title to see here}
\author[1,*]{Alice Author}
@bbdaniels
bbdaniels / sidenote-url.tex
Created April 24, 2019 22:02
SIdenote Wiki URL
\sidenote{\url{https://dimewiki.worldbank.org/wiki/PAGE}}
@bbdaniels
bbdaniels / web.bib
Last active April 30, 2019 20:03
Arbitrary citation
@article{downietraining,
author = {Downie, Richard},
title = {Training the Informal Health Workforce in India},
note={Center for Strategic and International Studies. Accessed: 2019-04-30.},
journal = {\url{https://www.csis.org/blogs/smart-global-health/training-informal-health-workforce-india}},
}
@bbdaniels
bbdaniels / samplsi-sampclus.do
Created May 7, 2019 14:36
Power estimates for clustered samples
//Power calcs start here
sum l_household_income_total if (treatment == 0 & round == 1)
local mean1 = r(mean) //mean in control
local sd1 = r(sd) //SD in control
sum l_household_income_total if ((treatment == 1 | treatment == 2) & round == 1)
local mean2 = r(mean) //mean in AFSP
local sd2 = r(sd) //SD in AFSP
loneway l_household_income_total hhid_dvdc //--> 0.13
@bbdaniels
bbdaniels / stata-percents.do
Last active January 25, 2024 19:20
Add percentage signs to bar graph labels
local nb=`.Graph.plotregion1.barlabels.arrnels'
qui forval i=1/`nb' {
.Graph.plotregion1.barlabels[`i'].text[1]="`.Graph.plotregion1.barlabels[`i'].text[1]'%"
}
.Graph.drawgraph
// Rounding
local nb=`.Graph.plotregion1.barlabels.arrnels'
forval i=1/`nb' {
.Graph.plotregion1.barlabels[`i'].text[1] = "`: di %2.0f `.Graph.plotregion1.barlabels[`i'].text[1]''"
@bbdaniels
bbdaniels / tufte-handout.tex
Created May 13, 2019 19:31
Minimal implementation of tufte-handout
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% How to use writeLaTeX:
%
% You edit the source code here on the left, and the preview on the
% right shows you the result within a few seconds.
%
% Bookmark this page and share the URL with your co-authors. They can
% edit at the same time!
%
% You can upload figures, bibliographies, custom classes and