If all you are given is the graph, then it is probably best to approximate the calibration curve by a series of short straight lines, find the area of each trapezoid between the calibration curve and y=x and add them.
Hi all,
I am working part-time at the university, and my background is not in mathematics, therefore I have a (probably easy) question that I need help with.
I have a graph with two lines: a identity line (x = y) and a calibration curve. I need to calculate the area between the calibration curve and the identity line. The calibration curve might be below or above the identity line. Any ideas?
I have no clue where to start ( my last maths class was in school ).
Thanks in advance,
s.t.
Thank you for the reply HallsofIvy. Sorry, I should have mentioned that I do have the exact x,y co-ordinates for the calibration curve. Therefore, is there a way to calculate the exact area, rather than to estimate it? I previously looked at something like the gini-coefficient to calculate the area (b) of the calibration curve. However am not sure whether it's the correct way to go about it :-)
Thank you very much :-)
What do you mean you "have the exact x,y coordinates"? Are you given a function describing the graph? If so, then the area is . What is the function? However, it is still true that most functions cannot be integrated in terms of elementary functions so it might still be necessary to use a trapezoid rule or Simpson's rule approximation.
Basically I have an array containing entries for x and y co-ordinates that I use to plot the calibration curve. I want to use these points to calculate the area of the curve.
I'm sorry for being a pain, but I don't quite understand your solution :s
Thanks for the help :-)
Then you are NOT "given" the function itself, you are given a numerical approximation to it and the best you can do is a numerical approximation to the area. Use either the "trapezoid" rule or "Simpson's rule" (from any Calculus book or google them) to integrate .
I suggest you do the following: Run the data points in Mathematica using Fit to obtain a least-square fit function. Then integrate the difference. The code below just makes up a table of points corresponding randomly to the function . I then run Fit to obtain a least-square fit I cal myFunction. I then plot the function y=x, y=myFunction, and also the list of points I generated. Finally, I use Integrate to integrate the area between myFunction and x in the range 0 to 5. I use Abs below to get the total area if the calib curve dips below y=x. If you're not familiar with this, try and get someone there to help you with the details.
Code:myList = Table[{xval, 0.1 xval^2 + RandomReal[{-0.5, 0.5}]}, {xval, 0, 5, 0.1}]; ListPlot[myList] myFunction = Fit[myList, {1 + x + x^2 + x^3}, x] Show[{ListPlot[myList], Plot[{x, myFunction}, {x, 0, 5}]}] Integrate[Abs[x - myFunction], {x, 0, 5}]