Skip to contents

This is an interactive helper function that guides a user through a series of questions to generate a probability vector for Quality of Life (QoL) outcomes. The outcomes are discretized into five levels, from significant deterioration (-2) to significant improvement (+2).

The final vector is calculated by blending a predefined "scenario vector" with a uniform "uncertainty vector". The weight of this blend is determined by the user's stated confidence in the evidence, creating a final probability distribution that reflects both the expected outcome and its certainty.

Usage

generate_qol_vector()

Value

A named numeric vector of length 5. The names (`P(-2)` to `P(+2)`) represent the QoL change level, and the values are the corresponding probabilities, which sum to 1.

Details

The function performs the following steps: 1. Prompts the user to select one of five predefined QoL scenarios (e.g., "Significant Improvement"). 2. Prompts the user to rate the strength of evidence for that scenario on a 5-point scale. 3. Calculates a confidence factor `alpha` (from 0 to 1) based on the evidence strength. 4. Computes the final probability vector using the formula: `final_vector = alpha * scenario_vector + (1 - alpha) * uncertainty_vector`.

Examples

# The function is interactive, so the call should be wrapped in \dontrun{}
# for automated checking.
if (FALSE) {

# Run the function
qol_vector <- generate_qol_vector()

# The console will prompt you to enter information. For example:
#
# Select the main Quality of Life (QoL) scenario:
# 1: Significant Improvement
# 2: Stabilization / Probable Benefit
# 3: No Difference / Marginal Benefit
# 4: Deterioration
# 5: Insufficient Data / Unknown
# Enter a number (1-5): 2
#
# Select the strength/quality of the evidence for this scenario:
# 1: Very Low (almost speculative)
# 2: Low
# 3: Moderate (standard)
# 4: High
# 5: Very High (e.g., large RCT, low bias, p<0.001)
# Enter a number (1-5): 4

# The resulting vector would be stored in `qol_vector`
# print(qol_vector)
# P(-2)  P(-1)   P(0)  P(+1)  P(+2)
# 0.0875 0.1250 0.2000 0.4250 0.1625

}