Announcement

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

  • rolling+average

    Hello.. I have a difficulty in calculating with stata the following formula.

    yt= bo + xt with rolling way t=1~39, 2~40, ..... 129~167

    Here, rolling way means "estimate is applied over a given data sample and the sample is moved up or "rolled" forward one observation. This process continues until all observations are exhausted. "

    Basically, the b0 is yt-xt and the estimated bo is the average of yt-xt t=1~39, 2~40, ..... 129~167.

    there will be total 129 estimated bo.

    and for each 129 estimated bo, there will be 39 residuals. (so total 129 * 39 = 5031)

    If anyone can give me some help with coding this formula, I would really appreciate it.

    Thank you!
    Attached Files

  • #2
    Please help me with any advice.... this is a modification of rolling regression and getting residuals to run the error correction model...

    Comment


    • #3
      You will most likely need to use the rolling command to accomplish this, and to do so requires using tsset to describe the time series nature of your dataset, and to do that will require that you transform your string variable A which has values like "Q2 1973" into a Stata Internal Format quarterly time variable.

      Stata's "date and time" variables are complicated and there is a lot to learn. If you have not already read the very detailed Chapter 24 (Working with dates and times) of the Stata User's Guide PDF, do so now. If you have, it's time for a refresher. After that, the help datetime documentation will usually be enough to point the way. You can't remember everything; even the most experienced users end up referring to the help datetime documentation or back to the manual for details. But at least you will get a good understanding of the basics and the underlying principles. An investment of time that will be amply repaid.

      All Stata manuals are included as PDFs in the Stata installation and are accessible from within Stata - for example, through the PDF Documentation section of Stata's Help menu.
      Code:
      help datetime
      help tsset
      help rolling

      Comment

      Working...
      X