| update.mvgam | R Documentation |
This function allows a previously fitted mvgam model to be updated.
## S3 method for class 'mvgam'
update(
object,
formula,
trend_formula,
knots,
trend_knots,
trend_model,
family,
share_obs_params,
data,
newdata,
trend_map,
use_lv,
n_lv,
priors,
chains,
burnin,
samples,
threads,
algorithm,
lfo = FALSE,
...
)
## S3 method for class 'jsdgam'
update(
object,
formula,
factor_formula,
knots,
factor_knots,
data,
newdata,
n_lv,
family,
share_obs_params,
priors,
chains,
burnin,
samples,
threads,
algorithm,
lfo = FALSE,
...
)
object |
|
formula |
Optional new |
trend_formula |
An optional Important notes:
|
knots |
An optional |
trend_knots |
As for |
trend_model |
Available options:
Additional features:
|
family |
Supported families:
See |
share_obs_params |
|
data |
A Required columns for most models:
Special cases:
|
newdata |
Optional |
trend_map |
Optional Required structure:
Notes:
|
use_lv |
|
n_lv |
|
priors |
An optional |
chains |
|
burnin |
|
samples |
|
threads |
|
algorithm |
Character string naming the estimation approach:
Can be set globally via |
lfo |
|
... |
Other arguments to be passed to |
factor_formula |
Optional new |
factor_knots |
An optional |
A list object of class mvgam containing model output,
the text representation of the model file, the mgcv model output (for
easily generating simulations at unsampled covariate values), Dunn-Smyth
residuals for each outcome variable and key information needed for other
functions in the package. See mvgam-class for details. Use
methods(class = "mvgam") for an overview on available methods.
A list object of class mvgam containing model output,
the text representation of the model file, the mgcv model output (for
easily generating simulations at unsampled covariate values), Dunn-Smyth
residuals for each series and key information needed for other functions in
the package. See mvgam-class for details. Use
methods(class = "mvgam") for an overview on available methods.
Nicholas J Clark
## Not run:
# Simulate some data and fit a Poisson AR1 model
simdat <- sim_mvgam(n_series = 1, trend_model = AR())
mod <- mvgam(
y ~ s(season, bs = 'cc'),
trend_model = AR(),
noncentred = TRUE,
data = simdat$data_train,
chains = 2
)
summary(mod)
conditional_effects(mod, type = 'link')
# Update to an AR2 model
updated_mod <- update(
mod,
trend_model = AR(p = 2),
noncentred = TRUE
)
summary(updated_mod)
conditional_effects(updated_mod, type = 'link')
# Now update to a Binomial AR1 by adding information on trials
# requires that we supply newdata that contains the 'trials' variable
simdat$data_train$trials <- max(simdat$data_train$y) + 15
updated_mod <- update(
mod,
formula = cbind(y, trials) ~ s(season, bs = 'cc'),
noncentred = TRUE,
data = simdat$data_train,
family = binomial()
)
summary(updated_mod)
conditional_effects(updated_mod, type = 'link')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.