Skip to contents

This function simulates dose-response data with a hierarchical structure: n doses, m tanks per dose, and optionally k individuals per tank, with variance components that can vary by dose level.

Usage

simulate_dose_response(
  n_doses,
  dose_range = c(0, 20),
  m_tanks = 3,
  k_individuals = 10,
  var_tank = 4,
  var_individual = 2,
  include_individuals = TRUE,
  response_function = NULL,
  ...
)

Arguments

n_doses

Number of dose levels

dose_range

Vector of length 2 specifying the min and max dose values

m_tanks

Number of tanks per dose

k_individuals

Number of individuals per tank (only used if include_individuals = TRUE)

var_tank

Variance at the tank level. Can be a single value or a vector of length n_doses.

var_individual

Variance at the individual level. Can be a single value or a vector of length n_doses.

include_individuals

Logical, whether to simulate individual-level data (TRUE) or only tank-level data (FALSE)

response_function

Function that calculates the response given a dose

...

Additional parameters to pass to the response_function

Value

A data frame containing the simulated dose-response data