Question: 4 . Using the college.csv dataset Perform a Simple Linear Regression of Top 1 0 perc as the independent variable to graduation rate as the
Using the college.csv dataset
Perform a Simple Linear Regression of Topperc as the independent variable to graduation rate as the dependent variable show all code to answer the following questions.
Create a data frame called X that drops Grad.Rate since this is the dependent variable Alternatively, you can create a new X dataframe that is only comprised of the dependent variable Topperc. Whichever way you go you will only be using the single independent variable.
Create a Series called y that is the Grad.rate feature.
Perform an test train split resulting in Xtrain Xtest, ytrain and ytest
Train and test the model.
Show the coefficient and intercept
Show R and RMSE interpret these.
Show a line chart with datapoints and the regression line. Title and label accordingly.
Leveraging the X and y defined in Question perform a multiple linear regression.
Perform label encoding for any categorical features. You will need to drop any categorical features after this step since linear regression operates on numerical data.
Perform an test train split resulting in Xtrain Xtest, ytrain and ytest
Use all features perform the regression
Train and test the model.
Provide R
Pvalues
FStatistic
Coefficients and intercept
Interpret results.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
