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, avoidCompliance=FALSE, ...)

Arguments

x

Input numerical array or time series that must satisfy the compliance control check defined in is.bimets.

TSRANGE

Optional date range of operations that process the input time series. TSRANGE must be specified as an array composed by starting year, starting period, ending year and ending period, i.e. TSRANGE=c(START_Y,START_P,END_Y,END_P). The projection into the time interval specified in TSRANGE takes place before the cumulative product.

avoidCompliance

If TRUE, compliance control check of input time series will be skipped. See is.bimets

...

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

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)
	
	

[Package bimets version 1.5.3 Index]