Learn R Programming

dapper (version 1.1.0)

new_privacy: privacy Object Constructor.

Description

Creates a privacy object to be used as input into dapper_sample().

Usage

new_privacy(
  posterior_f = NULL,
  latent_f = NULL,
  mechanism_f = NULL,
  statistic_f = NULL,
  npar = NULL,
  varnames = NULL
)

Value

A S3 object of class privacy.

Arguments

posterior_f

a function that draws posterior samples given the confidential data.

latent_f

a function that represents the latent data sampling model.

mechanism_f

a function that represents the log likelihood of the privacy mechanism.

statistic_f

a function that calculates the statistic to be released.

npar

dimension of the parameter being estimated.

varnames

an optional character vector of parameter names. Used to label summary outputs.

Details

  • posterior_f() is a function which makes draws from the posterior sampler. It has the syntax posterior_f(dmat, theta). Here dmat is a numeric matrix representing the confidential database and theta is a numeric vector which serves as the initialization point for a one sample draw. The easiest, bug-free way to construct posterior_f() is to use a conjugate prior. However, this function can also be constructed by wrapping a MCMC sampler generated from other R packages (e.g. rstan, fmcmc, adaptMCMC).

  • mechanism_f() is a function that represents the log of the privacy mechanism density. This function has the form mechanism_f(sdp, sx) where sdp and sx are both either a numeric vector or matrix. The arguments must appear in the exact stated order with the same variables names as mentioned. Finally, the return value of mechanism_f() must be a numeric vector of length one.

  • statistic_f() is a function which calculates a summary statistic. It has the syntax statistic_f(xi, sdp, i) where the three arguments must appear in the stated order. The role of this function is to represent terms in the definition of record additivity. Here i is an integer, while xi is an numeric vector and sdp is a numeric vector or matrix.

  • npar is an integer equal to the dimension of theta.