systematic: returns a systematic exploration of a vector

Description Usage Arguments Details Value Examples

View source: R/f0.rbsb1.code.r

Description

returns a vector of indices of x such that this is explored in systematic way by nb draws, spaced of kk according to its order.
Even is ord is not "random", a call to sample is done so it is advised to call first set.seed.

Usage

1
systematic(x, nb, kk, ord="random")

Arguments

x

The vector to systematically sample.

nb

desired number of draws.

kk

frequency of successive draws. Something giving quasi-uniform draw is is min(length(x)-1,length(x)% /% (nb% % length(x))) ???notice that the direct application of this formula failed for rounding phenomenum???.

ord

indicates which type of ordering must be done on the output: randor for a circular random permutation; random for a complete random permutation; order for a sorting with sort; such for nothing (in that case, it depends on the algorithm which can be

Details

When nb*kk is less than length(x) then the sequence is 1, kk+1, 2*kk+1,..., (nb-1)*kk+1 taking into account the ordered order of values of x. If not either look at the code or experiment the function.

Value

A vector of length nb of indices of x.

Examples

1
2
3
4
5
6
7
8
9
 rbsb3k("reset"); # only necessary for R checking
 systematic(1:20, 5, 1);
 systematic(1:20, 5, 3);
 systematic(1:20, 15, 3);
 systematic(1:20, 15, 3, "order");
 systematic(1:20, 15, 3, "random");
 sort(systematic(1:20, 55, 3));
 uu <- c(2*(1:10), 1+2*(0:9));
 uu[systematic(uu, 20, 3)];

rbsb documentation built on May 2, 2019, 4:41 p.m.

Related to systematic in rbsb...