rpearson | R Documentation |
Simulates two numeric variables linear correlated, given a Pearson linear correlation coefficient, that also follows a normal distribution.
rpearson(n = 25, pearson = 0.5, tol = 0.1, mean = 0, sd = 1)
n |
A numeric integer single value (default = 25), that will be the number of observations to simulate |
pearson |
A numeric single value (default = 0.50), that will be the expected Pearson linear correlation coefficient |
tol |
A numeric single value (default = 0.10), that will be the tolerance between the simulated and estimated correlation |
mean |
A numeric single value (default = 0), that will be the mean of the simulated data |
sd |
A numeric single value (default = 1), that will be the standard deviation of the simulated data |
A tibble (nx2) with two numeric variables (x and y).
df <- rpearson(n = 100, pearson = .8, mean = 3)
head(df)
plot(df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.