Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- > newdata <- read.csv(file="nr129717.csv", header=TRUE)
- > head(newdata)
- y x1 x2
- 1 19.15372 0.72292566 9.236719
- 2 11.13821 0.01474544 6.182988
- 3 18.06823 0.77878730 8.986456
- 4 12.08616 0.16159705 6.124310
- 5 16.72357 0.01543808 8.371611
- 6 10.68216 0.72488182 5.557159
- > newy <- newdata[1]
- > newx1 <- newdata[2]
- > newx2 <- newdata[3]
- > newy <- as.numeric(unlist(newy))
- > newx1 <- as.numeric(unlist(newx1))
- > newx2 <- as.numeric(unlist(newx2))
- > l1 <- lm(newy~newx1+newx2)
- > summary(l1)
- Call:
- lm(formula = newy ~ newx1 + newx2)
- Residuals:
- Min 1Q Median 3Q Max
- -6.1083 -0.9389 -0.0545 0.9359 6.3030
- Coefficients:
- Estimate Std. Error t value Pr(>|t|)
- (Intercept) -0.98126 0.27923 -3.514 0.000461 ***
- newx1 0.94132 0.17442 5.397 8.48e-08 ***
- newx2 2.01244 0.03499 57.520 < 2e-16 ***
- ---
- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
- Residual standard error: 1.614 on 997 degrees of freedom
- Multiple R-squared: 0.7706, Adjusted R-squared: 0.7702
- F-statistic: 1675 on 2 and 997 DF, p-value: < 2.2e-16
- > library(tseries)
- > err <- residuals(l1)
- > jarque.bera.test(err)
- Jarque Bera Test
- data: err
- X-squared = 61.872, df = 2, p-value = 3.675e-14
- > library(lmtest)
- > dwtest(newy~newx1+newx2)
- Durbin-Watson test
- data: newy ~ newx1 + newx2
- DW = 2.04, p-value = 0.7365
- alternative hypothesis: true autocorrelation is greater than 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement