processLUR {SpatioTemporal} | R Documentation |
Function that create covariate specifications for createSTmodel
,
and compare the covariates requested (both geographic and spatio-temporal) with
those available in STdata
.
processLUR(STdata, LUR.in) processST(STdata, ST.in)
STdata |
|
LUR.in |
A vector or list indicating which geographic covariates to use. |
ST.in |
A vector indicating which spatio-temporal covariates to use. |
Several options exist for LUR.in
LUR.in=NULL
Only an intercept for all beta-fields.
LUR.in="all"
Use all elements in STdata$covars
,
NOT recommended.
LUR.in=list(...)
Use different covariates for each, specified by the different components of the list.
LUR.in=vector
Use the same covariates for all beta-field.
For the two last options the vector/list-elements can contain either:
This will be used as names(STdata$covars)[int]
to
extract a character vector (see below) of covariates.
The character vector will be used to create a
formula
(see below), through:
as.formula(paste("~", paste(unique(chars), collapse="+")),
env=.GlobalEnv)
formula
The formula will be used as
model.matrix(formula, STdata$covars)
to create a covariate matrix.
Setting any element(s) of the list to NULL
implies only an
intercept for the corresponding temporal trend(s).
ST.in
should be a vector specifying the spatio-temporal covariates to
use; the vector either give names or layers in STdata$SpatioTemporal
to use, compare character
and integer
options for LUR.in
above.
If covariates are specified using names these should match
dimnames(STdata$SpatioTemporal)[[3]]
, unmatched elements are
dropped with a warning.
A list of LUR specifications, as formula
;
or a ST specification as a character vector.
Johan Lindstrom
Other STmodel functions: createCV
,
createDataMatrix
,
createSTmodel
,
dropObservations
,
estimateBetaFields
,
loglikeSTdim
, loglikeST
,
predictNaive
,
processLocation
, updateCovf
,
updateTrend.STdata
##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"]) ##create a simple set of covariates processLUR(mesa.data, list(c(7:9),7,8)) ##or a structure with the same covariates for all ##temporal trends processLUR(mesa.data, c(7,11)) ##or a structure with only intercept for the temporal trends processLUR(mesa.data, list(c(7:9),NULL,NULL)) ##Ask for covariates by name processLUR(mesa.data, list(c("log10.m.to.a1","log10.m.to.a2"), "log10.m.to.a1","log10.m.to.a1")) ##use formula for part of it processLUR(mesa.data, list(~log10.m.to.a1+log10.m.to.a2+log10.m.to.a1*km.to.coast, "log10.m.to.a1", "log10.m.to.a1")) ##Ask for non-existent covariate by name or formula, or location ##for each temporal trend) try(processLUR(mesa.data, list("log10.m.to.a4",~log10.m.to.a1+log10.m.to.a4, 25))) ##create a simple set of spatio-temporal covariates processST(mesa.data, 1) ##or create a empty set of spatio-temporal covariates processST(mesa.data, NULL) ##by name processST(mesa.data, "lax.conc.1500")