createZforGroupset: Create a co-data matrix Z for a group set

View source: R/functions_create.R

createZforGroupsetR Documentation

Create a co-data matrix Z for a group set

Description

Create a co-data matrix Z for a group set as obtained for instance with createGroupset.

Usage

createZforGroupset(groupset,p=NULL)

Arguments

groupset

A list with G elements that contain the indices of the variables belonging to each of the groups.

p

Number of covariates in total. If not given, taken as maximum index in ‘groupset’. But in cases where some covariates are left unpenalised, the total number of covariates may be larger.

Value

A (pxG)-dimensional co-data matrix.

See Also

createGroupset

Examples

#Group set: G random groups
G <- 5 #number of groups
p <- 300 #number of covariates from which last 10 left unpenalised
#sample random categorical co-data:
categoricalRandom <- as.factor(sample(1:G,(p-10),TRUE))
#make group set, i.e. list with G groups
groupsetRandom <- createGroupset(categoricalRandom)
Zcat <- createZforGroupset(groupsetRandom,p=p)

ecpc documentation built on May 13, 2022, 5:07 p.m.