stateFrequency

fun ReportBuilder.stateFrequency(freq: StateFrequency, caption: String? = null, confidenceLevel: Double = 0.95, showStatistics: Boolean = true, showTransitions: Boolean = true, showTransitionProportions: Boolean = false, showPlot: Boolean = true, proportions: Boolean = false)(source)

Appends a self-contained section that reports the state frequency distribution, summary statistics on the observed state numbers, optional transition matrices, and a frequency bar plot.

Produces (inside a section titled caption or freq.name):

  1. A ksl.utilities.io.report.ast.ReportNode.Paragraph summarising total observations and number of states.

  2. A DataTable ("State Frequency Table") with columns: State | Count | Cum Count | % | Cum %

  3. A ksl.utilities.io.report.ast.ReportNode.StatPropertyTable ("Statistics on Observed States") built from StateFrequency.statistic — the explicit bridge to numeric statistics on state numbers. Omitted when showStatistics is false.

  4. A DataTable ("Transition Count Matrix") — square matrix of state-to-state transition counts, rows = from-state, columns = to-state. Omitted when showTransitions is false.

  5. A DataTable ("Transition Proportion Matrix") — same structure as the count matrix but with row-normalised proportions (each row sums to 1.0 for visited states, 0.0 for unvisited states). Omitted when showTransitionProportions is false.

  6. A ksl.utilities.io.report.ast.ReportNode.PlotNode for the state frequency bar chart. Omitted when showPlot is false.

Usage:

val doc = report("Machine State Analysis") {
stateFrequency(machineStateFreq, showTransitionProportions = true)
}

Parameters

freq

the state frequency tabulation to report

caption

optional section title; defaults to freq.name

confidenceLevel

confidence level for the StatPropertyTable CI; must be in (0, 1)

showStatistics

when true (default) a StatPropertyTable of numeric statistics on observed state numbers is included. Set to false when the numeric statistics on state numbers have no meaningful interpretation.

showTransitions

when true (default) a transition count matrix DataTable is included

showTransitionProportions

when true a transition proportion matrix DataTable is included (row-normalised: each row sums to 1.0 for visited states). Default is false.

showPlot

when true (default) a frequency bar chart is appended

proportions

when true the bar chart y-axis shows proportions; when false (default) it shows counts. Has no effect when showPlot is false.