[BioC] using offsets from EDASeq and cqn
Mike Love
love at molgen.mpg.de
Thu Feb 14 18:53:17 CET 2013
One more thing, another wrinkle is log or log2. For this reason, I
shouldn't have used correlation in the example. I believe cqn is giving
log2 offsets, EDASeq natural log, and edgeR is accepting natural log.
thanks,
Mike
On 2/14/13 5:21 PM, Michael Love wrote:
> hi,
>
> I could have things totally mixed up here. I was thinking that GLM
> offsets would be positively correlated with log counts.
>
> for instance in edgeR, mglmLS.R:
>
> mu <- exp(beta %*% t(X) + offset)
>
> but it seems offsets from packages EDASeq and cqn are negative
> correlated with log counts.
>
> for example some poisson data:
>
> > n <- 1000
> > covariate <- rnorm(n,6,.5)
> > counts <- replicate(2,rpois(n,exp(covariate)))
>
> > library(EDASeq)
> > edaseq.offset <-
> withinLaneNormalization(x=counts,y=covariate,which="full",offset=TRUE)
> > cor(edaseq.offset[,1],log(counts[,1]+1))
> [1] -0.9765923
>
> > library(cqn)
> > cqn.offset <-
> cqn(counts,x=covariate,lengths=rep(1,n),lengthMethod="fixed",sizeFactors=c(1,1))$offset
> > cor(cqn.offset[,1],log(counts[,1]+1))
> [1] -0.9950717
>
>
> So EDASeq and cqn are giving similar results here:
>
> > cor(edaseq.offset[,1],cqn.offset[,1])
> [1] 0.9847672
>
> If I give these to the standard glm function as offsets I would expect
> the coefficient for 'covariate' to go from 1 to 0. But it gives me
> something like a coefficient of 2, and to get zero I have to give it
> -1 * offset:
>
> without offset:
>
> > coef(glm(counts[,1] ~ covariate, family="poisson"))
> (Intercept) covariate
> -0.02735053 1.00467285
>
> with offset:
>
> > coef(glm(counts[,1] ~ covariate, offset=edaseq.offset[,1],
> family="poisson"))
> (Intercept) covariate
> -5.860094 1.954997
> > coef(glm(counts[,1] ~ covariate, offset=cqn.offset[,1],
> family="poisson"))
> (Intercept) covariate
> -8.752786 2.457637
>
> with -1 * offset:
>
> > coef(glm(counts[,1] ~ covariate, offset=-edaseq.offset[,1],
> family="poisson"))
> (Intercept) covariate
> 5.8253511 0.0498681
> > coef(glm(counts[,1] ~ covariate, offset=-cqn.offset[,1],
> family="poisson"))
> (Intercept) covariate
> 8.6975896 -0.4482184
>
>
> thanks for any guidance,
>
> Mike
>
More information about the Bioconductor
mailing list