Home > front end >  How can i transform random distribution to (predefined) integer values in R?
How can i transform random distribution to (predefined) integer values in R?

Time:08-20

In R there's a lot of samples with which I can generate simulated data according to a specific distribution. For example:

rnorm(N, 0, 1)
runif(N, 0, 1)

which gives me a set of random values that are basically real numbers. For some reason, however, I would like to get a result based on a set of integers, for example integers from 1 to 10, something like c(1:10).

Is there any simple function that can transform, for example obtained normal distribution of real values to (pseudo)normal distribution of indicated range of integer values?

EDIT: In social sciences, the observed variables are most often questionnaire scores. The results of these questionnaires are scored in integer numbers. The subject cannot score 1.5 points, only 1 or 2 points. Nevertheless, a normal distribution of the results can be obtained. I am looking for a function that generates such a distribution within integer results.

Other background: enter image description here

  • Related