Package: kernR 0.8.2

Max Moldovan

kernR: Kernel-Based Causal Distributional Testing

Kernel-based hypothesis tests for causal inference and distributional treatment effects. Implements backdoor-adjusted HSIC (bd-HSIC) for testing causal association, and doubly robust kernel statistics (DR-DATE, DR-DETT) for testing distributional treatment effects beyond mean shifts. Supports binary, continuous, and mixed treatments, hierarchical/nested data structures, and scales to large datasets via Nystrom approximation and random Fourier features. This package depends on 'PESTO' (GPL (>= 3)); kernR's own sources are released under the MIT licence, but the installed combination with 'PESTO' is a combined work subject to the terms of the GPL (>= 3).

Authors:Max Moldovan [aut, cre, cph]

kernR_0.8.2.tar.gz
kernR_0.8.2.zip(r-4.7-x86_64)kernR_0.8.2.zip(r-4.6-x86_64)kernR_0.8.2.zip(r-4.5-x86_64)
kernR_0.8.2.tgz(r-4.6-x86_64)kernR_0.8.2.tgz(r-4.6-arm64)kernR_0.8.2.tgz(r-4.5-x86_64)kernR_0.8.2.tgz(r-4.5-arm64)
kernR_0.8.2.tar.gz(r-4.7-arm64)kernR_0.8.2.tar.gz(r-4.7-x86_64)kernR_0.8.2.tar.gz(r-4.6-arm64)kernR_0.8.2.tar.gz(r-4.6-x86_64)
kernR_0.8.2.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
kernR/json (API)

# Install 'kernR' in R:
install.packages('kernR', repos = c('https://max578.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/max578/kernr/issues

Uses libs:
  • openblas– Optimized BLAS
  • c++– GNU Standard C++ Library v3

On CRAN:

Conda:

openblascpp

4.59 score 46 exports 25 dependencies

Last updated from:60bb618c01 (on main). Checks:13 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK229
linux-devel-x86_64OK216
source / vignettesOK322
linux-release-arm64OK217
linux-release-x86_64OK181
macos-release-arm64OK145
macos-release-x86_64OK443
macos-oldrel-arm64OK135
macos-oldrel-x86_64OK307
windows-develOK243
windows-releaseOK232
windows-oldrelOK228
wasm-releaseOK153

Exports:aggregate_downscaleassess_overlapbd_hsic_testcir_objectiveconcordance_testconcordance_test_nystromcoverage_testdist_regressiondr_date_scenariodr_date_testdr_dett_testeffective_sample_sizeestimate_density_ratioestimate_propensityfit_cmefit_density_ratiogaussian_scorehierarchical_testhsic_identifiabilityhsic_sensitivityhsic_testhsic_test_nystromjoint_coverage_testkernel_causal_testkernel_downscalekernel_matrixkernel_specksd_testksd_test_nystromlhs_designmmd_ppcmmd_testnumeric_scorenystrom_factorpesto_ensembleplot_weightsposterior_sample_aggregatepredict_density_ratiorelative_entropyrelative_entropy_ensembleresolve_bandwidthrff_featuresselect_bandwidthtaci_testtidyweighted_hsic_stat

Dependencies:clicpp11data.tabledigestfarvergenericsggplot2gluegtableisobandlabelinglifecyclePESTOR6RColorBrewerRcppRcppArmadilloRcppEigenrlangS7scalesvctrsviridisLitewithryaml

Calibration and concordance: kernR's validation layer
Calibration: ksd_test() | Concordance: concordance_test() | The validation pattern

Last update: 2026-06-02
Started: 2026-06-02

Causal Association Testing with bd-HSIC
The Problem | How It Works | Example: Linear Causal Effect | Example: No Causal Effect (Confounding Only) | Example: Non-Linear Causal Effect | Diagnostic: Null Distribution | Using the Formula Interface | When to Use bd-HSIC | References

Last update: 2026-05-18
Started: 2026-04-10

Density-Ratio Backends and the proxymix Binding
The cross-package contract | Four backends, one problem | bd-HSIC under each backend | When to reach for proxymix | References

Last update: 2026-05-18
Started: 2026-05-18

Distributional Treatment Effect Tests (DR-DATE / DR-DETT)
Beyond Mean Effects | Key Concepts | Example: Mean Shift (Detectable by All Methods) | Example: Variance Effect Only (Invisible to Mean-Based Tests) | DR-DETT: Effect on the Treated | Comparing the Tests | Using the Formula Interface | When to Use Which Test | References

Last update: 2026-05-18
Started: 2026-04-10

DR-DATE for APSIM Scenario Counterfactuals
The ag-scenario question | One calibration, two scenarios | Run the DR-DATE scenario test | Null case — same outputs | What gets validated | Output sub-selection | When parameter posteriors genuinely differ | Where the cross-package plumbing lives | Reproducibility

Last update: 2026-05-18
Started: 2026-05-18

Getting Started with kernR
What is kernR? | Kernel Basics | Computing Kernel Matrices | Two-Sample Testing with MMD | Independence Testing with HSIC | Visualising Results | Next Steps

Last update: 2026-05-18
Started: 2026-04-10

Hierarchical and Nested Data
Why Hierarchy Matters | Example: Agriculture Trial | Decomposition: Within vs Between | Weight Methods | Example: No Treatment Effect | When to Use Hierarchical Tests

Last update: 2026-05-18
Started: 2026-04-10

Hierarchical bd-HSIC for Multi-Site Designs
Why a hierarchical version of bd-HSIC? | A multi-site stub | Naive vs hierarchical permutation | Stratified per-cluster contributions | Type-I behaviour under a true null with cluster effects | Choosing the scheme | Notes on practice | Reference

Last update: 2026-05-18
Started: 2026-05-18

HSIC-Based Distributional Sensitivity
What HSIC-Sensitivity catches that Sobol misses | A sensitivity scan on a stubbed APSIM-like simulator | The scan | Visual | Side-by-side with sensitivity::sobol | Tabular form | Total-order indices | A pure-interaction example | Side-by-side plot | A near-additive example for contrast | Pair-bootstrap CI for total-order indices | Notes on total-order indices | Notes on practice | References

Last update: 2026-05-18
Started: 2026-05-18

Kernel-Based Downscaling: Vector and Distribution Inputs
Three flavours of kernel downscaling | (1) kernel_downscale(): coarse climate → paddock yield | When to reach for kernel_downscale() | (2) dist_regression(): distribution → scalar | Bag-level vector targets | Outer kernel choice | Variable bag sizes | When to reach for dist_regression() | (3) aggregate_downscale(): aggregate-likelihood inversion | When to reach for aggregate_downscale() | Comparison | References

Last update: 2026-05-18
Started: 2026-05-18

Posterior-Predictive Check with MMD
The question | The stub ensemble | Case A: well-calibrated posterior | Case B: miscalibrated posterior (variance too narrow) | Case C: miscalibrated posterior (mean-shifted) | Comparing surprise across scenarios | Visual diagnostic | Notes on practice | Cross-package handoff | References

Last update: 2026-05-18
Started: 2026-05-18

Pre-IES Identifiability Screening with HSIC
Why screen before calibrating? | A stubbed APSIM archetype | Latin-hypercube design | Simulate and screen | Visual diagnostic | Handing off to PESTO | Tabular form | Notes on practice | References

Last update: 2026-05-18
Started: 2026-05-18

Scaling HSIC with Nystrom and Random Fourier Features
The scaling wall | A tiny correctness check | Scaling demonstration | When to use which | Notes on practice | References

Last update: 2026-05-18
Started: 2026-05-18

Readme and manuals

Help Manual

Help pageTopics
Aggregate-Likelihood Downscalingaggregate_downscale
Assess Propensity Score Overlapassess_overlap
Backdoor-HSIC Test for Causal Associationbd_hsic_test
Objective Causal Influence Range (threshold-free)cir_objective
Kernel k-sample Concordance Testconcordance_test
Accelerated Kernel k-sample Concordance Test (Nystrom / RFF)concordance_test_nystrom
Coverage / Calibration Diagnostic for a Predictive Ensemblecoverage_test coverage_test.default coverage_test.pesto_ensemble coverage_test.pesto_ensemble_manifest
Kernel Distribution Regressiondist_regression
DR-DATE for Two PESTO Ensemble Scenariosdr_date_scenario
Doubly Robust Distributional Average Treatment Effect Test (DR-DATE)dr_date_test
Doubly Robust Distributional Effect on the Treated Test (DR-DETT)dr_dett_test
Compute Effective Sample Sizeeffective_sample_size
Estimate Density Ratios (backwards-compatible wrapper)estimate_density_ratio
Estimate Propensity Scoresestimate_propensity
Estimate Conditional Mean Embedding via Kernel Ridge Regressionfit_cme
Fit a Density-Ratio Modelfit_density_ratio
Score function for a multivariate normal targetgaussian_score
Hierarchical Kernel Causal Testhierarchical_test
HSIC-Based Identifiability Diagnostichsic_identifiability
HSIC-Based Distributional Sensitivity Indexhsic_sensitivity
HSIC Independence Testhsic_test
HSIC Independence Test via Low-Rank Factorisationhsic_test_nystrom
Joint (Multivariate) Calibration Diagnostic for a Predictive Ensemblejoint_coverage_test joint_coverage_test.default joint_coverage_test.pesto_ensemble joint_coverage_test.pesto_ensemble_manifest
Unified Kernel Causal Testkernel_causal_test
Kernel-Based Statistical Downscalingkernel_downscale
Compute a Kernel Matrixkernel_matrix
Create a Kernel Specificationkernel_spec
Kernel Stein Discrepancy Goodness-of-Fit Testksd_test
Accelerated Kernel Stein Discrepancy Goodness-of-Fit Test (Nystrom)ksd_test_nystrom
Latin-Hypercube Design Over Bounded Parameterslhs_design
MMD Posterior-Predictive Checkmmd_ppc mmd_ppc.default mmd_ppc.pesto_ensemble mmd_ppc.pesto_ensemble_manifest
MMD Two-Sample Testmmd_test
Finite-difference score from a log-densitynumeric_score
Nystrom Low-Rank Kernel Factorisationnystrom_factor
PESTO Ensemble Manifest (Constructor)pesto_ensemble
Plot Weight Diagnosticsplot_weights
Plot an HSIC Identifiability Scanplot.hsic_identifiability
Plot HSIC-Sensitivity Indicesplot.hsic_sensitivity
Plot a Kernel Test Resultplot.kernel_test_result
Sample from the posterior of an aggregate-downscale fitposterior_sample_aggregate
Predict from a Fitted Density-Ratio Modelpredict_density_ratio
Predict Conditional Mean Embedding Weights at New Pointspredict.cme_fit
Predict from a Fitted Distribution Regression Modelpredict.dist_regression
Print a Conditional Mean Embedding Fitprint.cme_fit
Relative Entropy Between Two Gaussians (the ACI causal metric)relative_entropy
Relative Entropy Between Two Sample Ensembles (Gaussian approximation)relative_entropy_ensemble
Resolve Kernel Bandwidthresolve_bandwidth
Random Fourier Features for the RBF Kernelrff_features
Select Kernel Bandwidthselect_bandwidth
Theory-anchored causal inference (TACI) mechanism-consistency testtaci_test
Tidy a kernR Test Result Into a One-Row-Per-Term Data Frametidy.kernel_test_result
Tidy a TACI Mechanism-Consistency Resulttidy.taci_result
Weighted HSIC Statisticweighted_hsic_stat