Learn R Programming

outstandR (version 1.0.0)

calculate_trial_variance: Calculate trial variance

Description

Computes the variance of treatment effects for a trial based on the specified family distribution.

Usage

calculate_trial_variance(ald, tid, effect, family)

Value

Numeric computed variance of treatment effects.

Arguments

ald

Aggregate-level data. Data frame.

tid

Treatment identifier used to extract relevant columns from ald.

effect

A character string specifying the effect scale (e.g., "log_odds", "risk_difference").

family

A character string specifying the model family (e.g., "binomial", "gaussian").

Examples

Run this code
ald <- data.frame(trt = c("B","C","B","C"),
                  variable = c(NA, NA, "y", "y"),
                  statistic = c("N", "N", "sum", "sum"),
                  value = c(100, 100, 50, 60))
                  
calculate_trial_variance(
  ald, tid = "B", effect = "log_odds", family = "binomial")
  

Run the code above in your browser using DataLab