
Build the long table for a growth model on SSM coordinates
Source:R/ssm_growth_data.R
ssm_growth_data.RdScore every row of data as its own circumplex profile and stack the
three SSM coordinates, elevation e, x and y, into the long table that
the package's growth recipe fits. One input row gives three output rows,
one per coordinate, and the output holds each row's id and time value
beside the coordinate's name and value. ssm_growth_formula() gives the
fit call that takes this table.
Usage
ssm_growth_data(data, scales, angles = octants(), id, time)Arguments
- data
Required. A data frame or matrix with one row per person per time point, containing the circumplex scales, an id column and a time column.
- scales
Required. The variable names or column numbers for the variables in
datathat contain circumplex scales.- angles
Optional. A numeric vector containing the angular displacement of each circumplex scale included in
scales, in degrees (default =octants()).- id
Required. The name of the column in
dataidentifying persons. A column name, not a number. Missing values are an error.- time
Required. The name of the numeric column in
dataholding each row's time point. A column name, not a number. A column that is not numeric (aDate, factor or character column, among others) is an error, as are missing values: the growth model fits time as a number, so the caller chooses its origin and unit.idandtimemust differ from each other and fromdvandvalue, the two column names the output reserves.
Value
A data frame with 3 * nrow(data) rows and four columns, named
<id> (a factor), <time> (numeric), dv (a factor with levels e,
x and y) and value. Rows are ordered by input row, then by dv.
Each value is the Elev, Xval or Yval that
ssm_parameters_id() with id = NULL gives that input row.
Details
Growth in displacement is modeled through x and y, never through the
angle itself, so the table carries no amplitude or displacement. A flat
profile has x and y at zero to floating-point precision and a
defined e, and a profile with a scale entirely missing has NA on all
three coordinates. Both keep their rows. Each engine's fit call then drops
a row whose value is NA: glmmTMB and brms do so by default, and the
nlme call that ssm_growth_formula() prints sets na.action = na.omit
for the same effect.
See also
Other growth functions:
ssm_growth_formula(),
ssm_trajectory()