Implement bootstrap mean and variance
Problem Statement
Implement a function that estimates the sampling distribution of the mean for a given array of N numeric values using bootstrap resampling.
Function Requirements
The function must accept two inputs:
- An array of
Nnumeric values. - An integer
B, representing the number of bootstrap resamples to perform.
For each of the B resamples, the function should:
- Draw
Nobservations with replacement from the original input array. - Compute the mean of this newly resampled array.
Finally, the function must return a data structure containing:
- The bootstrap estimate of the mean of the sample mean.
- The bootstrap estimate of the variance of the sample mean.
Constraints and Assumptions
- The input array is guaranteed to fit entirely within memory.
- The use of any built-in bootstrap utility functions is strictly prohibited; the implementation must be from scratch.
AI interview prep
Core dilemma
Balancing computational efficiency and statistical correctness in a simulation involving repeated random sampling and aggregation.
3 tradeoffs and 3 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Implement bootstrap mean and variance
Problem Statement
Implement a function that estimates the sampling distribution of the mean for a given array of N numeric values using bootstrap resampling.
Function Requirements
The function must accept two inputs:
- An array of
Nnumeric values. - An integer
B, representing the number of bootstrap resamples to perform.
For each of the B resamples, the function should:
- Draw
Nobservations with replacement from the original input array. - Compute the mean of this newly resampled array.
Finally, the function must return a data structure containing:
- The bootstrap estimate of the mean of the sample mean.
- The bootstrap estimate of the variance of the sample mean.
Constraints and Assumptions
- The input array is guaranteed to fit entirely within memory.
- The use of any built-in bootstrap utility functions is strictly prohibited; the implementation must be from scratch.