strucchange: Interfaces for strucchange package for data science...

Description Usage Arguments Details Value Author(s) Examples

Description

Interfaces to strucchange functions that can be used in a pipeline implemented by magrittr.

Usage

1
2
3
4
5
6

Arguments

data

data frame, tibble, list, ...

...

Other arguments passed to the corresponding interfaced function.

Details

Interfaces call their corresponding interfaced function.

Value

Object returned by interfaced function.

Author(s)

Roberto Bertolusso

Examples

 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)

rbertolusso/intubate documentation built on May 27, 2019, 3 a.m.