growthparameters.bgmfit {bsitar} | R Documentation |
Estimate growth parameters from the model fit
Description
The growthparameters() computes population average and and individual-specific growth parameters (such as age at peak growth velocity) and the uncertainty (standard error, SE and the credible interval, CI).
Usage
## S3 method for class 'bgmfit'
growthparameters(
model,
newdata = NULL,
resp = NULL,
ndraws = NULL,
draw_ids = NULL,
summary = TRUE,
robust = FALSE,
re_formula = NA,
peak = TRUE,
takeoff = FALSE,
trough = FALSE,
acgv = FALSE,
acgv_velocity = 0.1,
estimation_method = "fitted",
allow_new_levels = FALSE,
sample_new_levels = "uncertainty",
incl_autocor = TRUE,
numeric_cov_at = NULL,
levels_id = NULL,
avg_reffects = NULL,
aux_variables = NULL,
ipts = 10,
deriv_model = TRUE,
conf = 0.95,
xrange = NULL,
xrange_search = NULL,
digits = 2,
seed = 123,
future = FALSE,
future_session = "multisession",
cores = NULL,
parms_eval = FALSE,
idata_method = NULL,
parms_method = "getPeak",
verbose = FALSE,
fullframe = NULL,
dummy_to_factor = NULL,
expose_function = FALSE,
usesavedfuns = NULL,
clearenvfuns = NULL,
envir = NULL,
...
)
growthparameters(model, ...)
Arguments
model |
An object of class |
newdata |
An optional data frame to be used in estimation. If
|
resp |
A character string (default |
ndraws |
A positive integer indicating the number of posterior draws to
be used in estimation. If |
draw_ids |
An integer indicating the specific posterior draw(s)
to be used in estimation (default |
summary |
A logical indicating whether only the estimate should be
computed ( |
robust |
A logical to specify the summarize options. If |
re_formula |
Option to indicate whether or not to include the
individual/group-level effects in the estimation. When |
peak |
A logical (default |
takeoff |
A logical (default |
trough |
A logical (default |
acgv |
A logical (default |
acgv_velocity |
Specify the percentage of the peak growth velocity to be
used when estimating |
estimation_method |
A character string to specify the estimation method
when calculating the velocity from the posterior draws. The |
allow_new_levels |
A flag indicating if new levels of group-level
effects are allowed (defaults to |
sample_new_levels |
Indicates how to sample new levels for grouping
factors specified in |
incl_autocor |
A flag indicating if correlation structures originally
specified via |
numeric_cov_at |
An optional (named list) argument to specify the value
of continuous covariate(s). The default |
levels_id |
An optional argument to specify the |
avg_reffects |
An optional argument (default |
aux_variables |
An optional argument to specify the variable(s) that can
be passed to the |
ipts |
An integer to set the length of the predictor variable to get a
smooth velocity curve. The |
deriv_model |
A logical to specify whether to estimate velocity curve
from the derivative function, or the differentiation of the distance curve.
The argument |
conf |
A numeric value (default |
xrange |
An integer to set the predictor range (i.e., age) when
executing the interpolation via |
xrange_search |
A vector of length two, or a character string
|
digits |
An integer (default |
seed |
An integer (default |
future |
A logical (default |
future_session |
A character string to set the session type when
|
cores |
Number of cores to be used when running the parallel
computations (if |
parms_eval |
A logical to specify whether or not to get growth parameters on the fly. This is for internal use only and mainly needed for compatibility across internal functions. |
idata_method |
A character string to indicate the interpolation method.
The number of of interpolation points is set up the |
parms_method |
A character to specify the method used to when evaluating
|
verbose |
An optional argument (logical, default |
fullframe |
A logical to indicate whether to return |
dummy_to_factor |
A named list (default |
expose_function |
An optional logical argument to indicate whether to
expose Stan functions (default |
usesavedfuns |
A logical (default |
clearenvfuns |
A logical to indicate whether to clear the exposed
function from the environment ( |
envir |
Environment used for function evaluation. The default is
|
... |
Further arguments passed to |
Details
The growthparameters() internally calls the
fitted_draws()
or the predict_draws()
function to estimate the first
derivative based growth parameters for each posterior draw. The growth
parameters estimated are age at peak growth velocity (APGV), peak growth
velocity (PGV), age at takeoff growth velocity (ATGV), takeoff growth
velocity (TGV), age at cessation of growth velocity (ACGV), and the
cessation growth velocity (CGV). The APGV and PGV are estimated by calling
the sitar::getPeak()
function whereas the ATGV and TGV are estimated by
using the sitar::getTakeoff()
function. The sitar::getTrough()
function
is used to estimates ACGV and CGV parameters. The parameters obtained from
each posterior draw are then summarized appropriately to get the estimates
and the uncertainty (SEs and CIs) around these estimates. Please note that
it is not always possible to estimate cessation and takeoff growth
parameters when there are no distinct pre-peak or post-peak troughs.
Value
A data frame with either five columns (when summary = TRUE
),
or two columns when summary = False
(assuming re_formual =
NULL
). The first two columns common to each scenario (summary =
TRUE/False
) are 'Parameter'
and 'Estimate'
which define the
name of the growth parameter (e.g., APGV, PGV etc), and estimate. When
summary = TRUE
, the three additional columns are 'Est.Error'
,
and a paired vector of names defining the lower and upper limits of the
CIs. The CI columns are named as Q with appropriate suffix taken from the
percentiles used to construct these intervals (such as Q.2.5
and
Q.97.5
where2.5
and 97.5
are the 0.025
and
0.975
percentiles used to compute by the 95% CI by calling the
quantile function. When re_formual = NULL
, an additional column is
added that denotes the individual identifier (typically id
).
Author(s)
Satpal Sandhu satpal.sandhu@bristol.ac.uk
Examples
# Fit Bayesian SITAR model
# To avoid mode estimation which takes time, the Bayesian SITAR model fit to
# the 'berkeley_exdata' has been saved as an example fit ('berkeley_exfit').
# See 'bsitar' function for details on 'berkeley_exdata' and 'berkeley_exfit'.
# Check and confirm whether model fit object 'berkeley_exfit' exists
berkeley_exfit <- getNsObject(berkeley_exfit)
model <- berkeley_exfit
# Population average age and velocity during the peak growth spurt
growthparameters(model, re_formula = NA)
# Population average age and velocity during the take-off and the peak
# growth spurt (APGV, PGV. ATGV, TGV)
growthparameters(model, re_formula = NA, peak = TRUE, takeoff = TRUE)
# Individual-specific age and velocity during the take-off and the peak
# growth spurt (APGV, PGV. ATGV, TGV)
growthparameters(model, re_formula = NULL, peak = TRUE, takeoff = TRUE)