Question
Question 1. The data salary.txt collects the salary data from a company. We want to study the relationship of the salary (salary) and the number
Question 1. The data salary.txt collects the salary data from a company. We want to study the relationship of the salary (salary) and the number of years of working experience (years). The response variable is salary, and the explanatory variable is years. Use R to answer the following questions.
-
[5 pts] Perform the F test to determine whether or not a linear regression function is a good fit for the relationship between the mean salary and the number of years of working experience. Perform the test at the significance level 0.05. State the null and alternative hypotheses (using either plain English or mathematical expression), F test statistic value, p-value, and conclusion.
-
(f) [5 pts] Find an appropriate transformation of the response variable via the Box-Cox procedure using the R function boxcox. Consider five candidate values, = 1, 0.5, 0, 0.5, 2. Print out the log-likelihood for each value. Choose the optimal value which has the maximum log-likelihood.
-
(g) [5 pts] Perform a natural logarithm transformation on the salary, and fit an SLRM in which the response variable is the logarithm transformed salary, and the explanatory variable is the number of years of experience. (i) Print out the summary of the fitted SLRM. (ii) Create a scatter plot of the transformed salary versus the number of years of experience with the fitted regression line. Does the regression line appear to be a good fit to the transformed data?
-
(h) [5 pts] Create two residual plots for the SLRM obtained in part (g): (i) a scatter plot of the studentized residuals versus the fitted values with three horizontal reference lines: -3, 0, 3, (ii) a QQ plot of the residuals. Are these two plots show any evidence indicating violations to the assumptions of an SLRM? If yes, please explain.
years salary 1 41504 1 32619 1 44322 2 40038 2 46147 2 38447 2 38163 3 42104 3 25597 3 39599 3 55698 4 47220 4 65929 4 55794 4 45959 5 52460 5 60308 5 61458 5 56951 6 56174 6 59363 6 57642 6 69792 7 59321 7 66379 7 64282 7 48901 8 100711 8 59324 8 54752 8 73619 9 65382 9 58823 9 65717 9 92816 9 72550 10 71365 10 88888 10 62969 10 45298 11 111292 11 91491 11 106345 11 99009 12 73981 12 72547 12 74991 12 139249 13 119948 13 128962 13 98112 13 97159 14 125246 14 89694 14 73333 14 108710 15 97567 15 90359 15 119806 15 101343 16 147406 16 153020 16 143200 16 97327 17 184807 17 146263 17 127925 17 159785 17 174822 18 177610 18 210984 18 160044 18 137044 19 182996 19 184183 19 168666 19 121350 20 193627 20 142611 20 170131 20 134140 21 129446 21 201469 21 202104 21 220556 22 166419 22 149044 22 247017 22 247730 23 252917 23 235517 23 241276 23 197229 24 175879 24 253682 24 262578 24 207715 25 221179 25 212028 25 312549
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