parse.names: Partition DL term names

Description Usage Arguments Value Examples

Description

Parse variable names and create a unique integer label for each unique use of a matching base case. parse.names is used internally by several dlmBE functions to determine which distributed lag terms share the same random effects variance/penalty.

Usage

1

Arguments

base

a character vector with literal matches in names

names

a character vector with substrings that are literal matches to elements in base

Value

an S3 object of class "pnames" which is of length equal to length(names) and stores a unique integer label for each matching case in base and a look up dictionary for each integer.

Indexing in pnames objects takes a character string argument and returns the vector indices of the matching base uses. See Examples.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
lg <- 1:5
Z <- matrix(rbinom(60, 10, 0.1), 12)
group <- rep(1:4, each = 3)
base <- "cr(lg, Z)"
names <- colnames(model.matrix(~ cr(lg, Z):factor(group)))
pn <- parse.names(base, names, FALSE)
names
pn
pn[""]
pn["cr(lg, Z):factor(group)2"]

asw221/dlm documentation built on June 3, 2019, 5:16 p.m.