| MSprog | R Documentation |
Detect and characterise confirmed disability worsening (CDW) or improvement (CDI) events of an outcome measure (EDSS, NHPT, T25FW, or SDMT; or any custom outcome) based on repeated assessments through time (and on the dates of acute episodes, if any). The events are detected sequentially by scanning the outcome values in chronological order. Several qualitative and quantitative options are given as arguments that can be set by the user and reported as a complement to the results to ensure reproducibility.
MSprog(
data,
subj_col,
value_col,
date_col,
outcome,
relapse = NULL,
rsubj_col = NULL,
rdate_col = NULL,
renddate_col = NULL,
subjects = NULL,
delta_fun = NULL,
worsening = NULL,
event = c("firstCDW", "firstCDI", "multiple", "firstPIRA", "firstRAW", "first"),
RAW_PIRA = FALSE,
baseline = c("fixed", "roving", "roving_impr", "roving_wors"),
proceed_from = c("firstconf", "event"),
sub_threshold_rebl = c("none", "change", "improvement", "worsening"),
bl_geq = FALSE,
relapse_rebl = FALSE,
skip_local_extrema = c("none", "strict", "all"),
validconf_col = NULL,
conf_days = 12 * 7,
conf_tol_days = c(7, 2 * 365.25),
require_sust_days = 0,
check_intermediate = TRUE,
relapse_to_bl = 30,
relapse_to_event = 0,
relapse_to_conf = 30,
relapse_assoc = 90,
relapse_indep = NULL,
impute_last_visit = 0,
date_format = NULL,
include_dates = FALSE,
include_values = FALSE,
include_stable = TRUE,
verbose = 1
)
data |
Data frame containing longitudinal data, including: subject IDs, outcome values, visit dates. |
subj_col |
Name of data column with subject IDs. |
value_col |
Name of data column with outcome values. |
date_col |
Name of data column with visit dates. |
outcome |
Specifies the outcome type. Must be one of the following:
When it's not set to |
relapse |
Optional data frame containing longitudinal data, including subject IDs and relapse onset dates. |
rsubj_col |
Name of subject ID column in the |
rdate_col |
Name of relapse onset date column in the |
renddate_col |
Name of relapse end date column in the |
subjects |
Subset of subjects (a vector or list of IDs). If none is specified, all subjects listed in |
delta_fun |
Custom function specifying the minimum clinically meaningful
change in the outcome measure from the provided reference value.
The function provided must take a numeric value (reference score) as input,
and return a numeric value corresponding to the minimum shift from baseline, see example below.
If |
worsening |
The direction of worsening ( The given value is only used when |
event |
Character string specifying which events to detect. Must be one of the following.
|
RAW_PIRA |
If |
baseline |
Specifies the baseline scheme. Must be one of the following.
|
proceed_from |
After detecting a confirmed disability event, continue searching:
If
|
sub_threshold_rebl |
This argument is only used if
See |
bl_geq |
This argument is only used if relapse-based re-baseline is enabled ( |
relapse_rebl |
If |
skip_local_extrema |
This argument is only used if the baseline is moved. It controls re-baseline behaviour in the presence of local minima or maxima. A visit
Local maxima are defined similarly. A visit
Strict local maxima are defined similarly. When
|
validconf_col |
Name of data column, if any, specifying which visits can
( |
conf_days |
Period before confirmation (days). Can be a single value, or
vector of any length if considering multiple windows.
If |
conf_tol_days |
Tolerance window for confirmation visit (days).
Can be an integer (equal lower and upper tolerance)
or vector of length 2 (different lower and upper tolerance).
The right end of the interval (upper tolerance) may be set to |
require_sust_days |
Minimum number of days over which a confirmed change must be sustained
(i.e., confirmed at all visits occurring in the specified period) to be retained as an event.
Events sustained for the remainder of the follow-up period are always retained regardless of follow-up duration.
If (Warning: if |
check_intermediate |
If If set to |
relapse_to_bl |
Minimum distance (days) from the onset of a relapse for a visit to be used as baseline. Can be an integer (minimum distance from last relapse onset) or vector of length 2 (minimum distance from last relapse onset, minimum distance from next relapse onset). Note that setting the distance to zero means keeping the baseline where it is regardless of surrounding relapses. If relapse end dates are available ( If the designated baseline does not satisfy this constraint, the baseline is moved to the next available visit. |
relapse_to_event |
Minimum distance (days) from the onset of a relapse for an event to be considered as such. Can be an integer (minimum distance from last relapse onset) or vector of length 2 (minimum distance from last relapse onset, minimum distance from next relapse onset). Note that setting the distance to zero means retaining the event regardless of surrounding relapses. If relapse end dates are available ( |
relapse_to_conf |
Minimum distance (days) from the onset of a relapse for a visit to be an eligible confirmation visit. Can be an integer (minimum distance from last relapse onset) or vector of length 2 (minimum distance from last relapse onset, minimum distance from next relapse onset). Note that setting the distance to zero means using any visit for confirmation regardless of surrounding relapses. If relapse end dates are available ( |
relapse_assoc |
Maximum distance (days) from the onset of a relapse for a CDW event to be classified as RAW.
Can be an integer (maximum distance from last relapse onset) or vector of length 2
(maximum distance from last relapse onset, maximum distance from next relapse onset).
If relapse end dates are available ( |
relapse_indep |
Specifies relapse-free intervals for PIRA definition.
Must be a named list
The auxiliary function |
impute_last_visit |
Imputation probability for worsening events occurring
at the last available visit (i.e., with no confirmation).
Unconfirmed worsening events occurring at the last visit are never imputed if |
date_format |
Format of dates in the
If not specified, function |
include_dates |
If
|
include_values |
If
|
include_stable |
If |
verbose |
One of:
|
An object of class MSprogOutput with the following attributes:
event_count: a data frame containing event counts for each subject
(and the event sequence in case of multiple events).
results: a data frame with extended info on each event for all subjects.
settings: a list containing all the arguments used to compute the output.
unconfirmed: a data frame with info on unconfirmed events (initial change from baseline, but no confirmation)
for all subjects.
For a detailed description of output data frames, see ?MSprogOutput.
[1] Müller J, Cagol A, Lorscheider J, Tsagkas C, Benkert P, Yaldizli Ö, et al.
Harmonizing definitions for progression independent of relapse activity in multiple sclerosis: A systematic review.
JAMA Neurol. 2023;80:1232–45.
[2] Kappos L, Wolinsky JS, Giovannoni G, Arnold DL, Wang Q, Bernasconi C, et al.
Contribution of relapse-independent progression vs relapse-associated worsening to overall confirmed disability
accumulation in typical relapsing multiple sclerosis in a pooled analysis of 2 randomized clinical trials.
JAMA Neurol. 2020;77:1132–40.
# 1. EDSS course
output <- MSprog(toydata_visits, subj_col="id", value_col="EDSS", date_col="date", outcome="edss",
relapse=toydata_relapses, conf_days=12*7, conf_tol_days=30,
event="multiple", baseline="roving", verbose=1)
print(output$results) # extended info on each event for all subjects
print(output$event_count) # event counts for each subject
# 2. SDMT course
output <- MSprog(toydata_visits, subj_col="id", value_col="SDMT", date_col="date", outcome="sdmt",
relapse=toydata_relapses, conf_days=12*7, conf_tol_days=30,
event="multiple", baseline="roving", verbose=1)
print(output$results) # extended info on each event for all subjects
print(output$event_count) # event counts for each subject
# 3. SDMT course, with a custom delta function
my_sdmt_delta <- function(reference_value) {min(c(reference_value/10, 3))}
output <- MSprog(toydata_visits, subj_col="id", value_col="SDMT", date_col="date", outcome="sdmt",
delta_fun=my_sdmt_delta,
relapse=toydata_relapses, conf_days=12*7, conf_tol_days=30,
event="multiple", baseline="roving", verbose=1)
print(output$results) # extended info on each event for all subjects
print(output$event_count) # event counts for each subject
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.