The {fdp} package provides tools for working with
The package is based on the
You can install the package from CRAN:
install.packages("fdp")Or install the development version from GitHub:
# install.packages("remotes")
remotes::install_github("louisaslett/fdp")Here are some basic examples of using the {fdp} package:
library(fdp)
# Plot a single GDP trade-off function with μ = 1
fdp(gdp(1))# Compare Gaussian DP with classical (ε, δ)-DP
fdp(
"Gaussian DP" = gdp(1.0),
"Classical DP" = epsdelta(1.0),
"Approximate DP" = epsdelta(1.3, 0.05),
.legend = "Privacy Mechanism"
)# Define empirical trade-off points from a privacy audit
empirical_points <- data.frame(
alpha = c(0.00, 0.05, 0.10, 0.25, 0.50, 1.00),
beta = c(1.00, 0.93, 0.87, 0.72, 0.43, 0.00)
)
# Find the GDP parameters that lower bound these points
gdp_bound <- est_gdp(empirical_points)
gdp_bound
# Visualize the fit
fdp(empirical_points, gdp_bound)# Create trade-off function for Laplace mechanism with scale parameter 1.5
lap_mechanism <- lap(1.5)
# Find its GDP lower bound
gdp_equiv <- est_gdp(lap_mechanism)
# Compare them
fdp(lap_mechanism, gdp_equiv)For more detailed examples and documentation, see the package vignettes and function help pages.
