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

Description Usage Arguments Value Examples

View source: R/calculateRSS.R

Description

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

\loadmathjax \mjdeqn

RSS(S_q) = \sum_k \in S_q \sum_i = 1^n_k ||y_k,i - \hat\mu_S_q \left(\fracin_k\right) - \hatc_k||^2ASCII representation

(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

1
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

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

SCEM documentation built on Sept. 5, 2021, 5:50 p.m.