c.STmodel: Combine Several STmodel/STdata Objects

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Combines several locations and covariates for several STmodel/STdata objects. Temporal trend, observations and covariance model (both spatial and spatio-temporal) are taken from the first object in the call. Any additional covariates/trends/observations not present in the first argument are dropped from the additional arguments without warning. Locations and covariates (both spatial and spatio-temporal) from additional objects are added to those in the first object.

Usage

1
2
## S3 method for class 'STmodel'
c(..., recursive = FALSE)

Arguments

...

STmodel and STdata objects to combine, the first object has to be a STmodel.

recursive

For S3 compatibility; the function will ALWAYS run recursively

Details

For additional STdata objects the covariates are transformed according to STmodel$scale.covars of the first object, see createSTmodel.

For STmodel objects can not be combined if either has scaled covariates.

Value

An updated STmodel object.

Author(s)

Johan Lindstrom

See Also

Other STmodel methods: MCMC.STmodel, createSTmodel, estimate.STmodel, estimateCV.STmodel, plot.STdata, predict.STmodel, print.STmodel, print.summary.STmodel, qqnorm.predCVSTmodel, scatterPlot.predCVSTmodel, simulate.STmodel, summary.STmodel

Other STdata functions: createDataMatrix, createSTdata, createSTmodel, detrendSTdata, estimateBetaFields, removeSTcovarMean, updateTrend.STdata

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
##load the data
data(mesa.data.raw)
##and create STdata-object
mesa.data <- createSTdata(mesa.data.raw$obs, mesa.data.raw$X, n.basis=2,
                          SpatioTemporal=mesa.data.raw["lax.conc.1500"])

##keep only observations from the AQS sites
ID.AQS <- mesa.data$covars$ID[ mesa.data$covars$type=="AQS" ]
mesa.data$obs <- mesa.data$obs[mesa.data$obs$ID %in% ID.AQS,]

##model specification
LUR <- list(~log10.m.to.a1 + s2000.pop.div.10000 + km.to.coast,
            ~km.to.coast, ~km.to.coast)
locations <- list(coords=c("x","y"), long.lat=c("long","lat"), others="type")

##create reduced model, without and with a spatio-temporal covariate.
mesa.model <- createSTmodel(mesa.data, LUR=LUR, locations=locations,
                            strip=TRUE)
mesa.model.ST <- createSTmodel(mesa.data, LUR=LUR, ST=1,
                               locations=locations, strip=TRUE)
##and non stripped version
mesa.model.full <- createSTmodel(mesa.data, LUR=LUR, ST=1,
                                 locations=locations)

##combine, this adds the missing locations
mesa.model$locations$ID
c(mesa.model, mesa.data)$locations$ID

##or we could study the summary output
print(c(mesa.model.ST, mesa.data))

##no change since we're tryin to adding existing sites
mesa.model.full$locations$ID
c(mesa.model.full, mesa.data)$locations$ID

##We can also combine two STmodels
print(c(mesa.model, mesa.model.full))

SpatioTemporal documentation built on May 2, 2019, 8:49 a.m.