Reading the file into R and Viewing

setwd("~/SIP/SIP Phase 2/R Programming/Udemy Class Material/Week 4")
MBASalaries.df <- read.csv(paste("MBA Starting Salaries Data.csv", sep=""))
View(MBASalaries.df)

Subsetting the data and replacing the factors with appropriate

placed <- subset(MBASalaries.df, salary != "999" & salary != "998" & salary != "0")
unplaced <- subset(MBASalaries.df, salary != "0")
salarydata <- subset(MBASalaries.df, salary != "998" & salary != "999")
satisdata <- subset(MBASalaries.df, satis != "998" & satis != "999")
MBASalaries.df$sex <- factor(MBASalaries.df$sex, levels = c(1,2), labels = c("Male", "Female"))
MBASalaries.df$frstlang <- factor(MBASalaries.df$frstlang, levels = c(1,2), labels = c("English", "Others"))

Histograms to see the distribution of different variables

library(lattice)
## Warning: package 'lattice' was built under R version 3.4.3
histogram(placed$salary, type="count", xlab = "Salary ($)", ylab="No. of students", col="gray50")

histogram(MBASalaries.df$gmat_tot, type="count", xlab = "GMAT Scores", ylab="No. of students", col="gray50")

histogram(MBASalaries.df$age, type="count", xlab = "Age", ylab="No. of students", col="gray50")

histogram(MBASalaries.df$work_yrs, type="count", xlab = "Work Experience", ylab="No. of students", col="gray50")

Effect of age and gender

histogram(MBASalaries.df$age, type="count", xlab = "Age", ylab="No. of students", col="gray50")

histogram(MBASalaries.df$sex, type = "count", xlab = "Gender", ylab = "No of students", col = "gray50")

table(MBASalaries.df$sex)
## 
##   Male Female 
##    206     68
prop.table(table(MBASalaries.df$sex))*100
## 
##     Male   Female 
## 75.18248 24.81752
AG <- aggregate(cbind(age, salary, gmat_tot, f_avg, s_avg) ~ sex, data = placed, mean)
AG
##   sex      age    salary gmat_tot    f_avg    s_avg
## 1   1 27.08333 104970.97 616.6667 3.038194 3.072361
## 2   2 26.06452  98524.39 614.5161 3.213548 3.138710
histogram(~salary | sex + frstlang, data = placed, type = "count", layout = c(2,2), col =  "lightgray")

#75.18% of the studenst are male and 24.82% of students are female. The avg age of male students who are placed is 27 and that of female students is 26 and there is a significant difference between the avg. salaries if male and female students who are placed.

library(car)
## Warning: package 'car' was built under R version 3.4.3
scatterplot(placed$age, placed$salary, xlab="Age", ylab="Salary of placed students ($)")

cor(placed$age, placed$salary)
## [1] 0.4996428
cor.test(placed$age, placed$salary)
## 
##  Pearson's product-moment correlation
## 
## data:  placed$age and placed$salary
## t = 5.7968, df = 101, p-value = 7.748e-08
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.3388862 0.6320523
## sample estimates:
##       cor 
## 0.4996428

The scatterplot and the correlation tests show a strong positive correlation with the salary of placed students

scatterplot(placed$work_yrs, placed$salary, xlab="Work Experience (Yrs.)", ylab="Salary of placed students ($)")

cor(placed$work_yrs, placed$salary)
## [1] 0.4546663
cor.test(placed$work_yrs, placed$salary)
## 
##  Pearson's product-moment correlation
## 
## data:  placed$work_yrs and placed$salary
## t = 5.1303, df = 101, p-value = 1.403e-06
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2863362 0.5957697
## sample estimates:
##       cor 
## 0.4546663

There is a strong positive correlation between Work Exp. and salary of the students who are placed.

Effect of students liking

boxplot(placed$salary ~ placed$satis, horizontal=TRUE, xlab="Salary ($)", ylab="Satisfaction Rating")

boxplot(satisdata$satis ~ satisdata$sex, horizontal=TRUE, xlab="Salary ($)", ylab="Satisfaction Rating")

library(car)
scatterplot(placed$satis, placed$salary, xlab="Satisfaction Rating", ylab="Salary ($)")

cor(placed$satis, placed$salary)
## [1] -0.0400506
cor.test(placed$satis, placed$salary)
## 
##  Pearson's product-moment correlation
## 
## data:  placed$satis and placed$salary
## t = -0.40283, df = 101, p-value = 0.6879
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2317788  0.1546729
## sample estimates:
##        cor 
## -0.0400506

From the scatterplot and the correlation tests, it is evident that there is a weak correaltion between Satisfaction Rating and Salary.

Effect of GMAT Score

scatterplot(placed$gmat_tot, placed$salary, xlab="GMAT Scores", ylab="Salary")

cor(placed$gmat_tot,placed$salary)
## [1] -0.09067141
cor.test(placed$gmat_tot,placed$salary)
## 
##  Pearson's product-moment correlation
## 
## data:  placed$gmat_tot and placed$salary
## t = -0.91501, df = 101, p-value = 0.3624
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2792952  0.1046903
## sample estimates:
##         cor 
## -0.09067141

Weak correlation between salary and gmat score of students who are placed

Effect of Language

boxplot(placed$salary ~ placed$frstlang, xlab="Salary ($)", ylab="Language")

boxplot(placed$salary ~ placed$frstlang, horizontal = TRUE, xlab="Salary ($)", ylab="Language")

lang <- aggregate(cbind(salary, gmat_tot, work_yrs)~frstlang, data = placed, mean)
lang
##   frstlang   salary gmat_tot work_yrs
## 1        1 101748.6 617.8125 3.520833
## 2        2 120614.3 591.4286 5.857143
langtable <- table(MBASalaries.df$frstlang)
prop.table(langtable)*100
## 
##  English   Others 
## 88.32117 11.67883

Though a high number of students have ENglish as their first language, the avg. salary of students speaking other languages is higher than students who speak english as first language, among the placed students.

regression analysis of MBA Starting salary

colsal <- c("age", "salary", "gmat_tot", "gmat_qpc", "gmat_vpc", "gmat_tpc", "s_avg", "f_avg", "work_yrs")
cor(placed[, colsal])
##                  age      salary    gmat_tot    gmat_qpc    gmat_vpc
## age       1.00000000  0.49964284 -0.07871678 -0.16503906  0.01799420
## salary    0.49964284  1.00000000 -0.09067141  0.01414130 -0.13743230
## gmat_tot -0.07871678 -0.09067141  1.00000000  0.66638227  0.78038546
## gmat_qpc -0.16503906  0.01414130  0.66638227  1.00000000  0.09466541
## gmat_vpc  0.01799420 -0.13743230  0.78038546  0.09466541  1.00000000
## gmat_tpc -0.09609156 -0.13201783  0.96680810  0.65865003  0.78443167
## s_avg     0.15654954  0.10173175  0.17198874  0.01547166  0.15865101
## f_avg    -0.21699191 -0.10603897  0.12246257  0.09841887  0.02290167
## work_yrs  0.88052470  0.45466634 -0.12280018 -0.18270126 -0.02812182
##             gmat_tpc      s_avg       f_avg    work_yrs
## age      -0.09609156 0.15654954 -0.21699191  0.88052470
## salary   -0.13201783 0.10173175 -0.10603897  0.45466634
## gmat_tot  0.96680810 0.17198874  0.12246257 -0.12280018
## gmat_qpc  0.65865003 0.01547166  0.09841887 -0.18270126
## gmat_vpc  0.78443167 0.15865101  0.02290167 -0.02812182
## gmat_tpc  1.00000000 0.13938500  0.07051391 -0.13246963
## s_avg     0.13938500 1.00000000  0.44590413  0.16328236
## f_avg     0.07051391 0.44590413  1.00000000 -0.21633018
## work_yrs -0.13246963 0.16328236 -0.21633018  1.00000000
library(corrgram)
## Warning: package 'corrgram' was built under R version 3.4.3
corrgram(placed[, colsal], order =TRUE, lower.panel=panel.shade, upper.panel=panel.pie, txt.panel=panel.txt, main = "Corrgram of important variables in the dataset")
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy.coords(x, y), type = type, ...): "txt.panel" is not a
## graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter
## Warning in plot.window(...): "txt.panel" is not a graphical parameter
## Warning in plot.xy(xy, type, ...): "txt.panel" is not a graphical parameter
## Warning in title(...): "txt.panel" is not a graphical parameter

fit <- lm(salary ~ age + gmat_tot + gmat_qpc + gmat_vpc + gmat_tpc + s_avg + f_avg + work_yrs, data = placed)
summary(fit)
## 
## Call:
## lm(formula = salary ~ age + gmat_tot + gmat_qpc + gmat_vpc + 
##     gmat_tpc + s_avg + f_avg + work_yrs, data = placed)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -31270  -7556    665   5143  69407 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)  
## (Intercept) 43964.6689 47268.2859   0.930   0.3547  
## age          2363.9733   992.6810   2.381   0.0193 *
## gmat_tot       -0.7838   165.5112  -0.005   0.9962  
## gmat_qpc      868.1298   483.7421   1.795   0.0759 .
## gmat_vpc      546.2923   483.7512   1.129   0.2617  
## gmat_tpc    -1467.2112   704.7030  -2.082   0.0401 *
## s_avg        3895.8927  4857.2091   0.802   0.4245  
## f_avg       -1709.7057  3783.2060  -0.452   0.6524  
## work_yrs      372.0196  1082.6051   0.344   0.7319  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 15360 on 94 degrees of freedom
## Multiple R-squared:  0.319,  Adjusted R-squared:  0.261 
## F-statistic: 5.503 on 8 and 94 DF,  p-value: 1.05e-05

The R-squared value is 0.319 which proves that this is a poor model to predict the starting MBA salary. And only age, gmat_tpc variables are statistically significant

Another regression model

fit1 <- lm(salary~age+gmat_tpc+sex+frstlang, data = placed)
summary(fit1)
## 
## Call:
## lm(formula = salary ~ age + gmat_tpc + sex + frstlang, data = placed)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -30445  -8532  -1781   6306  77081 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  47248.3    19749.3   2.392   0.0186 *  
## age           2387.6      509.9   4.683 9.11e-06 ***
## gmat_tpc      -125.6      141.6  -0.887   0.3773    
## sex          -4474.5     3398.7  -1.317   0.1911    
## frstlang      7761.1     6597.3   1.176   0.2423    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 15500 on 98 degrees of freedom
## Multiple R-squared:  0.2772, Adjusted R-squared:  0.2477 
## F-statistic: 9.394 on 4 and 98 DF,  p-value: 1.806e-06

The intercept and age are statistically significant in predictin the MBA Starting salary. This is not a good regression model since the R-squared value is 0.2772.