Learn R Programming

SpatioTemporal (version 1.1.2)

updateSTdataTrend: Update Trend in STdata Object

Description

Updates/sets the temporal trend for STdata objects. It also checks that the spatio-temporal covariate exists for all dates in the trend (mainly an issue if extra.dates!=NULL adding additional times at which to do predictions.

Usage

updateSTdataTrend(STdata, n.basis = 0,
    extra.dates = NULL, ...)

Arguments

STdata
A STdata object, see mesa.data.
n.basis
number of basis functions for the temporal trend
extra.dates
Additional dates for which smooth trends should be computed.
...
Additional parameters passed to calcSmoothTrends.

Value

  • Returns a modfied version of the input, with and added/altered smooth trend.

See Also

Other STdata functions: createDataMatrix, createSTdata, createSTmodel, c.STmodel, detrendSTdata, removeSTcovarMean

Other SVD for missing data: calcSmoothTrends, plot.SVDcv, print.SVDcv, SVDmiss, SVDsmooth, SVDsmoothCV

Examples

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

##default data and time trend for one location
par(mfrow=c(4,1),mar=c(2.5,2.5,3,1))
plot(mesa.data)

##let's try with no trend
mesa.data <- updateSTdataTrend(mesa.data, n.basis=0)
plot(mesa.data)

##...and just one basis function, based on only AQS sites
subset <- mesa.data$covars$ID[mesa.data$covars$type=="AQS"]
mesa.data <- updateSTdataTrend(mesa.data, n.basis=1, subset=subset)
plot(mesa.data)

##Five basis functions, based on only AQS sites and much less smooth
mesa.data <- updateSTdataTrend(mesa.data, n.basis=5, subset=subset, df=100)
plot(mesa.data)

Run the code above in your browser using DataLab