0

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
    }
Slobodanip
  • 71
  • 7
  • I'm not sure what you are trying to do, but you might want to do a 2-sample t-test which is kind of similar. You can yield a significance value that would be useful in figuring out if the two samples are from the same distribution or not. – user1367204 Feb 09 '17 at 23:34
  • I would just sample with replacement each original sample. After each sampling I would calculate difference of means. Then I would collect these differences in 1 distribution. From this distribution it is easy to obtain CI. I am not good in R. If you wish I may post MATLAB code – zlon Feb 09 '17 at 23:44
  • Your question is more about the answer to another question rather than in independent question in its own right. What the other answer says is to resample with replacement in both populations simultaneously, and make paired differences. – Carl Feb 09 '17 at 23:48
  • Thank you for you comments. Basically, I have to 2 group of data, non-normal and that has different distribution. How can I do a test of mean difference? So, I was thinking of bootstrap to conclude in CI to see if there is any significance in the mean difference. – Slobodanip Feb 09 '17 at 23:56
  • @Carl Yes, indeed. But my question is, Can I do that with 2 group of data, that are non-parametric and have different distribution? Because in the other question, it didn't say if the 2 samples had the same distribution or not... – Slobodanip Feb 10 '17 at 00:20
  • Non-parametric data are not usually tested for difference of mean values. What you want to know put in other terms may be "Do the distributions have different locations or not?" Nor did you specify if the data is paired or not paired. The formal answer to your question is to use bootstrap. However, you may not be asking what you want to ask. Have the same distribution or not? Irrelevant, in this context, you want a 'how' not a 'what'. – Carl Feb 10 '17 at 00:35
  • I think what you need to look at is Wilcoxon signed rank sum if the data is paired and Mann-Whitney U if unpaired. Look at answers for those elsewhere on this site. – Carl Feb 10 '17 at 19:56

0 Answers0