Fixed syntax / coding errors to make tests agree exactly with Java tests; added missing tests to testAll.
This commit is contained in:
parent
23b351c894
commit
03326f6116
|
@ -31,7 +31,6 @@ tol <- 1E-9
|
|||
# Function definitions
|
||||
|
||||
source("testFunctions") # utility test functions
|
||||
library(rmutil)
|
||||
|
||||
# function to verify distribution computations
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ verifyDistribution <- function(points, expected, m, s, tol) {
|
|||
i <- 0
|
||||
for (point in points) {
|
||||
i <- i + 1
|
||||
rDistValues[i] <- pnaka(point, m, s)
|
||||
rDistValues[i] <- pnaka(point, s, m)
|
||||
}
|
||||
output <- c("Distribution test m = ",m,", s = ", s)
|
||||
if (assertEquals(expected, rDistValues, tol, "Distribution Values")) {
|
||||
|
@ -55,7 +55,7 @@ verifyDensity <- function(points, expected, m, s, tol) {
|
|||
i <- 0
|
||||
for (point in points) {
|
||||
i <- i + 1
|
||||
rDensityValues[i] <- dnaka(point, m, s)
|
||||
rDensityValues[i] <- dnaka(point, s, m)
|
||||
}
|
||||
output <- c("Density test m = ",m,", s = ", s)
|
||||
if (assertEquals(expected, rDensityValues, tol, "Density Values")) {
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
#
|
||||
# R functions used
|
||||
# ppareto(q, mean=0, sd=1, lower.tail = TRUE, log.p = FALSE) <-- distribution
|
||||
# The VGAM library which includes the function above must be installed to run
|
||||
# this test.
|
||||
# See https://cran.r-project.org/web/packages/VGAM/index.html
|
||||
#-----------------------------------------------------------------------------
|
||||
tol <- 1E-9
|
||||
|
||||
|
@ -78,7 +81,7 @@ verifyDistribution(distributionPoints, distributionValues, mu, sigma, tol)
|
|||
verifyDensity(distributionPoints, densityValues, mu, sigma, tol)
|
||||
|
||||
distributionValues <- c(0, 0, 0, 0.510884134236, 0.694625688662, 0.785201995008, 0.837811522357, 0.871634279326)
|
||||
densityValues <- c(0, 0, 0, 0.195646346305, 0.0872498032394, 0.0477328899983, 0.0294888141169, 0.0197485724114)
|
||||
densityValues <- c(0, 0, 0.666666666, 0.195646346305, 0.0872498032394, 0.0477328899983, 0.0294888141169, 0.0197485724114)
|
||||
distributionPoints <- c(mu - 2 *sigma, mu - sigma, mu, mu + sigma,
|
||||
mu + 2 * sigma, mu + 3 * sigma, mu + 4 * sigma,
|
||||
mu + 5 * sigma)
|
||||
|
@ -91,17 +94,17 @@ distributionPoints <- c(mu - 2 *sigma, mu - sigma, mu, mu + sigma,
|
|||
mu + 2 * sigma, mu + 3 * sigma, mu + 4 * sigma,
|
||||
mu + 5 * sigma)
|
||||
distributionValues <- c(0, 0, 0, 0.5, 0.666666666667, 0.75, 0.8, 0.833333333333)
|
||||
densityValues <- c(0, 0, 0, 0.25, 0.111111111111, 0.0625, 0.04, 0.0277777777778)
|
||||
densityValues <- c(0, 0, 1, 0.25, 0.111111111111, 0.0625, 0.04, 0.0277777777778)
|
||||
verifyDistribution(distributionPoints, distributionValues, mu, sigma, tol)
|
||||
verifyDensity(distributionPoints, densityValues, mu, sigma, tol)
|
||||
|
||||
mu <- 0.1
|
||||
sigma <- 0.1
|
||||
distributionPoints <- c(mu - 2 *sigma, mu - sigma, mu, mu + sigma,
|
||||
distributionPoints <- c(mu - 2 *sigma, 0, mu, mu + sigma,
|
||||
mu + 2 * sigma, mu + 3 * sigma, mu + 4 * sigma,
|
||||
mu + 5 * sigma)
|
||||
distributionValues <- c(0, 0, 0, 0.0669670084632, 0.104041540159, 0.129449436704, 0.148660077479, 0.164041197922)
|
||||
densityValues <- c(0, 0, 0, 0.466516495768, 0.298652819947, 0.217637640824, 0.170267984504, 0.139326467013)
|
||||
densityValues <- c(0, 0, 1, 0.466516495768, 0.298652819947, 0.217637640824, 0.170267984504, 0.139326467013)
|
||||
verifyDistribution(distributionPoints, distributionValues, mu, sigma, tol)
|
||||
verifyDensity(distributionPoints, densityValues, mu, sigma, tol)
|
||||
|
||||
|
|
|
@ -21,6 +21,12 @@
|
|||
# directory, launch R from this directory and then enter
|
||||
# source("<name-of-this-file>")
|
||||
#
|
||||
# The KolmogorovSmirnov and Pareto distribution tests require the following
|
||||
# packages to be installed:
|
||||
#
|
||||
# https://cran.r-project.org/web/packages/Matching/index.html
|
||||
# https://cran.r-project.org/web/packages/VGAM/index.html
|
||||
#
|
||||
# To redirect output to a file, uncomment the following line, substituting
|
||||
# another file path if you like (default behavior is to write the file to the
|
||||
# current directory).
|
||||
|
@ -31,6 +37,8 @@
|
|||
source("binomialTestCases")
|
||||
source("normalTestCases")
|
||||
source("poissonTestCases")
|
||||
source("paretoTestCases")
|
||||
source("logNormalTestCases")
|
||||
source("hypergeometricTestCases")
|
||||
source("exponentialTestCases")
|
||||
source("cauchyTestCases.R")
|
||||
|
@ -45,6 +53,7 @@ source("gumbelTestCases.R")
|
|||
source("laplaceTestCases.R")
|
||||
source("logisticsTestCases.R")
|
||||
source("nakagamiTestCases.R")
|
||||
source("zipfTestCases")
|
||||
|
||||
# regression
|
||||
source("regressionTestCases")
|
||||
|
@ -52,7 +61,8 @@ source("regressionTestCases")
|
|||
# inference
|
||||
source("chiSquareTestCases")
|
||||
source("anovaTestCases")
|
||||
source("KolmogorovSmirnovTestCases")
|
||||
source("KolmogorovSmirnovTestCases.R")
|
||||
source("TTestCases")
|
||||
|
||||
# descriptive
|
||||
source("descriptiveTestCases")
|
||||
|
|
Loading…
Reference in New Issue