Random selection

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.

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

1,773

Your Answer

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];

You must login to post answers.

Have a Specific Question?

Get a real answer from a real person

Need Support?

Get help from our friendly experts.

Try GAUSS for 14 days for FREE

See what GAUSS can do for your data

© Aptech Systems, Inc. All rights reserved.

Privacy Policy