predict.ProbitSpatial {ProbitSpatial} | R Documentation |
Spatial probit model predictions.
Description
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)
Usage
## S3 method for class 'ProbitSpatial'
predict(
object,
X,
type = c("link", "response", "binary"),
cut = 0.5,
oos = FALSE,
WSO = NULL,
...
)
Arguments
object |
an object of class |
X |
a matrix of explanatory variables. If oos=TRUE, it may contain more observations than the dataset on which the model has been trained |
type |
the type of output:
|
cut |
the threshold probability for the |
oos |
logical. If TRUE, out-of-sample predictions are returned. |
WSO |
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 |
Details
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.
Value
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
.
References
- Goulard et al. (2017)
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.