# # ############### Categorical Regression Data Generation ############### # # ## This script shows how I generated the Categorial Regression example data file. # # # The script results in a data file made up of 6 ordinal # variables: y and x1 - x5 (N = 1000). ###### b1 <- 17 b2 <- 13 b3 <- 9 b4 <- 5 b5 <- 1 e <- rnorm(1000) x1 <- rnorm(1000,5) x2 <- rnorm(1000,5) x3 <- rnorm(1000,5) x4 <- rnorm(1000,5) x5 <- rnorm(1000,5) y <- b1*x1 + b2*x2 + b3*x3 + b4*x4 + b5*x5 + e x1 <- trunc(x1) x2 <- trunc(x2) x3 <- trunc(x3) x4 <- trunc(x4) x5 <- trunc(x5) y <- trunc(y) catreg <- data.frame(y,x1,x2,x3,x4,x5)