context("Discover Distributions - Fréchet")
options <- jaspTools::analysisOptions("LDfrechet")
options$location <- 1
options$scale <- 2
options$shape <- 3.5
options$andersonDarling <- TRUE
options$ciInterval <- TRUE
options$ciIntervalInterval <- 0.95
options$cramerVonMisses <- TRUE
options$estCDF <- TRUE
options$estPDF <- TRUE
options$highlightDensity <- TRUE
options$highlightProbability <- TRUE
options$histogram <- FALSE
options$kolmogorovSmirnov <- TRUE
options$methodMLE <- TRUE
options$newVariableName <- ""
options$outputEstimates <- TRUE
options$outputSE <- TRUE
options$parsSupportMoments <- TRUE
options$plotCDF <- TRUE
options$plotQF <- TRUE
options$ppplot <- TRUE
options$qqplot <- TRUE
options$qqPlotCi <- FALSE
options$qqPlotCiLevel <- 0.95
options$ppPlotCi <- FALSE
options$ppPlotCiLevel <- 0.95
options$variable <- "frechet"
set.seed(1)
results <- jaspTools::runAnalysis("LDfrechet",
data.frame(frechet = jaspDistributions:::rfrechet(n=100,shape=3.5,location=1,scale=2)),
options)
test_that("Descriptives table results match", {
table <- results[["results"]][["dataContainer"]][["collection"]][["dataContainer_summary"]][["data"]]
jaspTools::expect_equal_tables(table,
list(8.91034166750067, 3.48709410252652, 3.19875323416648, 2.31721917019024,
2.93144522938583, 3.9228922490251, 100, 0.914532371649053, 0.836369458794042,
"frechet"))
})
test_that("Estimated Parameters table results match", {
table <- results[["results"]][["mleContainer"]][["collection"]][["mleContainer_estParametersTable"]][["data"]]
jaspTools::expect_equal_tables(table,
list(5.46445243285961, 0.576675934506699, "<unicode>", 2.49380934389972,
10.3522289312125, 0.177494733871164, -2.46954241758425, "<unicode>",
1.35055397565206, 2.82453188532658, 2.89059793345486, 0.196260785670041,
"<unicode>", 1.3746870702918, 5.58493508123967))
})
test_that("Empirical vs. Theoretical CDF plot matches", {
plotName <- results[["results"]][["mleContainer"]][["collection"]][["mleContainer_mleFitAssessment"]][["collection"]][["mleContainer_mleFitAssessment_estCDF"]][["data"]]
testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
jaspTools::expect_equal_plots(testPlot, "empirical-vs-theoretical-cdf", dir="LDfrechet")
})
test_that("Histogram vs. Theoretical PDF plot matches", {
plotName <- results[["results"]][["mleContainer"]][["collection"]][["mleContainer_mleFitAssessment"]][["collection"]][["mleContainer_mleFitAssessment_estPDF"]][["data"]]
testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
jaspTools::expect_equal_plots(testPlot, "histogram-vs-theoretical-pdf", dir="LDfrechet")
})
test_that("Fit Statistics table results match", {
table <- results[["results"]][["mleContainer"]][["collection"]][["mleContainer_mleFitAssessment"]][["collection"]][["mleContainer_mleFitAssessment_fitStatisticsTable"]][["data"]]
jaspTools::expect_equal_tables(table,
list(0.945034040783613, 0.0525772593537707, "Kolmogorov-Smirnov", 0,
0, 0, 0.824335469965107, 0.274472101469047, "Cram<unicode>r-von Mises",
0, 0, 0, 0.852781794494451, 1.51044947327082, "Anderson-Darling"
))
})
test_that("P-P plot matches", {
plotName <- results[["results"]][["mleContainer"]][["collection"]][["mleContainer_mleFitAssessment"]][["collection"]][["mleContainer_mleFitAssessment_ppplot"]][["data"]]
testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
jaspTools::expect_equal_plots(testPlot, "p-p-plot", dir="LDfrechet")
})
test_that("Q-Q plot matches", {
plotName <- results[["results"]][["mleContainer"]][["collection"]][["mleContainer_mleFitAssessment"]][["collection"]][["mleContainer_mleFitAssessment_qqplot"]][["data"]]
testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
jaspTools::expect_equal_plots(testPlot, "q-q-plot", dir="LDfrechet")
})
test_that("Cumulative Probability Plot matches", {
plotName <- results[["results"]][["plotCDF"]][["collection"]][["plotCDF_cdfPlot"]][["data"]]
testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
jaspTools::expect_equal_plots(testPlot, "cumulative-probability-plot", dir="LDfrechet")
})
test_that("Density Plot matches", {
plotName <- results[["results"]][["plotPDF"]][["collection"]][["plotPDF_pdfPlot"]][["data"]]
testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
jaspTools::expect_equal_plots(testPlot, "density-plot", dir="LDfrechet")
})
test_that("Quantile Plot matches", {
plotName <- results[["results"]][["plotQF"]][["collection"]][["plotQF_qfPlot"]][["data"]]
testPlot <- results[["state"]][["figures"]][[plotName]][["obj"]]
jaspTools::expect_equal_plots(testPlot, "quantile-plot", dir="LDfrechet")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.