-
Notifications
You must be signed in to change notification settings - Fork 11
/
estimation.qmd
383 lines (243 loc) · 9.47 KB
/
estimation.qmd
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
# Estimation
## Probabilistic models {.scrollable}
{{< include macros.qmd >}}
---
:::{#def-model}
##### Scientific models
**Scientific models** are attempts to describe *physical conditions or changes* that occur in the world and universe around us.
:::
:::{#exm-model}
##### Scientific models in epidemiology {.scrollable}
Epidemiologists typically study *biological conditions and changes*, such as the spread of infectious diseases through populations, or the effects of environmental factors on individuals.
:::
### Statistical analysis of scientific models
When we perform statistical analyses, we use data to help us choose between models - specifically, to determine which models best explain that data.
However, physical processes do not produce data on their own. Data is only produced when scientists implement an *observation process* (i.e., a *scientific study*), which is distinct from the underlying *physical process*. In some cases, the observation process and the physical process interact with each other. This phenomenon is called the ["observer effect"](https://en.wikipedia.org/wiki/Observer_effect).
In order to learn about the physical processes we are ultimately interested in, we often need to make special considerations for the observation process that produced the data which we are analyzing. In particular, if some of the planned observations in the study design were not completed, we will likely need to account for the incompleteness of the resulting data set in our analysis. If we are not sure why some observations are incomplete, we may need to model the observation process in addition to the physical process we were originally interested in. For example, if some participants in a study dropped out part-way through the study, we may need investigate why those participants dropped out, as opposed to other participants who completed the study.
These kinds of *missing data* issues are outside of the scope of this course; see @van2018flexible for more details.
## Estimands, estimates, and estimators
### Estimands
\index{estimand}
::: {#def-estimand}
##### Estimand
An **estimand** is an unknown quantity whose value we want to know [@pohl2021estimands; @lawrance2020estimand].
:::
::: {#exm-estimand}
##### Mean height of students
If we are trying to determine the mean height of students at our school,
then the *population mean* is our **estimand**.
:::
In statistical contexts, most estimands are parameters of probabilistic
models, or functions of model parameters.
::: callout-note
##### Notation for estimands
Model paramaters and other estimands are often symbolized using
lower-case Greek letters: $\alpha, \beta, \gamma, \delta$, etc.
:::
### Estimates
\index{estimate} \index{estimated value}
::: {#def-estimate}
##### Estimate/estimated value
In statistics, an **estimate** or **estimated value** is an informed
guess of an estimand's value, based on observed data.
:::
::: {#exm-estimate}
##### Mean height of students
Suppose we measure the heights of 50 random students from our school,
and the sample mean was 175cm. We might use 175cm as an *estimate* of
the population mean.
:::
### Estimators
\index{estimator}
::: {#def-estimator}
##### Estimator
An **estimator** is a function $\hth(x_1,...x_n)$ that transforms data $x_1,...x_n$ into an estimate.
:::
::: callout-note
#### Estimators are random variables
When estimators are applied to random variables, the estimators are also random variables.
:::
::: callout-note
##### Notation for estimators
Estimators are often symbolized by placing a \^ ("hat") symbol on top of
the corresponding estimand; for example, $\hth$.
Usually, their dependence on the data is implicit:
$$\hth \eqdef \hth(x_1,...x_n)$$
:::
::: {#exm-estimator}
##### Mean height of students
If we want to estimate the mean height of students at our university,
which we will represent as $\mu$, we might measure the heights of
$n= 50$ randomly sampled students as random variables $X_1,...,X_n$.
Then we could use the function
$$\hat\mu(X_1,...,X_n) = \frac{1}{n} \sum_{i=1}^n X_i \eqdef \bar X$$
as an *estimator* to produce an *estimate* $\hat\mu = \bar x$ of $\mu$.
Another estimator would be just the height of the first student sampled:
$$\hat\mu^{(2)}(X_1,...,X_n) = X_1$$
A third possible estimator would be the mean of all sampled students'
heights, except for the two most extreme; that is, if we re-order the
observations $X_{(1)} = \min_{i\in 1:n} X_i$,
$X_{(2)} = \min_{i\in \{1:n\} - \arg X_{(1)}} X_i$, ...,
$X_{(n)} = \max_{i\in 1:n} X_i$, then we could define the estimator:
$$\hat\mu^{(3)}(X_1,...,X_n) = \frac{1}{n}\sum_{i=2}^{n-1} X_{(i)}$$
Which of these estimators is best? It depends on how we evaluate them
(see @sec-est-accuracy below).
:::
### Contrasting estimands, estimates, and estimators
It's helpful to keep in mind the mathematical type of each estimation
concept:
- estimands are numbers (or vector of numbers)
- estimates are also numbers (or vectors)
- estimators are functions of random variables, so they are also random variables
## Accuracy of estimators {#sec-est-accuracy}
### Accuracy
To determine which estimator is best, we need to define *best*.
"Accuracy" is usually most important; easy computation is usually
secondary.
::: {#def-accuracy}
##### Accuracy
The **accuracy** of an estimator for a given estimand does not have a
consensus formal definition, but all of the usual candidates are related
to the distributions of the *errors* made by the resulting estimates.
:::
### Error
::: {#def-error}
##### Error
The **error** of an estimate $\hth$ of a true value $\th$, often denoted $\eps(\hth)$, or more completely $\eps(\hth, \th)$, is the
difference between the estimate and its estimand $\theta$; that is:
$$\eps(\hth) \eqdef \hth - \th$$
:::
Some frequently-used measures of accuracy include:
### Mean squared error
::: {#def-mse}
##### Mean squared error
The **mean squared error** of an estimator $\hth$, denoted
$\mselr{\hth}$, is the expectation of the square of the error[^1]:
$$\mselr{\hth} \eqdef \E{(\err(\hth))^2}$$
:::
### Mean absolute error
::: {#def-mae}
##### Mean absolute error
The **mean absolute error** of an estimator is the expectation of the
absolute value of the error:
$$
\maelr{\hth} \eqdef \E{\abs{\err(\hth)}}
$$
:::
### Bias
::: {#def-bias}
##### Bias
The **bias** of an estimator $\hth$ for an estimand $\theta$ is the
expected value of the error:
$$\bias{\hth} \eqdef \E{\err(\hth)}$$ {#eq-bias-def}
:::
---
::: {#thm-bias-exprs}
##### Bias equals Expectation minus Truth
$$\bias{\hth} =\E{\hth} - \theta$$
:::
:::: proof
$$
\begin{aligned}
\bias{\hth}
&\eqdef \E{\err(\hth)}\\
&= \E{\hth - \theta}\\
&=\E{\hth} - \E{\theta}\\
&=\E{\hth} - \theta
\end{aligned}
$$
The third equality is by the linearity of expectation.
::::
[^1]: <https://en.wikipedia.org/wiki/Does_exactly_what_it_says_on_the_tin>
---
::: {#thm-mse-bias-variance}
##### Mean Squared Error equals Bias Squared plus Variance
For any one-dimensional estimator $\hth$:
$$\mselr{\hth} = \sqf{\bias{\hth}} + \var{\hth}$$ {#eq-mse}
:::
:::: proof
{{< include proof-mse-bias-variance.qmd >}}
::::
----
#### Unbiased estimators {#sec-unbiased-estimators}
::: {#def-unbiased}
##### unbiased estimator
An estimator $\hth$ is **unbiased** if $\bias{\hth} = 0$.
:::
::: {#thm-unbiased-props}
##### properties of unbiased estimators
If $\hth$ is unbiased, then:
$$\E{\hth} = \th$$ {#eq-unbiased-exp}
$$\mselr{\hth} = \var{\hth}$$ {#eq-unbiased-mse}
:::
:::: proof
If $\hth$ is unbiased, then:
@eq-unbiased-exp:
$$
\ba
\bias{\hth} &= 0\\
\E{\hth} - \theta &= 0\\
\E{\hth} &= \theta
\ea
$$
@eq-unbiased-mse:
$$
\ba
\mselr{\hth}
&\eqdef \E{\sqf{\eps(\hth)}}\\
&= \E{\sqf{\hth - \th}}\\
&= \E{\sqf{\hth - \E{\hth}}}\\
&\eqdef \Var{\hth}
\ea
$$
(*Alternative proof of @eq-unbiased-mse*) We could have started from
@thm-mse-bias-variance instead:
$$
\ba
\mselr{\hth}
&= \sqf{\bias{\hth}} + \var{\hth}\\
&= \sqf{0} + \var{\hth}\\
&= 0 + \var{\hth}\\
&= \var{\hth}\\
\ea
$$
::::
---
### Standard error
:::{#def-SE}
##### Standard error
The **standard error** of an estimator $\hth$ is just the [standard deviation](probability.qmd#def-sd) of $\hth$; that is:
$$\SE{\hth} \eqdef \SD{\hth}$$
:::
"Standard error" is a confusing concept in a few ways. First of all, it isn't even defined as a characteristic of the [error](#def-error), $\eps(\hth)$! Moreover, it is just a synonym for standard deviation, so it seems like a redundant concept. However, standard errors help us construct p-values and confidence intervals, so they come up a lot - often enough to give them their own name.
We can relate standard error to actual error, by rearranging the result from @thm-mse-bias-variance:
$$
\ba
\Var{\hth} &= \Var{\hth - \th}\\
&= \Var{\eps(\hth)}\\
\ea
$$
So the variance of the estimator is equal to the variance of the error, and the standard error is equal to the standard deviation of the error:
$$\SE{\hth} = \SD{\eps(\hth)}$$
---
:::{#cor-var-mse-bias}
##### Standard error squared equals MSE minus squared bias
standard error is what is left over of MSE after bias is removed:
$$\sqf{\SE{\hth}} = \mselr{\hth} - \sqf{\bias{\hth}}$$
:::
::::{.proof}
$$
\ba
\mselr{\hth} &= \sqf{\bias{\hth}} + \Var{\hth}\\
\tf \Var{\hth} &= \mselr{\hth} - \sqf{\bias{\hth}}\\
\tf \sqf{\SE{\hth}} &= \mselr{\hth} - \sqf{\bias{\hth}}\\
\ea
$$
::::
:::{#cor-se-rmse-unbiased}
##### For unbiased estimators, SE = RMSE
If $\E{\erf{\hth}} = 0$, then:
$$\SE{\hth} = \sqrt{\mselr{\hth}}$$
(this result is equivalent to @eq-unbiased-mse)
:::
---