Thursday, September 24, 2009

Numbers

I've always been fascinated by numerical analysis. I've also always been unable to do it.

Here's an example. I keep a spreadsheet of my blood sugar readings -- at least first thing in the morning, and last thing at night, and frequently what it was during the day. (I take measurements during the middle of the day, and take drugs if needed, but I don't always record those numbers.) At night, I take a long-acting insulin. The quantity varies by what the nighttime reading has been. If the number's low, I take a low dose (low as determined by my track record); high, and I take a high one. I found out the hard way that taking a very high dose was counterproductive; it would drive my blood sugar down during the night, and I'd get up, get something to eat - sometimes, a great deal of something to eat -- and in the morning, the number would be through the roof. If I really have a high number at night, I'll take a skosh of fast-acting insulin to move the number down to an acceptable range, and then the normal amount of long-acting insulin.

As part of the spreadsheet, I have a note for what I think the correct amounts of those insulins should be, based on the night time number. I do this by sorting a range of days by the night time number, graphing it, and then eyeballing what the average morning number was, and how much insulin I took. Sometimes, the numbers cluster nicely together; sometimes, they're all over the map. I don't mind doing the graph, but each time I do, I think: there must be an algorithm to track the effect on one number of variations in two other numbers. There MUST be.

I'm thinking -- regression? Linear, multiple, something? It could fall on me, and I wouldn't recognize or remember how to use it. Wish I did. And I call myself smart!

3 comments:

Unknown said...

It's difficult to say if there's a pattern. Sometimes you need linear regression, sometimes you need a stair-stepping formula (highly unlikely in your case!), and sometimes you need a hyperbola.

Sometimes the numbers are random! If there are two elements involved, and they act in cohort, it is possible to derive the relationship. It's probably been done, and a Google search should reveal some answers.

Here's what I would do: Pythagorus. Square the two numbers and sum them. Plot the results on a graph; if it looks like a straight line, you've got the answer. (None of the points will lie on the line, but I think you know that!) If that doesn't work, do a log() function on the two, summing those numbers. And then try reciprocals. Pythagorus is usually the best for seemingly random numbers (I can't remember, but I think it's called "least squares". But that might be a geek convention...)

After that you start to get into Fourier transforms and the like.

There are a few good books on statistics; your local library might be able to get the Dummies (it's actually quite good), or take a look in the nearest big box bookstore.

Excel has a reasonable number of stat equations, perhaps just playing with them might lead to a reasonable answer?

Good luck!

Carolyn Ann

Cerulean Bill said...

For me, a 'good book on statistics' includes phrases such as "Farmer Brown has a problem. "

Well, perhaps not quite that basic, but not so far away either.

Cerulean Bill said...

I get the reference to the Pythagorean theorm, but not what it means, unless you're talking about 'backing into it' -- ie, given one measured number, adjust the variable other so that when squared/summed, the square root of the resulting sum is about where you want it.

I did the chart, though, and it didn't seem to correlate very well with what the morning reading actually was.Lower values were about 30% off, higher were about 80%.

Most of the line (charting the sq/sum total) was a fairly flat trend up, with only the right most 5% or so jumping sharply upward.