Grouping vectors

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Jason, EViews Steve, EViews Moderator

skaiser
Posts: 6
Joined: Tue Jul 19, 2016 12:32 pm

Grouping vectors

Postby skaiser » Tue Jul 19, 2016 12:36 pm

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.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11873
Joined: Tue Sep 16, 2008 5:38 pm

Re: Grouping vectors

Postby EViews Gareth » Tue Jul 19, 2016 12:46 pm

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
Follow us on Twitter @IHSEViews

skaiser
Posts: 6
Joined: Tue Jul 19, 2016 12:32 pm

Re: Grouping vectors

Postby skaiser » Tue Jul 19, 2016 1:00 pm

I've not used @hcat before, am I able to loop through the vectors and append them or should I use colplace for that?

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11873
Joined: Tue Sep 16, 2008 5:38 pm

Re: Grouping vectors

Postby EViews Gareth » Tue Jul 19, 2016 1:13 pm

Either.
Follow us on Twitter @IHSEViews

skaiser
Posts: 6
Joined: Tue Jul 19, 2016 12:32 pm

Re: Grouping vectors

Postby skaiser » Wed Aug 10, 2016 6:22 am

Thanks for the help. As a follow-up 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 t-stats
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

skaiser
Posts: 6
Joined: Tue Jul 19, 2016 12:32 pm

Re: Grouping vectors

Postby skaiser » Wed Aug 10, 2016 6:29 am

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)

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11873
Joined: Tue Sep 16, 2008 5:38 pm

Re: Grouping vectors

Postby EViews Gareth » Wed Aug 10, 2016 8:49 am

What are you trying to save?
Follow us on Twitter @IHSEViews

skaiser
Posts: 6
Joined: Tue Jul 19, 2016 12:32 pm

Re: Grouping vectors

Postby skaiser » Wed Aug 10, 2016 10:25 am

At each step of the rolling regression I am trying to save the residual from that regression.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11873
Joined: Tue Sep 16, 2008 5:38 pm

Re: Grouping vectors

Postby EViews Gareth » Wed Aug 10, 2016 10:57 am

"residual" is not a scalar. It is a series.
Follow us on Twitter @IHSEViews

skaiser
Posts: 6
Joined: Tue Jul 19, 2016 12:32 pm

Re: Grouping vectors

Postby skaiser » Wed Aug 10, 2016 11:28 am

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.

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11873
Joined: Tue Sep 16, 2008 5:38 pm

Re: Grouping vectors

Postby EViews Gareth » Wed Aug 10, 2016 11:50 am

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

shineK
Posts: 24
Joined: Sat Jun 09, 2018 12:23 am
Location: New Taipei City,Taiwan
Contact:

Re: Grouping vectors

Postby shineK » Mon Jun 18, 2018 5:22 am

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!!!
Best,
SK :D

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11873
Joined: Tue Sep 16, 2008 5:38 pm

Re: Grouping vectors

Postby EViews Gareth » Mon Jun 18, 2018 7:11 am

svectors cannot be put into a matrix.
Follow us on Twitter @IHSEViews


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 7 guests