calcMLE: calcMLE

View source: R/calcMLE.R

calcMLER Documentation

calcMLE

Description

Optimizes the likelihood function of the DNA mixture model

Usage

calcMLE(
  nC,
  samples,
  popFreq,
  refData = NULL,
  condOrder = NULL,
  knownRef = NULL,
  kit = NULL,
  DEG = TRUE,
  BWS = TRUE,
  FWS = TRUE,
  AT = 50,
  pC = 0.05,
  lambda = 0.01,
  fst = 0,
  knownRel = NULL,
  ibd = NULL,
  minF = NULL,
  normalize = TRUE,
  steptol = 1e-04,
  nDone = 3,
  delta = 1,
  difftol = 0.01,
  seed = NULL,
  verbose = FALSE,
  priorBWS = NULL,
  priorFWS = NULL,
  maxThreads = 0,
  adjQbp = FALSE
)

Arguments

nC

Number of contributors in model.

samples

A List with samples which for each samples has locus-list elements with list elements adata and hdata. 'adata' is a qualitative (allele) data vector and 'hdata' is a quantitative (peak heights) data vector.

popFreq

A list of allele frequencies for a given population.

refData

Reference objects has locus-list element [[i]] with a list element 'r' which contains a 2 long vector with alleles for each references.

condOrder

Specify conditioning references from refData (must be consistent order). For instance condOrder=(0,2,1,0) means that we restrict the model such that Ref2 and Ref3 are respectively conditioned as 2. contributor and 1. contributor in the model.

knownRef

Specify known non-contributing references from refData (index). For instance knownRef=(1,2) means that reference 1 and 2 is known non-contributor in the hypothesis. This affectes coancestry correction.

kit

shortname of kit: Obtained from getKit()

DEG

Boolean of whether Degradation model should be used

BWS

Boolean of whether back-stutter model should be used

FWS

Boolean of whether for-stutter model should be used

AT

The analytical threshold given. Used when considering probability of allele drop-outs.

pC

A numeric for allele drop-in probability. Default is 0.

lambda

Parameter in modeled peak height shifted exponential model. Default is 0.

fst

is the coancestry coeffecient. Default is 0.

knownRel

gives the index of the reference which the 1st unknown is related to.

ibd

the identical by decent coefficients of the relationship (specifies the type of relationship)

minF

The freq value included for new alleles (new alleles as potential stutters will have 0). Default NULL is using min.observed in popFreq.

normalize

Whether normalization should be applied or not. Default is FALSE.

steptol

Argument used in the nlm function for faster return from the optimization (tradeoff is lower accuracy).

nDone

Number of optimizations required providing equivalent results (same logLik value obtained)

delta

Scaling of variation of normal distribution when drawing random startpoints. Default is 1.

difftol

Tolerance for being exact in log-likelihood value (relevant when nDone>1)

seed

The user can set seed if wanted

verbose

Whether printing limits to integrate over. Printing progress if maxEval>0. Default is TRUE.

priorBWS

Prior function for BWS-parameter. Flat prior on [0,1] is default.

priorFWS

Prior function for FWS-parameter. Flat prior on [0,1] is default.

maxThreads

Maximum number of threads to be executed by the parallelization

adjQbp

Indicate whether fragmenth length of Q-allele is based on averaged weighted with frequencies

Value

Fitted maximum likelihood object

Author(s)

Oyvind Bleka

Examples

## Not run: 
kit = "ESX17"
AT = 50 #analytical threshold
sep0 = .Platform$file.sep
popfn = paste(path.package("euroformix"),"FreqDatabases",paste0(kit,"_Norway.csv"),sep=sep0)
evidfn = paste(path.package("euroformix"),"examples",paste0(kit,"_3p.csv"),sep=sep0)
reffn = paste(path.package("euroformix"),"examples",paste0(kit,"_refs.csv"),sep=sep0)
popFreq = freqImport(popfn)[[1]] #population frequencies
samples = sample_tableToList(tableReader(evidfn)) #evidence samples
refData = sample_tableToList(tableReader(reffn)) #reference sample
plotEPG2(samples,kit,refData,AT)
condOrder = c(1,2,0) #assuming C1=ref1,C2=ref2
mlefit = contLikMLE(3,samples,popFreq,refData,condOrder,kit=kit)
plotTopEPG2(mlefit)

## End(Not run)

oyvble/euroformix documentation built on Aug. 25, 2023, 11:14 a.m.