Dear StatList,
I am trying to replicate Harrison G. (2008) MLE of utility Functions using Stata. However, I am stucked at the very first commands. I run the following and get this error: "too few variables specified r(102)"
Here is the code
program define ML_eut0
version 9.0
args lnf r
tempvar choice prob0l prob1l prob2l prob3l prob0r prob1r prob2r prob3r endow m0 m1 m2 m3 y0 y1 y2 y3 euL euR euDiff
quietly {
generate int `choice' = $ML_y1
generate double `prob01' = $ML_y2
generate double `prob1l' = $ML_y3
generate double `prob2l' = $ML_y4
generate double `prob3l' = $ML_y5
generate double `prob0r' = $ML_y6
generate double `prob1r' = $ML_y7
generate double `prob2r' = $ML_y8
generate double `prob3r' = $ML_y9
generate double `m0' = $ML_y10
generate double `m1' = $ML_y11
generate double `m3' = $ML_y12
generate double `m4' = $ML_y13
generate double `m5' = $ML_y14
replace `m0' = `endow' + `m0'
replace `m1' = `endow' + `m1'
replace `m2' = `endow' + `m2'
replace `m3' = `endow' + `m3'
generate double `y0' = `m0'^`r'
generate double `y1' = `m1'^`r'
generate double `y0' = `m0'^`r'
generate double `y1' = `m1'^`r'
generate double `y2' = `m2'^`r'
generate double `y3' = `m3'^`r'
generate double `euL' = (`prob0l'*`y0')+(`prob1l'*`y1')+(`prob2l'*`y2')+(` prob3l'*`y3')
generate double `euR' = (`prob0r'*`y0')+(`prob1r'*`y1')+(`prob2r'*`y2')+(` prob3r'*`y3')
generate double `euDiff' = `euR' - `euL'
replace `lnf' = ln(normal( `euDiff')) if `choice'==1
replace `lnf' = ln(normal(-`euDiff')) if `choice'==0
replace ll = `lnf'
}
end
ml model lf ML_eut0 (r: Choices P0left P1left P2left P3left P0right P1right P2right P3right prize0 prize1 prize2 prize3 stake = ), cluster(id) technique(nr) maximize
Any suggestions?
Related Posts with MLE Function
How to identify households with all members with no incomeDear All, I want to know how we check whether in each HH there is at least one member with income (…
Arellano Bond MethodHello everyone, My regression looks in the following way: yit=a0 + a1xit + a2Dit +a3Lit + a4mit + …
How to move value/label of observations between variablesI have a dataset in which some observations take the values of the previous variable on the same row…
working with multi‐episode event history datasetAnyone with some experience working with multi‐episode event history dataset ? …
Centering variablesHello, I have 16 countries across 30+years. My variables are slightly multi collinear as I have GDP…
Subscribe to:
Post Comments (Atom)
0 Response to MLE Function
Post a Comment