-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
covariate_defns_ald <- list(
PF_cont_1 = list(type = continuous(mean = meanX_BC[1], sd = sdX[1]),
role = "prognostic"),
PF_cont_2 = list(type = continuous(mean = meanX_BC[2], sd = sdX[2]),
role = "prognostic"),
EM_cont_1 = list(type = continuous(mean = meanX_EM_BC[1], sd = sdX_EM[1]),
role = "effect_modifier"),
EM_cont_2 = list(type = continuous(mean = meanX_EM_BC[2], sd = sdX_EM[2]),
role = "effect_modifier")
)
BC.IPD <- simcovariates::gen_data(
N = N,
b_0 = b_0,
b_trt = b_trt,
covariate_defns = covariate_defns_ald,
b_prognostic = b_prognostic,
b_effect_modifier = b_effect_modifier,
cor_matrix = cor_matrix,
trt_assignment = list(prob_trt1 = allocation),
family = binomial("logit"))
BC.IPD$trt <- factor(BC.IPD$trt, labels = c("C", "B"))
# covariate summary statistics
# assume same between treatments
cov.X <-
BC.IPD %>%
as.data.frame() |>
dplyr::select(matches("^(PF|EM)"), trt) |>
tidyr::pivot_longer(
cols = starts_with("PF") | starts_with("EM"),
names_to = "variable",
values_to = "value") |>
group_by(variable) %>%
summarise(
mean = mean(value),
sd = sd(value)
) %>%
tidyr::pivot_longer(
cols = c("mean", "sd"),
names_to = "statistic",
values_to = "value") %>%
ungroup() |>
mutate(trt = NA)
# outcome
summary.y <-
BC.IPD |>
as.data.frame() |>
dplyr::select(y, trt) %>%
tidyr::pivot_longer(cols = "y",
names_to = "variable",
values_to = "value") %>%
group_by(variable, trt) %>%
summarise(
mean = mean(value),
sd = sd(value),
sum = sum(value)
) %>%
tidyr::pivot_longer(
cols = c("mean", "sd", "sum"),
names_to = "statistic",
values_to = "value") %>%
ungroup()
# sample sizes
summary.N <-
BC.IPD |>
group_by(trt) |>
count(name = "N") |>
tidyr::pivot_longer(
cols = "N",
names_to = "statistic",
values_to = "value") |>
mutate(variable = NA_character_) |>
dplyr::select(variable, statistic, value, trt)
ald_trial <- rbind.data.frame(cov.X, summary.y, summary.N)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels