# \donttest{
## Example 1: 3 by 3 table with custom test statistic
# Create an observed table (example data)
obs.table <- matrix(c(5, 3, 2, 6, 11, 7, 3, 0, 3), ncol = 3, byrow = TRUE)
# Define a test statistic emphasizing certain cells
transform.fun <- function(tb){
test.stat <- 4 * tb[3, 3] + 3 * tb[2, 3]
return(test.stat)
}
obs.stat <- transform.fun(obs.table)
# Find the reference set (tables with test statistic >= observed)
table.set <- possible.table(
threshold = obs.stat,
table = obs.table,
direction = "greater than",
transform.fun = transform.fun
)
# Perform sensitivity analysis
sen.result <- exact.general.sen.IxJ(
obs.table = obs.table,
table_space = table.set,
gamma = 0.5,
delta = c(0, 1, 1)
)
sen.result
# }
Run the code above in your browser using DataLab