Hi, Here assume there are four elements in the ordinal set y and take a random sample of size 10 according to the cumulative distribution given, or probability distribution p below.
> y <- c(levels = c("First", "Second", "Third", "Fourth")) > y levels1 levels2 levels3 levels4 "First" "Second" "Third" "Fourth" > (x <- c(1/9, 1/4, 3/5, 1)) [1] 0.1111111 0.2500000 0.6000000 1.0000000 > p <- c(x[1], x[2]-x[1], x[3]-x[2], x[4]-x[3]) > p [1] 0.1111111 0.1388889 0.3500000 0.4000000 > sample(y, 10, replace=TRUE, prob=p) levels2 levels4 levels4 levels3 levels1 levels3 levels4 levels2 levels4 levels3 "Second" "Fourth" "Fourth" "Third" "First" "Third" "Fourth" "Second" "Fourth" "Third" -- View this message in context: http://r.789695.n4.nabble.com/Genrating-Ordinal-Responses-in-R-tp4703159p4703244.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.