LastPointAboveQuantile: Determine if the Last Point is Above the Sample Quantile

Description Usage Arguments Value See Also Examples

View source: R/LastPointAboveQuantile.R

Description

This function LastPointAboveQuantile is used to determine whether the last observation of ts is above the sample quantile calculated using the rest of the points in ts. If argument exclude is specified, elements at those designated positions are further removed from the sample quantile calculation.

Usage

1
LastPointAboveQuantile(ts, exclude = NULL, probT = 0.9)

Arguments

ts

A numeric vector whose

  • last value is the one will be compared with the sample quantile;

  • all but the last one are used to calculate the sample quantile.

exclude

A logical vector with length equals to length(ts)-1. It is used to remove elements at designated positions from calculating the sample quantile. By default, exclude = NULL, which means no element is excluded when calculating the sample quantile.

probT

probability threshold with values in [0, 1]. The sample quantile corresponds to this probability is calculated.

Value

returns TRUE if the last element of ts is above the sample quantiles and FALSE otherwise.

See Also

quantile

Examples

1
2
3
4
5
set.seed(1)
ts <- c(runif(1000), 0.95)
exclude <- sample(c(T, F), 1000, replace = T, prob = c(0.005, 0.995))
LastPointAboveQuantile(ts, exclude)
LastPointAboveQuantile(ts, exclude, 0.95)

jingjin1018/anetimeseries documentation built on May 19, 2019, 10:35 a.m.