arm: Interfaces for arm package for data science pipelines.

Description Usage Arguments Details Value Author(s) Examples

Description

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

Usage

1
2

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
## Not run: 
library(intubate)
library(magrittr)
library(arm)

## ntbt_bayesglm: Bayesian generalized linear models
n <- 100
x1 <- rnorm (n)
x2 <- rbinom (n, 1, .5)
b0 <- 1
b1 <- 1.5
b2 <- 2
y <- rbinom(n, 1, invlogit(b0+b1*x1+b2*x2))

dta <- data.frame(y, x1, x2)

## Original function to interface
bayesglm(y ~ x1 + x2, family = binomial(link="logit"), data = dta,
         prior.scale = Inf, prior.df = Inf)

## The interface puts data as first parameter
ntbt_bayesglm(dta, y ~ x1 + x2, family = binomial(link="logit"),
              prior.scale = Inf, prior.df = Inf)

## so it can be used easily in a pipeline.
dta %>%
  ntbt_bayesglm(y ~ x1 + x2, family = binomial(link="logit"),
                prior.scale = Inf, prior.df = Inf)


## ntbt_bayespolr: Bayesian Ordered Logistic or Probit Regression
## Original function to interface
bayespolr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing,
          prior.scale = Inf, prior.df = Inf)

## The interface puts data as first parameter
ntbt_bayespolr(housing, Sat ~ Infl + Type + Cont, weights = Freq,
               prior.scale = Inf, prior.df = Inf)

## so it can be used easily in a pipeline.
housing %>%
  ntbt_bayespolr(Sat ~ Infl + Type + Cont, weights = Freq,
                 prior.scale = Inf, prior.df = Inf)

## End(Not run)

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