moimle {MLMOI} | R Documentation |
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))
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 |
nummtd |
numeric; number of metadata columns (e.g.
date, sample location, etc.) in the dataset (default
value is |
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 \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
.
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:
-
sample size,
allele prevalence counts,
-
observed prevalences
log likelihood at MLE,
-
maximum-likelihood estimate of MOI parameter,
-
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
\lambda_min or \lambda_max
respectively, a warning
is generated.
See Also
To import and transform data to standard format,
please see the function moimport()
.
Examples
#basic data analysis
infile1 <- system.file("extdata", "testDatamerge1.xlsx", package = "MLMOI")
mle1 <- moimle(infile1, nummtd = 1)