To help us understand and report the effect of the smooth term in GAM, several packages return some “general” parameters about the smooth term, besides the information related to each K component. This is the case for mgcv and gamm4, but also brms, returning a variance parameter representing the “wiggliness” of the smooth and the linear part of the spline:
BRMS
model <- brms::brm(Petal.Length ~ s(Petal.Width), data=iris)
summary(model)
Family: gaussian
Links: mu = identity; sigma = identity
Formula: Petal.Length ~ s(Petal.Width)
Data: iris (Number of observations: 150)
Samples: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
total post-warmup samples = 4000
Smooth Terms:
Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
sds(sPetal.Width_1) 1.74 0.76 0.68 3.64 1038 1.00
Population-Level Effects:
Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
Intercept 3.76 0.03 3.70 3.82 4482 1.00
sPetal.Width_1 0.30 0.51 -0.78 1.26 1901 1.00
Family Specific Parameters:
Estimate Est.Error l-95% CI u-95% CI Eff.Sample Rhat
sigma 0.38 0.02 0.34 0.43 3706 1.00
Samples were drawn using sampling(NUTS). For each parameter, Eff.Sample
is a crude measure of effective sample size, and Rhat is the potential
scale reduction factor on split chains (at convergence, Rhat = 1).
Compared to this, rstanarm provides the information for each K components, with two smooth_sd
parameters.
rstanarm
model <- rstanarm::stan_gamm4(Petal.Length ~ s(Petal.Width), data=iris)
summary(model)
Model Info:
function: stan_gamm4
family: gaussian [identity]
formula: Petal.Length ~ s(Petal.Width)
algorithm: sampling
priors: see help('prior_summary')
sample: 4000 (posterior sample size)
observations: 150
Estimates:
mean sd 2.5% 25% 50% 75% 97.5%
(Intercept) 3.8 0.0 3.7 3.7 3.8 3.8 3.8
s(Petal.Width).1 -0.3 1.1 -2.7 -1.0 -0.3 0.4 1.7
s(Petal.Width).2 -0.4 1.0 -2.5 -1.0 -0.3 0.3 1.6
s(Petal.Width).3 -0.1 0.9 -1.7 -0.7 -0.2 0.4 1.6
s(Petal.Width).4 1.3 0.9 -0.4 0.6 1.2 1.9 3.3
s(Petal.Width).5 1.1 0.8 -0.5 0.6 1.1 1.6 2.7
s(Petal.Width).6 0.8 0.4 0.1 0.5 0.8 1.1 1.6
s(Petal.Width).7 -2.2 0.2 -2.6 -2.4 -2.2 -2.1 -1.7
s(Petal.Width).8 -0.5 0.7 -1.8 -0.9 -0.5 0.0 0.8
s(Petal.Width).9 0.2 0.6 -0.7 -0.1 0.0 0.3 1.7
sigma 0.4 0.0 0.3 0.4 0.4 0.4 0.4
smooth_sd[s(Petal.Width)1] 1.2 0.3 0.7 1.0 1.2 1.4 2.1
smooth_sd[s(Petal.Width)2] 0.4 0.4 0.0 0.1 0.3 0.6 1.5
mean_PPD 3.8 0.0 3.7 3.7 3.8 3.8 3.8
log-posterior -91.2 2.8 -97.7 -92.9 -90.9 -89.2 -86.7
Is it possible to access/compute the general parameters of smooth in rstanarm? Thanks a lot