We use rclone to mount OneDrive as a network share in the directory ~/OneDrive.
First, log in as the user who needs OneDrive, and create the directory:
mkdir ~/OneDriveThen configure rclone:
rclone config| clear all | |
| set more off | |
| * download CES data, if new | |
| !wget -N https://download.bls.gov/pub/time.series/ce/ce.data.0.AllCESSeries | |
| !wget -N https://download.bls.gov/pub/time.series/ce/ce.series | |
| !wget -N https://download.bls.gov/pub/time.series/ce/ce.industry | |
| * identify 3-digit industries | |
| insheet using ce.industry, clear tab |
We use rclone to mount OneDrive as a network share in the directory ~/OneDrive.
First, log in as the user who needs OneDrive, and create the directory:
mkdir ~/OneDriveThen configure rclone:
rclone config| marchcps %>% | |
| # adult/af universe for health insurance q | |
| filter(prpertyp == 2 | prpertyp == 3) %>% | |
| # workers last year with industry info | |
| filter(industry > 0) %>% | |
| # keep only private and public emp (drop self employed & without pay) | |
| filter(clwk == 1 | clwk == 2) %>% | |
| # convert 2012 Census industry codes to NAICS sectors | |
| # using codebook https://www2.census.gov/programs-surveys/demo/guidance/industry-occupation/census-2012-final-code-list.xls | |
| mutate( |
| set more off | |
| clear all | |
| * load CPS for population weights | |
| load_epiextracts, begin(1979m1) end(2018m12) sample(basic) keep(age statefips) | |
| keep if age >= 16 | |
| * convert monthly weight to annual | |
| replace basicwgt = basicwgt / 12 | |
| collapse (sum) pop = basicwgt, by(statefips year) | |
| tempfile statepops |
| library(tidyverse) | |
| library(EmpElastR) | |
| library(viridis) | |
| # Dube (2019) review: median estimates | |
| ests <- tibble(`Median, \n low-wage` = -0.04, `Median, \n any group` = -0.17) | |
| # SR elasticity is the base elasticity scaled by real barsize and indexing adjustments | |
| cbo_sr_rwta_elas <- function(x) { |
sysuse state_geocodes, clear
list, ab(20)
+---------------------------------------------------------------------------------------------------------+
| state_name state_abb fips census division division_name region region_name |
|---------------------------------------------------------------------------------------------------------|
1. | Connecticut CT 9 16 1 New England 1 Northeast |
2. | Maine ME 23 11 1 New England 1 Northeast |
3. | Massachusetts MA 25 14 1 New England 1 Northeast || * Example Stata script using postfile to create | |
| * a dataset of results from an analysis. | |
| * This example simulates a female wage penalty X times | |
| * and compares the density of estimates to the normal density. | |
| * parameters for simulation | |
| local numiterations = 50 | |
| local samplesize = 500 | |
| * set the simulation seed just for reproducibility of this artificial example |
| library(dplyr) | |
| # just used to simulate some data | |
| library(purrr) | |
| # create fake data | |
| f <- function(x,i) { | |
| return(data.frame(bout=x, element=i)) | |
| } | |
| fake_data <- map_dfr(1:4, ~map2_dfr(.x, 0:(round(runif(1)*10)+5), f)) %>% | |
| mutate(invisible_id=ifelse(element==0,"bout","element")) %>% |
| setwd("/data/nlsy/data/raw/nlsy97_all_1997-2013") | |
| head -n 1 nlsy97_all_1997-2013 > data.dat | |
| read_delim("data.dat",delim=" ",) | |
| read_delim("data.dat",delim=" ",col_types = cols(.default = col_integer())) | |
| read_delim("data.dat",delim=" ",col_names=FALSE,col_types = cols(.default = col_integer())) | |
| read_delim(pipe("cut -d \" \" -f1-8 data.dat"),delim=" ",col_names=FALSE,col_types = cols(.default = col_integer())) | |
| newdata<-read_delim(pipe("cut -d \" \" -f1-10000 nlsy97_all_1997-2013.dat"),delim=" ",col_names=FALSE) |