Description Usage Arguments Details Value Author(s) Examples
Interfaces to strucchange
functions that can be used
in a pipeline implemented by magrittr
.
1 2 3 4 5 6 | ntbt_breakpoints(data, ...)
ntbt_efp(data, ...)
ntbt_Fstats(data, ...)
ntbt_mefp(data, ...)
ntbt_recresid(data, ...)
ntbt_sctest(data, ...)
|
data |
data frame, tibble, list, ... |
... |
Other arguments passed to the corresponding interfaced function. |
Interfaces call their corresponding interfaced function.
Object returned by interfaced function.
Roberto Bertolusso
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | ## Not run:
library(intubate)
library(magrittr)
library(strucchange)
## ntbt_breakpoints: Dating Breaks
data("Nile")
d <- list(Nl = Nile)
## Original function to interface
breakpoints(Nl ~ 1, data = d)
## The interface puts data as first parameter
ntbt_breakpoints(d, Nl ~ 1)
## so it can be used easily in a pipeline.
d %>%
ntbt_breakpoints(Nl ~ 1)
## ntbt_efp: Empirical Fluctuation Processes
## Original function to interface
ocus.nile <- efp(Nl ~ 1, d, type = "OLS-CUSUM")
plot(ocus.nile)
## The interface puts data as first parameter
ocus.nile <- ntbt_efp(d, Nl ~ 1, type = "OLS-CUSUM")
plot(ocus.nile)
## so it can be used easily in a pipeline.
d %>%
ntbt_efp(Nl ~ 1, type = "OLS-CUSUM") %>%
plot()
## ntbt_Fstats: F Statistics
## Original function to interface
fs.nile <- Fstats(Nl ~ 1, data = d)
plot(fs.nile)
## The interface puts data as first parameter
fs.nile <- ntbt_Fstats(d, Nl ~ 1)
plot(fs.nile)
## so it can be used easily in a pipeline.
d %>%
ntbt_Fstats(Nl ~ 1) %>%
plot()
## ntbt_mefp: Monitoring of Empirical Fluctuation Processes
df1 <- data.frame(y = rnorm(300))
df1[150:300, "y"] <- df1[150:300, "y"] + 1
## Original function to interface
mefp(y ~ 1, data = df1[1:50,, drop = FALSE], type = "ME", h = 1, alpha = 0.05)
## The interface puts data as first parameter
ntbt_mefp(df1[1:50,, drop = FALSE], y ~ 1, type = "ME", h = 1, alpha = 0.05)
## so it can be used easily in a pipeline.
df1[1:50,, drop = FALSE] %>%
ntbt_mefp(y ~ 1, type = "ME", h = 1, alpha = 0.05)
## ntbt_recresid: Recursive Residuals
d1 <- list(x = rnorm(100) + rep(c(0, 2), each = 50))
## Original function to interface
recresid(x ~ 1, d1)
## The interface puts data as first parameter
ntbt_recresid(d1, x ~ 1)
## so it can be used easily in a pipeline.
d1 %>%
ntbt_recresid(x ~ 1)
## ntbt_sctest: Structural Change Tests in Linear Regression Models
data("longley")
## Original function to interface
sctest(Employed ~ Year + GNP.deflator + GNP + Armed.Forces, data = longley,
type = "Chow", point = 7)
## The interface puts data as first parameter
ntbt_sctest(longley, Employed ~ Year + GNP.deflator + GNP + Armed.Forces,
type = "Chow", point = 7)
## so it can be used easily in a pipeline.
longley %>%
ntbt_sctest(Employed ~ Year + GNP.deflator + GNP + Armed.Forces,
type = "Chow", point = 7)
## End(Not run)
|
Loading required package: zoo
Attaching package: 'zoo'
The following objects are masked from 'package:base':
as.Date, as.Date.numeric
Loading required package: sandwich
Optimal 2-segment partition:
Call:
breakpoints.formula(formula = Nl ~ 1, data = d)
Breakpoints at observation number:
28
Corresponding to breakdates:
1898
Optimal 2-segment partition:
Call:
breakpoints.formula(formula = Nl ~ 1)
Breakpoints at observation number:
28
Corresponding to breakdates:
1898
Optimal 2-segment partition:
Call:
breakpoints.formula(formula = Nl ~ 1)
Breakpoints at observation number:
28
Corresponding to breakdates:
1898
Monitoring with ME test (moving estimates test)
Initial call:
mefp.formula(formula = y ~ 1, type = "ME", data = df1[1:50, , drop = FALSE], h = 1, alpha = 0.05)
Last call:
mefp.formula(formula = y ~ 1, type = "ME", data = df1[1:50, , drop = FALSE], h = 1, alpha = 0.05)
Significance level : 0.05
Critical value : 2.745928
History size : 50
Last point evaluated : 50
Parameter estimate on history :
(Intercept)
-0.04086475
Monitoring with ME test (moving estimates test)
Initial call:
mefp.formula(formula = y ~ 1, type = "ME", h = 1, alpha = 0.05)
Last call:
mefp.formula(formula = y ~ 1, type = "ME", h = 1, alpha = 0.05)
Significance level : 0.05
Critical value : 2.745928
History size : 50
Last point evaluated : 50
Parameter estimate on history :
(Intercept)
-0.04086475
Monitoring with ME test (moving estimates test)
Initial call:
mefp.formula(formula = y ~ 1, type = "ME", h = 1, alpha = 0.05)
Last call:
mefp.formula(formula = y ~ 1, type = "ME", h = 1, alpha = 0.05)
Significance level : 0.05
Critical value : 2.745928
History size : 50
Last point evaluated : 50
Parameter estimate on history :
(Intercept)
-0.04086475
[1] -0.84742456 0.63460439 0.16460140 -1.82085041 -0.09269521 0.61683494
[7] -0.22813883 -0.01804020 0.38545286 0.43179387 0.47249884 0.50615285
[13] 0.15246908 0.75547867 0.36549671 0.57828183 -1.05035365 0.33376842
[19] -1.48588592 0.06791984 0.60260434 -1.00302918 -0.12102735 0.54974603
[25] -1.39209691 -0.89466377 -1.67842843 -0.60945465 -2.32244299 2.55222863
[31] -1.93651653 -0.84631663 1.99532463 -0.93273161 1.24128210 0.35214449
[37] 0.44159178 -1.94295468 -0.16392386 1.10203644 -1.04072038 0.70122817
[43] -1.49485498 -0.18822885 1.56081446 -0.12635636 -0.21116296 0.34794490
[49] -0.33368612 2.58583368 0.48966990 2.04735815 1.81100062 1.15848241
[55] 1.32350257 1.19200098 2.90611616 1.52354400 2.08384252 2.78166534
[61] 1.98808489 2.10868455 1.13102941 1.38700027 1.32561180 0.74761973
[67] 1.69976338 0.92707248 0.52836016 1.10963569 2.20815691 0.08199166
[73] -0.24409303 2.11882821 0.37105706 1.28156250 0.79914225 1.81198448
[79] 1.74938738 1.88698099 0.60554132 2.83966700 2.07380256 1.36490851
[85] 1.61233010 1.29095389 -0.82022696 0.32077905 1.22862291 1.32636166
[91] 1.78803458 1.96133414 1.40228470 -0.23327935 1.02744344 1.33685620
[97] 1.22817081 0.66956850 2.62300471
[1] -0.84742456 0.63460439 0.16460140 -1.82085041 -0.09269521 0.61683494
[7] -0.22813883 -0.01804020 0.38545286 0.43179387 0.47249884 0.50615285
[13] 0.15246908 0.75547867 0.36549671 0.57828183 -1.05035365 0.33376842
[19] -1.48588592 0.06791984 0.60260434 -1.00302918 -0.12102735 0.54974603
[25] -1.39209691 -0.89466377 -1.67842843 -0.60945465 -2.32244299 2.55222863
[31] -1.93651653 -0.84631663 1.99532463 -0.93273161 1.24128210 0.35214449
[37] 0.44159178 -1.94295468 -0.16392386 1.10203644 -1.04072038 0.70122817
[43] -1.49485498 -0.18822885 1.56081446 -0.12635636 -0.21116296 0.34794490
[49] -0.33368612 2.58583368 0.48966990 2.04735815 1.81100062 1.15848241
[55] 1.32350257 1.19200098 2.90611616 1.52354400 2.08384252 2.78166534
[61] 1.98808489 2.10868455 1.13102941 1.38700027 1.32561180 0.74761973
[67] 1.69976338 0.92707248 0.52836016 1.10963569 2.20815691 0.08199166
[73] -0.24409303 2.11882821 0.37105706 1.28156250 0.79914225 1.81198448
[79] 1.74938738 1.88698099 0.60554132 2.83966700 2.07380256 1.36490851
[85] 1.61233010 1.29095389 -0.82022696 0.32077905 1.22862291 1.32636166
[91] 1.78803458 1.96133414 1.40228470 -0.23327935 1.02744344 1.33685620
[97] 1.22817081 0.66956850 2.62300471
[1] -0.84742456 0.63460439 0.16460140 -1.82085041 -0.09269521 0.61683494
[7] -0.22813883 -0.01804020 0.38545286 0.43179387 0.47249884 0.50615285
[13] 0.15246908 0.75547867 0.36549671 0.57828183 -1.05035365 0.33376842
[19] -1.48588592 0.06791984 0.60260434 -1.00302918 -0.12102735 0.54974603
[25] -1.39209691 -0.89466377 -1.67842843 -0.60945465 -2.32244299 2.55222863
[31] -1.93651653 -0.84631663 1.99532463 -0.93273161 1.24128210 0.35214449
[37] 0.44159178 -1.94295468 -0.16392386 1.10203644 -1.04072038 0.70122817
[43] -1.49485498 -0.18822885 1.56081446 -0.12635636 -0.21116296 0.34794490
[49] -0.33368612 2.58583368 0.48966990 2.04735815 1.81100062 1.15848241
[55] 1.32350257 1.19200098 2.90611616 1.52354400 2.08384252 2.78166534
[61] 1.98808489 2.10868455 1.13102941 1.38700027 1.32561180 0.74761973
[67] 1.69976338 0.92707248 0.52836016 1.10963569 2.20815691 0.08199166
[73] -0.24409303 2.11882821 0.37105706 1.28156250 0.79914225 1.81198448
[79] 1.74938738 1.88698099 0.60554132 2.83966700 2.07380256 1.36490851
[85] 1.61233010 1.29095389 -0.82022696 0.32077905 1.22862291 1.32636166
[91] 1.78803458 1.96133414 1.40228470 -0.23327935 1.02744344 1.33685620
[97] 1.22817081 0.66956850 2.62300471
Chow test
data: Employed ~ Year + GNP.deflator + GNP + Armed.Forces
F = 3.9268, p-value = 0.06307
Chow test
data: Employed ~ Year + GNP.deflator + GNP + Armed.Forces
F = 3.9268, p-value = 0.06307
Chow test
data: Employed ~ Year + GNP.deflator + GNP + Armed.Forces
F = 3.9268, p-value = 0.06307
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.