makeRankFull: Enforce full rank design matrix

Description Usage Arguments Value Examples

View source: R/prepareDataforGlm.R

Description

Given a design matrix (if the response is also included it has to be named "Response"), rank deficiency is corrected by dropping zero variance variables and one of each pair of highly correlated variables to make the design matrix invertible.

Usage

1
makeRankFull(data, verbose = FALSE)

Arguments

data

Matrix/data frame holding the design matrix and optionally a response vector named "Response"

Value

A subset of the original data structure (some of the variables are removed)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# get gene locations
mtor.loc <- findWells(experiments="brucella-du-k1", contents="MTOR")
scra.loc <- findWells(plates=sapply(mtor.loc, getBarcode),
                      contents="SCRAMBLED", well.names="G23")
# combine for faster fetching
data     <- getSingleCellData(list(mtor.loc[[1]], scra.loc[[1]]))
mtor.dat <- meltData(cleanData(data[[1]]$H6))
scra.dat <- meltData(cleanData(data[[1]]$G23))
# prepare data for glm
data <- prepareDataforGlm(mtor.dat$mat$Cells, scra.dat$mat$Cells)
data <- makeRankFull(data)
# run glm (enforcing full rank might be advisbale)
model <- glm("Response ~ .", binomial, data$train)

nbenn/singleCellFeatures documentation built on May 23, 2019, 12:24 p.m.