Returns estimated coefficient functions/surfaces \(\beta(t), \beta(s,t)\) and estimated smooth effects \(f(z), f(x,z)\) or \(f(x, z, t)\) and their point-wise estimated standard errors. Not implemented for smooths in more than 3 dimensions.
# S3 method for pffr
coef(
object,
raw = FALSE,
se = TRUE,
freq = FALSE,
sandwich = c("cluster", "cl2", "hc", "none"),
seWithMean = TRUE,
n1 = 100,
n2 = 40,
n3 = 20,
ci = c("none", "pointwise", "simultaneous"),
level = 0.95,
n_sim = 2000,
sim_seed = NULL,
...
)If raw==FALSE, a list containing
pterms a matrix containing the parametric / non-functional coefficients (and, optionally, their se's)
smterms a named list with one entry for each smooth term in the model. Each entry contains
coef a matrix giving the grid values over the covariates, the estimated effect (and, optionally, the se's).
The first covariate varies the fastest.
x, y, z the unique gridpoints used to evaluate the smooth/coefficient function/coefficient surface
xlim, ylim, zlim the extent of the x/y/z-axes
xlab, ylab, zlab the names of the covariates for the x/y/z-axes
dim the dimensionality of the effect
main the label of the smooth term (a short label, same as the one used in summary.pffr)
If ci != "none", the returned matrices include columns lower
and upper. The returned list also includes ci_meta with CI
settings.
a fitted pffr-object
logical, defaults to FALSE. If TRUE, the function simply returns object$coefficients
logical, defaults to TRUE. Return estimated standard error of the estimates?
logical, defaults to FALSE. If FALSE, use Bayesian posterior covariance for
variability estimates: object$Vc if available (includes correction for smoothing
parameter uncertainty), otherwise object$Vp. If TRUE, use frequentist
covariance object$Ve. See gamObject.
Type of sandwich-corrected covariance for standard errors.
"cluster" (default): cluster-robust sandwich (clustering by
curve).
"cl2": leverage-adjusted cluster-robust sandwich (clustering by
curve).
"hc": observation-level HC sandwich via vcov.gam.
"none": use model's default covariance.
If the model was fitted with a matching sandwich type, the pre-computed
covariance matrices are used directly.
logical, defaults to TRUE. Include uncertainty about the intercept/overall mean in standard errors returned for smooth components?
see below
see below
n1, n2, n3 give the number of gridpoints for 1-/2-/3-dimensional smooth terms
used in the marginal equidistant grids over the range of the covariates at which the estimated effects are evaluated.
Type of confidence intervals to return in addition to standard
errors. One of "none" (default), "pointwise", or
"simultaneous".
Confidence level for confidence intervals, defaults to
0.95.
Number of simulations for simultaneous intervals, defaults to
2000. Ignored unless ci = "simultaneous".
Optional integer seed for simultaneous interval simulation.
other arguments, not used.
Fabian Scheipl
The seWithMean-option corresponds to the "iterms"-option in predict.gam.
The sandwich-option computes robust standard errors. With
sandwich="cluster", a cluster-robust sandwich (clustering by curve)
is used, which handles both heteroskedasticity and within-curve correlation.
With sandwich="cl2", a leverage-adjusted cluster-robust sandwich
(Bell-McCaffrey style CL2) is used.
With sandwich="hc", mgcv's observation-level HC sandwich is used.
If the model was fitted with a matching sandwich option in
pffr, the pre-computed covariance matrices are used directly.
plot.gam, predict.gam which this routine is
based on.