The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Parallelize 'ez' functions

The 'futurize' hexlogo = The 'future' logo

The futurize package allows you to easily turn sequential code into parallel code by piping the sequential code to the futurize() function. Easy!

TL;DR

library(futurize)
plan(multisession)
library(ez)

data(ANT)
rt <- ezBoot(
  data = ANT,
  dv = rt,
  wid = subnum,
  within = .(cue, flank),
  between = group,
  iterations = 1e3
) |> futurize()

Introduction

This vignette demonstrates how to use this approach to parallelize ez functions such as ezBoot(), ezPerm(), and ezPlot2(). The functions ezBoot(), ezPerm(), and ezPlot2() support parallel evaluation via the parallel argument. By piping to futurize(), you can leverage any future-based parallel backend for these computations.

Example: Bootstrap resampling

The ezBoot() function computes bootstrap resampled predictions for each cell in an experimental design. We can parallelize this as:

library(futurize)
plan(multisession)
library(ez)

data(ANT)
rt <- ezBoot(
  data = ANT,
  dv = rt,
  wid = subnum,
  within = .(cue, flank),
  between = group,
  iterations = 1e3
) |> futurize()

This will distribute the bootstrap iterations across the available parallel workers.

Example: Permutation testing

The ezPerm() function performs a non-parametric factorial permutation test, and can be parallelized as:

library(futurize)
plan(multisession)
library(ez)
library(plyr)

data(ANT)
cell_stats <- ddply(
  .data = ANT,
  .variables = .(subnum, group, cue, flank),
  .fun = function(x) {
    data.frame(mrt = mean(x$rt[x$error == 0]))
  }
)
gmrt <- ddply(
  .data = cell_stats,
  .variables = .(subnum, group),
  .fun = function(x) {
    data.frame(mrt = mean(x$mrt))
  }
)

mean_rt_perm <- ezPerm(
  data = gmrt,
  dv = mrt,
  wid = subnum,
  between = group,
  perms = 1e3
) |> futurize()

Supported Functions

The following ez functions are supported by futurize():

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.