CUMPROD {bimets} | R Documentation |
Cumulative Product
Description
This function returns the cumulative product of the elements of the input array or time series. The result is an object of the same class of the input, and its elements are the cumulative product of the current and the previous elements of the input.
If the input is a time series, users can provide the argument TSRANGE
in order to project the input time series before the cumulative product.
Usage
CUMPROD(x=NULL, TSRANGE=NULL, ignoreNA=FALSE, avoidCompliance=FALSE, ...)
Arguments
x |
Input numerical array or time series that must satisfy the compliance control check defined in |
TSRANGE |
Optional date range of operations that process the input time series. |
ignoreNA |
Ignore missing values. |
avoidCompliance |
If |
... |
Backward compatibility. |
Value
This function returns an object of the same class of the input, i.e. an array or a BIMETS time series.
See Also
TSPROJECT
MOVAVG
TSDELTA
TSLAG
TSPROJECT
TSEXTEND
TSLEAD
INDEXNUM
VERIFY_MAGNITUDE
Examples
#create ts
ts1<-TSERIES(INTS(1,10),START=c(2000,1),FREQ='M')
out_CUMPROD<-CUMPROD(ts1)
TABIT(out_CUMPROD)
out_CUMPROD<-CUMPROD(ts1,TSRANGE=c(2000,4,2001,1))
TABIT(ts1,out_CUMPROD)
#define an array
arr1<-c(INTS(1,5),INTS(-1,-5))
out_CUMPROD<-CUMPROD(arr1)
print(out_CUMPROD)