Compute the conditional expectations (i.e. predictions)
at the unobserved space-time locations. Predictions are
computed for the space-time locations in object
and/or STdata
, conditional on the observations
(and temporal trends) in object
and parameters
given in x
.
# S3 method for STmodel
predict (object, x, STdata = NULL,
Nmax = 1000, only.pars = FALSE, nugget.unobs = 0,
only.obs = FALSE, pred.var = TRUE, pred.covar = FALSE,
beta.covar = FALSE, combine.data = FALSE, type = "p",
LTA = FALSE, transform = c("none", "unbiased", "mspe"),
...)
STmodel
object for which to compute
predictions.
Model parameters for which to compute the
conditional expectation. Either as a vector/matrix or an
estimateSTmodel
from
estimate.STmodel
.
STdata
/STmodel
object with
locations/times for which to predict. If not given
predictions are computed for locations/times in
object
Limits the size of matrices constructed when computing expectations. Use a smaller value if memory becomes a problem.
Compute only the regression parameters (using GLS) along with the related variance.
Value of nugget at unonserved
locations, either a scalar or a vector with one element
per unobserved site. NOTE: All sites in
STdata
are considered unobserved!
Compute predictions at only locations
specified by observations in STdata
. Used to limit
computations when doing cross-validation.
only.obs=TRUE
implies
pred.covar=FALSE
and combine.data=FALSE
.
Further createSTmodel
will be called on any
STdata
input, possibly reordering the
observations.
Compute point-wise prediction
variances; or compute covariance matrices for the
predicted time series at each location.
pred.covar=TRUE
implies
pred.var=TRUE
and sets Nmax
equal to the
number of timepoints.
Compute the full covariance matrix for the latent beta-fields, otherwise only the diagonal elements of V(beta|obs) are computed.
Combine object
and
STdata
and predict for the joint set of points,
see c.STmodel
.
A single character indicating the type of
prediction to compute. Valid options are "f", "p", and
"r", for full, profile or restricted
maximum likelihood (REML). For profile and full the
predictions are computed assuming that both
covariance parameters and regression parameters are
known, e.g. E(X|Y,cov_par,reg_par)
; for REML
predictions are compute assuming only covariance
parameters known, e.g. E(X|Y,cov_par)
. The main
difference is that REML will have larger variances
due to the additional uncertainty in the regression
parameters.
Regard field as log-Gaussian and apply exponential transformation to predictions. For the final expectations two options exist, either a unbiased prediction or the (biased) mean-squared error predictions.
Compute long-term temporal averages. Either a
logical value or a list; if TRUE
then averages at
each location (and variances if pred.var=TRUE
) are
computed; otherwise this should be a list with elements
named after locations and each element containing a
vector (or list of vectors) with dates over which to
compute averages. If only.obs=TRUE
averages are
computed over only the observations.
Ignored additional arguments.
The function returns a list containing (objects not computed will be missing):
Copy of options used in the function call.
A list with
regression parameters and related variances. pars
contain gamma.E
and alpha.E
with regression
coefficients for the spatio-temporal model and land-use
covaraiates; variances are found in gamma.V
and
alpha.V
; cross-covariance between gamma and alpha
in gamma.alpha.C
.
A list with
estimates of the beta-fields, including the regression
mean mu
, conditional expectations EX
,
possibly variances VX
, and the full covariance
matrix VX.full
.
predictions based on the regression parameters, geographic covariates, and temporal trends. I.e. only the deterministic part of the spatio-temporal model.
Predictions based on the latent-beta fields, but excluding the residual nu field.
Full predictions at the
space-time locations in object
and/or
STdata
.
Only for
transform!="none"
, full predictions including bias
correction for prediction error.
Pointwise variances and prediction
variances (i.e. incl. contribution from
nugget.unobs
) for all locations in EX
.
A list with (number of locations) elements, each element is a (number of timepoints) - by - (number of timepoints) temporal covariance matrix for the timeseries at each location.
Pointwise mean-square prediction errors for the log-Gaussian fields.
Pointwise predictions
and variances for the un-transformed fields when
transform!="none"
A data.frame with
temporal averages for locations specified by LTA
.
A vector with the locations of the
observations in object
or STdata
. To
extract predictions at the observations locations use
EX[I]
.
In addition to computing the conditional expectation at a number of space-time locations the function also computes predictions based on only the regression part of the model as well as the latent beta-fields.
Prediction are computed as the conditional expectation of
a latent field given observations. This implies that
E(X_i| Y_i) != Y_i
, with the difference being due
to smoothing over the nugget. Further two possible
variance can be computed (see below), V(X_i|Y_i)
and V(X_i|Y_i)+nugget_i
. Here the nugget for
unobserved locations needs to be specified as an
additional argument nugget.nobs
. The two variances
correspond, losely, to confidence and prediction
intervals.
Variances are computed if pred.var=TRUE
point-wise
variances for the predictions (and the latent
beta-fields) are computed. If instead
pred.covar=TRUE
the full covariance matrices for
each predicted time series is computed; this implies that
the covariances between temporal predictions at the same
location are calculated but not, due to memory
restrictions, any covariances between locations.
beta.covar=TRUE
gives the full covariance matrices
for the latent beta-fields.
If transform!="none"
the field is assumed to be
log-Gaussian and expectations are transformed, and if
pred.var=TRUE
the mean squared prediction errors
are given.
Other predictSTmodel methods:
plot.predCVSTmodel
,
plot.predictSTmodel
,
print.predictSTmodel
Other STmodel methods: c.STmodel
,
createSTmodel
, estimate
,
estimate.STmodel
, estimateCV
,
estimateCV.STmodel
, MCMC
,
MCMC.STmodel
, plot.STdata
,
plot.STmodel
, predictCV
,
predictCV.STmodel
,
print.STmodel
,
print.summary.STmodel
,
qqnorm.predCVSTmodel
,
qqnorm.STdata
,
qqnorm.STmodel
,
scatterPlot.predCVSTmodel
,
scatterPlot.STdata
,
scatterPlot.STmodel
,
simulate.STmodel
,
summary.STmodel
# NOT RUN {
##load data
data(mesa.model)
data(est.mesa.model)
##find regression parameters using GLS
x.reg <- predict(mesa.model, est.mesa.model, only.pars = TRUE)
str(x.reg$pars)
# }
# NOT RUN {
##compute predictions at all locations, including beta-fields
pred.mesa.model <- predict(mesa.model, est.mesa.model,
pred.var=TRUE)
# }
# NOT RUN {
##Let's load precomputed results instead.
data(pred.mesa.model)
##study results
print(pred.mesa.model)
# }
Run the code above in your browser using DataLab