Friday, August 17, 2012

Looking at the same data in Encore and SleepyHead

I've been gathering detailed data about my PAP therapy, my insomnia, and the all important "how do I feel?" data since April 2010. I've been looking at my PAP data in both Encore and in SleepyHead. All my SleepyHead data is now in SH 0.9-2. And I thought it might be useful to folks if I showed how both software packages show the same set of data.

For this exercise, I've chosen the night of July 1, 2012. Note that bedtime was 2:52 AM on July 2. This was the night when I broke my left pinky when I was out on my nightly walk/jog, so pain was an issue: At the ER, all the doc did was pull the broken and dislocated finger straight, buddy taped it to the ring finger, took x-rays, and informed me that I needed to see a hand specialist the next day because the finger likely needed to be pinned. Because of the pain, I took a sonata that night. Undoubtedly those things adversely affected my sleep that night because this was a night where my snoring was much worse than it normally is and the AHI is a bit higher than it typically is.

Here's the night's data in Encore:

ev-data



And here's the same night in SH:

sh-data



AHI and the other indices

If you look at the index numbers, you'll see that the only difference between the AHI, OAI, CAI, HI, FLI, and REI numbers are that SH rounds to two decimals and Encore rounds to one decimal. If you round the SH numbers to one decimal, you get the Encore numbers.

But clearly that's not the case for the VSI numbers. Encore reports a VSI = 63.8 and SH's VSnore Index = 7.43. Of course, the SH VSnore index only includes VS1s. But even if we take the VS2s into account, it's still impossible to immediately reconcile the Encore VSI with SH data. Clicking on the events tab for this night reveals that SH says there were 48 VS1s and 57 VS2s recorded during the night. That's a total of 105 snores altogether. And if we compute a snore index in the usual way, we'd expect:
snore index = (105 snores)/(6.45833333 hours) = 16.258
Interestingly, our computed snore index is about 1/4 the size of Encore's VSI. But it's not clear at all how Encore is computing the VSI. Digging deeper into the snore data, I can show that on this particular night:
(Sum of the VS2 parentheses numbers)/(usage time) = Encore VSI
I have no idea if this is the real definition of the Encore VSI or just an interesting coincidence. And I don't want to get too side tracked by the snore data---that's another post I intend to write later.


Leak data

Notice that Encore reports the average total leak, but I've chosen "median" for the middle computations in SH. However, SH computes the "averages" for each of the items listed in the left sidebar even if you've set the default to "median". To see these "averages", all I have to do is hover my mouse over the name and the "average" will appear in a pop-up box.

On this night, the median leak rate just happens to be pretty close to the average leak rate. (That's a mathematical coincidence.) Sleepy Head computes the average leak rate as 18.03 L/min, which rounds to Encore's 18.0 L/min average leak rate. I find that usually the SH average leak rate and the Encore average leak rates are typically pretty close.

The leak line in Encore looks much flatter than the one shown in SH. That's because of the scale of the vertical axis in each graph: My leak data on this night is trapped in an 8 L/min range (from a low of 15 L/min to a high of 23 L/min). On the SH graph, the total range for the graph is from 10 L/min to 30 L/min. So the leak data fill up just over a third of the available space in the vertical direction. But the vertical range for the Encore graph is from 0 L/min to 140 L/min, and my data takes up only 1/16 of that range. Hence the bumps look much smaller in Encore than they do in SH. And for newbies: This night's leak line is a really nice leak line.


Pressure data

The 90% pressure data is problematic: Ever since I switched to SH 0.8.8, I've noticed that SH almost always gives me integer values for the 90% pressure data, but it reports it to two decimals. In other words, rounding the SH 90% pressure data to one decimal doesn't change it. The difference between Encore's 90% IPAP = 7.9 and SH's 90% IPAP = 8.00 doesn't seem big enough to worry about.

But Encore's 90% EPAP = 5.5 and SH's 90% EPAP = 6.0 differ by 0.5 cm and my max EPAP = 6cm, so that's a pretty large discrepancy. And for the 90% EPAP, large discrepancies between Encore and SH seem to be common in my data. So which software should I believe for the 90%b EPAP number?

It's worth pointing out that JediMark, the author of Sleepy Head, knows that there are some problems with how he is computing 90% and 95% numbers. But it's also useful to point out that Encore's 90% numbers do not always make sense eirther.

For this night's data I can get a rough idea of which is more likely the correct number by doing a bit of basic arithmetic: I used the machine for 6:27:31, which is close enough to 6:30 for approximations. And 10% of one hour is 6 minutes. So 10% of 6.5 hours is 6*6.5 = 39 minutes. So the question becomes: Can we find about 40 minutes or so of time with the EPAP pressure at around 6 cm? If so, then the 90% EPAP = 6. And in eyeballing the pressure curve, it's clear the EPAP = 6 for at least 30 minutes between 3:00 and 4:30 and it's also clear that the EPAP = 6 for at least 30 minutes between 7:00 and 8:00. Hence, it's clear that EPAP = 6 for at least an hour, which indicates that the 90% EPAP really should be reported as 6cm instead of 5.5cm.

Thursday, August 2, 2012

Data available on the ResMed S9's LCD

The ResMed S9 AutoSet and S9 Elite have a wealth of efficacy data available right on the machine's LCD. The available on-screen data runs rings around the woefully inadequate data provided by the PR System One's LCD. (Note that if you are willing to download the System One data into Sleepy Head or Encore, all the bells and whistles of full efficacy data are there. It's just the System One's on-board data that sucks.)

But many newbie users of the Resmed S9 are not shown how to access the LCD's efficacy data by the DME that sets up their machine.

So---if you are using a Resmed S9 Elite or a resmed S9 AutoSet and you want to know how to get to the LCD's efficacy data and what that efficacy data tells you about the quality of your therapy, this post should answer your questions.

Step-by-step instructions on how to get to the Sleep Quality Report on your S9's LCD

  1. Press the info button on the S9 to get into the Short Sleep Quality Report. You should see your Usage for the night, an icon indicating Mask Fit for the night, and the AHI for the night. Note that Mr. Red Frowny Face shows up if your excess leak rate is AT or ABOVE 24 L/min for at least 30% of the night. If you only see the Usage data, your DME has locked you out of the full Sleep Report Data. Take the machine back to theDME and demand that they change the setting for Sleep Quality from Usage to On. Or learn how to get into the clinical menu and set Sleep Quality to On yourself.
  2. If you want more detailed information, you can go from the short Sleep Quality Report to the more detailed Long Sleep Quality Report by holding both the info and the double check buttons down at the same time for three seconds or so. You may notice a brief flash.
  3.  Use the large round knob to scroll down ONE icon on the left hand list of icons. You should now see the top of the detailed Sleep Quality menu. And then CLICK the round button to select the detailed Sleep Quality menu. This will now let you scroll all the way through the detailed Sleep Quality menu to see the AHI, AI, and CAI, which are at the bottom of this menu. It will also allow you to change the data period from 1 Day to 1 Week to 1 Month to 3 Months to get an idea of the averages of the data over longer time frames than over night.


Information on what data is available on the S9's LCD in the Long Sleep Quality Report

 

The S9's software detects four types of respiratory events: Obstructive apneas, central apneas, unknown apneas, and hypopneas. The unknown apneas are events that the S9's algorithm detects as apneas, but cannot tell whether the apnea is obstructive or central with enough certainty to classify them.

The AHI number is the Apnea/Hypopnea Index for the reporting period, which on the S9 LCD is typically the overnight number. For overnight (one day) data, the AHI is computed by the S9 as follows: It takes the number of all detectable events (obstructive apneas, central apneas, unknown apneas, and hypopneas detected) and divides that number by the time the machine was running. In other words, the AHI is the average number of apneas and hypopneas that occurred each hour the machine was on. The LCD display number on the S9 is simply truncated at one decimal place without any rounding as near as I can tell. I believe that for longer reporting periods (such as five days), ResScan simply averages the nightly AHI numbers to compute the one in the report. But I don't know for sure.

The AI number is the Apnea Index for the reporting period. It only counts the obstructive, central, and unknown apneas. In other words, the S9 computes this number by dividing the number of detected apneas (includes obstructive, central, and unknown apneas) by the time the machine was running. In other words, the AI is the average number of apneas that occurred each hour the machine was on. Again, the S9's LCD display number seems to simply be truncated at one decimal place instead of being rounded to one decimal place.

An example might help.  Suppose that on a given night the S9 detects 15 total events---let's say there are 9 obstructive apneas, 2 central apneas, and 4 hypopneas---and that the machine was run for a total of 6.6 hours.

The S9's LCD's overnight AHI, AI, and CAI numbers are computed as follows:
AHI = 15/6.6 = 2.272727 = 2.2 (due to truncating the decimal)
AI = 11/6.6 = 1.666667 = 1.6 (due to truncating the decimal)
CAI = 2/6.6 = 0.303030 = 0.3 (due to truncating the decimal)
    Note that we can use the LCD's overnight data to estimate the number of apneas, central apneas, obstructive apneas, and hypopneas by doing some quick multiplication of the LCD's overnight indices by the usage number. Here's a typical example:

    Let's suppose you look at the detailed Sleep Quality Data one morning and this is what you see:
    Usage: 7.3
    Pressure: 12.4
    Leak: 9.6
    AHI: 1.8
    AI: 1.4
    CAI: 0.3
    The Usage number indicates you used the machine 7.3 hours overnight.

    The Pressure number is the 95% pressure level. For example, if the LCD says the Pressure = 12.4, that means that your pressure was AT or BELOW 12.4 cmH2O for 95% of the night. It also means that your pressure was AT or ABOVE 12.4 cmH2O for 5% of the night.   Note: If you are using an S9 Elite or if you are using an S9 AutoSet in CPAP mode, the Pressure number will just be your Pressure setting and it will remain the same every day.

    The Leak number is the 95% excess leak rate in Liters per minute (L/min). Since the LCD says the Leak = 9.6, that means that your unintentional leak rate was AT or BELOW 9.6 L/min for 95% of the night. It also means that your unintentional leak rate was AT or ABOVE 9.6 L/min for 5% of the night.

    And how long is 5% of the night? Well, 5% of one hour = 3 minutes. So you can multiply the Usage time by 3 minutes to get an idea of how long your leaks were above the reported leak rate: In our example, leaks were ABOVE 9.6 L/min for a total of no more than 7.3 * 3 = 21.9 minutes and the Pressure was above 12.4 for a total of no more than 7.3 * 3 - 21.9 minutes.

    Since the usage was about 7.3 hours, we can also estimate the number of events you had and what type they were from the LCD's AHI, AI and CAI numbers as follows:

    Total number of apneas and hypopneas:
    AHI x Usage = (1.8 events per hour) x (7.3 hours) = approx. 13.14 events = 14 events (round UP since there's a fraction)

    Total number of apneas (all types):
    AI x Usage = (1.4 apneas per hour) x (7.3 hours) = approx. 10.22 apneas = 11 apneas (round UP since there's a fraction)

    Total number of central apneas:
    CAI x Usage = (0.3 CAs per hour) x (7.3 hours) = aprox. 2.19 central apneas = 3 central apneas (round UP since there's a fraction)

    Estimated Total number of obstructive apneas:
    First, an estimate of the OAI is simply OAI = AI - CAI. Note that if your S9 detects any Apneas of Unknown type, that will throw this calculation off, but it's still a good estimate. So here we go:
    OAI = AI - CAI = 1.4 - 0.3 = 1.1 and
    OAI x Usage = (1.1 OAs per hour) x (7.3 hours) = 8.03 obstructive apneas = 8 apneas (since we truncate to one decimal and because 8 + 3 = 11 apneas)

    Total number of hypopneas:
    First, an estimate of the HI is simply HI = AHI - AI. So here we go:
    HI = AHI - AI = 1.8 - 1.4 = 0.4
    HI x Usage = (0.4 Hypopneas per hour) x (7.3 hours) = 2.93 hypopneas = 3 hypopneas (Which make since because 11 apneas + 3 hypopneas = 14 events.)

    Of course, to get more detailed information about when the events happened and how long each of the apneas lasted, you will need to download the data into ResScan (or Sleepy Head) and look at the graphs for the night.

    Monday, March 19, 2012

    Average, Median, 95% numbers: A guide to those who don't remember their introductory stats

    Managing OSA with a full data CPAP/APAP machine involves a tremendous number of numbers. The indices (AHI, AI, CAI, OAI, HI, RERA I, etc) are best understood as the typical number of events of the given type that are expected to occur in one hour of sleep.. The computation of these numbers on a PSG is discussed in Understanding the data in your sleep test. The way our machines compute our overnight AHI (and other indices) is remarkably simple:
    • AHI = (number of events detected) / (total time the  machine was run)
    • AI = (number of apneas detected) / (total time the machine was run)
    • OAI = (number of obstructive apneas detected) / (total time the machine was run)
    • CAI = (number of clear airway apneas detected) / (total time the machine was run)
    • HI = (number of hypopneas detected) / (total time the machine was run)
    But the way leak data and pressure data is presented in ResScan, Encore Viewer or Pro, and SleepyHead involves a bit of elementary statistics.  Resmed users see median and 95th percentile for both the leak data and the pressure data in ResScan and 95% numbers on the S9's LCD. PR users see average leak rates and 90th percentile pressure levels in Encore. Users of SleepyHead can choose between median and weighted average for "middle" computations.

    And just what the heck to these numbers actually mean?

    What they mean, of course, is based on how they are computed. This blog entry computation focuses on how these various numbers are computed for a given set of data. The differences between median and (weighted) average are best understood by looking at what are called discrete sets of data. A discrete set of data is nothing more than a list of numbers. Once the data becomes continuous the ideas are the same, but the computations become more complicated. So to try to make this easier to understand, I'll stick with examples with discrete data. Let's look at a specific example. Suppose our data set looks like this:
     8.4, 8.4, 8.4, 8.4, 8.4, 8.4, 8.4, 8.4, 8.4, 8.4, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 9.5, 10, 10, 10, 10, 10, 10.1, 10.1, 10.1, 10.1, 10.1, 10.1, 10.1, 10.1, 15.3, 15.3
     There are 100 numbers on this list.  The two 9's with the green background are the 50th and 51st numbers on the list.  The red 10, is the 90th number on the list.  And the blue 10.1 is the 95th number on the list..

    The median for this set of numbers is 9 because half of the data is AT or BELOW this number and half of the data is AT or ABOVE this number.  (Technically speaking the median of this set of data is the average of the two 9 with the green backgrounds.).

    The 90 percentile (90%)  for the data is 10  because 90% of the data is AT or BELOW 10 since the is the 10 is the 90th number on our list of 100 numbers..  And note that 10% of the data is AT or ABOVE 10 because the last ten numbers on the list are all at least as big as the 10  is.

    The 95 percentile (95%)  for the data is 10.1  because 95% of the data is AT or BELOW 10.1 because the 10.1  is the 95th number on our list of 100 numbers..  And note that 5% of the data is AT or ABOVE 10.1 because the last ten numbers on the list are all at least as big as the 10.1  is.

    The weighted average of the numbers is found by multiplying each number by the percentage of data points at that number. Since we've got 100 data points in our example, the percentage is just the number of times a given number appears in our list divided by 100.  If you count carefully, you find that the weighted average of this set of data is 9354, which is.found by this calculation:


    (0.1 * 8.4) + (0.45 * 9) + (0.3 * 9.5) + (0.05 * 10) + (0.08 * 10.1) + (0.02 * 15.3) = 9.354

    So for this set of data we get the following statistical numbers:
    • Median = 9
    • 90% = 10
    • 95% = 10.1
    • average = 9.354
    A lot of people will assume that the average and the median are in the same neighborhood.  But that really depends on the spread of the data.  In general, the average can be less than the median OR it can equal the median OR it can be greater than the median.  Indeed, in data sets with a very limited number of distinct numbers where one low number predominates, the average can even be greater than the 90% or even the 95% numbers.  For example, consider this set of data with 100 points:
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,  10, 10, 10

    The 50th and 51st data data points are the pair of green highlighted 0's.  So the median is 0.

    The 90th data point  is the red 0.  So the 90% number is also 0.
    The 95th data point is the blue 1.  So the 95% number is 1.


    But average is 3.4 because (0.91*0) + (0.4*1) + (0.3*10) = 3.4  and so the average is larger than even the 95% number.

    Now to tie this directly back to CPAP numbers:


    • The median leak rate is 25 L/min:  This means that for 50% of the night, your leak rate was AT or BELOW 25 L/min.   And for 50% of the night, your leak rate was AT or ABOVE 25 L/min. (Whether a leak rate of 25 L/min is good or not depends on whether your machine is reporting total leaks or  unintentional leaks.  The PR System One machines report total leaks and 25 L/min is going to be very, very good for most masks at pressures of up to about 8 or 9 cm.  The Resmed machines report unintentional leaks and 25 L/min is above the Red Line of 24 L/min, which means the leak rate is bad.
    • The 90% leak rate is 35 L/min.  This means that for 90% of the night, your leak rate was AT or BELOW 35 L/min and for 10% of the night your leak rate was AT or ABOVE 35 L/min.
    • The 95% leak rate is 40 L/min. This means that for 95% of the night, your leak rate was AT or BELOW 40 L/min and for 5% of the night your leak rate was AT or ABOVE 40 L/min.
    • The average leak rate is 28.89 L/min.  Remember this tells you nothing about how much time you spent with a leak rate that was AT or BELOW 26.89 L/min because there is no concrete relationship between the average of a set of numbers and percentiles for the data.
    Pressure numbers are similar for APAPs in Auto mode:
    • The median pressure is 9.5 cm H2O:  This means that for 50% of the night, your pressure was AT or BELOW 9 cm H2O..   And for 50% of the night, your pressure was AT or ABOVE 9.5 cm H2O
    • The 90% pressure is 11 cm H2O.  This means that for 90% of the night, your pressure was AT or BELOW 11 cm H2O and for 10% of the night your pressure was AT or ABOVE 11 cm H2O.
    • The 95% leak rate is 11.5 cm H2O. This means that for 95% of the night, your pressure was AT or BELOW 11.5 cm H2O and for 5% of the night your pressure was AT or ABOVE 11.5 cm H2O..
    • The average pressure is 9.65 cm H2O.  Remember this tells you nothing about how much time you spent with a pressure that was AT or BELOW 9.65 cm H2O because there is no concrete relationship between the average of a set of numbers and percentiles for the data.