Compute estimated coefficients, standard errors and LogVarRatios for a given set of contrasts.
Usage
contrasts.varFit(fit, contrasts=NULL)
Arguments
fit
list containing a linear model fit produced by varFit. The fit object should be of class MArrayLM.
contrasts
numeric matrix with rows corresponding to coefficients in fit and columns containing contrasts.
Details
This function calls the contrasts.fit function in limma to compute coefficients and standard errors for the specified contrasts corresponding to a linear model fit obtained from the varFit function. LogVarRatios are also computed in terms of the contrasts. A contrasts matrix can be computed using the makeContrasts function.
Value
A list object of the same class as fit.
Author(s)
Belinda Phipson
See Also
varFit, contrasts.fit, makeContrasts
Examples
# Randomly generate data for a 3 group problem with 100 CpG sites and 4 arrays in each group.
library(limma)
y<-matrix(rnorm(1200),ncol=12)
group<-factor(rep(c(1,2,3),each=4))
design<-model.matrix(~0+group)
colnames(design)<-c("grp1","grp2","grp3")
# Fit linear model for differential variability
vfit<-varFit(y,design)
# Specify contrasts
contr<-makeContrasts(grp2-grp1,grp3-grp1,grp3-grp2,levels=colnames(design))
# Compute contrasts from fit object
vfit.contr<-contrasts.varFit(vfit,contrasts=contr)
summary(decideTests(vfit.contr))
# Look at top table of results for first contrast
topVar(vfit.contr,coef=1)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(missMethyl)
Setting options('download.file.method.GEOquery'='auto')
Setting options('GEOquery.inmemory.gpl'=FALSE)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/missMethyl/contrasts.varFit.Rd_%03d_medium.png", width=480, height=480)
> ### Name: contrasts.varFit
> ### Title: Compute contrasts for a varFit object.
> ### Aliases: contrasts.varFit
>
> ### ** Examples
>
> # Randomly generate data for a 3 group problem with 100 CpG sites and 4 arrays in each group.
>
> library(limma)
>
> y<-matrix(rnorm(1200),ncol=12)
>
> group<-factor(rep(c(1,2,3),each=4))
> design<-model.matrix(~0+group)
> colnames(design)<-c("grp1","grp2","grp3")
>
> # Fit linear model for differential variability
> vfit<-varFit(y,design)
Warning messages:
1: Partial NA coefficients for 100 probe(s)
2: In out$var.prior[is.na(out$var.prior)] <- 1/out$s2.prior :
number of items to replace is not a multiple of replacement length
3: In ebayes(fit = fit, proportion = proportion, stdev.coef.lim = stdev.coef.lim, :
Estimation of var.prior failed - set to default value
>
> # Specify contrasts
> contr<-makeContrasts(grp2-grp1,grp3-grp1,grp3-grp2,levels=colnames(design))
>
> # Compute contrasts from fit object
> vfit.contr<-contrasts.varFit(vfit,contrasts=contr)
Warning messages:
1: In out$var.prior[is.na(out$var.prior)] <- 1/out$s2.prior :
number of items to replace is not a multiple of replacement length
2: In ebayes(fit = fit, proportion = proportion, stdev.coef.lim = stdev.coef.lim, :
Estimation of var.prior failed - set to default value
>
> summary(decideTests(vfit.contr))
grp2 - grp1 grp3 - grp1 grp3 - grp2
-1 0 0 0
0 0 0 0
1 0 0 0
>
> # Look at top table of results for first contrast
>
> topVar(vfit.contr,coef=1)
SampleVar LogVarRatio DiffLevene t P.Value Adj.P.Value
1 0.6756536 NaN NA NA NA NA
2 0.5361943 NaN NA NA NA NA
3 1.1354274 NaN NA NA NA NA
4 0.9988517 NaN NA NA NA NA
5 0.5339442 NaN NA NA NA NA
6 0.8884493 NaN NA NA NA NA
7 0.4779402 NaN NA NA NA NA
8 0.3822255 NaN NA NA NA NA
9 1.1312203 NaN NA NA NA NA
10 0.3287167 NaN NA NA NA NA
>
>
>
>
>
>
> dev.off()
null device
1
>