Advertisement
Guest User

Untitled

a guest
Sep 17th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. ---
  2. title: "Assignment 1 - SAT"
  3. author: "Nikola Danevski"
  4. date: "9/14/2019"
  5. output: pdf_document
  6. ---
  7.  
  8. ```{r setup, include=FALSE}
  9. knitr::opts_chunk$set(echo = TRUE)
  10. ```
  11.  
  12. We plot SAT score against professor salary below.
  13. There is no relationship between the two entries (although one could argue it is weak, linear and negative).
  14. 1 = "black", 2 = "red", 3 = "green". The plot says that #TODO WHAT EXACTLY
  15.  
  16. ```{r}
  17. sat <- read.csv("SAT.csv")
  18. head(sat)
  19. #TODO what does c) ask us to do?
  20. cor(sat$salary, sat$sat)
  21. group_frac <- cut(sat$frac, breaks=c(0,22,49,81), labels = c(1,2,3))
  22. plot(x = sat$salary, y = sat$sat, xlab = "Salary of the professor", ylab = "Sat score", col = group_frac)
  23. cor(sat$salary[group_frac == 1], sat$sat[group_frac == 1])
  24. cor(sat$salary[group_frac == 2], sat$sat[group_frac == 2])
  25. cor(sat$salary[group_frac == 3], sat$sat[group_frac == 3])
  26.  
  27. expendCAT <- ifelse(SAT$expend > 7, "high", "low")
  28. sat900 <- ifelse(SAT$sat > 900, "Higher", "Lower")
  29.  
  30.  
  31.  
  32.  
  33. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement