Introduction

knitr::opts_chunk$set(collapse = TRUE, comment = "#>")

library(hbgd)

The growth velocity function allows you to apply a function to the first derivative of growth trajectories. For example, taking the mean of the first derivative. Since the function depends on growth trajectories, they need to be generated first; see documentation for HBGD package.

smc <- get_smocc_data()[1:500,]
smc_haz_wandfit <- get_fit(smc, y_var = "haz", method = "wand")
smc_tr <- fit_all_trajectories(smc, smc_haz_wandfit)

Calling the function

Suppose we assign the trajectories to a variable named traj. We call the growth velocity method as follows:

traj_velocity <- get_traj_velocity(all_traj = smc_tr)

The result of this call will be a tibble. Each row of this tibble has the subject ID and growth velocity.

print(traj_velocity)

Options and Defaults



hafen/hbgd documentation built on March 1, 2020, 5:31 p.m.