Title: | Drug EXPosures and ADRs |
---|---|
Description: | An R package for fitting complex drug exposure and adverse drug reaction (ADR) relationships |
Authors: | Louis Dijkstra |
Maintainer: | Louis Dijkstra <[email protected]> |
License: | GPL-3 |
Version: | 1.0.0 |
Built: | 2025-01-04 05:56:51 UTC |
Source: | https://github.com/bips-hb/expard |
Observations might not be present for certain patients, since they entered the data set later time = 1 or before the end. This function applies, for example, a risk model only to the observed time points.
apply_function_to_observed_timepoints( drug_history, fn = expard::risk_model_current_use() )
apply_function_to_observed_timepoints( drug_history, fn = expard::risk_model_current_use() )
drug_history |
The drug history. Unobserved time points are denoted by
|
fn |
A function (Default |
Vector of the same length as drug_history
. None observed time points
are denoted by NA
TableCreates a contingency table for a
drug and ADR.
A table is structured in the following form:
ADR | not ADR | |
drug | a |
c
|
not drug | b |
d
|
create2x2table(drug_ADR_pair, method = c("time-point", "drug-era", "patient"))
create2x2table(drug_ADR_pair, method = c("time-point", "drug-era", "patient"))
drug_ADR_pair |
A drug-ADR pair; see |
method |
Method used to construct the table; either
|
A cont_table
object; a list with
a , b , c , d
|
The counts in the table |
method |
Method that was used to construct the table |
n |
Total count ( |
The counts can be constructed in three different ways. See for two of them Zorych et al. (2013).
time-point
)Each time-point is counted separately. The counts are the number of time points that
a
- the drug was prescribed and the ADR occurred
b
- the drug was not prescribed but the ADR occurred
c
- the drug was prescribed but the ADR did not occur
d
- the drug was not prescribed and the ADR did not occur
Note that in this case the total count n = a + b + c + d
is
the same as the total number of time points observed, i.e., the total
number of patients times the number of time points observed:
n_patients * simulation_time
.
patient
)In this case, individual patients are counted. The counts are the number of patients that
a
- were prescribed the drug and did experience the ADR
b
- were never prescribed the drug and did experience the ADR
c
- were prescribed the drug and never experienced the ADR
d
- were never prescribed the drug and never experienced the ADR
In this case, the total count n = a + b + c +d
is the same as
the number of patients, n_patients
.
drug-era
)In this case we look at drug-eras, i.e., periods in which the patients was prescribed or not prescribed the drug for a longer time. For example, if the patient was prescribed the drug from time point 3 to 6, then that period is called a drug-era. The counts are the number of drug- and non-drug eras in which
a
- the drug was prescribed and the ADR occurred
b
- the drug was not prescribed but the ADR occurred
c
- the drug was prescribed but the ADR did not occur
d
- the drug was not prescribed and the ADR did not occur
In this case, the total count n
is the total number of drug- and
non-drug eras.
Zorych, I., Madigan, D., Ryan, P., & Bate, A. (2013). Disproportionality methods for pharmacovigilance in longitudinal observational databases. Statistical Methods in Medical Research, 22(1), 39–56. https://doi.org/10.1177/0962280211403602
set.seed(1) cohort <- generate_cohort(n_patients = 200) # create the 2x2 contingency table per time-point, # drug-era and patient: create2x2table(cohort, method = "time-point") create2x2table(cohort, method = "drug-era") create2x2table(cohort, method = "patient")
set.seed(1) cohort <- generate_cohort(n_patients = 200) # create the 2x2 contingency table per time-point, # drug-era and patient: create2x2table(cohort, method = "time-point") create2x2table(cohort, method = "drug-era") create2x2table(cohort, method = "patient")
TablesCreates the contingency tables for all
drug-ADR pairs in a specific cohort. The function is basically
a wrapper for
create2x2table
create2x2tables( cohort, method = c("time-point", "drug-era", "patient"), verbose = TRUE )
create2x2tables( cohort, method = c("time-point", "drug-era", "patient"), verbose = TRUE )
cohort |
A cohort; see |
method |
Method used to construct the table; either
|
A table is structured in the following form:
ADR | not ADR | |
drug | a |
c
|
not drug | b |
d
|
A list of cont_table
objects
The counts can be constructed in three different ways. See for two of them Zorych et al. (2013).
time-point
)Each time-point is counted separately. The counts are the number of time points that
a
- the drug was prescribed and the ADR occurred
b
- the drug was not prescribed but the ADR occurred
c
- the drug was prescribed but the ADR did not occur
d
- the drug was not prescribed and the ADR did not occur
Note that in this case the total count n = a + b + c + d
is
the same as the total number of time points observed, i.e., the total
number of patients times the number of time points observed:
n_patients * simulation_time
.
patient
)In this case, individual patients are counted. The counts are the number of patients that
a
- were prescribed the drug and did experience the ADR
b
- were never prescribed the drug and did experience the ADR
c
- were prescribed the drug and never experienced the ADR
d
- were never prescribed the drug and never experienced the ADR
In this case, the total count n = a + b + c +d
is the same as
the number of patients, n_patients
.
drug-era
)In this case we look at drug-eras, i.e., periods in which the patients was prescribed or not prescribed the drug for a longer time. For example, if the patient was prescribed the drug from time point 3 to 6, then that period is called a drug-era. The counts are the number of drug- and non-drug eras in which
a
- the drug was prescribed and the ADR occurred
b
- the drug was not prescribed but the ADR occurred
c
- the drug was prescribed but the ADR did not occur
d
- the drug was not prescribed and the ADR did not occur
In this case, the total count n
is the total number of drug- and
non-drug eras.
Zorych, I., Madigan, D., Ryan, P., & Bate, A. (2013). Disproportionality methods for pharmacovigilance in longitudinal observational databases. Statistical Methods in Medical Research, 22(1), 39–56. https://doi.org/10.1177/0962280211403602
set.seed(1) cohort <- generate_cohort(n_patients = 200) # create the 2x2 contingency table per time-point, # drug-era and patient: create2x2table(cohort, method = "time-point") create2x2table(cohort, method = "drug-era") create2x2table(cohort, method = "patient")
set.seed(1) cohort <- generate_cohort(n_patients = 200) # create the 2x2 contingency table per time-point, # drug-era and patient: create2x2table(cohort, method = "time-point") create2x2table(cohort, method = "drug-era") create2x2table(cohort, method = "patient")
determine_first_perscription
returns a time point
for the first prescription of the drug of interest
given the time frame of the patient (simulation_time
)
and the chance for it be prescribed is min_chance_drug
.
The patient, in this case, is always prescribed the drug at least
once. The time point follows a distribution.
determine_first_prescription(n_patients, simulation_time, min_chance_drug)
determine_first_prescription(n_patients, simulation_time, min_chance_drug)
n_patients |
Number of patients (Default: 1) |
simulation_time |
The total number of time points for this patient |
min_chance_drug |
The probability of the drug being prescribed at any given time point |
Note: we assume here that the probability of the drug being prescribed does not depend on any previous prescriptions.
A time point between 1
and simulation_time
set.seed(1) determine_first_prescription(n_patients = 4, simulation_time = 10, min_chance_drug = 0.1) # -> [1] 2 3 5 9
set.seed(1) determine_first_prescription(n_patients = 4, simulation_time = 10, min_chance_drug = 0.1) # -> [1] 2 3 5 9
Determine how often different values from time_steps_ago appear in the data set and how often the ADR occurs for each of them. This is used for speeding up the computation of the loglikeihood
determine_frequency_unique_values(mat, adr_history)
determine_frequency_unique_values(mat, adr_history)
mat |
Matrix with relevant values (depends on model) |
adr_history |
History of ADRs |
Tibble
expard
: A package for simulating electronic
health care data and fitting modelsLouis Dijkstra
fit_model
fits a specified risk model risk_model
to cohort data.
fit_model( pair, model = c("no-association", "current-use", "past-use", "withdrawal", "delayed", "decaying", "delayed+decaying", "long-term"), zero_patients = 0, zero_timepoints = 0, method = c("L-BFGS-B", "Nelder-Mead", "BFGS", "CG", "SANN", "Brent"), maxiter = 1000, parameters = list(), mc.cores = 1 )
fit_model( pair, model = c("no-association", "current-use", "past-use", "withdrawal", "delayed", "decaying", "delayed+decaying", "long-term"), zero_patients = 0, zero_timepoints = 0, method = c("L-BFGS-B", "Nelder-Mead", "BFGS", "CG", "SANN", "Brent"), maxiter = 1000, parameters = list(), mc.cores = 1 )
model |
Label for a risk model. Can be either ... |
method |
Methods used by the base |
maxiter |
Maximum number iterations for the |
cohort |
A cohort dataset. See details below. |
start |
Starting point for the base |
control |
List used by the base |
A model fit. A list with the items
n_patients |
Total number of patients in the dataset |
simulation_time |
Total number of time points |
loglikelihood |
The maximal log-likelihood value |
beta0 |
Intercept for the logistic model |
beta |
Parameter for the logistic model |
prob_no_adr_with_drug |
Estimated probability of no ADR occurring |
prob_ADR_with_drug |
Estimated probability of ADR occurring |
convergence |
Convergence value of |
fit_model
can currently only deal with the
patient_model_uninformative
. More complex
patient models, such as patient_model_sex
require the estimation of more parameters which is currently
not supported.
Minimal requirement is that the cohort is a list with two matrix with the items
drug_history
A binary matrix of size
n_patients x simulation_time
describing
the drug prescriptions.
adr_history
A binary matrix of size
n_patients x simulation_time
describing
ADR histories
See check_cohort
and generate_cohort
for more details on the cohort
object.
check_cohort
,generate_cohort
cohort <- expard::generate_cohort(n_patients = 1000, simulation_time = 100, risk_model = expard::risk_model_immediate(), verbose = TRUE, min_chance_drug = probability_model_constant(.3), max_chance_drug = probability_model_constant(.7), min_chance_adr = probability_model_constant(.3), max_chance_adr = probability_model_constant(.6)) # fit the no effect model fit_model(cohort, risk_model = expard::risk_model_no_effect()) # fit the true immediate effect model fit_model(cohort, risk_model = expard::risk_model_immediate()) # note that the estimators are close to the truth (.3 and .6)
cohort <- expard::generate_cohort(n_patients = 1000, simulation_time = 100, risk_model = expard::risk_model_immediate(), verbose = TRUE, min_chance_drug = probability_model_constant(.3), max_chance_drug = probability_model_constant(.7), min_chance_adr = probability_model_constant(.3), max_chance_adr = probability_model_constant(.6)) # fit the no effect model fit_model(cohort, risk_model = expard::risk_model_no_effect()) # fit the true immediate effect model fit_model(cohort, risk_model = expard::risk_model_immediate()) # note that the estimators are close to the truth (.3 and .6)
Generates a binary vector of ADR occurrences given a drug history and a risk model.
generate_adr_history(drug_history, risk_model, min_chance, max_chance, ...)
generate_adr_history(drug_history, risk_model, min_chance, max_chance, ...)
drug_history |
Binary vector denoting the drug prescriptions history |
risk_model |
A risk model, e.g., |
min_chance |
The probability of the ADR when the drug history has no effect |
max_chance |
The probability of the ADR when the drug history has the highest possible effect |
Binary vector of the same length as drug_history
Generates a cohort which is a collection of drug-ADR pair.
It is a wrapper function for the generate_patient
function.
generate_cohort( n_patients = 100, simulation_time = 100, n_drug_ADR_pairs = 50, risk_model = rep("risk_model_current_use()", n_drug_ADR_pairs), min_chance_drug = rep(0.1, n_drug_ADR_pairs), avg_duration = rep(5, n_drug_ADR_pairs), max_chance_drug = rep(NULL, n_drug_ADR_pairs), prob_guaranteed_exposed = rep(1, n_drug_ADR_pairs), min_chance = rep(0.1, n_drug_ADR_pairs), max_chance = rep(0.4, n_drug_ADR_pairs), verbose = FALSE )
generate_cohort( n_patients = 100, simulation_time = 100, n_drug_ADR_pairs = 50, risk_model = rep("risk_model_current_use()", n_drug_ADR_pairs), min_chance_drug = rep(0.1, n_drug_ADR_pairs), avg_duration = rep(5, n_drug_ADR_pairs), max_chance_drug = rep(NULL, n_drug_ADR_pairs), prob_guaranteed_exposed = rep(1, n_drug_ADR_pairs), min_chance = rep(0.1, n_drug_ADR_pairs), max_chance = rep(0.4, n_drug_ADR_pairs), verbose = FALSE )
n_patients |
Number of patients |
simulation_time |
The total number of time steps |
n_drug_ADR_pairs |
Number of drug-ADR pairs simulated |
risk_model |
Vector with risk models. Each risk model is given as
a string, e.g., |
min_chance_drug |
Vector with the probabilities of the drug being prescribed
when the drug history and the ADR history have no effect.
Must have a length of |
avg_duration |
Average number of time points a patient is exposed
once exposed to the drug (Determines |
max_chance_drug |
The probability of the ADR when
the drug history and the ADR history have the highest
possible effect (Default: |
min_chance |
The probability of the ADR when
the drug history has no effect
Must have a length of |
max_chance |
The probability of the ADR when
the drug history has the highest possible effect
Must have a length of |
verbose |
Show progress bar (Default: |
A cohort
object; A list of length n_drug_ADR_pairs
.
Each entry contains two binary matrices; one for the drug histories
of all patients and one for the ADR histories of all patients. Each
row is a patient
Generates the drug- and ADR history
generate_drug_ADR_pair( simulation_time = 100, risk_model = risk_model_current_use(), min_chance_drug = 0.1, avg_duration = 5, max_chance_drug = NULL, guaranteed_exposed = TRUE, min_chance = 0.1, max_chance = 0.4 )
generate_drug_ADR_pair( simulation_time = 100, risk_model = risk_model_current_use(), min_chance_drug = 0.1, avg_duration = 5, max_chance_drug = NULL, guaranteed_exposed = TRUE, min_chance = 0.1, max_chance = 0.4 )
simulation_time |
The total number of time steps |
risk_model |
One of the risk models |
min_chance_drug |
The probability of the drug being prescribed when the drug history and the ADR history have no effect |
avg_duration |
Average number of time points a patient is exposed
once exposed to the drug (Determines |
max_chance_drug |
The probability of the ADR when
the drug history and the ADR history have the highest
possible effect (Default: |
guaranteed_exposed |
If |
min_chance |
The probability of the ADR when the drug history has no effect |
max_chance |
The probability of the ADR when the drug history has the highest possible effect |
A list with
drug_history |
binary vector of the drug history |
adr_history |
binary vector of the ADR history |
drug_ADR_pair <- expard::generate_drug_ADR_pair()
drug_ADR_pair <- expard::generate_drug_ADR_pair()
Returns whether or not the drug is prescribed
at the next time point (1
) or not (0
).
The probability depends on the drug prescriptions,
the ADR history and the drug_model
.
generate_drug_history( simulation_time = 10, min_chance, avg_duration = 5, max_chance = NULL, guaranteed_exposed = TRUE, ... )
generate_drug_history( simulation_time = 10, min_chance, avg_duration = 5, max_chance = NULL, guaranteed_exposed = TRUE, ... )
simulation_time |
Total number of time points |
min_chance |
The probability of the drug being prescribed when the drug history and the ADR history have no effect |
avg_duration |
Average number of time points a patient is exposed
once exposed to the drug (Determines |
max_chance |
The probability of the ADR when
the drug history and the ADR history have the highest
possible effect (Default: |
guaranteed_exposed |
If |
1
or 0
generate_drug_history(simulation_time = 10, min_chance = .1, avg_duration = 5 guaranteed_exposed = TRUE)
generate_drug_history(simulation_time = 10, min_chance = .1, avg_duration = 5 guaranteed_exposed = TRUE)
Generates a patient, which is a collection of different
drug-ADR pairs, see function generate_drug_ADR_pair
.
generate_patient( simulation_time = 100, n_drug_ADR_pairs = 50, risk_model = rep("risk_model_current_use()", n_drug_ADR_pairs), min_chance_drug = rep(0.1, n_drug_ADR_pairs), avg_duration = rep(5, n_drug_ADR_pairs), max_chance_drug = rep(NULL, n_drug_ADR_pairs), guaranteed_exposed = rep(TRUE, n_drug_ADR_pairs), min_chance = rep(0.1, n_drug_ADR_pairs), max_chance = rep(0.4, n_drug_ADR_pairs) )
generate_patient( simulation_time = 100, n_drug_ADR_pairs = 50, risk_model = rep("risk_model_current_use()", n_drug_ADR_pairs), min_chance_drug = rep(0.1, n_drug_ADR_pairs), avg_duration = rep(5, n_drug_ADR_pairs), max_chance_drug = rep(NULL, n_drug_ADR_pairs), guaranteed_exposed = rep(TRUE, n_drug_ADR_pairs), min_chance = rep(0.1, n_drug_ADR_pairs), max_chance = rep(0.4, n_drug_ADR_pairs) )
simulation_time |
The total number of time steps |
n_drug_ADR_pairs |
Number of drug-ADR pairs simulated |
risk_model |
Vector with risk models. Each risk model is given as
a string, e.g., |
min_chance_drug |
Vector with the probabilities of the drug being prescribed
when the drug history and the ADR history have no effect.
Must have a length of |
avg_duration |
Average number of time points a patient is exposed
once exposed to the drug (Determines |
max_chance_drug |
The probability of the ADR when
the drug history and the ADR history have the highest
possible effect (Default: |
guaranteed_exposed |
If |
min_chance |
The probability of the ADR when
the drug history has no effect
Must have a length of |
max_chance |
The probability of the ADR when
the drug history has the highest possible effect
Must have a length of |
A list of drug-ADR pairs, see generate_drug_ADR_pair
generate_cohort
, generate_drug_ADR_pair
, generate_drug_history
loglikelihood
returns the negative
log-likelihood function, defined as
where is the probability.
loglikelihood(betas, risks, adr_history)
loglikelihood(betas, risks, adr_history)
betas |
Vector with two entries: |
risks |
Risks determined by the risk model. The risk model was applied to the observed drug prescription history |
Plots the BIC for the different risk models that were fitted by the
function fit_all_models
.
plot_fit( fit, x_label = "model", title = "", y_range = NULL, past_values = NULL )
plot_fit( fit, x_label = "model", title = "", y_range = NULL, past_values = NULL )
fit |
The fit |
past_values |
If not |
xlab |
The x-label |
ggplot
Plots the risk function's behavior for
a given drug prescription history.
The -axis denote the
drug prescriptions and the
-axis represent the
risk level, i.e.,
1
is maximal risk, 0
minimal risk.
plot_risk( drug_history = c(rep(0, 4), rep(1, 6), rep(0, 10)), risk_model = risk_model_immediate(), simulation_time = NULL, title = "", ylim = c(0, 1), shaded_area = TRUE, fill = "black", alpha = 0.3 )
plot_risk( drug_history = c(rep(0, 4), rep(1, 6), rep(0, 10)), risk_model = risk_model_immediate(), simulation_time = NULL, title = "", ylim = c(0, 1), shaded_area = TRUE, fill = "black", alpha = 0.3 )
drug_history |
Binary vector denoting the
drug prescription history.
(Default: |
risk_model |
One of the risk models |
simulation_time |
If not |
title |
Title of the plot |
ylim |
The limits of the y-axis: |
shaded_area |
If |
fill |
Color used for the shaded area (Default: |
alpha |
Alpha value for shaded area (Default: |
A ggplot2
plot
drug_history <- c(rep(0, 4), rep(1, 6), rep(0, 10)) risk_model <- risk_model_immediate() # create the plot p <- plot_risk(drug_history, risk_model, title = "Direct effect model") p
drug_history <- c(rep(0, 4), rep(1, 6), rep(0, 10)) risk_model <- risk_model_immediate() # create the plot p <- plot_risk(drug_history, risk_model, title = "Direct effect model") p
generate_cohort
Print function for generate_cohort
## S3 method for class 'cohort' print(cohort)
## S3 method for class 'cohort' print(cohort)
Print function for 2x2 tables
## S3 method for class 'cont_table' print(table)
## S3 method for class 'cont_table' print(table)
Function for printing a drug-ADR pair
## S3 method for class 'drug_ADR_pair' print(drug_ADR_pair)
## S3 method for class 'drug_ADR_pair' print(drug_ADR_pair)
Print function for the hccd fit_model
## S3 method for class 'expardfit2' print(fit)
## S3 method for class 'expardfit2' print(fit)
Function for printing a patient
## S3 method for class 'patient' print(patient)
## S3 method for class 'patient' print(patient)
A risk model reflects how the probability of
suffering the ADR changes with the drug exposures
of a patient. It returns 0
when the drug
prescription history has no effect, and 1
when the patient is at maximal risk.
In this case, the probability of the ADR
is maximal only when the patient is currently
exposed.
risk_model_current_use()
risk_model_current_use()
A risk model
Other Risk models:
risk_model_decaying()
,
risk_model_delayed()
,
risk_model_duration()
,
risk_model_long_term()
,
risk_model_no_association()
,
risk_model_past()
,
risk_model_withdrawal()
drug_history <- c(1, 0, 1, 0, 0) risk_model <- risk_model_immediate() risk_model(drug_history)
drug_history <- c(1, 0, 1, 0, 0) risk_model <- risk_model_immediate() risk_model(drug_history)
Risk Model 'Decaying'
risk_model_decaying(rate)
risk_model_decaying(rate)
rate |
The rate with which the risk dissipates |
A risk model
Other Risk models:
risk_model_current_use()
,
risk_model_delayed()
,
risk_model_duration()
,
risk_model_long_term()
,
risk_model_no_association()
,
risk_model_past()
,
risk_model_withdrawal()
drug_history <- c(1, 0, 1, 0, 0) risk_model <- risk_model_withdrawal(rate = 1.2) risk_model(drug_history)
drug_history <- c(1, 0, 1, 0, 0) risk_model <- risk_model_withdrawal(rate = 1.2) risk_model(drug_history)
Risk Model 'Delayed'
risk_model_delayed(mu, sigma)
risk_model_delayed(mu, sigma)
rate |
The rate with which the risk dissipates |
A risk model
Other Risk models:
risk_model_current_use()
,
risk_model_decaying()
,
risk_model_duration()
,
risk_model_long_term()
,
risk_model_no_association()
,
risk_model_past()
,
risk_model_withdrawal()
drug_history <- c(1, 0, 1, 0, 0) risk_model <- risk_model_withdrawal(rate = 1.2) risk_model(drug_history)
drug_history <- c(1, 0, 1, 0, 0) risk_model <- risk_model_withdrawal(rate = 1.2) risk_model(drug_history)
A risk model reflects how the probability of
suffering the ADR changes with the drug exposures
of a patient. It returns 0
when the drug
prescription history has no effect, and 1
when the patient is at maximal risk.
In this case, once the patient is no longer exposed
to the drug, the probability of the ADR peaks
and then dissipates exponentially.
Let be the number of time points since
the patient was prescribed the drug last. The return
value is the given by
where is
rate
.
risk_model_duration(duration)
risk_model_duration(duration)
rate |
The rate with which the risk dissipates |
A risk model
Other Risk models:
risk_model_current_use()
,
risk_model_decaying()
,
risk_model_delayed()
,
risk_model_long_term()
,
risk_model_no_association()
,
risk_model_past()
,
risk_model_withdrawal()
drug_history <- c(1, 0, 1, 0, 0) risk_model <- risk_model_withdrawal(rate = 1.2) risk_model(drug_history)
drug_history <- c(1, 0, 1, 0, 0) risk_model <- risk_model_withdrawal(rate = 1.2) risk_model(drug_history)
A risk model reflects how the probability of
suffering the ADR changes with the drug exposures
of a patient. It returns 0
when the drug
prescription history has no effect, and 1
when the patient is at maximal risk.
In this case, the risk of the ADR increases
only after a certain moment in time before it
reaches the maximal risk.
Let be the time point that the drug
was prescribed for the first time, and
be the number of time points since first description
that the function returns 0.5 ("half way"). The
return value is
where is
rate
. Note that this
is a sigmoid function.
risk_model_long_term(rate, delay)
risk_model_long_term(rate, delay)
rate |
The rate with which the risk increases |
delay |
How long it takes before the risk is .5 |
A risk model
Other Risk models:
risk_model_current_use()
,
risk_model_decaying()
,
risk_model_delayed()
,
risk_model_duration()
,
risk_model_no_association()
,
risk_model_past()
,
risk_model_withdrawal()
drug_history <- c(1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1) risk_model <- risk_model_long_time_after(rate = .5, delay = 9) risk_model(drug_history)
drug_history <- c(1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1) risk_model <- risk_model_long_time_after(rate = .5, delay = 9) risk_model(drug_history)
A risk model reflects how the probability of
suffering the ADR changes with the drug exposures
of a patient. It returns 0
when the drug
prescription history has no effect, and 1
when the patient is at maximal risk.
In this case, the drug has no effect on the ADR
what so ever.
risk_model_no_association()
risk_model_no_association()
A risk model
Other Risk models:
risk_model_current_use()
,
risk_model_decaying()
,
risk_model_delayed()
,
risk_model_duration()
,
risk_model_long_term()
,
risk_model_past()
,
risk_model_withdrawal()
drug_history <- c(1, 0, 1, 0, 0) risk_model <- risk_model_no_effect() risk_model() # -> 0
drug_history <- c(1, 0, 1, 0, 0) risk_model <- risk_model_no_effect() risk_model() # -> 0
A risk model reflects how the probability of
suffering the ADR changes with the drug exposures
of a patient. It returns 0
when the drug
prescription history has no effect, and 1
when the patient is at maximal risk.
In this case, once the patient is no longer exposed
to the drug, the probability of the ADR peaks
and then dissipates exponentially.
Let be the number of time points since
the patient was prescribed the drug last. The return
value is the given by
where is
rate
.
risk_model_past(past)
risk_model_past(past)
rate |
The rate with which the risk dissipates |
A risk model
Other Risk models:
risk_model_current_use()
,
risk_model_decaying()
,
risk_model_delayed()
,
risk_model_duration()
,
risk_model_long_term()
,
risk_model_no_association()
,
risk_model_withdrawal()
drug_history <- c(1, 0, 1, 0, 0) risk_model <- risk_model_withdrawal(rate = 1.2) risk_model(drug_history)
drug_history <- c(1, 0, 1, 0, 0) risk_model <- risk_model_withdrawal(rate = 1.2) risk_model(drug_history)
A risk model reflects how the probability of
suffering the ADR changes with the drug exposures
of a patient. It returns 0
when the drug
prescription history has no effect, and 1
when the patient is at maximal risk.
In this case, once the patient is no longer exposed
to the drug, the probability of the ADR peaks
and then dissipates exponentially.
Let be the number of time points since
the patient was prescribed the drug last. The return
value is the given by
where is
rate
.
risk_model_withdrawal(rate)
risk_model_withdrawal(rate)
rate |
The rate with which the risk dissipates |
A risk model
Other Risk models:
risk_model_current_use()
,
risk_model_decaying()
,
risk_model_delayed()
,
risk_model_duration()
,
risk_model_long_term()
,
risk_model_no_association()
,
risk_model_past()
drug_history <- c(1, 0, 1, 0, 0) risk_model <- risk_model_withdrawal(rate = 1.2) risk_model(drug_history)
drug_history <- c(1, 0, 1, 0, 0) risk_model <- risk_model_withdrawal(rate = 1.2) risk_model(drug_history)