PCT: Percentage Change Transformation

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/PCT.r

Description

The PCT() function returns a transformation of the provided time series using a Percentage Change transformation. PCT.rev() reverses the transformation.

Usage

1
2
3
PCT(x)

PCT.rev(p,x0)

Arguments

x

A numeric vector or univariate time series of class ts.

p

A numeric vector or univariate time series of percentage changes. Possibly returned by PCT().

x0

Initial value/observation of x (x[1]). First known non-transformed value used to recursively obtain the original series.

Details

The Percentage Change transformation is given approximately by

log( x[2:n] / x[1:(n-1)] ) = log( x[2:n] ) - log( x[1:(n-1)] )

where n=length(x).

Value

A vector of length length(x)-1 containing the transformed values.

Author(s)

Rebecca Pontes Salles

References

R.H. Shumway and D.S. Stoffer, 2010, Time Series Analysis and Its Applications: With R Examples. 3rd ed. 2011 edition ed. New York, Springer.

See Also

DIF,detrend, MAS, LT, BCT

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(NN5.A)
ts <- na.omit(NN5.A[,10])
length(ts)

pct <- PCT(ts)
length(pct)

x0 <- ts[1]
pct.rev <- PCT.rev(pct,x0)
x <- c(x0,pct.rev)

all(round(x,4)==round(ts,4))

TSPred documentation built on June 26, 2018, 5:04 p.m.