Announcement

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

  • WTP space using gmnl model

    Dear stata users,

    i want to calculate the WTP in preference space using the user written model gmnl in Stata 14.2. Therefore, I have written the following code:

    Code:
    gen price = P_IST + P_MPCI
    generate user_cset = 100*id + cset
    gen mprice = -price
    gen cons = 1
    constraint 1 [Mean]mprice = 1
    constraint 2 [tau]_cons = 0
    matrix start = 1,0,0,0,0,0,0,0,0,0
    gmnl choice mprice Impl Sub Cov KDP_mittel KDP_hoch asc1 asc2, group(user_cset) id(id) from(start, copy) het(cons) constraint(1,2) nrep(10)
    I also want to provide the answers of the first individual (id=1):

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int id byte(cset Alt choice asc1 asc2 asc3) int P_IST byte(P_MPCI Cov KDP KDP_mittel KDP_hoch Impl)
    1  1 1 0 1 0 0 350  0 60 2  1  0 1
    1  1 2 0 0 1 0   0  5 80 3  0  1 2
    1  1 3 1 0 0 1   0  0  0 0  0  0 0
    1  2 1 0 1 0 0 350  0 80 2  1  0 2
    1  2 2 0 0 1 0   0  5 60 2  1  0 1
    1  2 3 1 0 0 1   0  0  0 0  0  0 0
    1  3 1 1 1 0 0 600  0 70 1 -1 -1 1
    1  3 2 0 0 1 0   0 45 70 2  1  0 2
    1  3 3 0 0 0 1   0  0  0 0  0  0 0
    1  4 1 0 1 0 0 850  0 80 3  0  1 1
    1  4 2 0 0 1 0   0 45 60 1 -1  0 2
    1  4 3 1 0 0 1   0  0  0 0  0  0 0
    1  5 1 1 1 0 0 600  0 70 1 -1 -1 2
    1  5 2 0 0 1 0   0 25 70 2  1  0 1
    1  5 3 0 0 0 1   0  0  0 0  0  0 0
    1  6 1 0 1 0 0 350  0 80 3  0  1 1
    1  6 2 1 0 1 0   0 45 60 1 -1 -1 2
    1  6 3 0 0 0 1   0  0  0 0  0  0 0
    1  7 1 0 1 0 0 850  0 60 1 -1 -1 1
    1  7 2 0 0 1 0   0  5 80 3  0  1 2
    1  7 3 1 0 0 1   0  0  0 0  0  0 0
    1  8 1 0 1 0 0 850  0 80 2  1  0 2
    1  8 2 0 0 1 0   0  5 60 1 -1 -1 1
    1  8 3 1 0 0 1   0  0  0 0  0  0 0
    1  9 1 0 1 0 0 600  0 70 1 -1 -1 1
    1  9 2 1 0 1 0   0 25 70 3  0  1 2
    1  9 3 0 0 0 1   0  0  0 0  0  0 0
    1 10 1 1 1 0 0 850  0 60 3  0  1 2
    1 10 2 0 0 1 0   0 45 80 2  1  0 1
    1 10 3 0 0 0 1   0  0  0 0  0  0 0
    1 11 1 0 1 0 0 350  0 60 3  0  1 2
    1 11 2 1 0 1 0   0 25 80 1 -1 -1 1
    1 11 3 0 0 0 1   0  0  0 0  0  0 0
    1 12 1 1 1 0 0 600  0 70 2  1  0 2
    1 12 2 0 0 1 0   0 25 70 3  0  1 1
    1 12 3 0 0 0 1   0  0  0 0  0  0 0
    end
    For the calculation of the WTP in space I use the two price variables P_IST and P_MPCI which are the alternative specific prices for the alternative one and two of the DCE. The third alternative is a opt out. My first question is related to the price variable: Is it feasible to generate a single price variable by adding P_IST and P_MPCI? If this is the case, my second question is: Where is the mistake in the code, that leads to the error message: initial values not feasible r(1400)?

    Hopefully, my explanation of the problem is detailed enough! Thank you in advance for your answers!

    Best regards,
    Johannes

  • #2
    Johannes.
    welcome to the list.
    The guru in this field is Arne Risa Hole (https://www.sheffield.ac.uk/economics/people/hole).
    Skimming through his Stata threads and website is my advice.
    Kind regards,
    Carlo
    (Stata 18.0 SE)

    Comment


    • #3
      Did you try with the exemple provided by Arne ? Just to test compatibility with older Stata version ?

      use http://fmwww.bc.edu/repec/bocode/t/traindata.dta, clear
      gen mprice = -price
      gen const = 1
      constraint 1 [Mean]mprice = 1
      constraint 2 [tau]_cons = 0
      matrix start = 1,0,0,0,0,0,0,0
      gmnl y mprice contract local wknown tod seasonal, group(gid) id(pid) het(const) constraint (1 2) from(start, copy) nrep(1)

      I just try it with Stata 12.1 and it provides the same warning message "initial values not feasible"

      Comment


      • #4
        Sorry,

        I re-start all things and it worked.

        Comment


        • #5
          Johannes

          I suggest that you use my more recent mixlogitwtp command instead of gmnl, as that has been developed specifically for estimating models in WTP-space. E.g.

          Code:
          ssc install mixlogitwtp
          mixlogitwtp choice Impl Sub Cov KDP_mittel KDP_hoch asc1 asc2, group(user_cset) id(id) price(price) nrep(10)
          Arne

          Comment


          • #6
            I am running my model with gmnl at the moment. So before coming over to estimating WTP in my model, can I still use gmnl to interpret coefficients? Then I should use the new command mixlogitwtp for WTP estimation.

            Thanks Arne a lot.

            Comment


            • #7
              If you have used the gmnl trick (as Tina described) to estimate your WTP space model, your gmnl coefficients are already WTP space coefficients.

              If you have used gmnl to estimate your preference space model, then the WTP distribution implied by your model is different from what mixlogitwtp assumes, except in a few special cases. You must use the gmnl estimates to derive the WTP distribution, instead of using mixlogitwtp to estimate a totally different model.

              Comment

              Working...
              X