Announcement

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

  • How to plot of linear time trend normalized to zero and one at the beginning and end of the sample

    Dear fellow stata users,

    After conducting a cross-sectional regression on the panel data, I collected the coefficients' of each years' regression.
    and not I want to plot a linear time trend, which is normalized to zero and one at the beginning and end of the sample, so that the intercept measures the level in the beginning time period and the slope measures the cumulative change over the full sample period.

    But now I don't know how to normalize the time variable on the trend model.
    I would be appreciate if there's someone can give me someone hints to.
    Thank you inadvance!


    I want to generate the time trend on b5, b3 sFPE3, sFPE5 separately.Here's part of the variables

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input double year float(b5 b3 b1 sFPE1 sFPE3 sFPE5)
    1964  .01210736 .007341923 .0035780396  .003844916 .009996476  .01090701
    1965 .015396264 .008618028 -.003051655  .003801919 .009884687  .01078504
    1966 .006149841 .014598425  .006788644 .0040203054 .010452474 .011404544
    1967    .011944 .009383247    .0106511 .0041352836 .010751409 .011730708
    1968 .014137417 .004013681  .002383717 .0041071908  .01067837 .011651016
    1969  .02031038 .012030845   .00366233  .003894486 .010125353 .011047628
    1970 .013024523   .0208625  .006350213  .004410404   .0114667  .01251115
    1971 .015139028 .011371393  .010445192 .0044373223 .011536685  .01258751
    1972  .01243061  .01062778  .007894311  .004719735 .012270935  .01338864
    1973 .017844478 .016503459 -.008085154  .004959575   .0128945 .014069005
    end

    (sorry for my bad english grammar, coz i'm not a native speaker.)


    Last edited by Noah Liu; 31 Jul 2019, 09:25.

  • #2
    Code:
    summ year
    gen time_trend = (year-r(min))/(r(max)-r(min))

    Comment


    • #3
      Originally posted by Clyde Schechter View Post
      Code:
      summ year
      gen time_trend = (year-r(min))/(r(max)-r(min))
      the code works! thank you very much for your help!

      Comment

      Working...
      X