user1585394
user1585394

Reputation: 21

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

and

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 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.


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))

Upvotes: 2

Views: 798

Answers (1)

IRTFM
IRTFM

Reputation: 263411

The plot method for "ros" class objects is inadequately documented in my opinion. Both ylim and xlim are set as the ranges of the arguments, and this is done in a manner that prevents users from offering alternate ranges. You would need to re-write the plot method in order to change this. This fact is not documented on the help page for plot-methods in NADA.

If you want to mimic the methods used to set up the xlim and ylin arguments you need to look at how the plot.ros function does it and then generalize to two model fits:

    uncen = x$modeled[!x$censored]
    cen = x$modeled[x$censored]
    pp.uncen.nq = qnorm(x$pp[!x$censored])
    pp.cen.nq = qnorm(x$pp[x$censored])
     ymin = min(c(uncen, cen))
     ymax = max(c(uncen, cen))
     xmin = min(c(pp.uncen.nq, pp.cen.nq))
     xmax = max(c(pp.uncen.nq, pp.cen.nq))

So you will need to save the model fits and then pull out the modeled and 'pp' arguments and work on them until you have something you can pass to a modified plot method. After banging my head on the S4 calling methods without success, I've decided it would be easier to just construct an externalized version of the plot-method that you can see with this call:

showMethods("plot", class="ros", includeDefs=TRUE)

Upvotes: 0

Related Questions