predict.SVC_mle {varycoef} | R Documentation |
Prediction of SVCs (and response variable)
Description
Prediction of SVCs (and response variable)
Usage
## S3 method for class 'SVC_mle'
predict(
object,
newlocs = NULL,
newX = NULL,
newW = NULL,
newdata = NULL,
compute.y.var = FALSE,
...
)
Arguments
object |
( |
newlocs |
( |
newX |
( |
newW |
( |
newdata |
( |
compute.y.var |
( |
... |
further arguments |
Value
The function returns a data frame of n.new
rows and with
columns
-
SVC_1, ..., SVC_p
: the predicted SVC at locationsnewlocs
. -
y.pred
, ifnewX
andnewW
are provided -
y.var
, ifnewX
andnewW
are provided andcompute.y.var
is set toTRUE
. -
loc_x, loc_y
, the locations of the predictions
Author(s)
Jakob Dambon
References
Dambon, J. A., Sigrist, F., Furrer, R. (2021) Maximum likelihood estimation of spatially varying coefficient models for large data with an application to real estate price prediction, Spatial Statistics doi: 10.1016/j.spasta.2020.100470
See Also
Examples
## ---- toy example ----
## We use the sampled, i.e., one dimensional SVCs
str(SVCdata)
# sub-sample data to have feasible run time for example
set.seed(123)
id <- sample(length(SVCdata$locs), 50)
## SVC_mle call with matrix arguments
fit_mat <- with(SVCdata, SVC_mle(
y[id], X[id, ], locs[id],
control = SVC_mle_control(profileLik = TRUE, cov.name = "mat32")))
## SVC_mle call with formula
df <- with(SVCdata, data.frame(y = y[id], X = X[id, -1]))
fit_form <- SVC_mle(
y ~ X, data = df, locs = SVCdata$locs[id],
control = SVC_mle_control(profileLik = TRUE, cov.name = "mat32")
)
## prediction
# predicting SVCs
predict(fit_mat, newlocs = 1:2)
predict(fit_form, newlocs = 1:2)
# predicting SVCs and response providing new covariates
predict(
fit_mat,
newX = matrix(c(1, 1, 3, 4), ncol = 2),
newW = matrix(c(1, 1, 3, 4), ncol = 2),
newlocs = 1:2
)
predict(fit_form, newdata = data.frame(X = 3:4), newlocs = 1:2)