Bootstrapping to compare two groups

后端 未结 3 1348
不思量自难忘°
不思量自难忘° 2021-01-13 09:47

In the following code I use bootstrapping to calculate the C.I. and the p-value under the null hypothesis that two different fertilizers applied to tomato plants have no eff

3条回答
  •  太阳男子
    2021-01-13 10:14

    Following John, I think the appropriate way to use bootstrap to test if the sums of these two different populations are significantly different is as follows:

    x <- c(1.4,2.3,2.9,1.5,1.1)
    y <- c(23.7,26.6,28.5,14.2,17.9,24.3)
    
    
    b_x <- boot(x, sum, R = 10000)
    b_y <- boot(y, sum, R = 10000)
    
    z<-(b_x$t0-b_y$t0)/sqrt(var(b_x$t[,1])+var(b_y$t[,1]))
    pnorm(z)
    

    So we can clearly reject the null that they are the same population. I may have missed a degree of freedom adjustment, I am not sure how bootstrapping works in that regard, but such an adjustment will not change your results drastically.

提交回复
热议问题