Announcement

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

  • Variable not found in nlcom

    Dear Everyone,

    I'm new here and I would like to measure willingness to pay by using double bounded method analysis. I have found the constant and coefficients for each independent variables but I've got a message of 'not found' for my variable, is it because of the mistake in my command:

    nlcom (wtp_b[_cons]+Emplo_m*b[Emplo]+Income_m*b[Income]+TriedtoQuit_m*b[TriedtoQuit]+Heal_Res_m*b[Heal_Res]+PeerInfluence_m*b[PeerInfluence]+Toquit_m*b[Toquit]+Notice_m*b[Notice])), noheader

    I have seven independent variables and this is what I received:
    Emplo_m not found
    r(111);

    Thanks for your kind assistance.


  • #2
    I do not know what you are doing there, but the error probably comes because you simply do not have an Emplo_m variable, but rather Emplo variable. I can only guess because you re not showing neither your data, nor your actual estimation command.

    Also you have an error in how you call the estimated paremetars, e.g., you call b[Emplo], but this is wrong, it has to be _b[Emplo], and similarly for all other parameters up to b[Notice] which should be _b[Notice],

    Comment


    • #3
      In addition to what Joro said, based only on the command you presented, it looks like you may be better off using predict or margins. lincom and nlcom calculate linear and non-linear combos of the betas. I'm not sure they work on variables, actually.
      Be aware that it can be very hard to answer a question without sample data. You can use the dataex command for this. Type help dataex at the command line.

      When presenting code or results, please use the code delimiters format them. Use the # button on the formatting toolbar, between the " (double quote) and <> buttons.

      Comment


      • #4
        Weiwen Ng is right about something that did not come to me but it is so obvious that it should have stuck me immediately... What kind of a possible result can you expect when you re mixing -nlcom- with variables? -nlcom- is supposed to produce a scalar, if you mix it with a variable (=vector) what do you expect to get?

        Code:
        . sysuse auto, clear
        (1978 Automobile Data)
        
        . nlcom mpg*_b[mpg]
        
        expression (mpg*_b[mpg]) contains reference to X rather than _b[X]
        r(198);
        
        . reg price mpg, noheader
        ------------------------------------------------------------------------------
               price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
        -------------+----------------------------------------------------------------
                 mpg |  -238.8943   53.07669    -4.50   0.000    -344.7008   -133.0879
               _cons |   11253.06   1170.813     9.61   0.000     8919.088    13587.03
        ------------------------------------------------------------------------------
        
        . nlcom mpg*_b[mpg]
        
        expression (mpg*_b[mpg]) contains reference to X rather than _b[X]
        r(198);
        
        .

        Comment

        Working...
        X