Announcement

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

  • a problem when I use doubleb command to estimate willingness to pay

    Hi all,

    I am working on the double-bounded dichotomous-choice contingent valuation method. I tied to use STATA to get the WTP by doubleb command but I met some problems, can someone help me? I use STATA because I got stuck on R and I saw someone who had the same problem in R said she made it through on STATA instead.

    My code is like this:

    ```
    doubleb bid1a ffb yorn1 ffy gtr geoegb inhosp expen watp age gend mincome ideolody intnew

    ```
    where
    bid1a ffb are the first and the second bid I gave to participants separately;
    yorn1 ffy are the answer (0/1) to the first and second bid separately;
    others variables are others contributes variables.

    After I run this, it told me:
    Click image for larger version

Name:	85258030_2936512506411074_732805060890722304_n.png
Views:	1
Size:	70.0 KB
ID:	1538637



    I check my data there is some error like this, I fixed it and checked multiple times there's no problem in my data like this any more.

    I run it again and again, it gave me the same error. Does anyone know what happened here and what's the other reason to cause this problem?

    ​​​​​​​Many thanks.
    Last edited by Yixin Wang; 26 Feb 2020, 16:57.

  • #2
    -doubleb- is from ssc written Alejandro Lopez-Feldman.

    This is the code it uses to check for inconsistency. Run it manually to find where the variable "check" is equal to 1.

    Code:
        marksample touse
        tempvar check
        qui gen `check' = 1 if `touse'
        qui replace `check' = 0 if `lhs3'==0  & `lhs2'<`lhs1' & `touse'
        qui replace `check' = 0 if `lhs3'==1  & `lhs2'>`lhs1' & `touse'
        qui sum `check', meanonly
    
    if r(mean)>0 {
            di as err "There is an inconsistency in at least one of your observations."  
            di as err "Check for situations where the response to the first question is yes but the second bid is lower than the first"  
            di as err "or for situations where the response to the first question is no but the second bid is higher than the first."  
            di as err "After solving this issue try the command again." 
            exit 498
        }


    Comment


    • #3
      Thank you for this important code. Can you tell me how to do to check the variable "check"? I run the code in STATA there exists some invalid name.

      Comment


      • #4
        I believe it would be like this:
        Code:
        gen check = 1
        replace check  = 0 if yorn1 == 0 & ffb < bidla
        replace check  = 0 if yorn1 == 1 & ffb > bidla
        list if check == 1

        Comment


        • #5
          Thank you for your help. I think there's something else wrong here, but definitely not your code.

          Firstly, I used this method to check, but when I run, it returned check=1 in all the rows, but apparently it was very wrong. But I could not fix this problem and I don't know the reason.

          Then I check a baby example, taking the first 20 rows out as a small data set, it worked!!! But when I tried to do the small example by adding "in 1/21", it showed the same inconsistency information as in the picture.

          I am confused, I am tired, I want to give up. I don't know what is going on there.

          Comment


          • #6
            I solved this problem. The reason causing this problem and all the problems following when I tried to fix the first problem is NA values. I thought STATA would ignore or deal with the NA value directly but I was wrong. I got rid of NA values just now, and everything worked.

            I have another question, can anyone tell me what the method "doubleb" uses to calculate the standard error or confident interval of WTP.

            Comment

            Working...
            X