pwtime: pwtime - function to make piecewise time variables for a...

View source: R/utils.r

pwtimeR Documentation

pwtime - function to make piecewise time variables for a multiphase study

Description

pwtime - function to make piecewise time variables for a multiphase study

Usage

pwtime(time, phase)

Arguments

time

Numeric vector. A sequence of study times. If any times are negative (e.g., if time is center at 0 between the first and second phase) it is rescale to have a minimum of 0 so that the first observation within each phase has time=0.

phase

Numeric or character vector of the same length as time. The phases within which time is rescale to create the time variables needed for a piecewise growth model.

Author(s)

Stephen Tueller Stueller@rti.org

Examples


pwtime(-49:50, sort(rep(letters[1:5], length.out = 100)))

## Not run: 
# time should not be scaled in [0,1] or similar, rescale to integer
OvaryICT2 <- OvaryICT
OvaryICT2$Time <- round(OvaryICT2$Time*30)

p1 <- Palytic$new(data = OvaryICT2, ids='Mare', dv='follicles',
                  time='Time', phase='Phase', alignPhase = 'none')

p2 <- Palytic$new(data = OvaryICT2, ids='Mare', dv='follicles',
                  time='Time', phase='Phase', alignPhase = 'piecewise')

summary(p1$lme())
summary(p2$lme())

## End(Not run)

ICTatRTI/PersonAlytics documentation built on Dec. 13, 2024, 11:06 p.m.