| cable.ar.p.plot {bentcableAR} | R Documentation |
Plot the bent-cable AR(p) regression.
cable.ar.p.plot(ar.p.fit, xlab = "time", ylab = "", main = NULL, ctp.ci = NULL)
ar.p.fit |
A cable.ar.p.iter object for AR(p) data, p>0. |
xlab |
Character string: x-axis label. |
ylab |
Character string: y-axis label. |
main |
Character string: plot title. |
ctp.ci |
A cable.change.conf object. |
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).
This function fails if ar.p.fit is from a non-AR(p>0) fit.
For fits with independent data, use cable.lines.
This function is intended for internal use by bentcable.ar.
Grace Chiu
See the bentcableAR package references.
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 )