sample size

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

Katjes
Posts: 55
Joined: Thu Oct 02, 2008 5:46 am

sample size

Postby Katjes » Mon May 18, 2009 3:20 pm

I want to pick the number of observation in the sample, that is shown in the second line in each workfile (not the number of observation of a series -because -this varies)
the code looks like this:

sample crisis 2008 @last ' definition of my specific sample
smpl crisis ' select this sample
scalar time= @dateval("1/1/2008")-@dateval("5/15/2009") ' calculate the number of observation between the first and the last date

However, I don't want to type for each specific sample the start and end date, is there a nice solution?
I tried
scalar time= @dateval(@last)-@dateval(@first)
but it doesn't work!
By the way, the code above gives me 730088 but I want 358.

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

Re: sample size

Postby EViews Gareth » Mon May 18, 2009 3:31 pm

@obsrange - returns number of observations in workfile range.
@obssmpl - returns number of observations in current sample.
Follow us on Twitter @IHSEViews

Peter the Pan
Posts: 3
Joined: Sun Jul 07, 2013 8:54 am

Re: sample size

Postby Peter the Pan » Thu Jan 23, 2014 8:13 am

I'd like to change my sample size for one transformation, however, if I use for example:

smpl @first+1 1998:1
mtos(matrix, group)
smpl @all

I need to do this because 'matrix' is smaller then my complete sample. All values beyond 1988:1 are gone from the matrix afterwards. Is there a way to change the sample size without loosing data?

edit: correction: Eviews does not delete the data, it somehow squishes it together... In any case, my code doesn't work ;-)

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

Re: sample size

Postby EViews Gareth » Thu Jan 23, 2014 8:51 am

I don't follow the issue.
Follow us on Twitter @IHSEViews

Peter the Pan
Posts: 3
Joined: Sun Jul 07, 2013 8:54 am

Re: sample size

Postby Peter the Pan » Thu Jan 23, 2014 9:10 am

sorry for the bad explanation. I'll try again:

my sample ranges from 1991q1 till 2013q4

I ran some rolling OLS etc the results of which are collected into a matrix with 28 rows. I want to display this matrix as time series, so the x-axis shows the start years of the rolling windows (otherwise its annoying to interpret). Thats why I want to create groups out of the matrices. However, Eviews doesn't do that if the matrices are smaller than the sample size.

So I tried the code above. It runs through but does strange things to my data.

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

Re: sample size

Postby EViews Gareth » Thu Jan 23, 2014 9:42 am

Sorry, still not following.

You have a matrix with 28 rows. You have set the sample to be 1991Q2 to 1998Q1. That's 28 observations. You then convert the matrix into a group. EViews will put those 28 rows into the 28 observations you have in the sample. Nothing will be squashed. Nothing will be lost.
Follow us on Twitter @IHSEViews

Peter the Pan
Posts: 3
Joined: Sun Jul 07, 2013 8:54 am

Re: sample size

Postby Peter the Pan » Mon Jan 27, 2014 1:59 am

You are right. Everything looks good now. I don't know what the problem was... Feel free to delete the posts above if you want to keep this clean.
Thank you so much for your quick responses and sorry for wasting your time!


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 55 guests