Arne and others who responded to my question,
thanks for the suggestions. The model below works fine.
Henrik
-----Ursprungligt meddelande-----
Fr�n: [email protected] [mailto:[email protected]] F�r Arne Risa Hole
Skickat: den 5 december 2007 10:54
Till: [email protected]
�mne: Re: st: Double bounded WTP
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
> >
*
* 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/