Learn R Programming

MLMOI (version 0.1.2)

moimle: Estimates prevalences, frequency spectra and MOI parameter.

Description

moimle() derives the maximum-likelihood estimate (MLE) of the MOI parameter (Poisson parameter) and the lineage (allele) frequencies for each molecular marker in a dataset. Additionally, the lineage prevalence counts are derived.

Usage

moimle(file, nummtd = 0, bounds = c(NA, NA))

Value

moimle() returns a nested list, where the outer elements correspond to molecular markers in the dataset. The inner elements for each molecular marker contain the following information:

  1. allele prevalence counts,

  2. observed prevalences

  3. log likelihood at MLE,

  4. maximum-likelihood estimate of MOI parameter,

  5. maximum-likelihood estimates of lineage frequencies.

Arguments

file

string or data.frame; if file is a path it must specify the path to the file to be imported. The dataset can also be a data.frame object in R. The dataset must be in standard format (see moimport()). The first column must contain sample IDs. Adjacent columns can contain metadata, followed by columns corresponding to molecular markers.

nummtd

numeric; number of metadata columns (e.g. date, sample location, etc.) in the dataset (default value is nummtd = 0).

bounds

numeric vector; a vector of size 2, specifying a lower bound (1st element) and an upper bound (2nd element) for the MOI parameter. The function derives lineage frequency ML estimates by profiling the likelihood function on one of the bounds. For a marker without sign of super-infections, the lower bound is employed. If one allele is contained in every sample, the upper bound is employed.

Warnings

Warnings are issued, if data is pathological at one or multiple markers. If the option bounds is set, but MLE of MOI parameter at a molecular marker takes a lower or higher value than \(\lambda_min or \lambda_max\) respectively, a warning is generated.

Details

moimle() requires a dataset in standard format which is free of typos (e.g. incompatible and unidentified entries). Therefore, users need to standardize the dataset by employing the moimport() function.

If one or more molecular markers contain pathological data, the ML estimate for the Poisson parameter is either 0 or does not exist. Both estimates are meaningless, however, in the former case frequency estimates exist while they do not in the later. By setting the option bounds as a range for MOI parameter \(\lambda\). i.e., bounds = c(<\(\lambda_min\)>, <\(\lambda_max\)>), this problem is bypassed and the ML estimates are calculated by profiling at \(\lambda_min\) or \(\lambda_max\). If no super-infections are observed at a marker, moimle() uses \(\lambda_min\) as the MOI parameter estimate, \(\lambda_max\) if one lineage is present in all samples. For regular data, the profile-likelihood estimate using \(\lambda_min\) or \(\lambda_max\) is returned depending on whether the ML estimate falls below \(\lambda_min\) or above \(\lambda_max\).

See Also

To import and transform data to standard format, please see the function moimport().

Examples

Run this code

#basic data analysis
infile1 <- system.file("extdata", "testDatamerge1.xlsx", package = "MLMOI")
mle1 <- moimle(infile1, nummtd = 1)

Run the code above in your browser using DataLab