Learn R Programming

PowRPriori (version 0.1.2)

.create_design_matrix: Create the Design Matrix for a Simulation

Description

An internal helper function that takes the design specification and a sample size to generate a single data frame representing all observations for one simulation run. It handles within-, between-, nested, and crossed factors.

Usage

.create_design_matrix(design, current_n, n_is_total = TRUE)

Value

A tibble (data frame) with predictor variables.

Arguments

design

A PowRPriori_design object from define_design().

current_n

The sample size for which the design matrix should be generated.

n_is_total

A boolean that controls how current_n is interpreted. TRUE assumes that the whole sample used for the simulation should be size current_n, FALSE assumes that current_n specifies the size of each cell as defined by design.