Thank you for your help, David. I was trying to run bootrapping on the
dataset "shoes" from MASS package. But I still have some problem here.
as.matrix(data.frame(shoes),nrows=10,ncols=2,byrow=T)
A B
[1,] 13.2 14.0
[2,] 8.2 8.8
[3,] 10.9 11.2
[4,] 14.3 14.2
[5,] 10.7 11.8
[6,] 6.6 6.4
[7,] 9.5 9.8
[8,] 10.8 11.3
[9,] 8.8 9.3
[10,] 13.3 13.6
y=as.matrix(data.frame(shoes),nrows=10,ncols=2,byrow=T)
class(y)
[1] 0.8 0.6 0.3 -0.1 1.1 -0.2 0.3 0.5 0.5 0.3
dif.mns <- function(x2,tr1=.1,tr2=.2){
+ diffs=apply(x2,1,diff)
+ mn1=mean(diffs)
+ mn2=mean(diffs,tr=.1)
+ mn3=mean(diffs,tr=.2)
+ mn4=median(diffs)
+ mns=c(mn1,mn2,mn3,mn4)
+ list(mnds=round(mns,3))}
$mnds
[1] 0.410 0.400 0.417 0.400
bootstrap(y,nboot=1000,theta=dif.mns)