-
Notifications
You must be signed in to change notification settings - Fork 4
/
appendix_1.Rmd
159 lines (115 loc) · 5.06 KB
/
appendix_1.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
---
title: 'Appendix 1: Lower Bound of Effective Number of Functions'
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
The minimum number of effective functions will occur at the minimum level of evenness (maximum level of dominance) for any set of functions. Conveniently, using a standardized scale for functions between 0 and 1, the maximum level any function can achieve is 1. If all functions, save one, are 0, then by definition the number of effective functions will be 1. After this, one function will be 1 and all functions save one other will be 0. As we increase $A$, this function will increase in value until it, too, is 1. At which point, as $A$ increases, a third function will begin increasing in value, etc.
Noting that $AK$, the average level of function multiplied by the total number of functions, is always just greater than the number of functions that are equal to 1, we can a quantity $G$ that is the number of functions equal to 1, and is equivalent to the floor of $AK$ (i.e., $G = \lfloor AK \rfloor$).
For any level of A, the value of the function whose value is greater than 0 but less than 1 is $AK - G$, as $AK$ is the number of functions that are 1 + the additional contribution of our non-zero other function. Therefore,
$$
\begin{equation}
\begin{aligned}
&F_{1}...F_{G} = 1 \\
&F_{G + 1} = AK - G \\
&F_{G+2}...F_{K} = 0
\end{aligned}
\end{equation}
$$
and therefore summing up all of the functions at the maximum dominance for a given level of $A$,
$$
\sum F_i = G + AK - G + 0 \\
\Rightarrow AK
$$
We can use this to determine the lower bound of the effective number of functions. Looking at $p_i$ at maximum dominance
$$
p_i = \frac{F_i}{\sum F_i} \\
\Rightarrow \frac{F_i}{AK}
$$
We can then substitute this into equation 3.
$$
^{q}N = \left[ \sum_{i=1}^{K} \left(\frac{F_{i}}{AK}\right)^q \right] ^ {1/(1-q)} \\
$$
$$
\Rightarrow \left[{\frac{1}{A^q \cdot K^{q}}} \cdot \sum_{i=1}^{K}F_{i}^q \right]^{1/(1-q)}
$$
At maximum dominance we know that
$$
\sum_{i=1}^{K}F_{i}^q = G + (AK-G)^q
$$
So that the lower bound of effective number of functions is
$$
^qN_{lower}(A) = \left[ \frac{G + (AK-G)^q}{A^qK^q} \right]^{1/(1-q)}
$$
For q=1, we can find the lower bound by taking the limit $\lim_{q \to\ 1}$, which gives us
$$
\lim_{q \to\ 1} ~ ^qN_{lower}(A) = A K (A K - G)^{\frac{G}{AK} - 1}
$$
<!-- I am not sure we need this section, perhaps just delete?-->
<!-- Alternatively, we can re-arranging the limit by substituting in for $p_i$. -->
<!-- $$ -->
<!-- \begin{equation} -->
<!-- \begin{aligned} -->
<!-- &^{1}N_{lower} = \exp\left(-\sum p_i \;\log\; p_i \right) \\ -->
<!-- &\Rightarrow \exp\left(-\sum \frac{F_i}{AK} \;\log\; \frac{F_i}{AK} \right)\\ -->
<!-- &\Rightarrow \exp\left(-\frac{1}{AK} \sum (F_i \; \log \; F_i \; - F_i\; \log \; AK) \right) \\ -->
<!-- \end{aligned} -->
<!-- \end{equation} -->
<!-- $$ -->
<!-- Taking 0 log 0 = 0 and noting that log 1 = 0, we can use our previous exploration of the three possible values for $F_i$ at maximum dominance ($AK - G$) and plug those in to the above equation to get -->
<!-- $$ -->
<!-- \begin{equation} -->
<!-- \begin{aligned} -->
<!-- &^{1}N_{lower} = \exp\left(-\frac{1}{AK} \Bigl[ (AK-G)\;\log(AK-G) - G \; \log AK - (AK-G) \;\log\; AK \Bigr] \right)\\ -->
<!-- &\Rightarrow \exp\left(\frac{G}{AK}\;\log AK + \frac{AK-G}{AK}\;\log AK - \frac{AK-G}{AK}\; \log(AK-G) \right) \\ -->
<!-- &\Rightarrow A K (A K - G)^{\frac{G}{AK} - 1} -->
<!-- \end{aligned} -->
<!-- \end{equation} -->
<!-- $$ -->
In the limiting case of $AK \to G$, the expression becomes $AK$
We can write a function in R to explore this relationship between $^qN$ and $A$.
```{r, echo = TRUE}
get_mfn_floor <- function(a, k, q){
ak <- a*k
g <- floor(a*k)
if(a == 0)
return(0)
if(q==1){
if(ak-g==0){ #Shannon case limit
#AK ^ {\frac{G}{AK}}
return(ak)
}else{ #Shannon case
#\lim_{q \to\ 1} ~ ^qN_{lower}(A) = A K (A K - G)^{\frac{G}{AK} - 1}
ret <- ak*(ak-g)^(g/ak - 1 )
}
} else{ #anything else where q > 1
#\left[ \frac{G + (AK-G)^q}{A^qK^q} \right]^{1/(1-q)}
ret <- ( (g+(ak-g)^q)/(a^q * k^q) ) ^ (1/(1-q))
}
return(ret)
}
```
We can use this function to then explore the shape of the relationship between A and possible values of $^qN$ which is reported in the text as figure 1.
```{r show_conceptual, message=FALSE, warning=FALSE}
library(dplyr)
library(tidyr)
library(ggplot2)
library(forcats)
n_func <- 4
n_range <- crossing(data.frame(a = seq(0.0001,1,length.out=200)),
data.frame(q = 1:4)) %>%
group_by(q, a) %>%
mutate(n_upper=n_func, n_lower=get_mfn_floor(a, n_func, q))
ggplot(n_range, aes(x=a, y=n_lower,
ymin = n_lower,
ymax = n_upper,
fill = fct_rev(factor(q)))) +
geom_ribbon(alpha=0.7) +
xlab("Average Level of Functioning") +
ylab("Effective Number of Functions") +
ylim(c(0,n_func)) +
scale_fill_brewer(palette="Accent") +
guides(fill=guide_legend("Order (q)")) +
theme_bw(base_size = 14)
```