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(267413,294912,267366,293488,264777,290555,258863,284736,254844,281818,254868,287854,277267,316263,285351,325412,286602,326011,283042,328282,276687,317480,277915,317539,277128,313737,277103,312276,275037,309391,270150,302950,267140,300316,264993,304035,287259,333476,291186,337698,292300,335932,288186,323931,281477,313927,282656,314485,280190,313218,280408,309664,276836,302963,275216,298989,274352,298423,271311,301631,289802,329765,290726,335083,292300,327616,278506,309119,269826,295916,265861,291413,269034,291542,264176,284678,255198,276475,253353,272566,246057,264981,235372,263290,258556,296806,260993,303598,254663,286994,250643,276427,243422,266424,247105,267153,248541,268381,245039,262522,237080,255542,237085,253158,225554,243803,226839,250741,247934,280445,248333,285257,246969,270976,245098,261076,246263,255603,255765,260376,264319,263903,268347,264291,273046,263276,273963,262572,267430,256167,271993,264221,292710,293860),dim=c(2,67),dimnames=list(c('Y','X'),1:67))
> y <- array(NA,dim=c(2,67),dimnames=list(c('Y','X'),1:67))
> 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 267413 294912 1 0 0 0 0 0 0 0 0 0 0
2 267366 293488 0 1 0 0 0 0 0 0 0 0 0
3 264777 290555 0 0 1 0 0 0 0 0 0 0 0
4 258863 284736 0 0 0 1 0 0 0 0 0 0 0
5 254844 281818 0 0 0 0 1 0 0 0 0 0 0
6 254868 287854 0 0 0 0 0 1 0 0 0 0 0
7 277267 316263 0 0 0 0 0 0 1 0 0 0 0
8 285351 325412 0 0 0 0 0 0 0 1 0 0 0
9 286602 326011 0 0 0 0 0 0 0 0 1 0 0
10 283042 328282 0 0 0 0 0 0 0 0 0 1 0
11 276687 317480 0 0 0 0 0 0 0 0 0 0 1
12 277915 317539 0 0 0 0 0 0 0 0 0 0 0
13 277128 313737 1 0 0 0 0 0 0 0 0 0 0
14 277103 312276 0 1 0 0 0 0 0 0 0 0 0
15 275037 309391 0 0 1 0 0 0 0 0 0 0 0
16 270150 302950 0 0 0 1 0 0 0 0 0 0 0
17 267140 300316 0 0 0 0 1 0 0 0 0 0 0
18 264993 304035 0 0 0 0 0 1 0 0 0 0 0
19 287259 333476 0 0 0 0 0 0 1 0 0 0 0
20 291186 337698 0 0 0 0 0 0 0 1 0 0 0
21 292300 335932 0 0 0 0 0 0 0 0 1 0 0
22 288186 323931 0 0 0 0 0 0 0 0 0 1 0
23 281477 313927 0 0 0 0 0 0 0 0 0 0 1
24 282656 314485 0 0 0 0 0 0 0 0 0 0 0
25 280190 313218 1 0 0 0 0 0 0 0 0 0 0
26 280408 309664 0 1 0 0 0 0 0 0 0 0 0
27 276836 302963 0 0 1 0 0 0 0 0 0 0 0
28 275216 298989 0 0 0 1 0 0 0 0 0 0 0
29 274352 298423 0 0 0 0 1 0 0 0 0 0 0
30 271311 301631 0 0 0 0 0 1 0 0 0 0 0
31 289802 329765 0 0 0 0 0 0 1 0 0 0 0
32 290726 335083 0 0 0 0 0 0 0 1 0 0 0
33 292300 327616 0 0 0 0 0 0 0 0 1 0 0
34 278506 309119 0 0 0 0 0 0 0 0 0 1 0
35 269826 295916 0 0 0 0 0 0 0 0 0 0 1
36 265861 291413 0 0 0 0 0 0 0 0 0 0 0
37 269034 291542 1 0 0 0 0 0 0 0 0 0 0
38 264176 284678 0 1 0 0 0 0 0 0 0 0 0
39 255198 276475 0 0 1 0 0 0 0 0 0 0 0
40 253353 272566 0 0 0 1 0 0 0 0 0 0 0
41 246057 264981 0 0 0 0 1 0 0 0 0 0 0
42 235372 263290 0 0 0 0 0 1 0 0 0 0 0
43 258556 296806 0 0 0 0 0 0 1 0 0 0 0
44 260993 303598 0 0 0 0 0 0 0 1 0 0 0
45 254663 286994 0 0 0 0 0 0 0 0 1 0 0
46 250643 276427 0 0 0 0 0 0 0 0 0 1 0
47 243422 266424 0 0 0 0 0 0 0 0 0 0 1
48 247105 267153 0 0 0 0 0 0 0 0 0 0 0
49 248541 268381 1 0 0 0 0 0 0 0 0 0 0
50 245039 262522 0 1 0 0 0 0 0 0 0 0 0
51 237080 255542 0 0 1 0 0 0 0 0 0 0 0
52 237085 253158 0 0 0 1 0 0 0 0 0 0 0
53 225554 243803 0 0 0 0 1 0 0 0 0 0 0
54 226839 250741 0 0 0 0 0 1 0 0 0 0 0
55 247934 280445 0 0 0 0 0 0 1 0 0 0 0
56 248333 285257 0 0 0 0 0 0 0 1 0 0 0
57 246969 270976 0 0 0 0 0 0 0 0 1 0 0
58 245098 261076 0 0 0 0 0 0 0 0 0 1 0
59 246263 255603 0 0 0 0 0 0 0 0 0 0 1
60 255765 260376 0 0 0 0 0 0 0 0 0 0 0
61 264319 263903 1 0 0 0 0 0 0 0 0 0 0
62 268347 264291 0 1 0 0 0 0 0 0 0 0 0
63 273046 263276 0 0 1 0 0 0 0 0 0 0 0
64 273963 262572 0 0 0 1 0 0 0 0 0 0 0
65 267430 256167 0 0 0 0 1 0 0 0 0 0 0
66 271993 264221 0 0 0 0 0 1 0 0 0 0 0
67 292710 293860 0 0 0 0 0 0 1 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
93124.3064 0.5952 1460.6463 2625.5017 2063.6108 2144.3008
M5 M6 M7 M8 M9 M10
-474.9146 -4747.3343 -1131.2389 -6743.0300 -2789.3314 -2464.1580
M11
-2133.0168
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-12218 -4947 -3026 3257 26340
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.312e+04 1.634e+04 5.700 5.14e-07 ***
X 5.952e-01 5.434e-02 10.955 2.45e-15 ***
M1 1.461e+03 5.794e+03 0.252 0.802
M2 2.626e+03 5.795e+03 0.453 0.652
M3 2.064e+03 5.807e+03 0.355 0.724
M4 2.144e+03 5.825e+03 0.368 0.714
M5 -4.749e+02 5.858e+03 -0.081 0.936
M6 -4.747e+03 5.828e+03 -0.815 0.419
M7 -1.131e+03 5.878e+03 -0.192 0.848
M8 -6.743e+03 6.230e+03 -1.082 0.284
M9 -2.789e+03 6.142e+03 -0.454 0.652
M10 -2.464e+03 6.074e+03 -0.406 0.687
M11 -2.133e+03 6.052e+03 -0.352 0.726
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 9568 on 54 degrees of freedom
Multiple R-squared: 0.7396, Adjusted R-squared: 0.6818
F-statistic: 12.78 on 12 and 54 DF, p-value: 7.893e-12
> 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,] 2.727403e-04 5.454806e-04 0.9997273
[2,] 8.402395e-05 1.680479e-04 0.9999160
[3,] 7.491706e-06 1.498341e-05 0.9999925
[4,] 4.929501e-07 9.859002e-07 0.9999995
[5,] 5.987157e-08 1.197431e-07 0.9999999
[6,] 3.623000e-09 7.245999e-09 1.0000000
[7,] 2.101109e-06 4.202218e-06 0.9999979
[8,] 3.957147e-06 7.914295e-06 0.9999960
[9,] 3.708537e-06 7.417073e-06 0.9999963
[10,] 1.198164e-06 2.396327e-06 0.9999988
[11,] 5.857193e-07 1.171439e-06 0.9999994
[12,] 3.794002e-07 7.588005e-07 0.9999996
[13,] 6.511652e-07 1.302330e-06 0.9999993
[14,] 1.291364e-06 2.582727e-06 0.9999987
[15,] 1.299525e-06 2.599049e-06 0.9999987
[16,] 5.396564e-07 1.079313e-06 0.9999995
[17,] 1.459785e-07 2.919570e-07 0.9999999
[18,] 6.767600e-08 1.353520e-07 0.9999999
[19,] 2.273380e-08 4.546760e-08 1.0000000
[20,] 6.518209e-09 1.303642e-08 1.0000000
[21,] 1.538160e-09 3.076320e-09 1.0000000
[22,] 4.894954e-10 9.789908e-10 1.0000000
[23,] 1.249127e-10 2.498255e-10 1.0000000
[24,] 4.881489e-11 9.762979e-11 1.0000000
[25,] 1.897915e-11 3.795830e-11 1.0000000
[26,] 9.342392e-12 1.868478e-11 1.0000000
[27,] 2.215119e-11 4.430238e-11 1.0000000
[28,] 1.083754e-10 2.167508e-10 1.0000000
[29,] 2.564849e-10 5.129697e-10 1.0000000
[30,] 4.757354e-10 9.514708e-10 1.0000000
[31,] 2.343342e-09 4.686683e-09 1.0000000
[32,] 7.474621e-08 1.494924e-07 0.9999999
[33,] 5.708792e-06 1.141758e-05 0.9999943
[34,] 1.811501e-02 3.623003e-02 0.9818850
[35,] 3.826833e-01 7.653667e-01 0.6173167
[36,] 7.985568e-01 4.028865e-01 0.2014432
> postscript(file="/var/www/html/rcomp/tmp/1frgn1259052021.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/202i61259052021.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/3vjz31259052021.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/42hae1259052021.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/5ytth1259052021.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 = 67
Frequency = 1
1 2 3 4 5 6
-2716.8891 -3081.1154 -3362.3705 -5893.3290 -5556.1883 -4852.6682
7 8 9 10 11 12
-2980.0830 5269.8102 2210.5598 -3026.4153 -3282.7185 -4222.8547
13 14 15 16 17 18
-4207.3789 -4527.5812 -4314.4081 -5448.1241 -4271.0330 -4359.3299
19 20 21 22 23 24
-3234.0377 3791.6284 2003.1327 4707.4963 3622.1875 2336.0240
25 26 27 28 29 30
-836.4467 332.1992 1310.8277 1975.6420 4067.7661 3389.6394
31 32 33 34 35 36
1517.9171 4888.1944 6953.1914 3844.2674 2692.1478 -725.4800
37 38 39 40 41 42
910.0871 -1027.0056 -4560.3188 -4159.1956 -4321.0458 -9727.0665
43 44 45 46 47 48
-10109.3982 -6103.5121 -6503.7603 -4558.9783 -6156.8823 -5040.8328
49 50 51 52 53 54
-5796.4401 -6975.7542 -10218.0522 -8874.6778 -12217.9441 -10790.3351
55 56 57 58 59 60
-10992.5923 -7846.1209 -4663.1236 -966.3701 3125.2654 7653.1436
61 62 63 64 65 66
12647.0677 15279.2572 21144.3218 22399.6844 22298.4450 26339.7603
67
25798.1940
> postscript(file="/var/www/html/rcomp/tmp/6zi8z1259052021.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 = 67
Frequency = 1
lag(myerror, k = 1) myerror
0 -2716.8891 NA
1 -3081.1154 -2716.8891
2 -3362.3705 -3081.1154
3 -5893.3290 -3362.3705
4 -5556.1883 -5893.3290
5 -4852.6682 -5556.1883
6 -2980.0830 -4852.6682
7 5269.8102 -2980.0830
8 2210.5598 5269.8102
9 -3026.4153 2210.5598
10 -3282.7185 -3026.4153
11 -4222.8547 -3282.7185
12 -4207.3789 -4222.8547
13 -4527.5812 -4207.3789
14 -4314.4081 -4527.5812
15 -5448.1241 -4314.4081
16 -4271.0330 -5448.1241
17 -4359.3299 -4271.0330
18 -3234.0377 -4359.3299
19 3791.6284 -3234.0377
20 2003.1327 3791.6284
21 4707.4963 2003.1327
22 3622.1875 4707.4963
23 2336.0240 3622.1875
24 -836.4467 2336.0240
25 332.1992 -836.4467
26 1310.8277 332.1992
27 1975.6420 1310.8277
28 4067.7661 1975.6420
29 3389.6394 4067.7661
30 1517.9171 3389.6394
31 4888.1944 1517.9171
32 6953.1914 4888.1944
33 3844.2674 6953.1914
34 2692.1478 3844.2674
35 -725.4800 2692.1478
36 910.0871 -725.4800
37 -1027.0056 910.0871
38 -4560.3188 -1027.0056
39 -4159.1956 -4560.3188
40 -4321.0458 -4159.1956
41 -9727.0665 -4321.0458
42 -10109.3982 -9727.0665
43 -6103.5121 -10109.3982
44 -6503.7603 -6103.5121
45 -4558.9783 -6503.7603
46 -6156.8823 -4558.9783
47 -5040.8328 -6156.8823
48 -5796.4401 -5040.8328
49 -6975.7542 -5796.4401
50 -10218.0522 -6975.7542
51 -8874.6778 -10218.0522
52 -12217.9441 -8874.6778
53 -10790.3351 -12217.9441
54 -10992.5923 -10790.3351
55 -7846.1209 -10992.5923
56 -4663.1236 -7846.1209
57 -966.3701 -4663.1236
58 3125.2654 -966.3701
59 7653.1436 3125.2654
60 12647.0677 7653.1436
61 15279.2572 12647.0677
62 21144.3218 15279.2572
63 22399.6844 21144.3218
64 22298.4450 22399.6844
65 26339.7603 22298.4450
66 25798.1940 26339.7603
67 NA 25798.1940
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -3081.1154 -2716.8891
[2,] -3362.3705 -3081.1154
[3,] -5893.3290 -3362.3705
[4,] -5556.1883 -5893.3290
[5,] -4852.6682 -5556.1883
[6,] -2980.0830 -4852.6682
[7,] 5269.8102 -2980.0830
[8,] 2210.5598 5269.8102
[9,] -3026.4153 2210.5598
[10,] -3282.7185 -3026.4153
[11,] -4222.8547 -3282.7185
[12,] -4207.3789 -4222.8547
[13,] -4527.5812 -4207.3789
[14,] -4314.4081 -4527.5812
[15,] -5448.1241 -4314.4081
[16,] -4271.0330 -5448.1241
[17,] -4359.3299 -4271.0330
[18,] -3234.0377 -4359.3299
[19,] 3791.6284 -3234.0377
[20,] 2003.1327 3791.6284
[21,] 4707.4963 2003.1327
[22,] 3622.1875 4707.4963
[23,] 2336.0240 3622.1875
[24,] -836.4467 2336.0240
[25,] 332.1992 -836.4467
[26,] 1310.8277 332.1992
[27,] 1975.6420 1310.8277
[28,] 4067.7661 1975.6420
[29,] 3389.6394 4067.7661
[30,] 1517.9171 3389.6394
[31,] 4888.1944 1517.9171
[32,] 6953.1914 4888.1944
[33,] 3844.2674 6953.1914
[34,] 2692.1478 3844.2674
[35,] -725.4800 2692.1478
[36,] 910.0871 -725.4800
[37,] -1027.0056 910.0871
[38,] -4560.3188 -1027.0056
[39,] -4159.1956 -4560.3188
[40,] -4321.0458 -4159.1956
[41,] -9727.0665 -4321.0458
[42,] -10109.3982 -9727.0665
[43,] -6103.5121 -10109.3982
[44,] -6503.7603 -6103.5121
[45,] -4558.9783 -6503.7603
[46,] -6156.8823 -4558.9783
[47,] -5040.8328 -6156.8823
[48,] -5796.4401 -5040.8328
[49,] -6975.7542 -5796.4401
[50,] -10218.0522 -6975.7542
[51,] -8874.6778 -10218.0522
[52,] -12217.9441 -8874.6778
[53,] -10790.3351 -12217.9441
[54,] -10992.5923 -10790.3351
[55,] -7846.1209 -10992.5923
[56,] -4663.1236 -7846.1209
[57,] -966.3701 -4663.1236
[58,] 3125.2654 -966.3701
[59,] 7653.1436 3125.2654
[60,] 12647.0677 7653.1436
[61,] 15279.2572 12647.0677
[62,] 21144.3218 15279.2572
[63,] 22399.6844 21144.3218
[64,] 22298.4450 22399.6844
[65,] 26339.7603 22298.4450
[66,] 25798.1940 26339.7603
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -3081.1154 -2716.8891
2 -3362.3705 -3081.1154
3 -5893.3290 -3362.3705
4 -5556.1883 -5893.3290
5 -4852.6682 -5556.1883
6 -2980.0830 -4852.6682
7 5269.8102 -2980.0830
8 2210.5598 5269.8102
9 -3026.4153 2210.5598
10 -3282.7185 -3026.4153
11 -4222.8547 -3282.7185
12 -4207.3789 -4222.8547
13 -4527.5812 -4207.3789
14 -4314.4081 -4527.5812
15 -5448.1241 -4314.4081
16 -4271.0330 -5448.1241
17 -4359.3299 -4271.0330
18 -3234.0377 -4359.3299
19 3791.6284 -3234.0377
20 2003.1327 3791.6284
21 4707.4963 2003.1327
22 3622.1875 4707.4963
23 2336.0240 3622.1875
24 -836.4467 2336.0240
25 332.1992 -836.4467
26 1310.8277 332.1992
27 1975.6420 1310.8277
28 4067.7661 1975.6420
29 3389.6394 4067.7661
30 1517.9171 3389.6394
31 4888.1944 1517.9171
32 6953.1914 4888.1944
33 3844.2674 6953.1914
34 2692.1478 3844.2674
35 -725.4800 2692.1478
36 910.0871 -725.4800
37 -1027.0056 910.0871
38 -4560.3188 -1027.0056
39 -4159.1956 -4560.3188
40 -4321.0458 -4159.1956
41 -9727.0665 -4321.0458
42 -10109.3982 -9727.0665
43 -6103.5121 -10109.3982
44 -6503.7603 -6103.5121
45 -4558.9783 -6503.7603
46 -6156.8823 -4558.9783
47 -5040.8328 -6156.8823
48 -5796.4401 -5040.8328
49 -6975.7542 -5796.4401
50 -10218.0522 -6975.7542
51 -8874.6778 -10218.0522
52 -12217.9441 -8874.6778
53 -10790.3351 -12217.9441
54 -10992.5923 -10790.3351
55 -7846.1209 -10992.5923
56 -4663.1236 -7846.1209
57 -966.3701 -4663.1236
58 3125.2654 -966.3701
59 7653.1436 3125.2654
60 12647.0677 7653.1436
61 15279.2572 12647.0677
62 21144.3218 15279.2572
63 22399.6844 21144.3218
64 22298.4450 22399.6844
65 26339.7603 22298.4450
66 25798.1940 26339.7603
> 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/7jodt1259052021.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/8o0iq1259052021.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/9ll8t1259052021.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/109fjk1259052021.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/11zvrh1259052021.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/1295vk1259052021.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/13pnnm1259052021.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/141qe51259052021.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/15j4tk1259052021.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/166d5r1259052021.tab")
+ }
> system("convert tmp/1frgn1259052021.ps tmp/1frgn1259052021.png")
> system("convert tmp/202i61259052021.ps tmp/202i61259052021.png")
> system("convert tmp/3vjz31259052021.ps tmp/3vjz31259052021.png")
> system("convert tmp/42hae1259052021.ps tmp/42hae1259052021.png")
> system("convert tmp/5ytth1259052021.ps tmp/5ytth1259052021.png")
> system("convert tmp/6zi8z1259052021.ps tmp/6zi8z1259052021.png")
> system("convert tmp/7jodt1259052021.ps tmp/7jodt1259052021.png")
> system("convert tmp/8o0iq1259052021.ps tmp/8o0iq1259052021.png")
> system("convert tmp/9ll8t1259052021.ps tmp/9ll8t1259052021.png")
> system("convert tmp/109fjk1259052021.ps tmp/109fjk1259052021.png")
>
>
> proc.time()
user system elapsed
2.425 1.530 3.793