Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Double bounded WTP


From   "Arne Risa Hole" <[email protected]>
To   [email protected]
Subject   Re: st: Double bounded WTP
Date   Wed, 5 Dec 2007 15:54:29 +0000

Henrik,

I think Manos has essentially solved the problem but if you're keen on
using the logistic instead of the normal distribution there's an
example -ml- program below. This is something that has come up on the
list before so I thought it might be useful for others as well.

Arne

** NB!! Save your data before running this **

** Generate simulated double-bounded CV data **

clear
set obs 1000
set seed 12345

gen double bid0 = 5*uniform()
gen double bid1 = 2*bid0
gen double bid2 = bid0/2
gen double x = invnorm(uniform())
gen double e = logit(uniform())

gen double xb = 1 + 0.75*x
gen byte YY = (-0.5*bid1 + xb + e) >= 0
gen byte NN = (-0.5*bid2 + xb + e) < 0
gen byte YN = ((-0.5*bid0 + xb + e) >= 0) & ((-0.5*bid1 + xb + e) < 0)
gen byte NY = ((-0.5*bid0 + xb + e) < 0) & ((-0.5*bid2 + xb + e) >= 0)

** Specify log-likelihood function **

capture program drop double_cv
program double_cv
	version 9.2
	args lnf xb bid
	qui replace `lnf' = ln(invlogit($ML_y6*`bid'+`xb')) if $ML_y1 == 1
	qui replace `lnf' = ln(invlogit(-($ML_y7*`bid'+`xb'))) if $ML_y2 == 1
	qui replace `lnf' = ln(invlogit(-($ML_y6*`bid'+`xb')) - ///
	invlogit(-($ML_y5*`bid'+`xb'))) if $ML_y3 == 1
	qui replace `lnf' = ln(invlogit(-($ML_y5*`bid'+`xb')) - ///
	invlogit(-($ML_y7*`bid'+`xb'))) if $ML_y4 == 1
end

** Estimate model **

ml model lf double_cv (xb: YY NN YN NY = x) (bid: bid0 bid1 bid2 = )
ml search
ml maximize


On 04/12/2007, Arne Risa Hole <[email protected]> wrote:
> Hi Henrik,
>
> Take a look at "Maximum Likelihood Estimation with Stata" by William
> Gould, Jeffrey Pitblado and William Sribney
> <http://stata-press.com/books/ml.html>. It should be fairly
> straightforward to extend the logit example in the book to the
> double-bounded CV model you outlined.
>
> Hope this helps.
>
> Arne
>
>
> On 04/12/2007, Henrik Andersson <[email protected]> wrote:
> > Hi,
> >
> > I would to maximize the likelihood function for interval data from a dichotomous stated preference study. In this kind of study respondents are first asked if they are accepting to pay a certain bid (bid0). Depending on their answer they are then asked whether they accept a second higher bid (bid1) if they answered yes to the first question and a second lower bid if they answered no (bid 2).
> >
> > My log likelihood is made up of four parts and is given by
> >
> > LL=-{
> > YY*ln(1+exp(-($a+$c*bid1+`Xb')))
> > +NN*ln(exp(-($a+$c*bid2+`Xb')))/(1+exp(-($a+$c*bid2+`Xb')))
> > +YN*ln((exp(-($a+$c*bid1+`Xb')))/(1+exp(-($a+$c*bid1+`Xb')))-(exp(-($a+$c*bid0+`Xb')))/(1+exp(-($a+$c*bid0+`Xb'))))
> > +NY*ln((exp(-($a+$c*bid0+`Xb')))/(1+exp(-($a+$c*bid0+`Xb')))-(exp(-($a+$c*bid2+`Xb')))/(1+exp(-($a+$c*bid2+`Xb'))))}
> >
> > where
> >
> > YY = variable that defines respondent who has answered yes to initial and follow-up bid
> > NN = variable that defines respondent who has answered no to initial and follow-up bid
> > YN = variable that defines respondent who has answered yes to initial but no follow-up bid
> > NY = variable that defines respondent who has answered no to initial but yes follow-up bid
> >
> > bid0=initial bid level
> > bid1= follow-up bid (2*bid0)
> > bid2= follow-up bid (bid0/2)
> >
> > X = other covariates
> > a, b, and c = parameters
> >
> > The variables YY, NN, YN, and NY can be defined as both dummies or a continuous variable. The intervals for the bid levels may overlap since the initial bid level is varied among respondents.
> >
> > My experience from programming in Stata is very limited (close to nonexisting) so I don't know if what I want to do is trivial to solve, or if it is not possible to do. I would be very grateful for any help.
> >
> > Thank you
> >
> > Henrik
> >
> > Corresponding address Sep 2007 until May 2008:
> > Henrik Andersson
> > Program in Health Decision Science
> > Harvard School of Public Health
> > 718 Huntington Avenue, 2nd Floor
> > Boston, MA  02115-5924
> > phone +1-617-432-0394
> > fax: +1-617-432-0190
> > email: [email protected]
> > www.healthdecisionscience.hsph.harvard.edu
> >
> > Permanent address:
> > vti
> > Henrik Andersson
> > Researcher, PhD
> > Dept. of Transport Economics
> > Post: VTI / P.O. Box 55685 / SE-102 15 Stockholm / Sweden
> > Visit: Lindstedtsv�gen 24 / KTH Campus Vallhallav�gen
> > Tel: +46-13-20 40 00
> > Direct: +46-8-555 770 27
> > Fax: +46-8-28 50 43
> > E-mail: [email protected] / www.vti.se/henrik
> > www.vti.se
> >
> >
> >
> > *
> > *   For searches and help try:
> > *   http://www.stata.com/support/faqs/res/findit.html
> > *   http://www.stata.com/support/statalist/faq
> > *   http://www.ats.ucla.edu/stat/stata/
> >
>

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index