nlsList {nlme} | R Documentation |
List of nls Objects with a Common Model
Description
Data
is partitioned according to the levels of the grouping
factor defined in model
and individual nls
fits are
obtained for each data
partition, using the model defined in
model
.
Usage
nlsList(model, data, start, control, level, subset,
na.action = na.fail, pool = TRUE, warn.nls = NA)
## S3 method for class 'formula'
nlsList(model, data, start, control, level, subset,
na.action = na.fail, pool = TRUE, warn.nls = NA)
## S3 method for class 'nlsList'
update(object, model., ..., evaluate = TRUE)
Arguments
object |
an object inheriting from class |
model |
either a nonlinear model formula, with the response on
the left of a |
model. |
changes to the model – see |
data |
a data frame in which to interpret the variables named in
|
start |
an optional named list with initial values for the
parameters to be estimated in |
control |
a list of control values passed as the |
level |
an optional integer specifying the level of grouping to be used when multiple nested levels of grouping are present. |
subset |
an optional expression indicating the subset of the rows of
|
na.action |
a function that indicates what should happen when the
data contain |
pool |
an optional logical value that is preserved as an attribute of the
returned value. This will be used as the default for |
warn.nls |
|
... |
some methods for this generic require additional arguments. None are used in this method. |
evaluate |
If |
Details
As nls(.)
is called on each sub group, and convergence
of these may be problematic, these calls happen with error catching.
Since nlme version 3.1-127
(2016-04), all the errors are
caught (via tryCatch
) and if present, a “summarizing”
warning
is stored as attribute of the resulting
"nlsList"
object and signalled unless suppressed by
warn.nls = FALSE
or currently also when warn.nls = NA
(default) and getOption("show.error.messages")
is
false.
nlsList()
originally had used try(*)
(with its default
silent=FALSE)
and hence all errors were printed to the console
unless the global option show.error.messages
was set to true.
This still works, but has been deprecated.
Value
a list of nls
objects with as many components as the number of
groups defined by the grouping factor. Generic functions such as
coef
, fixed.effects
, lme
, pairs
,
plot
, predict
, random.effects
, summary
,
and update
have methods that can be applied to an nlsList
object.
References
Pinheiro, J.C., and Bates, D.M. (2000), Mixed-Effects Models in S and S-PLUS, Springer.
See Also
nls
, nlme.nlsList
,
nlsList.selfStart
,
summary.nlsList
Examples
fm1 <- nlsList(uptake ~ SSasympOff(conc, Asym, lrc, c0),
data = CO2, start = c(Asym = 30, lrc = -4.5, c0 = 52))
summary(fm1)
cfm1 <- confint(fm1) # via profiling each % FIXME: only *one* message instead of one *each*
mat.class <- class(matrix(1)) # ("matrix", "array") for R >= 4.0.0; ("matrix" in older R)
i.ok <- which(vapply(cfm1,
function(r) identical(class(r), mat.class), NA))
stopifnot(length(i.ok) > 0, !anyNA(match(c(2:4, 6:9, 12), i.ok)))
## where as (some of) the others gave errors during profile re-fitting :
str(cfm1[- i.ok])