Announcement

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

  • indicator function

    Hey guys
    I have the following data: n people who purchased a car in the period of 2002-2010, characteristics of the old and the newly purchased cars for each customer and customer demographic variables. What I am trying to model now is the following: DV is upgrade as a continuous variable specified as the difference between the price of the new car minus the price paid for the old car and IVs are variables mentioned above. In particular I am interested whether there is a difference in coefficients for the IVs for the loyal vs. switching customers. Is there a way to estimate the model simultaneously, that is for both loyal and switching customers, without using the -if- or building interaction effects such as income##loyalty? In this case I sometimes read about the indicator function I(1,0) which should be multiplied with the complete model, but I dont know what is meant by it. Any help would be greatly appreciated.
    thanks

  • #2
    The indicator function is just your variable loyalty (which I assume to have the value 0 when someone switched and the value 1 when someone is loyal) and the multiplication are just the interaction terms. If you have many other variables in your model you can create them more easily by doing something like: i.loyalty##(i.var1 c.var2 c.var3) where I assume that var1 is categorical and var2 and var3 are continuous. You can find more about that in help fvvarlist. If you want to look at the coefficients as they would appear in your models with the if condition you can look at the tricks discussed in:

    M.L. Buis (2012) "Stata tip 106: With or without reference", The Stata Journal, 12(1), pp. 162-164.
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Hey Maarten, thanks, I will check it out.

      Comment


      • #4
        Marteen,

        I just read through your Stata tip, and I want to understand the use of glm with the log link function and eform. From what I understood, this would be equivalent to running a regression with natural log of price as the response variable, but reporting the coefficients in exponentiated form so that statements are made on the effect on price, and not the natural log of price. To check if my understanding is correct I log transform price and run
        Code:
        reg lnprice i.foreign c_weight, eform(exp)
        where lnprice = ln(price). However, the estimates differ significantly, more than you would expect from glm being a ML estimator and regress just being OLS, so I'm thinking there are other differences. I'd appreciate any further light into this.

        Thanks,
        Alfonso Sanchez-Penalver

        Comment


        • #5
          The difference is that the regress model with a logarithmitically transformed dependent variable models E(log(y)), while the glm model models log(E(y)). Since log() is a non-linear transformation, the two are different. You can read more here www.blog.stata.com/2011/08/22/use-poisson-rather-than-regress-tell-a-friend/. There are also additional references in the comments.
          ---------------------------------
          Maarten L. Buis
          University of Konstanz
          Department of history and sociology
          box 40
          78457 Konstanz
          Germany
          http://www.maartenbuis.nl
          ---------------------------------

          Comment


          • #6
            Hi,

            I did know about using the poisson rather than the log-linear specification, and about the transformation when using log-linear estimations. I haven't used glm much, only to estimate fractional response logit models, and I am not really aware of how they work. So basically it estimates the expected value of the link function of the linear specification, using maximum likelihood I pressume.

            Thanks again for pointing it out,
            Alfonso Sanchez-Penalver

            Comment


            • #7
              Models like poisson, logit, and probit are all special cases of glm. A lot of the older literature focusses on special algorithms that maximize the likelihood function (iterated, reweighted least-squares), and the possibility to get more robust results using pseudo-likelhood. This makes it easy to overlook that in its basic form glm is just a general class of models that are estimated with maximum likelihood of which models like poisson, logit, and probit are special cases. A good overview can be found in:

              James W. Hardin and Joseph M. Hilbe (2012) Generalized Linear Models and Extensions, Third Edition. College Station, TX: Stata Press.
              ---------------------------------
              Maarten L. Buis
              University of Konstanz
              Department of history and sociology
              box 40
              78457 Konstanz
              Germany
              http://www.maartenbuis.nl
              ---------------------------------

              Comment


              • #8
                back to the problem stated above:

                now I have done some research and adjustments to my model and what I am doing now is a Heckman model . My DV now is the price difference between the price paid for the last car and the price paid for the new car. The model is calculated twice (for loyal and disloyal customers), here is the syntax I am using for the “swtichers”

                Code:
                heckman price_difference a b, select (switch =  a b)
                However, now I have another question. There is also the possibility that people decide first whether to switch or to stick with the previous brand, then the model specified above would be appropriate. However, what if one thinks of the price he is willing to pay and then chooses the brand? I looked into mixture models, but unfortunately, I cannot use this approach with -heckman-. Does anyone have an idea how I can deal with the issue? thanks in advance

                Comment

                Working...
                X