Full_Name: Dominique Soudant
Version: 2.4.1
OS: Winbdows
Submission from: (NULL) (134.246.54.61)
R 2.4.1
boot 1.2-27
Let us consider the following example with 8 strata, one observation for each :
[,1]
[1,] 0.2
[2,] 0.5
[3,] 0.8
[4,] 0.2
[5,] 0.2
[6,] 1.0
[7,] 0.5
[8,] 1.0
[9,] 0.8
[10,] 1.0
Results are differents, they should be equal. I guess that the issue is coming
from the function ordinary.array() from the boot package :
ordinary.array <- function (n, R, strata)
{
output <- matrix(0, R, n)
inds <- as.integer(names(table(strata)))
for (is in inds) {
gp <- c(1:n)[strata == is]
output[, gp] <- matrix(sample(gp, R * length(gp), replace = TRUE),
nrow = R)
}
output
}
ordinary.array(8,10,1:8)
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,] 1 1 2 2 1 1 5 2
[2,] 1 1 2 2 3 3 2 5
[3,] 1 2 1 4 2 1 1 7
[4,] 1 1 3 2 5 5 3 6
[5,] 1 1 2 4 5 3 7 1
[6,] 1 2 2 4 4 6 1 8
[7,] 1 1 2 2 4 2 7 5
[8,] 1 2 3 2 3 4 1 7
[9,] 1 2 2 1 1 3 1 2
[10,] 1 1 2 4 5 1 1 5
In ordinary.array(), the issue is coming from sample() :
[quote]If x has length 1 and x >= 1, sampling takes place from 1:x[/quote]
Note that when only one strata has only one observation, the problem is
identical