cable.ar.p.plot {bentcableAR} | R Documentation |
Plot Bent Cable AR(p) Fit Over Data
Description
Plot the bent-cable AR(p) regression.
Usage
cable.ar.p.plot(ar.p.fit, xlab = "time", ylab = "", main = NULL, ctp.ci = NULL)
Arguments
ar.p.fit |
A |
xlab |
Character string: x-axis label. |
ylab |
Character string: y-axis label. |
main |
Character string: plot title. |
ctp.ci |
A |
Details
The time series data and bent-cable / broken-stick fit are extracted
from the argument ar.p.fit
. These data are then plotted, with
the fitted regression superimposed in red. The estimated transition
\tau
and \tau \pm \gamma
are also marked in red. The
optional ctp.ci
, if provided, adds to the plot in blue the
confidence interval for the CTP (unique point at which the cable's
slope changes sign).
Warning
This function fails if ar.p.fit
is from a non-AR(p>0) fit.
For fits with independent data, use cable.lines
.
Note
This function is intended for internal use by bentcable.ar
.
Author(s)
Grace Chiu
References
See the bentcableAR
package references.
See Also
Examples
data(sockeye)
# AR(2) cable fit
fit.ar2 <- cable.ar.p.iter( c(13,.1,-.5,11,4,.5,-.5),
sockeye$logReturns, tol=1e-4 )
cable.ar.p.plot( fit.ar2, ctp.ci=cable.change.conf( fit.ar2, .9 ) )
# compare to this:
# fit.ar2 <- bentcable.ar( sockeye$logReturns,
# init.cable=c(13,.1,-.5,11,4), p=2, ci.level=.9 )
# cable.ar.p.plot( fit.ar2$cable, ctp.ci=fit.ar2$ctp )
# AR(4) stick fit
fit.ar4 <- cable.ar.p.iter( c(13,.1,-.5,11,.5,-.5,.5,-.5),
sockeye$logReturns, tol=1e-4, stick=TRUE )
cable.ar.p.plot( fit.ar4, ctp.ci=cable.change.conf( fit.ar4, .9 ) )
# compare to this:
# fit.ar4 <- bentcable.ar( sockeye$logReturns,
# init.cable=c(13,.1,-.5,11), p=4, stick=TRUE, ci.level=.9 )
# cable.ar.p.plot( fit.ar4$cable, ctp.ci=fit.ar4$ctp )