Pairs-bootstrap

Statistical Thinking in Python (deel 2)

Justin Bois

Lecturer at the California Institute of Technology

Niet-parametrische inferentie

  • Maak geen aannames over het model of de verdeling achter de data
Statistical Thinking in Python (deel 2)

Verkiezingsuitslagen swing states VS, 2008

ch2-3.004.png

1 Gegevens afkomstig van Data.gov (https://www.data.gov/)
Statistical Thinking in Python (deel 2)

Pairs-bootstrap voor lineaire regressie

  • Resample data in paren
  • Bereken helling en intercept uit de resample
  • Elke helling en elk intercept is een bootstrap-replicaat
  • Bepaal betrouwbaarheidsintervallen via percentielen van replicaten
Statistical Thinking in Python (deel 2)

Een pairs-bootstrap-steekproef genereren

np.arange(7)
array([0, 1, 2, 3, 4, 5, 6])
inds = np.arange(len(total_votes))

bs_inds = np.random.choice(inds, len(inds))
bs_total_votes = total_votes[bs_inds] bs_dem_share = dem_share[bs_inds]
Statistical Thinking in Python (deel 2)

Een pairs-bootstrap-replicaat berekenen

bs_slope, bs_intercept = np.polyfit(bs_total_votes, 
                                    bs_dem_share, 1)

bs_slope, bs_intercept
(3.9053605692223672e-05, 40.387910131803025)
np.polyfit(total_votes, dem_share, 1)  # fit of original
array([  4.03707170e-05,   4.01139120e+01])
Statistical Thinking in Python (deel 2)

Verkiezingsuitslagen swing states VS, 2008

ch2-3.022.png

1 Gegevens afkomstig van Data.gov (https://www.data.gov/)
Statistical Thinking in Python (deel 2)

Laten we oefenen!

Statistical Thinking in Python (deel 2)

Preparing Video For Download...