calculateRSS {SCEM}R Documentation

Residual sum of squares (RSS) for all time series in a group.

Description

SCEM uses the residual sum of squares for each group to give a sense of the error in estimation. It is defined by:

\[RSS(S_q) = \sum_{k \in S_q} \sum_{i = 1}^{n_k} ||y_{k,i} - \hat{\mu}_{S_q} \left(\frac{i}{n_k}\right) - \hat{c}_{k}||^2\]

(See Chazin et al. 2019, Supplemental Materials 1).

The trend function for each individual time series is estimated non-parametrically by the local linear estimate (as discussed in Fan and Gijbels (1996)). Then, the common trend function for the group is estimated by taking the average over the group. Next, the shift functions are estimated as the differences from the individual trend functions and finally, the residual sum of squares are calculated using the original values, the common trend functions and the shifts.

Usage

calculateRSS(paths, S, bandwidth)

Arguments

paths

A list of data frames, where each frame contains the data for one individual. Every data frame should have two columns with names 'distance' and 'oxygen'.

S

A vector of integers showing which individuals are considered in the group.

bandwidth

Denotes the order of the bandwidth that should be used in the estimation process. bandwidth = k will mean that the bandwidth is n^k.

Value

A vector of length equal to the group-size, so that each element is the RSS for the corresponding individual in the group.

Examples

armenia_split = split(armenia,f = armenia$ID)
band = -0.33
p = length(armenia_split)
calculateRSS(armenia_split,1:p,band)

[Package SCEM version 1.1.0 Index]