Announcement

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

  • #31
    This identical question was asked, and in part answered, at

    https://www.statalist.org/forums/for...egression-loop

    Comment


    • #32
      -rangestat- can store your regression coefficients, but it does that in the same data set that contains the data from the regression, whereas you are creating new sets of random data to regress and then storing the resulting coefficients in a different data set that you started with. You could still use -rangestat- to do the regression within each of your random data sets and then copy the coefficients into your starting data set, but that is actually more work than what you are currently doing, and it doesn't make use of any of -rangestat-'s really central features: the -by()- and -interval()- options. So it's a bit like using a sledge hammer to kill flies, but not quite hitting them properly and having to then finish the job with a regular fly-swatter. I don't recommend it.

      Also, -rangestat- does not return RSS or df.

      Finally, you have posted this same code, with a different question, elsewhere. Please see my responses there as this code has some problems you need to fix.

      Comment


      • #33
        Hello!

        I am currently trying to run this command:

        rangestat (reg) var1 var2, by(var3) interval(time -120 5)

        However, I get the following error:
        "no result for all obs: reg var1 var2"

        Does anyone by chance know what may be wrong with the data or my command?

        Comment


        • #34
          We don’t know more about your data than you do and there is no data example here. Please show the results of

          Code:
          summarize time
          
          describe time
          My guess: time is a date-time variable with units milliseconds but you want to work in days.

          Comment


          • #35
            Hello everyone,
            Can we use rangestat to calculate the GARCH(1 1) volatility model using a rolling window of say past 5 years data (in my analysis I am using monthly data) ? I have hereby attached inflation data for panel of countries


            Code:
            * Example generated by -dataex-. To install: ssc install dataex
            clear
            input str12 Code float Year double inflation
            "AUS" 1998  .86009997
            "AUS" 1999  1.4831001
            "AUS" 2000  4.4573998
            "AUS" 2001  4.4071002
            "AUS" 2002     2.9816
            "AUS" 2003     2.7326
            "AUS" 2004  2.3433001
            "AUS" 2005  2.6918001
            "AUS" 2006     3.5553
            "AUS" 2007     2.3276
            "AUS" 2008  4.3502998
            "AUS" 2009     1.7711
            "AUS" 2010  2.9182999
            "AUS" 2011     3.3039
            "AUS" 2012     1.7628
            "AUS" 2013  2.4498999
            "AUS" 2014     2.4879
            "AUS" 2015     1.5084
            "AUS" 2016      1.277
            "AUS" 2017  1.9486001
            "AUT" 1998  .92250001
            "AUT" 1999  .56900001
            "AUT" 2000  2.3448999
            "AUT" 2001  2.6500001
            "AUT" 2002     1.8104
            "AUT" 2003     1.3556
            "AUT" 2004  2.0611999
            "AUT" 2005  2.2990999
            "AUT" 2006  1.4414999
            "AUT" 2007  2.1686001
            "AUT" 2008  3.2160001
            "AUT" 2009  .50629997
            "AUT" 2010     1.8135
            "AUT" 2011  3.2866001
            "AUT" 2012  2.4856999
            "AUT" 2013     2.0002
            "AUT" 2014     1.6058
            "AUT" 2015  .89660001
            "AUT" 2016  .89160001
            "AUT" 2017     2.0813
            "BEL" 1998  .94929999
            "BEL" 1999     1.1208
            "BEL" 2000  2.5445001
            "BEL" 2001     2.4693
            "BEL" 2002     1.6452
            "BEL" 2003      1.589
            "BEL" 2004  2.0973001
            "BEL" 2005     2.7814
            "BEL" 2006     1.7912
            "BEL" 2007     1.8231
            "BEL" 2008  4.4893999
            "BEL" 2009     -.0531
            "BEL" 2010  2.1893001
            "BEL" 2011     3.5321
            "BEL" 2012     2.8397
            "BEL" 2013  1.1131001
            "BEL" 2014        .34
            "BEL" 2015      .5614
            "BEL" 2016     1.9739
            "BEL" 2017  2.1259999
            "CAN" 1998  .99589998
            "CAN" 1999     1.7348
            "CAN" 2000  2.7193999
            "CAN" 2001     2.5251
            "CAN" 2002     2.2584
            "CAN" 2003     2.7586
            "CAN" 2004     1.8573
            "CAN" 2005  2.2135999
            "CAN" 2006  2.0020001
            "CAN" 2007  2.1384001
            "CAN" 2008  2.3703001
            "CAN" 2009  .29949999
            "CAN" 2010  1.7769001
            "CAN" 2011  2.9121001
            "CAN" 2012     1.5157
            "CAN" 2013  .93830001
            "CAN" 2014     1.9066
            "CAN" 2015     1.1252
            "CAN" 2016     1.4288
            "CAN" 2017     1.5969
            "CHE" 1998      .0179
            "CHE" 1999      .8064
            "CHE" 2000  1.5585001
            "CHE" 2001  .98900002
            "CHE" 2002  .64270002
            "CHE" 2003      .6383
            "CHE" 2004  .80290002
            "CHE" 2005  1.1720001
            "CHE" 2006     1.0595
            "CHE" 2007      .7324
            "CHE" 2008  2.4260001
            "CHE" 2009 -.48050001
            "CHE" 2010      .6882
            "CHE" 2011      .2313
            "CHE" 2012 -.69260001
            "CHE" 2013     -.2173
            "CHE" 2014     -.0132
            "CHE" 2015    -1.1439
            "CHE" 2016     -.4346
            "CHE" 2017  .53380001
            end
            Thank You for consideration

            Comment


            • #36
              GARCH in a moving window is a problem beyond rangestat. It may yield to rolling.

              Comment


              • #37
                Disclaimer: I know nothing about GARCH.

                But building on what Nick says, if it can be done with -rolling-, then it almost certainly can also be done with -rangerun-. And -rangerun- is going to be much faster if the data set is large. -rangerun- is another of Robert Picard's great contributions to the Stata community. It is available from SSC.

                Comment


                • #38
                  Hi Clyde Schechter , I will simply things, overall these are conditional models used to describe volatile variance , so it arises when we have heteroskedasticity in our data and if we model the change in heteroskedasticity at time t using the past values of the variance so this is ARCH, however when we further assume that our variance is not only depended on my past variance but also on the square of my past observation then it is a GARCH model (https://www.stata.com/manuals/tsarch.pdf ) . Nick Cox and Clyde Schechter thank you for your replies, I will go through rangerun and rolling documentation.

                  Comment


                  • #39
                    Thank you for the explanation of GARCH.

                    Comment

                    Working...
                    X