# Fitting a fixed, exponential relationship between categories with categorical data

Suppose I have a table of counts that look like this

            A    B     C
Success  1261  230  3514
Failure   381  161  4012


I have a hypothesis that there is some probability $p$ such that $P(Success_A) = p^i$, $P(Success_B) = p^j$ and $P(Success_C) = p^k$.

Is there some way to produce estimates for $p$, $i$, $j$ and $k$? The idea I have is to iteratively try values for $p$ between 0 and 1, and values for $i$, $j$ and $k$ between 1 and 5. Given the column totals, I could produce expected values, then calculate $\chi^2$ or $G^2$.

This would produce a best fit, but it wouldn't give any confidence interval for any of the values. It's also not particularly computationally efficient.

As a side question, if I wanted to test the goodness of fit of a particular set of values for $i$, $j$ and $k$ (specifically 1, 2, and 3), once I've calculated $\chi^2$ or $G^2$, I'd want to calculate significance on the $\chi^2$ distribution with 1 degree of freedom, correct? This isn't a normal contingency table since relationship of each column to the others is fixed to a single value. Given $p$, $i$, $j$ and $k$, filling in a single value in a cell fixes what the values of the other cells must be.

• Do i, j, k have to be integers? In general you have an unidentifiable model (that is the solution is not unique) because if you let p2=p^i, then p^j=p2^j2, where j2=j/i. Aug 4 '10 at 21:45
• I think to demonstrate non-identifiability you have to show that the likelihood is invariant to a transformation of parameters. I am not sure if what you did is sufficient to demonstrate lack of identification.
– user28
Aug 4 '10 at 22:50
• @Srikant Vadali I just did. Replace p^i with p, j with j/i and k with k/i and you get the exact same probabilities as an output with a different set of parameters (unless i=1 - with that constraint the model is identifiable). Aug 5 '10 at 3:08
• @Aniko Perhaps, I am missing something here. But, when I substituted the two sets of parameters into the likelihood function that I suggested they are not identical (assuming that I did not make any errors which is always possible).
– user28
Aug 5 '10 at 10:26

Following up on my comment, this question would be very simple if i, j, and k were not restricted to be integers. The reason is as follows: pA, pB, and pC denote the observed probability of success in the three groups. Then let p=pA, i=1, j=log(pB)/log(pA), and k=log(pC)/log(pA). These will easily satisfy the required conditions (except for j and k being between 1 and 5, but that looks like an ad-hoc simplifying assumption instead of a real constraint). In fact, if you do this with the given data, you get j=2.009 and k=2.884 which I think prompted the original question.

It is even possible to get standard errors for these quantities (or rather their logarithm). Note that if pB = p^j, then log(-log(pB)) = log(j) + log(-log(p)), so one can use logistic regression with a complimentary log-log link for the number of failures (the complimentary log-log function is log(-log(1-x)) and this link is built in for most statitical software such as R or SAS). Then one could check whether the 95% CIs include integers, or perhaps run a likelihood-ratio (or other) test comparing the fit of the unrestricted model to one where j and k are rounded to the nearest integer.

The above assumes that i=1. Something similar could probably be done for other integer i's (probably by having an offset of log(i) in the model - I have not thought it through).

In the end, I want to note that you should make sure that your hypothesis is meaningful by itself, and did not come from playing with the data. Otherwise any statistical test is biased because you picked a form of the null hypothesis (out all the possible weird forms that you could have imagined) that is likely to fit.

You could write the likelihood function like so:

$L(p,i,j,k|-) \propto (p^i)^{1261} (1-p^i)^{381} (p^j)^{230} (1-p^j)^{161} (p^k)^{3514} (1-p^k)^{4012}$

Maximize the above likelihood function to estimate your parameters. Constructing confidence intervals and hypothesis testing should be straight forward once you have the estimates.