make.ref.model.matrices: Make Model Matrices for Random Effects Model

Description Usage Arguments Author(s) Examples

Description

Makes model matrices for random effects models

Usage

1

Arguments

snm.obj

An object of class snm

exp

New environment to hold the lmer formula

Author(s)

Brig Mecham <brig.mecham@sagebase.org> and John D. Storey <jstorey@princeton.edu>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (snm.obj, exp) 
{
    F.mats <- list()
    spline.re.model <- ""
    for (i in 1:length(snm.obj$int.var)) {
        ide <- names(snm.obj$int.var)[i]
        spline.re.model <- paste(spline.re.model, "+ ( Bt", 1, 
            "-1 | ", ide, ")", sep = "")
        for (d in 2:snm.obj$spline.dim) {
            spline.re.model <- paste(spline.re.model, "+ ( Bt", 
                d, "-1 | ", ide, ")", sep = "")
        }
        F.mats[[i]] <- model.matrix(~-1 + snm.obj$int.var[, 
            i])
    }
    if (dim(snm.obj$adj.var)[2] > 0) {
        ref.model <- paste( "probes+", paste("probes:", colnames(snm.obj$adj.var)[-1],
            collapse = "+"),sep="+" )
    }
    else {
        ref.model <- "probes + "
    }
    ref.model <- as.formula(paste("y ~ -1 +", ref.model, spline.re.model), 
        env = exp)
    names(F.mats) <- names(snm.obj$int.var)
    list(ZF = ref.model, F.mats = F.mats)
  }

Sage-Bionetworks/snm documentation built on May 9, 2019, 12:14 p.m.