moimle: Estimates prevalences, frequency spectra and MOI parameter.

Description Usage Arguments Details Value Warnings See Also Examples

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

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

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.

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 λ. i.e., bounds = c(<λ_min>, <λ_max>), this problem is bypassed and the ML estimates are calculated by profiling at λ_min or λ_max. If no super-infections are observed at a marker, moimle() uses λ_min as the MOI parameter estimate, λ_max if one lineage is present in all samples. For regular data, the profile-likelihood estimate using λ_min or λ_max is returned depending on whether the ML estimate falls below λ_min or above λ_max.

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. sample size,

  2. allele prevalence counts,

  3. observed prevalences

  4. log likelihood at MLE,

  5. maximum-likelihood estimate of MOI parameter,

  6. maximum-likelihood estimates of lineage frequencies.

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 λ_min or λ_max respectively, a warning is generated.

See Also

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

Examples

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

MLMOI documentation built on Jan. 11, 2020, 9:22 a.m.