context("Discover Distributions - Mixture of normal and uniform")
options <- jaspTools::analysisOptions("LDmixtureNormalUniform")
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 <- "mixnormuniform"
set.seed(1)
results <- jaspTools::runAnalysis("LDmixtureNormalUniform",
data.frame(mixnormuniform = jaspDistributions:::rmixnormunif(n=100, pi=0.5, mu=-3, sigma=1, min=-10, max=10)),
options)
test_that("Descriptives table results match", {
table <- results[["results"]][["dataContainer"]][["collection"]][["dataContainer_summary"]][["data"]]
jaspTools::expect_equal_tables(table,
list(9.92154743056744, -0.822406925304493, -2.46859147852952, -8.5769195202738,
-3.74500662416853, 0.705836249981075, 100, 4.90237866905133,
24.0333166147695, "mixnormuniform"))
})
test_that("Estimated Parameters table results match", {
table <- results[["results"]][["mleContainer"]][["collection"]][["mleContainer_estParametersTable"]][["data"]]
jaspTools::expect_equal_tables(table,
list(0.512711670928913, 0.380894176503768, "<unicode>", 0.0672550595137997,
0.644529165354059, -2.9298148347657, -3.29388294129742, "<unicode>",
0.185752447189564, -2.56574672823398, 1.06326533823062, 0.75853327273685,
"<unicode>", 0.155478400571366, 1.36799740372439))
})
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")
})
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")
})
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.479105278467795, 0.0840992162607834, "Kolmogorov-Smirnov", 0,
0, 0, 0.556172340493501, 0.383814094145755, "Cram<unicode>r-von Mises",
0, 0, 0, 0.159885874834422, 3.43294732402111, "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")
})
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")
})
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")
})
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")
})
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")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.