# Calculation of confidence interval for relative difference using bootstrap

I want to calculate confidence interval for relative difference using bootstrap. I have two sample $s_a$ and $s_b$ from two difference populations $P_A$ and $P_B$ respectively. I used relative difference to compare mean value of two samples from the following formula:

$relative\_difference = \frac{m_a -m_b}{\frac{m_a+m_b}{2}}$

which $m_a$ and $m_b$ are the mean of samples $s_a$ and $s_b$ respectively.

Then I calculate confidence interval using bootstrap samples (1000 re-sampling of original samples with replacement) as follows:

$m\_s_a\_vector = \lbrace m^*_{a1}, m^*_{a2}, ... ,m^*_{a1000} \rbrace$ which is vector of mean value of 1000 samples of $s_a$

$m\_s_b\_vector = \lbrace m^*_{b1}, m^*_{b2}, ... ,m^*_{b1000} \rbrace$ which is vector of mean value of 1000 samples of $s_b$

$relative\_difference\_vector = \lbrace \frac{m^*_{a1} -m^*_{b1}}{\frac{m^*_{a1}+m^*_{b1}}{2}}, \frac{m^*_{a2} -m^*_{b2}}{\frac{m^*_{a2}+m^*_{b2}}{2}}, ... , \frac{m^*_{a1000} -m^*_{b1000}}{\frac{m^*_{a1000}+m^*_{b1000}}{2}} \rbrace$

$Confiedence\_Lower = 5^{th} quantile relative\_difference\_vector$

$Confiedence\_Upper = 95^{th} quantile relative\_difference\_vector$

Using this approach I observed big ranges for confidence intervals, and I am not sure whether it is due to my confidence interval approach, or it is related to some characteristics in data such as large variations.

I was wondering if this approach is correct for identifying confidence interval for relative difference of two non_normal samples, paralytically for samples with high variations.

Thanks so much.

• Everything looks okay. So your data has such CI – zlon Mar 2 '17 at 20:11
• @zion Is there any other way that I can calculate confidence interval for relative difference between two sample populations? I have feeling that since my data has lot of zero values and the relative difference is so sensitive about the change between two populations and therefore I have got big range for confidence interval for random bootstrap samples. It is interesting that the data with more none-zero values has smaller range for confidence interval. I am thinking that probably I have to calculate confidence interval for relative difference using difference approach. – Mohsen Laali Mar 2 '17 at 23:50