14.5 Regression
Multiple Linear Regression
Lab 14.5.1
The dataset in the website (URL below) includes 20 columns about home sale, including price, number of bedrooms and bathrooms, areas etc. The data includes 21,613 entries.
- Write a Python code to find the least-squares prediction equation, for these data where, is
price, isbedrooms,sqft_basementand issqft_living. - Use the overall F test to determine whether the model contributes significant information to the prediction of with 1% level of significance.
- What is the value of R-squared. That is, the coefficient of determination.
- Does the
sqft_living, , contribute significant information for the prediction of the price, , given that and are already in the model? (use )
kc_house_data.csv
Logistic Regression
Lab 14.5.2
The data set below (URL) contains the occurrence of coronary heart disease, chd, tobacco, obesity, age, alcohol, etc. For chd, 0 means patient has no chd and 1 means patient has chd.
- Write a Python code to read the data set and display the first five rows.
- Write a Python code to fit a logistic regression model where the dependent variable is
chdand the predictor variables areldl,sbsandage. Use 5% level of significance.
heart.csv
Adapted from Python for Introductory Statistics: Student's Lab Workbook, by Simon Aman (Truman College, City Colleges of Chicago), licensed under CC BY 4.0. Changes were made: reformatted as an accessible XYZ web edition with live in-browser code cells. License: CC-BY-4.0.