When newdata is NULL, returns the in-sample fitted values.
Otherwise estimates the local coefficients at each new location with
GWmodel::gwr.basic(regression.points = ), with the fit's kernel and
bandwidth (an adaptive bandwidth counts neighbours among the training
points), and returns \(x^\top\hat\beta(u)\). These are the
values GWmodel::gwr.predict() returns, without its prediction
variance, which this method never returned and which costs time cubic in
the number of training points. Each location stands alone: one that cannot
be estimated does not affect the others.
newdata is first transformed to the CRS used during fitting
(via ensure_projected()), so predictions are computed in a
single coordinate system regardless of the CRS newdata arrives in.
Usage
# S3 method for class 'gwr_fit'
predict(object, newdata = NULL, ...)Value
Numeric vector aligned to nrow(newdata), with NA for
rows dropped as missing or non-finite, and for locations whose local
regression cannot be estimated (too few training points within a fixed
bandwidth, or a singular local design); a warning counts those. If the
design matrix for newdata cannot be built, every value is
NA and a warning says why. CRS-less
newdata first receives the interpretation the training data got, so
the same rows land where they did at fit time.
See also
Other methods on a fitted model:
coef.bayesian_fit(),
coef.gwr_fit(),
coef.rf_fit(),
fitted.bayesian_fit(),
fitted.gwr_fit(),
fitted.rf_fit(),
model_metrics(),
predict.bayesian_fit(),
predict.rf_fit(),
print.rf_fit(),
print.spatial_fit(),
residuals.bayesian_fit(),
residuals.gwr_fit(),
residuals.rf_fit(),
summary.spatial_fit()