I have estimated prospect theory parameters (gamma and alpha) from experimental data Holt and Laury method and tried to draw histograms of estimated parameters. the parameters are estimated from this model, but i do not know how to get parameters for each individual to get the distribution of parameters. please help to understand this
* define prospect theory model following Harrison and Rutstrom (2008)
program define MLcpt
args lnf alpha lambda gamma
tempvar prob0l prob1l prob0r prob1r y0 y1 y2 y3
tempvar euL euR euDiff euRatio tmp
quietly {
generate double `tmp' = (($ML_y2^`gamma')+((1-$ML_y2)^`gamma'))
replace `tmp' = `tmp'^(1/`gamma')
generate double `prob0l' = ($ML_y2^`gamma')/`tmp'
generate double `prob1l' = ((1-$ML_y2)^(`gamma'))/`tmp'
replace `tmp' = (($ML_y3^`gamma')+((1-$ML_y3)^`gamma'))
replace `tmp' = `tmp'^(1/`gamma')
generate double `prob0r' = ($ML_y3^`gamma')/`tmp'
generate double `prob1r' = ((1-$ML_y3)^(`gamma'))/`tmp'
generate double `y0' = .
replace `y0' = ( $ML_y4)^(`alpha') if $ML_y4>=0
replace `y0' = -`lambda'*(-$ML_y4)^(`alpha') if $ML_y4<0
generate double `y1' = .
replace `y1' = ( $ML_y5)^(`alpha') if $ML_y5>=0
replace `y1' = -`lambda'*(-$ML_y5)^(`alpha') if $ML_y5<0
generate double `y2' = .
replace `y2' = ( $ML_y6)^(`alpha') if $ML_y6>=0
replace `y2' = -`lambda'*(-$ML_y6)^(`alpha') if $ML_y6<0
generate double `y3' = .
replace `y3' = ( $ML_y7)^(`alpha') if $ML_y7>=0
replace `y3' = -`lambda'*(-$ML_y7)^(`alpha') if $ML_y7<0
gen double `euL'=(`prob0l'*`y0')+(`prob1l'*`y1')
gen double `euR'=(`prob0r'*`y2')+(`prob1r'*`y3')
generate double `euDiff' = `euR' - `euL'
replace `lnf' = ln(normal( `euDiff')) if $ML_y1==1
replace `lnf' = ln(normal(-`euDiff')) if $ML_y1==0
}
end
ml model lf HL_cpt0 (alpha: choices prob1l prob2l prize0 prize1 prize2 prize3= )(gamma: ), cluster(ID) technique(nr) maximize
* define prospect theory model following Harrison and Rutstrom (2008)
program define MLcpt
args lnf alpha lambda gamma
tempvar prob0l prob1l prob0r prob1r y0 y1 y2 y3
tempvar euL euR euDiff euRatio tmp
quietly {
generate double `tmp' = (($ML_y2^`gamma')+((1-$ML_y2)^`gamma'))
replace `tmp' = `tmp'^(1/`gamma')
generate double `prob0l' = ($ML_y2^`gamma')/`tmp'
generate double `prob1l' = ((1-$ML_y2)^(`gamma'))/`tmp'
replace `tmp' = (($ML_y3^`gamma')+((1-$ML_y3)^`gamma'))
replace `tmp' = `tmp'^(1/`gamma')
generate double `prob0r' = ($ML_y3^`gamma')/`tmp'
generate double `prob1r' = ((1-$ML_y3)^(`gamma'))/`tmp'
generate double `y0' = .
replace `y0' = ( $ML_y4)^(`alpha') if $ML_y4>=0
replace `y0' = -`lambda'*(-$ML_y4)^(`alpha') if $ML_y4<0
generate double `y1' = .
replace `y1' = ( $ML_y5)^(`alpha') if $ML_y5>=0
replace `y1' = -`lambda'*(-$ML_y5)^(`alpha') if $ML_y5<0
generate double `y2' = .
replace `y2' = ( $ML_y6)^(`alpha') if $ML_y6>=0
replace `y2' = -`lambda'*(-$ML_y6)^(`alpha') if $ML_y6<0
generate double `y3' = .
replace `y3' = ( $ML_y7)^(`alpha') if $ML_y7>=0
replace `y3' = -`lambda'*(-$ML_y7)^(`alpha') if $ML_y7<0
gen double `euL'=(`prob0l'*`y0')+(`prob1l'*`y1')
gen double `euR'=(`prob0r'*`y2')+(`prob1r'*`y3')
generate double `euDiff' = `euR' - `euL'
replace `lnf' = ln(normal( `euDiff')) if $ML_y1==1
replace `lnf' = ln(normal(-`euDiff')) if $ML_y1==0
}
end
ml model lf HL_cpt0 (alpha: choices prob1l prob2l prize0 prize1 prize2 prize3= )(gamma: ), cluster(ID) technique(nr) maximize