[R] boot with different sample sizes
Rui Barradas
ruipbarradas at sapo.pt
Thu Mar 21 00:35:23 CET 2013
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:
> 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
>
>> 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,y,d){
> + return(sum(x) - sum(y))
> + }
>> b=boot(red blue, test1 ,R=10)
> Error: unexpected symbol in "b=boot(red blue"
>
>
>
More information about the R-help
mailing list