growthCurve: Within subject model-predicted growth curve

Description Usage Arguments Value Note Author(s) See Also

View source: R/growthCurve.R

Description

Produces a set of predicted response values, by subject, at T time points. The response values are predicted by employing the posterior samples of model parameters where the resultant response values for each subject are composed by averaging over all posterior samples in a Rao-Blackwellizing fashion.

Usage

1
2
3
4
growthCurve(y.case, B, Alpha, Beta, U = NULL, aff.clients = NULL,
  W.subj = NULL, X.n = NULL, Z.n = NULL, trt.case, trt.lab, subject.case,
  subject.lab, T, min.T, max.T, n.thin, n.waves = NULL, time.case,
  n.fix_degree, Nrandom = NULL)

Arguments

y.case

The N x 1 (subject-time case) vector of data response values.

B

The M x P*q matrix of subject random effect posterior samples. M = number of MCMC samples, P = number of subjects, q = number of random effect parameters, per subject.

Alpha

The M x 1 vector for the model intercept parameter.

Beta

The M x F matrix of model fixed effects parameters, where F = number of fixed effects

U

The M x S matrix of univariate multiple membership random effects, where S = number of random effects. U is multivariate, then the input is of dimension M x Nmv*S, where Nmv is the multivariate dimension. Leave NULL is don't require the multiple membership effects. Input as list of M x S matrices if have more than one mutiple membership term.

aff.clients

Vector of length P.aff that identifies subjects affected by U. Identical to subj.aff from dpgrowmm. Input as list of vectors, each comprised of affected subjects attached to the equivalent multiple membership term if have more than one term.

W.subj

A P x S multiple membership weight matrix for U that expands W.subj.aff of dpgrowmm from affected subjects, Paff to all subjects, P. Input as list of P[i] x S[i] matrices, where i indexes an MM term, if have more than one multiple membership term.

X.n

A design matrix with N rows (for subject-measure) cases providing nuisance fixed effects. Will be expanded to the T within sample predictions, but held constant between successive observed values (for generating expanded predictions).

Z.n

A design matrix with N rows providing nuisance random effects. Grouping is assumed to be by-subject.

trt.case

The treatment group membership vector of length N (subject-time cases). Assumed numeric with lowest group level == 0; .e.g. (0,0,0,1,1,2,2,2,2,).

trt.lab

Associated labels for the numeric treatment groups. Each distinct treatment group assumed to have a unique label.

subject.case

Vector of length N providing subject-measure cases. Must be in numerical format with unique subjects sequential starting at 1.

subject.lab

N x 1 case length vector with user desired labels that map 1:1 to subject.case.

T

Number of time points to build each subject curve. T = 10 is typically sufficient.

min.T

The minimum time value that T will take.

max.T

The maximum time value that T will take.

n.thin

The gap between each MCMC sample used for the growth curve.

n.waves

The maximum number of observed measurement waves, per subject.

time.case

A vector of length N providing times for associated subject-measure observations. Identical to time from dpgrowmm.

n.fix_degree

The highest polynomial degree to employ for constructing time-based fixed effects covariates.

Nrandom

A scalar input providing the number of by-subject time-based random effect parameters. Only need to input if employ nuisance random effects.

Value

A list object containing the following data.frames and plots:

plot.dat

A data.frame object containing the within-subjects predicted growth curves. Fields are titled, c("fit","time","subject","trt").

dat.data

A data.frame object containing actual by-subject data for each measurement occasion. Fields are titled, c("fit","time","subject","trt").

p.gcall

A ggplot2 object that aggregates growth curves by treatment type.

p.gcsel

A ggplot2 object that plots growth curves with associated data points for 10 randomly selected subjects.

Note

Intended as an internal function for dpgrow, dpgrowmm, and dpgrowmult

Author(s)

Terrance Savitsky tds151@gmail.com

See Also

dpgrowmm, dpgrow, dpgrowmult


growcurves documentation built on May 2, 2019, 7:03 a.m.