# Example I: Single formulation
df <- data.frame(
time = c(0, 15, 30, 45, 60, 90, 120, 150, 180),
remain = c(100, 88.6, 79.2, 69.2, 60.2, 42.2, 28.0, 15.2, 6.5)
)
hixson_crowell_model(
data = df,
time_col = "time",
remain_col = "remain"
)
# Example II: Two formulations (grouped, not pH-dependent)
df2 <- data.frame(
time = rep(c(0, 20, 40, 60, 80, 100, 120, 140, 160, 180), 2),
remain = c(
100, 90, 81, 72, 63, 54, 45, 36, 27, 18, # Formulation A
100, 92, 84, 76, 68, 60, 52, 44, 36, 28 # Formulation B
),
formulation = rep(c("Formulation A", "Formulation B"), each = 10)
)
hixson_crowell_model(
data = df2,
time_col = "time",
remain_col = "remain",
group_col = "formulation"
)
# Example III: pH-dependent release
df_pH <- data.frame(
time = rep(c(0, 20, 40, 60, 80, 100, 120, 140, 160, 180), 2),
remain = c(
100, 90, 80, 70, 60, 50, 40, 30, 20, 10, # pH 7.4
100, 92, 84, 76, 68, 60, 52, 44, 36, 28 # pH 4.5
),
pH = rep(c(7.4, 4.5), each = 10)
)
hixson_crowell_model(
data = df_pH,
time_col = "time",
remain_col = "remain",
pH_col = "pH"
)
# Example IV: Two formulations under two pH conditions
df1 <- data.frame(
time = rep(c(0, 20, 40, 60, 80, 100, 120, 140, 160, 180), 2),
remain = c(
100, 88, 75, 62, 50, 38, 28, 18, 10, 5, # pH 4.5
100, 90, 78, 65, 52, 40, 30, 20, 12, 6 # pH 7.6
),
pH = rep(c(4.5, 7.6), each = 10)
)
df2 <- data.frame(
time = rep(c(0, 15, 30, 45, 60, 75, 90, 105, 120, 135), 2),
remain = c(
100, 90, 78, 66, 54, 44, 34, 25, 16, 8, # pH 4.5
100, 92, 80, 68, 56, 44, 34, 24, 15, 7 # pH 7.6
),
pH = rep(c(4.5, 7.6), each = 10)
)
df_all <- rbind(
cbind(formulation = "Dataset 1", df1),
cbind(formulation = "Dataset 2", df2)
)
hixson_crowell_model(
data = df_all,
time_col = "time",
remain_col = "remain",
group_col = "formulation",
pH_col = "pH"
)
Run the code above in your browser using DataLab