Page 254 - Computational Statistics Handbook with MATLAB
P. 254
242 Computational Statistics Handbook with MATLAB
% Store as temporary vector:
gpat = gpa;
lsatt = lsat;
% Leave i-th point out:
gpat(i) = [];
lsatt(i) = [];
% Get correlation coefficient:
% In this example, we want off-diagonal element.
tmp = corrcoef(gpat,lsatt);
reps(i) = tmp(1,2);
end
mureps = mean(reps);
sehat = sqrt((n-1)/n*sum((reps-mureps).^2));
% Get the estimate of the bias:
biashat = (n-1)*(mureps-T);
Our estimate of the standard error of the sample correlation coefficient is
ˆ ˆ
SE Jack ρ() = 0.14 ,
and our estimate of the bias is
ˆ ˆ
Bias Jack ρ() = – 0.0065 .
This data set will be explored further in the exercises.
Example 7.5
We provide a MATLAB function called csjack that implements the jack-
knife procedure. This will work with any MATLAB function that takes the
random sample as the argument and returns a statistic. This function can be
one that comes with MATLAB, such as mean or var, or it can be one written
by the user. We illustrate its use with a user-written function called corr that
returns the single correlation coefficient between two univariate random
variables.
function r = corr(data)
% This function returns the single correlation
% coefficient between two variables.
tmp = corrcoef(data);
r = tmp(1,2);
The data used in this example are taken from Hand, et al. [1994]. They were
originally from Anscombe [1973], where they were created to illustrate the
point that even though an observed value of a statistic is the same for data
sets ρ =( ˆ 0.82) , that does not tell the entire story. He also used them to show
© 2002 by Chapman & Hall/CRC