Inference for Modeling
Re-visiting many of the ideas in this class with an inferential perspective.
Data 100, Summer 2020 @ UC Berkeley
Suraj Rampure, John DeNero, Sam Lau, Ani Adhikari
LECTURE 21
Agenda
Inference
Prediction vs. inference
Prediction is the task of using our model to make predictions for the response of unseen data.
Inference is the task of using our model to draw conclusions about the underlying true relationship(s) between our features and response.
For example, suppose we are interested in studying the relationship between the value of a home and crime rates, a view of a river, school districts, size, income level of community, etc.
What is statistical inference?
Terminology
Useful terminology:
Bias and variance of an estimator
Bias of an estimator: the difference between the estimator’s expected value and the true value of the parameter being estimated.
Variance of an estimator: the expected squared deviation of an estimator from its mean.
Example: sample mean estimator
What’s the variance of the sample mean estimator?
If the sample were different
The sample mean would be different
But the �“average sample mean” �would stay the same
Example: estimating an estimator’s variance
What’s the variance of the sample mean estimator?
Impractical approach that would work:
Estimated by the empirical mean of the m sample means
Estimated by the empirical mean of �m squared differences
Example: estimating an estimator’s variance
Why is this so impractical?
(demo)
Take sample mean
9
4
5
5
10
6
7
6
5
Compute variance
4.3
Bootstrapping
Note
Bootstrap resampling
Idea: Treat our random sample as a “population”, and resample from it.
Bootstrap resampling
Bootstrap resampling is a technique for estimating the sampling distribution of an estimator.
(demo)
Impractical:
f( )
f( )
f( )
Sample drawn from the �true sampling distribution of f
Bootstrap:
f( )
f( )
f( )
A proxy for a sample from the sampling distribution of f
Bootstrapping pseudocode
collect random sample of size n (called the bootstrap population)
initiate list of estimates
repeat 10,000 times:
resample with replacement n times from bootstrap population
apply estimator f to resample
store in list
list of estimates is the bootstrapped sampling distribution of f
Why must we resample with replacement?
Bootstrap discussion
Bootstrap confidence intervals
Confidence intervals
Confidence intervals
How do we compute ci(s,f,P)?
ci( , f, P) =
ci( , f, P) =
ci( , f, P) =
2
3
4
5
θ*
About P% of these intervals contain θ*
An estimator f exists in order to guess the value of an unknown parameter θ*.
An estimator ci for a P% confidence interval for f is a function that takes a sample and returns an interval. This interval will (ideally) contain θ* for P% of samples.
Bootstrap confidence intervals
...
f( ) =
f( ) =
f( ) =
f( ) =
Choose an interval containing the middle P% of these values.
An estimator ci for a P% confidence interval for f is a function that takes a sample and returns an interval. This interval will (ideally) contain θ* for P% of samples.
Resample with replacement to approximate the sampling distribution of f
2
3
4
5
(Demo)
Confidence intervals
The regression model
The regression model
observed response
design matrix
true parameters
errors (assumed to be i.i.d. across observations)
Example: simple linear regression
true linear relationship
random noise
true underlying relationship
observed response
The regression model
We can observe the quantities in blue. The quantities in red are unobservable.
Our goal is to estimate .
observed response
design matrix
errors (assumed to be i.i.d. across observations)
true parameters
Least squares estimation
Estimator! Takes in a sample, returns an estimate for a population parameter.
Bootstrapping model parameters
Parameter estimates
Assessing the quality of our model
how we make predictions
assumed underlying model
Confidence interval for true slope
(demo)
Multicollinearity
The meaning of “slope”
Consider the equation
Multicollinearity
Case study in multicollinearity
(demo)
Summary
Summary
What’s next
from Joseph Gonzalez