<jupyter_start><jupyter_text>Multiple Linear Regression IntroductionIn this notebook (and following quizzes), you will be creating a few simple linear regression models, as well as a multiple linear regression model, to predict home value.Let's get started by importing the necessary libraries and reading in the data you will be using.<jupyter_code>import numpy as np
import pandas as pd
import statsmodels.api as sm;

df = pd.read_csv('./house_prices.csv')
df.head()<jupyter_output>/opt/conda/lib/python3.6/site-packages/statsmodels/compat/pandas.py:56: FutureWarning: The pandas.core.datetools module is deprecated and will be removed in a future version. Please use the pandas.tseries module instead.
  from pandas.core import datetools<jupyter_text>`1.` Using statsmodels, fit three individual simple linear regression models to predict price.  You should have a model that uses **area**, another using **bedrooms**, and a final one using **bathrooms**.  You will also want to use an intercept in each of your three models.Use the results from each of your models to answer the first two quiz questions below.<jupyter_code>df['intercept']=1
areaLM= sm.OLS(df['price'],df[['intercept','area']])
areaResults= areaLM.fit()

bedroomLM= sm.OLS(df['price'],df[['intercept','bedrooms']])
bedroomResults= bedroomLM.fit()
bathroomLM= sm.OLS(df['price'],df[['intercept','bathrooms']])
bathroomResults= bathroomLM.fit()

print(areaResults.summary())
print(bedroomResults.summary())
print(bathroomResults.summary())<jupyter_output>OLS Regression Results                            
==============================================================================
Dep. Variable:                  price   R-squared:                       0.678
Model:                            OLS   Adj. R-squared:                  0.678
Method:                 Least Squares   F-statistic:                 1.269e+04
Date:                Sun, 05 Apr 2020   Prob (F-statistic):               0.00
Time:                        19:36:36   Log-Likelihood:                -84517.
No. Observations:                6028   AIC:                         1.690e+05
Df Residuals:                    6026   BIC:                         1.691e+05
Df Model:                           1                                         
Covariance Type:            nonrobust                                         
==============================================================================
                 coef    std err          t      P>|[...]<jupyter_text>`2.` Now that you have looked at the results from the simple linear regression models, let's try a multiple linear regression model using all three of these variables  at the same time.  You will still want an intercept in this model.<jupyter_code>multipleLM= sm.OLS(df['price'],df[['intercept','area','bedrooms','bathrooms']])
multipleLMresults=multipleLM.fit()
print(multipleLMresults.summary())<jupyter_output>OLS Regression Results                            
==============================================================================
Dep. Variable:                  price   R-squared:                       0.678
Model:                            OLS   Adj. R-squared:                  0.678
Method:                 Least Squares   F-statistic:                     4230.
Date:                Sun, 05 Apr 2020   Prob (F-statistic):               0.00
Time:                        19:39:19   Log-Likelihood:                -84517.
No. Observations:                6028   AIC:                         1.690e+05
Df Residuals:                    6024   BIC:                         1.691e+05
Df Model:                           3                                         
Covariance Type:            nonrobust                                         
==============================================================================
                 coef    std err          t      P>|[...]<jupyter_text>`3.` Along with using the **area**, **bedrooms**, and **bathrooms** you might also want to use **style** to predict the price.  Try adding this to your multiple linear regression model.  What happens?  Use the final quiz below to provide your answer.<jupyter_code>badModel= sm.OLS(df['price'],df[['intercept','area','bedrooms','bathrooms','style']])
badModelresults=badModel.fit()
print(badModelresults.summary())<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup