View source: R/methods_generic.R
| predict.tulpa_fit | R Documentation |
Prediction of the linear predictor at newdata, on the link or response
scale. The fixed-effect part is X beta with credible bounds from the
fixed-effect covariance (vcov()). For a fit carrying a continuous spatial
field, the posterior-mean field is interpolated (kriged) to the newdata
coordinates and added to the linear predictor by default, so predict()
gives the conditional (location-specific) prediction. Three continuous field
families are supported: an SPDE Matern field (spatial_spde()), projected
through the mesh; a Hilbert-space GP field (spatial_gp(approx = "hsgp")),
where the Laplacian basis is re-evaluated at the new coordinates (with the
training centring / boundary); and a GP / NNGP field (spatial_gp()),
interpolated by the NNGP conditional mean at each new location's nearest
training locations. The HSGP and GP/NNGP fields are marginalised over the
hyperparameter grid (not plugged in at the posterior mean). Ordinary random
effects are held at zero (population level); add group effects from ranef()
when needed. An areal (ICAR / BYM2 / CAR) or temporal (RW1 / RW2 / AR1) field
is held at zero in the same way, at the training design too; the in-sample
linear predictor with every fitted component is what posterior_predict()
draws and what compare_models(criterion = "waic") / "loo" score.
## S3 method for class 'tulpa_fit'
predict(
object,
newdata = NULL,
type = c("link", "response"),
se.fit = FALSE,
level = 0.95,
include_field = TRUE,
...
)
object |
A |
newdata |
Data frame of covariates (and, for an SPDE fit, the coordinate
columns named in the spec's coordinate formula). If |
type |
|
se.fit |
If |
level |
Credible-interval level (default 0.95). |
include_field |
For a continuous-spatial fit (SPDE, HSGP, or GP/NNGP),
add the kriged field to the prediction (default |
... |
Ignored. |
If se.fit = FALSE, a numeric vector. If se.fit = TRUE, a data
frame with fit, se.fit (link scale), lower, upper on the requested
scale.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.