Learn R Programming

SpatioTemporal (version 1.1.2)

createSTmodel: Construct STmodel Object

Description

Creates a STmodel object that can be for estimation and prediction. For details see the sub-functions linked under the relevant Arguments.

Usage

createSTmodel(STdata, LUR = NULL, ST = NULL,
    cov.beta = list(covf = "exp", nugget = FALSE),
    cov.nu = list(covf = "exp", nugget = TRUE, random.effect = FALSE),
    locations = list(coords = c("x", "y"), long.lat = NULL, coords.beta = NULL, coords.nu = NULL, others = NULL),
    strip = FALSE, scale = FALSE, scale.covars = NULL)

Arguments

STdata
STdata object with observations, covariates, trends, etc; see createSTdata or mesa.data for an example.
LUR
Specification of covariates for the beta-fields, see processLUR.
ST
Specification of spatio-temporal covariates, see processST.
cov.beta,cov.nu
Specification of the covariance functions, see updateCovf.
locations
Specification of the sites (both monitored and un-monitored), see processLocation.
strip
Should unobserved locations be dropped?
scale
Scale the covariates? If TRUE all non-factor covariates are scaled after the locations have been extracted but before constructing the covariate matrix for the beta-fields. (NOTE: If set to TRUE this scales the <
scale.covars
list with elements mean and sd giving the mean and standard deviation to use when scaling the covariates. Computed from STdata$covars if not given.

Value

Details

The object holds observations, trends, geographic, and spatio-temporal covariates, as well as a number of precomputed fields that speed up log-likelihood evaluations. To improve performance the locations are also reorder so that observed locations come before unobserved.

See Also

Other STdata functions: createDataMatrix, createSTdata, c.STmodel, detrendSTdata, removeSTcovarMean, updateSTdataTrend

Other STmodel functions: createCV, createDataMatrix, dropObservations, loglikeST, loglikeSTdim, loglikeSTnaive, predictNaive, processLocation, processLUR, processST, updateCovf

Other STmodel methods: c.STmodel, estimateCV.STmodel, estimate.STmodel, MCMC.STmodel, plot.STdata, plot.STmodel, predictCV.STmodel, predict.STmodel, print.STmodel, print.summary.STmodel, simulate.STmodel, summary.STmodel

Examples

Run this code
##load the data
data(mesa.data)

##define land-use covariates
LUR <-  list(c("log10.m.to.a1", "s2000.pop.div.10000", "km.to.coast"),
             "km.to.coast", "km.to.coast")
##and covariance model
cov.beta <- list(covf="exp", nugget=FALSE)
cov.nu <- list(covf="exp", nugget=TRUE, random.effect=FALSE)
##which locations to use
locations <- list(coords=c("x","y"), long.lat=c("long","lat"), others="type")

##create object
mesa.model <- createSTmodel(mesa.data, LUR=LUR, cov.beta=cov.beta,
                            cov.nu=cov.nu, locations=locations)
print(mesa.model)
##This is the same as data(mesa.model)

##lets try some alternatives:
model.none <- createSTmodel(mesa.data, LUR=NULL, ST=NULL)
print(model.none)

##Specify LUR:s using numbers
names(mesa.data$covars)
model.diff <- createSTmodel(mesa.data, LUR=list(c(7,10,11,12),11:12,11:12),
                            ST=1)
print(model.diff)

##Same covariates for all temporal trends, calling by name
##but with different covariance models for each trend, and nugget that depends
##on monitor type
model.same <- createSTmodel(mesa.data, LUR=c("log10.m.to.a1", "log10.m.to.road",
                                         "km.to.coast","s2000.pop.div.10000"),
                            ST="lax.conc.1500", cov.nu=list(nugget="type"),
                            cov.beta=list(covf=c("exp","exp2","iid"),
                              nugget=c(FALSE, FALSE, TRUE)) )
print(model.same)

Run the code above in your browser using DataLab