## STATA Homework Help on Political Economics

• 27th Jan, 2022
• 15:28 PM
graph drop _all
cd "d:\Documentele lui Bogdan\Assignments\2020.05.20 Danah (Stata) (reg)\"
log using "Untitled.smcl", replace
use states.dta, clear

**
fsum unemploy  density college hisp, label
kdensity unem
gen lnDensity=ln(dens)
kdensity dens, name(g1)
kdensity lnD, name(g2)
graph combine g1 g2

recode unempl (0/5=0) (5/max=1), gen(highUnempl)
lab var high "high unemployment"
fre high

logit highUne lnDens coll hisp, robust
logit highUne lnDens coll hisp, robust or

margins, at(lnD=(0(1)7))
marginsplot,  recast(line) recastci(rarea)
predict predUnempl
kdensity pred, name(g3)
graph box pred, name(g4)
graph combine g3 g4

**
lab def eee 0 "low" 1 "average" 2 "high"
recode  unempl (0/4.5=0) (4.5/5.5=1) (5.5/max=2), gen(oUnempl)
lab val oUnempl eee
lab var oUnempl "unemployment - ordinal variable"
tab oUnempl
ologit oUnempl lnDens coll hisp, robust
logit oUnempl lnDens coll hisp, robust or
margins, at(lnD=(0(1)7))
marginsplot,  recast(line) recastci(rarea)
predict pred2Unempl
kdensity pred2, name(g5)
graph box pred2, name(g6)
graph combine g5 g6

**
gen mnDV=battle04*10+highU
lab def mmm 0 "low unempl; not Battleground state" 1 "high unempl; no Battleground state" 10 "low unempl; Battleground state" 11 "high unempl; Battleground state"
lab val mnDV mmm
tab mnDV

mlogit mnDV lnDens coll hisp, robust
margins, at(lnD=(0(1)7))
marginsplot,  recast(line)
log close