Learn R Programming

SpatioTemporal (version 0.9.2)

construct.LUR.basis: Extract and Create Covariate Matrices

Description

Extracts the requested geographic and spatio-temporal covariates from mesa.data and formats them into suitable matrices.

Usage

construct.LUR.basis(mesa.data, LUR)

construct.ST.basis(mesa.data, ST.Ind)

Arguments

mesa.data
Data structure holding observations, observation locations, smooth temporal trends, geographic covariates and spatio-temporal covariates. See mesa.data.
LUR
A vector or list of vectors indicating which geographic covariates to use, see default.LUR.list.
ST.Ind
A vector indicating which spatio-temporal covariates to use, see default.ST.list.

Value

  • construct.LUR.basis returns a list of matrices, where each matrix contains geographic covariates for the corresponding temporal trend, starting with the intercept.

    construct.ST.basis returns a matrix with one column for each spatio-temporal covariate. Each row contains the covariate(s) for the corresponding observation in mesa.data$obs$obs.

encoding

latin1

See Also

Used internally by: create.data.model. See default.LUR.list and default.ST.list for details on the variable specification.

For other data functions, see mesa.data.raw, mesa.data.model, default.LUR.list, and create.data.matrix.

Examples

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

##create a simple set of covariates
LUR.1 <- construct.LUR.basis(mesa.data, list(c(1:3),1,2))
str(LUR.1)

##or a structure with the same covariates for all
##temporal trends
LUR.2 <- construct.LUR.basis(mesa.data, c(1:2))
str(LUR.2)

##or a structure with only intercept for the temporal trends
LUR.3 <- construct.LUR.basis(mesa.data, list(c(1:3),NULL,NULL))
str(LUR.3)

##Ask for covariates by name
LUR.4 <- construct.LUR.basis(mesa.data, "log10.m.to.a1")
str(LUR.4)

##Ask for non-existent covariate by name (produces a warning)
LUR.5 <- construct.LUR.basis(mesa.data, "log10.m.to.a4")
str(LUR.5)

##create a simple set of spatio-temporal covariates
ST.1 <- construct.ST.basis(mesa.data, 1)
str(ST.1)

##or create a empty set of spatio-temporal covariates
ST.2 <- construct.ST.basis(mesa.data, NULL)
str(ST.2)

Run the code above in your browser using DataLab