Learn R Programming

SimNPH (version 0.5.7)

analyse_describe: Create a Function for Descriptive Statistics of a Dataset

Description

Create a Function for Descriptive Statistics of a Dataset

Usage

analyse_describe()

summarise_describe(name = NULL)

Value

an analyse function that returns a list with the elements

  • followup follow up time

  • events table of events vs. treatment

  • ice if column ice is present, table of intercurrent events, events, treatment

  • subgroup if column subgroup is present, table of subgroup, events, treatment

A function that can be used in Summarise that returns a data frame with columns with means and standard deviations for every variable in the description.

Arguments

name

name for the summarise function, appended to the name of the analysis method in the final results

Functions

  • summarise_describe(): Summarise Descriptive Statistics

Examples

Run this code
condition <- merge(
    assumptions_delayed_effect(),
    design_fixed_followup(),
    by=NULL
  ) |>
  head(1)
dat <- generate_delayed_effect(condition)
analyse_describe()(condition, dat)
condition <- merge(
  assumptions_delayed_effect(),
  design_fixed_followup(),
  by=NULL
) |>
  tail(4) |>
  head(1)

summarise_all <- create_summarise_function(
  describe=summarise_describe()
)

# runs simulations
sim_results <- runSimulation(
  design=condition,
  replications=100,
  generate=generate_delayed_effect,
  analyse=list(
    describe=analyse_describe()
  ),
  summarise = summarise_all
)

# study time is missing, since there was no admin. censoring
sim_results[, 9:16]

Run the code above in your browser using DataLab