PYTHON AND STATISTICAL INFERENCE - Bryant University
Transcript of PYTHON AND STATISTICAL INFERENCE - Bryant University
PYTHON AND STATISTICAL INFERENCE
Brian BlaisScience and TechnologyBryant University
Monday, May 7, 12
WHAT IS PYTHON?Flexible,powerful language
Multiple programming paradigms
Easy, clean syntax
Large community of support
“Batteries included”
Free as in “free beer”
Free as in “free speech”
http://www.python.org
Monday, May 7, 12
NUMERICAL PYTHON
http://www.enthought.com/
Monday, May 7, 12
FILE FORMATS
Monday, May 7, 12
EXAMPLE DATA
Monday, May 7, 12
EXAMPLE DATA
Monday, May 7, 12
TRANSFORMING DATA
Example log transform of population
Monday, May 7, 12
PLOTTING DATA
Monday, May 7, 12
INTERFACE WITH R
Monday, May 7, 12
INFERENCE IN PHYSICS(Or Why I Don’t Do This Sort of Analysis Often)
•In the physical sciences one often has much more prior information about the causal structure in the problem•Often more concerned with parameter estimation and model comparison than correlation detection
Monday, May 7, 12
DATA NEVER SEEN IN THE SOCIAL SCIENCES
Swiss Astronomer Rudolf Wolf (1816-1893)
Monday, May 7, 12
ELONGATED DICE
1 cm
1 cm
(1 + r) cm
Surface Area Model
p1 = p2 = p5 = p6 =1 + r
6 + 4r
p3 = p4 =1
6 + 4r
Monday, May 7, 12
BAYESIAN ANALYSIS
p(r|data) ⇠ p(data|r)p(r) # n
1 3246
2 3449
3 2897
4 2841
5 3635
6 3923
Monday, May 7, 12
PYTHON
Monday, May 7, 12
CLIMATE EXAMPLE
Is there evidence of an oscillation here?More than one?
Monday, May 7, 12
BAYESIAN ANALYSIS BRETTHORST, 1988
data
model
Gaussian noise
Monday, May 7, 12
BAYESIAN ANALYSIS BRETTHORST, 1988
likelihood
Monday, May 7, 12
BAYESIAN ANALYSIS BRETTHORST, 1988
•integrate out the B1 and B2 (uniform priors)•we don’t know the noise level - integrate it out•interested only in the frequency
C(w) is the Schuster periodogram, related to the FFT
This is the “Student” t-distribution
Monday, May 7, 12
NUMERICAL ANALYSIS
Monday, May 7, 12
BAYESIAN REGRESSION
order Log Likelihood
1 1.2
2 18.2
3 18.9
Monday, May 7, 12
BAYESIAN REGRESSION
order Log Posterior
1 -4.8
2 9.2
3 6.9
Automatic penalty for
more complex models
Monday, May 7, 12
THANKS!
Monday, May 7, 12