Question: 2. Need help with the variables that were excluded(Highlighted below) 2 Stepwise main effects model Fit the full model g.main: salary ~ . Hide g.main
2. Need help with the variables that were excluded(Highlighted below)
2 Stepwise main effects model Fit the full model g.main: salary ~ . Hide g.main |t/) (Intercept) 65955.2 4588. 6 14. 374 1. 9812e+11 7965.2 yrs . since. phd 1 2 . 5041e+09 2. 0062e+11 7968.2 yrs . service 1 2. 7100e+09 2. 0083e+11 7968.6 discipline 1 1. 9237e+10 2. 1735e+11 8000.0 rank 2 6. 950Be+10 2. 6762e+11 8080.6 Step: AIC=7964. 75 salary ~ rank + discipline + yrs. since.phd + yrs. service of Sum of Sq RSS AIC 1. 9890e+11 7964.8 + sex 1 7. 806Be+08 1. 9812e+11 7965.2 - yrs . since . phd 1 2. 5001e+09 2. 0140e+11 7967.7 - yrs . service 1 2. 5763e+09 2. 0147e+11 7967.9 discipline 1 1. 9489e+10 2. 1839e+11 7999.9 rank 2 7. 0679e+10 2. 6958e+11 8081.5 Hide summary (g . step) Call : Im (formula = salary ~ rank + discipline + yrs. since. phd + yrs. service, data = Salaries) Residuals: in 10 Median 30 Max -65244 -13498 -1455 9638 99682 Coefficients: Estimate Std. Error t value Pr (>|t/) (Intercept) 69869.0 3332.1 20.968 [t/ ) (Intercept) 53684.011 4169. 552 12. 875 2 . 2657e+11 8014.5 yrs . service 1 1. 4482e+09 2. 2801e+11 8015.0 discipline 1 2. 3114e+10 2. 4968e+11 8051.0 I (yrs . since . phd*2) 1 4. 3010e+10 2. 6958e+11 8081.5 yrs . since . phd 1 7. 8715e+10 3. 052Be+11 8130.8 Hide summary (g . quad . step) Call : Im (formula = salary ~ discipline + yrs. since. phd + I (yrs. since.phd*2) + yrs . service, data = Salaries) Residuals : Min 10 Median 30 Max -59288 -15808 -2076 12285 96488 Coefficients: Estimate Std. Error t value Pr (> |t/ ) (Intercept) 53684. 011 4169. 552 12. 875 1 . 8951e+11 7955.6 poly (yrs. service, 3) 3 6.1473e+09 1. 9566e+11 7962.2 poly (yrs . since . phd, 3) 3 1. 0402e+10 1. 999le+11 7970.8 discipline 1 1. 8610e+10 2. 0812e+11 7990.7 rank 2 2. 9557e+10 2. 1906e+11 8009.1 Step: AIC=7955.4 salary ~ rank + discipline + poly (yrs. since.phd, 3) + poly(yrs. service, 3) Df Sum of Sq RSS AIC 1. 9039e+11 7955.4 sex 1 8. 8334e+08 1. 8951e+11 7955.6 poly (yrs . service, 3) 3 6. 0107e+09 1. 9640e+11 7961.7 poly (yrs. since. phd, 3) 3 1. 0409e+10 2. 0080e+11 7970.5 discipline 1 1. 8870e+10 2. 0926e+11 7990.9 - rank 2 3. 1177e+10 2. 2157e+11 8011.6 Compare coefficients of all models: g.poly3 and g.poly3.step Hide coef (9. poly3) (Intercept) sexMale rankAssocProf rankProf 72520.216 5121. 782 11226. 867 40324 . 075 disciplineApplied poly (yrs. since.phd, 3)1 poly (yrs. since.phd, 3)2 poly (yrs. since. phd, 3) 3 14225.078 134959. 712 -84857.343 -105180 . 793 poly (yrs. service, 3) 1 poly (yrs . service, 3)2 poly (yrs . service, 3) 3 -93991. 634 49870.710 78499.233 Hide coef (9 . poly3. step) ( Intercept) rankAssocProf rankProf disciplineApplied 76226.77 11840 .12 41462.55 14317.73 poly (yrs . since.phd, 3) 1 poly (yrs. since. phd, 3)2 poly (yrs. since.phd, 3)3 poly (yrs . service, 3)1coef (g. poly3) (Intercept) sexMale rankAssocProf rankProf 72520. 216 5121 . 782 11226.867 40324.075 disciplineApplied poly (yrs. since. phd, 3)1 poly (yrs . since. phd, 3)2 poly (yrs. since. phd, 3)3 14225.078 134959. 712 -84857. 343 -105180 .793 poly (yrs . service, 3)1 poly (yrs . service, 3)2 poly (yrs. service, 3) 3 -93991 . 634 49870. 710 78499.233 Hide coef (g. poly3 . step) (Intercept) rankAssocProf rankProf disciplineApplied 76226.77 11840. 12 41462.55 14317 .73 poly (yrs . since .phd, 3)1 poly (yrs. since. phd, 3)2 poly (yrs. since. phd, 3)3 poly (yrs . service, 3)1 131838 . 27 -80680.09 -107485.90 -91867 .57 poly (yrs . service, 3) 2 poly (yrs . service, 3)3 50991 . 53 77368.75 What are the differences between these two models"coef (g. poly3. inter . step) (Intercept) sexMale -118120 .542 13770 . 785 poly (yrs . since . phd, 3)1 poly (yrs . since . phd, 3)2 4740089 . 054 -2337558 . 713 poly (yrs . since . phd, 3) 3 rankAssocProf 775696.373 9074 . 313 rankProf disciplineApplied 35999. 226 23375.381 poly (yrs . service, 3)1 poly (yrs . service, 3)2 -7286049.974 -5336918 . 068 poly (yrs. service, 3)3 sexMale : disciplineApplied -1605412 . 989 -12557 . 564 poly (yrs . since. phd, 3) 1 :disciplineApplied poly (yrs . since . phd, 3) 2:disciplineApplied -239656. 728 -9110. 802 poly (yrs . since. phd, 3) 3:disciplineApplied poly (yrs. since. phd, 3) 1:poly (yrs. service, 3)1 183103. 477 146319898. 947 poly (yrs . since. phd, 3)2:poly (yrs. service, 3)1 poly (yrs. since. phd, 3)3:poly (yrs. service, 3)1 -84051963.723 27380870 . 635 poly (yrs. since.phd, 3) 1:poly(yrs. service, 3)2 poly (yrs. since.phd, 3)2:poly (yrs. service, 3)2 113926718 . 349 -60716199. 062 poly (yrs . since.phd, 3)3:poly(yrs. service, 3)2 poly(yrs. since. phd, 3)1:poly (yrs. service, 3)3 11275603 . 472 35209365.733 poly (yrs . since.phd, 3) 2:poly (yrs . service, 3)3 poly (yrs. since. phd, 3)3:poly (yrs. service, 3)3 -12122563. 966 737997.228 disciplineApplied:poly (yrs . service, 3)1 disciplineApplied:poly (yrs . service, 3)2 215948 . 504 -128962. 986 disciplineApplied: poly (yrs. service, 3)3 -124326. 282 What is the difference in salary between men versus women?Instructions: Do your homework in RStudio. Start with a new notebook file in the source window. Create only one notebook file. Compile the results into an HTML file. . Upload only one HTML file. . Please do not email your homework to the professor. Data: . Use the Salaries data in the car package. . See the appendix for a complete description of the data. . Delete all records with NAs. . The following code may be helpful. # install. packages("car", repos = 'http://cran.rstudio. com') #Run once only library (car) data (Salaries) 1 Data Preprocessing Apply the labels "Theoretical" and "Applied" to discipline. 2 Stepwise main effects model . Fit the full model g.main: (salary - . . Obtain the coefficient estimates, standard error of estimates, t-value, and p-value. . Obtain the summary Estimated coefficients, Std. Error, t-value, p-value. . Run AIC stepwise regression on g.main, and save the results into g.step Run a comparison of the coefficients of the two models, g.main and g.step. Which predictor variable(s) are excluded from the final model?3 Scatterplot Matrix . Obtain the scatterplot matrix with these specifications: the variables in this order: c("sex\7 Cubic model using poly() Fit a 3rd degree polynomial: g-poly3: (salary ~ sex + rank + discipline + poly(yrs. since.phd, 3) + poly(yrs. service, 3) Obtain the summary Estimated coefficients, Std. Error, t-value, p-value. Run AIC stepwise on g.poly3 and save the results in g.poly2.step Compare coefficients of all models: g.poly3 and g-poly3.step What are the differences between these two models" 8 Interaction-poly3 Model Fit the interaction model g.poly3.inter: (salary ~ (sex + rank + discipline) * (poly(yrs. since.phd, 3) + poly(yrs. service, 3)) Note: A long way to write the model g-poly3.inter: (salary ~ sex * (poly(yrs. since.phd, 3) + discipline: poly(yrs. service, 3)) + rank * (poly(yrs.since.phd, 3) + discipline:poly(yrs.service, 3)) + discipline*(poly(yrs.since.phd, 3) + discipline: poly(yrs. service, 3)) Obtain the summary Estimated coefficients, Std. Error, t-value, p-value. Run AIC stepwise on g.poly3.inter and save the results in g.poly3.inter.step. Obtain the summary Estimated coefficients, Std. Error, t-value, p-value. What is the difference in salary between men versus women? 9 Compare coefficients Compare coefficients of all stepwise models constructed so far. 10 Perform a cross-validation of all the stepwise models . Using folds equal to 3, perform a cross-validation of all the stepwise models: (g.poly2. step, g.poly2. inter. step, g.poly3. step, g. poly3. inter. step). Repeat the CV 10 times using a (for loop. Save the mse values in a separate dataframe. 11 Compare all the above stepwise models using the mse's Compare all the above models using the mse's from the cross-validations with the number of folds equal to 3. . Which model wins most of the CV's? 12 Which models pass hypothesis testing? g.poly2.step vs g.poly2.inter.step Perform the ANOVA test of models g.poly2.step vs g.poly2.inter.step What is the p-value? Using (alpha
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
Students Have Also Explored These Related Mathematics Questions!