Hi:
You could always create a matrix of nCd combinations of size d from n =
length(data) and apply your delete-d jackknife to that. Here's a simple
version for delete-2:

# data vector
> u <- rnorm(10)
> library(combinat)

Attaching package: 'combinat'

The following object(s) are masked from 'package:utils':

    combn
# matrix of all combinations of size 2 from 1:10
> combn(10, 2)
     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
[1,]    1    1    1    1    1    1    1    1    1     2     2     2     2
[2,]    2    3    4    5    6    7    8    9   10     3     4     5     6
     [,14] [,15] [,16] [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24] [,25]
[1,]     2     2     2     2     3     3     3     3     3     3     3     4
[2,]     7     8     9    10     4     5     6     7     8     9    10     5
     [,26] [,27] [,28] [,29] [,30] [,31] [,32] [,33] [,34] [,35] [,36] [,37]
[1,]     4     4     4     4     4     5     5     5     5     5     6     6
[2,]     6     7     8     9    10     6     7     8     9    10     7     8
     [,38] [,39] [,40] [,41] [,42] [,43] [,44] [,45]
[1,]     6     6     7     7     7     8     8     9
[2,]     9    10     8     9    10     9    10    10

# The function below operates on a single column of the above matrix.
# It removes the elements of u corresponding to the indices in each column
# of the matrix above and then computes the average. You can always
# write an external function to pass to apply() for your case.

> apply(combn(10, 2), 2, function(x) mean(u[-x]))
 [1]  0.278856785  0.251338791  0.022794855  0.161130397  0.012826789
 [6]  0.054276157  0.033911398  0.079530314 -0.039614651  0.364950962
[11]  0.136407026  0.274742569  0.126438960  0.167888328  0.147523569
[16]  0.193142486  0.073997521  0.108889032  0.247224574  0.098920966
[21]  0.140370334  0.120005575  0.165624491  0.046479526  0.018680639
[26] -0.129622970 -0.088173602 -0.108538361 -0.062919445 -0.182064410
[31]  0.008712573  0.050161940  0.029797182  0.075416098 -0.043728867
[36] -0.098141668 -0.118506427 -0.072887511 -0.192032476 -0.077057059
[41] -0.031438143 -0.150583108 -0.051802902 -0.170947867 -0.125328950

It shouldn't be that hard to wrap this up into a function.

HTH,
Dennis

On Wed, Nov 24, 2010 at 5:03 PM, ufuk beyaztas <[email protected]>wrote:

>
> Hi dear all,
> Can aynone help me about delete-d jackknife
> usually normal jackknife code for my data is:
> n <- nrow(data)
> y <- data$y
> z <- data$z
> theta.hat <- mean(y) / mean(z)
> print (theta.hat)
>
> theta.jack <- numeric(n)
> for (i in 1:n)
> theta.jack[i] <- mean(y[-i]) / mean(z[-i])
> bias <- (n - 1) * (mean(theta.jack) - theta.hat)
>
> print(bias)
>
> but how i can apply delete-d jackknife when d=2 or 3.
> Thanks forany idea..
> --
> View this message in context:
> http://r.789695.n4.nabble.com/delete-d-jackknife-tp3058335p3058335.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [email protected] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to