Ease of use wrapper function for fitting various growth models specified by growthSS
Source:R/fitGrowth.R
fitGrowth.Rd
Ease 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
#> 204.760 148.662 13.295 10.748 3.000 3.482
#> residual sum-of-squares: 205524
#>
#> Number of iterations to convergence: 4
#> Achieved convergence tolerance: 8.288e-08
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.448 -52.515 227.337 187.069
#> groupb bs(time)1:groupb bs(time)2:groupb bs(time)3:groupb
#> -2.268 69.284 -56.108 -53.586
#>