View source: R/simulate_missing_data_array.R
simulate_missing_data_array | R Documentation |
Some data sets have a lot of missing markers. If this is the case, it is not OK to just do the simulations as if there is no missing data. This function wraps up a lot of different steps that can be taken to try to get more accurate "first-pass" FPRs and FNRs for situations with a lot of missing data. The steps are:
Tabulate the distribution of the number of informative (i.e., not missing in either member of the pair) markers, across all pairs. (Note, this requires that you have an actual data set that you are trying to do relationship inference in.)
Estimate missingness rates per locus, and from that calculate the rate of missingness in pairs, under a simple independence assumption.
Simulate Q_ij values at a series of different numbers of non-missing loci to calculate FPRs and FNRs for those.
simulate_missing_data_array(LG, C, num_points = 11, num_cores = 1, ...)
LG |
the genotypes in long format. It must have the columns Indiv (unique IDs of the individuals), Locus, gene_copy (must be 1 or 2 denoting which of the two gene copies in a diploid each allele is), and Allele, which must be a character. If there are any missing genotypes in the data frame, they must appear as NAs in the Allele column. |
C |
the ckmr object upon which to base the simulations. |
num_points |
the number of different values between the lowest observed number of pairwise non-missing genotypes and the highest, inclusive, that simulations will be performed for. |
num_cores |
Number of cores to parallelize the simulations over (using mclapply) from the parallel package. On Windows, parallelization is not available from forking so this must remain equal to 1 on Windows. |
... |
Arguments passed on to
|
This function returns a list. More on that later.
# this is just here for testing at the moment
LG <- read_rds("/tmp/LG.rds")
C <- read_rds("/tmp/C.rds")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.