Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: wtpcikr for models not estimated in STATA
From
"P. Wilner Jeanty" <[email protected]>
To
[email protected], "[email protected]" <[email protected]>
Subject
Re: st: wtpcikr for models not estimated in STATA
Date
Wed, 14 Nov 2012 13:56:49 -0600
On Wed, Nov 14, 2012 at 10:17 AM, [email protected]
<[email protected]> wrote:
>
> Good day.
>
> I am using a different program to run my models. I used this program
> to export the coefficient estimates as well as the varcov matrix and
> then imported these into Stata. As such, these are the two pieces of
> information I currently have: b1 (the coefficient vector) and varcov1
> (the varcov matrix).
>
> I specified the varcov and the b1 so that price is my first variable
> and the ASC (capturing the utility of choosing the status quo option)
> is the last. I did this because the help file specifies that the bid
> variable should be the first variable specified after wtpcikr and the
> constant the last.
>
> Now, if I type
> wtpcikr price_c1 miles5_c1 miles8_c1 miles12_c1 asc_c1, bmat(b1) vmat(varcov1)
>
> Then I get the error message:
> last estimates not found
> r(301);
>
> Can anyone help me with what I am doing wrong? When I look through
> your help file, the one thing I see I don't have is the mymean(.)
> option. Is this required? If so, how would I obtain this? The data at
> hand is from a choice experiment and price_c1 etc. represent the
> coefficients on the price variable and miles5_c1 represents the
> utility associated with the a level of 5 miles. I'm not sure what
> would go in the mymean () vector.
>
> Any assistance would be very much appreciated!
> Have a lovely day.
> Sanja
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/faqs/resources/statalist-faq/
> * http://www.ats.ucla.edu/stat/stata/
Dear Sanja,
You are right that -wtpcikr- allows you to bring your estimation
results into Stata for constructing Krinsky and Robb confidence
intervals. However, you need to trick -wtpcikr- in order to have it do
what you want. Since you are bringing in your estimation results, in
addition to specifying the -bmat()- and -vmat()- options, you need to
specify the -mymean()- option to provide the mean values of your
variables in a matrix. Here is where the trick comes in. Prior to
using -wtpcikr-, you have to estimate in Stata a model with the same
distributional assumption you used to get your coefficient estimates.
For instance, if you used a logistic distributional assumption to get
your estimates, then you need to estimate a simple logit model in
Stata. It really does not matter what variables go into the estimation
as long as it is a logit model. That step will not only prevent Stata
from issuing the r(301) error message but also point -wtpcikr- to the
right formula to use for the computations.
If you know the mean values of your variables, you can place them into
a matrix as follows:
. matrix meanval=[val1, val2, val3, val4]
If you don't, you can use Stata's -tabstat- command to calculate them
and place them into a matrix as follows:
. tabstat miles5_c1 miles8_c1 miles12_c1 asc_c1, save
. matrix meanval = r(StatTotal)
You are now ready to proceed.
. logit anyvar anyvar
. wtpcikr price_c1 miles5_c1 miles8_c1 miles12_c1 asc_c1, bmat(b1)
vmat(varcov1) mymean(meanval)
Hope this helps.
Best regards,
Wilner
Rice University
6100 Main Street, Houston, Texas 77005
Email: [email protected]
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/