- k1 = 1
- k2 = 2
- Melt = melt(t(model$phi[,,k1]-model$phi[,,k2]))
- gDiff = ggplot(data = Melt, aes(x=Var1, y=Var2, fill=value)) + geom_tile() +
- scale_fill_gradient2(low = "blue", high = "red", mid = "white", midpoint = 0, space = "Lab") +
- ggtitle(paste("Difference between regression matrices in cluster",k1, "and", k2))
- print(gDiff)
+ if (comp)
+ {
+ if (is.na(k1) || is.na(k))
+ {
+ print("k1 and k2 must be integers, representing the clusters you want to compare")
+ }
+ Melt <- melt(t(model$phi[, , k1] - model$phi[, , k2]))
+ gDiff <- ggplot(data = Melt, aes(x = Var1, y = Var2, fill = value)) + geom_tile() +
+ scale_fill_gradient2(low = "blue", high = "red", mid = "white", midpoint = 0,
+ space = "Lab") + ggtitle(paste("Difference between regression matrices in cluster",
+ k1, "and", k2))
+ print(gDiff)
+
+ }