likeLTD::optimisation.params

Description

Creates a list of parameters to use with DEoptim::DEoptim.

Usage

1
2
3
4
5
optimisation.params(hypothesis, verbose=FALSE, fixed=NULL,
                           logObjective=TRUE, logDegradation=TRUE,
                           arguments=NULL, zero=0, throwError=FALSE,
                           withPenalties=TRUE, doLinkage=TRUE,objective=NULL, iterMax=75, 
                           likeMatrix=FALSE,...)

Arguments

hypothesis

Hypothesis from which to perform maximization

verbose

Wether to print likelihood each and every time the objective function is called

fixed

Names of the parameters to keep fixed

logObjective

If TRUE (default), the objective function is the log10-likelihood.

logDegradation

If TRUE (default), the degradation parameters are entered as 10^x

arguments

Initial parameters from which to start the maximization. If NULL, calls initial.arguments.

zero

Epsilon to indicate lower and upper bounds as alpha +/- epsilon that exclude the bound itself

throwError

If TRUE, throws an error if the result is infinite

withPenalties

If TRUE, then penalties are evaluated and used

doLinkage

Logical indicating whether or not to apply a correction for linked loci. This correction is only applied when Q and X are assumed to be siblings i.e. hypothesis$relatedness=c(0.5,0.25). This multiplies the prosecution likelihood by IMP_L/IMP_U, where IMP_L is the inverse match probability with linkage taken into account, and IMP_U is the same but without linkage taken into account.

objective

Objective function produced from create.likelihood.vectors

iterMax

Number of iterations to run the optimisation for

likeMatrix

Whether to return likelihoods for every genotype combination, or a likelihood summed over all genotypes after optimisation. Set to TRUE for individual genotype likelihoods. This is used for get.likely.genotypes.

...

Any named parameter to modify the hypothesis, e.g. nUnknowns

Details

Starting from the hypothesis, it creates an list of arguments which can be applied to DEoptim::DEoptim to obtain the maximum (log-)likelihood of that hypothesis.

It accepts a number of customization:

  • The optimisation can be performed for the likelihood or the log of the likelihood. The latter is recommended.

  • wether the degradation parameter should be inputs as x or as an exponent 10^x. The latter seems to be more numerically stable, likely because degradations (in first form) are factors of an exponent in any case.

  • whether to keep some nuisance parameters fixed

In any case, the value returned can always be modified prior to calling DEoptim::DEoptim.

Value

fn

The objective function

lower

Lower bounds for the parameters

upper

Upper bounds for the parameters

control

Control parameters for DEoptim::DEoptim

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
## Not run: 
# datapath to example files
datapath = file.path(system.file("extdata", package="likeLTD"),"hammer")

# File paths and case name for allele report
admin = pack.admin.input(
            cspFile = file.path(datapath, 'hammer-CSP.csv'),
            refFile = file.path(datapath, 'hammer-reference.csv'),
            caseName = "hammer",
	    kit= "SGMplus"
             )

# Enter arguments
args = list(
        nUnknowns = 1,
        doDropin = FALSE,
        ethnic = "EA1",
        adj = 1,
        fst = 0.02,
        relatedness = c(0,0)
        )

# Create hypotheses
hypP = do.call(prosecution.hypothesis, append(admin,args))
hypD = do.call(defence.hypothesis, append(admin,args))

# Get parameters for optimisation
paramsP = optimisation.params(hypP)
paramsD = optimisation.params(hypD)

## End(Not run)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.