Eduard Szöcs

Data in Environmental Science and Eco(toxico-)logy

Quantitative Ecotoxicology, Page 35, Robust Regression on Order Statistics

Get the data from here and read it into R:

SO4 <- read.table("p35.csv", header = TRUE, sep = ";")

First we need to convert the vector indicating if an observation is censored to TRUE/FALSE: I store it in a new colum called ‘rem2’ (you could also overwrite rem):

SO4$rem2 <- ifelse(SO4$rem == "<", TRUE, FALSE)
SO4
##    value rem  rem2
## 1    2.5   <  TRUE
## 2    2.5   <  TRUE
## 3    2.6   X FALSE
## 4    3.3   X FALSE
## 5    3.5   X FALSE
## 6    3.5   X FALSE
## 7    3.6   X FALSE
## 8    4.0   X FALSE
## 9    4.1   X FALSE
## 10   4.5   X FALSE
## 11   5.2   X FALSE
## 12   5.6   X FALSE
## 13   5.7   X FALSE
## 14   6.1   X FALSE
## 15   6.2   X FALSE
## 16   6.5   X FALSE
## 17   6.9   X FALSE
## 18   7.1   X FALSE
## 19   7.7   X FALSE
## 20   7.9   X FALSE
## 21   9.9   X FALSE

Then we can run the Robust Regression on Order Statistics with the ros() function from the NADA package:

require(NADA)
rs <- ros(SO4$value, SO4$rem2)
print(rs)
##      n  n.cen median   mean     sd 
## 21.000  2.000  5.200  5.158  2.071

Which gives the same mean and standard deviation as the SAS-Makro (5.16 and 2.07).

Code and data are available at my github-repo under filename ‘p35’.

Written on December 1, 2012