X-Git-Url: https://git.auder.net/?p=valse.git;a=blobdiff_plain;f=pkg%2FR%2FfilterModels.R;fp=pkg%2FR%2FfilterModels.R;h=0000000000000000000000000000000000000000;hp=2659ed468a8450f5d84e8d75280148acdb5da29a;hb=08f4604c778da8af7e26b52b1d433a6be82c3139;hpb=086cf723817b690dc368d2f11b7b9e88d183e804 diff --git a/pkg/R/filterModels.R b/pkg/R/filterModels.R deleted file mode 100644 index 2659ed4..0000000 --- a/pkg/R/filterModels.R +++ /dev/null @@ -1,36 +0,0 @@ -#' Among a collection of models, this function constructs a subcollection of models with -#' models having strictly different dimensions, keeping the model which minimizes -#' the likelihood if there were several with the same dimension -#' -#' @param LLF a matrix, the first column corresponds to likelihoods for several models -#' the second column corresponds to the dimensions of the corresponding models. -#' -#' @return a list with indices, a vector of indices selected models, -#' and D1, a vector of corresponding dimensions -#' -#' @export -filterModels = function(LLF) -{ - D = LLF[,2] - D1 = unique(D) - - indices = rep(1, length(D1)) - #select argmax MLE - if (length(D1)>2) - { - for (i in 1:length(D1)) - { - A = c() - for (j in 1:length(D)) - { - if(D[[j]]==D1[[i]]) - a = c(a, LLF[j,1]) - } - b = max(a) - #indices[i] : first indices of the binary vector where u_i ==1 - indices[i] = which.max(LLF == b) - } - } - - return (list(indices=indices,D1=D1)) -}