Announcement

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

  • probleme to perform rolling granger causality test

    Dears,

    i am a new one on this forum and on stata, thank you for your help
    my question is :
    I want to run a rolling rolling granger causality test according to the following program:

    Part1:

    * program to do rolling granger causality test
    . capt prog drop rgranger
    . prog rgranger, rclass
    syntax varlist(min=2 numeric ts) [if] [in] [, Lags(integer 2)]
    var `varlist´ `if´ `in´, lags(1/`lags´)
    vargranger
    matrix stats = r(gstats)
    return scalar s2c = stats[3,3]
    return scalar s2i = stats[6,3]
    return scalar s2y = stats[9,3]
    end


    Part2:

    *rolling window regressions
    rolling pc = r(s2c) pi = r(s2i) py = r(s2y), window(35) saving(wald,replace) : rgranger lconsumption linvestment lincome, lags(4)


    Despite the fact that I save part 1 in an .ado file and put it in "PLUS: c: \ ado \ plus ", when I run rolling as shown in part 2, I get the message : invalid name.

    Please is there someone who can help me overcome this problem.
    thank you in advance

  • #2
    Type

    Code:
    set trace on
    repeat what you are doing, then look up to the error message in red, and copy and paste here some couple of lines before and after the error message.

    Comment


    • #3
      Dear,
      Thank you for your support:
      this is the return the message:



      Dheadernew, `nocnsreport'
      eret display, level(`level') `options'
      exit
      }
      - local cmdline : copy local 0
      - syntax varlist(ts) [if][in] , [LAgs(numlist min=1 sort integer >=1) EXog(varlist ts) CONSTraints(numlist sort) noConstant DFK LUTstats noBIGf Level(cilevel) SMall noISure ITerate(numlis
      > t max =1 integer >0 ) TOLerance(numlist max =1 >0 <1 ) NOCNSReport NOLOg LOg noDISPlay ZLags noMODEL *]
      ` invalid name
      ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- end var ---
      ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- end rgranger ---
      - restore
      - `traceoff'
      =
      - local rc = c(rc)
      - if `rc' {
      = if 198 {
      - _prefix_run_error `rc' rolling `cmdname'
      = _prefix_run_error 198 rolling rgranger
      ----------------------------------------------------------------------------------------------------------------------------------------------------------------- begin _prefix_run_error ---
      - version 9
      - args rc caller cmdname
      - di as err `"an error occurred when {bf:`caller'} executed {bf:`cmdname'}"'
      = di as err `"an error occurred when {bf:rolling} executed {bf:rgranger}"'
      an error occurred when rolling executed rgranger
      - exit `rc'
      = exit 198
      ------------------------------------------------------------------------------------------------------------------------------------------------------------------- end _prefix_run_error ---
      }
      ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- end rolling.Rolling ---
      - _prefix_clear, e r




      all the best

      Comment


      • #4
        It is my belief that you copied-and-pasted your code either from a source with the wrong sort of quotation marks. Your command was
        Code:
        var `varlist´ `if´ `in´, lags(1/`lags´)
        To have Stata substitute the value of a local macro
        Code:
         shortcut
        you need to type on your keyboard
        Code:
         `shortcut'
        where the first character is (on an American English keyboard) the "left single quote" beneath the tilde (~) character below the ESC key, and the final character is the usual "single quote" ("apostrophe") just to the left of the RETURN key. Neither of these are "smart quotes" as understood in programs like Microsoft Word, and in particular the first character is correctly titled the "grave accent". Your code has smart single quotes.

        Note that the Stata PDF documentation unfortunately displays local macro references incorrectly using smart single quotes as
        Code:
         ‘shortcut’ 
        which leads to no end of confusion, especially because such code will not work if copied and pasted into Stata. On the other hand, it does look elegant in the printed documentation.

        Comment


        • #5
          thank you dear william for your support
          it works now

          Comment


          • #6
            Hi William Lisowski ,


            Do you know how to apply "as reg" for a rollling window granger causality or a time varying granger causality on Stata ? I have searched for a long time on forums and found nothing except an add in named roll a added in Eviews.

            Thanks in advance.

            Pita

            Comment

            Working...
            X