This class represents a normalised power prior whose Beta
prior on the power parameter is calibrated rather than configured.
The ordinary normalised power prior takes the mean and standard deviation of
that prior from the configuration grid, so a run uses the same prior however
precise the target trial is. Whether a given source/target discrepancy is
even distinguishable from noise depends on the target standard error, so a
prior fixed in advance cannot express "borrow when the two studies agree,
stop borrowing at a discrepancy I would not tolerate". This class states that
intention instead, as a Kullback-Leibler criterion over two hypothetical
target estimates, and solves for the shape parameters it implies - see
calibrate_npp_kl().
Everything downstream of the prior is inherited unchanged: the joint and
marginal posteriors, the quadrature mixture, the summaries and the effective
sample sizes are the ones GaussianNPP already computes. Only where p and
q come from differs.
The calibration reads the design, not the data, so it happens once per
scenario, in Model$calibrate_for_design(), before any replicate is
generated. p and q are left NULL until then: a model analysed before it
has been calibrated would otherwise silently use whatever placeholder stood
in for them.
Super classes
Model -> GaussianNPP -> GaussianNPP_KL
Public fields
methodName of the method
theta_0Boundary of the null hypothesis space
null_spaceThe null hypothesis space, which gives the benefit direction
calibrationThe result of
calibrate_npp_kl()for this scenariocalibration_settingsThe criterion settings read from the method parameters
Methods
Inherited methods
Model$check_data()Model$create()Model$empirical_bayes_update()Model$estimate_bayesian_operating_characteristics()Model$estimate_frequentist_operating_characteristics()Model$hypothesis_space_transformation()Model$inference_cache_scope()Model$plot_pdfs()Model$plot_posterior_pdf()Model$plot_prior_pdf()Model$posterior_beta_mixture()Model$posterior_ess()Model$posterior_mean()Model$posterior_moments()Model$posterior_quantile()Model$posterior_to_RBesT()Model$print_model_summary()Model$prior_cdf()Model$prior_elir_ess()Model$prior_to_RBesT()Model$simulation_for_given_treatment_effect()Model$test_decision()GaussianNPP$credible_interval()GaussianNPP$normalizing_constant_power_parameter()GaussianNPP$plot_power_parameter_posterior_pdf()GaussianNPP$plot_power_parameter_vs_drift()GaussianNPP$posterior_cdf()GaussianNPP$posterior_median()GaussianNPP$posterior_pdf()GaussianNPP$power_parameter_posterior_pdf()GaussianNPP$sample_posterior()GaussianNPP$summary_rows()GaussianNPP$unnormalized_posterior_power_parameter_pdf()
GaussianNPP_KL$new()
Initialize a new GaussianNPP_KL object.
Usage
GaussianNPP_KL$new(prior, theta_0, null_space)GaussianNPP_KL$calibrate_for_design()
Calibrate the prior on the power parameter to this design;
see npp_kl_calibrate_design(). For a binary endpoint the expected
target standard error is taken at zero treatment drift, so that the prior
does not depend on the scenario's true treatment effect.
GaussianNPP_KL$vectorised_replicate_inference()
Run every replicate at once
The parent's fast path, widened by the calibration columns. They are constant within a scenario, and are reported per replicate because the reporting layer averages every posterior parameter over the replicates.
Usage
GaussianNPP_KL$vectorised_replicate_inference(
target_data,
samples,
to_return,
critical_value,
theta_0,
confidence_level,
null_space
)Arguments
target_dataTarget study data.
samplesData frame of generated replicates.
to_returnCharacter vector of requested outputs.
critical_valueCritical value for hypothesis testing.
theta_0Null hypothesis value.
confidence_levelConfidence level for the credible interval.
null_spaceThe null space for hypothesis testing.
GaussianNPP_KL$sample_prior()
Sample from the prior on the treatment effect.
The prior is what the calibration chooses, so reaching for it before the
design has been seen is the same mistake as running inference early. It
is worth catching separately because this is the door the design priors
and the effective sample sizes come in through, and the shape parameters
being absent surfaces there as rbeta's "invalid arguments" rather than
as anything that names the cause.
GaussianNPP_KL$inference()
Perform inference on the target data.
The scalar path, which the vignette and the reference tests use, reports the same columns as the vectorised one so that the two can be compared.