These functions take a fitted mvgam or jsdgam object and
return various useful summaries
Arguments
- object
listobject returned frommvgam- include_betas
Logical. Print a summary that includes posterior summaries of all linear predictor beta coefficients (including spline coefficients)? Defaults to
TRUEbut useFALSEfor a more concise summary- smooth_test
Logical. Compute estimated degrees of freedom and approximate p-values for smooth terms? Defaults to
TRUE, but users may wish to set toFALSEfor complex models with many smooth or random effect terms- digits
The number of significant digits for printing out the summary; defaults to
2.- ...
Ignored
- summarise
logical. Summaries of coefficients will be returned ifTRUE. Otherwise the full posterior distribution will be returned
Value
For summary.mvgam, an object of class mvgam_summary containing:
model_spec: Model specification details (formulas, family, dimensions)parameters: Parameter estimates and significance testsdiagnostics: MCMC convergence diagnosticssampling_info: Sampling algorithm details
For summary.mvgam_prefit, a list is printed on-screen showing
the model specifications
For coef.mvgam, either a matrix of posterior coefficient
distributions (if summarise == FALSE or data.frame of
coefficient summaries)
Details
summary.mvgam and summary.mvgam_prefit return brief summaries of
the model's call, along with posterior intervals for some of the key
parameters in the model. Note that some smooths have extra penalties on the
null space, so summaries for the rho parameters may include more
penalty terms than the number of smooths in the original model formula.
Approximate p-values for smooth terms are also returned, with methods used
for their calculation following those used for mgcv equivalents (see
summary.gam for details). The Estimated Degrees of
Freedom (edf) for smooth terms is computed using either edf.type = 1 for
models with no trend component, or edf.type = 0 for models with trend
components. These are described in the documentation for
jagam. Experiments suggest these p-values tend to be
more conservative than those that might be returned from an equivalent model
fit with summary.gam using method = 'REML'
coef.mvgam returns either summaries or full posterior estimates for GAM
component coefficients
Examples
# \donttest{
simdat <- sim_mvgam(seasonality = "hierarchical")
mod <- mvgam(
y ~ series +
s(season, bs = "cc", k = 6) +
s(season, series, bs = "fs", k = 4),
data = simdat$data_train,
chains = 2,
silent = 2
)
#> Warning: model has repeated 1-d smooths of same variable.
#> Warning: model has repeated 1-d smooths of same variable.
#> Warning: model has repeated 1-d smooths of same variable.
mod_summary <- summary(mod)
mod_summary
#> GAM formula:
#> y ~ series + s(season, bs = "cc", k = 6) + s(season, series,
#> bs = "fs", k = 4)
#> <environment: 0x561c03abdd68>
#>
#> Family:
#> poisson
#>
#> Link function:
#> log
#>
#> Trend model:
#> None
#>
#> N series:
#> 3
#>
#> N timepoints:
#> 75
#>
#> Status:
#> Fitted using Stan
#> 2 chains, each with iter = 1000; warmup = 500; thin = 1
#> Total post-warmup draws = 1000
#>
#> GAM coefficient (beta) estimates:
#> 2.5% 50% 97.5% Rhat n_eff
#> (Intercept) -1.900 -0.3800 2.000 1.00 254
#> seriesseries_2 -2.400 0.7600 2.600 1.00 324
#> seriesseries_3 -1.700 1.0000 2.900 1.00 367
#> s(season).1 -1.800 -1.3000 -0.720 1.00 282
#> s(season).2 0.330 0.7700 2.000 1.01 109
#> s(season).3 0.110 0.6000 1.800 1.00 121
#> s(season).4 0.079 0.4600 0.920 1.00 273
#> s(season,series).1 -0.200 0.0900 0.710 1.00 180
#> s(season,series).2 -0.860 -0.1900 0.037 1.00 101
#> s(season,series).3 -1.300 0.2900 2.700 1.00 263
#> s(season,series).4 -0.210 0.0083 0.350 1.00 322
#> s(season,series).5 -0.590 -0.0730 0.200 1.00 319
#> s(season,series).6 -0.640 -0.0720 0.130 1.01 112
#> s(season,series).7 -2.700 -0.0920 1.900 1.00 355
#> s(season,series).8 -0.220 -0.0110 0.200 1.01 345
#> s(season,series).9 -0.340 0.0082 0.410 1.00 266
#> s(season,series).10 -0.600 -0.0037 0.210 1.01 115
#> s(season,series).11 -2.500 -0.0070 2.300 1.00 241
#> s(season,series).12 -0.190 0.0130 0.290 1.02 214
#>
#> Approximate significance of GAM smooths:
#> edf Ref.df Chi.sq p-value
#> s(season) 3.708 4 62.223 1.33e-05 ***
#> s(season,series) 5.160 12 9.786 0.998
#> ---
#> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#>
#> Stan MCMC diagnostics:
#> ✔ No issues with effective samples per iteration
#> ✔ Rhat looks good for all parameters
#> ✔ No issues with divergences
#> ✔ No issues with maximum tree depth
#>
#> Samples were drawn using sampling(hmc). For each parameter, n_eff is a
#> crude measure of effective sample size, and Rhat is the potential scale
#> reduction factor on split MCMC chains (at convergence, Rhat = 1)
#>
#> Use how_to_cite() to get started describing this model
# }
