Consulting

Results 1 to 4 of 4

Thread: Bootstrapping-Random sampling with replacement

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Tutor
    Joined
    Jul 2015
    Posts
    212
    Location

    Bootstrapping-Random sampling with replacement

    On sheet '40%' of the attachment I want to place a macro trigger button. This trigger would action the following:
    1/ Sort all the data rows in a random order (apart from rows 1 & 2 )
    2/ Count the number of randomly sorted rows and calculate 60% of the row count. In the attachment it would be 60% of 28 rows = 17 rows (rounded)
    3/ Copy the first 17 rows and paste into Sheet1
    4/End of macro.

    Now I can record this but have come up with two problems that my limited knowledge of vba can't solve?
    1/The total number of rows on the '40%' worksheet varies, so the reference needs to be dynamic.
    2/ I've had no success in randomly mixing up the data with a trigger.

    The concept is to take a set of historical data, take a 60% sample of it all mixed up and not in time order, this sample then goes to a pivot table for further analysis, but along with other runs of the same sampling, to generate an unbiased total sample, for analysis going forward.

    Cheers and Happy Holidays to all.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •