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
Clarke Error Grid Analysis and PlotI was looking for Clarke Error Grid Plot over the internet but couldn't find how to do this in STATA…
Nested loops with macros - using required, r(100)Hi everyone, I have about twenty csv files on which I need to do some estimation after I have obtai…
Normality test for multiple imputationsDear all, I have a data set with multiple imputations performed. I want to perform linear and logis…
How to generate a value for groups of distinct value of a variable and then drop subgroups based on the value generated?Hi! I have a dataset including ppl's information in the group of family (each observation has a pid …
Why does indicating omitted dummy variables not work?So I run two Probit regressions with different commands, one is with i(2 3 4 5).c_lable and the othe…
Subscribe to:
Post Comments (Atom)
0 Response to MLE Function
Post a Comment