Learn R Programming

SpatioTemporal (version 1.1.2)

processLUR: Internal Function that do Covariate Selection

Description

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

Usage

processLUR(STdata, LUR.in)

processST(STdata, ST.in)

Arguments

STdata
STdata object with observations, covariates, trends, etc; see mesa.data.
LUR.in
A vector or list indicating which geographic covariates to use.
ST.in
A vector indicating which spatio-temporal covariates to use.

Value

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

Details

Several options exist for LUR.in [object Object],[object Object],[object Object],[object Object] For the two last options the vector/list-elements can contain either: [object Object],[object Object],[object Object] 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.

See Also

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

Examples

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

##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")

Run the code above in your browser using DataLab