full.model.mtx: Generate full model matrix for MEs and CMEs

View source: R/header.R

full.model.mtxR Documentation

Generate full model matrix for MEs and CMEs

Description

full.model.mtx returns the full model matrix for main effects (MEs) and conditional main effects (CMEs).

Usage

  full.model.mtx(xme)

Arguments

xme

An n x p binary model matrix (n observations, p binary MEs).

Value

model.mtx

An n x (p+4*choose(p,2)) full model matrix for MEs and CMEs.

cme.mtx

An n x (4*choose(p,2)) model matrix for only CMEs.

Examples

library(MASS)
n <- 50 #number of observations
p <- 50 #number of main effects

## Simulate model matrix for MEs and CMEs
set.seed(1)
rho <- 0 #correlation
ones <- matrix(1,p,p)
covmtx <- rho*ones+(1-rho)*diag(p)
latmtx <- mvrnorm(n,p,mu=rep(0,p),Sigma=covmtx) #equicorrelated cov. matrix
memtx <- (latmtx>=0)-(latmtx<0) #simulate model matrix for MEs
model.mtx <- full.model.mtx(memtx)$model.mtx #generate model matrix for MEs and CMEs


cmenet documentation built on May 28, 2022, 1:06 a.m.