[R] how to simulate Likert-type data using R

Jim Lemon jim at bitwrit.com.au
Mon Jun 27 13:55:51 CEST 2011


On 06/26/2011 07:26 PM, wjcao wrote:
> Dear R members
>
> Could someone tell me how to simulate Likert-type data using the rnorm
> function.
>
> Let's say, 200*15 random numbers in a variable that goes from 1 to 4 in
> steps of
> 1 (i.e., 1, 2, 3, 4)  belonging to a normal distribution?
>
> random.data<— matrix(rnorm(200 * 15), nrow = 200, ncol = 15)
> random.data
>
> The result cannot be reached.
>
Hi cao,
Values on a Likert scale, like most other categorical data, do not 
usually have a normal distribution, especially with a small number of 
agreement levels. However, if you want to distribute the numbers 1 to 4 
in the most "normal" way possible, here is a fairly easy way.

Use the "sample" function and specify the probabilities for the four 
digits so that they would be close to the way normal variates would be 
binned into four categories:

table(cut(rnorm(100),breaks=c(-10,-1,0,1,10)))

Don't just copy this, but think about how you want to slice up a 
"normal" distribution to get the best fit. Then when you have discovered 
the correct proportions of responses, you can use those proportions as 
the "prob" argument of the sample function.

Let's say that this looks enough like homework that I won't just give a 
solution.

Jim



More information about the R-help mailing list