# Example I: Single population toxicity study
df1 <- data.frame(
dose = c(5, 10, 20, 40, 80, 160),
toxic = c(0, 0, 0, 1, 1, 1)
)
td50_model(
data = df1,
dose_col = "dose",
response_col = "toxic"
)
# Example II: Grouped analysis (Male vs Female)
df2 <- data.frame(
dose = rep(c(5, 10, 20, 40, 80), 2),
toxic = c(0,0,1,1,1, 0,0,0,1,1),
sex = rep(c("Male","Female"), each = 5)
)
td50_model(
data = df2,
dose_col = "dose",
response_col = "toxic",
group_col = "sex"
)
# Example III: Grouped by formulation and exposure route
df3 <- data.frame(
dose = rep(c(10, 25, 50, 100), 4),
toxic = c(0,0,1,1, 0,1,1,1, 0,0,0,1, 0,0,1,1),
formulation = rep(c("A","B"), each = 8),
route = rep(c("Oral","IV"), each = 4, times = 2)
)
td50_model(
data = df3,
dose_col = "dose",
response_col = "toxic",
group_col = "formulation",
condition_col = "route"
)
Run the code above in your browser using DataLab