I want to simulate survey data- think of a survey where people respond on a scale from 1(strongly disagree) to 7(strongly agree).
I want to be able to specify the mean of the simulated sample, as well. For example, I want to simulate 100 numbers between 1 and 7 with a mean of 4 and an SD of 1.
Then I would like to simulate 100 more numbers between 1 and 7 with a mean of 3 and an SD of 1.
This way, I can compute an effect size of d = 1.00. I will use this data for a classroom demonstration.
rnorm()
allows me to specify a mean, but not the bounds.
runif()
allows me to specify the bounds but not the mean.
sample()
allows me to specify the bounds but not the mean.
Applying round()
to rnorm()
gives me whole numbers, but will sometimes generate 0s or 8s (eg numbers outside of the 1-7 range). Yes, I can recode them but this adjusts my effect size:
round(rnorm(200, 2, 1))
Is there not a way to generate either whole numbers between 1 and 7 with a specified mean OR two samples with a specified mean difference and range?