Learn R Programming

SpatioTemporal (version 1.1.7)

predict.STmodel: Computes Conditional Expectation at Unobserved Locations

Description

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.

Usage

# 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"),
    ...)

Arguments

object

STmodel object for which to compute predictions.

x

Model parameters for which to compute the conditional expectation. Either as a vector/matrix or an estimateSTmodel from estimate.STmodel.

STdata

STdata/STmodel object with locations/times for which to predict. If not given predictions are computed for locations/times in object

Nmax

Limits the size of matrices constructed when computing expectations. Use a smaller value if memory becomes a problem.

only.pars

Compute only the regression parameters (using GLS) along with the related variance.

nugget.unobs

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!

only.obs

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.

pred.var,pred.covar

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.

beta.covar

Compute the full covariance matrix for the latent beta-fields, otherwise only the diagonal elements of V(beta|obs) are computed.

combine.data

Combine object and STdata and predict for the joint set of points, see c.STmodel.

type

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.

transform

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.

LTA

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.

Value

The function returns a list containing (objects not computed will be missing):

opts

Copy of options used in the function call.

pars

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.

beta

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.

EX.mu

predictions based on the regression parameters, geographic covariates, and temporal trends. I.e. only the deterministic part of the spatio-temporal model.

EX.mu.beta

Predictions based on the latent-beta fields, but excluding the residual nu field.

EX

Full predictions at the space-time locations in object and/or STdata.

EX.pred

Only for transform!="none", full predictions including bias correction for prediction error.

VX,VX.pred

Pointwise variances and prediction variances (i.e. incl. contribution from nugget.unobs) for all locations in EX.

VX.full

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.

MSPE,MSPE.pred

Pointwise mean-square prediction errors for the log-Gaussian fields.

log.EX,log.VX.pred,log.VX

Pointwise predictions and variances for the un-transformed fields when transform!="none"

LTA

A data.frame with temporal averages for locations specified by LTA.

I

A vector with the locations of the observations in object or STdata. To extract predictions at the observations locations use EX[I].

Details

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.

See Also

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

Examples

Run this code
# 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