Question
1.Nonlinear regression in R (50 points in total) A sample containing years to maturity and yield (percent) for 40 corporate bonds are contained in the
1.Nonlinear regression in R (50 points in total)
A sample containingyears to maturityandyield (percent)for 40 corporate bonds are contained in the provided CSV data file namedCorporateBonds.csv(Barron's, April 2, 2012).
2.1Import/read the externalCorporateBonds.csvdata file into a new variable namedbondsin RStudio using theread.table()function. Remember to specify the arguments for theheaderandseparguments correctly in the function. Then use thetail()function to show thelast 5 rowsof variablebonds. (5 points)
2.2First, you can develop abaseline simple linear regression (SLR) modelwhich uses a single independent variableYears ()to predict the dependent variableYield (). Store the built estimated baseline SLR equation's regression results into a new variable calledbonds.slr.fit. Then apply thesummary()function onbonds.slr.fitto show the regression report for this estimated baseline equation. How much percentage of variability inis explained by the estimated baseline equation according to? (10 points)
2.3Use theplot()function onbonds.slr.fitto get the diagnostic plots. Among the 4 diagnostic plots, show the diagnostic plot of Residuals vs Fitted here and use it to explain if the linearity assumption is violated or not. (5 points)
2.4Assume the baseline model violates the linearity assumption, you may now consider using aquadraticregression model to capture the remaining quadratic pattern in the residual plot. Develop a quadratic regression model with two independent variablesYears()andYears Squared ()to predict the dependent variableYield (). Store the built estimated quadratic regression equation's results into a new variable calledbonds.quad.fit. Then apply thesummary()function onbonds.quad.fitto show the regression report for this estimated quadratic regression equation. (10 points)
2.5According to the regression report for the estimated quadratic regression equation from part 2.4, is the overall quadratic regression model significant at the 5% significance level, and which number you use to make the conclusion? Are the individual coefficient estimates ofYearsandYears Squaredsignificant at the 5% level, and which numbers you use to make the conclusions? Per the providedvalue, how much percentage of variability in y is explained by the estimated quadratic regression equation? Do you see any improvement in terms ofby this quadratic regression equation, compared to the previous baseline SLR equation? (10 points)
2.6Use theplot()function onbonds.quad.fitto get the diagnostic plots. Show the diagnostic plot of Residuals vs Fitted here and use it to explain if the linearity assumption is severely violated or not. As a result, do you think the quadratic regression model is better than the baseline SLR model in terms of the linearity assumption and? Why or why not? (10 points)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started