# Form hypothesis and test it using given data

In country A, during the ten-year period $2002 - 2012$ judges sentenced convicts to the death penalty 45 times. In contrast, the number of such penalties in 2013 was $19$ and in $2014$ it was $4$. An analyst claimed that the evident change in the rate of conviction is not statistically significant because of the sample.

I am trying to formulate a possible hypothesis that the analyst might have had in mind, given ONLY these data, and carry out a test to check whether or not the result is statistically significant. My idea for the hypothesis was the following:

\begin{align*} H_0&: \mu_{x \le 2012} = \mu_{x > 2012} \\ H_1&: \mu_{x \le 2012} < \mu_{x > 2012} \end{align*} where $\mu_{x \le 2012}$ denotes the average annual number of convictions up to $2012$ and $\mu_{x > 2012}$ denotes the average annual number of prosecutions from $2012$ onwards.

Assuming that this is a reasonable hypothesis, I am thinking of computing the likelihood ratio statistic and then proceeding from there. However, that statistic requires me to compute the likelihood function under the null and divide it by the maximum of the likelihood function under the full model. How is am I to approach this since I am not given anything about the distribution of the observations? Any suggestions will be greatly appreciated, especially ones regarding the correctness of the stated hypothesis.

The simplest approach that I can think of that is theoretically valid would be to assume that these convictions are generated by a Poisson process - meaning that each death sentence is a rare event, independent of other death sentences and that the probability distribution for the time between two such sentences is given by the exponential distribution.

With that, you can simply estimate the $\lambda$:s for the three different time periods and calculate the confidence intervals for the sample means.

2002-2012 (assuming it is a 10-year period as you said, and not 11):

$\widehat{\lambda} = \frac{45} {10} = 4.5$, with a 95% confidence interval of $\widehat{\lambda} ~ \pm ~ \sqrt{\widehat{\lambda}} \approx 4.5 \pm 0.67$

2013:

$\widehat{\lambda} = \frac{19} {1} = 19$, with a 95% confidence interval of $\widehat{\lambda} ~ \pm ~ \sqrt{\widehat{\lambda}} \approx 19 \pm 4.36$

2014:

$\widehat{\lambda} = \frac{4} {1} = 4$, with a 95% confidence interval of $\widehat{\lambda} ~ \pm ~ \sqrt{\widehat{\lambda}} = 4 \pm 2$

(Note: the confidence intervals assume that the number of events is "great" and that the probability distribution for $\widehat{\lambda}$ can therefore be approximated with the normal distribution. This assumption does not hold very well for the 2014 time period)

You can then do pairwise comparisons. If you wish to check whether e.g. 2013 in particular stands out, then treat 2002-2012 and 2014 as a single 11-year period with 49 sentences. Clearly, the number of sentences in 2013 stand out as exceptional.

Let me suggest a different approach that is simpler and relies on fewer assumptions than Heitz Chi Square approach.

Going back to your data set, you essentially have a time series of annual death penalties running from 2002 to 2014. And, except for 2013 in the other years the average is about 4 per year. Now, 2013 is very different at 19 in that year. Your hypothesis really should be is whether the 19 occurence in 2013 is statistically significant or not. The easiest way to do this is by using linear regression. For it to be interactive, I propose doing it with LINEST in Excel. To investigate whether 2013 figure is statistically significant, we can structure our linear regression in two different ways.

Both regressions will have the same dependent variable structure. We know the exact figures from 2012 to 2014. And, for the earlier years we know they sum up to 45. So, you can enter a bunch of annual figures with a bit of variation (let's say between 2 and 6) as long as they sum up to 45.

In the first regression, you will use three regressors: 1) Intercept; 2) a Trend variable (1, 2, 3,...); and 3) a dummy variable for 2013 (1 in 2013 and 0 in all other years). Within this first regression, you will see that the 2013 dummy variable comes in with a very high value at around 15. This makes perfect sense because at 19, it is 15 units higher than the average of the other years around 4. And, the same 2013 dummy variable comes with a very high t stat of close to 12, meaning it is very statistically significant (any t stat > 3 is already very statistically significant).

In the second regression, you replicate the first regression except you do not use a 2013 dummy variable. In this case, you will calculate the residuals of this regression and subsequently the standardized residuals of this regression. Next, you observe how much of an outlier is 2013 by looking at its standardized residual or Z value. In my case, the residual was - 11.8 and the standardized residuals was -38.3. Any standardized residual whose absolute value is greater than 3 denotes a very statistically significant outlier.

Both regression methods fully confirm that the year 2013 is extraordinary and way above the norm or trend rate as depicted by all the other years.

By conducting your regression using LINEST you will see that the values you assign to 2002 to 2012 do not affect your outcome of the statistical significance of 2013. You will get slightly different results than mine. However, directionally your results will match mine. 2013 again is a very statistically significant extraordinary year compared to the other years in the data.

Given the number of data points you have, I think the above approach will be far more conclusive and robust than using a standard multiple group hypothesis testing approach like ANOVA or its nonparametrics equivalents. That's because those approaches will not work well with one category that has only 2 data points or maybe even just one depending on how you segment your data (in 2 or 3 different groups). The linear regression approach entirely circumvented this problem.

• Nice approach Sympa. – HEITZ Nov 28 '16 at 23:53

I fit a robust Poisson model to the 3 data points that you have, adjusting for the number of years in each:

. clear

. input t years y

t      years          y
1. 1 10 45
2. 2 1 19
3. 3 1  4
4. end

. label define period 1 "2002-2012" 2 "2013" 3 "2014"

. lab val t period

. poisson y ib1.t, exp(years) robust nolog

Poisson regression                              Number of obs     =          3
Wald chi2(0)      =          .
Prob > chi2       =          .
Log pseudolikelihood = -6.8525416               Pseudo R2         =     0.6208

------------------------------------------------------------------------------
|               Robust
y |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
t |
2013  |   1.440362   3.86e-11  3.7e+10   0.000     1.440362    1.440362
2014  |   -.117783   2.27e-10 -5.2e+08   0.000     -.117783    -.117783
|
_cons |   1.504077   1.93e-16  7.8e+15   0.000     1.504077    1.504077
ln(years) |          1  (exposure)
------------------------------------------------------------------------------


The coefficients on 2013 and 2014 are significant, suggesting 2013 is above the 2002-2012 average and 2014 is below it. You can exponentiate them to get the multiplicative effect on the baseline.

There are several layers to this onion.

First off, let me play devil's advocate and assume I am the analyst and took at quick look at these data. You have 3 time spans, 2002-2012 (45), 2013 (19), and 2014 (4). Converting to a yearly rate, the 2002-2012 time span had 4.09/year (45/11), so comparing that to the 4 recorded death penalties in 2014, I might conclude off the bat that save for 2013, the yearly rate hasn't changed.

But let's move on. There are a few ways to attack this problem, but in each you have some unknowns that need addressing. You suggest going the likelihood ratio route, in which case you need to specify the nature of the distributions, but I think this problem can be addressed with chi-square. In fact, your H0 and H1 as stated seems to anticipate this, as you are reducing everything to a contingency table (<=2012 vs > 2012). I will proceed with the assumption that the 2012 cut-off is adequate and call them the 'old' and 'new' time spans for convenience.

What you'd need to do next is figure out what you are comparing this death penalty to, and we'll have to make some assumptions. You might want to compare the rates for new and old versus population in country A. For present purposes, I will instead assume that exactly 20 people per year are convicted of a crime potentially punishable by death penalty, but receive a lesser penalty (say, life in prison or something).

Lets create a contingency table. Note that I've converted the 45 for the old period to 4.09/year, then rounded down to 4 for convenience. For the new period, you actually have (19+4)/2 = 11.5, which I also round to 12 for convenience. Despite the simplification, the point should be clear.

Next, I assume that 20 people/year have death-penalty eligible convictions, which I add to the contingency table. You could use some other value too, but you'd have to correct the previous entries as well. E.g., rate per capita, rate per 1000 people, etc.

With this toy example set, we can then compute the chi-square, which I won't do by hand, but here is some sloppy R code that computes it.

x1 = data.frame(status=rep('Death',4),year='old')
x2 = data.frame(status=rep('Death',12),year='new')
x3 = data.frame(status=rep('No Death',20),year='old')
x4 = data.frame(status=rep('No Death',20),year='new')
x = rbind(x1,x2,x3,x4)
chisq.test(table(x),correct = FALSE)


The test does not attain conventional (p<.05) significance, suggesting that you retain the null hypothesis that there is no difference between the 'old' and 'new' periods. But, of course half the contingency table is fabricated.

Is your hypothesis reasonable? It might be, provided that you really don't have access to the yearly data, and are limited only to 2002-2012, 2013, 2014. If you do have access to the yearly data, simplifying like this doesn't make sense.