| Title: | Scoring Tools for Urology and Pelvic Health Research Instruments |
|---|---|
| Description: | Scores standardized patient-reported instruments used in urology and pelvic health research, including the International Prostate Symptom Score (Barry et al., 1992), the Overactive Bladder Symptom Score (Homma et al., 2006) <doi:10.1016/j.urology.2006.02.042>, the O'Leary-Sant interstitial cystitis indices, the short forms of the Urogenital Distress Inventory and the Incontinence Impact Questionnaire (Uebersax et al., 1995) <doi:10.1002/nau.1930140206>, the Sandvik incontinence severity index, and the Benign Prostatic Hyperplasia Impact Index. Instruments are declarative definitions read by a single scoring engine. Responses are checked against the permitted value set of each item, missing items follow the published rule for the instrument or return NA when none was published, severity bands are assigned by membership, and published minimal important difference statistics are included for responder analyses. |
| Authors: | Muhammad Faiz Amirullah Nurhadi [aut, cre] |
| Maintainer: | Muhammad Faiz Amirullah Nurhadi <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-10-11 15:11:43 UTC |
| Source: | https://github.com/faizamirullah/uroscores |
Computes every total the instrument can produce from valid item responses under its registered missing-item rule. For sum and mean-scaled instruments with a published prorating rule, the prorated totals are included (UDI-6/IIQ-7 totals are fractions when items are missing). For product instruments the set is the products of the item values.
achievable_totals(instrument)achievable_totals(instrument)
instrument |
A |
classify_severity() and responder() check scores against this set,
which catches hand-entered typos and totals computed elsewhere under a
different convention.
A sorted numeric vector of achievable totals.
achievable_totals("isi")achievable_totals("isi")
Converts numeric total scores into an ordered factor using the severity
bands declared in the instrument's registry definition. Classification is
by explicit band membership, not by cut points: published bands are not
always contiguous (e.g. the Sandvik severity index bands 3-6 and 8-9), and
a value falling between bands gets NA with a warning rather than an
invented label.
classify_severity(x, instrument)classify_severity(x, instrument)
x |
Numeric vector of total scores. |
instrument |
A |
An ordered factor with the instrument's severity labels. Scores
outside the instrument's score range, not achievable from the
instrument's items (see achievable_totals()), or falling between
published bands become NA with a warning.
classify_severity(c(5, 12, 24), "ipss")classify_severity(c(5, 12, 24), "ipss")
Retrieve an instrument definition by id
get_instrument(id)get_instrument(id)
id |
Instrument identifier, e.g. |
A uro_instrument object.
List registered instruments
list_instruments()list_instruments()
A data.frame with one row per registered instrument.
list_instruments()list_instruments()
Returns published statistics that researchers commonly use to justify
minimal-important-difference thresholds, one row per estimate, with the
anchor, subgroup, and citation carried on every row. These are
descriptive, published values, not canonical MIDs: the source itself
(Barry 1995) emphasises that any threshold choice is arbitrary and that
perceptible change depends strongly on the baseline score. Choosing among
them, or against them, is the analyst's decision; responder() therefore
requires an explicit threshold.
mid_estimates(instrument = NULL)mid_estimates(instrument = NULL)
instrument |
Optional: a |
All Barry 1995 rows come from a trial that used the 1-week recall version of the AUA symptom index and BPH impact index in men with BPH; check transferability before applying them elsewhere.
value is a signed score change; negative means a score decrease, which
is improvement on all built-in instruments.
A data.frame with columns instrument, statistic, value,
anchor, subgroup, note, reference.
mid_estimates("ipss")[, c("statistic", "value", "subgroup")]mid_estimates("ipss")[, c("statistic", "value", "subgroup")]
Instruments carrying this rule are scored strictly: any missing item makes
the score NA. Requests to prorate such instruments are refused, because
inventing an unpublished prorated-scoring rule would codify exactly the kind
of ad hoc practice this package exists to prevent.
missing_rule_none()missing_rule_none()
An object of class uro_missing_rule.
Declare a published prorated-scoring rule for missing items
missing_rule_prorate(max_missing = NA_integer_, reference = NA_character_)missing_rule_prorate(max_missing = NA_integer_, reference = NA_character_)
max_missing |
Maximum number of missing items tolerated before the
score is |
reference |
Citation for the publication that states the rule. |
An object of class uro_missing_rule.
Adds a user-supplied uro_instrument() definition to the session registry,
making it available to score_instrument() by its id. Registering an
existing id overwrites it with a message.
register_instrument(definition)register_instrument(definition)
definition |
A |
The definition, invisibly.
Computes followup - baseline and classifies each pair as responder or
not against a threshold the analyst chooses. There is no default
threshold on purpose: no canonical MID exists, and the published
estimates depend on anchor, method, population, and baseline severity
(see mid_estimates(), and consider baseline-stratified thresholds).
responder( baseline, followup, instrument, threshold, direction = c("decrease", "increase") )responder( baseline, followup, instrument, threshold, direction = c("decrease", "increase") )
baseline, followup
|
Numeric vectors of total scores. |
instrument |
A |
threshold |
Single positive number: the magnitude of change that counts as response. |
direction |
|
A logical vector: TRUE responder, FALSE not, NA when either
score is missing, out of range, or not an achievable total (see
achievable_totals()).
responder(baseline = c(20, 12), followup = c(14, 11), "ipss", threshold = 3)responder(baseline = c(20, 12), followup = c(14, 11), "ipss", threshold = 3)
Score an instrument from a data frame of item responses
score_instrument( data, instrument, items = NULL, missing = c("registry", "strict", "prorate"), keep_items = FALSE )score_instrument( data, instrument, items = NULL, missing = c("registry", "strict", "prorate"), keep_items = FALSE )
data |
A |
instrument |
A |
items |
Optional character vector of column names holding the item responses, in instrument item order. Defaults to the instrument's default item names. |
missing |
Missing-item policy:
|
keep_items |
If |
A data.frame with one row per row of data, containing
<id>_total, one <id>_<subscale> column per subscale, and
<id>_n_missing. Subscale scores are always computed strictly in this
version (any missing subscale item gives NA for that subscale).
d <- data.frame(oabss_q1 = c(1, 2), oabss_q2 = c(2, 3), oabss_q3 = c(3, 5), oabss_q4 = c(2, 5)) score_instrument(d, "oabss")d <- data.frame(oabss_q1 = c(1, 2), oabss_q2 = c(2, 3), oabss_q3 = c(3, 5), oabss_q4 = c(2, 5)) score_instrument(d, "oabss")
Convenience wrapper around score_instrument() for the IPSS. Returns the
7-item symptom total, the voiding and storage subscores, and optionally the
separate quality-of-life item and a severity classification.
score_ipss( data, items = paste0("ipss_q", 1:7), qol = NULL, classify = FALSE, missing = c("registry", "strict", "prorate"), keep_items = FALSE )score_ipss( data, items = paste0("ipss_q", 1:7), qol = NULL, classify = FALSE, missing = c("registry", "strict", "prorate"), keep_items = FALSE )
data |
A |
items |
Character vector of the 7 symptom item columns, in
questionnaire order. Defaults to |
qol |
Optional name of the quality-of-life item column. |
classify |
If |
missing |
Missing-item policy:
|
keep_items |
If |
The QoL item is not part of the symptom total; it is validated (0-6) and
passed through as ipss_qol.
A data.frame of scores; see score_instrument().
d <- data.frame( ipss_q1 = c(1, 3), ipss_q2 = c(2, 4), ipss_q3 = c(3, 5), ipss_q4 = c(0, 2), ipss_q5 = c(4, 5), ipss_q6 = c(5, 3), ipss_q7 = c(2, 4), qol = c(3, 5) ) score_ipss(d, qol = "qol", classify = TRUE)d <- data.frame( ipss_q1 = c(1, 3), ipss_q2 = c(2, 4), ipss_q3 = c(3, 5), ipss_q4 = c(0, 2), ipss_q5 = c(4, 5), ipss_q6 = c(5, 3), ipss_q7 = c(2, 4), qol = c(3, 5) ) score_ipss(d, qol = "qol", classify = TRUE)
Constructs the declarative definition of a clinical instrument. All
clinical content (item ranges, scoring rule, severity cutoffs, missing-item
policy) lives here, as data; score_instrument() is a generic engine that
consumes it.
uro_instrument( id, full_name, items, item_min = NULL, item_max = NULL, item_values = NULL, scoring = c("sum", "mean_scaled", "product"), scale_max = NULL, subscales = NULL, severity = NULL, missing_rule = missing_rule_none(), references = character(), validated = FALSE )uro_instrument( id, full_name, items, item_min = NULL, item_max = NULL, item_values = NULL, scoring = c("sum", "mean_scaled", "product"), scale_max = NULL, subscales = NULL, severity = NULL, missing_rule = missing_rule_none(), references = character(), validated = FALSE )
id |
Short lowercase identifier, e.g. |
full_name |
Human-readable instrument name. |
items |
Character vector of default item column names. |
item_min, item_max
|
Integer vectors (recycled across items) giving the
permitted response range of each item. Ignored when |
item_values |
Optional list with one numeric vector per item giving the exact permitted response values. Use this when an item's values are not contiguous (e.g. the ICSI bladder-pain item permits 0, 2, 3, 4, 5 but not 1). |
scoring |
|
scale_max |
Upper bound of the rescaled score when
|
subscales |
Named list of integer index vectors into |
severity |
|
missing_rule |
A rule created by |
references |
Character vector of primary source citations. |
validated |
Logical. Set |
An object of class uro_instrument.
vas <- uro_instrument( id = "vas10", full_name = "Single-item 0-10 rating", items = "vas10", item_min = 0L, item_max = 10L, references = "add the primary source before use" ) vas suppressWarnings(score_instrument(data.frame(vas10 = 7), vas))vas <- uro_instrument( id = "vas10", full_name = "Single-item 0-10 rating", items = "vas10", item_min = 0L, item_max = 10L, references = "add the primary source before use" ) vas suppressWarnings(score_instrument(data.frame(vas10 = 7), vas))