On Tue, 17 Sep 2019, Allin Cottrell wrote:
On Tue, 17 Sep 2019, Sven Schreiber wrote:
> Am 16.09.2019 um 23:23 schrieb Artur Tarassow:
>>
>> 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 haven't looked very carefully what the functions do, but somehow I
> have the feeling that a combination of the functions randgen(u...),
> selifr() and uniq() -or perhaps just resample() and uniq()- might do the
> job.
Perhaps relevant, from the help on "smpl":
<quote>
With the --random flag, the specified number of cases are selected
from the current dataset at random (without replacement). If you wish
to be able to replicate this selection you should set the seed for the
random number generator first (see the set command).
</quote>
Actually, I was thinking that it's a shame that argument 2 in the
"resample" function is already taken (I hear you, Sven, named arguments...
;)). It would have been nice to have a Boolean flag for the "with/without
resampling" choice.
-------------------------------------------------------
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
-------------------------------------------------------