|
417 | 417 | isTRUE(options[["andersonDarling"]]) ||
|
418 | 418 | isTRUE(options[["lillienfors"]]) ||
|
419 | 419 | isTRUE(options[["shapiroWilk"]]) ||
|
| 420 | + isTRUE(options[["shapiroFrancia"]]) || |
420 | 421 | isTRUE(options[["chiSquare"]]) ||
|
421 | 422 | isTRUE(options[["estPDF"]]) ||
|
422 | 423 | isTRUE(options[["estPMF"]]) ||
|
|
522 | 523 | .ldFitStatisticsTable <- function(fitContainer, options, method){
|
523 | 524 | if(!is.null(fitContainer[['fitStatisticsTable']])) return()
|
524 | 525 |
|
525 |
| - allTests <- c("kolmogorovSmirnov", "cramerVonMisses", "andersonDarling", "lillienfors", "shapiroWilk", "chiSquare") |
| 526 | + allTests <- c("kolmogorovSmirnov", "cramerVonMisses", "andersonDarling", "lillienfors", "shapiroWilk", "shapiroFrancia", "chiSquare") |
526 | 527 | optionsTests <- allTests %in% names(options)
|
527 | 528 | whichTests <- unlist(options[allTests[optionsTests]])
|
528 | 529 |
|
|
550 | 551 | if(is.null(fit)) return()
|
551 | 552 | if(!is.null(fitContainer[['fitStatisticsResults']])) return(fitContainer[['fitStatisticsResults']]$object)
|
552 | 553 |
|
553 |
| - allTests <- c("kolmogorovSmirnov", "cramerVonMisses", "andersonDarling", "lillienfors", "shapiroWilk", "chiSquare") |
| 554 | + allTests <- c("kolmogorovSmirnov", "cramerVonMisses", "andersonDarling", "lillienfors", "shapiroWilk", "shapiroFrancia", "chiSquare") |
554 | 555 | tests <- allTests[allTests %in% names(options)]
|
555 | 556 |
|
556 | 557 | res <- data.frame(test = tests, statistic = numeric(length = length(tests)), p.value = numeric(length = length(tests)))
|
|
562 | 563 | "kolmogorovSmirnov" = c(list(x = variable, y = options$cdfFun), pars),
|
563 | 564 | "lillienfors" = list(x = variable),
|
564 | 565 | "shapiroWilk" = list(x = variable),
|
| 566 | + "shapiroFrancia" = list(x = variable), |
565 | 567 | "chiSquare" = list(x = as.numeric(table(variable)),
|
566 | 568 | p = do.call(options[['pdfFun']],
|
567 | 569 | utils::modifyList(pars,
|
|
577 | 579 | "cramerVonMisses" = goftest::cvm.test,
|
578 | 580 | "andersonDarling" = goftest::ad.test,
|
579 | 581 | "lillienfors" = nortest::lillie.test,
|
580 |
| - "shapiroWilk" = nortest::sf.test, |
| 582 | + "shapiroWilk" = stats::shapiro.test, |
| 583 | + "shapiroFrancia" = nortest::sf.test, |
581 | 584 | "chiSquare" = stats::chisq.test
|
582 | 585 | )
|
583 | 586 |
|
|
593 | 596 | fun <- function(x) {
|
594 | 597 | return(list(statistic = NA, p.value = NA))
|
595 | 598 | }
|
596 |
| - } else if (test == "shapiroWilk" && (length(variable) < 5 || length(variable) > 5000)) { |
597 |
| - fun <- stats::shapiro.test |
598 | 599 | }
|
599 | 600 | } else {
|
600 |
| - if (test == "shapiroWilk") { |
601 |
| - fun <- stats::shapiro.test |
602 |
| - } else if (test=="lillienfors") { |
| 601 | + if (test=="lillienfors") { |
603 | 602 | fun <- function(x) {
|
604 | 603 | return(list(statistic = NA, p.value = NA))
|
605 | 604 | }
|
|
622 | 621 | if(is.null(table)) return()
|
623 | 622 |
|
624 | 623 |
|
625 |
| - allTests <- c("kolmogorovSmirnov", "cramerVonMisses", "andersonDarling", "lillienfors", "shapiroWilk", "chiSquare") |
| 624 | + allTests <- c("kolmogorovSmirnov", "cramerVonMisses", "andersonDarling", "lillienfors", "shapiroWilk", "shapiroFrancia", "chiSquare") |
626 | 625 | tests <- allTests[allTests %in% names(options)]
|
627 | 626 | testNames <- c(gettext("Kolmogorov-Smirnov"),
|
628 | 627 | gettext("Cramér-von Mises"),
|
629 | 628 | gettext("Anderson-Darling"),
|
630 | 629 | gettext("Lillienfors"),
|
631 | 630 | gettext("Shapiro-Wilk"),
|
| 631 | + gettext("Shapiro-Francia"), |
632 | 632 | gettext("Chi-square"))[allTests %in% names(options)]
|
633 | 633 |
|
634 | 634 | whichTests <- unlist(options[tests])
|
|
0 commit comments