ComBat: it.sol error
0
1
Entering edit mode
@anna-christine-reisetter-6692
Last seen 9.6 years ago
Hi, I'm using the ComBat package within the MSPrep R package to normalize some metabolomic data. I receive the following error when trying to run MSPrep: Error in while (change > conv) { : missing value where TRUE/FALSE needed I traced this error to the ComBat function and within it, the it.sol function, the code for which I obtained from the ComBat website (http://www.bu.edu/jlab/wp-assets/ComBat/Download.html) and have pasted below. it.sol <- function(sdat,g.hat,d.hat,g.bar,t2,a,b,conv=.0001){ n <- apply(!is.na(sdat),1,sum) g.old <- g.hat d.old <- d.hat change <- 1 count <- 0 while(change>conv){ g.new <- postmean(g.hat,g.bar,n,d.old,t2) sum2 <- apply((sdat-g.new%*%t(rep(1,ncol(sdat))))^2, 1, sum,na.rm=T) d.new <- postvar(sum2,n,a,b) change <- max(abs(g.new-g.old)/g.old,abs(d.new-d.old)/d.old) g.old <- g.new d.old <- d.new count <- count+1 } #cat("This batch took", count, "iterations until convergence\n") adjust <- rbind(g.new, d.new) rownames(adjust) <- c("g.star","d.star") adjust } The MSPrep package passes the following arguments through the function: for (i in 1:n.batch) { temp <- it.sol(s.data[, batches[[i]]], gamma.hat[i, ], delta.hat[i, ], gamma.bar[i], t2[i], a.prior[i], b.prior[i]) gamma.star <- rbind(gamma.star, temp[1, ]) delta.star <- rbind(delta.star, temp[2, ]) } Where n.batch=50, the dimensions of s.data are (392, 300), the dimensions of gamma.hat (g.hat) are (50, 392), the dimensions of delta.hat (d.hat) are (50, 392), gamma.bar (g.bar) is NULL, a.prior (a) is NULL, and b.prior (b) is null). I believe the problem is coming from the fact that gamma.bar is null, which results because gamma.hat has NaN values. Could you please advise? Thank you, Anna Anna Reisetter, MS Statistical Analyst/Programmer Department of Preventive Medicine Northwestern University Medical School 680 N. Lake Shore Drive Suite 1400 Chicago, IL 60611 312 503 7039 anna.reisetter@northwestern.edu<mailto:anna.reisetter@northwestern.edu> [[alternative HTML version deleted]]
• 1.1k views

Login before adding your answer.

Traffic: 760 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6