Learn R Programming

intubate (version 1.0.0)

psychomix: Interfaces for psychomix package for data science pipelines.

Description

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

Usage

ntbt_btmix(data, ...) ntbt_raschmix(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(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)

Run the code above in your browser using DataLab