3
$\begingroup$

I have a database of purchase events. Each event has a field green (a boolean field that determines whether the item was green) and a field silk that is another boolean parameter.

The proportion of an events that are silk and green is p_A = x and the proportion of events that are non silk and green is p_B = y

p_B > p_A, p_B / p_A = z

Is it safe to assume that non silk purchased items are more likely to be green than silk purchased items?

How to determine whether the difference is significant? Should I look into some kind of p-value testing?

update

After Glen_b's suggestion I realized that I had subtly confused probabilities and proportions, thus updated my question to be dealing with proportions.

$\endgroup$
0

2 Answers 2

2
$\begingroup$

I believe that your problem is simply the testing of two proportions.

You can first notice that there are two populations in your problem. The silk and non-silk populations. In this setting the question you are asking is if the proportion of green items in the silk population is significantly smaller than the proportion of green items in the non-silk population.

There is a simple answer to this question if you can assume that the observations are independent of one-another. If you are not able to ad-hoc impose the independence condition there are tests for it: https://en.wikipedia.org/wiki/Pearson%27s_chi-squared_test

Let's assume that the silk population is $\{X_1,...,X_n\}$ and that the non-silk population is $\{Y_1,...,Y_m\}$. In this notion I mean that $X_i = 1$ if the i-th observation in the silk population is green and $X_i = 0$ otherwise. The same rule applies to the $Y$'s. In this formulation the $X$'s are independent Bernoulli random variables with mean $p_X$ and the $Y$'s are also independent Bernoulli random variables with mean $p_Y$. The statistical test you want to perform is:

$$H_0: p_Y \leq p_X$$ $$H_1: p_Y > p_X$$

A test for those statistical hypothesis can be performed as follows. The proportion of green and silk items is $\bar X =\frac{\sum_{i = 1}^{n}X_i}{n}$ and the proportion of green and non-silk items is $\bar Y =\frac{\sum_{i = 1}^{m}Y_i}{m}$. Than under fairly simple conditions,

$$T = \frac{\bar Y - \bar X}{\sqrt{p^*(1-p^*)(\frac{1}{n}+\frac{1}{m})}}$$

where $p^* = \frac{\sum_{i-1}^nX_i + \sum_{i-1}^mY_i}{n+m}$, has approximately a normal distribution with mean 0 and variance 1.

You can reject $H_0$ if $T$ is greater than the critical value related to the level of significance of your choice.

This http://www.dummies.com/how-to/content/how-to-compare-two-population-proportions.html might be useful.

$\endgroup$
1
$\begingroup$

I think I have an answer for you, but first I'd like to restate the problem just to make the notation easier on me.

The Question Restated

We have some set of events $E$ such that the probability of an event to be silk and green is $P(S,G|E)$ and the probability of an event to be non-silk and green is $P(\neg S,G|E)$. We know that $P(\neg S,G|E)>P(S,G|E)$. We wish to know if the probability of purchased, non-silk items being green $P(G|\neg S,E)$ is greater than the probability of purchased, silk items $P(G|S,E)$.

Analytic approach

Let's express what we want in terms of what we have:
$$ P(G|S,E) P(S|E) = P(G,S|E)$$ $$ P(G|\neg S,E) P(\neg S|E) = P(G,\neg S|E)$$ $$ P(G,\neg S|E) >P(G,S|E) \rightarrow P(G|\neg S,E) P(\neg S|E)>P(G|S,E) P(S|E)$$ As you can see we can not make a comparison between the two without having the probability of something being silk or non-silk given an event.

Say you had this information (I assume you do!) you would then be in a position to determine the likelihood this set of observations arose out of chance or not as well as evaluate how much that matters. You probably would want Fisher's exact test or Barnard's Test.

Someone correct if I'm wrong on the tests.

$\endgroup$
1
  • $\begingroup$ Can I assume the probability of an item being silk to be equal to P(S|E) = total_amount_of_silk_items / total_amount_of_sold_items? after a suggestion I updated my question to talk about proportions and not probabilities but I assume we are still talking about the same concept. In comparison with the other answer I guess this is considered the analytics approach while the answer above is covering the statistics? $\endgroup$ Commented Jun 22, 2016 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.