Relatively simple problem, but can't see how to solve it. Rephrasing in terms of everyday events.

Assume there is a fair in town for three days. Each day the total visitors are known, and so are their demographics. Any number of individual people can attend across multiple days.

\begin{array} {|r|r|r|r|r|} \hline \text{Attendance} & \text{Young} & \text{Middle} & \text{Old} & \text{Total}\\ \hline \text{Day 1} & 914 & 815 & 279 & 2008\\ \hline \text{Day 2} & 906 & 633 & 547 & 2086 \\ \hline \text{Day 3} & 958 & 127 & 98 & 1183\\ \hline \text{Total} & 2778 & 1575 & 924 & 5277\\ \hline \end{array}

Within the fair you can visit tents or activities for the day. Assume you can only choose one activity each day. The demographic composition of those who attended the same activity as Person X for each day is:

\begin{array} {|r|r|r|r|r|} \hline \text{Attendance} & \text{Young} & \text{Middle} & \text{Old} & \text{Total}\\ \hline \text{Activity on Day 1} & 27 & 49 & 116 & 192\\ \hline \text{Activity on Day 2} & 12 & 81 & 189 & 282 \\ \hline \text{Activity on Day 3} & 20 & 47 & 92 & 159\\ \hline \text{Total} & 59 & 177 & 397 & 633\\ \hline \end{array}

Notice that Young visited the fair more than any other demographic, but person X attended more Old-specific activities; especially Day 3 where 92 out of 98 of Old did the same activity as Person X.

  • Taking into account all known information, how can we determine the probability person X is each demographic?

  • How would this be modified if Person X chooses not to attend a specific day? (e.g. if Person X is 'Old', not attending 'Young Day'). Non-attendance may also give information. In this case, by not attending he may be more likely not to be Young. (As a possible counterexample: What if Young Day had large Young attendance, but was a small percent of total population of Young, but all 10 Old people in the town showed up.)


The recipe for solving any statistical problem is:

  1. Enumerate all variables.
  2. Write down the joint distribution of all variables, including observations, either as a formula or a generative process.
  3. Use Bayes' rule to get the distribution of all unknowns conditioned on data.
  4. Marginalize out the variables that are not of interest.

Let $d$ range over days and $g$ range over demographic groups. In this problem, the variables are: \begin{align} n_g &= \mbox{the number of people in group $g$ that could attend on any given day} \\ n_{gd} &= \mbox{the number of people in group $g$ attending day $d$} \\ a_{d} &= \mbox{the activity chosen by person X on day $d$} \\ c_{gd} &= \mbox{the number of people in group $g$ choosing activity $a_{d}$ on day $d$} \\ g_x &= \mbox{the group of person X} \\ t_d &= \mbox{indicates whether person X attended on day $d$} \end{align} The question doesn't specify any generative model. The simplest option is to assume that people independently choose to attend, and independently choose an activity. This leads to a binomial distribution for the counts: $$ n_{gd} \sim \mathrm{Binomial}(n_g, u_{gd}) \\ c_{gd} \sim \mathrm{Binomial}(n_{gd}, v_{gd}) $$ where $u_{gd}$ and $v_{gd}$ are parameters. $u_{gd}$ represents the probability of a person in group $g$ attending day $d$. $v_{gd}$ represents the probability of a person in group $g$ choosing activity $a_{d}$ on day $d$. If $D$ represents all of the data and $D_{-x}$ is all the data except for person X, then the conditional distribution of interest is $$ p(g_x=g | D) \propto p(g_x=g) \int_{(u,v)} p(u,v|D_{-x}) \prod_d (u_{gd} v_{gd})^{t_d} (1-u_{gd})^{1-t_d} du dv $$ Note this includes the possiblity that person X doesn't attend certain days. Since there is a lot of data, if the priors are weak then $p(u,v|D_{-x})$ can be approximated as a point mass on the MLE, so the integral disappears and we just substitute the following values: $$ u_{gd} \approx n_{gd}/n_g \\ v_{gd} \approx c_{gd}/n_{gd} $$

  • $\begingroup$ Thank you! This is a great answer. One quick question in relation the conditional distribution equation: In this set-up is P(g_x=g) = n_g / sum(n_g) ? $\endgroup$ – sheppa28 Nov 10 '14 at 16:48
  • $\begingroup$ It depends how Person X is chosen. Your formula applies to the case where Person X is chosen randomly among all people that could attend. This is different from choosing Person X among all people that did attend. $\endgroup$ – Tom Minka Nov 10 '14 at 18:01
  • $\begingroup$ Since u_gd and v_gd are multiplied within the likelihood the n_gd terms cancel. So does mean it only depends on the population that could attend for each demographic (n_g), and those who attended a specific activity (c_gd)? It seems the actual composition of the fair itself each day does not matter. Is that correct? Thank you. $\endgroup$ – sheppa28 Dec 30 '14 at 16:18

Your Answer

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

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