Mathematicians where are you?

General Discussion on any topic relating to CPAP and/or Sleep Apnea.
User avatar
jasper
Posts: 210
Joined: Mon Oct 09, 2006 3:19 pm
Location: Upstate NY

Mathematicians where are you?

Post by jasper » Tue Oct 09, 2007 4:38 pm

There has been a lot of discussion about the 7-day averages available on the LCD screens of M-Series machines and the like. I remember a comment recently about calculating the numbers from the previous one night based on comparing 2 7-day averages. (I think mindy referred to it recently).

So, first of all, RG and our other historians, has this calculation been presented before? If so, I tried to do a Search and a Google on it but with no luck.

Secondly, I played around with the numbers and think I have a simple formula to calculate the last night’s number(s) – AHI, leak or whatever.

I'd be glad to float it out here for the group's mathematicians to look at, but if I'm reinventing the wheel, please let me know.

Thanks, George


User avatar
Flying_Norseman
Posts: 321
Joined: Fri Sep 07, 2007 7:14 pm

Post by Flying_Norseman » Tue Oct 09, 2007 4:50 pm

The formula is pretty simple. For my example, let's say you have 3 days worth of data and I will use made up numbers. The first night will give you your first AHI so let's say it is 4.6. The next day your average AHI is 3.8. In order to find out your AHI for that night use this formula:

(4.6 + x)/2 = 3.8 Then just solve for x. In this case x = 3.0 which is your AHI for the second night. Now say the next day your average is 3.1, the formula would be: (4.6 + 3.0 + x)/3 = 2.1 in this case x = 1.7 which is your AHI for the 3rd night.

Just keep dividing the left side by the number of days.


_________________
Mask
Additional Comments: APAP 10cm to 12cm C-Flex 2

User avatar
jasper
Posts: 210
Joined: Mon Oct 09, 2006 3:19 pm
Location: Upstate NY

Post by jasper » Tue Oct 09, 2007 5:05 pm

Looks like it works out the same. I used the 7-day averages, and came up with the following - which is an extension of your calculation:

C= current 7-day average
P = the previous day's 7-day average
N= last night's number (AHI, leak etc.)

then C = 6/7*P + 1/7*N

or, solved for N it's N = abs(7C-6P)

Sound ok?

jules
Posts: 3304
Joined: Mon Nov 27, 2006 10:51 pm

Post by jules » Tue Oct 09, 2007 5:15 pm

I think you have to also consider the number of hours. If every night is the same number of hours then what was posed would work but why use an absolute value? Okay - maybe my math sucks..

Also remember than Encore Pro sucks on doing basic math - almost as bad as microsoft. I wouldn't count on built in Respironics firmware to do any better then Encore Pro especially when we know there are missing days with the M series machines. In other words, careful - these are just trends not absolute numbers.


User avatar
Flying_Norseman
Posts: 321
Joined: Fri Sep 07, 2007 7:14 pm

Post by Flying_Norseman » Tue Oct 09, 2007 6:52 pm

Jasper, I am from Upstate NY too.

BTW, did you know you can reset the data on your machine so that you can get the numbers for just the previous night?

_________________
Mask
Additional Comments: APAP 10cm to 12cm C-Flex 2

User avatar
RiverDave
Posts: 470
Joined: Mon Jun 25, 2007 6:46 pm
Location: Central Texas, USA

Post by RiverDave » Tue Oct 09, 2007 7:38 pm

Jasper,

That formula won't work to predict your nightly numbers anywhere near accurately (I tried it on my daily numbers and some data sets I created). The problem is that the formula doesn't take into account the variability among the numbers that make up the two 7 day averages you are using to compare. Hard to explain, but unless most of the data points that make up the average are "clumped" together (their values are identical), it makes it harder to calculate the ones that aren't (outliers).

There are probably statistical methods to overcome this, but I don't know them without research. Mindy might, though.

Good Luck.

User avatar
jasper
Posts: 210
Joined: Mon Oct 09, 2006 3:19 pm
Location: Upstate NY

Post by jasper » Tue Oct 09, 2007 7:42 pm

Yep, Snoredog posted the way to do that a couple of weeks ago. For myself, I have the Encore Pro sw, so I don't really need the calc. Just playing around, in case somebody wanted to save the cumulative data.

Upstate NY huh? Of course to some, "upstate" is anything past Poughkeepsie. I'm actually on Lake Ontario, wayyy upstate.


User avatar
Flying_Norseman
Posts: 321
Joined: Fri Sep 07, 2007 7:14 pm

Post by Flying_Norseman » Wed Oct 10, 2007 5:41 am

I am waaay Upstate too. On Lake Champlain about 20 miles south of the Canadian border.

_________________
Mask
Additional Comments: APAP 10cm to 12cm C-Flex 2

User avatar
sleepyWI
Posts: 170
Joined: Thu Dec 07, 2006 9:19 pm
Location: Wisconsin
Contact:

Post by sleepyWI » Wed Oct 10, 2007 9:39 am

RiverDave wrote:Jasper,

That formula won't work to predict your nightly numbers anywhere near accurately (I tried it on my daily numbers and some data sets I created). The problem is that the formula doesn't take into account the variability among the numbers that make up the two 7 day averages you are using to compare. Hard to explain, but unless most of the data points that make up the average are "clumped" together (their values are identical), it makes it harder to calculate the ones that aren't (outliers).

There are probably statistical methods to overcome this, but I don't know them without research. Mindy might, though.

Good Luck.
The reason the formula does not work is that each day the new average is not just the result of adding in the AHI from that night. The other thing that happens is that the first value (the AHI from eight nights ago) disappears from the average and we don't know what that number was. The formula given above only works exactly if that first night's AHI is numerically equal to the first week's average. If it is not it induces an inaccuracy related to how far the true AHI number was from the average (does this make any sense?). I can't think of any statistical method to overcome this. The solution appears to me to be the brute force method described above whereby you start with a blank slate which allows you to calculate the new AHI every day (don't miss a day!). Either that or reset the machine every day..or get the software.

Tim


mindy
Posts: 1753
Joined: Sun Aug 12, 2007 9:36 am

Post by mindy » Wed Oct 10, 2007 9:59 am

sleepyWI wrote:[
I can't think of any statistical method to overcome this. The solution appears to me to be the brute force method described above whereby you start with a blank slate which allows you to calculate the new AHI every day (don't miss a day!). Either that or reset the machine every day..or get the software.

Tim
I think you're right, Tim. The simplest method (which I still haven't had time to set up) is to create a spreadsheet with formulas, reset the machine stats for the first night and then each day enter the 7-day averages into the spreadsheet. You'll have the real numbers from the first day and can set up formulas from that to automatically calculate each day's real numbers. Of course, that assumes that the numbers displayed are reasonably accurate!

Mindy


_________________
Mask: Swift™ FX Bella Nasal Pillow CPAP Mask with Headgears
Humidifier: S9™ Series H5i™ Heated Humidifier with Climate Control
Additional Comments: Pressure 7-11. Padacheek
"Life isn't about waiting for the storm to pass, it's about learning how to dance in the rain."
--- Author unknown

User avatar
Flying_Norseman
Posts: 321
Joined: Fri Sep 07, 2007 7:14 pm

Post by Flying_Norseman » Wed Oct 10, 2007 10:01 am

And I thought I was being smart... Oh well, it figures. I suck at math.

_________________
Mask
Additional Comments: APAP 10cm to 12cm C-Flex 2

User avatar
sleepyWI
Posts: 170
Joined: Thu Dec 07, 2006 9:19 pm
Location: Wisconsin
Contact:

Post by sleepyWI » Wed Oct 10, 2007 10:28 am

Flying Norseman...it is your method that works. Its Jasper's shortcut formula that doesn't work. I should have said this in my original post.

I have just put this into an Excel spreadsheet ... wonder how I can make it available?

Tim

User avatar
Flying_Norseman
Posts: 321
Joined: Fri Sep 07, 2007 7:14 pm

Post by Flying_Norseman » Wed Oct 10, 2007 11:01 am

Great! I am accidentally smart.

_________________
Mask
Additional Comments: APAP 10cm to 12cm C-Flex 2