compute_sample_size: Compute (effective) sample size

View source: R/compute_sample_size.R

compute_sample_sizeR Documentation

Compute (effective) sample size

Description

Computes sample sum (as new column "N") or effective sample size (ESS) (as new column "Neff"). Computing ESS is important as it takes into account the proportion of cases to controls (i.e. class imbalance) so as not to overestimate your statistical power.

Usage

compute_sample_size(
  sumstats_dt,
  method = c("ldsc", "giant", "metal", "sum"),
  force_new = FALSE,
  append_method_name = FALSE
)

Arguments

sumstats_dt

Summary statistics data.table.

method

Method for computing (effective) sample size.

force_new

If "Neff" (or "N") already exists in sumstats_dt, replace it with the recomputed version.

append_method_name

should Neff column have an indicator to explain the method that makes it., Default is FALSE unless multiple methods are passed

Details

There are many different formulas for calculating ESS, but LDSC is probably the best method available here, as it doesn't assume that the proportion of controls:cases is 2:1 (as in GIANT) or 4:1 (as in METAL).

Value

A data.table with a new column "Neff" or "N"


neurogenomics/MungeSumstats documentation built on May 2, 2024, 9:04 a.m.