## R Code for Computing CI

Mission accomplished, thanks to everyone, especially David for pointing out the system of non-linear equations based on the Pythagorean triangle relationship. If you run this, this is what you get:

Delta 100 4x5 DDX 1+4.png
And the data you feed into it comes from a text file that looks like this:

What Data Looks LIke.png

If you want to play with it, you need my code (attached) and a copy of R, which is a free programming language and an environment for statistics/numerical analysis, and which does nice plots. It runs on Windows, Macs, and Linux, get it from here if you feel geeky, or read about on Wikipedia. My code is in the attachment, all you need to do is to load it in R by using 'source("CI_plotter.R.txt")' having placed it in the current directory. If you open that file, you can see how to use it, I gave some examples. Let me know if anyone would like any pointers. I don't mind plotting your data, if you wish, to find the CIs—I suppose this won't be a very popular request, anyway.

The R code, which I wrote, works for the various curve data I fed into it. You need to give it a series of numbers representing your step tablet exposures (so from 0 on the left increasing towards the right) in a column called "He" and any number of columns containing your densitometer readings. R will plot the points and it will try fitting curves—using Bezier splines with 6 degrees of freedom by default. You can decrease that number for more smoothing (left-of-toe will look odd but calculations will work) or increase it, for less smoothing. You can also play with other smoothers if you uncomment the right lines in the code, including LOESS. In either case, the CI computations should work. I uses nleqslv, which is pretty much as close to SciPy fsolve, which David mentioned, as I could find today. The alternative which I have tested, multiroot (from rootSolve) was less forgiving of bad choices of the "starting point". This is a weakness of my code (I am sure one of many!). Sometimes, for some curves, it will not compute CI, it will display "NA" on the plot, and it will make a suggestion that you change the "starting.point". This is a parameter at the top of the program, which denotes the best guess of the x[1], x[2], and x[3] as per David's explanations, that is the rel log E values that are supposed to correspond to the projections onto the X axis of the 3 key CI determination points. In other words, those are: the centre of the two arcs, and the intersections of the 0.2 and the 2.2 arcs with x axis. I defaulted it to (0.9, 1, 2) by trial and error, but if it does not work for you, nudge them a bit either way, especially the first one. Anyone who would like to contribute a good way to guess those automatically, please let me know—I have tried interpolating them from a straight-line regression of the data points etc but that was worse than using my best manual guesses. Some other time I will add a function to plot the CI ~ dev time curve...

Ok, back to the darkroom tomorrow—I miss a low-contrast test in this data, will try a 4.5 min time to complete the exercise.