Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Maximum Likelihood Estimation cannot find starting values in Stata

    I am attempting to use Deal or No Deal Data to test for risk aversion parameters using Maximum Likelihood Estimation. I am relatively inexperienced in using MLE in Stata and how it works.

    I am trying to use a model used in the 'Risk Aversion in Game Shows' Chapter in Volume 12 - Risk Aversion in Experiments (2008). Harrison and Lau (2008) have a paper called 'Maximum likelihood estimation of utility functions using Stata' which provides Stata code to evaluate the lottery choices of Harrison and Rutström [2005], which uses the same model. I have altered this code to match my dataset, however, when running this program I am unable to find any feasible values despite having altered the model many times and reducing the dataset to only final round decisions, even though this model has previously been used for DOND data.

    The code they provide in their paper is as follows:
    Code:
    program define ML_eut0
    * specify the arguments of this program
    args lnf r
    
    * declare the temporary variables to be used
    tempvar choice prob0l prob1l prob2l prob3l prob0r prob1r prob2r prob3r endow m0 m1 m2 m3 y0 y1 y2 y3 euL euR euDiff
    
    * please do not display all these steps on the screen, for every ML iteration!
    
    quietly {
    
    * initialize the data
    generate int `choice' = $ML_y1
    generate double `prob0l' = $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 `m2' = $ML_y12
    generate double `m3' = $ML_y13
    generate double `endow' = $ML_y14
    
    * construct the argument of the utility function
    replace `m0' = `endow'+`m0'
    replace `m1' = `endow'+`m1'
    replace `m2' = `endow'+`m2'
    replace `m3' = `endow'+`m3'
    
    * evaluate the utility function
    generate double `y0' = `m0'^`r'
    generate double `y1' = `m1'^`r'
    generate double `y2' = `m2'^`r'
    generate double `y3' = `m3'^`r'
    
    * calculate EU of each lottery
    generate double `euL' = (`prob0l'*`y0')+(`prob1l'*`y1')+(`prob2l'*`y2')+(`prob3l'*`y3')
    generate double `euR' = (`prob0r'*`y0')+(`prob1r'*`y1')+(`prob2r'*`y2')+(`prob3r'*`y3')
    
    * get the Fechner index
    generate double `euDiff' = `euR' - `euL'
    
    * evaluate the likelihood
    replace `lnf' = ln(normal( `euDiff')) if `choice'==1
    replace `lnf' = ln(normal(-`euDiff')) if `choice'==0
    
    * save the calculated likelihood in an external storage variable (for post-processing, explained later)
    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
    I have adapted the following sections in order for it to match my dataset and variables:

    Code:
    tempvar Choice Bankoffer probr1 probr2 probr3 probr4 probr5 probr6 probr7 probr8 probr9 probr10 probr11 probr12 probr13 probr14 /*
    */ probr15 probr16 probr17 probr18 probr19 probr1 probr20 probr21 probr22 probr23 probr24 probr25 probr26 /*
    */ onepence onepound five ten twentyfive fifty seventyfive onehundred twohundred threehundred fourhundred fivehundred /*
    */ sevenhundredfifty onethousand fivethousand tenthousand twentyfivethousand fiftythousand seventyfivethousand /*
    */ onehundredthousand twohundredthousand threehundredthousand fourhundredthousand fivehundredthousand /*
    */ sevenhundredfiftythousand onemillion y0 y1 y2 y3 y4 y5 y6 y7 y8 y9 y10 y11 y12 y13 y14 y15 y16 y17 y18 y19 y20 /*
    */ y21 y22 y23 y24 y25 y26 y27 y28 euL euR euDiff
    
    generate int `Choice' = $ML_y1
    generate double `Bankoffer'= $ML_y2
    generate double `probr1' = $ML_y3
    generate double `probr2' = $ML_y4
    generate double `probr3' = $ML_y5
    generate double `probr4' = $ML_y6
    generate double `probr5' = $ML_y7
    generate double `probr6' = $ML_y8
    generate double `probr7' = $ML_y9
    generate double `probr8' = $ML_y10
    generate double `probr9' = $ML_y11
    generate double `probr10' = $ML_y12
    generate double `probr11' = $ML_y13
    generate double `probr12' = $ML_y14
    generate double `probr13' = $ML_y15
    generate double `probr14' = $ML_y16
    generate double `probr15' = $ML_y17
    generate double `probr16' = $ML_y18
    generate double `probr17' = $ML_y19
    generate double `probr18' = $ML_y20
    generate double `probr19' = $ML_y21
    generate double `probr20' = $ML_y22
    generate double `probr21' = $ML_y23
    generate double `probr22' = $ML_y24
    generate double `probr23' = $ML_y25
    generate double `probr24' = $ML_y26
    generate double `probr25' = $ML_y27
    generate double `probr26' = $ML_y28
    generate double `onepence' = $ML_y29
    generate double `onepound' = $ML_y30
    generate double `five' = $ML_y31
    generate double `ten' = $ML_y32
    generate double `twentyfive' = $ML_y33
    generate double `fifty' = $ML_y34
    generate double `seventyfive' = $ML_y35
    generate double `onehundred' = $ML_y36
    generate double `twohundred' = $ML_y37
    generate double `threehundred' = $ML_y38
    generate double `fourhundred' = $ML_y39
    generate double `fivehundred' = $ML_y40
    generate double `sevenhundredfifty' = $ML_y41
    generate double `onethousand' = $ML_y42
    generate double `fivethousand' = $ML_y43
    generate double `tenthousand' = $ML_y44
    generate double `twentyfivethousand' = $ML_y45
    generate double `fiftythousand' = $ML_y46
    generate double `seventyfivethousand' = $ML_y47
    generate double `onehundredthousand' = $ML_y48
    generate double `twohundredthousand' = $ML_y49
    generate double `threehundredthousand' = $ML_y50
    generate double `fourhundredthousand' = $ML_y51
    generate double `fivehundredthousand' = $ML_y52
    generate double `sevenhundredfiftythousand' = $ML_y53
    generate double `onemillion' = $ML_y54
    
    
    generate double `y0' = (`Bankoffer'^`r')
    generate double `y1' = (`onepence'^`r')
    generate double `y2' = (`onepound'^`r')
    generate double `y3' = (`five'^`r')
    generate double `y4' = (`ten'^`r')
    generate double `y5' = (`twentyfive'^`r')
    generate double `y6' = (`fifty'^`r')
    generate double `y7' = (`seventyfive'^`r')
    generate double `y8' = (`onehundred'^`r')
    generate double `y9' = (`twohundred'^`r')
    generate double `y10' = (`threehundred'^`r')
    generate double `y11' = (`fourhundred'^`r')
    generate double `y12' = (`fivehundred'^`r')
    generate double `y13' = (`sevenhundredfifty'^`r')
    generate double `y14' = (`onethousand'^`r')
    generate double `y15' = (`fivethousand'^`r')
    generate double `y16' = (`tenthousand'^`r')
    generate double `y17' = (`twentyfivethousand'^`r')
    generate double `y18' = (`fiftythousand'^`r')
    generate double `y19' = (`seventyfivethousand'^`r')
    generate double `y20' = (`onehundredthousand'^`r')
    generate double `y21' = (`twohundredthousand'^`r')
    generate double `y22' = (`threehundredthousand'^`r')
    generate double `y23' = (`fourhundredthousand'^`r')
    generate double `y24' = (`fivehundredthousand'^`r')
    generate double `y25' = (`sevenhundredfiftythousand'^`r')
    generate double `y26' = (`onemillion'^`r')
    
    generate double `euL' = `y0'
    generate double `euR' = (`probr1'*`y1')+(`probr2'*`y2')+(`probr3'*`y3')+(`probr4'*`y4')+(`probr5'*`y5')+(`probr6'*`y6')/*
    */ +(`probr7'*`y7')+(`probr8'*`y8')+(`probr9'*`y9')+(`probr10'*`y10')+(`probr11'*`y11')+(`probr12'*`y12')+(`probr13'*`y13') /*
    */ +(`probr14'*`y14')+(`probr15'*`y15')+(`probr16'*`y16')+(`probr17'*`y17')+(`probr18'*`y18')+(`probr19'*`y19') /*
    */ +(`probr20'*`y20')+(`probr21'*`y21')+(`probr22'*`y22')+(`probr23'*`y23')+(`probr24'*`y24')+(`probr25'*`y25')+(`probr26'*`y26')
    In this case, the probabilities are associated with the boxes left at the end of each round, and the variables for the box values contain a 0 or the numerical value of the box. All the rest of the code remains the same except the execution line.

    When carried out Stata is unable to find any feasible values, despite this model having worked in previous research. I was hoping to develop this initial code to include errors and use other utility functions etc, however, without getting this basic model to work I am not sure how to proceed. I was wondering if someone could help me find my error, or whether it was an issue with the model being used. Sorry for the long post and thanks in advance.

  • #2
    My experience with this models has been that it is better to start with a far simpler model. (say only 3 options as payments) instead of the 26 all at once. Then just add more and more information until the whole model is estimated.
    HTH
    F

    Comment

    Working...
    X