Fit and plot several models on one graph with model selection results
Source:R/plots.R
plot_multiple_fits.RdFits several models to the same data with fit_litter_all and plots them
together with plot.litfit_list. Existing fits can be plotted instead
by passing a litfit_list (or a list of litfit objects) as the first
argument, which avoids refitting.
Usage
plot_multiple_fits(
time,
mass.remaining,
model = c("neg.exp", "weibull", "discrete.parallel", "discrete.series", "cont.quality",
"neg.exp.limit"),
color = NULL,
iters = 500,
bty = "o",
...
)Arguments
- time
vector of time points, or a
litfit_list/ list oflitfitobjects to plot without refitting- mass.remaining
vector of mass remaining (ignored when
timeis a list of fits)- model
vector of models to fit and plot (see
fit_litter)- color
colours for the curves; defaults to the Okabe-Ito palette
- iters
number of random starts, passed to
fit_litter- bty
box type of the legend
- ...
additional arguments passed to
plot.default
Examples
plot_multiple_fits(
time = pineneedles$Year,
mass.remaining = pineneedles$Mass.remaining,
bty = "n", model = c("neg.exp", "weibull"), iters = 200
)
# plot existing fits without refitting
fits <- fit_litter_all(pineneedles$Year, pineneedles$Mass.remaining,
models = c("neg.exp", "cont.quality"), iters = 100
)
#> Warning: cont.quality: one or more parameters fit on the boundary (a), check fit closely
plot_multiple_fits(fits)