n.rows <- 4; n.cols <- 5; n <- (n.rows*n.cols)
# Draw some fixed numbers
mu.true <- rnorm(1:n.rows, mean=1:n.rows, sd=1)
sigma.true <- 1
theta <- rvmatrix(rvnorm(n=n.cols, mean=mu.true, sd=sigma.true), nrow=n.rows)
#
col.labels <- paste("Time", 1:n.cols, sep=":")
row.labels <- paste("Unit", 1:n.rows, sep=":")
dimnames(theta) <- list(row.labels, col.labels)
#
par(mfrow=c(2,2))
mlplot(theta, main="theta")
abline(v=0, lty="dotted")
mlplot(t(theta), main="theta transposed")
abline(v=0, lty="dotted")
row.sd <- apply.rv(theta, 1, sd)
col.sd <- apply.rv(theta, 2, sd)
x.max <- max(rvquantile(c(row.sd, col.sd), 0.99))
mlplot(row.sd, xlim=c(0, x.max), main="theta: within-row sd for each unit")
abline(v=0)
mlplot(col.sd, xlim=c(0, x.max), main="theta: between-row sd for each time point")
abline(v=0)
Run the code above in your browser using DataLab