cluster/TBdat/tbStab.R

library(flowReMix)
ncpus <- 15

filenames <- as.list(dir(path = 'results', pattern="TBdat1_*"))
filenames <- lapply(filenames, function(x) paste0('results/', x))

post <- list()
random <- list()
assign <-list()
for(i in 1:length(filenames)) {
  load(file = filenames[[i]])
  post[[i]] <- fit$posteriors[, -1]
  random[[i]] <- fit$randomEffectSamp
  assign[[i]] <- fit$assignmentList
}
post <- Reduce("+", post) / length(filenames)
assign <- do.call("c", assign)
random <- do.call("c", random)
fit$posteriors[, -1] <- post
fit$randomEffectSamp <- random
fit$assignmentList <- assign

stability <- stabilityGraph(fit, type = "ising", cv = FALSE, reps = 1000,
                            gamma = 0.25,
                            cpus = ncpus, AND = TRUE)
save(stability, file = "results/tbAggStab3soft.Robj")

stability <- stabilityGraph(fit, type = "randomEffects", cv = FALSE, reps = 1000,
                            gamma = 0.25,
                            cpus = ncpus, AND = TRUE)
save(stability, file = "results/tbAggRand3soft.Robj")
RGLab/flowReMix documentation built on May 8, 2019, 5:55 a.m.