## 12.6 Problems

1. Fit the intercept only model from section 12.2.1. Set the burn-in to 3, and when the model completes, plot the time series of the parameter u for the first MCMC chain.

1. Based on your visual inspection, has the MCMC chain convered?

2. What is the ACF of the first MCMC chain?

2. Increase the MCMC burn-in for the model in question 1 to a value that you think is reasonable. After the model has converged, calculate the Gelman-Rubin diagnostic for the fitted model object.

3. Compare the results of the plotModelOutput() function for the intercept only model from section 12.2.1. You will to add “predY” to your JAGS model and to the list of parameters to monitor, and re-run the model.

4. Plot the posterior distribution of $$b$$ for the AR(1) model in section 12.2.4. Can this parameter be well estimated for this dataset?

5. Plot the posteriors for the process and observation variances (not standard deviation) for the univariate state-space model in section 12.2.6. Which is larger for this dataset?

6. Add the effect of temperature to the AR(1) model in section 12.2.4. Plot the posterior for C and compare to the posterior for C from the model in section 12.2.2.

7. Plot the fitted values from the model in section 12.5, including the forecasts, with the 95% credible intervals for each data point.

8. The following is a dataset from the Upper Skagit River (Puget Sound, 1952-2005) on salmon spawners and recruits:

Spawners <- c(2662, 1806, 1707, 1339, 1686, 2220, 3121, 5028,
9263, 4567, 1850, 3353, 2836, 3961, 4624, 3262, 3898, 3039,
5966, 5931, 7346, 4911, 3116, 3185, 5590, 2485, 2987, 3829,
4921, 2348, 1932, 3151, 2306, 1686, 4584, 2635, 2339, 1454,
3705, 1510, 1331, 942, 884, 666, 1521, 409, 2388, 1043, 3262,
2606, 4866, 1161, 3070, 3320)
Recruits <- c(12741, 15618, 23675, 37710, 62260, 32725, 8659,
28101, 17054, 29885, 33047, 20059, 35192, 11006, 48154, 35829,
46231, 32405, 20782, 21340, 58392, 21553, 27528, 28246, 35163,
15419, 16276, 32946, 11075, 16909, 22359, 8022, 16445, 2912,
17642, 2929, 7554, 3047, 3488, 577, 4511, 1478, 3283, 1633,
8536, 7019, 3947, 2789, 4606, 3545, 4421, 1289, 6416, 3647)
logRS <- log(Recruits/Spawners)
1. Fit the following Ricker model to these data using the following linear form of this model with normally distributed errors:
$\begin{equation*} log(R_t/S_t) = a + b \times S_t + e_t,\text{ where } e_t \sim \,\text{N}(0,\sigma^2) \end{equation*}$ You will recognize that this form is exactly the same as linear regression, with independent errors (very similar to the intercept only model of Wind we fit in section 12.2.1).

2. Within the constraints of the Ricker model, think about other ways you might want to treat the errors. The basic model described above has independent errors that are not correlated in time. Approaches to analyzing this dataset might involve

• modeling the errors as independent (as described above)

• modeling the errors as autocorrelated

• fitting a state-space model, with independent or correlated process errors

Fit each of these models, and compare their performance (either using their predictive ability, or forecasting ability).