Issue with dummify command and a head scratcher
by Alecos Papadopoulos
Good afternoon.
1) I have a series X characterized as discrete, with 9 unique values,
one of them negative the other positive. When I execute
dummify X
I get all 9 dummies that the command should produce.
I found out that I can also execute
list dumXlist = dummify(X)
...but in which case the command does not produce the dummy_1, related
to the negative value, and so the dumXlist contains only 8 dummies.
Note: the dummies that are produced are labelled correctly, namely their
names start from DX_2, DX_3 etc. So Gretl tells me "I know there is one
more dummy in there, but I won't create it"... is this a bug?
I want to use the command "list" because the whole thing will be inside
a loop.
2) I was unable to determine the combination of Gretl commands that will
give me the following:
Let X be a series, X(i), i=1,...,n. I want to create the following series
Y(i) = "the immediately smaller value than X(i) in the X series".
(If the Y series is created using a loop, I guess I can deal with what
happens when X(i) is the minimum value in the series by an "if" command)
E.g. if the X series has unique values {-3, -1, 5, 17}, then X(i)
= 5 => Y(i) = -1, X(j) = -1 => Y(j) = -3, etc.
I would much appreciate any ideas.
--
Alecos Papadopoulos PhD
Athens University of Economics and Business
web: alecospapadopoulos.wordpress.com/
5 years, 3 months
resampling with or without replacement
by Stefano
dear all,
sorry for arriving late - been busy marking (appalling) exams and
projects over the last few days.
Coming to the issue, I confess I fail to see the point of resampling
without replacement.
As far as the bootstrap is concerned, as far as I know resampling MUST
be carried out with replacement. This was clearly stated at the outset
of the literature (eg in Efron-Tibshirani's 1993 book "with replacement"
is in italics the first time the resampling algorithm is described, at
p. 45). The rationale is that our aim is to generate artificial data
distributed as a multinomial given by the empirical distribution
function of the data. Note this holds for each artificial datapoint.
What happens if use resampling without replacement? the various
artificial datapoints would be generated with different multinomials.
Further, we consider this: if the bootstrap pseudodataset is of the same
size of the original dataset (as typical, although by no means
necessary) resampling with no replacement we end up with the original data!
bye,
Stefano
--
________________________________________________________________________
Stefano Fachin
Professore Ordinario di Statistica Economica
Dip. di Scienze Statistiche
"Sapienza" Università di Roma
P.le A. Moro 5 - 00185 Roma - Italia
Tel. +39-06-49910834
fax +39-06-49910072
web http://stefanofachin.site.uniroma1.it/
5 years, 3 months
Re: resampling with or without replacement
by Ioannis A. Venetis
Sorry for this second follow up post.
In addition, it might be necessary to draw (shuffle) less than the
original 100 series (it has to do with dimensions and breaking the
number of series in small VAR blocks ...).
Say 95 series out of the original 100.
Yiannis
5 years, 3 months
Re: resampling with or without replacement
by Ioannis A. Venetis
Sure without replacement is not for bootstrap purposes.
It was necessary for me when I tried to write estimation procedures for
generalized dynamic factor models:
Forni, M., M. Hallin, M. Lippi and P. Zaffaroni (2015) 'Dynamic factor
models with
infinite-dimensional factor spaces: One-sided representations', Journal
of Econometrics 185(2): 359-371.
Forni, M., M. Hallin, M. Lippi and P. Zaffaroni (2017) 'Dynamic factor
models with infinite-dimensional factor space:
Asymptotic analysis', Journal of Econometrics 199(1): 74-92.
For a number of quantities (parameters, impulse response function and
other), their estimators (in the way of estimating the common components
and factors) strongly depend on the ordering of the cross-section. We
are not interested in such matrices per se but only insofar as they
enter the impulse-response functions and their estimators.
The authors argue that although the population impulse-response
functions are permutation-equivariant, their estimators are not.
Simulations by Forni et al. (2017) provide convincing evidence that,
selecting a small number of permutations at random and averaging the
corresponding estimators of the impulse-response functions leads to
rapidly stabilizing results and a substantial reduction of the expected
Mean Square Estimation Error (MSE).
More simply, say I have 100 series, in any particular uninformative
order (no identification of any kind). I estimate some quantities, then
I change (shuffle) the variables and I re-estimate the quantities,...do
it 100 times and average the estimates to get the necessary results.
Yiannis
5 years, 3 months
Resample without replacement
by Artur Tarassow
Hi all,
it seems that we don't have a resample _without_ replacement function so
far -- at least I could not find any. I've got inspired by the following
example from John D. Cook: https://stackoverflow.com/a/311716
I translated it to hansl and wrote 2 versions. The first one simply
draws n integers from a vector taking values from 1 to N which could be
used for selecting some rows of a matrix in another step. The second
function does the first one's job but returns n randomly drawn rows from
an input matrix X. I am not happy with the functions' name -- but maybe
you've got another idea?
Also, maybe one of the functions could be another candidate for extra.gfn?
Best,
Artur
<hansl>
function matrix SampleWithoutReplacement (int N[1::] "Size of set
sampling from",
int draws[1::] "No. of draws
or size of each sample")
/* Draws integers from a sequence from 1 to N. */
if draws > N
funcerr "Number of draws cannot exceed the size of the set to
sample from"
endif
scalar t = 1 # total input records dealt with
scalar m = 0 # number of items selected so far
matrix sample = zeros(draws, 1)
loop while m < draws -q
scalar u = randgen1(u,0,1)
if (N-t)*u < (draws-m)
sample[1+m] = t
m++
endif
t++
endloop
return sample
end function
function matrix SampleMatrixWithoutReplacement (matrix X "Matrix to
sample rows from",
int draws[1::] "No.
of draws or size of each sample")
/* Draws random rows from X */
scalar N = rows(X)
if draws > N
funcerr "Number of draws cannot exceed the size of the set to
sample from"
endif
scalar t = 1 # total input records dealt with
scalar m = 0 # number of items selected so far
matrix sample = zeros(draws, 1)
loop while m < draws -q
scalar u = randgen1(u,0,1)
if (N-t)*u < (draws-m)
sample[1+m] = t
m++
endif
t++
endloop
# retrieve sampled rows from X
matrix R = zeros(draws,cols(X))
loop i=1..draws -q
R[i,] = X[sample[i],]
endloop
return R
end function
# Examples
#----------
matrix sample = SampleWithoutReplacement(10, 5)
sample
matrix M = mnormal(10,2)
matrix sampled_mat = SampleMatrixWithoutReplacement(M, 5)
sampled_mat
</hansl>
5 years, 3 months
MPI problems
by Sven Schreiber
Hi,
I'm having trouble using MPI parallelization with a August 15th snapshot
on Windows 10, i7 CPU. Gretl apparently freezes, "never" comes back.
This is with the parallel_specs package (sample script), or with the
bootstrap illustration code in the gretl+MPI manual.
I will update the snapshot and see what happens, but is there some other
kind of testing code available which would give some useful output or
even diagnosis? When I start gretl, 'eval $sysinfo.mpi' tells me 1
(yes), and I have freshly installed Microsoft's MPI on this machine. So
most recent version there, 10 I think.
thanks
sven
5 years, 3 months
rolling windows volatility forecasting with HAR model
by Burak Korkusuz
Hi,I have 2000 obs. in total which is 5 minutes realised variance. I will have an HAR model (for example: ols x constant x(-1) a b) with an initial sample 1-500 obs. and I am going to forecast 501. obs. Next, I will have the initial sample 2-501 obs. and forecast 502. obs. And again initial sample 3-502 and forecast 503. obs. ... up until 2000. obs. Each time, I need to re-estimate my HAR model with initial sample and forecast next one, which is rolling windows forecasting. I could not find the codes for this purpose. Is it possible to do that in gretl? Many Thanks,
5 years, 3 months
Inspecting the (FEVD) results from SVAR model
by Yusuf Abduwahab Hassan
Good morning all,
Please i would like to know how to generate the Forecast Error Variance
Decomposition in a tabular form as against the default output that is
displayed in a graph.
Many thanks.
--
*Yusuf Abdulwahab Hassan.Department of Economics and Development
Studies.Federal University of Kashere,Gombe.+234
8036830166.yabdulwahab(a)fukashere.edu.ng <yabdulwahab(a)fukashere.edu.ng>*
5 years, 3 months
Power outage
by Riccardo (Jack) Lucchetti
* With apologies for cross-posting *
Hi everyone,
tomorrow morning there will be some work done on the power lines for the
building where our mailing list server is. Therefore, the mailing lists
are going to be down for some time; most likely, 7am - 1pm.
After that, everything should bo back to normal.
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------
5 years, 3 months
How to exploit the panel data in a SEM
by luis.salazar.ramirez
Good day for all.
I have a SEM where the structure is panel data.
I load the data in gretl, I find options to manage panel data but in the
SEM I can't find some option relative to panel data. Is Gretl
exploiting the panel data estructure already ? or I have to center the
data before to load data on, to manage fixed effect, for example?.
I will thanked much your support.
Cordially,
Luis Salazar
5 years, 3 months