Grouping vectors
Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator
Grouping vectors
I have a large number of vectors that capture the r2 and tstat of rolling regressions. How do I collect all of those vectors into either a group or a matrix? I tried to create a group and then you MTOS but it doesn't seem to be working for me. Thanks very much.

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11832
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Grouping vectors
Groups can only contain series, not vectors.
You'll have to put them in a matrix.
You can use the colplace command or the @hcat function
You'll have to put them in a matrix.
You can use the colplace command or the @hcat function
Follow us on Twitter @IHSEViews
Re: Grouping vectors
I've not used @hcat before, am I able to loop through the vectors and append them or should I use colplace for that?

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11832
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Grouping vectors
Thanks for the help. As a followup I am trying to store the residual from each step of a rolling regression. I tried the commands below but it is returning only the last 100 observations, which is the length of the rolling regression window. is there a better (i.e. correct) way to do this? Thanks for the help. Stuart
''Vector to store r^2 and tstats
vector(!i) regmulti_r2_{%k}
regmulti_r2_{%k}(!i) = regmulti.@r2
vector(!i) regmulti_ts{%l}_{%k}
regmulti_ts{%l}_{%k}(!i) = regmulti.@tstats({%l})
vector(!i) regmulti_err_{%k}
regmulti.makeresid res1
regmulti_err_{%k} = res1
''Vector to store r^2 and tstats
vector(!i) regmulti_r2_{%k}
regmulti_r2_{%k}(!i) = regmulti.@r2
vector(!i) regmulti_ts{%l}_{%k}
regmulti_ts{%l}_{%k}(!i) = regmulti.@tstats({%l})
vector(!i) regmulti_err_{%k}
regmulti.makeresid res1
regmulti_err_{%k} = res1
Re: Grouping vectors
Is this just as simple as adding (!I) to the final line? If so, I'm an idiot.
vector(!i) regmulti_err_{%k}
regmulti.makeresid res1
regmulti_err_{%k}(!I) = res1(!I)
vector(!i) regmulti_err_{%k}
regmulti.makeresid res1
regmulti_err_{%k}(!I) = res1(!I)

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11832
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Grouping vectors
At each step of the rolling regression I am trying to save the residual from that regression.

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11832
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Grouping vectors
In the context of a rolling regression the series is only going to be as long as the regression window so I think I need to grab the last observation and append those to a series.

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11832
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Grouping vectors
Use the @elem function to grab the single observation, or set the sample to be a single observation and take the max of the residuals.
Follow us on Twitter @IHSEViews
Re: Grouping vectors
Hi there,
i have 2 svector sv1 and sv2, how do i collect both of them into matrix?
i had tried to use @hcat but it doesn't work...
do you have any idea for combining these 2 svec?
Thanks a lot!!!
i have 2 svector sv1 and sv2, how do i collect both of them into matrix?
i had tried to use @hcat but it doesn't work...
do you have any idea for combining these 2 svec?
Thanks a lot!!!
Best,
SK
SK

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11832
 Joined: Tue Sep 16, 2008 5:38 pm
Who is online
Users browsing this forum: No registered users and 6 guests