Examples of Gretl scripts
by Carlos Andrade

Dear All,
Where to get examples of Gretl scripts for different types of analysis?
--
Atenciosamente,
Prof. Carlos A. S. de Andrade
LAPEA - Laboratório de Pesquisa em Economia Aplicada e Engenharia de
Produção
Universidade Federal de Campina Grande.
Centro de Humanidades
Unidade Acadêmica de Economia
7 years, 7 months

Re: [Gretl-users] GARCH, Forecasting
by Allin Cottrell

On Mon, 17 Jan 2011, [ISO-8859-1] Alejandro Mosi�o wrote:
> Maybe i was not too much specific last time:
>
> I have a variable "y" that follows a GARCH(1,1) process. Then, i Gretl i
> type:
>
> garch 1 1 ; y const
>
> Then i got the result and forecasting the out-of-sample values of y can
> be done in the usual way. However, i'm interested in forecasting the
> out-of-sample variance. I don't know if such a function exists in Gretl.
There is no built-in function to do this, but you can compute a
one-step ahead forecast of the variance from the model data, as
hown in the following example script.
<script>
open b-g.gdt
garch 1 1 ; Y
series e = $uhat
series h = $h
dataset addobs 10
a0 = $coeff[2]
a1 = $coeff[3]
b1 = $coeff[4]
series hfc = h
# set future errors to their expectation
e = misszero(e)
# forecast the variance
hfc = a0 + a1 * e(-1)^2 + b1 * hfc(-1)
smpl 1970 ;
print e h hfc --byobs
</script>
Allin Cottrell
8 years

Hansl Help
by Henrique Andrade

Dear Hansl experts,
I would like to write a Hansl code but unfortunately I'm out of creativity
:(
I have a binary series with blocks of 0 and 1. Something like
X=(0,0,0,1,1,1,1,1,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1).
Here are the steps I need do follow:
(1) Find the number of 1-blocks;
(2) Calculate the average number of observations inside these blocks.
In my hypothetical example, the X series, I have two blocks, and these
blocks have an average of 8 observations (five observations in the first
block and eleven observations in the second block).
Any help will be appreciated.
Um abraço,
Henrique Andrade*
*
9 years

Problem in the Command Help Example
by Henrique Andrade

Dear Gretl Team,
I think I found a little error in the example of the "printf" command help:
<hansl>
ols 1 0 2 3
genr b = $coeff(2)
genr se_b = $stderr(2)
printf "b = %.8g, standard error %.8g, t = %.4f\n", b, se_b, b/se_b
</hansl>
If we use "[ ]" instead of "( )" the error goes away :-)
Um abraço,
Henrique Andrade*
*
9 years

CSV and decimal point character
by Henrique Andrade

Dear Gretl Community,
I´m trying to save data into comma-separated values (the csv extension)
files using the Brazilian standard (comma as the decimal point character)
but it is not working. Gretl only saves the text file with point as the
decimal point character.
In order to do this I'm using the following script:
<hansl>
open australia.gdt
set csv_delim semicolon
set force_decpoint on
set csv_na ""
store "C:\Users\Henrique\Desktop\Teste.csv" --csv --overwrite
--comment="Dados dessazonalizados no Gretl via X-12-Arima"
</hansl>
Best regards,
Henrique Andrade
9 years

Create a random variable
by Carlos Andrade

Gretl List
How to generate a random variable for a given range of values?
Example: 46 observations between 0 and 45.
--
Atenciosamente,
Prof. Carlos A. S. de Andrade
LAPEA - Laboratório de Pesquisa em Economia Aplicada e Engenharia de
Produção
Universidade Federal de Campina Grande.
Centro de Humanidades
Unidade Acadêmica de Economia
9 years

Ralph M Rodriguez/PO/KAIPERM is out of the office.
by Ralph.M.Rodriguez＠kp.org

I will be out of the office starting 11/23/2011 and will not return until
12/01/2011.
Hi All, I will be out of the office on business from Monday Nov 28
returning to the office Thursday Dec 1, 2011. I will be cheking emails
during my trip. But, if you have an immediate concern with Cost Model,
email CM-Help(a)kp.org or contact Bradley Njus at 510 625 4595.
Thanks so much,
Ralph
9 years

Re: [Gretl-users] Time Diversification and Estimation Risk
by Arina Andryeyeva

>> Hello,
>>
>> We are students in the Masters of Finance program in Belgium and are working on a project of Time Diversification. In order to check whether this concept exists, we need to perform a block bootstrap simulation together with the portfolio optimization analysis. We need to perfrom the above mentioned techniques in Gretl and have some questions for you.
1. How to write a code in order to divide a sample of three different series (Stocks, bonds and tbills) into a subsample. We have a sample that consists of 274 observations, we should divide it into subsamples: from 1st observation to 12th one (1 year holding period), from 1st to 60th etc
2. How to build variance-covariance matrix
3. How to find optimal weights for each holding period (our holding periods are of 1 year, 5 yrs, 10, 15 and 20)
>>
>> We very much appreciate your help and thank you in advance for taking the time in addressing these questions.
>>
>> Arina and Valeriya.
>
This is what we basically need to do in Gretl:
Method
In this section, we describe the optimization method used to find the asset weights of the efficient portfo- lios and how we applied the bootstrap approach to construct empirical distributions for asset weights.
Efficient Portfolios. Investorswere assumed to use the mean-variance criterion when forming their optimal portfolios, and the investment hori- zons we considered were 1 year, 5 years, and 10 years.5 The investors look for the portfolio weights x that minimize the following trade-off between
Min x'lx - Xg'x
subject to I'x = 1 X?>0,
variance and expected investment horizon:
The Bootstrap Approach. The bootstrap method, introduced by Efron (1979), is a computer- intensive method for estimating the distribution of an estimator or a statistic by resampling the data at hand. In this study, we used a nonparametric mov- ing block bootstrap introduced by Carlstein (1986) and Kiinch (1989), in which serial dependence, as well as cross-sectional correlation, is preserved within the blocks. We used a nonparametric boot- strap because a parametric form gives inconsistent estimates if the structure of the serial correlation is misspecified or not tractable. The assets were drawn cross-sectionally, so they belonged to the same time period in the original series. Thus, we never con- structed a five-year relationship between stocks and bills that did not exist in the original series. The sample of real continuous returns on stocks and bills, R, was grouped into k overlapping blocks of 60 months. We chose a block length of 60 months because it is probably long enough to pick up most forms of possible time dependencies. The blocks were then resampled with replacement b times until a series R*with the same length as R was obtained, which was equivalent to constructing a realization or trajectory for stocks and bills for each drawing or R*.From each resampled R*,we calcu- lated a variance-covariance matrix, Y*, and an expected return vector, p&*,for each investment horizon from nonoverlapping holding-period returns. We then used 1* and ,u as inputs to the mean-variance optimization and obtained the opti- mal portfolio weights, x*. We repeated this proce- dure 1,000 times. In the end, we had a set of bootstrapped observations for each optimal portfo- lio in the mean-variance optimization and every investment horizon.
The empirical distribution of the weights, based on the bootstrap samples, allowed us to draw infer- ences about the weights. We constructed 90 percent confidence intervals based on the percentiles of the distribution of the assets weights. We ordered the observations in ascending order. That is, the 5 per- cent percentile, x*(a)i,s the 50th ordered value of the replications and x*(l-a)is the 95 percent percentile and the 950th ordered value of the replications. We obtained an indication of the magnitude of the esti- mation risk from the intervals because the confi- dence region displayed the degree of uncertainty associated with the efficient frontier. Our bootstrap approach to measuring estimation risk is an alterna- tive to the confidence regions
9 years

use of lagged dependent variables with Cochrane-Orcutt and Prais-Winsten estimation
by Gabor Ruzsa

Dear Gretl users,
I'm totally puzzled by the option in Gretl to include lags of the dependent
variable in time series models estimated via FGLS (Cochrane-Orcutt or
Prais-Winsten). As much as I know, the consistence of the FGLS estimator
requires the strict exogeneity of the regressors, i.e. including lagged
dependent variables is out of question.
Does anybody have a possible explanation? I've looked in Gretl's user's
manual but haven't found any indication about this matter.
Any comments are very welcome and appreciated.
Gabor Ruzsa
Corvinus University of Budapest, Hungary
9 years

an econometric question about panels (off topic ?)
by nadaud＠centre-cired.fr

Dear all gretl listers, greetings from Paris !
I would like your advice on an econometric question.
May be a bit off topic I guess, but well, I could not find a clear answer...
I have to review results on a panel an estimation on 17 OECD countries
1985-2003. The series stationarity is assumed and not tested, but it seems
reasonable for most (i.e: most are in first differences but some in
levels). The authors use 2SLS with IV but do not test stationarity.
What makes me uneasy is when they do not report the usual residuals checks
nor conduct a Chow test (My guess is that the test on this period is so
bad that the whole results are not tenable).
I think this is not very good practice, do you agree ?
Finally I computed semi-partial correlations and these reveal that just
one variable seem to have any explanatory power. I would like to know if
it OK to compute semi-partial correlations after estimation in this
context, and if these have at least an indicative content.
Also the guys tried about 23 other variables which were rejected. There is
strong flavor of datamining here, I know it is very sensitive question but
my opinion is that the results are very suspicious with the usual standard
significance levels.
So, I would like your advice on those questions.
I will try to find the data and run them into GRETL but here in France
this study begins to generate a real political mess !
cheers to all !
Sincerely
Franck
Franck Nadaud
CIRED
UMR 8568 CNRS - EHESS, ENPC, ENGREF, CIRAD
45 bis avenue de la Belle Gabrielle
94736 Nogent-sur-Marne Cedex
TEL: 33-1-43-94-73-94
FAX: 33-1-43-94-73-70
MOB: 06-07-39-92-75
France
9 years