Average public teacher pay and spending on public schools per pupil in 1985 for 50 states and the District of Columbia were reported by the Albuquerque Tribune in dataset Teacher_Pay.
Number of cases: 51
Variable Names:
PAY: Average public school teacher annual salary (in dollars)
SPEND: Spending on public schools per pupil (in dollars)
AREA: Region 1 - Northeast and North Central, Region 2-South, Region 3-West
Question 1: (2 pts) Use function names() to confirm the variables in the dataset
names(Teacher_Pay)
## [1] "STATE" "PAY" "SPEND" "AREA"
Question 2: (3 pts) It is believed that teachers are paid higher in school districts that spend more money on their pupils. Make a scatterplot of spending and teachers’ pay in which spending on public school per student is an explanatory variable .
xyplot(Teacher_Pay$PAY~Teacher_Pay$SPEND)
Question 3: (5 pts) Based on the scatterplot, do you think that there is a linear relationship between the spending and teachers’ pay variables? Find the correlation coefficient.
Answer: Yes I believe there is a linear relationship the corelation is .834 which indicates a strong linear correlation
lm(Teacher_Pay$PAY~Teacher_Pay$SPEND)
##
## Call:
## lm(formula = Teacher_Pay$PAY ~ Teacher_Pay$SPEND)
##
## Coefficients:
## (Intercept) Teacher_Pay$SPEND
## 12129.371 3.308
Question 4: (10 pts) Find the equation of the least-squares regression line. Now produce a scatterplot with the regression line. equation is y=12129.371 + 3.308X
xyplot(Teacher_Pay$PAY~Teacher_Pay$SPEND,type=c("P","r"))
Question 5: (10 pts) Make a boxplot of teachers’ pay broken down by Area. Comment on the distribution of teachers’ pay in each area.
Answer: for three it is extremely left skewed with a high median of about 26000 while 2 is relatively symetrical but a little skewed to the right with a simular overall range as three and has a median of about 22000 1 is slightly skewed to the left with a extemely larger range that 2 and 3 its median is in between the two at about 24500.
boxplot(Teacher_Pay$PAY~AREA, horizontal = TRUE)
Lastly, knit your work and submit on Moodle!