Announcement

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

  • Create new variable using coefficient from a variable containing time dummy

    Hello everyone, I'm using Stata version 14.0. I'm actually trying to estimate the natural rate of unemployment in different countries and different time periods (21 countries during 21 years).
    My database looks like this
    cid (country id) time d_u (change in unemployment) d_inf (change in inflation) control variables
    1 2000q1 0.038 0.08273 ...
    1 2000q2 ... ... ...
    1 ...
    1 2020q4
    ... ... ... ... ...
    21 2000q1 ... ... ...
    ... ... ... ... ...
    21 2020q4 ... ... ...
    The natural rate of unemployment being the point where unemployment doesn't cause inflation. So : dY = a + b*dX and set dY as 0, dX=-a/b
    So what I would do is
    code :
    reg d_inf d_u i.cid i.cid##d_u i.time

    I am not sure it is the right way to do it ...
    Furthermore I would like to "extract" the coefficient to estimate the natural rate of unemployment
    I would do it like that : gen b1=_b[_cid##d_u]
    It gives me : invalid matrix stripe;
    cid##d_u
    r(198) ;
    Is there another way to do it ?


    To sum up : a) Is there a regression that would give me coefficient for each country on each time period for the effect of a change in unemployment on the change in inflation ?
    b) How can I "get out" the coefficient results of the regression ?

    Please do not hesitate to tell me if I need to give more details

    Thank you
    Sander De Rudder
    Last edited by Sander De Rudder; 23 Dec 2022, 16:10.

  • #2
    Before we even worry about extracting the coefficients, we need to be sure the regression itself is right. I don't think it is. Stata has default interpretations when a variable is specified in a regression variable list without a c. or i. prefix. When the variable appears alone, it is, by default, continuous. When it appears in an interaction term, it is, by default, discrete. Your command has the variable d_u appearing both alone and in an interaction, both times without a prefix. So you have given Stata conflicting instructions. I believe in this circumstance, it will treat the variable as discrete. Given what this variable represents, that seems a highly questionable specification. Intuitively, it should be a continuous variable, and unless you have a clear and compelling reason why it should be treated as discrete, you should fix this. I believe that will change your regression to
    Code:
    regress d_inf i.cid##c.d_u i.time
    Once you do, you need to know exactly how Stata names the regression coefficients, and which ones you are interested in. You wrote -gen b1 = _b[_cid##d_u]- Apart from the fact that this does not conform to Stata syntax, it suggests that you are expecting a single result. But you have 21 different countries, so you will have 20 different coefficients for the interaction with d_u. Is there one in particular you want to extract? Or do you really want to do something with all 20 coefficients? If the latter, what exactly do you plan to do with them--it usually does not make sense to store constants in variables. So knowing where you are going would give a basis for figuring out what is the best way to extract the coefficients.

    Comment


    • #3
      Hi, thank you for the quick answer !

      What I would like to do is to capture the effect of a change in unemployment (u) on the inflation (inf) for the 21 countries during the 20 years(80 quarters), to store those 21*80 coefficients and divide them by the intercept (_cons).
      My regression being : d_Inf=a+b*d_u if I want to find the point where a change in unemployment cause d_inf to be 0,
      0=a+b*d_u <=> d_u=-a/b
      If I can compute that for each country each time period, I will get the natural rate of unemployment for each country each period.

      That is ultimately where I want to go. But I'm afraid my interpretation of the coefficient of variables containing a country dummy is wrong... I guess by using cid##d_u, the coefficient explains the effect of being in one country relatively to the cid1 being the reference. It is not the effect of a change in unemployment on inflation in country 1,2,3,4,... (What I would like to find).

      I thought about a command that would do something like :
      regress d_inf d_u if cid==1 and time==2000q1
      regress d_inf d_u if cid==1 and time==2000q2
      .....
      for each country each time period

      I could do it one by one but it would take me an infinite amount of time, is there another way?

      Thank you

      Comment


      • #4
        I thought about a command that would do something like :
        regress d_inf d_u if cid==1 and time==2000q1
        regress d_inf d_u if cid==1 and time==2000q2
        This doesn't make sense to me. It looks, in #1, like you have just a single observation for each country in each quarter. You can't do a regression on a single observation! You could do regressions separately for each country over the entire range of time, giving you a single coefficient for the country. Or perhaps you could do it separately for each country and each year, although those regressions would be based on only four quarterly data points, and so pretty noisy.

        Comment

        Working...
        X