February 22, 2013 --- Class 13 --- Statistical Analsis with Mathematica,
Biased Estimators (continued), Bias Reducation and the Jackknife Method
Activities:
We went back to the problem of the random walk and showed how
Mathematica can make many random walks of a specific length and
we showed that the variance of the final position is N^2 where
N is the length of the walk. We use Histogram, Mean and Variance
functions in Mathematica. We also used Length[ list ] to avoid
having to count how long the last is to get the last element.
This is covered in Sec. G of the Mathematica handout.
Biased Esimators (continued)
We continued our discussion of biased estimators by applying
the work we did in the last class to teach Mathematica to
do multiple integrals.
Without waiting too long, we were able to get up to a sample size of 6;
however, this result still shows significant bias.
We also used Mathematica to do larger sample sizes with a numerical
technique.
Several Mathematica notebooks contain examples of the commands
used: ~sg/Documents/feb16_v1.nb , ~sg/Documents/feb16_v2.nb and
~sg/Documents/October_10_2006.nb .
We plotted the values obtained for different samples sizes vs
1/(sample size) and found that the curve was linearly approaching
2 as 1/(sample size) approaches zero.
Bias reduction
Recognizing that a plot of the result vs. 1/n shows the error is
linear in 1/n, where n is the sample size:
S_n = A +e/n
where A is the limit of n -> infinity and e determines the size of
the error. Considering samples sizes n and n-1, it is easy to
solve for A.
A = n S_n - (n-1) S_{n-1}
The jackknife method allows us to resample our n values to also
get samples of size (n-1). If we have a sample of size n, we use
it to compute the statistic S_n. Instead of getting a new sample
with n-1 new variables, we throw one of the values out of our
sample of size n to create a sample of size n-1 and use that to
compute S_{n-1}. However, we can throw any of the values out, so
we might as well take the average over throwing out each of the n
values. Let
S'^j_{n-1}
represent the statistic on the sample of size n-1 from which the jth
element has been eliminated. Our estimate for S_{n-1} is
(1/n) \sum_{j=1}^n S'^j_{n-1}
Biased Estimators and the Jackknife method
A program ~sg/jackknife/jackknife.c implements the jackknife method
of bias reduction. The jackknife program can take up to two
arguments. The first is the sample size, the second, optional
argument, is the number of samples to create. On each line of
output is the sample estimate of 1/(sum of x_i), and the jackknife
value (which is corrected for bias). We examined the code an how
it implements the formulae displayed on the board.
In our next class, we will run the code for different sample sizes.