Learn R Programming

SpatioTemporal (version 0.9.2)

detrend.data: Removes the estimated time-trend from the observations in a mesa.data object.

Description

Removes the estimated time-trend from the observations in a mesa.data object, returning a similar object with a "vacant" trend, that can then be used to fit a simpler model.

Usage

detrend.data(mesa.data,subregion=NA,method="rlm")

Arguments

mesa.data
A mesa.data object.
subregion
NA (default), or a factor vector of the same length and order of the observations, with levels corresponding to sub-regions that should be treated differntly.
method
The method used for trend removal. At present only "rlm" is implemented.

Value

  • A mesa.data object, with the following differences:
  • obsThis data frame has one additional column labeled "removedtrend", with the amount subtracted per observation. This enables back-calculation of the original values and of original-scale predictions.
  • trendThe trend data frame only has a "date" vector. It is still needed in this format, for compatibility as input to create.data.model and other functions.
  • oldtrendAn additional data frame with the old trend(s) used for the detrending.

encoding

latin1

Details

Sometimes there is no apparent spatial structure to the time-trend amplitude, or there is not enough identifiability in the data to properly model the structure. In that case, it is possible, at least as a sensitivity analysis, to de-trend the observations and run a model with a spatial field for the intercept only (apart from the spatio-temporal residual field). When the returned object is used as input to create.data.model, the LUR list should contain only one vector of variable IDs (for the intercept). Similarly, vectors with initial parameter values for fit.mesa.model should be of length 5. detrend.data will remove the trends from the observations, using the trend component of the mesa.data input object. The "rlm" method simply performs robust regression on all the observations as a bulk, with the time trend(s) as predictor(s). The "observations" in the new returned object are the residuals from this regression. If a vector with factor levels is provided for subregion, then the model will be an interaction between the time trend(s) and region identifiers.

See Also

mesa.data, mesa.data.model, create.data.model.