glmx: Interfaces for glmx package for data science pipelines.

Description Usage Arguments Details Value Author(s) Examples

Description

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

## ntbt_glmx: Generalized Linear Models with Extra Parameters
set.seed(1)
d <- data.frame(x = runif(200, -1, 1))
d$y <- rnbinom(200, mu = exp(0 + 3 * d$x), size = 1)
require("MASS")

## Original function to interface
glmx(y ~ x, data = d, family = negative.binomial, xlink = "log", xstart = 0)

## The interface puts data as first parameter
ntbt_glmx(d, y ~ x, family = negative.binomial, xlink = "log", xstart = 0)

## so it can be used easily in a pipeline.
d %>%
  ntbt_glmx(y ~ x, family = negative.binomial, xlink = "log", xstart = 0)


## ntbt_hetglm: Heteroskedastic Binary Response GLMs
n <- 200
x <- rnorm(n)
ystar <- 1 + x +  rnorm(n, sd = exp(x))
y  <- factor(ystar > 0) 
dta <- data.frame(x, y)

## Original function to interface
hetglm(y ~ x | 1, data = dta)

## The interface puts data as first parameter
ntbt_hetglm(dta, y ~ x | 1)

## so it can be used easily in a pipeline.
dta %>%
  ntbt_hetglm(y ~ x | 1)

## End(Not run)

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