calculate_SKAT_empirical_p: Produce permuted p-values or empirical p-value for SKAT

View source: R/calculate_SKAT_empirical_p.R

calculate_SKAT_empirical_pR Documentation

Produce permuted p-values or empirical p-value for SKAT

Description

Produce permuted p-values or empirical p-value for SKAT

Usage

calculate_SKAT_empirical_p(
  Z,
  n_permutations,
  null_model,
  missing_cutoff = 0.15,
  return_all_p_vals = FALSE,
  ...
)

Arguments

Z

Matrix with row for each genotype in the SNP dataset, columns for each SNP in the SNP window of interest, and numeric values of 0, 1, 2 indicating number of alternative alleles for each SNP in each genotype (or NA for indels or missing data)

n_permutations

Integer indicating the number of permutations used to calculate empirical p-values

null_model

Object generated by SKAT_Null_Model

missing_cutoff

A numeric threshold representing the minimum desired missing rate; missing rate is defined for each SNP as the proportion of genotypes missing data for the given SNP. Imputation to mean is performed , either by 'pre_allocate' or 'SKAT' itself, for all remaining missing values

return_all_p_vals

If 'TRUE', will return a vector of all permuted p-values (useful for when not all permutations can fit into memory available for a single thread); if 'FALSE', will calculate and return the empirical p-value

...

Additional parameters passed on to SKAT

Value

An empirical p-value or vector of permuted p-values, depending on the user-submitted argument for 'return_all_p' as described above

Examples

data("small_pre_allocated_windows")

sample_null_model <- SKAT::SKAT_Null_Model(
  small_phenodata ~ 1 + as.matrix(small_covariates), out_type="C",
  n.Resampling = 1000)

calculate_SKAT_empirical_p(
  Z = small_pre_allocated_windows[[1]][[2]],
  n_permutations = 1000,
  null_model = sample_null_model,
  return_all_p = FALSE)

calculate_SKAT_empirical_p(
  Z = small_pre_allocated_windows[[1]][[2]],
  n_permutations = 1000,
  null_model = sample_null_model,
  return_all_p = TRUE)

naglemi/mtmcskat documentation built on Aug. 23, 2023, 5:35 p.m.