Resampling to do this well use resampling that is we

This preview shows page 4 - 7 out of 14 pages.

1.22. ResamplingTo do this, we’ll use resampling. That is, we won’t exactly simulate the observations the RAFwould have really seen. Rather we sample from our current sample, or "resample."Why does that make any sense?
Question 2.1Write a function calledsimulate_resample. It should generate a resample from
4
Question 2.2Which of the following statements are true?1. The resample can contain serial numbers that are not in the original sample.2. The original sample can contain serial numbers that are not in the resample.3. The resample has either zero, one, or more than one copy of each serial number.4. The original sample has exactly one copy of each serial number.Assigntrue_statementsto an array of the number(s) corresponding to correct statements.[36]:true_statements=make_array(2,3,4)[37]:ok.grade("q2_2");~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Running tests---------------------------------------------------------------------Test summaryPassed: 1Failed: 0[ooooooooook] 100.0% passedNow let’s write a function to do many resamples at once.Since resampling from a sample looks just like sampling from a population, the code shouldlook almost the same. That means we can write a function that simulates the process of either sam-pling from a population or resampling from a sample. If we pass in population as its argument, itwill do the former; if we pass in a sample, it will do the latter.
5
Question 2.3Write a function calledsample_estimates.It should take 4 arguments:1.serial_num_tbl: A table from which the data should be sampled. The table will have one columnnamedserial number. 2.sample_size: The size of each sample from that table, an integer.- For example, to bootstrap, we would pass in the number of rows in the table. 3.statistic:Afunctionthat takes in an array of serial numbers as its argument and computes a statistic from

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture