R Under development (unstable) (2025-08-19 r88650 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > > require(nlraa) Loading required package: nlraa > require(ggplot2) Loading required package: ggplot2 > ##library(agridat) > > if(FALSE){ + + data("hernandez.nitrogen") + + hn <- hernandez.nitrogen + + ggplot(data = hn, aes(x = nitro, y = yield)) + + facet_wrap(~loc) + + geom_point() + + fm1 <- lm(yield ~ nitro + I(nitro^2), data = hn) + fm2 <- nls(yield ~ SSlinp(nitro, a, b, xs), data = hn) + fm3 <- nls(yield ~ SSquadp3xs(nitro, a, b, xs), data = hn) + fm4 <- nls(yield ~ SSquadp(nitro, a, b, c, xs), data = hn) + fm5 <- nls(yield ~ SSquadpq(nitro, a, b, xs, ldxs = 4.2), + start = list(a = 7, b = 0.05, xs = 200), + data = hn) + + ## This does not work + ## fm6 <- minpack.lm::nlsLM(yield ~ SSquadpq(nitro, a, b, xs, ldxs), data = hn) + + ## Interestingly they all fit better than the quadratic + IC_tab(fm1, fm2, fm3, fm4, fm5) + + ggplot(data = hn, aes(x = nitro, y = yield)) + + geom_point() + + geom_line(aes(y = fitted(fm1), color = "Q")) + + geom_line(aes(y = fitted(fm2), color = "LP")) + + geom_line(aes(y = fitted(fm3), color = "QP3-xs")) + + geom_line(aes(y = fitted(fm4), color = "QP")) + + geom_line(aes(y = fitted(fm5), color = "QPQ")) + + } > > > proc.time() user system elapsed 2.51 0.29 2.76