estimateCV.STmodel {SpatioTemporal} | R Documentation |
Functions that perform cross-validated parameter estimation and prediction for the spatio-temporal model.
## S3 method for class 'STmodel' estimateCV(object, x, Ind.cv, control = list(trace = 3), verbose.res = FALSE, ...) estimateCV(object, x, Ind.cv, ...) ## S3 method for class 'STmodel' predictCV(object, x, Ind.cv = NULL, ..., silent = TRUE, LTA = FALSE) predictCV(object, x, Ind.cv, ...)
object |
|
x |
Either a vector or matrix of starting point(s) for the optimisation,
see |
Ind.cv |
|
control |
A list of control parameters for the optimisation.
See |
verbose.res |
A |
... |
All additional parameters for |
silent |
Show status after each iteration? |
LTA |
|
For predictCV.STmodel
the parameters used to compute predictions for the left
out observations can be either a single vector or a matrix.
For a single vector the same parameter values will be used for all
cross-validation predictions; for a matrix the parameters in x[,i]
will be used for the predictions of the i:th cross-validation set (i.e. for
Ind.cv[,i]
). Suitable matrices are provided in the output from
estimateCV.STmodel
.
The cross-validation groups are given by Ind.cv
. Ind.cv
should
be either a (number of observations) - by - (groups) logical matrix or an
integer valued vector with length equal to (number of observations).
If a matrix then each column defines a cross-validation set with the
TRUE
values marking the observations to be left out. If a vector then
1
:s denote observations to be dropped in the first cross-validation
set, 2
:s observations to be dropped in the second set, etc.
Observations marked by values <=0
are never dropped. See
createCV
for details.
Either a estCVSTmodel
object with elements:
status |
Data.frame with convergence information and best function value for each cross-validation group. |
Ind.cv |
The cross-validation grouping. |
x.fixed |
Fixed parameters in the estimation, see
|
x.init |
Matrix of inital values used, i.e. |
par.all, par.cov |
Matrices with estimated parameters for each cross-validation group. |
par.all.sd, par.cov.sd |
Standard deviations computed from the Hessian/information matrix for set of estimated parameters. |
res.all |
Estimation results for each cross-validation group,
contains the output from the |
Or a predCVSTmodel
object with elements:
opts |
Copy of the |
Ind.cv |
The cross-validation grouping. |
pred.obs |
A data.frame with a copy of observations from
|
pred.all |
A list with time-by-location data.frames containing
predictions and variances for all space-time locations as
well as predictions and variances for the
beta-fields. Unobserved points are |
Johan Lindstrom
Other STmodel methods: MCMC.STmodel
,
c.STmodel
, createSTmodel
,
estimate.STmodel
,
plot.STdata
, predict.STmodel
,
print.STmodel
,
print.summary.STmodel
,
qqnorm.predCVSTmodel
,
scatterPlot.predCVSTmodel
,
simulate.STmodel
,
summary.STmodel
Other cross-validation functions: computeLTA
,
createCV
, dropObservations
,
predictNaive
Other estCVSTmodel methods: boxplot.estCVSTmodel
,
coef.estCVSTmodel
,
print.estCVSTmodel
,
print.summary.estCVSTmodel
,
summary.estCVSTmodel
Other predCVSTmodel functions: computeLTA
Other predCVSTmodel methods: plot.predCVSTmodel
,
print.predCVSTmodel
,
print.summary.predCVSTmodel
,
qqnorm.predCVSTmodel
,
scatterPlot.predCVSTmodel
,
summary.predCVSTmodel
##load data data(mesa.model) data(est.mesa.model) ################ ## estimateCV ## ################ ##create the CV structure defining 10 different CV-groups Ind.cv <- createCV(mesa.model, groups=10, min.dist=.1) ##use the best parameters and there starting values as x.init <- coef(est.mesa.model, pars="cov")[,c("par","init")] ## Not run: ##estimate different parameters for each CV-group est.cv.mesa <- estimateCV(mesa.model, x.init, Ind.cv) ## End(Not run) ##lets load precomputed results instead data(est.cv.mesa) ##examine the estimation results print( est.cv.mesa ) ##estimated parameters for each CV-group coef(est.cv.mesa, pars="cov") ############### ## predictCV ## ############### ## Not run: ##Do cross-validated predictions using the just estimated parameters ##Ind.cv is infered from est.cv.mesa as est.cv.mesa$Ind.cv pred.cv.mesa <- predictCV(mesa.model, est.cv.mesa, LTA=TRUE) ## End(Not run) ##lets load precomputed results instead data(pred.cv.mesa) ##prediction results print( pred.cv.mesa ) ##and CV-statistics print( summary( pred.cv.mesa, LTA=TRUE) ) ## Not run: ##A faster option is to only consider the observations and not to compute ##variances pred.cv.fast <- predictCV(mesa.model, est.cv.mesa, only.obs=TRUE, pred.var=FALSE) print( pred.cv.fast ) summary( pred.cv.fast ) ## End(Not run)