cable.ar.p.plot: Plot Bent Cable AR(p) Fit Over Data

Description Usage Arguments Details Warning Note Author(s) References See Also Examples

View source: R/code.r

Description

Plot the bent-cable AR(p) regression.

Usage

1
cable.ar.p.plot(ar.p.fit, xlab = "time", ylab = "", main = NULL, ctp.ci = NULL)

Arguments

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.

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 τ and τ \pm γ 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

cable.lines, plot, par

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
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 )

bentcableAR documentation built on May 2, 2019, 11:01 a.m.