Skip to contents

Design specifications

Write, validate and load the portable JSON specification that everything else reads.

build_spec()
Build a design specification from a flat list of design inputs
validate_spec()
Validate a design specification
load_spec()
Load a design specification from a JSON file
spec_json()
Serialise a design specification to pretty-printed JSON
spec_from_model()
Build a design specification from a fitted mixed model
pilotr_example()
Example design specifications shipped with pilotr

Simulation

Draw a data set from a specification, together with the model that specification implies.

simulate_design()
Simulate a data set from a design specification
model_data()
Build the modelling data frame from a simulated data set and its specification
model_formula()
Derive the lmer formula implied by a specification
default_response_name()
Default response-column name for a family

Power and design analysis

Estimate power by simulation, at one sample size or across a range of them, and solve the resulting curve for the value that meets a target.

power_design()
Simulation-based power and design analysis for a two-group Gaussian design
power_mixed()
Simulation-based power and design analysis for a mixed-effects design
power_curve_mixed()
Power curve over sample size for a mixed-effects design
solve_curve()
Solve a simulated design curve for the value that meets a target
target_n()
Solve a power curve for the sample size that reaches a target power
print(<pilotr_power>)
Print a simulation-based power result

Precision and equivalence

Size a study for the width of an interval rather than for a significance test.

precision_design()
Precision and ROPE design analysis at a fixed sample size
precision_curve()
Precision and ROPE curve over sample size

Calibration and sweeps

Tune a specification towards a target, and vary one of its fields across a range.

calibrate_response()
Rescale a design to a target total variance
response_variance()
Variance components of the linear predictor
design_conditions()
Build a grid of fixed-effect coefficient sets
sweep_spec()
Sweep an analysis over one field of a design specification

Generated analysis code

Emit runnable, self-contained code for the analysis a specification implies.

generate_r_script()
Generate a self-contained, reproducible R script from a specification
generate_design_analysis()
Generate a Bayesian design-analysis script from a specification
brms_bridge()
Derive a brms formula, family, and priors from a design spec

Reproducibility

The shared random-number stream that makes an R run and a Python run agree bit for bit.

make_rng()
Create a shared cross-language random-number generator
replicate_seeds()
Seeds for the replicates of a Monte Carlo run
as241()
Inverse normal cumulative distribution function (Wichura's AS 241)

App

The code-free interface to the same workflow.

run_app()
Launch the pilotr no-code app

Package overview

What the package does, and where to start.

pilotr pilotr-package
pilotr: Simulate Experimental and Behavioural Data from a Portable Design Specification