calcArrayEffects: Calulate Array Effects Using Random Effects Model

Description Usage Arguments Author(s) Examples

Description

Fits the mixed effects model

Usage

1
calcArrayEffects(rff, basisSplineFunction, snm.obj, model.objects, M.matrix, lf)

Arguments

rff

The rff slot from the lmer output

basisSplineFunction

B-spline basis function defined by buildBasisFunction

snm.obj

An object of class snm

model.objects

A list containing the formatted model matrices returned from make.ref.model.matrices

M.matrix

Matrix of pooled estimated RNA concentrations. The pooling strategy is defined by the nbins parameter. The element in position i,j is equal to the average RNA concentration on array j of the probes' whose average concentration is in the region spanned by bin i.

lf

Object of class mer used for parsing random effects object.

Author(s)

Brig Mecham <brig.mecham@sagebase.org>

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
##---- 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 (rff, basisSplineFunction, snm.obj, model.objects, M.matrix) 
{
  splineDimNames <- paste("Bt", 1:snm.obj$spline.dim, sep = "")
  ranfx <- rff
  ranfx2 <- lapply(ranfx, function(x) {
    x[, splineDimNames]
  })
  ranfx2 <- ranfx2[names(snm.obj$int.var)]
  for (i in 1:length(snm.obj$int.var)) {
    x <- names(snm.obj$int.var)[i]
    ranfx2[[x]] <- as.matrix(ranfx2[[x]][levels(snm.obj$int.var[[x]]),])
  }
  ars <- sapply(1:dim(M.matrix)[2], function(i) {
    mREFs <- sapply(1:length(ranfx2), function(j) {
      model.objects$F.mats[[j]][i, ] %*% ranfx2[[j]]
    })
    bSM <- predict(basisSplineFunction, M.matrix[, as.numeric(i)])
    arsL <- bSM %*% mREFs
    rowSums(arsL)
  })
  }

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