Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR R

pairwise combinations r

compare <- function(...){

  m <- list(...)
  n_mod <- length(m)
  names(m) <- sapply(substitute(list(...))[-1], deparse)
  combs <- t(combn(x = names(m), m = 2))

  comp_value <- apply(X = combs, MARGIN = 1, function(ind) pchisq(2 * (logLik(m[[ind[2]]]) - logLik(m[[ind[1]]])), df = abs(m[[ind[1]]]$df.residual - m[[ind[2]]]$df.residual), lower.tail = FALSE))
  df_out <- data.frame(combs, comp_value)
  names(df_out) <- c("mod_1", "mod_2", "comp_value")

  return(df_out)
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pairwise #combinations
ADD COMMENT
Topic
Name
3+8 =