synthesize | R Documentation |
Create n
values or records based on the emperical (multivariate)
distribution of y
. For data frames it is possible to decorrelate synthetic
from the original variables by lowering the value for the rankcor
parameter.
synthesize(x, n = NROW(x), rankcor = 1)
x |
|
n |
|
rankcor |
|
A data object of the same type and structure as x
.
The utility of a synthetic variable is lowered by decorelating the rank
correlation between the real and synthetic data. If rankcor=1
, the
synthetic data will ordered such that it has the same rank order as the
original data. If rankcor=0
, no such reordering will take place. For
values between 0 and 1, blocks of data are randomly selected and randomly
permuted iteratively until the rank correlation between original and
synthetic data drops below the parameter.
Other synthesis:
make_synthesizer()
synthesize(cars$speed,10)
synthesize(cars)
synthesize(cars,25)
s1 <- synthesize(iris, rankcor=1)
s2 <- synthesize(iris, rankcor=0.5)
s3 <- synthesize(iris, rankcor=c("Species"=0.5))
oldpar <- par(mfrow=c(2,2), pch=16, las=1)
plot(Sepal.Length ~ Sepal.Width, data=iris, col=iris$Species, main="Iris")
plot(Sepal.Length ~ Sepal.Width, data=s1, col=s1$Species, main="Synthetic Iris")
plot(Sepal.Length ~ Sepal.Width, data=s2, col=s2$Species, main="Low utility Iris")
plot(Sepal.Length ~ Sepal.Width, data=s3, col=s3$Species, main="Low utility Species")
par(oldpar)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.