Jfortin1 / ComBatHarmonization

Harmonization of multi-site imaging data with ComBat
264 stars 107 forks source link

Error in solve.default(t(design) %*% design)? #6

Closed jlhanson5 closed 6 years ago

jlhanson5 commented 6 years ago

Hello,

I previously got ComBat to work with some test data, but recently ran into an error when working with "real data". The data I'm working with is located here.

My basic R syntax was--

source("scripts/utils.R");
source("scripts/combat.R")

dat<-t(as.matrix(read.csv("Freesurfer_HBN_w_Site_For_Combat.csv")))
batch<-read.csv("HBN_site.csv")
batch<-t(batch$Site)
data.harmonized <- combat(dat=dat, batch=batch)

After I run that command, I get the following error--

untitled

Any thoughts re: what I might be doing incorrectly? Thanks much!

All the best, Jamie.

Jfortin1 commented 6 years ago

Hi Jamie,

I cannot reproduce your analysis since the file "HBN_site.csv" is not part of your data directory.

jlhanson5 commented 6 years ago

Ah I apologizes, I uploaded the incorrect file to dropbox. The correct files should be there now (link again).

Jfortin1 commented 6 years ago

I used the following code:

dat <- t(as.matrix(read.csv("Freesurfer_HBN_w_Site_For_Combat.csv")))
batch <- read.csv("HBN_site.csv")$Site 
data.harmonized <- combat(dat=dat, batch=batch)

and the code ran smoothly.

JP

jlhanson5 commented 6 years ago

Ah yes, that seems to have done it. I must have misspecified Site/Batch. Thanks for the help with this!