Learn R Programming

ptycho (version 1.1-4)

createGroupsSim: Create Groups of Covariates

Description

Create an object specifying groups of covariates as needed for some of the simulations.

Usage

createGroupsSim(G, p)

Value

List containing the following components:

var2group

Integer vector of length p, with entry \(j\) being the index of the group containing covariate \(j\)

group2var

List of length G, each entry of which is an integer vector containing the indices of the covariates belonging to that group

sizes

Vector of length G containing the number of covariates in each group

Arguments

G

Number of groups

p

Number of covariates

Author

Laurel Stell and Chiara Sabatti
Maintainer: Laurel Stell <lstell@stanford.edu>

Details

If G divides p, then each group will have p/G consecutive covariates. If G does not divide p, then the last group will have fewer covariates.

See Also

createData

Examples

Run this code
grp <- createGroupsSim(G=3, p=15)
# Which covariates are in group 2?  Two ways to find out:
which(grp$var2group == 2)
grp$group2var[[2]]

Run the code above in your browser using DataLab