design: Create full and reduced design matrices for the cpg.assoc...

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/design.R

Description

Designed to be used by cpg.assoc and cpg.perm. Creates a full and reduced design matrices.

Usage

1
design(covariates, indep, chip.id, random)

Arguments

covariates

A data frame consisting of the covariates of interest. covariates can also be a matrix if it is a model matrix minus the intercept column. It can also be a vector if there is only one covariate of interest. If no covariates must be specified as NULL.

indep

A vector containing the main variable of interest. cpg.assoc will evaluate the association between indep and the beta values.

chip.id

An optional vector containing chip or batch identities. If specified, chip.id will be included as a factor in the model.

random

Is the model going to be a mixed effects. If so, chip.id will not be included in the design matrices.

Value

Returns a list containing the full and reduced design matrices.

full

The full design matrix.

reduced

The reduced design matrix.

Note

The design function is designed to be used exclusively by the cpg.assoc and cpg.perm functions.

Author(s)

Barfield, R.; Kilaru,V.; Conneely, K.
Maintainer: R. Barfield: <rbarfield01@fas.harvard.edu>

See Also

cpg.assoc cpg.perm cpg.work plot.cpg scatterplot cpg.combine manhattan plot.cpg.perm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
data(samplecpg,samplepheno,package="CpGassoc")
#Example where there are covariates:
covar<-data.frame(samplepheno$weight,samplepheno$Distance)
test<-design(covar,samplepheno$SBP,samplepheno$chip,FALSE)
dim(test$full)
dim(test$reduced)
test$reduced[1:5,1:5]
test$full[1:5,1:5]
#When no covariates or chip.id:
test2<-design(NULL,samplepheno$SBP,NULL,FALSE)
dim(test2$full)
dim(test2$reduced)

Example output

Loading required package: nlme
[1] 258  26
[1] 258  25
  (Intercept) samplepheno.weight samplepheno.Distance factor(chip.id)3
1           1           31.02998             28.49084                0
2           1           20.83885             13.10059                0
3           1           21.47078             14.76703                0
4           1           23.95091             25.54482                0
5           1           34.12922             29.45997                0
  factor(chip.id)4
1                0
2                0
3                0
4                0
5                0
  (Intercept)    indep samplepheno.weight samplepheno.Distance factor(chip.id)3
1           1 16.98629           31.02998             28.49084                0
2           1 34.90645           20.83885             13.10059                0
3           1 21.55838           21.47078             14.76703                0
4           1 20.90882           23.95091             25.54482                0
5           1 27.01004           34.12922             29.45997                0
[1] 258   2
[1] 258   1

CpGassoc documentation built on May 1, 2019, 8:24 p.m.