Space-time centering and scaling function

Share:

Description

stcenter centers and scales the space-time series data such that its mean is 0 and its standard error 1.

Usage

1

Arguments

data

a matrix or data frame containing the space-time series: row-wise should be the temporal observations, with each column corresponding to a site.

center

a logical value indicating whether the series should be centered or not (subtracting the mean).

scale

a logical value indicating whether the series should be scaled or not (dividing by the empiric stand deviation).

Details

To be able to apply the three-stage iterative model building procedure method for STARMA models, data must be centered beforehand (since starma doesn't estimate an intercept coefficient).

The only difference with the R function scale is that it doesn't center and scale column by column, but globally, since all the observations come from a single process in the case of space time series.

Value

An object of the same class as data, that is either a matrix or a data.frame.

Author(s)

Felix Cheysson

Examples

1
2
3
4
5
6
7
8
data <- matrix(rnorm(9400, mean=5, sd=2), 100, 94)
data <- stcenter(data)	# Center and scale the dataset

# Check for mean
sum(data) / (nrow(data) * ncol(data))

# Check for sd
sqrt( sum(data^2) / (nrow(data) * ncol(data) - 1) )