From: emilie Date: Wed, 12 Apr 2017 09:45:12 +0000 (+0200) Subject: few updates X-Git-Url: https://git.auder.net/doc/html/scripts/img/current/R.css?a=commitdiff_plain;h=a6b60f91ff8d798a3dcb7da6acbc03fba8a0459d;p=valse.git few updates --- diff --git a/pkg/DESCRIPTION b/pkg/DESCRIPTION index 32ed6a8..c975ee9 100644 --- a/pkg/DESCRIPTION +++ b/pkg/DESCRIPTION @@ -39,3 +39,4 @@ Collate: 'EMGLLF.R' 'generateXY.R' 'A_NAMESPACE.R' + 'plot_valse.R' diff --git a/pkg/R/main.R b/pkg/R/main.R index 701a2c9..a2e5697 100644 --- a/pkg/R/main.R +++ b/pkg/R/main.R @@ -138,7 +138,7 @@ valse = function(X, Y, procedure='LassoMLE', selecMod='DDSE', gamma=1, mini=10, mod = as.character(tableauRecap[indModSel,1]) listMod = as.integer(unlist(strsplit(mod, "[.]"))) if (plot){ - print(plot_valse()) + print(plot_valse(models_list[[listMod[1]]][[listMod[2]]],n)) } models_list[[listMod[1]]][[listMod[2]]] diff --git a/pkg/R/plot_valse.R b/pkg/R/plot_valse.R index 05963c8..2c74554 100644 --- a/pkg/R/plot_valse.R +++ b/pkg/R/plot_valse.R @@ -2,18 +2,21 @@ #' #' It is a function which plots relevant parameters #' -#' +#' @param model the model constructed by valse procedure +#' @param n sample size #' @return several plots #' #' @examples TODO #' #' @export #' -plot_valse = function(){ +plot_valse = function(model,n){ require("gridExtra") require("ggplot2") require("reshape2") + require("cowplot") + K = length(model$pi) ## regression matrices gReg = list() for (r in 1:K){ @@ -60,8 +63,8 @@ plot_valse = function(){ gam2[i, ] = c(gam[i, affec[i]], affec[i]) } bp <- ggplot(data.frame(gam2), aes(x=X2, y=X1, color=X2, group = X2)) + - geom_boxplot() + theme(legend.position = "none") - print(bp + background_grid(major = "xy", minor = "none")) + geom_boxplot() + theme(legend.position = "none")+ background_grid(major = "xy", minor = "none") + print(bp ) ### Mean in each cluster XY = cbind(X,Y)