Announcement

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

  • Svar impulse resposes

    Hi everyone,
    I'm sorry for a messy post before so i post the new one. Please help me to understand why did impulse responses not work in this case. My best guess is that i go beyond the svar STATA workload. Can i have another solution ? Thank you so much
    Code:
    clear
    set mem 15m
    set matsize 5000
    import excel using "svar1", first
    gen quarter = tq(1980q1) +_n-1
    tsset quarter, quarterly
    replace quarter = quarterly("","YQ") if quarter == quarterly("2018q1","YQ")
    
    matrix A = ( 1,0,0,0,0,0,0,0,0,0,0 \ .,1,0,0,0,0,0,0,0,0,0 \ .,.,1,0,0,0,0,0,0,0,0 \ .,.,.,1,0,0,0,0,0,0,0 \ .,.,.,.,1,0,0,0,0,0,0 \ .,.,.,.,.,1,0,0,0,0,0 \.,.,.,.,.,.,1,0,0,0,0 \ .,.,.,.,.,.,.,1,0,0,0 \ .,.,.,.,.,.,.,.,1,0,0 \ .,.,.,.,.,.,.,.,.,1,0 \ .,.,.,.,.,.,.,.,.,.,1)
    matrix B = (.,0,0,0,0,0,0,0,0,0,0 \ 0,.,0,0,0,0,0,0,0,0,0 \ 0,0,.,0,0,0,0,0,0,0,0 \ 0,0,0,.,0,0,0,0,0,0,0 \ 0,0,0,0,.,0,0,0,0,0,0 \ 0,0,0,0,0,.,0,0,0,0,0 \ 0,0,0,0,0,0,.,0,0,0,0 \ 0,0,0,0,0,0,0,.,0,0,0\ 0,0,0,0,0,0,0,0,.,0,0 \ 0,0,0,0,0,0,0,0,0,.,0 \ 0,0,0,0,0,0,0,0,0,0,.)
    svar pi_us y_us r_us pi_jap y_jap r_jap e_jap pi_kor y_kor r_kor e_kor, lag(1/2) aeq(A) beq(B)
    matlist e(A)
    matlist e(B)
    irf cre order1, step(10) set(myirf1,replace) 
    irf graph sirf, xlabel(0(4)20) irf(order1) yline(0,lcolor(black)) byopts(yrescale)
    Attached Files

  • #2
    Hi Thomas,

    The contents of the file you uploaded are:

    Code:
    clear
    cd D:\thesis
    import excel using "svar1", first
    gen quarter  = q(1980q1) + _n -1
    tsset quarter , quarterly
    varsoc r_us y_us pi_us y_jap pi_jap e_jap r_jap y_kor pi_kor e_kor r_kor, maxlag(5)
    var r_us y_us pi_us y_jap pi_jap e_jap r_jap y_kor pi_kor e_kor r_kor, lag (1/2)
    irf create var1, step(20) set(myirf) replace
    irf graph oirf, impulse(r_us y_us pi_us y_jap pi_jap e_jap r_jap y_kor pi_kor e_kor r_kor) response(r_us y_us pi_us y_jap pi_jap e_jap r_jap y_kor pi_kor e_kor r_kor)
    No one on the forum can access the folder Thesis on your D: drive. Please use dataex (if you don't have it installed on your Stata already, run "findit dataex" and follow window instructions to install it). If you can provide a portion of your data for people to run the code on, help is more likely to come. Note that you can use dataex for portions of your data, such as the code below:

    Code:
    dataex in 1/10 // returns a code to recreate your database for the first 10 observations
    dataex var1 var2 var3 in 1/10 // returns a code to recreate only var1 var2 and var3 for the first 10 observations

    Comment


    • #3
      I'm sorry i upload the wrong file, how can i edit the post ? I upload the data file in this comment svar1.xlsx
      Attached Files
      Last edited by Thomas Lee; 31 May 2018, 15:09.

      Comment


      • #4
        Hi Thomas,

        I opened your database and tried running the commands you gave, my Stata just doesn't respond in the highlighted commands below.

        Code:
        insheet using PATH-IN-MY-COMPUTER
        drop if date=="" // I had to convert your file to csv, and one observation is missing for all variables, I just dropped it
        gen quarter = tq(1980q1) +_n-1
        tsset quarter, quarterly
        replace quarter = quarterly("","YQ") if quarter == quarterly("2018q1","YQ")
        matrix A = ( 1,0,0,0,0,0,0,0,0,0,0 \ .,1,0,0,0,0,0,0,0,0,0 \ .,.,1,0,0,0,0,0,0,0,0 \ .,.,.,1,0,0,0,0,0,0,0 \ .,.,.,.,1,0,0,0,0,0,0 \ .,.,.,.,.,1,0,0,0,0,0 \.,.,.,.,.,.,1,0,0,0,0 \ .,.,.,.,.,.,.,1,0,0,0 \ .,.,.,.,.,.,.,.,1,0,0 \ .,.,.,.,.,.,.,.,.,1,0 \ .,.,.,.,.,.,.,.,.,.,1)
        matrix B = (.,0,0,0,0,0,0,0,0,0,0 \ 0,.,0,0,0,0,0,0,0,0,0 \ 0,0,.,0,0,0,0,0,0,0,0 \ 0,0,0,.,0,0,0,0,0,0,0 \ 0,0,0,0,.,0,0,0,0,0,0 \ 0,0,0,0,0,.,0,0,0,0,0 \ 0,0,0,0,0,0,.,0,0,0,0 \ 0,0,0,0,0,0,0,.,0,0,0\ 0,0,0,0,0,0,0,0,.,0,0 \ 0,0,0,0,0,0,0,0,0,.,0 \ 0,0,0,0,0,0,0,0,0,0,.)
        set matsize 1000
        
        *Tried simplifying your vars to at least make them exportable using the dataex command (which works after you run the code below)
        foreach var in y_us pi_us r_us y_jap pi_jap e_jap r_jap y_uk pi_uk e_uk r_uk y_kor pi_kor e_kor r_kor y_aus pi_aus e_aus r_aus y_bra pi_bra e_bra r_bra y_bel pi_bel e_bel r_bel{
            replace `var'=round(`var',0.01)
        }
        
        svar pi_us y_us r_us pi_jap y_jap r_jap e_jap pi_kor y_kor r_kor e_kor, lag(1/2) aeq(A) beq(B)
        matlist e(A)
        matlist e(B)
        
        *THESE COMMANDS FREEZE MY STATA
        irf cre order1, step(10) set(myirf1,replace)
        irf graph sirf, xlabel(0(4)20) irf(order1) yline(0,lcolor(black)) byopts(yrescale)
        Other than telling that my Stata also froze, I'm afraid I can't help you.

        Comment


        • #5
          Same problem as Igor Paploski. I'm working with Stata 15.1SE
          I used the code:
          Code:
          cd Stata15Data
          import delimited image_11026.csv
          ren date date_
          gen date = quarterly(date_, "YQ")
          tsset date
          set matsize 1000
          matrix A = ( 1,0,0,0,0,0,0,0,0,0,0 \ .,1,0,0,0,0,0,0,0,0,0 \ .,.,1,0,0,0,0,0,0,0,0 \
          .,.,.,1,0,0,0,0,0,0,0 \ .,.,.,.,1,0,0,0,0,0,0 \ .,.,.,.,.,1,0,0,0,0,0 \.,.,.,.,.,.,1,0,0,0,0 \
          .,.,.,.,.,.,.,1,0,0,0 \ .,.,.,.,.,.,.,.,1,0,0 \ .,.,.,.,.,.,.,.,.,1,0 \ .,.,.,.,.,.,.,.,.,.,1)
          matrix B = (.,0,0,0,0,0,0,0,0,0,0 \ 0,.,0,0,0,0,0,0,0,0,0 \ 0,0,.,0,0,0,0,0,0,0,0 \
          0,0,0,.,0,0,0,0,0,0,0 \ 0,0,0,0,.,0,0,0,0,0,0 \ 0,0,0,0,0,.,0,0,0,0,0 \ 0,0,0,0,0,0,.,0,0,0,0 \
          0,0,0,0,0,0,0,.,0,0,0\ 0,0,0,0,0,0,0,0,.,0,0 \ 0,0,0,0,0,0,0,0,0,.,0 \ 0,0,0,0,0,0,0,0,0,0,.)
          svar pi_us y_us r_us pi_jap y_jap r_jap e_jap pi_kor y_kor r_kor e_kor, lag(1/2) aeq(A) beq(B)
          matlist e(A)
          matlist e(B)
          irf set myirf1, replace
          irf cre order1
          It blocks at the last line. I don't know how much memory my virtual machine (operating under Windows7) has access to.

          Comment


          • #6
            So has you had any suggestion to run the impulse response in this case

            Comment


            • #7
              All I can suggest is to drastically reduce the number of variables in the (s)var, see if it works, if it does add variables slowly till it blocks;
              If the first few svars work, then to advance you will have to decide which are the most important variables until one get to the root cause of the problem

              Comment


              • #8
                If I eliminate Japan or Korea it works.

                Comment


                • #9
                  well i want to examine the spill over effect so if i exclude variable, it's nothing to me

                  Comment


                  • #10
                    I realise that. My point was simply that somewhere in Stata is a size constraint. Either that or it takes a very long time to calculate the impulse responses with so many variables. You should probably start another thread with a title indicating the size problem.

                    Comment

                    Working...
                    X