Introduction

Biology says: UVB sunlight converts 7-dehydrocholesterol in our skin into vitamin D. In winter, the low sun and the atmosphere block most UVB, so skin makes much less.

But in real life:

  • People also get vitamin D from food, fortified milk, and supplements
  • The body stores vitamin D for several weeks
  • Many people spend most of their time indoors all year

So we know winter should lower vitamin D, but we do not know by how much.

Talking About the Sun

My name means sun. My birth number is ruled by the Sun. I study at the home of the Sun Devils. So naturally, I chose sunlight.

The Question

Are people more likely to be low in vitamin D in winter than in summer? And by how much?


We answer the above question with a confidence interval.

Dataset Introduction

I am using NHANES 2013–2014 data, a national US health survey that includes blood tests. I kept adults aged 20+ with a vitamin D result: n = 5,365. Of these, 2,617 were tested in winter (Nov–Apr) and 2,748 in summer (May–Oct).

Deficient means vitamin D below 50 nmol/L.

Sex Age Season Vitamin D (nmol/L)
Male 69 Winter 28.9
Male 54 Winter 61.9
Male 72 Summer 126.0
Female 73 Winter 108.0

Vitamin D data Visualization

The two curves look similar, with the summer curve shifted a little to the right. Everyone to the left of the dashed line is deficient.

The Math: Interval for a Mean

Average vitamin D in one season:

\[\bar{x} \;\pm\; t^{*} \cdot \frac{s}{\sqrt{n}}\]

  • \(\bar{x}\) = sample mean, \(s\) = standard deviation, \(n\) = sample size
  • \(t^{*}\) ≈ 1.96 for 95% with large samples
  • \(\frac{s}{\sqrt{n}}\) = standard error: how much the mean jumps around from sample to sample

Difference between seasons:

\[(\bar{x}_S - \bar{x}_W) \;\pm\; t^{*}\sqrt{\frac{s_S^2}{n_S} + \frac{s_W^2}{n_W}}\]

The Math: Interval for a Proportion

Percentage of people who are deficient:

\[\hat{p} \;\pm\; z^{*}\sqrt{\frac{\hat{p}\,(1 - \hat{p})}{n}}\]

  • \(\hat{p}\) = share of the sample that is deficient
  • \(z^{*} = 1.96\) for 95% confidence

Difference between seasons:

\[(\hat{p}_W - \hat{p}_S) \;\pm\; 1.96\sqrt{\frac{\hat{p}_W(1-\hat{p}_W)}{n_W} + \frac{\hat{p}_S(1-\hat{p}_S)}{n_S}}\]

If the interval for a difference includes 0, we can’t say the groups are different.

R Code

d <- read.csv("nhanes_vitd_season.csv")
d$season <- factor(d$season, c("Winter", "Summer"))
d$low <- d$vitd < 50

t.test(vitd ~ season, data = d)$conf.int
## [1] -10.63498  -7.62424
## attr(,"conf.level")
## [1] 0.95
n <- tapply(d$vitd, d$season, length)
p <- tapply(d$low, d$season, mean)
round(100 * cbind(est = p,
                  lo = p - 1.96 * sqrt(p * (1 - p) / n),
                  hi = p + 1.96 * sqrt(p * (1 - p) / n)), 1)
##         est   lo   hi
## Winter 39.0 37.1 40.9
## Summer 22.1 20.5 23.6

t.test() gives the interval for the difference in means. The last lines apply the proportion formula by hand.

Results: Winter vs Summer

  • Winter: 39% of people were deficient (95% CI: 37.1% to 40.9%).
  • Summer: 22.1% of people were deficient (95% CI: 20.5% to 23.6%).
  • Difference: about 17 percentage points more people were deficient in winter (95% CI: 14.5 to 19.4). The range does not include 0, so winter really does have more deficiency.

Interactive 3D Representation

How to Read the 3D Plot

The plot shows how wide a confidence interval is. A narrower interval means a more precise answer.

  • Sample size: how many people we test
  • Confidence: how sure we want to be (80% to 99%)
  • Height: how wide the interval is

What it shows:

  • When we test more people, the surface goes down: the interval gets narrower.
  • When we want more confidence, the surface goes up: the interval gets wider.

Example: with 200 people at 95% confidence, the interval is about 13 points wide. With 2,000 people, it shrinks to about 4 points.

Tip: drag to rotate, scroll to zoom, and hover to see exact values.

What Did We Learn?

  1. Deficiency is common: about 30% of US adults are below 50 nmol/L.
  2. Season matters: winter deficiency is 17 points different from summer (95% CI 14.5 to 19.4).
  3. Confidence intervals tell us more than a single number. They show both the estimate and how sure we are.
  4. Study design matters. Where and when data is collected can hide a real effect.

The real effect may be larger: NHANES tested people in the south in winter and the north in summer, which makes the two seasons look more alike than they really are.