The sfsmisc Package - NexTag Supports Open Source Initiatives
The sfsmisc Package - NexTag Supports Open Source Initiatives
The sfsmisc Package - NexTag Supports Open Source Initiatives
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
36 iterate.lin.recursion<br />
Arguments<br />
x<br />
coeff<br />
delta<br />
nr.it<br />
numeric vector with initial values, i.e., specifying the beginning of the resulting<br />
sequence; must be of length (larger or) equal to length(coeff).<br />
coefficient vector of the linear recursion.<br />
numeric scalar added to each term; defaults to 0. If not zero, determines the<br />
linear drift component.<br />
integer, number of iterations.<br />
Value<br />
numeric vector, say r, of length n + nr.it, where n = length(x). Initialized as r[1:n]<br />
= x, the recursion is r[k+1] = sum(coeff * r[(k-m+1):k]), where m = length(coeff).<br />
Note<br />
Depending on the zeroes of the characteristic polynomial of coeff, there are three cases, of convergence,<br />
oszillation and divergence.<br />
Author(s)<br />
Martin Maechler<br />
See Also<br />
seq can be regarded as a trivial special case.<br />
Examples<br />
## <strong>The</strong> Fibonacci sequence:<br />
iterate.lin.recursion(0:1, c(1,1), nr = 12)<br />
## 0 1 1 2 3 5 8 13 21 34 55 89 144 233<br />
## seq() as a special case:<br />
stopifnot(iterate.lin.recursion(4,1, d=2, nr=20)<br />
== seq(4, by=2, length=1+20))<br />
## ``Deterministic AR(2)'' :<br />
round(iterate.lin.recursion(1:4, c(-0.7, 0.9), d = 2, nr=15), dig=3)<br />
## slowly decaying :<br />
plot(ts(iterate.lin.recursion(1:4, c(-0.9, 0.95), nr=150)))