Chapter 7 - Ulysses’ Compass

The chapter began with the problem of overfitting, a universal phenomenon by which models with more parameters fit a sample better, even when the additional parameters are meaningless. Two common tools were introduced to address overfitting: regularizing priors and estimates of out-of-sample accuracy (WAIC and PSIS). Regularizing priors reduce overfitting during estimation, and WAIC and PSIS help estimate the degree of overfitting. Practical functions compare in the rethinking package were introduced to help analyze collections of models fit to the same data. If you are after causal estimates, then these tools will mislead you. So models must be designed through some other method, not selected on the basis of out-of-sample predictive accuracy. But any causal estimate will still overfit the sample. So you always have to worry about overfitting, measuring it with WAIC/PSIS and reducing it with regularization.

Place each answer inside the code chunk (grey box). The code chunks should contain a text response or a code that completes/answers the question or activity requested. Problems are labeled Easy (E), Medium (M), and Hard(H).

Finally, upon completion, name your final output .html file as: YourName_ANLY505-Year-Semester.html and publish the assignment to your R Pubs account and submit the link to Canvas. Each question is worth 5 points.

Questions

7E1. State the three motivating criteria that define information entropy. Try to express each in your own words.

Answer: 1. Continuous. Uncertainty should be measured on a continuous scale. 2. Increasing with number of possible events. Uncertainty should increase when the number of different outcome increase. 3. Additive. Uncertainty should be additive for independent events

7E2. Suppose a coin is weighted such that, when it is tossed and lands on a table, it comes up heads 70% of the time. What is the entropy of this coin?

p <- c(0.7, 1 - 0.7)
E <- -sum(p*log(p))
E
## [1] 0.6108643

7E3. Suppose a four-sided die is loaded such that, when tossed onto a table, it shows “1” 20%, “2” 25%, “3” 25%, and “4” 30% of the time. What is the entropy of this die?

p <- c(0.2, 0.25, 0.25, 0.3)
E <- -sum(p*log(p))
E
## [1] 1.376227

7E4. Suppose another four-sided die is loaded such that it never shows “4”. The other three sides show equally often. What is the entropy of this die?

p <- c(1/3, 1/3, 1/3)
E <- -sum(p*log(p))
E
## [1] 1.098612

7M1. Write down and compare the definitions of AIC and WAIC. Which of these criteria is most general? Which assumptions are required to transform the more general criterion into a less general one?

Answer: AIC: Akaike Information Criterion. It estimates K-L Distance in theory. AIC = Dtrain + 2p = −2lppd + 2p

WAIC: Widely Applicable Information Criterion. It makes no assumption about the shape of the posterior. In a finite sample, it can disagree. In the large-sample limit, they tend to be the same. WAIC(y, Θ) = −2 􀀀 lppd − X i varθ log p(yi|θ) | {z } penaltyterm

WAIC is most general. To transform WAIC to AIC, we assume Gaussian posterior and the posterior to be either flat or overwhelmed by likelihood, and that the sample size N is much greater than the number of parameters k.

7M2. Explain the difference between model selection and model comparison. What information is lost under model selection?

Answer: The most common form of model selection among practicing scientists is to search for a model in which every coefficient is statistically significant (also called Stargazing). But this does not always helps becuase sometimes predictor variables that improve prediction are not always statistically significant. Model loses information about relative model accuracy contained in the differences among criterion values and casaul inference.

We should avoid model selection. Instead, practice model comparison by applying multiple models competing to explain.

7M3. When comparing models with an information criterion, why must all models be fit to exactly the same observations? What would happen to the information criterion values, if the models were fit to different numbers of observations? Perform some experiments, if you are not sure.

Answer: It is because deviance is the measure of model performance. It accrued over observations. If the models fit to different observations, the model fit to more observations will probably have higher deviance, seemingly less accurate. However, that inaccuracy comes from application but not from the model itself. Thus, all models need to be fit to exactly the same observations for fairness.

7M4. What happens to the effective number of parameters, as measured by PSIS or WAIC, as a prior becomes more concentrated? Why? Perform some experiments, if you are not sure.

Answer: For WAIC, as a prior becomes more concentrated, the observed likelihood will become more concentrated, resulting in decrease of the variance (pWAIC) and thus effective number of parameters.

7M5. Provide an informal explanation of why informative priors reduce overfitting.

Answer: Informative priors limit the flexibility of the model. Outliers or extreme parameter values do not have too much influence on the model and thus will not be assigned high posterior probability. Informative priors help the model not to learn too much from the extreme noises.

7M6. Provide an informal explanation of why overly informative priors result in underfitting.

Answer: While informative priors limit the model in a good way, overly informative priors will limit the model too much and does not let it learn enough from the sample data. This time, even good values lose their voice and do not get assigned high enough posterior probability. The model not learning enough results in underfitting.