Dear R-gurus..

How do I implement the following:
a) Overlay frequency(instead of density) with line of density plot, vertical
lines of confidence intervals and reference levels?
b) Control the breaks (using "nint?"), order of the panel, and the layout,
place units for each conditioning variable?

Is there more efficient way than lines provided below? Please feel free to
suggest other ways of displaying the above information.

library(reshape)
# The data frame below is an example of a subset of results from bootstrap
runs. From the results of bootstrap, I would like to          # display
frequency histogram with overlay of density,confidence intervals, and point
estimates.

aa <- data.frame(id=seq(20),a1=rnorm(20),b1=rnorm(20,0.8),c1=rnorm(20,0.5))
aa1 <- rbind(aa,c( -99, -0.02,1.09,  0.23)) # record of reference values for
each distribution, set "id" = -99
ab <- melt(aa1,measure=names(aa1)[-match("id",names(aa1)])
uns <- unlist(list(id="",a1="mL/h",b1="L",c1="L"))
uns1 <- data.frame(var=names(uns),uni=(uns))
ab1 <- merge(ab,uns1,by="variable",all.x=T)
 ab2 <- ab1[order(ab1$variable,ab1$id),]

histogram(~value|paste(as.character(variable),"
(",uni,")",sep=""),breaks=NULL,nint=10,ab2,layout=c(2,2),as.table=T,type="density",scales=list(relation='free'),
            panel=function(x,lqp=c(0.025,0.975),...) { # lqp indicate
confidence intervals
            x1 <- x[-1]
             vs <- x[1]
            panel.histogram(x1,col='light blue',...)
            panel.densityplot(x1,col.line='blue',lwd=1.75,...)
            panel.abline(v=c(quantile(as.vector(x1),prob=lqp,na.rm = T),vs),
            col=c("blue","blue","dark green"),lwd=2,lty=c(2,2,1))},
            strip=strip.custom( strip.names=F, strip.levels=T)
)

Thanks so much for your help!
Santosh

On Sat, Mar 20, 2010 at 10:56 AM, Sundar Dorai-Raj <sdorai...@gmail.com>wrote:

> You're right. It's necessary for xyplot though to prevent grouping.
>
> On Mar 20, 2010 10:43 AM, "Dieter Menne" <dieter.me...@menne-biomed.de>
> wrote:
>
>
>
> Sundar Dorai-Raj-2 wrote:
> >
> > Or perhaps more clearly,
> >
> > histogram(~a1 + b1 + c1, data = aa, o...
> Why outer=TRUE? Looks same for me without:
> Dieter
>
> library(lattice)
>
> aa <- data.frame(a1=rnorm(20),b1=rnorm(20,0.8),c1=rnorm(20,0.5))
> histogram(~a1 + b1 + c1, data = aa)
>
>
> --
> View this message in context:
> http://n4.nabble.com/sapply-lattice-functions-tp1618134p1676043.html
> Sent from the R help mailing list archive at Nabble.com.
>
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz....
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to