Solved – How to elegantly determine the area of a hysteresis loop (inside/outside problem)

data visualizationgeometryr

I have measured two parameters (Dissolved organic carbon DOC = y, and discharge = x). When these two variables are plotted against each other, we get a hysteresis loop (see code example and picture).

Now, for further analysis, I would like to determine the area of this hysteretic loop. I figured out that this can be done using the Monte Carlo darting method. This method says that the area of an unknown area is proportional to the area of a known rectangular times the hits in the inside field (the loop).

My problem now is, how to solve the inside / outside problem using R. How can I draw a rectangular with a known area and how can I excel the random hits inside and outside the hysteretic loop?

Please note, that I am open to any other method…

I googled, and searched various statistical sites but could not find an answer.
Any direct help or linkage to other websites/posts is greatly appreciated.

My hysteresis loop

Data <- read.table("http://dl.dropbox.com/u/2108381/DOC_Q_hystersis.txt", sep = ";",
               header = T)

head(Data)
plot(Data$Q, Data$DOC, type = "o", xlab = "Discharge (m3 s-1)", ylab = "DOC (mg C l-1)",
 main = "Hystersis loop of the C/Q relationship")

Best Answer

A completely different way would be to directly calculate the area of your polygon:

library(geometry)
polyarea(x=Data$Q, y=Data$DOC)

This yields 0.606.

Related Question