Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. > newdata <- read.csv(file="nr129717.csv", header=TRUE)
  2. > head(newdata)
  3. y x1 x2
  4. 1 19.15372 0.72292566 9.236719
  5. 2 11.13821 0.01474544 6.182988
  6. 3 18.06823 0.77878730 8.986456
  7. 4 12.08616 0.16159705 6.124310
  8. 5 16.72357 0.01543808 8.371611
  9. 6 10.68216 0.72488182 5.557159
  10. > newy <- newdata[1]
  11. > newx1 <- newdata[2]
  12. > newx2 <- newdata[3]
  13. > newy <- as.numeric(unlist(newy))
  14. > newx1 <- as.numeric(unlist(newx1))
  15. > newx2 <- as.numeric(unlist(newx2))
  16. > l1 <- lm(newy~newx1+newx2)
  17. > summary(l1)
  18.  
  19. Call:
  20. lm(formula = newy ~ newx1 + newx2)
  21.  
  22. Residuals:
  23. Min 1Q Median 3Q Max
  24. -6.1083 -0.9389 -0.0545 0.9359 6.3030
  25.  
  26. Coefficients:
  27. Estimate Std. Error t value Pr(>|t|)
  28. (Intercept) -0.98126 0.27923 -3.514 0.000461 ***
  29. newx1 0.94132 0.17442 5.397 8.48e-08 ***
  30. newx2 2.01244 0.03499 57.520 < 2e-16 ***
  31. ---
  32. Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
  33.  
  34. Residual standard error: 1.614 on 997 degrees of freedom
  35. Multiple R-squared: 0.7706, Adjusted R-squared: 0.7702
  36. F-statistic: 1675 on 2 and 997 DF, p-value: < 2.2e-16
  37.  
  38. > library(tseries)
  39. > err <- residuals(l1)
  40. > jarque.bera.test(err)
  41.  
  42. Jarque Bera Test
  43.  
  44. data: err
  45. X-squared = 61.872, df = 2, p-value = 3.675e-14
  46.  
  47. > library(lmtest)
  48. > dwtest(newy~newx1+newx2)
  49.  
  50. Durbin-Watson test
  51.  
  52. data: newy ~ newx1 + newx2
  53. DW = 2.04, p-value = 0.7365
  54. alternative hypothesis: true autocorrelation is greater than 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement