Estimating standard deviation of residuals by using Loop

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator

muenzmax
Posts: 1
Joined: Tue Sep 05, 2017 10:15 am

Estimating standard deviation of residuals by using Loop

Postby muenzmax » Tue Sep 05, 2017 10:47 am

Hi there,
I'm new of programming and this is the first time to write a Eviews code.
I was trying to get the standard deviation of residuals to estimate the idiosyncratic risk of my portfolios. I used daily returns (y1 to y11) as my dependent variables, X1 X2 represents indexes returns and X3 represents currency returns. I have a daily data from 02/02/2009 to 11/03/2016, but I was trying to get the quarterly standard deviation of residuals to run the cross-sectional regression. I was managed to run this daily data 1865 times to get residuals, however, my data was not sorted by quarters and not following logic order, that is , sample periods between 1 to 42 represent 2009Q1, 43 to 107 represent 2009Q2 and so on. So I have to manually set up my testing periods.( this may sounds stupid)
Now I'm trying find alternative ways to write this codes to make it looks better and don't have to manually change the series name. Please see the attachment for my codes.

Any help would be highly appreciated!
Attachments
loop.prg
(2.11 KiB) Downloaded 6 times

EViews Matt
EViews Developer
Posts: 144
Joined: Thu Apr 25, 2013 7:48 pm

Re: Estimating standard deviation of residuals by using Loop

Postby EViews Matt » Wed Sep 06, 2017 10:02 am

Hello,

First, you're needlessly performing the exact same regression 1856 times, it doesn't need to be inside a loop. The regression will automatically cover all the observations (or the current sample). Second, you can calculate the quarterly standard deviations much more compactly via @stdevsby, e.g.: @stdevsby(e11, @quarter, @year).


Return to “Programming”

Who is online

Users browsing this forum: Google [Bot] and 3 guests