From 6036d5f43d8b2523f0c270f3bb3b5ce61b4c2044 Mon Sep 17 00:00:00 2001 From: Maxime WACK Date: Wed, 2 Jul 2014 11:47:38 +0200 Subject: [PATCH] Modified algorithm for qualitative test selection : If there is a warning in chisq.test, try fisher.test with workspace=1e+08. If it still fails, retry fisher.test with simulated p value with 1e+06 samples. --- R/desc_groupe.R | 7 ++++--- cosmosR.rproj | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/R/desc_groupe.R b/R/desc_groupe.R index 0cc9c74..dfc120c 100644 --- a/R/desc_groupe.R +++ b/R/desc_groupe.R @@ -206,12 +206,13 @@ desc_groupe <- function(table, groupe, param = character(0), html=NULL, titre=NU test <<- "f" tryCatch( { - fisher.test(table[[var]],modulo,workspace)$p.value + fisher.test(table[[var]],modulo,workspace=1e+08)$p.value }, error=function(e) { - test <<- "X(f failed)" - chisq.test(table[[var]],modulo)$p.value + #test <<- "X(f failed)" + #chisq.test(table[[var]],modulo)$p.value + fisher.test(table[[var]],modulo,simulate.p.value = T,B = 1e+06)$p.value }) }, error=function(e) diff --git a/cosmosR.rproj b/cosmosR.rproj index 88c6159..c85962f 100644 --- a/cosmosR.rproj +++ b/cosmosR.rproj @@ -13,6 +13,6 @@ RnwWeave: Sweave LaTeX: pdfLaTeX BuildType: Package -PackageInstallArgs: --no-multiarch +PackageInstallArgs: --no-multiarch --with-keep.source PackageCheckArgs: --as-cran PackageRoxygenize: rd,collate,namespace