Skip to content

Commit

Permalink
update time-varying vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Clark committed Oct 24, 2024
1 parent 1df1949 commit ee881ab
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 56 deletions.
89 changes: 40 additions & 49 deletions docs/articles/time_varying_effects.html

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 11 additions & 7 deletions vignettes/time_varying_effects.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -198,18 +198,20 @@ plot_mvgam_series(data = model_data, y = 'survival')
mod0 <- mvgam(formula = survival ~ 1,
trend_model = AR(),
noncentred = TRUE,
priors = prior(normal(-3.5, 0.5), class = Intercept),
family = betar(),
data = model_data,
silent = 2)
```

```{r eval = FALSE}
mod0 <- mvgam(formula = survival ~ 1,
trend_model = AR(),
noncentred = TRUE,
family = betar(),
data = model_data,
silent = 2)
trend_model = AR(),
noncentred = TRUE,
priors = prior(normal(-3.5, 0.5), class = Intercept),
family = betar(),
data = model_data,
silent = 2)
```

The summary of this model shows good behaviour of the Hamiltonian Monte Carlo sampler and provides useful summaries on the Beta observation model parameters:
Expand All @@ -226,9 +228,10 @@ plot(mod0, type = 'trend')
Now we can increase the complexity of our model by constructing and fitting a State-Space model with a time-varying effect of the coastal upwelling index in addition to the autoregressive dynamics. We again use a Beta observation model to capture the restrictions of our proportional observations, but this time will include a `dynamic()` effect of `CUI.apr` in the latent process model. We do not specify the $\rho$ parameter, instead opting to estimate it using a Hilbert space approximate GP:
```{r include=FALSE}
mod1 <- mvgam(formula = survival ~ 1,
trend_formula = ~ dynamic(CUI.apr, k = 25, scale = FALSE),
trend_formula = ~ dynamic(CUI.apr, k = 25, scale = FALSE) - 1,
trend_model = AR(),
noncentred = TRUE,
priors = prior(normal(-3.5, 0.5), class = Intercept),
family = betar(),
data = model_data,
adapt_delta = 0.99,
Expand All @@ -237,9 +240,10 @@ mod1 <- mvgam(formula = survival ~ 1,

```{r eval=FALSE}
mod1 <- mvgam(formula = survival ~ 1,
trend_formula = ~ dynamic(CUI.apr, k = 25, scale = FALSE),
trend_formula = ~ dynamic(CUI.apr, k = 25, scale = FALSE) - 1,
trend_model = AR(),
noncentred = TRUE,
priors = prior(normal(-3.5, 0.5), class = Intercept),
family = betar(),
data = model_data,
silent = 2)
Expand Down

0 comments on commit ee881ab

Please sign in to comment.