Plot windows close after new dataset is created
by Andreï | Андрей Викторович

Dear gentlemen and ladies,
After some extensive work with scripts, I was a bit frustrated when I
figured out that plots brought onto display via
gnuplot STUFF --output=display
are shut down after the *nulldata* command. Consider the following example:
<hansl>
nulldata 50
set seed 20140624
series x = sort(randgen(u,0,10))
set seed 20140625
series normerr = randgen(n,0,1)
set seed 2024
series baderr = randgen(t,1)
series y = 2+0.5*x + (index>40 ? baderr : normerr)
# Let's look at those odious outliers
gnuplot y x --output=display --linear-fit
# Bootstrap
matrix Y = y
matrix X = x
matrix DATA = Y~ones(50,1)~X
scalar iters = 100000
matrix betas = zeros(iters,2)
loop i=1..iters --progressive --quiet
matrix D = resample(DATA)
betas[i,] = mols(D[,1], D[,2:3])'
endloop
nulldata iters --preserve
# Because kdensity does not favour matrices, series only!
series bs2 = betas[,2]
matrix ker2 = kdensity(bs2)
gnuplot 2 1 --matrix=ker2 --with-lines --suppress-fitted --output=display
</hansl>
As you can see, the desired output consists of two plots, the scatterplot
and the bootstrap distribution of the coefficient. However, much as I would
like to look at them side-by-side, it is impossible since the *nulldata*
command eliminates the original series and somehow closes the plot window
(verified via console, too). So things go smoothly as long as we use the
same dataset, but even the preservation of matrices does not prevent the
plot window from being shut down. Is it a bug or a feature? Can such
forceful behaviour be somehow overridden?
--
Yours sincerely, | С уважением,
Andreï V. Kostyrka. | Андрей Викторович Костырка.
http://kostyrka.ru, http://kostyrka.ru/blog
9 years, 5 months

Argument type for var(), sd() and such
by Andreï | Андрей Викторович

Dear all,
Today I was reading the Function Reference when it confused me that the
argument for var() or sd() should be a list or a series. However, having a
one-column matrix (named MAT) at hand, I tried
scalar sdM = sd(MAT)
and obtained a correct result. When a matrix with multiple columns was fed
in, an error was not slow to arrive.
Does it mean that these functions fully support one-column matrices as
arguments? If yes, could you mention it in the Function Reference? If it is
a slippery slope, could you state it in the Reference that “for matrices
other than n×1, it produce an error, whereas for n×1 matrices it will yield
the result, which, however, has something to do with matrix-series
conversion and it is strongly advised to explicitly prepare such a series
before”? (Of course, the latter is so undesirable, especially when the
length of the one-column matrix differs from the length of the dataset!)
--
Yours sincerely, | С уважением,
Andreï V. Kostyrka. | Андрей Викторович Костырка.
http://kostyrka.ru, http://kostyrka.ru/blog
9 years, 5 months

Log-likelihood with Indicator function (IF-ELSE statement)
by Alecos Papadopoulos

Good afternoon.
I am running maximum likelihood using the script window.
I have the need to estimate a log-likelihood that has a different
functional form depending on whether the estimated value of the
variable(the residual) at each observation is lower or greater than zero.
In generic terms
if u_i <=0
mle logl_i = f(u_i, a, b)
else
mle logl_i = g(u_i, a, b)
endif
where u_i = y_i - c0 - c1*x_1i - c_2*x_2i and the coefficients c0,
c1, c2 are also under estimation, together with the variance terms a,b
I am not sure how to write the mle command for this case.
Since the value of the residual is itself under estimation (and so the
condition to switch functional forms is not pre-determined), I am not
even sure if this is feasible (starting values are of course provided
for the coefficients).
At worst, I could estimate the coefficients for the regressors by LS,
and thus create the residual series beforehand, and then plug it in and
let the mle calculate only the variance terms (which are my focus of
interest). But even in this case I don't seem to be able to write
correctly the IF-ELSE statement that apparently is needed. Naturally, I
would prefer to have the joint estimation procedure.
Any help will be really appreciated.
--
Alecos Papadopoulos
Athens University of Economics and Business, Greece
Department of Economics
cell:+30-6945-378680
fax: +30-210-8259763
skype:alecos.papadopoulos
9 years, 5 months

Strange behavior on sending data to R Sesion
by JOSE FRANCISCO PERLES RIBES

Dear list:
Yesterday, I tried to link my gretl data with R-Studio sesion and all was
OK.
It was gretl 1.9.15 cvs 13/04/2014 with R.3.0.1. I used the GUI,
Tools>>Start GNU R. (in my case the path to R-Studio)
However, this morning, after updgrade my R to R.3.1.0 the data starts to
experience a strange behavior. For example, a data of 36497.60 in Gretl is
opened in R as 68; 39187 as 76, and so on.
I have changed the path to R instead of R-Studio and there is the same
issue...
So, somebody has the same trouble???
Thanks in advance.
José F. Perles
University of Alicante
9 years, 5 months

Gretl and R-Studio
by JOSE FRANCISCO PERLES RIBES

Dear list:
Somebody knows if it is possible to send the Gretl data to R-Studio
interface instead to R-console through the Gretl GUI Menu Tools>>Start GNU
R? Only changing the general preferences is enough?
Thanks a lot.
José Perles
University of Alicante
9 years, 5 months

Java Wrapper
by Mukunda.Sharma＠ubs.com

Hello
I am very curious as to how to run gretl from Java. Any advice on this
will be highly appreciated.
Best regards
Mukunda Sharma
Visit our website at http://www.ubs.com
This message contains confidential information and is intended only
for the individual named. If you are not the named addressee you
should not disseminate, distribute or copy this e-mail. Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system.
E-mails are not encrypted and cannot be guaranteed to be secure or
error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. The sender
therefore does not accept liability for any errors or omissions in the
contents of this message which arise as a result of e-mail transmission.
If verification is required please request a hard-copy version. This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities
or related financial instruments.
UBS Limited is authorised by the Prudential Regulation Authority
and regulated by the Financial Conduct Authority and the Prudential
Regulation Authority.
UBS AG is a public company incorporated with limited liability in
Switzerland domiciled in the Canton of Basel-City and the Canton of
Zurich respectively registered at the Commercial Registry offices in
those Cantons with new Identification No: CHE-101.329.561 as from 18
December 2013 (and prior to 18 December 2013 with Identification
No: CH-270.3.004.646-4) and having respective head offices at
Aeschenvorstadt 1, 4051 Basel and Bahnhofstrasse 45, 8001 Zurich,
Switzerland and is authorised and regulated by the Financial Market
Supervisory Authority in Switzerland. Registered in the United
Kingdom as a foreign company with No: FC021146 and having a UK
Establishment registered at Companies House, Cardiff, with
No: BR 004507. The principal office of UK Establishment: 1 Finsbury
Avenue, London EC2M 2PP. In the United Kingdom, UBS AG is authorised
by the Prudential Regulation Authority and subject to regulation
by the Financial Conduct Authority and limited regulation by the
Prudential Regulation Authority. Details about the extent of our
regulation by the Prudential Regulation Authority are available
from us on request.
UBS reserves the right to retain all messages. Messages are protected
and accessed only in legally justified cases.
9 years, 5 months

Interval regression model
by Mārtiņš Liberts

I was using gretl to do interval regression modeling using the
function intreg. It was the gretl version 1.9.12 then.
I was running the same analyses recently using the newer gretl version
and found out that the intreg gives different coefficient estimates
for the same data. I found out that I am getting different coefficient
estimates since the gretl version 1.9.13. All upcoming versions of
gretl (1.9.14 and 1.9.90) gives the same coefficient estimates as the
gretl version 1.9.13.
It seems that there have been some change in the algorithm for intreg
at the version 1.9.13. However I do not see anything related to the
intreg in the changelog
(http://gretl.sourceforge.net/ChangeLog.html#v1-9-13).
I am attaching the output files from the gretl 1.9.12 and 1.9.13 where
you can see the differences in the coefficient estimates.
Could you please explain briefly what has been changed for intreg at
the gretl version 1.9.13?
Thanks a lot,
Martins
--
Mārtiņš Liberts
+371 26 411 543 (mobile)
+371 67 366 833 (office)
http://home.lu.lv/~pm90015/
9 years, 5 months

Re: [Gretl-users] cannot import unbalanced panel data
by Allin Cottrell

John Paravantis recently posed an interesting data-parsing
challenge. It came to me as list-owner and not to the list because
it had as attachment a very big dataset. I'll quote (most of) John's
query below and append my analysis.
John says:
> I successfully imported a very big data file (almost 244 thousand
> observations, attached in zipped text) in gretl BUT cannot make
> gretl accept its unbalanced panel structure so that I may run
> AR(1) regression or use other time series techniques. [...]
>
> The data set contains half-hourly temperature measurements
> (December 2012 to April 2013) and accompanying socioeconomic
> variables of 50 homes in Athens, Greece. Not all homes contain the
> same number of temperature measurements though, some started in
> December, others in February.
>
> So the data set structure resembles unbalanced panel data (I
> think), where the time index variable is an integer counting the
> number of half-hour periods (variable DAYS) and the panel group
> (variable HOUSENUM) simply holding the house number.
I'm not quite sure what DAYS measures (it ranges from -5 to 118) but
it clearly is _not_ an index of the half-hour periods, of which
there are several thousand.
> When I try to set the dataset structure in gretl though by
> selecting "panel" and then "use index variables" with variable
> HOUSENUM as the unit or group index variable and DATE as the time
> index variable, I get the message "The selected index variables do
> not represent a panel structure."
As elaborated below, DATE is a string variable identifying the
calendar day.
> I also tried to use the DAYS variable as a time index but this one
> does not even appear in the list of variables available as a time
> index, don't know why not.
>
> What am I doing wrong?
>
> Is it OK to just have gretl accept the data set as a very long
> time series with 243814 entries (even if it is not) just to get
> access to the time series submenu items in the model menu?
To answer the last question first: No, it is not at all OK to
proceed as if a panel dataset were a continuous time series; any
results would be meaningless statistical garbage, as I'm sure John
knows.
Consider the symptom John mentions: gretl says that the index
variables he selected "do not represent a panel structure". That's
quite right. The "unit" variable must constitute a unique ID for (in
the case) the household, and he's OK in that respect, he has
HOUSENUM. But in addition the "time" variable must constitute a
unique identifier for the time period, and he's not OK in that
respect: there's no variable in the dataset that fulfils that role.
There's a bunch of time-related variables -- DAYS, DATE, MONTH, DAY,
TIME, HOUR, etc., too many in fact! -- but no unique period ID for
the half-hourly frequency. The variables that look most promising
for forming such a series are DATE and TIME. These are both string
variables, with formats
DATE: "DD-MM-YYYY"
TIME: "hh:mm"
I'm adding below a script that creates a period ID using these
variables. Perhaps it ought to be possible to do this more easily --
and maybe in fact it is (Jack?) but anyway it's something of a
showcase for gretl's current string-handling capabilities. The
strategy is to write out these two variables as .txt files, read
them back in as strings, and parse them to create a series that (a)
has distinct values for every half hour and (b) is actually
increasing in the true time dimension.
<hansl>
open <John's data file>
# we need to exceed the default max number of
# "while" iterations below
set loop_maxiter 0
# write DATE (string: DD-MM-YYY) out to text
# with no added "obs" column or header
store dates.txt DATE --omit-obs --no-header
# and read it back as a big string
string s = readfile("dates.txt")
string line
scalar y, m, d
series ymd
# Loop across the dates.txt lines, parsing out day,
# month and year and reassembling as a proper sequence.
# We scan line + 1 to skip the leading quote
scalar i = 1
loop while getline(s, line) --quiet
sscanf(line + 1, "%d-%d-%d", d, m, y)
ymd[i] = y*10000 + m*100 + d
i++
endloop
# now write out TIME (string: hh:mm) as text
store time.txt TIME --omit-obs --no-header
# and read back in as a string
s = readfile("time.txt")
scalar h
series hm
# loop across the time.txt lines, parsing out hour,
# minute and reassembling as a numerical sequence
i = 1
loop while getline(s, line) --quiet
sscanf(line + 1, "%d:%d", h, m)
hm[i] = h*100 + m
i++
endloop
# now we're ready to construct a proper "time" index
# for these half-hourly data
series realtime = 10000*ymd + hm
# take a look and check
print DATE ymd TIME hm realtime --byobs
# use "realtime" as the panel time variable: OK!
setobs HOUSENUM realtime --panel-vars
</hansl>
Allin Cottrell
9 years, 5 months

sscanf with German Language
by Pindar

Hi there,
I programmed a function that uses getline and sscanf to parse several internet time series from a string at ones.
To do so I replace the comma in decimal characters with a dot. This is working when gretl is set on English. If I now turn to German because I need the csv output option (which is unfortunately only present when set to German) then the doubles are either made to integers or when using commas no import happens at all.
It's quite annoying to always close and reopen gretl just to download recent dates.
Please help me with that issue.
Cheers
Leon
9 years, 5 months

Omitted variable index
by Artur T.

Dear all,
I am just using the "omit" command. My initial model has many regressors
and the "omit" command with the "--auto=alpha" option reduces the
specification substantially. I want to find out the index/position of
the variable which is selected as insignificant each round.
So lets say I have three regressors. The initial point estimates are:
binit = { 0.5, 2, 3.4 }
after "omit" the first two regressors are found to be insignificant, and
hence the final estimate is, for instance, given by:
bfinal = { 3.55 }
In this case I would like to have something like a selection vector
which takes unity for the omitted variables:
select = { 1, 1, 0 }
I've got a rather complicated solution in mind but I am wondering
whether there is a built-in command which I am not aware of.
Thanks in advance!
Artur
9 years, 5 months