R version 2.9.0 (2009-04-17)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> x <- array(list(423,114,427,116,441,153,449,162,452,161,462,149,455,139,461,135,461,130,463,127,462,122,456,117,455,112,456,113,472,149,472,157,471,157,465,147,459,137,465,132,468,125,467,123,463,117,460,114,462,111,461,112,476,144,476,150,471,149,453,134,443,123,442,116,444,117,438,111,427,105,424,102,416,95,406,93,431,124,434,130,418,124,412,115,404,106,409,105,412,105,406,101,398,95,397,93,385,84,390,87,413,116,413,120,401,117,397,109,397,105,409,107,419,109,424,109,428,108,430,107),dim=c(2,60),dimnames=list(c('Y','X'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Y','X'),1:60))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Include Monthly Dummies'
> par1 = '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 423 114 1 0 0 0 0 0 0 0 0 0 0
2 427 116 0 1 0 0 0 0 0 0 0 0 0
3 441 153 0 0 1 0 0 0 0 0 0 0 0
4 449 162 0 0 0 1 0 0 0 0 0 0 0
5 452 161 0 0 0 0 1 0 0 0 0 0 0
6 462 149 0 0 0 0 0 1 0 0 0 0 0
7 455 139 0 0 0 0 0 0 1 0 0 0 0
8 461 135 0 0 0 0 0 0 0 1 0 0 0
9 461 130 0 0 0 0 0 0 0 0 1 0 0
10 463 127 0 0 0 0 0 0 0 0 0 1 0
11 462 122 0 0 0 0 0 0 0 0 0 0 1
12 456 117 0 0 0 0 0 0 0 0 0 0 0
13 455 112 1 0 0 0 0 0 0 0 0 0 0
14 456 113 0 1 0 0 0 0 0 0 0 0 0
15 472 149 0 0 1 0 0 0 0 0 0 0 0
16 472 157 0 0 0 1 0 0 0 0 0 0 0
17 471 157 0 0 0 0 1 0 0 0 0 0 0
18 465 147 0 0 0 0 0 1 0 0 0 0 0
19 459 137 0 0 0 0 0 0 1 0 0 0 0
20 465 132 0 0 0 0 0 0 0 1 0 0 0
21 468 125 0 0 0 0 0 0 0 0 1 0 0
22 467 123 0 0 0 0 0 0 0 0 0 1 0
23 463 117 0 0 0 0 0 0 0 0 0 0 1
24 460 114 0 0 0 0 0 0 0 0 0 0 0
25 462 111 1 0 0 0 0 0 0 0 0 0 0
26 461 112 0 1 0 0 0 0 0 0 0 0 0
27 476 144 0 0 1 0 0 0 0 0 0 0 0
28 476 150 0 0 0 1 0 0 0 0 0 0 0
29 471 149 0 0 0 0 1 0 0 0 0 0 0
30 453 134 0 0 0 0 0 1 0 0 0 0 0
31 443 123 0 0 0 0 0 0 1 0 0 0 0
32 442 116 0 0 0 0 0 0 0 1 0 0 0
33 444 117 0 0 0 0 0 0 0 0 1 0 0
34 438 111 0 0 0 0 0 0 0 0 0 1 0
35 427 105 0 0 0 0 0 0 0 0 0 0 1
36 424 102 0 0 0 0 0 0 0 0 0 0 0
37 416 95 1 0 0 0 0 0 0 0 0 0 0
38 406 93 0 1 0 0 0 0 0 0 0 0 0
39 431 124 0 0 1 0 0 0 0 0 0 0 0
40 434 130 0 0 0 1 0 0 0 0 0 0 0
41 418 124 0 0 0 0 1 0 0 0 0 0 0
42 412 115 0 0 0 0 0 1 0 0 0 0 0
43 404 106 0 0 0 0 0 0 1 0 0 0 0
44 409 105 0 0 0 0 0 0 0 1 0 0 0
45 412 105 0 0 0 0 0 0 0 0 1 0 0
46 406 101 0 0 0 0 0 0 0 0 0 1 0
47 398 95 0 0 0 0 0 0 0 0 0 0 1
48 397 93 0 0 0 0 0 0 0 0 0 0 0
49 385 84 1 0 0 0 0 0 0 0 0 0 0
50 390 87 0 1 0 0 0 0 0 0 0 0 0
51 413 116 0 0 1 0 0 0 0 0 0 0 0
52 413 120 0 0 0 1 0 0 0 0 0 0 0
53 401 117 0 0 0 0 1 0 0 0 0 0 0
54 397 109 0 0 0 0 0 1 0 0 0 0 0
55 397 105 0 0 0 0 0 0 1 0 0 0 0
56 409 107 0 0 0 0 0 0 0 1 0 0 0
57 419 109 0 0 0 0 0 0 0 0 1 0 0
58 424 109 0 0 0 0 0 0 0 0 0 1 0
59 428 108 0 0 0 0 0 0 0 0 0 0 1
60 430 107 0 0 0 0 0 0 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X M1 M2 M3 M4
249.2780 1.7272 0.6726 -1.2547 -39.6530 -48.8527
M5 M6 M7 M8 M9 M10
-51.2528 -37.3988 -28.3992 -17.6176 -10.9086 -6.9269
M11
-2.6362
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-32.890 -6.127 1.091 7.658 20.328
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 249.2780 14.9481 16.676 < 2e-16 ***
X 1.7272 0.1291 13.378 < 2e-16 ***
M1 0.6726 8.2600 0.081 0.935451
M2 -1.2547 8.2541 -0.152 0.879834
M3 -39.6530 9.1457 -4.336 7.62e-05 ***
M4 -48.8527 9.5448 -5.118 5.63e-06 ***
M5 -51.2528 9.4050 -5.450 1.81e-06 ***
M6 -37.3988 8.8202 -4.240 0.000104 ***
M7 -28.3992 8.4845 -3.347 0.001614 **
M8 -17.6176 8.4022 -2.097 0.041421 *
M9 -10.9086 8.3610 -1.305 0.198351
M10 -6.9269 8.3064 -0.834 0.408545
M11 -2.6362 8.2562 -0.319 0.750912
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 13.04 on 47 degrees of freedom
Multiple R-squared: 0.8043, Adjusted R-squared: 0.7544
F-statistic: 16.1 on 12 and 47 DF, p-value: 8.593e-13
> if (n > n25) {
+ kp3 <- k + 3
+ nmkm3 <- n - k - 3
+ gqarr <- array(NA, dim=c(nmkm3-kp3+1,3))
+ numgqtests <- 0
+ numsignificant1 <- 0
+ numsignificant5 <- 0
+ numsignificant10 <- 0
+ for (mypoint in kp3:nmkm3) {
+ j <- 0
+ numgqtests <- numgqtests + 1
+ for (myalt in c('greater', 'two.sided', 'less')) {
+ j <- j + 1
+ gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value
+ }
+ if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1
+ }
+ gqarr
+ }
[,1] [,2] [,3]
[1,] 0.8227741 3.544518e-01 1.772259e-01
[2,] 0.8430664 3.138672e-01 1.569336e-01
[3,] 0.9105368 1.789264e-01 8.946318e-02
[4,] 0.9554378 8.912448e-02 4.456224e-02
[5,] 0.9812811 3.743779e-02 1.871889e-02
[6,] 0.9937620 1.247594e-02 6.237968e-03
[7,] 0.9946327 1.073452e-02 5.367262e-03
[8,] 0.9985099 2.980184e-03 1.490092e-03
[9,] 0.9990751 1.849860e-03 9.249301e-04
[10,] 0.9997753 4.494005e-04 2.247003e-04
[11,] 0.9999523 9.546822e-05 4.773411e-05
[12,] 0.9998926 2.147172e-04 1.073586e-04
[13,] 0.9999352 1.296413e-04 6.482063e-05
[14,] 0.9999754 4.920406e-05 2.460203e-05
[15,] 0.9999989 2.139761e-06 1.069880e-06
[16,] 0.9999992 1.541244e-06 7.706219e-07
[17,] 0.9999998 4.638891e-07 2.319446e-07
[18,] 0.9999996 8.837606e-07 4.418803e-07
[19,] 0.9999999 1.684629e-07 8.423144e-08
[20,] 1.0000000 9.545548e-08 4.772774e-08
[21,] 1.0000000 4.583814e-08 2.291907e-08
[22,] 1.0000000 4.588902e-08 2.294451e-08
[23,] 0.9999999 2.143897e-07 1.071949e-07
[24,] 0.9999991 1.895711e-06 9.478557e-07
[25,] 0.9999939 1.214513e-05 6.072564e-06
[26,] 0.9999548 9.046310e-05 4.523155e-05
[27,] 0.9997039 5.921742e-04 2.960871e-04
[28,] 0.9994098 1.180420e-03 5.902100e-04
[29,] 0.9995349 9.302549e-04 4.651274e-04
> postscript(file="/var/www/html/rcomp/tmp/1nkm51258737047.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/2fcpw1258737047.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/3h9681258737047.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/4qqwn1258737047.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/5da8v1258737047.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 60
Frequency = 1
1 2 3 4 5 6
-23.85400659 -21.38122942 -32.89012075 -31.23545554 -24.10812294 -7.23545554
7 8 9 10 11 12
-5.96278814 -3.83556531 -1.90845225 1.29154775 4.63699232 4.63688255
13 14 15 16 17 18
11.60043908 12.80043908 5.01877058 0.40065862 1.80076839 -0.78100988
19 20 21 22 23 24
1.49165752 5.34610318 13.72766191 12.20043908 14.27310648 13.81855104
25 26 27 28 29 30
20.32766191 19.52766191 17.65488474 16.49121844 15.61855104 9.67288694
31 32 33 34 35 36
9.67277717 9.98166850 3.54544457 3.92711306 -1.00021954 -1.45477497
37 38 39 40 41 42
1.96322722 -2.65510428 7.19934138 9.03567508 5.79912184 1.49012075
43 44 45 46 47 48
0.03556531 -4.01888035 -7.72788145 -10.80065862 -12.72799122 -12.90976948
49 50 51 52 53 54
-10.03732162 -8.29176729 3.01712404 5.30790340 0.88968167 -3.14654226
55 56 57 58 59 60
-5.23721186 -7.47332602 -7.63677278 -6.61844127 -5.18188804 -4.09088913
> postscript(file="/var/www/html/rcomp/tmp/6m5bx1258737047.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 -23.85400659 NA
1 -21.38122942 -23.85400659
2 -32.89012075 -21.38122942
3 -31.23545554 -32.89012075
4 -24.10812294 -31.23545554
5 -7.23545554 -24.10812294
6 -5.96278814 -7.23545554
7 -3.83556531 -5.96278814
8 -1.90845225 -3.83556531
9 1.29154775 -1.90845225
10 4.63699232 1.29154775
11 4.63688255 4.63699232
12 11.60043908 4.63688255
13 12.80043908 11.60043908
14 5.01877058 12.80043908
15 0.40065862 5.01877058
16 1.80076839 0.40065862
17 -0.78100988 1.80076839
18 1.49165752 -0.78100988
19 5.34610318 1.49165752
20 13.72766191 5.34610318
21 12.20043908 13.72766191
22 14.27310648 12.20043908
23 13.81855104 14.27310648
24 20.32766191 13.81855104
25 19.52766191 20.32766191
26 17.65488474 19.52766191
27 16.49121844 17.65488474
28 15.61855104 16.49121844
29 9.67288694 15.61855104
30 9.67277717 9.67288694
31 9.98166850 9.67277717
32 3.54544457 9.98166850
33 3.92711306 3.54544457
34 -1.00021954 3.92711306
35 -1.45477497 -1.00021954
36 1.96322722 -1.45477497
37 -2.65510428 1.96322722
38 7.19934138 -2.65510428
39 9.03567508 7.19934138
40 5.79912184 9.03567508
41 1.49012075 5.79912184
42 0.03556531 1.49012075
43 -4.01888035 0.03556531
44 -7.72788145 -4.01888035
45 -10.80065862 -7.72788145
46 -12.72799122 -10.80065862
47 -12.90976948 -12.72799122
48 -10.03732162 -12.90976948
49 -8.29176729 -10.03732162
50 3.01712404 -8.29176729
51 5.30790340 3.01712404
52 0.88968167 5.30790340
53 -3.14654226 0.88968167
54 -5.23721186 -3.14654226
55 -7.47332602 -5.23721186
56 -7.63677278 -7.47332602
57 -6.61844127 -7.63677278
58 -5.18188804 -6.61844127
59 -4.09088913 -5.18188804
60 NA -4.09088913
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -21.38122942 -23.85400659
[2,] -32.89012075 -21.38122942
[3,] -31.23545554 -32.89012075
[4,] -24.10812294 -31.23545554
[5,] -7.23545554 -24.10812294
[6,] -5.96278814 -7.23545554
[7,] -3.83556531 -5.96278814
[8,] -1.90845225 -3.83556531
[9,] 1.29154775 -1.90845225
[10,] 4.63699232 1.29154775
[11,] 4.63688255 4.63699232
[12,] 11.60043908 4.63688255
[13,] 12.80043908 11.60043908
[14,] 5.01877058 12.80043908
[15,] 0.40065862 5.01877058
[16,] 1.80076839 0.40065862
[17,] -0.78100988 1.80076839
[18,] 1.49165752 -0.78100988
[19,] 5.34610318 1.49165752
[20,] 13.72766191 5.34610318
[21,] 12.20043908 13.72766191
[22,] 14.27310648 12.20043908
[23,] 13.81855104 14.27310648
[24,] 20.32766191 13.81855104
[25,] 19.52766191 20.32766191
[26,] 17.65488474 19.52766191
[27,] 16.49121844 17.65488474
[28,] 15.61855104 16.49121844
[29,] 9.67288694 15.61855104
[30,] 9.67277717 9.67288694
[31,] 9.98166850 9.67277717
[32,] 3.54544457 9.98166850
[33,] 3.92711306 3.54544457
[34,] -1.00021954 3.92711306
[35,] -1.45477497 -1.00021954
[36,] 1.96322722 -1.45477497
[37,] -2.65510428 1.96322722
[38,] 7.19934138 -2.65510428
[39,] 9.03567508 7.19934138
[40,] 5.79912184 9.03567508
[41,] 1.49012075 5.79912184
[42,] 0.03556531 1.49012075
[43,] -4.01888035 0.03556531
[44,] -7.72788145 -4.01888035
[45,] -10.80065862 -7.72788145
[46,] -12.72799122 -10.80065862
[47,] -12.90976948 -12.72799122
[48,] -10.03732162 -12.90976948
[49,] -8.29176729 -10.03732162
[50,] 3.01712404 -8.29176729
[51,] 5.30790340 3.01712404
[52,] 0.88968167 5.30790340
[53,] -3.14654226 0.88968167
[54,] -5.23721186 -3.14654226
[55,] -7.47332602 -5.23721186
[56,] -7.63677278 -7.47332602
[57,] -6.61844127 -7.63677278
[58,] -5.18188804 -6.61844127
[59,] -4.09088913 -5.18188804
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -21.38122942 -23.85400659
2 -32.89012075 -21.38122942
3 -31.23545554 -32.89012075
4 -24.10812294 -31.23545554
5 -7.23545554 -24.10812294
6 -5.96278814 -7.23545554
7 -3.83556531 -5.96278814
8 -1.90845225 -3.83556531
9 1.29154775 -1.90845225
10 4.63699232 1.29154775
11 4.63688255 4.63699232
12 11.60043908 4.63688255
13 12.80043908 11.60043908
14 5.01877058 12.80043908
15 0.40065862 5.01877058
16 1.80076839 0.40065862
17 -0.78100988 1.80076839
18 1.49165752 -0.78100988
19 5.34610318 1.49165752
20 13.72766191 5.34610318
21 12.20043908 13.72766191
22 14.27310648 12.20043908
23 13.81855104 14.27310648
24 20.32766191 13.81855104
25 19.52766191 20.32766191
26 17.65488474 19.52766191
27 16.49121844 17.65488474
28 15.61855104 16.49121844
29 9.67288694 15.61855104
30 9.67277717 9.67288694
31 9.98166850 9.67277717
32 3.54544457 9.98166850
33 3.92711306 3.54544457
34 -1.00021954 3.92711306
35 -1.45477497 -1.00021954
36 1.96322722 -1.45477497
37 -2.65510428 1.96322722
38 7.19934138 -2.65510428
39 9.03567508 7.19934138
40 5.79912184 9.03567508
41 1.49012075 5.79912184
42 0.03556531 1.49012075
43 -4.01888035 0.03556531
44 -7.72788145 -4.01888035
45 -10.80065862 -7.72788145
46 -12.72799122 -10.80065862
47 -12.90976948 -12.72799122
48 -10.03732162 -12.90976948
49 -8.29176729 -10.03732162
50 3.01712404 -8.29176729
51 5.30790340 3.01712404
52 0.88968167 5.30790340
53 -3.14654226 0.88968167
54 -5.23721186 -3.14654226
55 -7.47332602 -5.23721186
56 -7.63677278 -7.47332602
57 -6.61844127 -7.63677278
58 -5.18188804 -6.61844127
59 -4.09088913 -5.18188804
> plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals')
> lines(lowess(z))
> abline(lm(z))
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/7iwjm1258737047.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/8fe1x1258737047.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/9ty0t1258737047.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/www/html/rcomp/tmp/10oo451258737047.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/rcomp/createtable")
>
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE)
> a<-table.row.end(a)
> myeq <- colnames(x)[1]
> myeq <- paste(myeq, '[t] = ', sep='')
> for (i in 1:k){
+ if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '')
+ myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ')
+ if (rownames(mysum$coefficients)[i] != '(Intercept)') {
+ myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='')
+ if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='')
+ }
+ }
> myeq <- paste(myeq, ' + e[t]')
> a<-table.row.start(a)
> a<-table.element(a, myeq)
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/11c93l1258737047.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'Variable',header=TRUE)
> a<-table.element(a,'Parameter',header=TRUE)
> a<-table.element(a,'S.D.',header=TRUE)
> a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE)
> a<-table.element(a,'2-tail p-value',header=TRUE)
> a<-table.element(a,'1-tail p-value',header=TRUE)
> a<-table.row.end(a)
> for (i in 1:k){
+ a<-table.row.start(a)
+ a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE)
+ a<-table.element(a,mysum$coefficients[i,1])
+ a<-table.element(a, round(mysum$coefficients[i,2],6))
+ a<-table.element(a, round(mysum$coefficients[i,3],4))
+ a<-table.element(a, round(mysum$coefficients[i,4],6))
+ a<-table.element(a, round(mysum$coefficients[i,4]/2,6))
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/12evha1258737047.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple R',1,TRUE)
> a<-table.element(a, sqrt(mysum$r.squared))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'R-squared',1,TRUE)
> a<-table.element(a, mysum$r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Adjusted R-squared',1,TRUE)
> a<-table.element(a, mysum$adj.r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (value)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[1])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[2])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[3])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'p-value',1,TRUE)
> a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3]))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Residual Standard Deviation',1,TRUE)
> a<-table.element(a, mysum$sigma)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Sum Squared Residuals',1,TRUE)
> a<-table.element(a, sum(myerror*myerror))
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/1325kd1258737047.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Time or Index', 1, TRUE)
> a<-table.element(a, 'Actuals', 1, TRUE)
> a<-table.element(a, 'Interpolation
Forecast', 1, TRUE)
> a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE)
> a<-table.row.end(a)
> for (i in 1:n) {
+ a<-table.row.start(a)
+ a<-table.element(a,i, 1, TRUE)
+ a<-table.element(a,x[i])
+ a<-table.element(a,x[i]-mysum$resid[i])
+ a<-table.element(a,mysum$resid[i])
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/14weg01258737047.tab")
> if (n > n25) {
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'p-values',header=TRUE)
+ a<-table.element(a,'Alternative Hypothesis',3,header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'breakpoint index',header=TRUE)
+ a<-table.element(a,'greater',header=TRUE)
+ a<-table.element(a,'2-sided',header=TRUE)
+ a<-table.element(a,'less',header=TRUE)
+ a<-table.row.end(a)
+ for (mypoint in kp3:nmkm3) {
+ a<-table.row.start(a)
+ a<-table.element(a,mypoint,header=TRUE)
+ a<-table.element(a,gqarr[mypoint-kp3+1,1])
+ a<-table.element(a,gqarr[mypoint-kp3+1,2])
+ a<-table.element(a,gqarr[mypoint-kp3+1,3])
+ a<-table.row.end(a)
+ }
+ a<-table.end(a)
+ table.save(a,file="/var/www/html/rcomp/tmp/15sif31258737047.tab")
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'Description',header=TRUE)
+ a<-table.element(a,'# significant tests',header=TRUE)
+ a<-table.element(a,'% significant tests',header=TRUE)
+ a<-table.element(a,'OK/NOK',header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'1% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant1)
+ a<-table.element(a,numsignificant1/numgqtests)
+ if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'5% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant5)
+ a<-table.element(a,numsignificant5/numgqtests)
+ if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'10% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant10)
+ a<-table.element(a,numsignificant10/numgqtests)
+ if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.end(a)
+ table.save(a,file="/var/www/html/rcomp/tmp/16xckn1258737047.tab")
+ }
>
> system("convert tmp/1nkm51258737047.ps tmp/1nkm51258737047.png")
> system("convert tmp/2fcpw1258737047.ps tmp/2fcpw1258737047.png")
> system("convert tmp/3h9681258737047.ps tmp/3h9681258737047.png")
> system("convert tmp/4qqwn1258737047.ps tmp/4qqwn1258737047.png")
> system("convert tmp/5da8v1258737047.ps tmp/5da8v1258737047.png")
> system("convert tmp/6m5bx1258737047.ps tmp/6m5bx1258737047.png")
> system("convert tmp/7iwjm1258737047.ps tmp/7iwjm1258737047.png")
> system("convert tmp/8fe1x1258737047.ps tmp/8fe1x1258737047.png")
> system("convert tmp/9ty0t1258737047.ps tmp/9ty0t1258737047.png")
> system("convert tmp/10oo451258737047.ps tmp/10oo451258737047.png")
>
>
> proc.time()
user system elapsed
2.471 1.588 2.926