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. > ### Not currently working on this > > # library(ggplot2) > # > # data(Orange) > # > # tree3 <- subset(Orange, Tree == 3) > # > # fm0 <- nls(circumference ~ SSlogis(age, Asym, xmid, scal), data = tree3) > # > # ggplot(data = tree3, aes(x = age, y = circumference)) + > # geom_point() + > # geom_line(aes(y = fitted(fm0))) > # > # tree31 <- data.frame(age = c(tree3$age, 1900, 2200, 2400, tree3$age + 3000, > # 5000, 5600), > # circumference = c(tree3$circumference, > # 150, 155, 153, > # tree3$circumference + 150, > # 300, 305)) > # > # ggplot(data = tree31, aes(x = age, y = circumference)) + > # geom_point() > # > # getInitial(circumference ~ SSdlogis7(age, y.min, > # y.mid, > # y.max, > # xmid1, scal1, xmid2, scal2), > # data = tree31) > # > # getInitial(circumference ~ SSdlogis4(age, yt, > # yd, > # xmid, scal), > # data = tree31) > # > # fm1 <- minpack.lm::nlsLM(circumference ~ SSdlogis7(age, y.min, > # y.mid, > # y.max, > # xmid1, > # scal1, > # xmid2, > # scal2), > # data = tree31) > # > # > # fm1 <- minpack.lm::nlsLM(circumference ~ SSdlogis4(age, yt, > # yd, > # xmid, scal), > # data = tree31, > # control = list(maxiter = 1000)) > # > # ggplot(data = tree31, aes(x = age, y = circumference)) + > # geom_point() + > # geom_line(aes(y = fitted(fm1))) > # > # grd <- expand.grid(yt = seq(0, 300, length.out = 10), > # yd = seq(0, 300, length.out = 10), > # xmid = seq(0, 5000, length.out = 10), > # scal = seq(0, 1000, length.out = 10)) > # > # fm.bf <- nls2(circumference ~ dlogis4(age, yt, > # yd, > # xmid, scal), > # start = grd, > # algorithm = "brute", > # data = tree31) > # > # xx <- 1:5000 > # yy <- dlogis4(xx, yt = 150, yd = 150, xmid = 2500, scal = 400) > # > # plot(xx, yy) > # > # > # xx <- 1:6000 > # yy <- dlogis7(xx, y.min = 30, y.mid = 150, y.max = 300, > # xmid1 = 1500, scal1 = 300, xmid2 = 4200, scal2 = 300) > # > # plot(xx, yy) > # > # ggplot() + > # geom_point(data = tree31, aes(x = age, y = circumference)) + > # geom_line(aes(x = xx, y = yy)) > # > # fm1 <- minpack.lm::nlsLM(circumference ~ dlogis7(age, y.min, > # y.mid, > # y.max, > # xmid1, > # scal1, > # xmid2, > # scal2), > # data = tree31, > # start = c(y.min = 0, y.mid = 150, y.max = 300, > # xmid1 = 700, scal1 = 300, > # xmid2 = 4200, scal2 = 200)) > > proc.time() user system elapsed 0.14 0.06 0.18