# Bootstrap: How to do a Confidence interval for the difference of two means? (Different sample distributions) [duplicate]

Can I apply a bootstrap from 2 samples that have different non-parametric distributions to get their mean difference?

Can I do that with 2 group of data, that are non-parametric and have different distribution? Because in the other questionexample, it didn't say if the 2 samples had the same distribution or not.

EDIT:

I'm trying to do it with this code, but my concern is that I don't know if I can do it on this case. (2 non-parametric distribution that are different)

Code:

    bt <- function(data1,data2,n){
btr<<- c()
for(i in 1:n) {
m1 <- mean(sample(data1,length(data1), replace=TRUE, prob=NULL))
m2 <- mean(sample(data2,length(data2), replace=TRUE, prob=NULL))
btr[i] <<- m1-m2
}
quantile(btr, .500) # median
quantile(btr, .025) # 2.5th percentile
quantile(btr, .975) # 97.5th percentile
}