betareg: Interfaces for betareg package for data science pipelines.

Description Usage Arguments Details Value Author(s) Examples

Description

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

Usage

1
2
3

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
## 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)

intubate documentation built on May 2, 2019, 2:46 p.m.