MPPsims: Missing person power simulations

View source: R/MPPsims.R

MPPsimsR Documentation

Missing person power simulations

Description

Estimate the exclusion/inclusion power for various selections of available individuals.

Usage

MPPsims(
  reference,
  missing = "MP",
  selections,
  ep = TRUE,
  ip = TRUE,
  addBaseline = TRUE,
  nProfiles = 1,
  lrSims = 1,
  thresholdIP = NULL,
  disableMutations = NA,
  numCores = 1,
  seed = NULL,
  verbose = TRUE
)

Arguments

reference

A connected ped object, or a list of pedigrees. In the latter case, the list must have the same length as selections.

missing

The ID label of the missing pedigree member.

selections

A list of pedigree member subsets. In the special case that all subsets consist of a single individual, selections can be given as a simple vector.

ep

A logical: Estimate the exclusion power? (Default: TRUE)

ip

A logical: Estimate the inclusion power? (Default: TRUE)

addBaseline

A logical. If TRUE (default) an empty selection, named "Baseline", is added as the first element of selection.

nProfiles

The number of profile simulations for each selection.

lrSims, thresholdIP

Parameters passed onto missingPersonIP().

disableMutations

This parameter determines how mutation models are treated. Possible values are as follows:

  • NA (the default): Mutations are disabled only for those markers whose known genotypes are consistent with the pedigree. This is determined by temporarily removing all mutation models and checking which markers have nonzero likelihood.

  • TRUE: Mutations are disabled for all markers. This will result in an error if any markers are inconsistent.

  • FALSE: No action is done to disable mutations.

  • A vector containing the names or indices of those markers for which mutations should be disabled.

numCores

The number of cores used for parallelisation, by default 1.

seed

An integer seed for the random number generator (optional).

verbose

A logical.

Value

An object of class "MPPsim", which is basically a list with one entry for each element of selections. Each entry has elements ep and ip, each of which is a list of length nProfiles.

The output object has various attributes reflecting the input. Note that reference and selection may differ slightly from the original input, since they may be modified during the function run. (For instance, a "Baseline" entry is added to selection if addBaseline is TRUE.) The crucial point is that the output attributes correspond exactly to the output data.

  • reference (always a list, of the same length as the selections attribute

  • selections

  • nProfiles,lrSims,thresholdIP,seed (as in the input)

  • totalTime (the total time used)

Examples

x = nuclearPed(fa = "Gf", mo = "Gm", children = c("Uncle", "Mother"), sex = 1:2)
x = addChildren(x, fa = "Father", mo = "Mother", nch = 3, sex = c(1,2,1),
                id = c("S1", "S2", "MP"))
x = addSon(x, "Father", id = "HS")

# Brother S1 is already genotyped with a marker with 4 alleles
x = addMarker(x, S1 = "1/2", alleles = 1:4)

# Alternatives for additional genotyping
sel = list("Father", "S2", "HS", c("Gm", "Uncle"))

plot(x, marker = 1, hatched = sel)

# Simulate
simData = MPPsims(x, selections = sel, nProfiles = 2, lrSims = 2)

# Power plot
powerPlot(simData, type = 3)


### With  mutations
# Add inconsistent marker
x = addMarker(x, S1 = "1/2", Father = "3/3", alleles = 1:4)

# Set mutation models for both
mutmod(x, 1:2) = list("equal", rate = 0.1)

# By default mutations are disabled for consistent markers
MPPsims(x, selections = "Father", addBaseline = FALSE)

# Don't disable anything
MPPsims(x, selections = "Father", addBaseline = FALSE,
        disableMutations = FALSE)


# Disable all mutation models. SHOULD GIVE ERROR FOR SECOND MARKER
# MPPsims(x, selections = "Father", addBaseline = FALSE,
#         disableMutations = TRUE)




magnusdv/forrel documentation built on March 9, 2024, 4:05 a.m.