# NOT RUN {
# }
# NOT RUN {
# Fit many curves (using an example dataset)
# The bilinear method is much faster, but compare using 'default'!
fits <- fitacis(manyacidat, "Curve", fitmethod="bilinear")
with(coef(fits), plot(Vcmax, Jmax))
# The resulting object is a list, with each component an object as returned by fitaci
# So, we can extract one curve:
fits[[1]]
plot(fits[[1]])
# Plot all curves in separate figures with plot(fits)
# Or, in one plot:
plot(fits, how="oneplot")
# Note that parameters can be passed to plot.acifit. For example,
plot(fits, how="oneplot", what="data", col="blue")
plot(fits, how="oneplot", add=TRUE, what="model", lwd=c(1,1))
# Other elements can be summarized with sapply. For example, look at the RMSE:
rmses <- sapply(fits, "[[", "RMSE")
plot(rmses, type='h', ylab="RMSE", xlab="Curve nr")
# And plot the worst-fitting curve:
plot(fits[[which.max(rmses)]])
# It is very straightforward to summarize the coefficients by a factor variable
# that was contained in the original data. In manyacidat, there is a factor variable
# 'treatment'.
# We first have to refit the curves, using the 'id' argument:
fits <- fitacis(manyacidat, "Curve", fitmethod="bilinear", id="treatment")
# And now use this to plot Vcmax by treatment.
boxplot(Vcmax ~ treatment, data=coef(fits), ylim=c(0,130))
# As of package version 1.4-2, you can also use the id variable for colouring curves,
# when plotting all fitted curves in one plot.
# Set colours to be used. Also note that the 'id' variable has to be a factor,
# colours will be set in order of the levels of the factor.
# Set palette of colours:
palette(rainbow(8))
# Use colours, add legend.
plot(fits, how="oneplot", colour_by_id = TRUE, id_legend=TRUE)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab