### Example with data on self rated health
data(data_SRHS_long)
SRHS <- data_SRHS_long[1:1600,]
# Covariates
X <- cbind(SRHS$gender-1,
SRHS$race == 2 | SRHS$race == 3,
SRHS$education == 4,
SRHS$education == 5,
SRHS$age-50,
(SRHS$age-50)^2/100)
# Responses
Y <- SRHS$srhs
res <- long2matrices(SRHS$id, X = X, Y = Y)
long <- matrices2long(Y = res$YY, X1 = res$XX)
Run the code above in your browser using DataLab