Advertisement
Guest User

Untitled

a guest
Nov 15th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. ## SL Lab1 (zestaw 4)
  2.  
  3. library(ggplot2)
  4.  
  5. # PART 1 ------------------------------------------------------------------
  6.  
  7. dataset1<-part1_set04
  8.  
  9. #1
  10. #The data is normal if the p-value is above 0.05. So we now know our variable is normally distributed.
  11.  
  12. shapiro.test(dataset1$dose)
  13.  
  14.  
  15. shapiro.test(dataset1$concentration)
  16.  
  17.  
  18. #2
  19.  
  20. ggplot(dataset1, aes(x=dose, y=concentration)) + geom_point()
  21.  
  22. #3
  23. #install.packages("ggpubr")
  24. library("ggpubr")
  25.  
  26. r = cor(dataset1$dose, dataset1$concentration, method = "pearson")
  27.  
  28. #5
  29.  
  30. #b1 = (1/(n-1))*( (sum((xi-xŚr)(yi-yŚr))) / (sd(dataset1$dose)*sd(dataset1$concentration)) ) * ()
  31.  
  32. # b1 = r*(sd(dataset1$dose)/sd(dataset1$concentration))
  33. # b0 = mean(dataset1$dose) - b1*mean(dataset1$concentration)
  34.  
  35. b1 = r*(sd(dataset1$concentration)/sd(dataset1$dose))
  36. b0 = mean(dataset1$concentration) - b1*mean(dataset1$dose)
  37.  
  38. lm(dataset1)
  39.  
  40. ggplot(dataset1, aes(x=dose, y=concentration)) +
  41. geom_point(shape=1) +
  42. geom_smooth(method=lm, se=FALSE)
  43.  
  44. # PART 2 ------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement