Ease of use wrapper function for fitting various growth models specified by growthSS
Source:R/fitGrowth.R
fitGrowth.RdEase of use wrapper function for fitting various growth models specified by growthSS
Arguments
- ss
A list generated by
growthSS.- ...
Additional arguments passed to model fitting functions determined by
ss$type. For type = "nlme" these are passed tonlme::nlmeControl, notnlme::nlme. Additional arguments are documented in fitGrowthbrms, fitGrowthnlme, fitGrowthnls, fitGrowthnlrq, fitGrowthmgcvgam, fitGrowthsurvreg, fitGrowthflexsurv.
See also
growthPlot for model visualization, testGrowth for hypothesis testing, barg for Bayesian model reporting metrics.
Examples
simdf <- growthSim("logistic",
n = 20, t = 25,
params = list("A" = c(200, 160), "B" = c(13, 11), "C" = c(3, 3.5))
)
ss <- growthSS(
model = "logistic", form = y ~ time | group,
df = simdf, type = "nls"
)
fitGrowth(ss)
#> Nonlinear regression model
#> model: y ~ A[group]/(1 + exp((B[group] - time)/C[group]))
#> data: ss[["df"]]
#> A1 A2 B1 B2 C1 C2
#> 200.867 158.675 13.152 10.508 2.957 3.657
#> residual sum-of-squares: 308487
#>
#> Number of iterations to convergence: 3
#> Achieved convergence tolerance: 7.032e-06
ss <- growthSS(
model = "gam", form = y ~ time | group,
df = simdf, type = "nls"
)
fitGrowth(ss)
#>
#> Call:
#> stats::lm(formula = ss[["formula"]], data = ss[["df"]])
#>
#> Coefficients:
#> (Intercept) bs(time)1 bs(time)2 bs(time)3
#> 9.1722 -51.3695 228.1606 183.3481
#> groupb bs(time)1:groupb bs(time)2:groupb bs(time)3:groupb
#> -0.4303 77.2199 -52.0667 -41.4705
#>