mlsolve {bio.infer} | R Documentation |
mlsolve
uses maximum likelihood estimation to infer
environmental conditions from biological observations.
mlsolve(ss, coef0, site.sel = "all", bruteforce = FALSE)
ss |
A site-species matrix, with sample identifiers in the first
column, and abundances. Typically, the result of |
site.sel |
Character vector of sample id's at which inferences should be computed. Default selection of 'all' forces script to compute inferences for all samples in the matrix. |
coef0 |
Coefficient file with model specifications and regression
coefficients defining
taxon-environment relationships. See |
bruteforce |
Logical flag. Select |
mlsolve
uses maximum likelihood estimation to infer environmental
conditions from biological observations. Maximum likelihood
estimation in this context is a constrained optimization problem, in
which we wish find the point at which the likelihood function is
maximized, constrained by the range of the environmental variables in
the calibration data. mlsolve
formulates the likelihood
function and calls optim
to solve the optimization
problem.
The option bruteforce
can be used to check the performance of the
iterative solver. When bruteforce
is set to be TRUE
,
the script also
computes likelihood values for a uniformly-spaced grid that spans the
ranges of the environmental variables. This is a time-consuming
calculation, and therefore should only be attempted on a few samples.
Once the grid is computed, though, contours of the likelihood surface
are plotted.
mlsolve
requires that the taxa included in ss
each have
associated taxon-environment information in coef0
. The best
way to ensure that this condition is satisfied is to make sure that
get.otu
is run with the same coef0
as used in
mlsolve
, and that the results from get.otu
are used to
generate ss
(see makess
).
The script returns a dataframe containing inferences for each sample as well as a logical flag indicating whether solutions computing with four different starting locations are consistent with one another.
Lester L. Yuan
data(coef.west.wt)
data(ss.OR)
inf.out <- mlsolve(ss.OR, coef.west.wt)