Using python, use the fastfood.csv file to complete the following assignment. Create a file, fastfood.py, that loads the .csv file and runs a regression predicting calories from total_fat, sat_fat, cholesterol, and sodium, in that order. Add a constant using sm.add_constant(data). Note: you will not need to upload the .csv to CodeGrade because I have pre-loaded it. Then, print the following to two decimals print(model.mse_total.round(2)) print(model.rsquared.round(2)) print(model.params.round(2)) print(model.pvalues.round(2)) Lastly, the expected output needs to be exact with the below results.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

 

Using python, use the fastfood.csv file to complete the following assignment. Create a file, fastfood.py, that loads the .csv file and runs a regression predicting calories from total_fat, sat_fat, cholesterol, and sodium, in that order. Add a constant using sm.add_constant(data). Note: you will not need to upload the .csv to CodeGrade because I have pre-loaded it. Then, print the following to two decimals

print(model.mse_total.round(2)) print(model.rsquared.round(2)) print(model.params.round(2)) print(model.pvalues.round(2))

Lastly, the expected output needs to be exact with the below results.

 
1.     79770.18
2.     0.9
3.     .{0,}71.73
4.     total fat       9.10
5.    sat_fat         0.60
6.    cholesterol  0.21
7.    sodium        0.16
8.    dtype:       float64
9.    .{0,}0.00
10.  total_fat     0.00
11.   sat_fat       0.64
12.  cholesterol  0.07
13.sodium        0.00
14.dtype:        float64
 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

how would you go about using sys.argv with this assignment? I understand that it is not needed however one of the assignment requirement is using it.

Solution
Bartleby Expert
SEE SOLUTION
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education