Hello, I am trying to define and estimate the parameters from a log likelihood function using minimum wage data and unemployment and wage data from the National Agricultural Workers Survey. The individual likelihood contributions are defined as follows (from Flinn (2006): Minimum Wage Effects on Labor Market Outcomes under Search, Matching, and Endogenous Contact Rates):
For unemployed individuals Array
For employed individuals earning the minimum wage: Array
For employed individuals earning above the minimum wage: Array
where m denotes the minimum wage, w denotes the wage of individuals who are paid at least $0.50 above the minimum wage, rho*V_n(m) is denoted by the parameter "theta" in the code below, G() denotes the CDF of the lognormal distribution, and g() denotes the PDF of the lognormal distribution. So far I have specified my program as follows: I want to estimate mu and sigma (which are embedded in the G() and g() functions), as well as the parameters alpha, theta, lambda, and eta. Here is the code I have been using so far:
use "C:\Users\Zach\Dropbox\Confidential NAWS Data\Confidential NAWS Data 2018\Raw Files\NAWS Datasets (Stata)\nawscrtdvars1db18_STATA.dta", clear
rename *, lower
gen year = year(cs2)
merge m:1 state year using "C:\Users\Zach\Dropbox\AEWR Project\Data Files\Generated Data Files\State Minimum Wages No FY 1990-2018.dta"
drop _m
merge m:1 year using "C:\Users\Zach\Dropbox\AEWR Project\Data Files\Generated Data Files\Federal Minimum Wages No FY 1990-2018.dta"
drop _m
replace fed_min_wage = 3.35 if year==1988 | year==1989 //impute fed min wage data that is missing
replace min_wage = fed_min_wage if real_min_wage==. //impute fed min wage for states with no min wage
replace min_wage = fed_min_wage if state=="GA" | state=="WY" //impute fed min wage for states with lower min wage
replace fwweeks = 52 if fwweeks>52 //round down weeks for leap year
replace fwweeks = fwweeks/52 //normalize work weeks to 52 weeks = 1
gen unemployed = fwweeks < 52 //identify workers who were unemployed during year
gen ti = 52 - fwweeks if fwweeks<52 //identify length of unemployment spell
gen paid_min_wage = waget1<=(min_wage + .50) //identify individuals paid about the min wage
replace waget1 = min_wage if waget1<=(min_wage+.50) //replace wages for individuals who make min wage + .50
gen paid_above_min_wage = waget1>(min_wage+.50) //identify individuals paid above min wage
gen ln_mw=ln(min_wage) //generate the log of min wage
gen waget1_hi = waget1 if waget1>(min_wage +.50) //generate wages for individuals who make above min
gen ln_waget1_hi = ln(waget1) if waget1>(min_wage +.50) //take log of wages for those above min wage
replace paid_min_wage=0 if unemployed==1 //classify individuals as not paid min wage if classified as unemployed
replace paid_above_min_wage=0 if unemployed==1 //classifiy individual as not paid hi wage if classified as unemployed
program drop AEWR_1
program define AEWR_1
version 1.0
args llf mu sigma alpha theta lambda eta
tempvar G1 G2 G3 T1 T2 T3 T4 T5 T6
generate double `G1' = normal(sqrt((ln_mw - `mu')/`sigma')^2)
generate double `G2' = normal([(ln_mw - (1 - `alpha')*`theta')/`alpha' - `mu']/`sigma')
generate double `G3' = normalden([(ln_waget1_hi - (1 - `alpha')*`theta')/`alpha' - `mu']/`sigma')/(`sigma'*waget1_hi)
generate double `T1' = ln(sqrt(`lambda')^2) - ln(sqrt(`eta' + `lambda'*`G1')^2)
generate double `T2' = ln(sqrt(`eta')^2) + ln(sqrt(`G1')^2) if unemployed==1
generate double `T3' = -sqrt(`lambda'*`G1'*ti)^2 if unemployed==1
generate double `T4' = ln(sqrt(`G1' - `G2')^2) if paid_min_wage==1
generate double `T5' = -ln(sqrt(`alpha')^2) if paid_above_min_wage==1
generate double `T6' = ln(sqrt(`G3')^2) if paid_above_min_wage==1
quietly replace `llf' = `T1' + `T2' + `T3' if unemployed==1
quietly replace `llf' = `T1' + `T4' if paid_min_wage==1
quietly replace `llf' = `T1' + `T5' + `T6' if paid_above_min_wage==1
end
ml model lf AEWR_1 () () () () () ()
ml check
ml search, repeat()
ml maximize, iterate(50) difficult
ml graph
exit
I get this message indicating that feasible values cannot be found. Array
First of all, I am not sure if I should be using the lf model or if I should switch to using the d0 estimator. Also, I am not sure if I am specifying the equations correctly in terms of the () () ... () after the ml model lf AEWR_1 command. At this point, I do not want my dependent variables (i.e., ln_mw, ln_waget1_hi, and ti) to depend on other variables, which is why I left the () without an equation in them. Is this how I should be doing it? Any help you could provide would be greatly appreciated, as I have spent the past two days trying to figure this out.
Related Posts with Help with ML Program
How to create and define 30 minutes interval data in Stata?Dear user, My data is 30 minutes interval. I want to declare as time series. For daily time series d…
How to make this type of graph?Hello guys, Do you have any idea how to make the chart below? It is a histogram of frequencies of …
Generating a new variable that is the sum of each value of a different variableHello. This seems like it would be straightforward but as an advanced beginner I am having a hard ti…
profileplotHi, I'm using Stata version 11, and despite repeated attempts, unable to download the profileplot pr…
creating an indix visitHello, I am trying to create an "index visit" where an individual has 90 days of eligibly period bef…
Subscribe to:
Post Comments (Atom)
0 Response to Help with ML Program
Post a Comment