Last data update: 2014.03.03
|
R: Simulated Data
Simulated Data
Description
A simulated data-set used for the illustration of grouped for grouped data
coming from a logit-normal distribution.
Format
A data frame with 250 observations on the following 4 variables:
lo the lower limits of the response intervals.
up the upper limits of the response intervals.
treat the treatment indicator.
x a continuous covariate.
Details
The data set has been produced with the code in the Examples below.
Author(s)
Dimitris Rizopoulos d.rizopoulos@erasmusmc.nl
Examples
## Not run:
n <- 250
treat <- rbinom(n, 1, 0.5)
x <- runif(n, -4, 4)
mu <- 1 + 0.5 * treat -1 * x + 0.8 * treat * x
u <- plogis(rnorm(n, mu, 2))
index <- cbind(c(0, 0.25, 0.5, 0.75), c(0.25, 0.5, 0.75, 1))
a <- b <- numeric(n)
for(i in 1:n){
ind <- which(index[, 2] - u[i] > 0)[1]
a[i] <- index[ind, 1]
b[i] <- index[ind, 2]
}
Sdata <- data.frame(lo = a, up = b, treat = factor(treat), x)
## End(Not run)
str(Sdata)
summary(Sdata)
Results
|