Let's say that I want to examine whether rain affects the number of patients that will check in a hospital with respiratory problems. So my data looks like this:

  • Case 1: There were $\boldsymbol{n_1=100}$ days with No Rain. In each day a different number of patients were examined and diagnosed with respiratory problem, i.e.

Day 1: 5/50 patients were positive

Day 2: 0/45 patients were positive


Day 100: 3/34 patients were positive.

  • Case 2: Similarly let's say there were $\boldsymbol{n_2=30}$ days with Rain:

Day 1: 0/35 patients were positive


Day 30: 15/40 patients were positive.

I need to estimate the sample mean and variance for each different case. I first consider each day as a different random variable, in this case a binomial experiment so I can estimate the probability p:

Day x: $p_x=\frac{\text{# patients with resp problem}}{\text{# of patients examined}}$ , $var_x = \frac{p_x(1-p_x)}{\text{# of patients examined} }$

Then for the two cases (no rain/rain) I estimate the mean of all these single-day random variables: (No Rain): $\hat{\mu_1} = \frac{(p_1 + p_2 + ... + p_{100})}{100}$, $\hat{var_{1}} = \frac{1}{100^2}(var_1 + var_2 + ... + var_{100})$

(Rain): $\hat{\mu_2} = \frac{(p_1 + p_2 + ... + p_{30})}{30}$, $\hat{var_{2}} = \frac{1}{30^2}(var_1 + var_2 + ... + var_{30})$

Now I want to estimate what is the probability that the two means differ only due to chance (or in other words reject the null hypothesis that they are equal).

What's the best metric to use in this case? Should it be Welch's t-test? In that case that would correspond to

$t = \frac{\hat{\mu_1}-\hat{\mu_2}}{\sqrt{\frac{\hat{var_1}}{n_1}+\frac{\hat{var_2}}{n_2}}}$,

where $n_1=100$ and $n_2=30$? Or

$t = \frac{\hat{\mu_1}-\hat{\mu_2}}{\sqrt{\hat{var_1}+\hat{var_2}}}$,

where the division of the variances by $n_1$ and $n_2$ is omitted as I included this in the variance of the mean above? I guess I'm confused as the final samples I'm comparing are already averaged estimators of random variables.

I would be glad if you could let me know if my solution is correct and how to evaluate if the difference in the two means is statistically significant.

  • $\begingroup$ I would suggest to run a binomial regression and then examine coefficients. $\endgroup$ – Andrey Kolyadin Feb 10 '17 at 16:35
  • 1
    $\begingroup$ Why do you want to dichotomise humidity? It discards information and leads to a model which is mis-specified as you are assuming the effect is exactly the same for levels of humidity between 0 and 60 and then equal to a different effect for all values of humidity from 61 to 100. $\endgroup$ – mdewey Feb 10 '17 at 17:03
  • $\begingroup$ I changed the humidity level to Rain/No rain so that there's no confusion regarding this issue $\endgroup$ – Mark Feb 11 '17 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.