ds.scatterPlotGG | R Documentation |
ggplot2
)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.
ds.scatterPlotGG( x = NULL, y = NULL, group = NULL, method = "deterministic", k = 3, noise = 0.25, type = "split", datasources = NULL )
x |
|
y |
|
group |
|
method |
|
k |
|
noise |
|
type |
|
datasources |
a list of |
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
ggplot
object
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.