Question: Using Python in Rstudio! We will reproduce the example given in the ebook here fitting a simple machine learnig model. Exactly follow the example from

Using Python in Rstudio!
We will reproduce the example given in the ebook here fitting a simple machine learnig model. Exactly follow the example from the notes to do this part of the project using the data aircraft from robustbase R package.
Aircraft Data, deals with 23 single-engine aircraft built over the years 1947-1979, from Office of Naval Research. The dependent variable is cost (in units of $100,000) and the explanatory variables are aspect ratio, lift-to-drag ratio, weight of plane (in pounds) and maximal thrust. A data frame with 23 observations on the following 5 variables:
X1 is Aspect Ratio,
X2 is Lift-to-Drag Ratio,
X3 is Weight,
X4 is Thrust, and
Y is Cost.
We shall build a predictive model for the Cost (Y) given X1, X2, X3, and X4.
# Load the data
import statsmodels.api as stat
aircraft = stat.datasets.get_rdataset("aircraft", "robustbase").data # load data "aircraft" from the R package 'robustbase'
Plot histogram of the Cost (see examples from notes)
#Code here
Split data to 80% training and 20% testing data sets
#Code here
Create outcome (Cost) and features (Xi) from training data and testing data (see examples from notes)
#Code here
fit a linear regression on training data set
#Code here
Predict using the fit and testing data set
#Code here
Calculate MAPE
#Code here

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!