R/maxBestimation.R
dot-fitNLMwCovariates.Rd
Uses likelihood parameter estimation to fit non linear models while attempting several starting values.
.fitNLMwCovariates(
data,
nonLinModelQuoted,
linModelQuoted,
mllsOuterPrev,
model = c("CR", "Logistic"),
maxCover = 1L,
starts = NULL,
lower = NULL,
upper = NULL,
nbWorkers = 1L
)
a data.table
or data.frame
with all covariates
and the response variable. Note that incomplete lines are removed.
The non-linear equation as a call
(quoted expression) passed to bbmle::mle2(minuslog1)
. See ?mle
.
Accepts equations with three parameters 'A', 'p' and 'k'.
A list of linear equations/modes relating each
parameter ('A', 'p' and 'k') with a set of covariates. A call
(quoted expression) passed to mle2(..., parameters)
. Note that for the
purpose of tree growth, the linear equation determining 'A' should include a
'cover' predictor indicating the tree cover or dominance in the stand. Should be
scaled between 0 and maxCover
.
the output of a previous fitNLMwCovariates
run which
is used to extract last best AIC and maximum biomass estimate and judge if new
iterations are better.
character. Non-linear model form used to estimate average maximum
biomass. One of "CR" (Chapman-Richards) or "Logistic". In both cases, maximum biomass
is equivalent to the 'A' asymptote parameter, which is estimated using observed mean
values of predictors entering its linear equation and cover == maxCover
, if this
predictor is included (as it should). Passed to extractMaxB
numeric. Value indicating maximum cover/dominance.
data.table
or data.frame
of parameter starting values. Will be coerced to named list
with names being parameter names.
passed to bbmle::mle2
passed to bbmle::mle2
integer. If > 1, the number of workers to use in parallelly::makeClusterPSOCK(nbWorkers = .)
,
otherwise no parallellisation is done.
a list
with entries mll
(the maximum likelihood-estimated
coefficients) and AICbest
(the AIC of the best models generating these coefficients)