[R] simulating Likert-type data

Jim Lemon jim at bitwrit.com.au
Mon Jun 15 13:27:21 CEST 2009


Fernando Marmolejo Ramos wrote:
> Dear R members
>
> Could someone indicate me how to simulate Likert-type data using the GAMLSS
> library and how to fit that data?
>
> Let’s say, 50 random numbers in a variable that goes from -4 to +4 in steps of
> 1 (i.e., -4, -3, -2, -1, 0, 1, 2, 3, 4) with a mean of 2 and SD of 0.15 and
> belonging to a normal distribution?
>
>   
Hi Fernando,
You can get something like a truncated normal (in the sense of, "If I 
squint my eyes right down, it looks kind of normal") sample with:

sample(-4:4,50,TRUE,prob=c(pnorm(-4:2,)pnorm(c(3,4),2,lower.tail=FALSE))

but it will not pass any of the usual tests for normal distribution.

Jim




More information about the R-help mailing list