processLUR: Internal Function that do Covariate Selection

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

Description

Function that create covariate specifications for createSTmodel, and compare the covariates requested (both geographic and spatio-temporal) with those available in STdata.

Usage

1
2
3
processLUR(STdata, LUR.in)

processST(STdata, ST.in)

Arguments

STdata

STdata object with observations, covariates, trends, etc; see mesa.data.raw.

LUR.in

A vector or list indicating which geographic covariates to use.

ST.in

A vector indicating which spatio-temporal covariates to use.

Details

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:

integer

This will be used as names(STdata$covars)[int] to extract a character vector (see below) of covariates.

character

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.

Value

A list of LUR specifications, as formula; or a ST specification as a character vector.

Author(s)

Johan Lindstrom

See Also

Other STmodel functions: createCV, createDataMatrix, createSTmodel, dropObservations, estimateBetaFields, loglikeSTdim, loglikeST, predictNaive, processLocation, updateCovf, 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
##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")

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