epi_stats_prop_outcome: Calculate the proportion of individuals who suffered an event...

View source: R/epi_stats_prop_outcome.R

epi_stats_prop_outcomeR Documentation

Calculate the proportion of individuals who suffered an event at a given point in time

Description

It can be used to estimate the case fatality rate.

Usage

epi_stats_prop_outcome(
  df,
  outcome_var_window,
  pop_at_risk_var,
  analysis_window,
  round_dig = 4
)

Arguments

df

A data frame containing the data.

outcome_var_window

A string representing the column name of the outcome variable at the analysis window. Expects an integer where 1 = event, 0 = no event.

pop_at_risk_var

A string representing the column name of the population at risk variable. This is matched against the analysis window to obtain a subset.

analysis_window

A value from the variable passed as pop_at_risk_var representing the analysis window.

round_dig

An integer representing the number of decimal places to round the result to. Default is 4.

Value

The proportion of individuals who suffered the event at the given point, printed and returned as a numeric value.

Examples

## Not run: 
df <- data.frame(
  d_T0_outcome = c(1, 0, 1, 0, 1),
  d_time_cuts_prev = c('T0', 'T1', 'T0', 'T1', 'T0')
)
outcome_var_window <- 'd_T0_outcome'
pop_at_risk_var <- 'd_time_cuts_prev'
analysis_window <- 'T0'
epi_stats_prop_outcome(df, outcome_var_window, pop_at_risk_var, analysis_window)

## End(Not run)

AntonioJBT/episcout documentation built on Feb. 20, 2025, 12:46 a.m.