R/archive/new_plot.r

# library(reshape2)
#
# # load("/Volumes/Christine/r/sim/5_7.RData")
# j = 5
# mod = rbind(freq = result[[j]]$new.mod.0$variable.freq, result[[j]]$new.mod.0$mod.collection[,-1])
# len = min(sum(result[[j]]$new.mod.0$variable.freq>0.1), 10)#
# i = result[[j]]$new.mod.0$variable.order[1:len]
# mod = t(mod[,i])
#
# mod = data.frame(mod)
# mod = cbind(var.name = factor(rownames(mod),levels = rownames(mod)), mod)
# rownames(mod) = NULL
# # mod = mod.0$mod.collection[,-1]
#
# long = melt(mod, id.vars=1:2)[,-3]
# colnames(long)[3] = "est.coef"
#
# f1 <- function(x) {
#   r <- quantile(x, probs = c(0.05, 0.95))
#   names(r) <- c("ymin", "ymax")
#   r
# }
# f2 <- function(x) {
#   r <- quantile(x, probs = c(0.5))
#   names(r) <- c("y")
#   r
# }
# ggplot(long, aes(x = var.name, y = est.coef)) +
#   scale_fill_gradient(low = "white", high = "red", limits = c(0,1))+
#   geom_violin(scale = "width", aes(fill = freq)) +
#   # stat_summary(fun.data = f1, geom = "errorbar", colour="black", width=.1) +
#   # stat_summary(fun.data = f2, geom = "point")
#   geom_boxplot(width = 0.1, outlier.shape = NA)
#
# print(which(result[[j]]$compare.mods["true",-1]!=0))
#
christineyuen/VSC documentation built on Oct. 8, 2019, 10:45 a.m.