R version 2.8.0 (2008-10-20)
Copyright (C) 2008 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(6.4,12.5,6.8,14.8,7.5,15.9,7.5,14.8,7.6,12.9,7.6,14.3,7.4,14.2,7.3,15.9,7.1,15.3,6.9,15.5,6.8,15.1,7.5,15,7.6,12.1,7.8,15.8,8,16.9,8.1,15.1,8.2,13.7,8.3,14.8,8.2,14.7,8,16,7.9,15.4,7.6,15,7.6,15.5,8.2,15.1,8.3,11.7,8.4,16.3,8.4,16.7,8.4,15,8.6,14.9,8.9,14.6,8.8,15.3,8.3,17.9,7.5,16.4,7.2,15.4,7.5,17.9,8.8,15.9,9.3,13.9,9.3,17.8,8.7,17.9,8.2,17.4,8.3,16.7,8.5,16,8.6,16.6,8.6,19.1,8.2,17.8,8.1,17.2,8,18.6,8.6,16.3,8.7,15.1,8.8,19.2,8.5,17.7,8.4,19.1,8.5,18,8.7,17.5,8.7,17.8,8.6,21.1,8.5,17.2,8.3,19.4,8.1,19.8,8.2,17.6,8.1,16.2,8.1,19.5,7.9,19.9,7.9,20,7.9,17.3,8,18.9,8,18.6,7.9,21.4,8,18.6,7.7,19.8,7.2,20.8,7.5,19.6,7.3,17.7,7,19.8,7,22.2,7,20.7,7.2,17.9,7.3,21.2,7.1,21.4,6.8,21.7,6.6,23.2,6.2,21.5,6.2,22.9,6.8,23.2,6.9,18.6),dim=c(2,85),dimnames=list(c('Werkloosheid','export'),1:85))
> y <- array(NA,dim=c(2,85),dimnames=list(c('Werkloosheid','export'),1:85))
> 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 = 'Do not include Seasonal 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
Werkloosheid export
1 6.4 12.5
2 6.8 14.8
3 7.5 15.9
4 7.5 14.8
5 7.6 12.9
6 7.6 14.3
7 7.4 14.2
8 7.3 15.9
9 7.1 15.3
10 6.9 15.5
11 6.8 15.1
12 7.5 15.0
13 7.6 12.1
14 7.8 15.8
15 8.0 16.9
16 8.1 15.1
17 8.2 13.7
18 8.3 14.8
19 8.2 14.7
20 8.0 16.0
21 7.9 15.4
22 7.6 15.0
23 7.6 15.5
24 8.2 15.1
25 8.3 11.7
26 8.4 16.3
27 8.4 16.7
28 8.4 15.0
29 8.6 14.9
30 8.9 14.6
31 8.8 15.3
32 8.3 17.9
33 7.5 16.4
34 7.2 15.4
35 7.5 17.9
36 8.8 15.9
37 9.3 13.9
38 9.3 17.8
39 8.7 17.9
40 8.2 17.4
41 8.3 16.7
42 8.5 16.0
43 8.6 16.6
44 8.6 19.1
45 8.2 17.8
46 8.1 17.2
47 8.0 18.6
48 8.6 16.3
49 8.7 15.1
50 8.8 19.2
51 8.5 17.7
52 8.4 19.1
53 8.5 18.0
54 8.7 17.5
55 8.7 17.8
56 8.6 21.1
57 8.5 17.2
58 8.3 19.4
59 8.1 19.8
60 8.2 17.6
61 8.1 16.2
62 8.1 19.5
63 7.9 19.9
64 7.9 20.0
65 7.9 17.3
66 8.0 18.9
67 8.0 18.6
68 7.9 21.4
69 8.0 18.6
70 7.7 19.8
71 7.2 20.8
72 7.5 19.6
73 7.3 17.7
74 7.0 19.8
75 7.0 22.2
76 7.0 20.7
77 7.2 17.9
78 7.3 21.2
79 7.1 21.4
80 6.8 21.7
81 6.6 23.2
82 6.2 21.5
83 6.2 22.9
84 6.8 23.2
85 6.9 18.6
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) export
9.15165 -0.07399
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.8268 -0.5418 0.1360 0.4840 1.4654
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.15165 0.49202 18.600 <2e-16 ***
export -0.07399 0.02810 -2.633 0.0101 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.674 on 83 degrees of freedom
Multiple R-squared: 0.07708, Adjusted R-squared: 0.06596
F-statistic: 6.932 on 1 and 83 DF, p-value: 0.01009
> 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.4910684 0.98213688 0.50893156
[2,] 0.3911528 0.78230560 0.60884720
[3,] 0.2719973 0.54399452 0.72800274
[4,] 0.1859090 0.37181795 0.81409102
[5,] 0.1381285 0.27625706 0.86187147
[6,] 0.1351483 0.27029663 0.86485169
[7,] 0.1481731 0.29634612 0.85182694
[8,] 0.1207219 0.24144387 0.87927806
[9,] 0.1387930 0.27758608 0.86120696
[10,] 0.1500822 0.30016445 0.84991778
[11,] 0.1623143 0.32462868 0.83768566
[12,] 0.2151945 0.43038902 0.78480549
[13,] 0.3279601 0.65592018 0.67203991
[14,] 0.4110493 0.82209856 0.58895072
[15,] 0.4437319 0.88746377 0.55626812
[16,] 0.4025129 0.80502571 0.59748715
[17,] 0.3627857 0.72557136 0.63721432
[18,] 0.3398570 0.67971403 0.66014299
[19,] 0.3157360 0.63147190 0.68426405
[20,] 0.3260274 0.65205475 0.67397263
[21,] 0.4653729 0.93074574 0.53462713
[22,] 0.4869020 0.97380409 0.51309796
[23,] 0.4838287 0.96765732 0.51617134
[24,] 0.5020924 0.99581510 0.49790755
[25,] 0.5510867 0.89782670 0.44891335
[26,] 0.6590944 0.68181112 0.34090556
[27,] 0.7024185 0.59516309 0.29758155
[28,] 0.6519647 0.69607062 0.34803531
[29,] 0.6762050 0.64759000 0.32379500
[30,] 0.8272287 0.34554268 0.17277134
[31,] 0.8302783 0.33944350 0.16972175
[32,] 0.8493314 0.30133720 0.15066860
[33,] 0.9210608 0.15787842 0.07893921
[34,] 0.9703408 0.05931838 0.02965919
[35,] 0.9689376 0.06212471 0.03106235
[36,] 0.9562110 0.08757800 0.04378900
[37,] 0.9412543 0.11749148 0.05874574
[38,] 0.9273676 0.14526487 0.07263244
[39,] 0.9109549 0.17809015 0.08904507
[40,] 0.9132444 0.17351111 0.08675555
[41,] 0.8853811 0.22923781 0.11461890
[42,] 0.8547148 0.29057042 0.14528521
[43,] 0.8205192 0.35896165 0.17948082
[44,] 0.7900810 0.41983791 0.20991896
[45,] 0.7740499 0.45190021 0.22595010
[46,] 0.8213920 0.35721592 0.17860796
[47,] 0.7888809 0.42223830 0.21111915
[48,] 0.7778468 0.44430635 0.22215317
[49,] 0.7511596 0.49768082 0.24884041
[50,] 0.7448274 0.51034511 0.25517255
[51,] 0.7548876 0.49022471 0.24511236
[52,] 0.9046220 0.19075604 0.09537802
[53,] 0.8905000 0.21899999 0.10949999
[54,] 0.9099241 0.18015179 0.09007589
[55,] 0.9231074 0.15378510 0.07689255
[56,] 0.9037318 0.19253636 0.09626818
[57,] 0.8686176 0.26276485 0.13138242
[58,] 0.8831959 0.23360824 0.11680412
[59,] 0.8911951 0.21760973 0.10880487
[60,] 0.9048659 0.19026821 0.09513410
[61,] 0.8700195 0.25996092 0.12998046
[62,] 0.8718112 0.25637758 0.12818879
[63,] 0.8761250 0.24774991 0.12387495
[64,] 0.9584325 0.08313492 0.04156746
[65,] 0.9755991 0.04880190 0.02440095
[66,] 0.9866837 0.02663262 0.01331631
[67,] 0.9846407 0.03071851 0.01535925
[68,] 0.9869761 0.02604786 0.01302393
[69,] 0.9772015 0.04559697 0.02279848
[70,] 0.9635328 0.07293444 0.03646722
[71,] 0.9533678 0.09326436 0.04663218
[72,] 0.9249924 0.15001526 0.07500763
[73,] 0.8710702 0.25785969 0.12892985
[74,] 0.8949294 0.21014120 0.10507060
[75,] 0.8939728 0.21205439 0.10602720
[76,] 0.8164351 0.36712975 0.18356487
> postscript(file="/var/www/html/rcomp/tmp/1j7yj1228900779.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/2odki1228900779.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/3k5yz1228900779.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/4shzc1228900779.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/5xvwe1228900779.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 = 85
Frequency = 1
1 2 3 4 5 6
-1.82678072 -1.25660567 -0.47521760 -0.55660567 -0.59718506 -0.49360025
7 8 9 10 11 12
-0.70099916 -0.67521760 -0.91961109 -1.10481326 -1.23440892 -0.54180784
13 14 15 16 17 18
-0.65637638 -0.18261652 0.09877155 0.06559108 0.06200626 0.24339433
19 20 21 22 23 24
0.13599542 0.03218131 -0.11221218 -0.44180784 -0.40481326 0.16559108
25 26 27 28 29 30
0.01402796 0.45437806 0.48397372 0.35819216 0.55079325 0.82859650
31 32 33 34 35 36
0.78038891 0.47276070 -0.43822303 -0.81221218 -0.32723930 0.82478240
37 38 39 40 41 42
1.17680409 1.46536179 0.87276070 0.33576613 0.38397372 0.53218131
43 44 45 46 47 48
0.67657481 0.86154769 0.36536179 0.22096830 0.22455311 0.65437806
49 50 51 52 53 54
0.66559108 1.06894660 0.65796287 0.66154769 0.68015962 0.84316504
55 56 57 58 59 60
0.86536179 1.00952599 0.62096830 0.58374443 0.41334009 0.35056396
61 62 63 64 65 66
0.14697914 0.39114335 0.22073901 0.22813792 0.02836721 0.24674986
67 68 69 70 71 72
0.22455311 0.33172274 0.22455311 0.01334009 -0.41267075 -0.20145774
73 74 75 76 77 78
-0.54203713 -0.68665991 -0.50908594 -0.62006967 -0.62723930 -0.28307509
79 80 81 82 83 84
-0.46827726 -0.74608052 -0.83509679 -1.36087835 -1.25729353 -0.63509679
85
-0.87544689
> postscript(file="/var/www/html/rcomp/tmp/6bhn51228900779.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 = 85
Frequency = 1
lag(myerror, k = 1) myerror
0 -1.82678072 NA
1 -1.25660567 -1.82678072
2 -0.47521760 -1.25660567
3 -0.55660567 -0.47521760
4 -0.59718506 -0.55660567
5 -0.49360025 -0.59718506
6 -0.70099916 -0.49360025
7 -0.67521760 -0.70099916
8 -0.91961109 -0.67521760
9 -1.10481326 -0.91961109
10 -1.23440892 -1.10481326
11 -0.54180784 -1.23440892
12 -0.65637638 -0.54180784
13 -0.18261652 -0.65637638
14 0.09877155 -0.18261652
15 0.06559108 0.09877155
16 0.06200626 0.06559108
17 0.24339433 0.06200626
18 0.13599542 0.24339433
19 0.03218131 0.13599542
20 -0.11221218 0.03218131
21 -0.44180784 -0.11221218
22 -0.40481326 -0.44180784
23 0.16559108 -0.40481326
24 0.01402796 0.16559108
25 0.45437806 0.01402796
26 0.48397372 0.45437806
27 0.35819216 0.48397372
28 0.55079325 0.35819216
29 0.82859650 0.55079325
30 0.78038891 0.82859650
31 0.47276070 0.78038891
32 -0.43822303 0.47276070
33 -0.81221218 -0.43822303
34 -0.32723930 -0.81221218
35 0.82478240 -0.32723930
36 1.17680409 0.82478240
37 1.46536179 1.17680409
38 0.87276070 1.46536179
39 0.33576613 0.87276070
40 0.38397372 0.33576613
41 0.53218131 0.38397372
42 0.67657481 0.53218131
43 0.86154769 0.67657481
44 0.36536179 0.86154769
45 0.22096830 0.36536179
46 0.22455311 0.22096830
47 0.65437806 0.22455311
48 0.66559108 0.65437806
49 1.06894660 0.66559108
50 0.65796287 1.06894660
51 0.66154769 0.65796287
52 0.68015962 0.66154769
53 0.84316504 0.68015962
54 0.86536179 0.84316504
55 1.00952599 0.86536179
56 0.62096830 1.00952599
57 0.58374443 0.62096830
58 0.41334009 0.58374443
59 0.35056396 0.41334009
60 0.14697914 0.35056396
61 0.39114335 0.14697914
62 0.22073901 0.39114335
63 0.22813792 0.22073901
64 0.02836721 0.22813792
65 0.24674986 0.02836721
66 0.22455311 0.24674986
67 0.33172274 0.22455311
68 0.22455311 0.33172274
69 0.01334009 0.22455311
70 -0.41267075 0.01334009
71 -0.20145774 -0.41267075
72 -0.54203713 -0.20145774
73 -0.68665991 -0.54203713
74 -0.50908594 -0.68665991
75 -0.62006967 -0.50908594
76 -0.62723930 -0.62006967
77 -0.28307509 -0.62723930
78 -0.46827726 -0.28307509
79 -0.74608052 -0.46827726
80 -0.83509679 -0.74608052
81 -1.36087835 -0.83509679
82 -1.25729353 -1.36087835
83 -0.63509679 -1.25729353
84 -0.87544689 -0.63509679
85 NA -0.87544689
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.25660567 -1.82678072
[2,] -0.47521760 -1.25660567
[3,] -0.55660567 -0.47521760
[4,] -0.59718506 -0.55660567
[5,] -0.49360025 -0.59718506
[6,] -0.70099916 -0.49360025
[7,] -0.67521760 -0.70099916
[8,] -0.91961109 -0.67521760
[9,] -1.10481326 -0.91961109
[10,] -1.23440892 -1.10481326
[11,] -0.54180784 -1.23440892
[12,] -0.65637638 -0.54180784
[13,] -0.18261652 -0.65637638
[14,] 0.09877155 -0.18261652
[15,] 0.06559108 0.09877155
[16,] 0.06200626 0.06559108
[17,] 0.24339433 0.06200626
[18,] 0.13599542 0.24339433
[19,] 0.03218131 0.13599542
[20,] -0.11221218 0.03218131
[21,] -0.44180784 -0.11221218
[22,] -0.40481326 -0.44180784
[23,] 0.16559108 -0.40481326
[24,] 0.01402796 0.16559108
[25,] 0.45437806 0.01402796
[26,] 0.48397372 0.45437806
[27,] 0.35819216 0.48397372
[28,] 0.55079325 0.35819216
[29,] 0.82859650 0.55079325
[30,] 0.78038891 0.82859650
[31,] 0.47276070 0.78038891
[32,] -0.43822303 0.47276070
[33,] -0.81221218 -0.43822303
[34,] -0.32723930 -0.81221218
[35,] 0.82478240 -0.32723930
[36,] 1.17680409 0.82478240
[37,] 1.46536179 1.17680409
[38,] 0.87276070 1.46536179
[39,] 0.33576613 0.87276070
[40,] 0.38397372 0.33576613
[41,] 0.53218131 0.38397372
[42,] 0.67657481 0.53218131
[43,] 0.86154769 0.67657481
[44,] 0.36536179 0.86154769
[45,] 0.22096830 0.36536179
[46,] 0.22455311 0.22096830
[47,] 0.65437806 0.22455311
[48,] 0.66559108 0.65437806
[49,] 1.06894660 0.66559108
[50,] 0.65796287 1.06894660
[51,] 0.66154769 0.65796287
[52,] 0.68015962 0.66154769
[53,] 0.84316504 0.68015962
[54,] 0.86536179 0.84316504
[55,] 1.00952599 0.86536179
[56,] 0.62096830 1.00952599
[57,] 0.58374443 0.62096830
[58,] 0.41334009 0.58374443
[59,] 0.35056396 0.41334009
[60,] 0.14697914 0.35056396
[61,] 0.39114335 0.14697914
[62,] 0.22073901 0.39114335
[63,] 0.22813792 0.22073901
[64,] 0.02836721 0.22813792
[65,] 0.24674986 0.02836721
[66,] 0.22455311 0.24674986
[67,] 0.33172274 0.22455311
[68,] 0.22455311 0.33172274
[69,] 0.01334009 0.22455311
[70,] -0.41267075 0.01334009
[71,] -0.20145774 -0.41267075
[72,] -0.54203713 -0.20145774
[73,] -0.68665991 -0.54203713
[74,] -0.50908594 -0.68665991
[75,] -0.62006967 -0.50908594
[76,] -0.62723930 -0.62006967
[77,] -0.28307509 -0.62723930
[78,] -0.46827726 -0.28307509
[79,] -0.74608052 -0.46827726
[80,] -0.83509679 -0.74608052
[81,] -1.36087835 -0.83509679
[82,] -1.25729353 -1.36087835
[83,] -0.63509679 -1.25729353
[84,] -0.87544689 -0.63509679
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.25660567 -1.82678072
2 -0.47521760 -1.25660567
3 -0.55660567 -0.47521760
4 -0.59718506 -0.55660567
5 -0.49360025 -0.59718506
6 -0.70099916 -0.49360025
7 -0.67521760 -0.70099916
8 -0.91961109 -0.67521760
9 -1.10481326 -0.91961109
10 -1.23440892 -1.10481326
11 -0.54180784 -1.23440892
12 -0.65637638 -0.54180784
13 -0.18261652 -0.65637638
14 0.09877155 -0.18261652
15 0.06559108 0.09877155
16 0.06200626 0.06559108
17 0.24339433 0.06200626
18 0.13599542 0.24339433
19 0.03218131 0.13599542
20 -0.11221218 0.03218131
21 -0.44180784 -0.11221218
22 -0.40481326 -0.44180784
23 0.16559108 -0.40481326
24 0.01402796 0.16559108
25 0.45437806 0.01402796
26 0.48397372 0.45437806
27 0.35819216 0.48397372
28 0.55079325 0.35819216
29 0.82859650 0.55079325
30 0.78038891 0.82859650
31 0.47276070 0.78038891
32 -0.43822303 0.47276070
33 -0.81221218 -0.43822303
34 -0.32723930 -0.81221218
35 0.82478240 -0.32723930
36 1.17680409 0.82478240
37 1.46536179 1.17680409
38 0.87276070 1.46536179
39 0.33576613 0.87276070
40 0.38397372 0.33576613
41 0.53218131 0.38397372
42 0.67657481 0.53218131
43 0.86154769 0.67657481
44 0.36536179 0.86154769
45 0.22096830 0.36536179
46 0.22455311 0.22096830
47 0.65437806 0.22455311
48 0.66559108 0.65437806
49 1.06894660 0.66559108
50 0.65796287 1.06894660
51 0.66154769 0.65796287
52 0.68015962 0.66154769
53 0.84316504 0.68015962
54 0.86536179 0.84316504
55 1.00952599 0.86536179
56 0.62096830 1.00952599
57 0.58374443 0.62096830
58 0.41334009 0.58374443
59 0.35056396 0.41334009
60 0.14697914 0.35056396
61 0.39114335 0.14697914
62 0.22073901 0.39114335
63 0.22813792 0.22073901
64 0.02836721 0.22813792
65 0.24674986 0.02836721
66 0.22455311 0.24674986
67 0.33172274 0.22455311
68 0.22455311 0.33172274
69 0.01334009 0.22455311
70 -0.41267075 0.01334009
71 -0.20145774 -0.41267075
72 -0.54203713 -0.20145774
73 -0.68665991 -0.54203713
74 -0.50908594 -0.68665991
75 -0.62006967 -0.50908594
76 -0.62723930 -0.62006967
77 -0.28307509 -0.62723930
78 -0.46827726 -0.28307509
79 -0.74608052 -0.46827726
80 -0.83509679 -0.74608052
81 -1.36087835 -0.83509679
82 -1.25729353 -1.36087835
83 -0.63509679 -1.25729353
84 -0.87544689 -0.63509679
> 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/7s4lt1228900779.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/8nwku1228900779.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/9k8241228900779.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/10pn8a1228900779.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/114x711228900779.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/12h5jj1228900779.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/13jkgy1228900779.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/14aoog1228900779.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/15q29s1228900779.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/16qs1p1228900779.tab")
+ }
>
> system("convert tmp/1j7yj1228900779.ps tmp/1j7yj1228900779.png")
> system("convert tmp/2odki1228900779.ps tmp/2odki1228900779.png")
> system("convert tmp/3k5yz1228900779.ps tmp/3k5yz1228900779.png")
> system("convert tmp/4shzc1228900779.ps tmp/4shzc1228900779.png")
> system("convert tmp/5xvwe1228900779.ps tmp/5xvwe1228900779.png")
> system("convert tmp/6bhn51228900779.ps tmp/6bhn51228900779.png")
> system("convert tmp/7s4lt1228900779.ps tmp/7s4lt1228900779.png")
> system("convert tmp/8nwku1228900779.ps tmp/8nwku1228900779.png")
> system("convert tmp/9k8241228900779.ps tmp/9k8241228900779.png")
> system("convert tmp/10pn8a1228900779.ps tmp/10pn8a1228900779.png")
>
>
> proc.time()
user system elapsed
2.858 1.652 4.143