Hello Allin,
The $fcast value is what I have been looking for. Thank you very much! Now I can finish my
thesis:) Gretl and this mailing list with you on it are absolutely great.
All the best,
Daniel.
______________________________________________________________
Od: gretl-users-request(a)lists.wfu.edu
Komu: <gretl-users(a)lists.wfu.edu>
Datum: 19.03.2012 17:04
Předmět: Gretl-users Digest, Vol 62, Issue 15
Send Gretl-users mailing list submissions to
gretl-users(a)lists.wfu.edu
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.wfu.edu/mailman/listinfo/gretl-users
or, via email, send a message with subject or body 'help' to
gretl-users-request(a)lists.wfu.edu
You can reach the person managing the list at
gretl-users-owner(a)lists.wfu.edu
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Gretl-users digest..."
Today's Topics:
1. Re: Rolling forecasting (Allin Cottrell)
2. Re: Rolling forecasting (Allin Cottrell)
3. picking columns from CSV (Abhijit Gadgil)
----------------------------------------------------------------------
Message: 1
Date: Sun, 18 Mar 2012 20:07:44 -0400 (EDT)
From: Allin Cottrell <cottrell(a)wfu.edu>
Subject: Re: [Gretl-users] Rolling forecasting
To: Gretl list <gretl-users(a)lists.wfu.edu>
Message-ID: <alpine.LFD.2.01.1203181932320.18009@myrtle>
Content-Type: text/plain; charset="iso-8859-2"
On Sat, 17 Mar 2012, Dan B?so? wrote:
> I am finishing my thesis on volatility prediction and I would like
> to compare 1-step-ahead forecasts of various models. I tried to
> use the following code
>
> open D:\Thesis\VECM\all_data.gdt
>
> smpl full
>
> scalar DataLen = $nobs
> scalar WindowLen = 400
> scalar FirstObs = 1
> scalar LastObs = WindowLen
>
> matrix Forecasts = zeros( DataLen, 1)
> matrix StdErrors = zeros( DataLen, 1)
>
> matrix FCDest = zeros(DataLen, 1 )
> matrix ErrDest = zeros(DataLen, 1 )
> scalar FDestVal= 0
> scalar EddDestVal= 0
>
> loop ForecastPeriod = LastObs + 1..DataLen - 1
> smpl FirstObs LastObs
> ols allRR allRR(-1) allRR(-2) allRR(-3) --robust --quiet
> fcast FDestVal
> FCDest[$ForecastPeriod,1] = FDestVal
>
> FirstObs = FirstObs + 1;
> LastObs = LastObs + 1;
> endloop
>
> but when trying to save FDestVal after fcasting I receive an error
> message.
You need to pay attention to the error message, namely
"Matrices not conformable for operation"
In your assignment
FCDest[$ForecastPeriod,1] = FDestVal
you are attempting to assign a series (FDestVal, which gretl is
willing to convert to a vector on demand) to a single element of a
vector (FCDest[$ForecastPeriod,1]) and there's no way that can work.
More generally, you need to figure out your logic: How, exactly, do
you want to make use of the results of the successive forecasts
generated by the "rolling" estimation-and-forecast loop? Each such
forecast comprises a series of values, not just a scalar. So what do
you want to do with these values? Perhaps you need a matrix with a
number of columns equal to the number of iterations in your loop?
On a relatively small point, you need to lose the trailing ";" on
some of the script lines -- that's not admissible gretl syntax.
Here's a sample script that does what one might want to do, on one
interpretation of your objective. That is, it fills out a matrix of
forecasts using one column per estimated model ("hansl" is gretl's
scripting language.)
<hansl>
open denmark.gdt
series allRR = LRM
scalar DataLen = $nobs
scalar WindowLen = 50
scalar FirstObs = 1
scalar LastObs = WindowLen
matrix FCMat = zeros(DataLen, DataLen - LastObs)
scalar j = 1
loop t = LastObs + 1..DataLen - 1
smpl FirstObs LastObs
ols allRR allRR(-1) allRR(-2) allRR(-3) --robust --quiet
smpl --full
fcast FSeries
FCMat[,j] = FSeries
FirstObs = FirstObs + 1
LastObs = LastObs + 1
j++
endloop
# drop missing values and print
FCMat = FCMat[4:,]
print FCMat
</hansl>
Allin Cottrell
------------------------------
Message: 2
Date: Sun, 18 Mar 2012 20:53:15 -0400 (EDT)
From: Allin Cottrell <cottrell(a)wfu.edu>
Subject: Re: [Gretl-users] Rolling forecasting
To: Gretl list <gretl-users(a)lists.wfu.edu>
Message-ID: <alpine.LFD.2.01.1203182047270.22065@myrtle>
Content-Type: text/plain; charset="iso-8859-2"
On Sun, 18 Mar 2012, Allin Cottrell wrote:
> On Sat, 17 Mar 2012, Dan B?so? wrote:
>
>> I am finishing my thesis on volatility prediction and I would like to
>> compare 1-step-ahead forecasts of various models [...]
Here are a couple of other variants of "what you might want" from
the forecasting exercise and how to achieve the given effects.
Variable names mostly using the style of Daniel's original script.
<hansl>
open denmark.gdt
series allRR = LRM
# "rolling" 1-step ahead forecast with the sample range
# _augmented_ by one observation at each iteration
ols allRR allRR(-1) allRR(-2) allRR(-3) --robust --quiet
fcast 1986:3 1987:3 1 rollfcast --rolling
print rollfcast --byobs
# "rolling" 1-step ahead forecast with the sample range
# pushed forward by one observation at each iteration
# (i.e. the last observation is dropped when a new one
# is added)
scalar DataLen = $nobs
scalar FirstObs = 1
scalar LastObs = 50
matrix fcvals = zeros(5,1)
j = 1
loop t = LastObs + 1..DataLen - 1 --quiet
smpl FirstObs LastObs
ols allRR allRR(-1) allRR(-2) allRR(-3) --robust --quiet
fc1 = LastObs + 1
fcast fc1 fc1 --quiet
fcvals[j] = $fcast
FirstObs++
LastObs++
j++
endloop
printf "\n%12.5f\n", fcvals
</hansl>
Allin Cottrell
------------------------------
Message: 3
Date: Mon, 19 Mar 2012 12:48:41 +0530
From: Abhijit Gadgil <gabhijit(a)gmail.com>
Subject: [Gretl-users] picking columns from CSV
To: Gretl list <gretl-users(a)lists.wfu.edu>
Message-ID:
<CAOFWafjyazuZd3Ury-PYKfg9etXon7HWRi4At0Qx7dQHtdyMyw(a)mail.gmail.com>
Content-Type: text/plain; charset=UTF-8
Dear All,
I am trying to use the new gretl API from within a C program. What I
want to do is from a CSV file, pick one or two columns (the file has
50odd columns). I know the column number. Is there a convenient way of
doing it rather than providing a list to the dataset_drop_variables()
which includes everything but the column that I want to pick.
Thanks
-abhijit
------------------------------
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users
End of Gretl-users Digest, Vol 62, Issue 15
*******************************************