cable.ar.p.diag: Bent-Cable AR(p>0) Diagnostics

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

View source: R/code.r

Description

ACF, PACF, and other plots are produced for diagnosing an AR(p) bent-cable fit when p>0.

Usage

1
2
cable.ar.p.diag(ar.p.fit, resid.type = "p", xlab = "time", ylab = "",
	main = NULL, main.all = NULL, ctp.ci = NULL)

Arguments

ar.p.fit

A cable.ar.p.iter object for AR(p) data, p>0.

resid.type

A type argument for the plot function; used to control the way fitted residuals and innovations are displayed. Default is "p" for points.

xlab

Character string: x-axis label.

ylab

Character string: y-axis label.

main

Character string: title for the time series plot.

main.all

Character string: title for the entire set of plots.

ctp.ci

A cable.change.conf object.

Details

This function splits the plotting canvas into several panels. For one panel, ar.p.fit is fed to cable.ar.p.plot that produces a scatterplot of the data and overlays on it the fitted bent cable with the estimated transition. The optioinal ctp.ci is also fed to cable.ar.p.plot to add the CTP confidence interval to the same panel. Additionally, ar.p.fit is fed to cable.ar.p.resid to extract the fitted residuals and innovations, which are then plotted in separate panels that again show the estimated transition and confidence interval. Finally, four panels show ACF and PACF diagnostics for the fitted residuals and innovations, via the built-in R functions acf and pacf.

Warning

See the warnings from cable.ar.p.plot and cable.ar.p.resid.

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, acf, pacf

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
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.diag( fit.ar2, main="bent cable", main.all="Sockeye",
	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, main="Sockeye bent cable",
		#	ci.level=.9 )

# 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.diag( fit.ar4, ctp.ci=cable.change.conf( fit.ar4, .95 ) )
		# compare to this:
		# fit.ar4 <- bentcable.ar( sockeye$logReturns,
		#	init.cable=c(13,.1,-.5,11), p=4, stick=TRUE )

Example output

initial  value 12.047624 
iter  10 value 4.927132
iter  20 value 4.886237
iter  30 value 4.873297
final  value 4.867997 
converged
CSS successful
Warning messages:
1: In (0L:n) * by :
  Recycling array of length 1 in vector-array arithmetic is deprecated.
  Use c() or as.vector() instead.

2: In c(-1, 1) * z * sqrt(v) :
  Recycling array of length 1 in vector-array arithmetic is deprecated.
  Use c() or as.vector() instead.

initial  value 16.164522 
iter  10 value 6.686580
iter  20 value 3.265483
iter  30 value 2.145406
final  value 2.145392 
converged
Non-stationary CSS fit
Applying method yw ...
1 : vector difference  2.365203
2 : vector difference  0.184967
3 : vector difference  0.011105
4 : vector difference  0.007786
5 : vector difference  0.006923
6 : vector difference  0.00651
7 : vector difference  0.006104
8 : vector difference  0.005725
9 : vector difference  0.00537
10 : vector difference  0.005037
11 : vector difference  0.004725
12 : vector difference  0.004433
13 : vector difference  0.004159
14 : vector difference  0.003902
15 : vector difference  0.003661
16 : vector difference  0.003435
17 : vector difference  0.003224
18 : vector difference  0.003025
19 : vector difference  0.002839
20 : vector difference  0.002664
21 : vector difference  0.002501
22 : vector difference  0.002347
23 : vector difference  0.002203
24 : vector difference  0.002068
25 : vector difference  0.001941
26 : vector difference  0.001822
27 : vector difference  0.00171
28 : vector difference  0.001605
29 : vector difference  0.001507
30 : vector difference  0.001415
31 : vector difference  0.001328
32 : vector difference  0.001247
33 : vector difference  0.001171
34 : vector difference  0.001099
35 : vector difference  0.001032
36 : vector difference  0.000969
37 : vector difference  0.00091
38 : vector difference  0.000854
39 : vector difference  0.000802
40 : vector difference  0.000753
41 : vector difference  0.000707
42 : vector difference  0.000664
43 : vector difference  0.000623
44 : vector difference  0.000585
45 : vector difference  0.00055
46 : vector difference  0.000516
47 : vector difference  0.000485
48 : vector difference  0.000455
49 : vector difference  0.000427
50 : vector difference  0.000401
51 : vector difference  0.000377
52 : vector difference  0.000354
53 : vector difference  0.000332
54 : vector difference  0.000312
55 : vector difference  0.000293
56 : vector difference  0.000275
57 : vector difference  0.000258
58 : vector difference  0.000243
59 : vector difference  0.000228
60 : vector difference  0.000214
61 : vector difference  0.000201
62 : vector difference  0.000189
63 : vector difference  0.000177
64 : vector difference  0.000166
65 : vector difference  0.000156
66 : vector difference  0.000147
67 : vector difference  0.000138
68 : vector difference  0.000129
69 : vector difference  0.000122
70 : vector difference  0.000114
71 : vector difference  0.000107
72 : vector difference  0.00011
73 : vector difference  9.7e-05

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