time varying autoregressive process with stochastic volatili

Questions and discussions on Time Series Analysis
Deepika
Posts: 43
Joined: Fri Apr 17, 2015 12:55 am

time varying autoregressive process with stochastic volatili

Unread post by Deepika »

hi
i am trying to find codes for running Time varying auto regressive process with stochastic volatility on the lines of Nakajima, J. (2011). "Time-varying parameter VAR model with stochastic volatility: An overview of methodology and empirical applications" Monetary and Economic Studies, 29, 107-142. please help me to find codes for the programme. i am using RATS 8.0.

regards
Deepika
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: time varying autoregressive process with stochastic vola

Unread post by TomDoan »

Deepika
Posts: 43
Joined: Fri Apr 17, 2015 12:55 am

Re: time varying autoregressive process with stochastic vola

Unread post by Deepika »

Hi Tom
thank you for a prompt reply. i am looking to run a simple AR(1) process with time varying parameters and stochastic volatility. will the codes not be different in this case.

thanks
deepika
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: time varying autoregressive process with stochastic vola

Unread post by TomDoan »

I believe it's the same, just with one variable.
Deepika
Posts: 43
Joined: Fri Apr 17, 2015 12:55 am

Re: time varying autoregressive process with stochastic vola

Unread post by Deepika »

Hi Tom

while running the codes for TVPVARKSC i am getting an error. The loop being run is
************ now normalize the responses for this period to make the average shock sizes the same across time (= full sample OLS size)
** compute scaling factors from median shock sizes, Cholesky
do i = 1,nvar
set statser 1 ndraws = responses(count,t)((i-1)*nvar+i,1)
stats(fractiles,noprint) statser 1 ndraws
comp scalefact(i) = shocksize(i)/%median
end do i
** now do the rescaling
do draws = 1,ndraws
do k = 1,nstep
do i = 1,nvar
do j = 1,nvar
comp responses(count,draws)((i-1)*nvar+j,k) = responses(count,draws)((i-1)*nvar+j,k)*scalefact(i)
end do j
end do i
end do k
end do draws

end do count
and the error which i get is:
## EQ4. Equation %MODELEQN(VARMOD Has At Least One Undefined or NA Coefficient
The Error Occurred At Location 615, Line 27 of loop/block
41296728 Position 12686


can you please help

regards
deepika
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: time varying autoregressive process with stochastic vola

Unread post by TomDoan »

What you posted has no reference at all to %MODELEQN or VARMOD, so the problem is elsewhere. Don't post a part of the source file---post the call to the procedure that you're making.
Deepika
Posts: 43
Joined: Fri Apr 17, 2015 12:55 am

Re: time varying autoregressive process with stochastic vola

Unread post by Deepika »

Hi

Sorry my error. Attaching the correct data and program file for your reference.

Regards
Deepika
Attachments
data_1.csv
data used in program
(9.22 KiB) Downloaded 1186 times
repPrimiceriDee.prg
Program File
(21.16 KiB) Downloaded 1206 times
VARTVPKSC.correctedJan2014.src
source file
(31.51 KiB) Downloaded 1197 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: time varying autoregressive process with stochastic vola

Unread post by TomDoan »

This is specific to the original example and isn't correct for your case (the first two are before your data even starts). These list the entries for which you want to compute IRF's.

comp [vec[int]] impdates = ||1975:1,1981:3,1996:1||
Deepika
Posts: 43
Joined: Fri Apr 17, 2015 12:55 am

Re: time varying autoregressive process with stochastic vola

Unread post by Deepika »

Hi Tom

even if i use a 3 variable model but with a different data set i get the following error:
## DLM2. No Observations Produce Valid Output. Check Data and Initial Values
The Error Occurred At Location 6682, Line 434 of VARTVPKSC
C:\UsersData\Deepika-2015-Jul\RatsPrograms\VARTVPKSC.correctedJan2014.src Line 517
attached are the files for reference


thanks
Deepika
Attachments
VARTVPKSC.correctedJan2014.src
(31.51 KiB) Downloaded 1247 times
repPrimiceriDee-wim.prg
(21.19 KiB) Downloaded 1239 times
data_2.csv
data used in the program
(76.61 KiB) Downloaded 1184 times
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: time varying autoregressive process with stochastic vola

Unread post by TomDoan »

What you posted doesn't work at all because you don't read all three variables. When I fix that it works fine. However, it uses a LOT of memory, and so might not work on RATS Standard.
Deepika
Posts: 43
Joined: Fri Apr 17, 2015 12:55 am

Re: time varying autoregressive process with stochastic vola

Unread post by Deepika »

so does it imply i cannot run the three variable model on the standard version of RATS 9

Deepika
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: time varying autoregressive process with stochastic vola

Unread post by TomDoan »

You may have to cut down on the number of draws.
Deepika
Posts: 43
Joined: Fri Apr 17, 2015 12:55 am

Re: time varying autoregressive process with stochastic vola

Unread post by Deepika »

Hi Tom

Thanks for that suggestion. but by how much should the number of draws be reduced so that the effciency of estimates is not affected??
Also do you think that updating to RATS Pro9 would help?? If yes then would that also make a larger model to be able to run possible, say a 4 or 5 varaible model.

Regards
Deepika
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: time varying autoregressive process with stochastic vola

Unread post by TomDoan »

Deepika wrote:Hi Tom

Thanks for that suggestion. but by how much should the number of draws be reduced so that the effciency of estimates is not affected??
4000 should be fine and would take roughly half the space.
Deepika wrote: Also do you think that updating to RATS Pro9 would help?? If yes then would that also make a larger model to be able to run possible, say a 4 or 5 varaible model.
Yes and yes. It's faster and has effectively unlimited capacity.
Deepika
Posts: 43
Joined: Fri Apr 17, 2015 12:55 am

Re: time varying autoregressive process with stochastic vola

Unread post by Deepika »

Respected Sir

i used Nakajima, J. (2011). "Time-varying parameter VAR model with stochastic volatility: An overview of methodology and empirical applications" Monetary and Economic Studies, 29, 107-142 to study inflation persistence in India. using the codes in RATS i am unable to produce graphs which shows time-varying IRF of inflation to unit shocks in inflation, output and interest rate, at one period, two period and three period ahead. they have used MATLAB codes. how can this be done in RATS. i am using RATS pro 9.

Regards
Deepika
Post Reply