View source: R/generate_contin_table_with_clustered_AE_with_tol.R
generate_contin_table_with_clustered_AE_with_tol | R Documentation |
Generate simulated contingency tables with the option of incorporating adverse event correlation within clusters and tolerance for total report count.
generate_contin_table_with_clustered_AE_with_tol(
row_marginal,
column_marginal,
signal_mat,
tol = 0.1,
contin_table = NULL,
AE_idx = NULL,
n_rep = 1,
rho = NULL
)
row_marginal |
Marginal sums for the rows of the contingency table. |
column_marginal |
Marginal sums for the columns of the contingency table. |
signal_mat |
A data matrix of the same dimension as the contingency table with entries representing the signal strength. The values should be greater or equal to 1, where 1 indicates no signal, and values greater than 1 indicate signal. |
tol |
Tolerance for the total report count, expressed in terms of the Relative Total Difference (RTD), defined as:
This represents the difference between the total number of reports in the simulated datasets and the original input total number of reports. Sufficiently low tolerance will generate tables with total report counts equal to the actual supplied value. Default is 0.1. |
contin_table |
A data matrix of an |
AE_idx |
A data frame or list.
In case of data frame it must contain two variables |
n_rep |
Number of contingency tables to be generated. |
rho |
A numeric value, matrix, or NULL indicating the correlation
structure.If a numeric value (float or int) is provided, it represents the
correlation value |
A list of n_rep
simulated contingency tables.
# using statin49 as an example
data(statin49)
data(statin49_AE_idx)
# Prepare a matrix of signal strength with the same dimension as
# statin49, where 1 indicates no signal and values > 1 indicate
# signal
lambda_matrix <- matrix(1, nrow = nrow(statin49), ncol = ncol(statin49))
lambda_matrix[1, 1] <- 4
# Generate 5 simulated tables
simulated_tables <- generate_contin_table_with_clustered_AE_with_tol(
contin_table = statin49,
signal_mat = lambda_matrix,
n_rep = 5,
AE_idx = statin49_AE_idx,
rho = 0.5,
tol = 0.1
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.