full.model.mtx | R Documentation |
full.model.mtx
returns the full model matrix for main effects (MEs) and conditional main effects (CMEs).
full.model.mtx(xme)
xme |
An n x p binary model matrix (n observations, p binary MEs). |
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. |
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.