Hi All,

I am using lattice::bwplot to plot the results of a subgroup analysis for different simulation scenarios.  I have 4 subgroups, 5 methods of estimating treatment effect in subgroups, and 4 scenarios.  I am plotting the subgroup effect and its upper and lower CI.

I have 2 issues that I am unable to resolve:

1.       How can I control the order in which the panels are plotted?  For example, I would like to bottom and top rows to be switched, and for 2nd and 3rd rows to be switched.

2.       How can I plot a point within each panel at a fixed coordinate?

My code is as follows:

library(lattice)
trellis.par.set("box.rectangle", list(lty=1, lwd=2))
trellis.par.set("box.umbrella", list(lty=1, lwd=2))

n.param <- 16
est.method <- c("Bayes-DS", "EB", "MLE-DS", "Naive", "Stand")
est.type <- c("Point", "LCL", "UCL")
est.names <- c("Int.", paste0("X", 2:n.param))
est.names <- c(outer(c("X0=0", "X0=1","X1=0", "X1=1"), paste0(", scenario", 1:4), function(x,y) paste0(x, y)))


n.methods <- length(est.method)
n.types <- length(est.type)

estimates <- data.frame(Tx.effect=sort(rnorm(n.param*n.methods*n.types, mean=0.5, sd=0.2)),
                        method=rep(est.method, each=n.param*n.types),
                        name=rep(est.names, times=n.types*n.methods),
                        type=rep(est.type, times=n.param*n.methods))

truth <- runif(16)  # I would like to plot these points, one per each panel

bwplot(method ~ Tx.effect|name, data=estimates, box.width=0, coef=0, pch=22)

I would greatly appreciate any help.

Thank you,
Ravi


	[[alternative HTML version deleted]]

