chart.nls | R Documentation |
The methods autoplot()
or chart()
for nls objects. If
type = model
(by default for chart()
), a scatterplot with the model
superimposed is produced,. The other types allow to analyze the residuals of
the model.
## S3 method for class 'nls'
chart(
data,
type = "model",
...,
title,
labels = "AUTO",
name = deparse(substitute(data)),
lang = getOption("data.io_lang", "en"),
env = parent.frame()
)
autoplot.nls(
object,
type = c("model", "resfitted", "qqplot", "scalelocation", "reshist", "resautocor"),
title,
xlab,
ylab,
...,
name = deparse(substitute(object)),
lang = getOption("data.io_lang", "en"),
env = parent.frame()
)
data |
A nls model. |
type |
The type of plot: |
... |
Additional arguments passed to the chart. |
title |
A title for the plot. If not provided, a default title is computed. |
labels |
A vector of four character strings, one for each plot done with
|
name |
The name of the model. If not provided, it is the name of the model object by default. |
lang |
The language to use for titles and labels, currently only |
env |
The environment to evaluate code. It is |
object |
Idem |
xlab |
A label for the X axis. A default label is proposed if it is not provided. |
ylab |
A label for the Y axis (with default if not provided). |
The ggplot object produced.
data("ChickWeight", package = "datasets")
chick1 <- ChickWeight[ChickWeight$Chick == 1, ]
# Adjust a logistic curve
chick1_logis <- nls(weight ~ SSlogis(Time, Asym, xmid, scal), data = chick1)
library(chart)
chart(chick1_logis)
# Residuals analysis
chart$resfitted(chick1_logis)
chart$qqplot(chick1_logis)
chart$scalelocation(chick1_logis)
chart$reshist(chick1_logis, bins = 15)
chart$resautocor(chick1_logis)
# The four most important residual analysis plots in one figure
chart$residuals(chick1_logis)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.