Skip to content

backwash and limma::limmaFit() gives identical outputs? #12

Description

@jakeyeung

Hi David,

Really cool R package, I am enjoying digging into it.

I noticed that backwash() gives identical output to limma::limmaFit() in the simulation example you have?

Is this expected behavior? If so, is there something in the backwash output that lets me know that it is not doing any hidden confounder adjustment?

I paste code example below.

Kindest regards,

Jake


rm(list=ls())

library(vicar)
library(ggplot2)
library(dplyr)
data(sim_gtex)
Y <- sim_gtex$Y
X <- sim_gtex$X
ctl <- sim_gtex$ctl
which_null <- sim_gtex$which_null
beta <- sim_gtex$beta

num_sv <- sva::num.sv(dat = t(Y), mod = X, method = "be")
bout.sim <- backwash(Y = Y, X = X, k = num_sv, cov_of_interest = 2, include_intercept = FALSE)

lmout.sim <- limma::lmFit(t(Y), X)
betahat_ols <- lmout.sim$coefficients[, 2]
sebetahat_ols <- lmout.sim$stdev.unscaled[, 2] * lmout.sim$sigma

# identical 
plot(bout.sim$result$betahat, betahat_ols)


head(bout.sim$result$betahat)
head(betahat_ols)

Kindest regards,

Jake

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions