structural models for time series

Discussion of State Space and Dynamic Stochastic General Equilibrium Models

Re: structural models for time series

Postby mcorozcos » Fri Apr 19, 2013 2:59 pm

Hello Tom

I revised the examples about @seasonaldlm, but, I couldn´t run the code because I don´t have the data sets. You known where I can find those data sets for these examples.

Thanks for your help

Best regards
mcorozcos
 
Posts: 26
Joined: Wed Feb 08, 2012 11:04 am

Re: structural models for time series

Postby TomDoan » Fri Apr 19, 2013 3:59 pm

The data are provided with RATS in the directory for the appropriate textbook. For instance, the data for the harveyxxx examples are in the Harvey textbook directory.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: structural models for time series

Postby mcorozcos » Tue Apr 23, 2013 8:16 am

Thanks for your help
mcorozcos
 
Posts: 26
Joined: Wed Feb 08, 2012 11:04 am

Re: structural models for time series

Postby mcorozcos » Fri Apr 26, 2013 2:23 pm

Hello Tom,
I need to simulated two series with the specification for this code:

Code: Select all
@SeasonalDLM(type=fourier,a=as,c=cs,f=fs,SPAN=12)
@LocalDLM(a=al,c=cl,f=fl)
dec symm sigmav(2,2) sigmal(2,2) sigmas(2,2)
dec symm sw
compute a=(al~\as)~\(al~\as)
compute f=(fl~\fs)~\(fl~\fs)
compute c=(cl~~cs)~\(cl~~cs)
dec packed pl(2,2) ps(2,2)
compute sw=%zeros(%rows(a),%rows(a))
function %%DLMSetupSW
local integer i
compute sigmal=%ltouterxx(pl),sigmas=%ltouterxx(ps)
compute sw(1,1)=sigmal(1,1),sw(1,13)=sigmal(1,2),sw(13,13)=sigmal(2,2)
do i=1,11
   compute sw(i+1,i+1)=sigmas(1,1)
   compute sw(i+1,i+13)=sigmas(1,2)
   compute sw(i+13,i+13)=sigmas(2,2)
end do i
end %%DLMSetupSW
compute sigmav=%mscalar(.005),pl=%mscalar(.0003),ps=%mscalar(0.0)
nonlin sigmav pl ps
dlm(start=%%DLMSetupSW(),sw=sw,a=a,c=c,f=f,sv=sigmav,yhat=ysim,type=simulate) 1 500
set y1 = ysim(t)(1)
print / y1 y2
graph 1
# y1


My problem is in “yhat”, because I don´t know which is the instruction for two series. Additionally, I need to simulated with trend that is random walk, and I don´t sure if with @localdlm its possible.

Thanks for your help
mcorozcos
 
Posts: 26
Joined: Wed Feb 08, 2012 11:04 am

Re: structural models for time series

Postby TomDoan » Fri Apr 26, 2013 2:37 pm

Use

set y2 = ysim(t)(2)

What you're creating with localdlm is a "local level" which is a random walk.

@localdlm(type=trend)

generates the state-space representation for a local trend model, where the trend-rate is a random walk.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: structural models for time series

Postby mcorozcos » Sun Apr 28, 2013 1:43 pm

Hello Tom,

Thanks :D
mcorozcos
 
Posts: 26
Joined: Wed Feb 08, 2012 11:04 am

Re: structural models for time series

Postby mcorozcos » Fri May 03, 2013 7:57 pm

Hello Tom,

I am writing because, I need estimate a regression with two variables dependents and two variables independents and calculate the residuals, i.e. I need estimate a multivariate regression. And, I don´t know, which is the instruction for I do it.

Can I use “linreg”? but I think this instruction is only for univariate regresion ¿how do I use it? ¿Do I need another instruction? ¿which is new instruction?

I hope you can help me
Thanks
mcorozcos
 
Posts: 26
Joined: Wed Feb 08, 2012 11:04 am

Re: structural models for time series

Postby TomDoan » Fri May 03, 2013 11:00 pm

mcorozcos wrote:Hello Tom,

I am writing because, I need estimate a regression with two variables dependents and two variables independents and calculate the residuals, i.e. I need estimate a multivariate regression. And, I don´t know, which is the instruction for I do it.

Can I use “linreg”? but I think this instruction is only for univariate regresion ¿how do I use it? ¿Do I need another instruction? ¿which is new instruction?

I hope you can help me
Thanks


Use SUR
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: structural models for time series

Postby mcorozcos » Sat May 04, 2013 7:51 pm

Thanks Tom :lol:
mcorozcos
 
Posts: 26
Joined: Wed Feb 08, 2012 11:04 am

Re: structural models for time series

Postby mcorozcos » Mon May 06, 2013 11:06 am

Hello Tom,

I have a question, I used the instruction “%eigdecomp” in order to calculate the eigenvalues and the eigenvectors for one matrix (because my matrix isn´t symmetric, for this reason I can´t use Eigen), but only I need are the eigenvalues, ¿How do I extract the eigenvalues and eigenvectors separated, using the instruction "%eigdecomp"?

I hope you can help me

Thanks
mcorozcos
 
Posts: 26
Joined: Wed Feb 08, 2012 11:04 am

Re: structural models for time series

Postby TomDoan » Mon May 06, 2013 11:31 am

You can (and in fact have to) use EIGEN for a non-symmetric matrix. You can use the CVALUES option if the eigenvalues might be complex, or just use the eigenvalues (2nd) parameter if they will be real.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: structural models for time series

Postby mcorozcos » Mon May 06, 2013 1:25 pm

But, when I used the instruction "eigen" only I can use with square matrices.

In my case I have an other type of matrix, and When I use this instruction, the program shows error like "## MAT3. Matrix with Dimensions 486 x 488 Involved in EIGEN Operation. Need NxN" for this reason I think that I have to use the other instruction.

Or exist other instruction what can I use for calculate eigenvalues and eigenvectors a matrices no square?
mcorozcos
 
Posts: 26
Joined: Wed Feb 08, 2012 11:04 am

Re: structural models for time series

Postby TomDoan » Mon May 06, 2013 1:35 pm

No, because non-square matrices don't have eigenvalues. They have singular values, which can be computed with %SVDECOMP, but those don't really work the same way as eigenvalues.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: structural models for time series

Postby mcorozcos » Mon May 06, 2013 2:11 pm

Ok thanks
mcorozcos
 
Posts: 26
Joined: Wed Feb 08, 2012 11:04 am

Previous

Return to State Space Models/DSGE

Who is online

Users browsing this forum: No registered users and 1 guest