Resources

Random selection

0

How do i resample my data with replacement for bootstrapping in Gauss? Like if y={1  2  3} and x = { 2  4  6}. To select randomly 10 times resampled data.

asked April 5, 2014

1 Answer

0

The first step to drawing a random sample from your data is to create random integers between 1 and the number of observations of your data. This link shows how to create a random integer in GAUSS. Next you use the random integers as indices into your data. Take a draw from your data with an indexing operation. For example:

my_data = { 72,
            31,
            24,
            47,
            82,
            19,
            54,
            67,
            88,
            27 };
num_per_draw = 3;

//Create random integers between 1-10
rndm_indices = ceil(rows(my_data) * rndu(num_per_draw, 1));

//Pull random sample
first_draw = my_data[rndm_indices];
aptech
352