KEMBAR78
MLE of Utility Function by Using Stata | PDF | Logarithm | Utility
0% found this document useful (0 votes)
196 views14 pages

MLE of Utility Function by Using Stata

The document discusses methods for estimating utility functions using maximum likelihood estimation in Stata. It describes estimating a constant relative risk aversion (CRRA) utility function, extending the model to include loss aversion and probability weighting based on prospect theory, and adding stochastic errors. It provides example Stata code for estimating standard models and discusses outputs.

Uploaded by

meriem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
196 views14 pages

MLE of Utility Function by Using Stata

The document discusses methods for estimating utility functions using maximum likelihood estimation in Stata. It describes estimating a constant relative risk aversion (CRRA) utility function, extending the model to include loss aversion and probability weighting based on prospect theory, and adding stochastic errors. It provides example Stata code for estimating standard models and discusses outputs.

Uploaded by

meriem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Maximum Likelihood Estimation of

Utility Functions Using Stata


Glenn W. Harrison†
May 2008

Presenter: Hanyu Xia


MLE of Utility Functions using Stata
• Estimating a CRRA Utility Function
• Extending the Economic Specification to Include Loss Aversion and
Probability Weighting
• Adding Stochastic Errors
• Non-Parametric Estimation of the EUT Model
• Alternative Functional Forms for Utility
• Testing Non-Nested Models
• Mixture Models
• Maximum Simulated Likelihood
Experiment design-Risk Averse
• Harrison and Rustrom [2005]
• 2 lotteries with “low” and “high” payoff
• Group 1X10X: provided the opportunity to give up the earnings in
return for a chance with payments scaled up by 10
• Group 10X: given only the 10X task

• Test whether the responses in the 10X task are affected by the prior
experience of having seen the 1 X
Estimating a CRRA Utility Function
• Utility function

Basic Stata Syntax


Estimating a standard CRRA Utility Function

• program define ML_eut0


• Version 9.0
• args lnf r * specify the arguments of this program

• tempvar choice prob0l prob1l prob2l prob3l prob0r prob1r


prob2r prob3r endow m0 m1 m2 m3 y0 y1 y2 y3 euL euR euDiff
* declare the temporary variables to be used

• quietly { * please do not display all these steps on


the screen, for every ML iteration!
Estimating a standard CRRA Utility Function
• generate int `choice' = $ML_y1 * initialize the data
• generate double `prob0l' = $ML_y2
• ……
• generate double `endow' = $ML_y14
• replace `m0' = `endow'+`m0’
* construct the argument of
……
the utility function
• replace `m3' = `endow'+`m3’
• generate double `y0' = `m0'^`r
…… * evaluate the utility function
• generate double `y3' = `m3'^`r’
Estimating a standard CRRA Utility Function
• generate double `euL' =
(`prob0l'*`y0')+(`prob1l'*`y1')+(`prob2l'*`y2')+(`prob3l'*`y3’)
* calculate EU of each lottery
• generate double `euR' =
(`prob0r'*`y0')+(`prob1r'*`y1')+(`prob2r'*`y2')+(`prob3r'*`y3')
• generate double `euDiff' = `euR' - `euL’ * get the index
• replace `lnf' = ln(normal( `euDiff')) if `choice’==1
…… * evaluate the likelihood
• replace `lnf' = ln(normal(-`euDiff')) if `choice'==0
• replace ll = `lnf’ * save the calculated likelihood
• } in an external storage variable
• end (for post-processing, explained
later)
Output
• 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

initial: log pseudolikelihood = -10201.74


alternative: log pseudolikelihood = -10058.855
rescale: log pseudolikelihood = -10058.855
Iteration 0: log pseudolikelihood = -10058.855 (not concave)
Iteration 1: log pseudolikelihood = -9617.4367
Iteration 2: log pseudolikelihood = -9512.9457
Iteration 3: log pseudolikelihood = -9512.8186
Iteration 4: log pseudolikelihood = -9512.8186
Output
• ml display
Extending the Economic Specification to Include Loss
Aversion and Probability Weighting

• Utility Fuction Tversky and Kahneman [1992]

• Weighting Function Tversky and Kahneman [1992]


Estimating a SPT Utility Function
* define KT 1992 SPT specification with no errors
program define MLkt0
args lnf alpha beta lambda gamma
tempvar choice prob0l prob1l prob2l prob3l prob0r prob1r prob2r prob3r
tempvar m0 m1 m2 m3 y0 y1 y2 y3 euL euR euDiff euRatio tmp
quietly {
generate int `choice' = $ML_y1
generate double `tmp' = (($ML_y2^`gamma')+($ML_y3^`gamma')+($ML_y4^`gamma')+($ML_y5^`gamma'))^(1/`gamma')
generate double `prob0l' = ($ML_y2^`gamma')/`tmp'
generate double `prob1l' = ($ML_y3^`gamma')/`tmp'
generate double `prob2l' = ($ML_y4^`gamma')/`tmp’
generate double `prob3l' = ($ML_y5^`gamma')/`tmp'
replace `tmp' = (($ML_y6^`gamma')+($ML_y7^`gamma')+($ML_y8^`gamma')+($ML_y9^`gamma'))^(1/`gamma')
generate double `prob0r' = ($ML_y6^`gamma')/`tmp'
generate double `prob1r' = ($ML_y7^`gamma')/`tmp'
generate double `prob2r' = ($ML_y8^`gamma')/`tmp'
generate double `prob3r' = ($ML_y9^`gamma')/`tmp'
generate double `m0' = $ML_y10
generate double `m1' = $ML_y11
generate double `m2' = $ML_y12
generate double `m3' = $ML_y13
generate double `y0' = .
replace `y0' = ( `m0')^(`alpha') if `m0'>=0
replace `y0' = -`lambda'*(-`m0')^(`beta') if `m0'<0
Output
• ml model lf MLkt0 (alpha: Choices P0left P1left P2left P3left P0right P1right
P2right P3right prize0 prize1 prize2 prize3 = ) (beta: ) (lambda: ) (gamma: ),
cluster(id) technique(nr) maximize
Thank you for your attention!

You might also like