# Generate some data
set.seed(1)
df <- tibble::tibble(
group = factor(
sample(c("a", "b"), 1000, replace = TRUE),
levels = c("a", "b")
),
p = runif(1000)^2,
frisked = runif(1000) < p + 0.1 * (group != "a")
)
# Compute the sensitivity analysis
sens(df, group, frisked, p, "a", 0.1)
# Search over a finer grid
sens(df, group, frisked, p, "a", 0.1, eta = 0.001)
# Increase the accuracy of the maximization approximation
sens(df, group, frisked, p, "a", 0.1, m = 1001)
# \donttest{
# Calculate 90% pointwise confidence intervals
sens(df, group, frisked, p, "a", 0.1, N = 1000, alpha = 0.1)
# Run in parallel, adjusting the chunk size to avoid blocking
sens(df, group, frisked, p, "a", 0.1, n_threads = 2, eta = 0.0001,
chunk_size = 1000)
# }
Run the code above in your browser using DataLab