Skip to contents

aetable is used to plot a table of AE summary by body system class and arm using the following summary statistics:

  • Total number of participants at risk per arm

  • Frequency (number of participants with at least one event for each body system class)

  • Proportions (number of participants with at least one event for each body system class relative to number of participants at risk)

  • Number of adverse events per participant: presented as counts, mean (SD)

  • Total number of events and incidence rates (number of events relative to total time in follow-up)

  • Treatment effect estimate and 95% confidence intervals

Usage

aetable(
  data,
  control,
  intervention_levels,
  body_system_class = "body_system_class",
  id = "id",
  arm = "arm",
  date_rand = "date_rand",
  last_visit = "last_visit",
  control_name = NULL,
  intervention_names = NULL,
  treatment_effect_estimate = TRUE,
  model = "Poisson (rate)",
  variables = c(),
  mean = TRUE,
  drop_bodsys = TRUE,
  IR_per_person = 100,
  proportions_dp = 1,
  IR_dp = 1,
  mean_dp = 1,
  SD_dp = 1,
  estimate_sf = 3,
  CI_sf = 3,
  save_image_path = NULL,
  save_docx_path = NULL
)

Arguments

data

data frame with adverse_event, body_system_class, id, arm, date_rand and last_visit columns (optional: variables to be included in model)

control

factor level of control arm

intervention_levels

vector of factor levels for interventions

body_system_class

name of body_system_class column

id

name of id column

arm

name of arm column

date_rand

name of date_rand column

last_visit

name of last_visit column

control_name

name of control arm

intervention_names

vector of names for interventions

treatment_effect_estimate

a logical value whether to include treatment effect estimate and 95% CI column in summary table (only for 2 arms)

model

model used for computation of treatment effect estimate and 95% CI

variables

vector of variable names to be included in the model for computation of treatment effect estimate (excluding arm)

mean

a logical value whether to include mean and SD column in summary table

drop_bodsys

a logical value whether to drop body system class with no observations from summary table

IR_per_person

incidence rate per number of person

proportions_dp

number of decimal places for proportions

IR_dp

number of decimal places for incidence rate

mean_dp

number of decimal places for mean number of AEs per participant

SD_dp

number of decimal places for standard deviation of number of AEs per participant

estimate_sf

number of significant figures for treatment effect estimate

CI_sf

number of significant figures for 95% CI

save_image_path

file path to save table as image

save_docx_path

file path to save table as docx

Value

flextable of AE summary by body system class and arm

Treatment Effect Estimate

The treatment effect and its 95% confidence interval are estimated via the following models below:

  • Poisson (rate): fitting a generalised linear model with Poisson family and log link with length of follow up time as offset

  • Poisson (count): fitting a generalised linear model with Poisson family and log link with count as response

  • Negative Binomial (rate): fitting a Negative Binomial model with length of follow up time as offset

  • Negative Binomial (count): fitting a Negative Binomial model with count as response

  • Binomial (logit): fitting a generalised linear model with Binomial family and logit link

  • Binomial (log): fitting a generalised linear model with Binomial family and log link

  • Binomial (identity): fitting a generalised linear model with Binomial family and identity link

The default model is the Poisson (rate) model.

For Poisson and Negative Binomial models, the treatment effect estimate is the Incidence Rate Ratio (IRR). For Binomial (logit) model, the treatment effect estimate is the Odds Ratio (OR). For Binomial (log) model, the treatment effect estimate is the Risk Ratio (RR). For Binomial (identity) model, the treatment effect estimate is the Risk Difference (RD).

The reference group for the treatment arm in the regression model is the control arm.

Additional covariates besides arm can be added into the model via the argument variables. Note that interaction terms cannot be added to the model.

Examples

library(flextable)
set_flextable_defaults(font.family="sans")
df2$aebodsys <- as.factor(df2$aebodsys)
aetable(df2, body_system_class="aebodsys", control="Placebo", intervention_levels=c("Intervention"), treatment_effect_estimate=TRUE, variables = c("variable1", "variable2"))