Displaying 1 result from an estimated 1 matches for "delete_block_sums".
2007 Dec 31
0
Optimize jackknife code
...to delete
# the jacknife block has size N-k
total_sum=sum(O);
for (k in 1:2) {
N_B = length(O) %/% k;
N = N_B*k; # truncate data size to multiple of k
# data beyond O[N] is not used
#total_sum = sum(O[1:N]) # truncate data size N (which is a multiple of k)
delete_block_sums = rep(0, N_B);
for (i in 1:N_B)
{
# calculate indizes of the block boundaries
a = 1+k*(i-1);
b = k*i;
# sum of block to delete
delete_block_sums[i] = sum(O[a:b]);
}
v = (total_sum - delete_block_sums) / (N-k)
# The...