Skip to content

API reference

Every help topic in the package, generated from its help pages. In R, the same text is available with ?name.

Tests of the variance

Each test returns an htest object, whose fields test_results documents. The tests are grouped by the family they belong to.

What every test returns

Topic Functions
What every test returns

Auxiliary-regression tests

Topic Functions
Perform White's test for heteroscedasticity performWhiteTest()
Robust White test with bootstrap and effect sizes performWhiteTestRobust()
Memory-efficient White test for large datasets performWhiteTestStreaming()
Perform Breusch-Pagan test for heteroscedasticity performBPTest(), performBreuschPaganTest()
Robust Breusch–Pagan test with bootstrap and effect sizes performBPTestRobust()
Streaming Breusch\–Pagan test for large datasets performBPTestStreaming()
Perform Koenker studentized Breusch-Pagan test performKoenkerTest()
Streaming Koenker studentized Breusch\–Pagan test performKoenkerTestStreaming()
Studentized Breusch–Pagan test (deprecated) performStudentizedBPTest()
Perform Cook-Weisberg test for heteroscedasticity performCookWeisbergTest()
Perform the non-constant variance (NCV) score test (deprecated) performNCVTest()
Perform Harvey test for multiplicative heteroscedasticity performHarveyTest()
Perform Glejser test for heteroscedasticity performGlejserTest()
Perform Park test for heteroscedasticity performParkTest()
Test the functional form of the error variance performVarianceFormTest()
Perform Davidian-Carroll test performDavidianCarrollTest()
Perform Spearman rank correlation test performSpearmanTest()
Perform Spread-Level test performSpreadLevelTest()
High-dimensional projection heteroscedasticity test performHighDimensionalTest()

Tests on ordered observations

Topic Functions
Perform Goldfeld-Quandt test for heteroscedasticity performGQTest()
Szroeter test for ordered alternatives performSzroeterTest()
Harrison-McCabe test for heteroscedasticity performHarrisonMcCabeTest()

Group-wise tests

Topic Functions
Perform Levene's test for equality of variances performLeveneTest()
Perform Brown-Forsythe test for equality of variances performBrownForsytheTest()
Perform Fligner-Killeen test for homogeneity of variances performFlignerKilleenTest()
Perform Bartlett's test for equality of variances performBartlettTest()
Perform Hartley's Fmax test performHartleyFmaxTest()
Perform O'Brien test for equality of variances performOBrienTest()
Box's M Test for Equality of Covariance Matrices performBoxMTest()

Time series, panel and spatial tests

Topic Functions
Perform Engle's ARCH LM test performArchLMTest()
Perform McLeod-Li test performMcLeodLiTest()
Breusch-Pagan LM test for random effects performBPRandomEffectsTest()
Perform Pesaran CD test performPesaranTest()
Spatial heteroscedasticity test performSpatialHeteroTest()

Resampling and robust tests

Topic Functions
Bootstrap White test performWhiteTestBootstrap()
Wild bootstrap heteroscedasticity test performWildBootstrapTest()
Rank-based permutation heteroscedasticity test performRankPermutationTest()
Quantile regression heteroscedasticity test performQuantileRegressionTest()
Bootstrap a test statistic bootstrapTestStatistic(), rbootstrap_test_statistic()
Bootstrap utilities for heteroscedasticity diagnostics
Robust heteroscedasticity diagnostics
Modern heteroscedasticity diagnostics modern_diagnostics
Additional heteroscedasticity tests

Model checks

Checks of the fitted model that are not tests of the variance: the functional form, collinearity, influence and the fit itself. They are listed apart so that they are not mistaken for heteroscedasticity tests.

Topic Functions
Ramsey's RESET test for nonlinearity performRESETTest()
Variance inflation factors performVIFDiagnostic()
Identify influential observations performInfluenceDiagnostics()
Scatter-plot diagnostics for heteroscedasticity performScatterDiagnostic()
Validate model argument checkModel()
Enhanced model diagnostics (deprecated) checkModelEnhanced()

Running several diagnostics

Topic Functions
Run multiple heteroscedasticity diagnostics runHeteroTests()
Parallel test execution helper runHeteroTestsParallel()
Run a suite of model diagnostics runDiagnostics()
Run registered diagnostic plots runDiagnosticPlots()
Run multivariate heteroscedasticity tests runMultivariateTests()
Run time-series heteroscedasticity tests runTimeSeriesTests()
Run panel-data heteroscedasticity tests runPanelTests()
Run heteroscedasticity diagnostics on the data of a survey design runSurveyHeteroTests()
Run enhanced heteroscedasticity diagnostics runAdvancedDiagnostics(), rrunAdvancedDiagnostics()
Compare diagnostics across models compareModelDiagnostics()
Summarise heteroscedasticity test results compareTestResults()
Machine-learning residual analysis analyzeMLResiduals()
Register a custom diagnostic registerDiagnostic()
Register a diagnostic plot registerPlot()
List the registered diagnostics listDiagnostics()
Create a diagnostic object HeteroDiagnostic()
Run diagnostic tests test()
Summarize diagnostics summary(<HeteroDiagnostic>)
Plot diagnostics plot(<HeteroDiagnostic>)
S3 containers for heteroscedasticity diagnostics
broom methods for heteroscedasticity diagnostics tidy(<hetero_test>), glance(<hetero_test>), augment(<hetero_test>), tidy(<hetero_test_suite>), glance(<hetero_test_suite>), augment(<hetero_test_suite>), tidy(<hetero_grouped_suite>)
Cache results of a heteroscedasticity test cachedTest()
Clear cached test results clearTestCache()
Clear cached diagnostic run results clearAnalysisCache()
Heteroscedasticity Test Factory
Shared instance of the test factory

Remediation

Topic Functions
Weighted Least Squares wrapper fitWLS()
Robust regression wrapper fitRobust()
Automatic transformation helper autoTransform()
Suggest remediation actions for heteroscedasticity suggestRemediation(), print(<remediation_suggestions>)
Automatically compare remedial models autoCompareRemediations()

Recommendations

Topic Functions
Intelligent recommendations for heteroscedasticity diagnostics analyseDatasetCharacteristics(), suggestDiagnosticsForProfile(), interpretHeteroTestResults(), recommendRemediationStrategies(), warnDiagnosticAssumptions(), buildDiagnosticDecisionTree(), composeDiagnosticNarrative(), generateHeteroRecommendations()

Simulation

The simulation functions are named in snake_case on purpose; the rest of the package uses camelCase.

Topic Functions
Simulate heteroscedastic data simulate_hetero(), simulate_arch1(), sigma_linear(), sigma_exponential(), sigma_group(), sigma_piecewise(), sigma_poly(), sigma_sin(), sigma_multiplicative(), sigma_spatial(), sigma_logistic(), sigma_inverse(), sigma_power(), sigma_step(), sigma_u_shape(), sigma_exp_decay(), sigma_gaussian_peak(), sigma_piecewise_linear()
Advanced simulation framework for test validation simulate_size(), simulate_power(), simulate_type_I_errors(), simulate_power_analysis()
Plot method for power analysis results plot(<power_analysis>)

Plotting

Topic Functions
Plot residuals vs fitted values plotResidualsFitted()
Enhanced residuals vs fitted plot (deprecated) plotResidualsFittedEnhanced()
Spread-Level plot for variance diagnostics plotSpreadLevel()
Density plot of residuals plotResidualDensity()
QQ plot of residuals plotResidualQQ()
Bubble plot of residual variance by covariate plotBubbleVariance()
Generate a suite of diagnostic plots plotDiagnosticSuite()
Enhanced diagnostic plot suite (deprecated) plotDiagnosticSuiteEnhanced()
Compare residuals before and after remediation plotBeforeAfter()
Autoplot heteroscedasticity diagnostics autoplot(<hetero_test_suite>), autoplot(<hetero_grouped_suite>)
Heteroscedasticity diagnostic theme theme_hetero()
Colour scale for heteroscedasticity diagnostics scale_colour_hetero_diagnostic(), scale_fill_hetero_diagnostic()

Reporting and data

Topic Functions
Automated diagnostic report generation generateDiagnosticReport()
Download example teaching dataset downloadTeachingData()
Simulated dataset with collinearity and mild nonlinearity diagnostic_data
Simulated dataset with heteroscedastic errors hetero_data
Print method for enhanced White test results print(<htest_enhanced>)

Dashboard and benchmarks

To move to a companion package, once it has a name.

Topic Functions
Interactive diagnostic dashboard launchDiagnosticDashboard()
Benchmark heteroTests against reference implementations run_benchmark_suite(), generate_benchmark_report()

Package infrastructure

Topic Functions
Control logging for heteroTests diagnostics ht_set_log_level(), ht_enable_log_capture(), ht_log_history(), ht_clear_log_history()
Generate standardized error message (deprecated) std_error()
Generate standardized warning message (deprecated) std_warning()
Validate model and data inputs before running diagnostics (deprecated) validateTestInputs()
Validate data argument (deprecated) checkData()
Effect size calculations for heteroscedasticity diagnostics rcalculateEffectSize()
Estimate test power from observed effect size restimate_test_power()
Validate diagnostics against reference implementations rvalidate_against_reference()

Internal

Topic Functions
Diagnostics registry .diagnostic_registry
Bibliography of Diagnostic Algorithms
Bootstrap implementation for White test bootstrap_white_test()
Validate numeric vector checkNumericVector()
Check memory usage and warn for large datasets check_memory_usage()
Reset cached validation results clearValidationCache()
Ecosystem integration helpers .ht_null
Log a formatted message ht_log()
Interpret White test results interpret_white_test()
Standardized error and warning messages
Test-specific sample size requirements rTEST_REQUIREMENTS
Handle missing values according to a specified strategy rhandleMissingValues()
Process validation helper outputs rprocessValidationResult()
Validate data inputs for heteroscedasticity tests rvalidateDataInputs()
Validate distributional assumptions rvalidateDistributionalAssumptions()
Validate grouping variable structure rvalidateGroupingVariable()
Validate regression model inputs rvalidateModelInputs()
Validate test-specific sample size requirements rvalidateSampleSize()
Validate test-specific requirements rvalidateTestRequirements()
Safely fit a linear model safe_lm()
Safe variance calculation safe_var()