calculating abnormal returns with Gretl
by zsófia farkas
Dear Gretl users,
I would like to use gretl in my thesis for calculating short term abnormal
return after a occuring a stock split and check its significance.
I use a model, where Abnormal return(ARi)=Ri (actual return)-
alpha+(beta*Rm).
In the function alpha and beta is caculated from the data before the split
(from the calculate window) and Rm is the actual market return (from the
event window). I already have run an OLS on the data before the split, so I
get the alpha and the beta of the stocks before the event. I have some
problem how to run an other regression with the given alpha and beta
(calculated from the past) and the market return, but now using the actual
market return and not that of from the past? Could you please help me how
to do it? And how to check the significance of the abnormal return?
Thank you very much for your help in advance!
Sophi
9 years, 9 months
longitudinal data
by Allin Cottrell
This is a follow-up to
http://lists.wfu.edu/pipermail/gretl-users/2015-March/010772.html
It strikes me that the issue raised -- namely, how to wrangle
"difficult" data into gretl panel format -- may be of interest to
others so I've thought about it a bit more.
First a disclaimer: the method outlined below cannot be applied
mechanically to the ICPSR data mentioned by Christian. One would
have to go through the codebook very carefully to see which
variables actually "line up" across the waves of the study.
All the same, here's a toy example that might be helpful as a
template. It's in the form of two scripts: the first creates an
artificial dataset that mimics the general structure of the ICPSR
"Children of the Immigrants" data, and the second shows how the data
can be turned into a gretl panel.
1. Make the artificial data:
<hansl>
# let's suppose we have data on 50 individuals
# over 3 "waves", with the respective per-wave
# observations recorded as distinct variables
# (columns), here 10 columns per wave
nulldata 50
# unique ID for the individuals
series casenum = 10000 + index
# create a bunch of artificial data (30 series)
loop i=1..30 --quiet
series v$i = index * i
if i > 20
v$i += 20
elif i > 10
v$i += 10
endif
endloop
# write to CSV file
store rawdata.csv
</hansl>
2. Process the data into a panel
<hansl>
open rawdata.csv --quiet
# the number of longitudinal waves
scalar nwaves = 3
# the total number of panel observations
scalar NT = $nobs * nwaves
# create lists of series per wave
list L1 = v1..v10
list L2 = v11..v20
list L3 = v21..v30
# make a vector repeating the case numbers
matrix C = mshape({casenum}, NT, 1)
# matrix consisting of three vertically stacked
# components, each of which holds a wave number
# followed by the observations for that wave
matrix X = ({1}~{L1}) | ({2}~{L2}) | ({3}~{L3})
# note that X has an extra column for the wave
scalar nx = cols(X) - 1
# create empty dataset for panel
nulldata NT --preserve
# trash the automatic "index" variable
delete index
# add the casenum series from vector
series casenum = C
# add the wave number series from the first
# column of matrix X
series wave = X[,1]
# add the actual data
loop i=1..nx --quiet
series pan$i = X[,i+1]
endloop
# let's take a look...
print --byobs
# now turn into gretl panel format
setobs casenum wave --panel-vars
# and take a look again...
print --byobs
</hansl>
Allin Cottrell
9 years, 9 months
why the error
by Qi Shi
dear everyone,
when i write in gretl the scripts
"
open greene22_2
discrete Z5
list X=dummify(Z5) --drop-first
"
then I run the program and get the results,
"
gretl version 1.9.92
Current session: 2015-03-14 16:31
? open greene22_2
Read datafile C:\Program Files\gretl\data\greene\greene22_2.gdt
periodicity: 1, maxobs: 601
observations range: 1 to 601
Listing 10 variables:
0) const 1) Y 2) Z1 3) Z2 4) Z3
5) Z4 6) Z5 7) Z6 8) Z7 9) Z8
? discrete Z5
? list X=dummify(Z5) --drop-first
> list X=dummify(Z5) --drop-
The symbol 'drop' is undefined
Error executing script: halting
> list X=dummify(Z5) --drop-first
"
why did i encounter the error?
best,
shi,qi
9 years, 9 months
Re: [Gretl-users] why the error
by Dr. Logan Kelly
Allin,
Please forgive the silly question, but just out of curiosity
Why is the double minus "--" ok?
Logan
Sent from my T-Mobile 4G LTE Device
<div>-------- Original message --------</div><div>From: Allin Cottrell <cottrell(a)wfu.edu> </div><div>Date:2015/03/14 9:15 AM (GMT-06:00) </div><div>To: Gretl list <gretl-users(a)lists.wfu.edu> </div><div>Cc: </div><div>Subject: Re: [Gretl-users] why the error </div><div>
</div>On Sat, 14 Mar 2015, Sven Schreiber wrote:
> Am 14.03.2015 um 09:36 schrieb Qi Shi:
>
>> ? list X=dummify(Z5) --drop-first
>>> list X=dummify(Z5) --drop-
>> The symbol 'drop' is undefined
>>
>> Error executing script: halting
>>> list X=dummify(Z5) --drop-first
>> "
>>
>> why did i encounter the error?
>>
>
> You're mixing up the 'dummify' command with the 'dummify()' function.
> Only the command takes these double-dash-style options like
> "--drop-first". For the function you have a second argument, please see
> the help for that (haven't used it myself yet).
>
> Remark for Allin and Jack:
> BTW, I think the error message is strange insofar as IMO the parser
> should complain already about the "--" in there, not about the "drop"
> word, no? But perhaps this has been changed since last release.
The "--" is in principle OK if interpreted as "minus minus",
as in "y = f(x) --a".
Allin
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users
9 years, 9 months
Re: [Gretl-users] Question regarding the econometrics program gretl
by Allin Cottrell
Please post this sort of question to the gretl-users mailing list
[ http://lists.wfu.edu/mailman/listinfo/gretl-users ]
I'm forwarding it to the list; my comments follow the question.
On Fri, 13 Mar 2015, Christian Mücher wrote:
> I am an economics student at the university of constance. During the
> last semester I leaned the use of the econometrics program gretl.
> Right now I am writing my Bachelor Thesis with this program and
> encountered a problem.
>
> I am using the Children of the Immigrants Longitudinal Study Dataset
> http://doi.org/10.3886/ICPSR20520.v2
>
> When importing the Dataset in gretl the panel structure of the
> dataset is lost. When trying to impose a panel structure on the
> dataset the problem ist, that there is no variable measuring the
> period. Further, the Dataset is coded such that each observation is
> in one row and all variables are in columns. The problem is, that v1
> to v148 are measured in period 1, v203 to p144 are measured in
> period 2 and v400 to v450 are measured in period 3. But I fail to
> define this periodicity such that a panel structure can be defined.
> I tried pretty much everything I could think of, and my supervising
> professor does not now gretl. The tutor who taught us gretl also has
> no solution for my problem. The last thing I can think of ist to
> export the Dataset as .csv file and include a timevariable manually.
> I hope that you can help me out with an easier way, as this method
> would be very time consuming.
>From what I can tell, the ICPSR20520 dataset is not actually a panel,
although it is longitudinal. According to the codebook, the three
waves differ in regard to the information recorded, although there is
some overlap between the waves. You'll have to think carefully about
how you want to analyse these data.
That said, if you need to rearrange blocks of data to get a semblance
of a panel, then gretl's matrix methods are likely to be useful. Just
to illustrate, here's a hansl script to make a matrix out of variables
v1 to v148:
<hansl>
set echo off
set csv_delim tab
open 20520-0001-Data.tsv
list L1 = v1..v148
matrix X1 = {L1}
</hansl>
Having created blocks of this sort you can then create a new dataset
of an appropriate size and extract series from the blocks in the
"right places", wherever that may be:
<hansl>
scalar N = <you figure it out>
nulldata N --preserve
# pull stuff from matrices into series
# use "smpl" to set the range for writing from matrix to series
</hansl>
Allin Cottrell
9 years, 9 months
saving script graphs
by Annaert Jan
When I'm trying to save graphs in a script for further manipulation (not to disk, but to the icon view) as follows:
Gr <- gnuplot x y
I'm getting
Warning: ignoring "Gr <-"
and the graph is saved to disk instead.
>From the console this same command works as predicted and the graph becomes an object in the icon view.
The user guide seems to suggest that the command should also work from a script, so I don't see what is going wrong. It does work for models, both from the console and a script. I'm using gretl 1.9.92 on Mac OS 10.6.8.
Thanks for any insights.
Jan Annaert
9 years, 9 months
Generated regressor problem in VAR
by Gabriela Nodari
Dear Gretl community,
I am working with a VAR in which one of my endogenous variables is a
generated regressor. Specifically, I have estimated a time-varying
volatility measure from an EGarch model, and I'm using this mesure to
investigate the effects of volatility shocks.
I'm fully aware that alternative (and more fancy) econometric models would
do better than this 2-step procedure. Also because the estimated volatility
belongs to another endogenous VAR variable. However, ignoring this fact, my
question is whether gretl provides an option to account for this
measurement error problem when estimating a simple linear VAR system.
I had a look at Murphy and Topel's (1985) paper, and also tried to
find other references on how to correct the potential bias, but the
solution is not clear to me yet. I would appreciate any comments and
suggestions on this issue.
Thanks a lot,
Gabriela
9 years, 9 months
Forecasting variance of a GARCH model
by Karthik Raju
Hello,
I am writing to seek help to forecast volatility of index returns using
GRETL.
In GRETL, I want to know how to perform in the sample and out of sample
forecasting after estimating index return series by using GARCH variants
in the gig package.
Thank you.
Best,
Karthik
9 years, 9 months
Re: [Gretl-users] ODBC troubles
by Mike Walker
Hi Allin,
I’m a huge fan of the gretl platform and use it quite a bit in my professional job. But recently, I’ve run into some trouble. Are you still able to provide help on gretl? I’m trying to import data using ODBC connection, but I’m halting at the data command line.
Here is my code:
open dsn=FIGTrading --odbc
string SQLQuery = "SELECT spreads_ont5year, spreads_cmb5year FROM tbl_Spreads WHERE ((spreads_date)>(DateValue(Date())-200))"
data y t obs-format="%g" query=SQLQuery –odbc
Here is what gretl returns:
gretl version 1.9.92
Current session: 2015-03-05 16:34
? open dsn=FIGTrading --odbc
Connected to ODBC data source 'FIGTrading'
? string SQLQuery = "SELECT spreads_ont5year, spreads_cmb5year FROM \
tbl_Spreads WHERE ((spreads_date)>(DateValue(Date())-200))"
Replaced string SQLQuery
? data y t obs-format="%g" query=SQLQuery --odbc
Error executing script: halting
> data y t obs-format="%g" query=SQLQuery --odbc
If you could provide any feedback on this that would be great!
[Description: cid:image001.jpg@01CFE944.0366CB30]
Michael Walker
Associé / Associate
Groupe revenu fixe/Fixed Income Group
Marché des Capitaux/Capital Markets
Valeurs Mobilières Desjardins / Desjardins Securities Inc
Toronto
416-867-3580
1-855-607-3001
Fax:416-867-1490
25, York Street , Suite 1000
Toronto, Ontario M5J 2V5
Si vous avez reçu ce message électronique par erreur, ou si vous ne souhaitez plus recevoir de messages électroniques de notre part, veuillez nous en informer par courriel à l'adresse suivante: Desabonnement_Courriel(a)vmd.desjardins.com<mailto:Desabonnement_Courriel@vmd.desjardins.com>
If you have received this electronic message in error, or if you do not wish to receive any further electronic messages from us, please notify us by email at the following address: Email_Optout(a)vmd.desjardins.com<mailto:Email_Optout@vmd.desjardins.com>
- L'intégrité des informations transmises dans ce courriel n’est pas garantie par Valeurs mobilières Desjardins, qui décline toute responsabilité quant aux dommages causés par leur modification frauduleuse. Ce courriel est confidentiel et est à l’usage exclusif de son destinataire. Toute personne qui reçoit celui-ci par erreur doit en informer immédiatement son expéditeur et le détruire sur-le-champ. Toute autre utilisation des informations qu’il contient est strictement interdite. Valeurs mobilières Desjardins se réserve le droit de surveiller toutes les communications transmises par courrier électronique par l’intermédiaire de ses réseaux. Les instructions relatives à des opérations acheminées par courrier électronique ne seront pas acceptées. Le présent avertissement ne limite aucunement tout autre avertissement plus restrictif qui vous aurait été transmis par Valeurs mobilières Desjardins.
- The integrity of the transmitted information in this email is not guaranteed by Desjardins Securities, which accepts no liability for any damage caused by its fraudulent alteration. This email is confidential and is intended for the sole use of the recipient or authorized representative of the recipient. Any person who receives this email by mistake shall immediately notify the sender and destroy it. Any other use of the information therein is strictly prohibited. Desjardins Securities reserves the right to monitor all communications sent by e-mail through its networks. Instructions related to operations sent by e-mail will not be accepted. In no way does this notice limit other more restrictive warnings that may have been sent to you by Desjardins Securities.
9 years, 9 months
Interface to database of european union
by Wingenroth, Thorsten
Hi,
I just stumbled upon this website:
https://open-data.europa.eu/en/developerscorner
would it be of interest to some of you out there to include an interface into Gretl to directly access European Union data? Does someone have prior experience with this source and the ODBC interface is already sufficient for this job?
Kind regards,
Thorsten
Prof. Dr. Thorsten Wingenroth
Professor für Lehraufgaben BWL-Bank
Fakultät Wirtschaft | Studienzentrum Finanzwirtschaft (Center of Finance)
Duale Hochschule Baden-Württemberg Stuttgart
Baden-Wuerttemberg Cooperative State University Stuttgart
Herdweg 18 | 70174 Stuttgart
Fon +49 711 1849-766
thorsten.wingenroth(a)dhbw-stuttgart.de<mailto:thorsten.wingenroth@dhbw-stuttgart.de> | http://www.dhbw-stuttgart.de/bank
Master in Business Management - Banking & Finance
http://www.dhbw.de/master-finance
9 years, 9 months