Guest User

Untitled

a guest
Jun 20th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. data <- read.table(text = " sample methodx methody
  2. 1 1 0.52 0.53
  3. 2 2 0.50 0.51
  4. 3 3 0.48 0.48
  5. 4 4 0.40 0.41
  6. 5 5 0.36 0.36
  7. 6 6 0.30 0.32
  8. 7 7 0.28 0.30
  9. 8 8 0.28 0.29", header = T)
  10.  
  11. # Regression analysis
  12. model <- lm(data$methodx ~ data$methody)
  13. summary(model)
  14.  
  15. # Residuals:
  16. # Min 1Q Median 3Q Max
  17. # -0.007317 -0.004931 -0.002012 0.004596 0.011341
  18. #
  19. # Coefficients:
  20. # Estimate Std. Error t value Pr(>|t|)
  21. # (Intercept) -0.02341 0.01181 -1.983 0.0946 .
  22. # data$methody 1.03354 0.02879 35.900 3.11e-08 ***
  23. # ---
  24. # Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
  25. #
  26. # Residual standard error: 0.007374 on 6 degrees of freedom
  27. # Multiple R-squared: 0.9954, Adjusted R-squared: 0.9946
  28. # F-statistic: 1289 on 1 and 6 DF, p-value: 3.115e-08
  29.  
  30. # Paired t-test
  31. t.test(data$methodx, data$methody, paired = TRUE)
  32.  
  33. # Paired t-test
  34. #
  35. # data: data$methodx and data$methody
  36. # t = -3.7417, df = 7, p-value = 0.007247
  37. # alternative hypothesis: true difference in means is not equal to 0
  38. # 95 percent confidence interval:
  39. # -0.016319724 -0.003680276
  40. # sample estimates:
  41. # mean of the differences
  42. # -0.01
  43.  
  44. x = runif(30, -5, 10)
  45. y = jitter(1.2*x)
  46.  
  47. summary(lm(y~x))
  48.  
  49. x1 = runif(30, -5, 10)
  50. x2 = runif(30, -5, 5)
  51. x3 = runif(30, -5, 0)
  52.  
  53. null_model <- lm(methodx ~ offset(1*methody) -1, data=data)
  54.  
  55. anova(model, null_model)
  56.  
  57. Model 1: methodx ~ methody
  58. Model 2: methodx ~ offset(1 * methody) - 1
  59. Res.Df RSS Df Sum of Sq F Pr(>F)
  60. 1 6 0.00032622
  61. 2 8 0.00120000 -2 -0.00087378 8.0355 0.02009 *
Add Comment
Please, Sign In to add comment