Skip to content

boot with different sample sizes

2 messages · paolo brunori, Rui Barradas

#
Dear all,
a question about the package boot: is it possible to bootstrap a 
function of arguments of different length? is there an alternative package?
below an example of a simple try,

many thanks
paolo
+ 	return(sum(x) - sum(y))
+ 	}
Error: unexpected symbol in "b=boot(red blue"
#
Hello,

The second argument to your function must be a "vector of indices", like 
the manual page for ?boot says.
And you were missing a comma. That's what the error message was saying.



library(boot)
blue<-c(4, 3, 4, 1, 2, 3, 1)
red<-c(4, 3, 4, 1, 2, 3, 1, 2, 3, 1, 3, 2)

test1<-function(x, d, y){
      return(sum(x[d]) - sum(y))
}
b <- boot(red, test1, R=10, y = blue)
b
sum(red) - sum(blue)


Hope this helps,

Rui Barradas

Em 20-03-2013 22:49, paolo brunori escreveu: