help mata runningprod() -------------------------------------------------------------------------------

Title

runningprod() -- Running product of vector

Syntax

numeric vector runningprod(numeric vector x [, missing])

where optional argument missing is a real scalar that determines how missing values in x are treated.

Description

runningprod(x) returns a vector of the same dimension as x containing the running product of x. By default, missing values turn the product to missing.

Remarks

The running product of (2, 4, 6) is (2, 8, 48).

All functions return the same type as the argument, real if argument is real, complex if complex.

Conformability

runningprod(x, missing): x: r x 1 or 1 x c missing: 1 x 1 (optional) result: r x 1 or 1 x c

Diagnostics

If missing is not specified, missing values turn the product to missing. Specifying missing as 1 specifies that missing values in x are to be treated as 1, and so on.

Author We would like to thank Nick Cox for his useful advices

Federico Belotti Faculty of Economics Department of Financial and Quantitative Economics Tor Vergata University federico.belotti@uniroma2.it

Silvio Daidone Health Policy team Centre for Health Economics The University of York

Also see

Manual: [M-5] runningsum()

Help: [M-5] sum(); [M-4] mathematical, [M-4] utility