context("Discover Distributions - Logistic")
options <- jaspTools::analysisOptions("LDlogistic")
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$sampleSize <- 1000
options$variable <- "Normal100(mu=0,sigma=1)"
set.seed(1)
results <- jaspTools::runAnalysis("LDlogistic", "Distributions.csv", options)
test_that("Descriptives table results match", {
table <- results[["results"]][["dataContainer"]][["collection"]][["dataContainer_summary"]][["data"]]
expect_equal_tables(
table,
list(2.40161776050478, 0.130415109675896, 0.113909160788544, -2.2146998871775,
-0.494242549079378, 0.70433710614055, 100, 0.914574713318793,
0.836446906242152, "Normal100(mu=0,sigma=1)")
)
})
test_that("Estimated Parameters table results match", {
table <- results[["results"]][["mleContainer"]][["collection"]][["mleContainer_estParametersTable"]][["data"]]
expect_equal_tables(
table,
list(0.136816486578387, -0.0405989196665613, "<unicode>", 0.0905197277319271,
0.314231892823336, 0.518627612506237, 0.434228740538594, "<unicode>",
0.0430614402271524, 0.60302648447388)
)
})
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"]]
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"]]
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"]]
expect_equal_tables(
table,
list(0.991660820748592, 0.0434337377708869, "Kolmogorov-Smirnov", 0,
0, 0, 0.0630619303957307, 0.785756328615604, "Cram<unicode>r-von Mises",
0, 0, 0, 0.604258788450465, 2.04032129084066, "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"]]
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"]]
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"]]
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"]]
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"]]
expect_equal_plots(testPlot, "quantile-plot")
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.