Predicts of a ProbitSpatial
model on a set X
of covariates.
Works on both in-sample and out-of-sample using BLUP formula from Goulard et
al. (2017)
# S3 method for ProbitSpatial
predict(
object,
X,
type = c("link", "response", "binary"),
cut = 0.5,
oos = FALSE,
WSO = NULL,
...
)
an object of class ProbitSpatial
.
a matrix of explanatory variables. If oos=TRUE, it may contain more observations than the dataset on which the model has been trained
the type of output:
"link"
the value of the latent variable. Default
"response"
probability.
"binary"
binary 0/1 output.
the threshold probability for the "binary"
type.
Default is 0.5.
logical. If TRUE, out-of-sample predictions are returned.
W matrix containing weights of in-sample and out-of-sample data. Observations must be ordered in such a way that the first elements belong to the in-sample data and the remaining ones to the out-of-sample data.
ignored
Returns a vector of predicted values for the set X
of
covariates if oos=FALSE
or the best linear unbiased predictors of the #' set XOS
if oos=TRUE
.
If oos=FALSE
, the function computes the predicted values for #' the estimated model (same as fitted
). Otherwise, it applies the BLUP #' formula of Goulard et al. (2017):
$$\hat{y} = (\hat(y_S),\hat(y_O)),$$
where the sub-indexes S and O refer, respectively, to the in-sample and
out-of-sample data. \(\hat{y_S}\) corresponds to fitted values, while
\(\hat{y_O}\) is computed as follows:
$$\hat{y_O} = (I-\rho W)^{-1}(X\beta)-Q_{OO}^{-1}Q_{OS}(y_S-\hat{y_S}),$$
where \(Q\) is the precision matrix of
\(\Sigma=\sigma^2((I-\rho W)'(I-\rho W))^{-1}.\) and the sub-indexes OO and
OS refer to the corresponding block matrices.
M. Goulard, T. Laurent and C. Thomas-Agnan. About predictions in spatial autoregressive models: optimal and almost optimal strategies. Spatial Economic Analysis 12, 304-325, 2017.