Learn R Programming

intubate (version 1.0.0)

strucchange: Interfaces for strucchange package for data science pipelines.

Description

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

Usage

ntbt_breakpoints(data, ...) ntbt_efp(data, ...) ntbt_Fstats(data, ...) ntbt_mefp(data, ...) ntbt_recresid(data, ...) ntbt_sctest(data, ...)

Arguments

data
data frame, tibble, list, ...
...
Other arguments passed to the corresponding interfaced function.

Value

Object returned by interfaced function.

Details

Interfaces call their corresponding interfaced function.

Examples

Run this code
## 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)

Run the code above in your browser using DataLab