Re: [Gretl-users] Blending undated series
by George Matysiak

Thank you Sven, Jack and Henrique for your very prompt and clear replies.
All sorted at my end now and everything works like a dream. Very much
appreciated.
Best,
George
4 years, 6 months

Re: [Gretl-users] Blending undated series
by George Matysiak

My undated Full range is 1-63. I have one series with 20 observations and
another series with 15 observations, the first with (63-20) = 43 missing
observations and the second with (63-15)= 48 missing obseravations. There
is no overlap in their respective observation number. What would be best
way to combine both series into one series with 35 observations? Thanks.
4 years, 6 months

Re: [Gretl-users] Adding data values on the fly
by George Matysiak

I have an independent time series variable x for which I would like to vary
future input values in order to make forecasts - scenario type forecasts.
So, if I want to forecast four, say, future values of the dependent
variable what would the best way to add the four data values of x into my
script?
dataset addobs 4
scalar x?
fcast fit1
Thanks.
4 years, 6 months

Default Maximum lag on fracdiff function
by Fernando Fernandes Neto

Hi there.
I have a simple question regarding the definition of how many lags are
considered when we apply a fracdiff over a time series. Is all available
information considered everytime I apply the fracdiff function?
Or is there a default value for a maximum lag ? (thinking of that a
fractional difference can be thought as an infinite AR operator).
Thanks in advance,
Fernando
4 years, 6 months

Initial values for simulating an AR(p) process
by Artur T.

Dear all,
I experimenting a bit with simulating dynamic ARDL models. I've got
three questions:
1) In the script below, you see a simulation of an AR(p) model for two
different initial values which are sent to filter(), y0 and y00. I think
y00 should be the correct initial value but I would like to know your
opinion.
2) Do you think there are any concerns about the ysim() function?
3) I was thinking of simulating a series of length k*T where k is some
positive integer and T the length of the actual series. The first
(k-1)*T values would be taken as the "burn-in phase". However, I am not
sure how to program this cleverly as "Z" and thus "z" have some fixed
length in the ysim() function. Much appreciated if somebody comes up
with a nice idea ;-)
Best,
Artur
<hansl>
clear
set echo off
set messages off
open denmark.gdt -q
set seed 1234
function void ysim (series y,
matrix ARcoef,
list Z "lD~uhat",
matrix Zbeta "Coefficients of all exogenous | 1 (for uhat)",
scalar pq, scalar y0, series *Ysim)
series z = lincomb(Z, Zbeta)
series Ysim = filter(z,1,ARcoef,y0)
smpl $t1 $t1+pq-1
Ysim = y # add first initial (historical) values
smpl full
end function
series Y = LRY
list lD = const #time
scalar nD = nelem(lD)
# AR(p)
scalar p = 2
ols Y lD Y(-1 to -p)
matrix ARbeta = $coeff[(1+nD):]
matrix Zbeta = $coeff[1:nD]
# Simulate the Y-series
series uhat = resample($uhat)
scalar y0 = Y[$t1] # initial value 1
scalar y00 = Y[$t1+p-1] # initial value 2
list Z = lD uhat
Zbeta |= 1 # add unit coeff for uhat
series Yb0 = 0 # simulated series 1
ysim(Y,ARbeta,Z,Zbeta,p,y0,&Yb0)
series Yb00 = 0 # simulated series 2
ysim(Y,ARbeta,Z,Zbeta,p,y00,&Yb00)
gnuplot Y Yb0 Yb00 --with-lines --time-series --output=display
</hansl>
4 years, 6 months

using some test commands with matrix input (instead of series)
by Sven Schreiber

Hi,
I've come across the (minor) problem that I wanted to test a vector of
data observations for following a certain distribution. There was no
statistical problem, but I had to set up a "dummy" workfile with
"nulldata" and convert the vector to a series to be able to use the
"normtest" command.
But since "nulldata" isn't so easy to use or not allowed in loops and/or
functions, this caused some complications. So I wanted to ask if it's
also possible to run such tests on vectors/matrices, instead of series
in workfiles. Besides "normtest" another candidate might be "difftest",
and probably some others, too.
thanks,
sven
4 years, 6 months

Short question regarding econometric procedure: LASSO
by Jan Tille

Dear list members,
please allow my blunt question, I have seen that there Gretl does not have a built in functionality for LASSO regressions (which is possibly quite complex to implement), but does anyone know, whether there is a function package available?
Thanks in advance and kind regrads,
Jan
4 years, 6 months

powerball puzzle
by Allin Cottrell

OK, this is not really gretl-specific, but hopefully it might be of
interest to some. A colleague recently asked me what would be the
best way of testing the fairness of the US Powerball lottery, and he
suggested as candidates a chi-square test or translation via the
inverse normal cdf followed by a test for normality. You can find
historical data at
http://www.powerball.com/powerball/pb_frequency.asp ; I looked
at the frequency of "White balls" for each ball number, 1 to 69.
I simulated the two tests (well, three, since I used two variants of
the normality test) on the null hypothesis of fairness (each of the
69 balls has an equal chance of being selected on each drawing), and
got the following statistics for their p-values ("X2" = Pearson
chi-square, "DH" = Doornik-Hansen normality test, "SW" =
Shapiro-Wilk) based on 5000 replications:
Mean Std. Dev. Minimum Maximum
X2pv 0.50262 0.28698 4.81e-05 0.99914
DHpv 0.92881 0.04055 0.71212 0.99992
SWpv 0.99924 0.00141 0.97667 1.00000
It seems that under the null the p-value ought to be distributed
uniformly on (0,1). That appears to the case for the chi-square
test, but not at all for the two tests that employ the inverse
normal transformation.
Question: Am I suffering from a conceptual confusion, have I coded
the simulation wrongly (below), or what?
<hansl>
set echo off
set messages off
function scalar X2test (const matrix O)
scalar n = rows(O)
scalar N = sumc(O)
scalar E = N/n
scalar X2 = sumc(((O - E).^2) / E)
return pvalue(X, n-1, X2)
end function
function matrix cdftest (series count)
matrix ret = zeros(1, 2)
series relf = count/sum(count)
series EDF = cum(sort(relf))
# skip the last value (1.0) ?
smpl ; -1
series z = invcdf(N, EDF)
normtest z --quiet
ret[1] = $pvalue
normtest z --quiet --swilk
ret[2] = $pvalue
return ret
end function
# simulate a total of N draws for balls numbered 1 to 69,
# where N is chosen to roughly simulate the counts for
# White Balls shown on the powerball website
nulldata 69
series White
scalar N = 605 # draws
scalar K = 5000 # replications
matrix PV = zeros(K, 3)
loop i=1..K -q
White = 0
loop N -q
j = randint(1, 69)
White[j] += 1
endloop
PV[i,1] = X2test({White})
PV[i,2:3] = cdftest(White)
endloop
colnames(PV, "X2pv DHpv SWpv")
summary --matrix=PV --simple
</hansl>
Allin
4 years, 6 months

Accessing Function packages
by George Matysiak

Aha, all sorted - just unticked the http proxy and all fine. Apologies for
the distraction everyone.
*Contact number +48 781 415 432**"In God we trust, all others bring data."*
4 years, 6 months