Returned by KaguModel$effects(). Holds the full posterior over the
causal effect along with metadata.
Scalar effect:
samplesis a[n_chains, n_draws]matrix.Sweep effect:
samplesis a[n_sweep, n_chains, n_draws]array.
Public fields
sourceCharacter - the intervention node.
targetCharacter - the outcome node.
from_valueNumeric - intervention baseline value (or sweep grid).
to_valueNumeric - intervention target value (or sweep grid).
samplesNumeric array - posterior effect samples.
hdi_probNumeric - HDI probability used for summaries and plots.
std_unitsLogical - whether the effect is in SD units.
conditionsNamed list of conditioned node values, or
NULL.sweep_valuesNumeric vector of sweep grid values, or
NULL.conditions_labelString representation of conditions (for plotting).
compare_resultsList of other
EffectResults (for multi-condition plots).
Methods
EffectResult$new()
Create an EffectResult (normally called by compute_effect).
Usage
EffectResult$new(
source,
target,
from_value,
to_value,
samples,
hdi = 0.9,
std_units = FALSE,
conditions = NULL,
sweep_values = NULL
)Arguments
sourceCharacter - the intervention node.
targetCharacter - the outcome node.
from_valueNumeric - intervention baseline value.
to_valueNumeric - intervention target value.
samplesNumeric array - posterior effect samples.
hdiNumeric - HDI probability.
std_unitsLogical - whether the effect is in SD units.
conditionsNamed list of conditioned node values.
sweep_valuesNumeric vector of sweep grid values.
EffectResult$summary()
Tabular summary of the effect posterior.
Returns a tibble, consistent with KaguModel$summary(). The HDI
columns use the same hdi_lower / hdi_upper naming as
build_summary_table().
Scalar: a one-row tibble with
source,target,from,to,mean,sd,hdi_lower,hdi_upper.Sweep: one row per grid point with
source,target,x,mean,sd,hdi_lower,hdi_upper.
EffectResult$plot()
Plot the posterior effect distribution.
Scalar: density plot with mean point and HDI bar.
Sweep: dose-response line with HDI ribbon.
Arguments
compareOptional named list of other
EffectResultinstances to overlay (useful for comparing sweeps under different interactions/conditions). Only valid if this result and all comparison results aresweep = TRUE. If this effect was generated with a list of conditions,compareis populated automatically.base_labelOptional character string to label this
EffectResultin the legend when plotting withcompare(defaults to"Base"or the condition label).
EffectResult$diagnostics()
R-hat and ESS diagnostics for the effect posterior.
Chain structure is preserved, so r-hat values are genuine.
Returns
A tibble from posterior::summarise_draws().