What are the validity conditions for linear regression?
Linear Relationship
Independent Residuals
Normal Residuals
?????
Case Study: Extending Linear Regression
What are the validity conditions for linear regression?
Linear Relationship
Independent Residuals
Normal Residuals
Homoscedasticity i.e. constant variance
Case Study: Homoscedasticity
Unequal Variance Common
Typical for Variance to be proportional to magnitude in some way
Could try a data transformation, but isn’t satisfying
Heterogeneous detectors
Have sensor network with mix of types
Maximum Likelihood
Consider following statistical model for \(y_i\) in terms of measurements \(\mathbf{x}_i\): \[
y_i \sim \mathrm{Normal}\left(\mathbf{x}_i^T\mathbf{\theta},\sigma_i\right)
\]
\(\sigma_i^2\) is variance of measurement of \(y_i\)
Consider following statistical model for \(y_i\) in terms of measurements \(\mathbf{x}_i\): \[
y_i \sim \mathrm{Normal}\left(\mathbf{x}_i^T\mathbf{\theta},\sigma_i\right)
\]
\(\sigma_i^2\) is variance of measurement of \(y_i\)
And find: \[
\min_{\theta} \|A\mathbf{\theta} - \mathbf{y}\|^2
\]
Example: Autoregressive Time Series
Suppose we have observations \(y_t\) and want to predict new \(y\) based on previous observations \[
y_t = \theta_1 y_{t-1} + \theta_2 y_{t-2}+\cdots+\theta_n y_{t-n}
\]
How to write this in our framework?
Example: Autoregressive Time Series
Suppose we have observations \(y_t\) and want to predict new \(y\) based on previous observations \[
y_t = \theta_1 y_{t-1} + \theta_2 y_{t-2}+\cdots+\theta_n y_{t-n}
\]
How about using the past 8 hours?: \[
T_t = \sum_{i=1}^8 \theta_i T_{t-i}
\]
Setting up the model
A = np.array([central_park["temp"].values[i:i+8].T for i inrange(len(central_park)-8)])x = central_park["temp"].values[8:]theta = np.linalg.lstsq(A,x)[0]