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:
I also want to provide the answers of the first individual (id=1):
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
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)
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
Hopefully, my explanation of the problem is detailed enough! Thank you in advance for your answers!
Best regards,
Johannes
Comment