Learn R Programming

intubate (version 1.0.0)

betareg: Interfaces for betareg package for data science pipelines.

Description

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

Usage

ntbt_betamix(data, ...) ntbt_betareg(data, ...) ntbt_betatree(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(betareg)
# 
# 
# ## ntbt_betamix: Finite Mixtures of Beta Regression for Rates and Proportions
# data("ReadingSkills", package = "betareg")
# 
# ## Original function to interface
# set.seed(4040)
# betamix(accuracy ~ iq, data = ReadingSkills, k = 3, nstart = 10,
#         extra_components = extraComponent(type = "uniform", coef = 0.99, delta = 0.01))
# 
# ## The interface puts data as first parameter
# set.seed(4040)
# ntbt_betamix(ReadingSkills, accuracy ~ iq, k = 3, nstart = 10,
#              extra_components = extraComponent(type = "uniform", coef = 0.99, delta = 0.01))
# 
# ## so it can be used easily in a pipeline.
# ReadingSkills %>%
#   ntbt_betamix(accuracy ~ iq, k = 3, nstart = 10,
#                extra_components = extraComponent(type = "uniform", coef = 0.99, delta = 0.01))
# 
# 
# ## ntbt_betareg: Beta Regression for Rates and Proportions
# data("GasolineYield", package = "betareg")
# 
# ## Original function to interface
# betareg(yield ~ batch + temp, data = GasolineYield)
# 
# ## The interface puts data as first parameter
# ntbt_betareg(GasolineYield, yield ~ batch + temp)
# 
# ## so it can be used easily in a pipeline.
# GasolineYield %>%
#   ntbt_betareg(yield ~ batch + temp)
# 
# 
# ## ntbt_betatree: Beta Regression Trees
# data("ReadingSkills", package = "betareg")
# ReadingSkills$x1 <- rnorm(nrow(ReadingSkills))
# ReadingSkills$x2 <- runif(nrow(ReadingSkills))
# ReadingSkills$x3 <- factor(rnorm(nrow(ReadingSkills)) > 0)
# 
# library(partykit)
# ## Original function to interface
# set.seed(1071)
# bt <- betatree(accuracy ~ iq | iq, ~ dyslexia + x1 + x2 + x3,
#                data = ReadingSkills, minsize = 10)
# plot(bt)
# 
# ## The interface puts data as first parameter
# set.seed(1071)
# bt <- ntbt_betatree(ReadingSkills, accuracy ~ iq | iq, ~ dyslexia + x1 + x2 + x3,
#                     minsize = 10)
# plot(bt)
# 
# ## so it can be used easily in a pipeline.
# set.seed(1071)
# ReadingSkills %>%
#   ntbt_betatree(accuracy ~ iq | iq, ~ dyslexia + x1 + x2 + x3, minsize = 10) %>%
#   plot()
# ## End(Not run)

Run the code above in your browser using DataLab