sim_individual_data: Generate sample individual level data based upon a PheWAS...

Description Usage Arguments Value Examples

View source: R/sim_individual_data.R

Description

This function will take the results of a PheWAS study (most importantly a code, case and control numbers, and an OR) and simulate as many individual datapoints as you desire. Should only be used for testing of apps and not any real simulation studies.

Usage

1
sim_individual_data(phewas_results, num_patients, snp_prev)

Arguments

phewas_results

Phewas results. Needs a column code with the id of a given phecode, and OR: the odds ratio of having a code given having the snp of interest. Optionally, individuals that have the code in the entire population can be provided with column code_proportion.

num_patients

How many patients should be simulated.

snp_prev

The overall population prevalence of the snp you want to simulate.

Value

list with following components

snp_status

tibble with patient ID and snp status (snp)

phenotypes

wide tibble with an ID column and a column for each code provided in the phewas_resuts input. Cell values are if the patient had that given code.

Examples

1
2
simulated_phewas <- sim_phewas_results(n_codes = 100, n_categories = 11)
sim_individual_data(simulated_phewas, 10, 0.15)

tbilab/meToolkit documentation built on June 23, 2020, 9:55 a.m.