plebel
2012-Aug-08 18:21 UTC
[R] Showing multiple Probability Plots on the same graph using the plot(cenros) command from the NADA library
I am currently conducting a performance analysis for an urban stormwater management facility which employs Low Impact Development practices. I have the Event Mean Concentrations (EMCs) of several water quality constituents (ex: Total Phosphorus (TP), Total Oxidized Nitrogen (OxN), etc) at inflow and outflow locations for a particular stormwater management practice. I wish to use the Effluent Probability Method to create a normal probability plot comparing the log-transform (most often) data of both inflow and outflow Event Mean Concentrations (EMCs) as a method to visually compare the water quality constituent EMCs at the inflow and outflow locations across all storm events. Due to the censored nature of environmental water quality data I am employing a probability plot function which uses a robust regression on ordered statistics (ROS) method to determine the placement of uncensored data in the probability plot. This robust ROS method takes the proportion of data which is censored, or below the reporting limit, into account when determining the position of the uncensored data in the probability plot. The plot(cenros(Observation, ObservationCensored)) command creates a censored lognormal ROS probability plot for the data. Where Observation=the raw data ObservationCensored=TRUE/FALSE Where: TRUE=a censored observation FALSE=an uncensored observation I have included the data and commands I used in R at the end of this message. If wanted, they can be pasted directly into R to see the result (as long as you have the NADA package installed). If you have copied the below input into R, then you will see two censored lognormal ROS probability plots overlaid onto a single graph. However you will also notice that the x- and y- scales for the axes do not line up properly. The following list describes how I have attempted to set the x- and y-limits to the same scale for the two probability plots: ? I tried setting the x- and y-limits using xlim=c() and ylim=c() respectively in each plot() command however an error occurs because ?formal argument ?xlim? and ?ylim? matched by multiple actual arguments?. ? I also tried setting the second plot?s axes=FALSE within second plot() command however it did not seem to have an effect. ? I have tried setting usr=c(x1,x2,y1,y2) within the par() command, again it didn?t have an effect. ? I tried setting xaxs= ?d? in the par() command however ?d? is unimplemented in R and thus an error occurred. Same for yaxs=?d?. ? I tried setting xaxt= ?n? in the second graph to suppress plotting the axis however this only suppressed printing the values of the bottom x-axis and thus didn?t work for what I wanted. ? Long story short, I have been unable to graph two probability plots on the same plot (with matching x-and y-axis). I would appreciate any help in how to make the x- and y-axes the same by setting the xlim and ylim modifiers equal in both probability plots and/or by using modifiers within the par(new=TRUE) command. Thank you for your time and consideration, Paul Below are the data and commands I used to create the two censored lognormal ROS probability plots overlaid onto a single graph for use in the Effluent Probability Method. If wanted, they can be pasted directly into R to see the result (as long as you have the NADA package installed). library(NADA) CUIN.TP.EMC<-c(0.09,1.22748027,0.0414537,0.11796508,1.3,0.06,0.06,0.17495668,0.08997043,0.11922784,0.14,0.4,0.77,0.04573882,0.15,0.00531218,0.27376485,0.06,0.30250796,0.64581398,0.48,0.27,0.67655024,0.1,0.21) CUIN.TP.EMC.IV<-c(FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE) CUOUT.TP.EMC<-c(0.28,0.24,0.31,0.26,0.19,0.28,0.35,0.23,0.2,0.24,0.17,0.46,0.35) CUOUT.TP.EMC.IV<-c(FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE) plot(cenros(CUIN.TP.EMC,CUIN.TP.EMC.IV)) par(new=TRUE) plot(cenros(CUOUT.TP.EMC,CUOUT.TP.EMC.IV)) -- View this message in context: http://r.789695.n4.nabble.com/Showing-multiple-Probability-Plots-on-the-same-graph-using-the-plot-cenros-command-from-the-NADA-liby-tp4639651.html Sent from the R help mailing list archive at Nabble.com.