treatment control 10 5 15 9 16 10 16 10 17 14 19 18 20 20Macro Code: Store as Randomize.MAC in the folder where the Minitab file is saved. Execute by typing %Randomize. Stacked data is stored in column c3.
GMACRO Randomize DO k1 = 1:1000 Sample 7 c3 c5; Replace. Sample 7 c3 c6; Replace. let c8(k1) = mean(c5) - mean(c6) ENDDO ENDMACRO
R code:
treatment = c(10, 15, 16, 16, 17, 19, 20)
control = c(5, 9, 10, 10, 14, 18, 20)
mean(treatment) - mean(control)
pooled = append(treatment, control)
bootstrap = array(0, dim=c(1000))
for(k in 1:1000){
new_treat = sample(pooled, 7, replace=TRUE)
new_control = sample(pooled, 7, replace=TRUE)
bootstrap[k] = mean(new_treat) - mean(new_control)
}
bootstrap[order(bootstrap)]