This short document analyses the climate change dataset originally presented in the hyperdirichlet R package1 but using the hyper2 package instead. Lay perception of climate change is a complex and interesting process2 and here we assess the engagement of non-experts by the use of “icons” (this word is standard in this context. An icon is a “representative symbol”) that illustrate different impacts of climate change.

Here we analyse results of one experiment3, in which subjects were presented with a set of icons of climate change and asked to identify which of them they find most concerning. Six icons were used: PB [polar bears, which face extinction through loss of ice floe hunting grounds], NB [the Norfolk Broads, which flood due to intense rainfall events], L [London flooding, as a result of sea level rise], THC [the thermo-haline circulation, which may slow or stop as a result of anthropogenic modification of the water cycle], OA [oceanic acidification as a result of anthropogenic emissions of \({\mathrm C}{\mathrm O}_2\)], and WAIS [the West Antarctic Ice Sheet, which is rapidly calving as a result of climate change].

Methodological constraints dictated that each respondent could be presented with a maximum of four icons. The R idiom below (dataset icons in the package) shows the experimental results.

library("hyper2",quietly=TRUE)
M <- icons_table # saves typing
M
##       NB  L PB THC OA WAIS
##  [1,]  5  3 NA   4 NA    3
##  [2,]  3 NA  5   8 NA    2
##  [3,] NA  4  9   2 NA    1
##  [4,] 10  3 NA   3  4   NA
##  [5,]  4 NA  5   6  3   NA
##  [6,] NA  4  3   1  3   NA
##  [7,]  5  1 NA  NA  1    2
##  [8,]  5 NA  1  NA  1    1
##  [9,] NA  9  7  NA  2    0

(M is called icons_matrix in the package). Each row of M corresponds to a particular cue given to respondents. The first row, for example, means that a total of \(5+3+4+3=15\) people were shown icons NB, L, TCH, WAIS [column names of the the non-NA entries]; 5 people chose NB as most concerning, 3 chose L, and so on. The dataset is more fully described in the hyperdirichlet package.
The builtin icons likelihood function in the hyper2 package may be created by using the saffy() function:

icons
## log(L^24 * (L + NB + OA + THC)^-20 * (L + NB + OA + WAIS)^-9 * (L + NB
## + THC + WAIS)^-15 * (L + OA + PB + THC)^-11 * (L + OA + PB + WAIS)^-18
## * (L + PB + THC + WAIS)^-16 * NB^32 * (NB + OA + PB + THC)^-18 * (NB +
## OA + PB + WAIS)^-8 * (NB + PB + THC + WAIS)^-18 * OA^14 * PB^30 *
## THC^24 * WAIS^9)
icons == saffy(icons_table)  # should be TRUE
## [1] TRUE

At this point, the icons object as created above is mathematically identical to icons object in the hyperdirichlet package (and indeed the hyper2 package), but the terms might appear in a different order.

Analysis of the icons dataset

The first step is to find the maximum likelihood estimate for the icons likelihood:

options("digits" = 4)
(mic <- maxp(icons))
##      NB       L      PB     THC      OA    WAIS 
## 0.25230 0.17364 0.22458 0.17011 0.11069 0.06867
dotchart(mic,pch=16)

We also need the log-likelihood at an unconstrained maximum:

L1 <- loglik(indep(mic),icons)
L1
## [1] -175

Agreeing to 4 decimal places with the value given in the hyperdirichlet package.

The next step is to assess a number of hypotheses concerning the relative sizes of \(p_1\) through \(p_6\).

Hypothesis testing.

Below, I investigate a number of inequality hypotheses about \(p_1,\ldots, p_6\). The general analysis proceeds as follows; we can use \(H_0\colon p_1=1/6\) as an example but the method applies to any observation. I consider the general case first, then modifications for one-sided hypotheses.

As another example, consider \(H_0\colon p_1=p_2=p_3\). The vector \({\mathbf p}\in \left\{\left.\left(p_1,\ldots,p_6\right)\right| \sum p_i=1\right\}\) is a point in a 5-dimensional manifold, and \(H_0\) asserts that \({\mathbf p}\in \left\{\left.\left(p_1,p_1,p_1,p_4,p_5,p_6\right)\right| 3p_1+p_4+p_5+p_6=1\right\}\), that is, a 3-dimensional manifold. The null imposes a loss of two degrees of freedom.

The logic above operates for one-sided tests. We might observe that \(\hat{p_1}\) is the largest and wish to test a null of \(p_1\leqslant 1/6\) against an alternative of \(p_1>1/6\). Note that the one-sided p-value and likelihood ratio statistic are the same as the two-sided values.

Below I will rework some of the hypotheses tested in the hyperdirichlet package, with consistent labelling of null and alternative hypotheses, and renumbering

Equality of strengths

The most straightforward null would be the hypothesis of player equality, specifically:

\[ H_E\colon p_1=p_2=\cdots=p_n=\frac{1}{n}. \]

(“E” for equal). This was not carried out in Hankin 2010 because I had not thought of it. Testing \(H_E\) is implemented in the package as test.equalp(). Note that because \(H_E\) is a point hypothesis we would have \(n-1\) degrees of freedom (because \(H_0\) has \(n-1\) df).

equalp.test(icons)
## 
##  Constrained support maximization
## 
## data:  icons
## null hypothesis: NB = L = PB = THC = OA = WAIS
## null estimate:
##     NB      L     PB    THC     OA   WAIS 
## 0.1667 0.1667 0.1667 0.1667 0.1667 0.1667 
## (argmax, constrained optimization)
## Support for null:  -184.4 + K
## 
## alternative hypothesis:  sum p_i=1 
## alternative estimate:
##      NB       L      PB     THC      OA    WAIS 
## 0.25230 0.17364 0.22458 0.17011 0.11069 0.06867 
## (argmax, free optimization)
## Support for alternative:  -175 + K
## 
## degrees of freedom: 5
## support difference = 9.38
## p-value: 0.002131

Hypothesis 1: \(p_1 = 1/6\)

Following the analysis in Hankin 2010, and restated above, we first observe that NB [the Norfolk Broads] is the icon with the largest estimated probability with \(\hat{p_1}\simeq 0.25\) (O’Neill gives a number of theoretical reasons to expect \(p_1\) to be large). This would suggest that \(p_1\) is in fact large, in some sense, and here I show how to assess this statement statistically. Consider the hypothesis \(H_0\colon p_1=1/6\), and as per the protocol above we will try to reject it.

To that end, we perform a constrained optimization, with (active) constraint that \(p_1\leqslant 1/6\) (note that the inequality constraint allows us to use fast maxp(), which has access to derivatives). We note the support at the evaluate and then compare this support with the support at the unconstrained evaluate; if the difference in support is large then this constitutes strong evidence for \(H_A\) and then would conclude that \(p_1 > 1/6\). In package idiom, the optimization is implemented by the specificp.test() suite of functions; these work by imposing additional constraints to the maxp() function via the fcm and fcv arguments. Using the defaults we have:

specificp.test(icons,1)
## 
##  Constrained support maximization
## 
## data:  H
## null hypothesis: sum p_i=1, p_1 = 0.1667
## null estimate:
##     NB      L     PB    THC     OA   WAIS 
## 0.1667 0.1946 0.2563 0.1837 0.1225 0.0762 
## (argmax, constrained optimization)
## Support for null:  -177.6 + K
## 
## alternative hypothesis:  sum p_i=1 
## alternative estimate:
##      NB       L      PB     THC      OA    WAIS 
## 0.25230 0.17364 0.22458 0.17011 0.11069 0.06867 
## (argmax, free optimization)
## Support for alternative:  -175 + K
## 
## degrees of freedom: 1
## support difference = 2.607
## p-value: 0.02239 (two sided)

which tests a null of \(p_1\leqslant\frac{1}{6}\); see how the evaluate under the null is on the boundary and we have \(\hat{p_1}=\frac{1}{6}\). Compare the support of 2.607 with 2.608181 from the hyperdirichlet package. This exceeds Edwards’s two-units-of-support criterion; the \(p\)-value is obtained by applying Wilks’s theorem on the asymptotic distribution of 2.

Both these criteria indicate that we may reject that hypothesis that \(p_1\leqslant 1/6\) and thereby infer \(p_1>\frac{1}{6}\).

Hypothesis 2: \(p_1\geqslant\max\left(p_2,\ldots,p_6\right)\)

We observe that NB (the Norfolk Broads) has large strength, and hypothesise that it is in fact stronger than any other icon. This is another constrained likelihood maximization, although this one is not possible with convex constraints. In the language of the generic procedure given above, we would have

\[ H_0\colon (p_1\leqslant p_2)\cup (p_1\leqslant p_3)\cup (p_1\leqslant p_4)\cup (p_1\leqslant p_5)\cup (p_1\leqslant p_6) \]

\[ \overline{H_0}\colon (p_1 > p_2)\cap (p_1 > p_3)\cap (p_1 > p_4)\cap (p_1 > p_5)\cap (p_1 > p_6) \]

(although note that \(H_0\) has nonzero measure). In words, \(H_0\) states that \(p_1\) is smaller than \(p_2\), or \(p_1\) is smaller than \(p_3\), etc; while \(\overline{H_0}\) states that \(p_1\) is larger than \(p_2\), and is larger than \(p_3\), and so on. Considering the evaluate, we see that \({\mathcal L}_{H_0} < {\mathcal L}_{\overline{H_0}}\), so optimizing over \(\overline{H_0}\) is equivalent to unconstrained optimization [of course, the intrinsic constraints \(p_i\geqslant 0, \sum p_i\leqslant 1\) have to be respected]. Here, \(\overline{H_0}\) is regions of \((p_1,\ldots,p_6)\) with \(p_1\) being greater than at least one of \(p_2,\ldots,p_6\). The union of convex sets is not necessarily convex (think two-way Venn diagrams). As far as I can see, the only way to do it is to perform a sequence of five constrained optimizations: \(p_1\leqslant p_2, p_1\leqslant p_3, p_1\leqslant p_4, p_1\leqslant p_5\). The fillup constraint would be \(p_1\leqslant p_6\longrightarrow 2p_1+p_2+\ldots p_5\leqslant 1\). We then choose the largest likelihood from the five.

o <- function(Ul,Cl,startp,give=FALSE){
    small <- 1e-4  #  ensure start at an interior point
    if(missing(startp)){startp <- small*(1:5)+rep(0.1,5)}           
    out <- maxp(icons, startp=small*(1:5)+rep(0.1,5), give=TRUE, fcm=Ul,fcv=Cl)
    if(give){
        return(out)
    }else{
        return(out$value)
    }
}

p2max <- o(c(-1, 1, 0, 0, 0), 0)  # p1 <= p2
p3max <- o(c(-1, 0, 1, 0, 0), 0)  # p1 <= p3
p4max <- o(c(-1, 0, 0, 1, 0), 0)  # p1 <= p4
p5max <- o(c(-1, 0, 0, 0, 1), 0)  # p1 <= p5
p6max <- o(c(-2,-1,-1,-1,-1),-1)  # p1 <= p6 (fillup)

(the final line is different because \(p_6\) is the fillup value).

likes <- c(p2max,p3max,p4max,p5max,p6max)
likes
## [1] -175.8 -175.1 -176.0 -178.2 -181.5
ml <- max(likes) 
ml
## [1] -175.1

Thus the first element of likes corresponds to the maximum likelihood, constrained so that \(p_1\leqslant p_2\); the second element corresponds to the constraint that \(p_1\leqslant p_3\), and so on. The largest likelihood is the easiest constraint to break, in this case \(p_1\leqslant p_3\): this makes sense because \(p_3\) has the second highest MLE after \(p_1\). The extra likelihood is given by

L1-ml
## [1] 0.08417

(the hyperdirichlet package gives 0.0853 here, a suprisingly small discrepancy given the difficulties of optimizing over a nonconvex region). We conclude that there is no evidence for \(p_1\geqslant\max\left(p_2,\ldots,p_6\right)\).

It’s worth looking at the evaluate too:

o2 <- function(Ul,Cl){
  jj <-o(Ul,Cl,give=TRUE)
  out <- c(jj[[1]],1-sum(jj[[1]]),jj[[2]])
  names(out) <- c("p1","p2","p3","p4","p5","p6","support")
  return(out)
}
rbind(
o2(c(-1, 1, 0, 0, 0), 0),  # p1 <= p2
o2(c(-1, 0, 1, 0, 0), 0),  # p1 <= p3
o2(c(-1, 0, 0, 1, 0), 0),  # p1 <= p4
o2(c(-1, 0, 0, 0, 1), 0),  # p1 <= p5
o2(c(-2,-1,-1,-1,-1),-1)   # p1 <= p6
)
##          p1     p2     p3     p4     p5      p6 support
## [1,] 0.2117 0.2117 0.2264 0.1693 0.1114 0.06942  -175.8
## [2,] 0.2383 0.1739 0.2383 0.1696 0.1107 0.06912  -175.1
## [3,] 0.2091 0.1755 0.2279 0.2091 0.1099 0.06858  -176.0
## [4,] 0.1810 0.1766 0.2286 0.1651 0.1810 0.06767  -178.2
## [5,] 0.1586 0.1777 0.2325 0.1646 0.1079 0.15865  -181.5

In the above, the evaluate is the first five columns (\(p-6\) being the fillup) and the final column is the log-likelihood at the evaluate. See how the constraint is active in each line: M[1,] == M[1:5,2:6]. Also note that the largest log-likelihood is the second row: if we were to violate any of the constraints, it would be \(p_1<p_3\), consistent with the fact that \(p_3\) (polar bears) has the second highest strength, after \(p_1\).

Low frequency responses

The next hypothesis follows from the observed smallness of \(\hat{p_5}\) (ocean acidification) and \(\hat{p_6}\) (West Antarctic Ice Sheet) at 0.111 and 0.069 respectively. These two strengths correspond to “distant” concerns and O’Neill had reason to consider their sum (which she argued would be small). Thus we specify \(H_0\colon p_5+p_6\leqslant \frac{1}{3}\).

The optimizing constraint of \(p_5+p_6\geqslant\frac{1}{3}\) translates to an operational constraint of \(-p_1-p_2-p_3-p_4\geqslant-\frac{2}{3}\) (because \(p_5+p_6=1-p_1-p_2-p_3-p_4\)):

jj <- o(c(-1,-1,-1,-1,0) , -2/3, give=TRUE,start=indep((1:6)/21))$value
jj
## [1] -182.2

then the extra support is

L1-jj
## [1] 7.213

(compare 7.711396 in hyperdirichlet, not sure why the discrepancy is so large).

Final example

The final example was motivated by the fact that both the distant icons \(p_5\) and \(p_6\) had lower strength than any of the local icons \(p_1\ldots p_4\). Thus we would have \(H_0\colon\max\left\{p_5,p_6\right\}\geqslant\min\left\{p_1,p_2,p_3,p_4\right\}\). This means the null optimization is constrained so that at least one of \(\left\{p_5,p_6\right\}\) exceeds at least one of \(\left\{p_1,p_2,p_3,p_4\right\}\). So we have the union of the various possibilities:

\[ \overline{H_A}\colon \bigcup_{j\in\left\{5,6\right\}\atop k\in\left\{1,2,3,4\right\}} \left\{\left(p_1,p_2,p_3,p_4,p_5,p_6\right)\left|\sum p_i=1, p_j\geqslant p_k\right.\right\} \]

and of course \(p_6\geqslant p_2\), say, translates to \(-p_1-2p_2-p_3-p_4-p_5\geqslant -1\).

small <- 1e-4
start <- indep(c(small,small,small,small,0.5-2*small,0.5-2*small))
jj <- c(
   o(c(-1, 0, 0, 0, 1), 0,start=start),
   o(c( 0,-1, 0, 0, 1), 0,start=start),
   o(c( 0, 0,-1, 0, 1), 0,start=start),
   o(c( 0, 0, 0,-1, 1), 0,start=start),

   o(c(-2,-1,-1,-1,-1),-1,start=start),
   o(c(-1,-2,-1,-1,-1),-1,start=start),
   o(c(-1,-1,-2,-1,-1),-1,start=start),
   o(c(-1,-1,-1,-2,-1),-1,start=start)
   )
jj
## [1] -178.2 -175.9 -177.3 -175.7 -181.5 -178.0 -180.4 -177.8
max(jj)
## [1] -175.7

So the extra support is

L1-max(jj)
## [1] 0.7504

(compare hyperdirichlet which gives 3.16, not sure why the difference). We should look at the maximum value:

   o(c( 0, 0, 0,-1, 1), 0,give=TRUE,start=start)
## $par
## [1] 0.2503 0.1736 0.2243 0.1418 0.1418
## 
## $value
## [1] -175.7
## 
## $counts
## function gradient 
##      551       86 
## 
## $convergence
## [1] 0
## 
## $message
## NULL
## 
## $outer.iterations
## [1] 2
## 
## $barrier.value
## [1] 0.0001723
## 
## $likes
##  [1] -175.7 -175.7 -175.7 -175.7 -175.7 -175.9 -175.7 -175.7 -175.7 -175.7

So the evaluate is at the boundary, for \(p_4=p_5\). I have no explanation for the discrepancy between this and that in the hyperdirichlet package.


  1. RKS Hankin 2010. “A generalization of the Dirichlet distribution”, Journal of Statistical Software, 33:11

  2. SC Moser and L Dilling 2007. “Creating a climate for change: communicating climate change and facilitating social change”. Cambridge University Press

  3. S. O’Neill 2007. “An Iconic Approach to Representing Climate Change”, School of Environmental Science, University of East Anglia