Sleep Window Adjustment Planner
Apply weekly sleep efficiency thresholds to adjust a fixed-wake sleep window, with a threshold strip, guidance table, trajectory chart, and exports.| Week | Observed SE | Action | Decision basis | Δ min | Window | Bedtime | Wake | Copy |
|---|---|---|---|---|---|---|---|---|
| {{ row.week_label }} | {{ row.observed_label }} | {{ row.action_label }} | {{ row.decision_basis }} | {{ formatFixed(row.change_minutes, 0) }} | {{ row.window_label }} | {{ row.bedtime }} | {{ wake_target }} |
| Priority | Action | Why now | Timing | Track | Copy |
|---|---|---|---|---|---|
| {{ row.priority }} | {{ row.action }} | {{ row.reason }} | {{ row.timing }} | {{ row.track }} | |
| No adjustment guidance available. | |||||
Introduction:
Sleep-window adjustment is a rule-based way to review time in bed after several nights or weeks of sleep diary data. The central measure is sleep efficiency: the percentage of time in bed that was actually spent asleep. In cognitive behavioral therapy for insomnia, that percentage can help decide whether a sleep window should hold steady, expand in small steps, or tighten for a while.
The method depends on a stable wake time. When the wake anchor stays fixed, a shorter window moves bedtime later and a longer window moves bedtime earlier. This keeps morning timing consistent while the sleep window changes. It also makes the result easy to audit week by week because every row shows the observed efficiency, decision basis, change in minutes, window size, bedtime, and wake time.
Sleep-window rules are meant to reduce overreaction to one noisy week. A confirmation setting can require 1, 2, or 3 qualifying weeks before changing the window. Minimum and maximum bounds also matter because a rule can be met while the window still holds at a safety limit.
This description is informational and does not provide medical advice. Sleep-window restriction can worsen daytime sleepiness or be inappropriate for people with suspected sleep apnea, seizure risk, bipolar disorder, parasomnia risk, hazardous work, severe anxiety, or other complex clinical situations.
How to Use This Tool:
Use the planner after weekly sleep efficiency has already been calculated from a diary. It does not calculate sleep efficiency from bedtime, wake time, or awakenings. The threshold strip above the form shows how the pasted weekly values sit against the low, hold, and high zones before the detailed table applies the rules.
- Enter Start sleep window from 4.0 to 9.0 hours. Use either the exact number box or the slider. The first output row is Week 0, which records this baseline before any weekly rule is applied.
- Set Fixed wake time in HH:MM format. If the wake time is invalid, the page shows Wake time must be a valid HH:MM value and hides results.
- Paste Weekly sleep efficiency values as percentages separated by lines, commas, spaces, or semicolons. Values must be from 0 to 100, and only the first 26 valid weeks are used.
- Set Low threshold and High threshold. The paired sliders update the threshold strip immediately. Values below the low threshold build a compression streak; values at or above the high threshold build an expansion streak; values between them reset both streaks and hold.
- Choose Confirmation weeks, Adjustment step, Minimum window, and Maximum window. The window bounds also have sliders, and these controls determine when a qualifying streak can change the window and how far it can move.
- Use Follow-up cadence to change guidance timing. Cautious mode emphasizes safety rows, fast mode slightly favors progression rows, and standard mode keeps the default ordering.
- Review Weekly Adjustment Plan for the row-by-row decisions, then check Adjustment Guidance, the Adjustment Trajectory Chart, and JSON output for summary and export needs.
Interpreting Results:
The Adjustment Outcome summary shows the final window, final bedtime, number of weeks, counts of expand, hold, and compress actions, adjustment step, follow-up cadence, and confidence band. The threshold strip below the summary is an input check: it shows the entered efficiency values against the selected thresholds, while the table and chart show the actual week-by-week consequences. The confidence band describes plan stability, not clinical certainty.
The Weekly Adjustment Plan is the main audit trail. Observed SE shows the value that was tested. Action says whether the week expanded, held, compressed, or set the start window. Decision basis explains whether a high-week streak, low-week streak, hold zone, or baseline setup drove the row.
A low-confidence result usually means the window moved often or moved far from baseline. That can happen with real change, noisy diary data, or thresholds set too tightly. Before acting on the next change, verify that the weekly values were calculated the same way and that daytime alertness remains safe.
Technical Details:
Sleep efficiency is total sleep time divided by time in bed. This planner assumes that weekly efficiency has already been computed and entered as percentages. The adjustment rule then applies those percentages sequentially, so the order of pasted values matters: the first value is Week 1, the second is Week 2, and so on.
The initial window is clipped between the selected minimum and maximum bounds before Week 0 is created. Each following week updates high and low streak counters, tests whether a confirmed streak can move the window by the selected step, recalculates bedtime by counting backward from the wake time, and records cumulative shift from the original start window. The pre-field strip uses the same bounded low and high threshold values but deliberately stops before showing the final window, so it remains an orientation aid rather than a second result chart.
Formula Core:
SE is sleep efficiency. W is the sleep window in minutes. Δ is a positive step after a confirmed high-efficiency streak, a negative step after a confirmed low-efficiency streak, and 0 for hold weeks. Bedtime wraps across midnight when needed.
Rule Core:
| Observed weekly SE | Counter change | Window action when confirmed | Boundary behavior |
|---|---|---|---|
SE >= high threshold |
High streak increases; low streak resets | Expand by the adjustment step | Only expands when the result stays at or below the maximum window. |
SE < low threshold |
Low streak increases; high streak resets | Compress by the adjustment step | Only compresses when the result stays at or above the minimum window. |
low threshold <= SE < high threshold |
Both streaks reset | Hold window | The row remains a hold even if the previous week was close to confirming a change. |
The stability score behind the confidence band penalizes frequent non-hold actions and large net movement from baseline. It is calculated from the number of weekly values, the count of expand and compress actions, and the absolute net shift in minutes.
| Item | Boundary | Result effect |
|---|---|---|
| Weekly values | 0 to 100%, first 26 valid values used | Invalid tokens block results; later valid weeks are recorded as truncated. |
| High threshold | 75 to 99%, forced to at least 1 point above the low threshold | Prevents overlapping high and low rules. |
| Confidence band | 75 or higher High, 50 to 74.9 Moderate, below 50 Low | Labels plan stability rather than treatment success. |
| Follow-up cadence | Cautious, Standard, Fast | Changes guidance priorities and timing, but not weekly expand, hold, or compress math. |
Limitations:
The output is a scheduling aid for diary review. It does not decide whether sleep restriction is appropriate, calculate the original sleep-efficiency values, or account for medical and safety factors outside the entered thresholds.
- Use the same diary method across weeks before comparing efficiency values.
- Do not compress further when daytime sleepiness, drowsy driving, or hazardous work creates safety risk.
- Review suspected sleep apnea, bipolar disorder, seizure risk, parasomnias, severe anxiety, medication effects, or unstable shift work with a clinician before using window changes.
Worked Examples:
A 6-hour start window, 07:00 wake time, low threshold of 85%, high threshold of 90%, 1 confirmation week, and 15-minute step gives immediate responses to each weekly value. A week at 91% expands to 6h 15m with a 00:45 bedtime, while a later week at 84% compresses by 15 minutes if the minimum window allows it.
If confirmation weeks is set to 2, one high week does not expand. Two high weeks in a row are required before the Action row shows Expand, and a hold-zone week resets the streak before confirmation.
If pasted values include 82, ninety, 88, the word ninety triggers the invalid-value message and results stay hidden. Replace it with 90 or remove it before using the Weekly Adjustment Plan.
FAQ:
Does this calculate sleep efficiency from my diary?
No. Enter weekly sleep-efficiency percentages that were already calculated from diary data. The tool uses those percentages to apply expand, hold, and compress rules.
Why did a qualifying week still hold?
The rule may need more confirmation weeks, or the requested change may cross the minimum or maximum window. Check Decision basis and the window bounds.
What does Low confidence mean?
Low confidence means the plan changed often or moved far from the start window. It is a stability warning, not a diagnosis or a statement that the rule is medically wrong.
Can I use fast cadence to change the weekly math?
No. Follow-up cadence changes the Adjustment Guidance priorities and timing language. The weekly table still uses the same thresholds, confirmation weeks, step size, and bounds.
References:
- Behavioral and psychological treatments for chronic insomnia disorder in adults, American Academy of Sleep Medicine, 2021.
- Insomnia Treatment, National Heart, Lung, and Blood Institute.
- Sleep Restriction Therapy: Everything You Need to Know, Sleep Foundation.
- Sleep Deprivation and Deficiency: Healthy Sleep Habits, National Heart, Lung, and Blood Institute.