So I am a a bit confused here. My test is simple, I have a control population and a treatment population. The treatment population is shown an image before answering a yes/no question and the control population is not shown any image. So my data is something like this:
sample_id | date | control_or_treatment | response |
---|---|---|---|
1 | 12/25/2020 | control | 1 |
2 | 12/25/2020 | treatment | 0 |
3 | 12/25/2020 | control | 1 |
4 | 12/25/2020 | control | 0 |
5 | 12/25/2020 | control | 1 |
where each sample_id is unique and response=1 corresponds to a Y and response=0 corresponds to a N response.
I am running a simple independent t test in python to compare their means, something like:
stats.ttest_ind(treatment_df['response'],control_df['response'])
To get the p-value and see if I can reject $H_{0}$. But I thought I could also aggregate my table into something like:
date | control_or_treatment | y_responses | sessions_per_day | y_responses_per_session |
---|---|---|---|---|
12/25/2020 | control | 10 | 20 | 0.50 |
12/25/2020 | treatment | 7 | 15 | 0.47 |
12/26/2020 | control | 22 | 35 | 0.63 |
12/26/2020 | treatment | 18 | 25 | 0.72 |
and then similar to before, run something like this:
stats.ttest_ind(treatment_df['y_responses_per_session'],control_df['y_responses_per_session'])
And my assumption was that both would be equivalent but it turns out they are not. What information am I losing in the aggregation that renders the results from the daily aggregation different from the raw results? I thought I was comparing the same mean in both: number of Y responses per session.
EDIT: Is this even an appropriate application of hypothesis testing? There is no sample here, I have the entire historical population. What we are trying to establish is, for future customers should we keep showing the image before asking the question or not show the image if the ultimate goal is to get more Y responses.