This repository contains R functions to derive etimates and generate simulated data according to the methods and models described in the paper "Bias-corrected maximum-likelihood estimation of multiplicity of infection and lineage frequencies" (https://doi.org/10.1371/journal.pone.0261889). To import/merge molecular data of any type (STR, SNPs, amino acids) and format and apply further analysis please refer to the the R package "MLMOI" (https://cran.r-project.org/web/packages/MLMOI/index.html).
Description of the functions included in the repository:
- MLE: derives the maximum-likelihood estimate (MLE) of the MOI parameter (Poisson parameter) and the lineage (allele) frequencies;
- BCMLE: derives the bias-corrected maximum-likelihood estimate (BCMLE) of the MOI parameter (Poisson parameter) and the lineage (allele) frequencies;
- HBCMLE1 derives the 1st version of heuristically bias-corrected maximum-likelihood estimate (HBCMLE1) of the MOI parameter (Poisson parameter) and the lineage (allele) frequencies;
- HBCMLE2 derives the 2nd version of heuristically bias-corrected maximum-likelihood estimate (HBCMLE2) of the MOI parameter (Poisson parameter) and the lineage (allele) frequencies;
- HBCMLE3 derives the 1st version of heuristically bias-corrected maximum-likelihood estimate (HBCMLE3) of the MOI parameter (Poisson parameter) and the lineage (allele) frequencies;
- second_order_bias derives the approximated second-order bias of the MLE;
- prob_pathological derives the probability of pathological data;
- cpoiss generates conditionally Poisson distributed numbers;
- mnom generates multinomially distributed random vectors;
- cnegb generates negative binomial distributed random numbers;
- Cramer-Rao lower bounds derives Cramer-Rao lower bounds (CRLB) of the model parameters;
- simulation_bc the core function for the simulation study;
- all_functions this file contains all the functions described above.