geometric.sequence: Create a Geometric Sequence

Description Usage Arguments Value Author(s) Examples

Description

Create a geometric sequence.

Usage

1
  GeometricSequence(length, initial.value = 1, discount.factor = .5)

Arguments

length

A positive integer giving the length of the desired sequence.

initial.value

The first term in the sequence. Cannot be zero.

discount.factor

The ratio between a sequence term and the preceding term. Cannot be zero.

Value

A numeric vector containing the desired sequence.

Author(s)

Steven L. Scott steve.the.bayesian@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
GeometricSequence(4, .8, .6)
# [1] 0.8000 0.4800 0.2880 0.1728

GeometricSequence(5, 2, 3)
# [1]   2   6  18  54 162

## Not run: 
GeometricSequence(0, -1, -2)
# Error: length > 0 is not TRUE

## End(Not run)

michelletran/bsts documentation built on March 29, 2020, 12:58 a.m.