THE SIMPLE LINEAR REGRESSION EQUATION CODE
123 3.92 3.44 18.30 1 0 4 4 5 4 26 Porsche 914-2 26.0 4 120.3 91 4.43 2.14 16.70 0 1 2 Step 2: Scatterplot of miles per gallon against weight The block of code below will create a scatterplot of miles per gallon (coded as mpg in the data set) and v (coded as wt) Click the block of code below and hit the Run button above. cars_df = cars_df_orig sample (n=30, replace=False) # print only the first five observations in the data set print("WnCars data frame (showing only the first five observations)") display (HTML(cars_df head.to_html)Ĭars data frame (showing only the first five observations) Unnamed: 0 mpg cyl disp hp drat wt qsec Vs am gear carb 8 Merc 230 22.8 4 140.8 95 3.92 3.15 22.90 1 0 4 2 31 Volvo 142E 21.4 4 121.0 109 4.11 2.78 18.60 1 1 4 2 17 Fiat 128 32.4 4 78.7 66 4.08 2.20 19.47 1 1 1 9 Merc 280 19.2 6 167.6. read_csv" //mtcars.csv") #randomly pick 30 observations without replacement from mtcars dataset to make the data unique to you. In import pandas as pd from IPython display import display, HTML #read data from mtcars.csv data set. Click the block of code below and hit the Run button above. The data set will be saved into a Python dataframe which you will use in later calculations.
![the simple linear regression equation the simple linear regression equation](https://www.digitalvidya.com/wp-content/uploads/2018/10/CI-PI-EQUATION-1024x693.png)
To make the data unique to you, a random sample of size 30, without replacement, will be drawn from the data in the CSV file. Instead, the dataset will be imported from a CSV file. You will not be generating the dataset using numpy module this week.
![the simple linear regression equation the simple linear regression equation](https://i.ytimg.com/vi/VZkXjh0m1Rg/maxresdefault.jpg)
Transcribed image text: Step 1: Generating cars dataset This block of Python code will generate the sample data for you. P-value,, for weight in the Python output.) See Step 4 in the
![the simple linear regression equation the simple linear regression equation](https://vrzkj25a871bpq7t1ugcgmn9-wpengine.netdna-ssl.com/wp-content/uploads/2018/08/linear-regression-formula.png)
You created a scatterplot of miles per gallon against weight Ĭheck to make sure it was included in your attachment.In your initial post, address the following items: Run Step 1 in the Python script to generate your unique This data willīe unique to you, and therefore your answers will be unique as The random sample will be drawn from a CSV file. Weight of the car (coded as wt in the data set).Miles per gallon (coded as mpg in the data set).In this discussion, you will work with a cars data set that This analysis will help the company optimize its business model and (often measured in thousands of pounds) are correlated. That fuel efficiency (miles per gallon) and weight of the car Wants to evaluate the premise that heavier cars are less fuelĮfficient than lighter cars. Techniques covered in this week's reading about correlationĬoefficient and simple linear regression. In this discussion, you will apply the statistical concepts and
![the simple linear regression equation the simple linear regression equation](https://image.slidesharecdn.com/linearregression-140710173001-phpapp02/95/linear-regression-11-638.jpg)
You must attach your Python script output as an HTML file The script will output answers to the questions givenīelow. Once you have made your calculations, complete thisĭiscussion. Use the link in the Jupyter Notebook activity to access your