psychomix: Interfaces for psychomix package for data science pipelines.

Description Usage Arguments Details Value Author(s) Examples

Description

Interfaces to psychomix 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
46
47
48
49
50
51
52
53
54
55
56
## Not run: 
library(intubate)
library(magrittr)
library(psychomix)


## ntbt_btmix: Finite Mixtures of Bradley-Terry Models
data("GermanParties2009", package = "psychotools")

## omit single observation with education = 1
gp <- subset(GermanParties2009, education != "1")
gp$education <- factor(gp$education)

## Original function to interface
set.seed(1)
cm <- btmix(preference ~ gender + education + age + crisis,
            data = gp, k = 1:4, nrep = 3)
plot(cm)

## The interface puts data as first parameter
set.seed(1)
cm <- ntbt_btmix(gp, preference ~ gender + education + age + crisis,
                 k = 1:4, nrep = 3)
plot(cm)

## so it can be used easily in a pipeline.
set.seed(1)
gp %>%
  ntbt_btmix(preference ~ gender + education + age + crisis, k = 1:4, nrep = 3) %>%
  plot()



## ntbt_raschmix: Finite Mixtures of Rasch Models
set.seed(1)
r2 <- simRaschmix(design = "rost2")
d <- data.frame(
  x1 = rbinom(nrow(r2), prob = c(0.4, 0.6)[attr(r2, "cluster")], size = 1),
  x2 = rnorm(nrow(r2))
)
d$resp <- r2

## Original function to interface
m1 <- raschmix(resp ~ 1, data = d, k = 1:3, score = "saturated")
plot(m1)

## The interface puts data as first parameter
m1 <- ntbt_raschmix(d, resp ~ 1, k = 1:3, score = "saturated")
plot(m1)

## so it can be used easily in a pipeline.
d %>%
  ntbt_raschmix(resp ~ 1, k = 1:3, score = "saturated") %>%
  plot()

## End(Not run)

rbertolusso/intubate documentation built on May 27, 2019, 3 a.m.