View source: R/predict-SVC_mle.R
predict.SVC_mle | R Documentation |
Prediction of SVCs (and response variable)
## S3 method for class 'SVC_mle'
predict(
object,
newlocs = NULL,
newX = NULL,
newW = NULL,
newdata = NULL,
compute.y.var = FALSE,
...
)
object |
( |
newlocs |
( |
newX |
( |
newW |
( |
newdata |
( |
compute.y.var |
( |
... |
further arguments |
The function returns a data frame of n.new
rows and with
columns
SVC_1, ..., SVC_p
: the predicted SVC at locations newlocs
.
y.pred
, if newX
and newW
are provided
y.var
, if newX
and newW
are provided and
compute.y.var
is set to TRUE
.
loc_x, loc_y
, the locations of the predictions
Jakob Dambon
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 \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/j.spasta.2020.100470")}
SVC_mle
## ---- 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.