full.model.mtx {cmenet}R 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 nn x pp binary model matrix (nn observations, pp binary MEs).

Value

model.mtx

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

cme.mtx

An nn x (4*choose(pp,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


[Package cmenet version 0.1.2 Index]