Learn R Programming

growcurves (version 0.2.4.1)

XZcov: generate fixed and random design matrices, X and Z

Description

Constructs fixed and random design matrices compromised of either or both growth curve (time-based) components and user-defined nuisance fixed or random effects (input via a formula). Used to conduct Bayesian mixed effects modeling and to produce growth curve output.

Usage

XZcov(time = NULL, trt = NULL, trt.lab = NULL, subject = NULL, n.random = NULL, n.fix_degree = NULL, formula = NULL, random.only = NULL, data = NULL)

Arguments

time
A vector of lengthN (number of subject-time cases) providing times for associated subject-measure observations. Identical to time from dpgrowmm.
trt
The treatment group membership vector of length N. Assumed numeric and sequential. (e.g. (0,0,1,1,1,2,2,...).
trt.lab
Associated labels for the numeric treatment groups. Each distinct treatment group assumed to have a unique label.
subject
Vector of length N providing subject-measure cases. Identical to subject from dpgrowmm. P = number of subjects, q = number of random effect parameters, per subject.
n.random
A scalar input providing the number of by-subject time-based random effect parameters.
n.fix_degree
The highest polynomial degree to employ for constructing time-based fixed effects covariates.
formula
A formula of format y ~ x_1 + x_2*x_3 | z_1*z_2 where | separates fixed (to the left of |) and random effects.
random.only
A boolean scalar used in the case that either fixed or random effects are entered in formula, but not both, which case the | is not entered (e.g. y ~ x_1 + x_2*x_3 . Then, if random.only == TRUE the variables on the right-hand side are interpreted to be random effects; otherwise fixed for use in dpgrow and dpgrowmm.
data
Associated data.frame containing names variables in formula

Value

A list object containing composed fixed and random effect design matrices, X and Z, with column names and subsets: c(X.n, Z.n) nuisance and c(X.c, Z.c) growth curve design matrices. Also returns data output, y, if included with formula; otherwise returns y = NULL.

See Also

dpgrowmm, dpgrow