Learning Goal: I’m working on a economics multi-part question and need an explanation and answer to help me learn.
This question should be answered using the Credit data set from ISLR libray below. Please go to ISLR package in R to learn more about the Credit dataset.
library(tidymodels)
library(ISLR)
head(Credit)
model_1=lm(Balance∼Income+Education,data=Credit)
summary(model_1)
AIC(model_1)
BIC(model_1)
Credit$predictions=predict(model_1)
head(Credit)
Credit$residuals=Credit$Balance-Credit$predictions
head(Credit)
res=model_1$residuals
head(res)
plot(Credit$Balance,res)
(balance_mean=mean(Credit$Balance))
(tss=sum((Credit$Balance-balance_mean)^2))
(rss=sum(res^2))
(rsq_glance=glance(model_1)$r.squared)
(rho=cor(Credit$predictions, Credit$Balance))
(rho2=rho^2)
library(ggplot2)
ggplot(Credit, aes(x=predictions, y=residuals))+
geom_pointrange(aes(ymin=res, ymax=res))+
geom_line(linetype=3)+
ggtitle(“residuals vs. Linear model Predictions“)
sample_rows<-sample(nrow(Credit), 0.75*nrow(Credit))
sample_rows
Credit_train<-Credit[sample_rows,]
Credit_test<-Credit[-sample_rows,]
head(Credit_train)
head(Credit_test)
model_train=lm(Balance∼Income+Education+I(Income^2)+Student,data=Credit_train)
Credit_train$pred<-predict(model_train, Credit_train)
Credit_test$pred<-predict(model_train, Credit_test)
mean(Credit_test$pred==Credit_test$Balance)
library(Metrics)
(rmse_train=rmse(Credit_train$pred, Credit_train$Balance))
(rmse_test=rmse(Credit_test$pred,Credit_test$Balance))
ggplot(Credit_test, aes(x=predictions, y=Balance))+
geom_point()+
geom_abline()+
ggtitle(“Actual vs. Linear model Predictions”)
newrates=data.frame(Income=20, Education=20)
pred=predict(model_1, newdata=newrates)
pred
(a) Fit a multiple regression model to predict Balance using Age,
Education, and Income.
(b) Provide an interpretation of each coefficient in the model. Be
careful.
(c) For which of the predictors can you reject the null hypothesis
H0 : βj = 0?
(e) Fit a larger model that includes Rating, in addition to Age,
Education, and Income..
(f) How well do the models in (a) and (e) fit the data? (Explain based on adj R2 and AIC or BIC)
(g) Evaluate forecast accuracy of each model. Does Rating improve the forecast accuracy?
(Please upload all the Rcode and R results)!!
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more
Recent Comments