Archive

 

Sodask12122022

**第一个压缩包是有所有的结果,第二个是以防万一我把word也放上来了,code不让上传我贴在最后了, 但这些压缩包里都有。

**Stata code line10要改成你自己的路径,就是你存data的那个文件夹。

**********************
* OVERVIEW
* Date: 12/12/2022
* Author:
**********************

********Change directory *******************************************************
cd “/Users/yuwei/Google Drive” //change to the directory where data is stored

******Q1************************************************************************
use “data/emigration6.dta”, clear

// 1.a estimate OLS model
global control lpop1865 urban larea arableshare1810 lproxport10 lproxtown lproxsthlm lproxrail lproxstnfrost latitude longitude barley_hi oats_hi wheat_hi dairy_hi forest1907_hi
reghdfe labor_capy0020 emi67t $control, absorb(i.c_id) vce(cluster stnfrost)

// 1.d table2
// ssc install outreg2

//version 1: without fe and cluster
loc append replace
foreach dependent in $control{
reg `dependent’ shock port shockport
outreg2 using Table2_v1.xls, `append’ label keep(shockport) nocons noobs nor2 ///
title(“Dependent Variable”) ///

loc append append
}

//version 2: with fe and cluster—-closer to the paper
loc append replace
foreach dependent in $control{
reghdfe `dependent’ shock port shockport, absorb(i.c_id) vce(cluster stnfrost)
outreg2 using Table2_v2.xls, `append’ label keep(shockport) nocons noobs nor2 ///
title(“Dependent Variable”) ///

loc append append
}

// 1.e IV estimation
//First stage
reghdfe emi67t shockport shock, absorb(i.c_id) vce(cluster stnfrost)
predict emi_hat
//Second stage
reghdfe labor_capy0020 emi_hat shock port $control, absorb(i.c_id) vce(cluster stnfrost)

// 1.h IV estimation with additional controls
//Second stage
reghdfe labor_capy0020 emi_hat shock port shockport10 shocktown $control, absorb(i.c_id) vce(cluster stnfrost)

******Q2************************************************************************
use “data/ui6.dta”, clear

// 2b
//generate D_i, age-40
gen D=1 if age>=40 & !mi(age)
replace D=0 if age<40 & !mi(age)
gen age_40 = age – 40
gen age_40_sq = age_40^2

//regression
reg log_prev_wage i.D##c.age_40 i.D##c.age_40_sq

//plot
bys age_bin: egen mean_y = mean(log_prev_wage)
label var mean_y “mean of log previous wage”

preserve
duplicates drop mean_y age_bin, force
twoway connected mean_y age_bin, ///
ytitle(“mean of log previous wage”) xtitle(“age bins”) xline(40)
restore

// 2c
//regression
reg unempduration i.D##c.age_40 i.D##c.age_40_sq

//plot
bys age_bin: egen mean_y2 = mean(unempduration)
label var mean_y “mean of unemployment duration”

preserve
duplicates drop mean_y2 age_bin, force
twoway connected mean_y2 age_bin, ///
ytitle(“mean of unemployment duration”) xtitle(“age bins”) xline(40)
restore

// 2d
reg wagechange i.D##c.age_40 i.D##c.age_40_sq
//plot
bys age_bin: egen mean_y3 = mean(wagechange)
label var mean_y “mean of wage change”

preserve
duplicates drop mean_y3 age_bin, force
twoway connected mean_y3 age_bin, ///
ytitle(“mean of wage change”) xtitle(“age bins”) xline(40)
restore

// 2f
use “data/uiprereform6.dta”, clear
//generate D_i, age-40
gen D=1 if age>=40 & !mi(age)
replace D=0 if age<40 & !mi(age)
gen age_40 = age – 40
gen age_40_sq = age_40^2
//regression
reg unempduration i.D##c.age_40 i.D##c.age_40_sq
reg wagechange i.D##c.age_40 i.D##c.age_40_sq
//plot
bys age_bin: egen mean_y2 = mean(unempduration)
label var mean_y “mean of unemployment duration”

preserve
duplicates drop mean_y2 age_bin, force
twoway connected mean_y2 age_bin, ///
ytitle(“mean of unemployment duration”) xtitle(“age bins”) xline(40)
restore

bys age_bin: egen mean_y3 = mean(wagechange)
label var mean_y “mean of wage change”

preserve
duplicates drop mean_y3 age_bin, force
twoway connected mean_y3 age_bin, ///
ytitle(“mean of wage change”) xtitle(“age bins”) xline(40) yscale
restore

Reminder
OK
作业代写,代写作业,作业辅导,辅导作业,作业问答,美国作业代写,留学生作业,留学生作业代写,数学作业,数学作业代写,统计作业代写,物理作业代写,金融作业代写,大学作业辅导 Keywords: 作业代写 代写作业 作业辅导 辅导作业 作业问答 美国作业代写 留学生作业 留学生作业代写 数学作业 数学作业代写 统计作业代写 物理作业代写 金融作业代写 大学作业辅导