ds.scatterPlotGG: Generates non-disclosive scatter plots (with 'ggplot2')

ds.scatterPlotGGR Documentation

Generates non-disclosive scatter plots (with ggplot2)

Description

This function uses two disclosure control methods to generate non-disclosive scatter plots of two server-side continuous variables, with the option of using a grouping factor variable.

Usage

ds.scatterPlotGG(
  x = NULL,
  y = NULL,
  group = NULL,
  method = "deterministic",
  k = 3,
  noise = 0.25,
  type = "split",
  datasources = NULL
)

Arguments

x

character (default NULL) specifying the name of a numeric vector.

y

character (default NULL) specifying the name of a numeric vector.

group

character (default NULL) specifying the name of a numeric vector.

method

character (default 'deterministic') string that specifies the method that is used to generated non-disclosive coordinates to be displayed in a scatter plot. This argument can be set as 'deteministic' or 'probabilistic'. For more information see Details.

k

numeric (default 3) he number of the nearest neighbors for which their centroid is calculated. For more information see Details.

noise

numeric (default 0.25) the percentage of the initial variance that is used as the variance of the embedded noise if the argument method is set to 'probabilistic'.

type

character (default 'split') a character that represents the type of graph to display. This can be set as 'combine' or 'split'. For more information see Details.

datasources

a list of DSConnection-class (default NULL) objects obtained after login

Details

As the generation of a scatter plot from original data is disclosive and is not permitted in DataSHIELD, this function allows the user to plot non-disclosive scatter plots.

If the argument method is set to 'deterministic', the server-side function searches for the k-1 nearest neighbors of each single data point and calculates the centroid of such k points. The proximity is defined by the minimum Euclidean distances of z-score transformed data.

When the coordinates of all centroids are estimated the function applies scaling to expand the centroids back to the dispersion of the original data. The scaling is achieved by multiplying the centroids with a scaling factor that is equal to the ratio between the standard deviation of the original variable and the standard deviation of the calculated centroids. The coordinates of the scaled centroids are then returned to the client-side.

The value of k is specified by the user. The suggested and default value is equal to 3 which is also the suggested minimum threshold that is used to prevent disclosure which is specified in the protection filter nfilter.kNN. When the value of k increases, the disclosure risk decreases but the utility loss increases. The value of k is used only if the argument method is set to 'deterministic'. Any value of k is ignored if the argument method is set to 'probabilistic'.

If the argument method is set to 'probabilistic', the server-side function generates a random normal noise of zero mean and variance equal to 10\ The noise is added to each x and y variable and the disturbed by the addition of noise data are returned to the client-side. Note that the seed random number generator is fixed to a specific number generated from the data and therefore the user gets the same figure every time that chooses the probabilistic method in a given set of variables. The value of noise is used only if the argument method is set to 'probabilistic'. Any value of noise is ignored if the argument method is set to 'deterministic'.

In type argument can be set two graphics to display:
(1) If type = 'combine' a scatter plot for combined data is generated.
(2) If type = 'split' one scatter plot for each study is generated.

Server function called: scatterPlotGGDS

Value

ggplot object


isglobal-brge/dsMLClient documentation built on March 14, 2023, 1:59 p.m.