cppp :: architecture map

calibrated posterior predictive p-values — who calls what

Path 1 — NIMBLE model, one call

  • runCalibrationNIMBLE() model + specs → result
    • simulation() defaults to simulation("conditional")
    • makeDiscrepancyCalculator() builds discFun
      • standardizeDiscrepancies()
      • completeDiscrepancy()
      • completeSimulation()
      • discrepancyCalculatorNF compiled engine
        • makeDiscrepancyNimbleFun() one per discrepancy
          • completeDiscrepancy()
    • makeSimulateNewDataFun() builds simulateNewDataFun
      • completeSimulation()
    • runCalibration() the engine below

Path 2 — plain R, you supply the two functions

  • runCalibration() no model inside — draws + your functions
    • asDiscMatrix() shape the discrepancy output
    • checkDiscMatrices() obs and sim must agree
    • newCpppResult()
      • validateCpppResult() cpppResult
makeOfflineDiscFun() helper: wraps your own D(y, θ) into a discFun

What you write

discrepancy() name, nodes, optional custom fun
simulation() "conditional" or "marginal"
discrepancyBase your nimbleFunction must contain it

Five ship with the package — naming one is a shortcut:

meanDisc varianceDisc devianceDisc chisquaredDisc freemantukeyDisc

What you get back

CPPPone value per discrepancy
obsPPPobserved p-value
repPPPnReps × K replicated p-values
discrepanciesthe raw values
drawnIndiceswhich draws seeded the replicates

An S3 cpppResult. print / summary / plot methods are planned.

Not wired up yet

transferAutocorrelation() transfer-ESS variance of the cppp
makeDiscrepancyExtractor() read discrepancies the MCMC already computed
exported — you can call it internal helper nimbleFunction (compiles) — discrepancyBase is exported too placeholder, not implemented indentation = "calls"