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(97.6,82.9,96.9,83.8,105.6,86.2,102.8,86.1,101.7,86.2,104.2,88.8,92.7,89.6,91.9,87.8,106.5,88.3,112.3,88.6,102.8,91,96.5,91.5,101,95.4,98.9,98.7,105.1,99.9,103,98.6,99,100.3,104.3,100.2,94.6,100.4,90.4,101.4,108.9,103,111.4,109.1,100.8,111.4,102.5,114.1,98.2,121.8,98.7,127.6,113.3,129.9,104.6,128,99.3,123.5,111.8,124,97.3,127.4,97.7,127.6,115.6,128.4,111.9,131.4,107,135.1,107.1,134,100.6,144.5,99.2,147.3,108.4,150.9,103,148.7,99.8,141.4,115,138.9,90.8,139.8,95.9,145.6,114.4,147.9,108.2,148.5,112.6,151.1,109.1,157.5,105,167.5,105,172.3,118.5,173.5,103.7,187.5,112.5,205.5,116.6,195.1,96.6,204.5,101.9,204.5,116.5,201.7,119.3,207,115.4,206.6,108.5,210.6,111.5,211.1,108.8,215,121.8,223.9,109.6,238.2,112.2,238.9,119.6,229.6,104.1,232.2,105.3,222.1,115,221.6,124.1,227.3,116.8,221,107.5,213.6,115.6,243.4),dim=c(2,73),dimnames=list(c('tot_indus','prijsindex'),1:73))
> y <- array(NA,dim=c(2,73),dimnames=list(c('tot_indus','prijsindex'),1:73))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = '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
tot_indus prijsindex M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 97.6 82.9 1 0 0 0 0 0 0 0 0 0 0 1
2 96.9 83.8 0 1 0 0 0 0 0 0 0 0 0 2
3 105.6 86.2 0 0 1 0 0 0 0 0 0 0 0 3
4 102.8 86.1 0 0 0 1 0 0 0 0 0 0 0 4
5 101.7 86.2 0 0 0 0 1 0 0 0 0 0 0 5
6 104.2 88.8 0 0 0 0 0 1 0 0 0 0 0 6
7 92.7 89.6 0 0 0 0 0 0 1 0 0 0 0 7
8 91.9 87.8 0 0 0 0 0 0 0 1 0 0 0 8
9 106.5 88.3 0 0 0 0 0 0 0 0 1 0 0 9
10 112.3 88.6 0 0 0 0 0 0 0 0 0 1 0 10
11 102.8 91.0 0 0 0 0 0 0 0 0 0 0 1 11
12 96.5 91.5 0 0 0 0 0 0 0 0 0 0 0 12
13 101.0 95.4 1 0 0 0 0 0 0 0 0 0 0 13
14 98.9 98.7 0 1 0 0 0 0 0 0 0 0 0 14
15 105.1 99.9 0 0 1 0 0 0 0 0 0 0 0 15
16 103.0 98.6 0 0 0 1 0 0 0 0 0 0 0 16
17 99.0 100.3 0 0 0 0 1 0 0 0 0 0 0 17
18 104.3 100.2 0 0 0 0 0 1 0 0 0 0 0 18
19 94.6 100.4 0 0 0 0 0 0 1 0 0 0 0 19
20 90.4 101.4 0 0 0 0 0 0 0 1 0 0 0 20
21 108.9 103.0 0 0 0 0 0 0 0 0 1 0 0 21
22 111.4 109.1 0 0 0 0 0 0 0 0 0 1 0 22
23 100.8 111.4 0 0 0 0 0 0 0 0 0 0 1 23
24 102.5 114.1 0 0 0 0 0 0 0 0 0 0 0 24
25 98.2 121.8 1 0 0 0 0 0 0 0 0 0 0 25
26 98.7 127.6 0 1 0 0 0 0 0 0 0 0 0 26
27 113.3 129.9 0 0 1 0 0 0 0 0 0 0 0 27
28 104.6 128.0 0 0 0 1 0 0 0 0 0 0 0 28
29 99.3 123.5 0 0 0 0 1 0 0 0 0 0 0 29
30 111.8 124.0 0 0 0 0 0 1 0 0 0 0 0 30
31 97.3 127.4 0 0 0 0 0 0 1 0 0 0 0 31
32 97.7 127.6 0 0 0 0 0 0 0 1 0 0 0 32
33 115.6 128.4 0 0 0 0 0 0 0 0 1 0 0 33
34 111.9 131.4 0 0 0 0 0 0 0 0 0 1 0 34
35 107.0 135.1 0 0 0 0 0 0 0 0 0 0 1 35
36 107.1 134.0 0 0 0 0 0 0 0 0 0 0 0 36
37 100.6 144.5 1 0 0 0 0 0 0 0 0 0 0 37
38 99.2 147.3 0 1 0 0 0 0 0 0 0 0 0 38
39 108.4 150.9 0 0 1 0 0 0 0 0 0 0 0 39
40 103.0 148.7 0 0 0 1 0 0 0 0 0 0 0 40
41 99.8 141.4 0 0 0 0 1 0 0 0 0 0 0 41
42 115.0 138.9 0 0 0 0 0 1 0 0 0 0 0 42
43 90.8 139.8 0 0 0 0 0 0 1 0 0 0 0 43
44 95.9 145.6 0 0 0 0 0 0 0 1 0 0 0 44
45 114.4 147.9 0 0 0 0 0 0 0 0 1 0 0 45
46 108.2 148.5 0 0 0 0 0 0 0 0 0 1 0 46
47 112.6 151.1 0 0 0 0 0 0 0 0 0 0 1 47
48 109.1 157.5 0 0 0 0 0 0 0 0 0 0 0 48
49 105.0 167.5 1 0 0 0 0 0 0 0 0 0 0 49
50 105.0 172.3 0 1 0 0 0 0 0 0 0 0 0 50
51 118.5 173.5 0 0 1 0 0 0 0 0 0 0 0 51
52 103.7 187.5 0 0 0 1 0 0 0 0 0 0 0 52
53 112.5 205.5 0 0 0 0 1 0 0 0 0 0 0 53
54 116.6 195.1 0 0 0 0 0 1 0 0 0 0 0 54
55 96.6 204.5 0 0 0 0 0 0 1 0 0 0 0 55
56 101.9 204.5 0 0 0 0 0 0 0 1 0 0 0 56
57 116.5 201.7 0 0 0 0 0 0 0 0 1 0 0 57
58 119.3 207.0 0 0 0 0 0 0 0 0 0 1 0 58
59 115.4 206.6 0 0 0 0 0 0 0 0 0 0 1 59
60 108.5 210.6 0 0 0 0 0 0 0 0 0 0 0 60
61 111.5 211.1 1 0 0 0 0 0 0 0 0 0 0 61
62 108.8 215.0 0 1 0 0 0 0 0 0 0 0 0 62
63 121.8 223.9 0 0 1 0 0 0 0 0 0 0 0 63
64 109.6 238.2 0 0 0 1 0 0 0 0 0 0 0 64
65 112.2 238.9 0 0 0 0 1 0 0 0 0 0 0 65
66 119.6 229.6 0 0 0 0 0 1 0 0 0 0 0 66
67 104.1 232.2 0 0 0 0 0 0 1 0 0 0 0 67
68 105.3 222.1 0 0 0 0 0 0 0 1 0 0 0 68
69 115.0 221.6 0 0 0 0 0 0 0 0 1 0 0 69
70 124.1 227.3 0 0 0 0 0 0 0 0 0 1 0 70
71 116.8 221.0 0 0 0 0 0 0 0 0 0 0 1 71
72 107.5 213.6 0 0 0 0 0 0 0 0 0 0 0 72
73 115.6 243.4 1 0 0 0 0 0 0 0 0 0 0 73
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) prijsindex M1 M2 M3 M4
90.83209 0.10254 -1.02882 -2.96881 7.59568 -0.42785
M5 M6 M7 M8 M9 M10
-0.91041 7.28385 -8.87902 -7.59582 8.03783 9.42840
M11 t
4.08770 -0.03279
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-5.7794 -2.3345 0.1049 2.0506 4.6459
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 90.83209 2.27100 39.997 < 2e-16 ***
prijsindex 0.10254 0.03259 3.146 0.00259 **
M1 -1.02882 1.67256 -0.615 0.54084
M2 -2.96881 1.73957 -1.707 0.09315 .
M3 7.59568 1.74436 4.354 5.39e-05 ***
M4 -0.42785 1.75394 -0.244 0.80813
M5 -0.91041 1.74596 -0.521 0.60401
M6 7.28385 1.71305 4.252 7.66e-05 ***
M7 -8.87902 1.71448 -5.179 2.83e-06 ***
M8 -7.59582 1.70285 -4.461 3.73e-05 ***
M9 8.03783 1.69853 4.732 1.43e-05 ***
M10 9.42840 1.69997 5.546 7.22e-07 ***
M11 4.08770 1.69739 2.408 0.01917 *
t -0.03279 0.07807 -0.420 0.67601
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.939 on 59 degrees of freedom
Multiple R-squared: 0.8851, Adjusted R-squared: 0.8598
F-statistic: 34.96 on 13 and 59 DF, p-value: < 2.2e-16
> 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.219275881 0.43855176 0.78072412
[2,] 0.120501672 0.24100334 0.87949833
[3,] 0.060198314 0.12039663 0.93980169
[4,] 0.035421033 0.07084207 0.96457897
[5,] 0.027048897 0.05409779 0.97295110
[6,] 0.011771810 0.02354362 0.98822819
[7,] 0.007220371 0.01444074 0.99277963
[8,] 0.050230756 0.10046151 0.94976924
[9,] 0.044362075 0.08872415 0.95563792
[10,] 0.025545744 0.05109149 0.97445426
[11,] 0.096736254 0.19347251 0.90326375
[12,] 0.076217042 0.15243408 0.92378296
[13,] 0.067856150 0.13571230 0.93214385
[14,] 0.127313065 0.25462613 0.87268694
[15,] 0.125859526 0.25171905 0.87414047
[16,] 0.130464877 0.26092975 0.86953512
[17,] 0.226503369 0.45300674 0.77349663
[18,] 0.205504408 0.41100882 0.79449559
[19,] 0.165038571 0.33007714 0.83496143
[20,] 0.234791972 0.46958394 0.76520803
[21,] 0.232396222 0.46479244 0.76760378
[22,] 0.225807367 0.45161473 0.77419263
[23,] 0.379705713 0.75941143 0.62029429
[24,] 0.387662083 0.77532417 0.61233792
[25,] 0.418967023 0.83793405 0.58103298
[26,] 0.532371891 0.93525622 0.46762811
[27,] 0.582354360 0.83529128 0.41764564
[28,] 0.501015334 0.99796933 0.49898467
[29,] 0.542462647 0.91507471 0.45753735
[30,] 0.828608865 0.34278227 0.17139114
[31,] 0.837601590 0.32479682 0.16239841
[32,] 0.962442901 0.07511420 0.03755710
[33,] 0.953121392 0.09375722 0.04687861
[34,] 0.918505549 0.16298890 0.08149445
[35,] 0.899744693 0.20051061 0.10025531
[36,] 0.863308407 0.27338319 0.13669159
[37,] 0.904482263 0.19103547 0.09551774
[38,] 0.870098325 0.25980335 0.12990167
[39,] 0.882841712 0.23431658 0.11715829
[40,] 0.794072458 0.41185508 0.20592754
> postscript(file="/var/www/html/rcomp/tmp/1igy51258644500.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/2h4rf1258644500.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/38bg01258644500.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/4re5o1258644500.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/5i1p71258644500.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 = 73
Frequency = 1
1 2 3 4 5 6
-0.67112109 0.50937370 -1.56842410 3.69815246 3.10324947 -2.82482165
7 8 9 10 11 12
1.78880543 -0.07702925 -1.12916177 3.28230276 -1.09030792 -3.32108524
13 14 15 16 17 18
1.84061809 1.37501450 -3.07973411 3.00989165 -0.64907694 -3.50028736
19 20 21 22 23 24
2.97486431 -2.57808516 0.15698722 0.67371396 -4.78864262 0.75498987
25 26 27 28 29 30
-3.27296259 -1.39491868 2.43753762 1.98868797 -2.33452642 1.95273855
31 32 33 34 35 36
3.29975904 2.42884235 4.64594754 -0.71944863 -0.62536260 3.70792567
37 38 39 40 41 42
-2.80714158 -2.52147467 -4.22232167 -1.34040902 -3.27650863 4.01837934
43 44 45 46 47 48
-4.07824768 -0.82339395 1.83989974 -5.77939803 3.72748309 3.69171389
49 50 51 52 53 54
-0.37208286 1.10850204 3.95375344 -4.22549807 3.24411509 0.24907694
55 56 57 58 59 60
-4.51914856 -0.46955704 -1.18330427 -0.28454473 1.22995938 -1.95971143
61 62 63 64 65 66
2.05063130 0.92350310 2.47918882 -3.13082499 -0.08725257 0.10491418
67 68 69 70 71 72
0.53396746 1.51922305 -4.33036846 2.82737467 1.54687067 -2.87383276
73
3.23205873
> postscript(file="/var/www/html/rcomp/tmp/6z9xz1258644500.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 = 73
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.67112109 NA
1 0.50937370 -0.67112109
2 -1.56842410 0.50937370
3 3.69815246 -1.56842410
4 3.10324947 3.69815246
5 -2.82482165 3.10324947
6 1.78880543 -2.82482165
7 -0.07702925 1.78880543
8 -1.12916177 -0.07702925
9 3.28230276 -1.12916177
10 -1.09030792 3.28230276
11 -3.32108524 -1.09030792
12 1.84061809 -3.32108524
13 1.37501450 1.84061809
14 -3.07973411 1.37501450
15 3.00989165 -3.07973411
16 -0.64907694 3.00989165
17 -3.50028736 -0.64907694
18 2.97486431 -3.50028736
19 -2.57808516 2.97486431
20 0.15698722 -2.57808516
21 0.67371396 0.15698722
22 -4.78864262 0.67371396
23 0.75498987 -4.78864262
24 -3.27296259 0.75498987
25 -1.39491868 -3.27296259
26 2.43753762 -1.39491868
27 1.98868797 2.43753762
28 -2.33452642 1.98868797
29 1.95273855 -2.33452642
30 3.29975904 1.95273855
31 2.42884235 3.29975904
32 4.64594754 2.42884235
33 -0.71944863 4.64594754
34 -0.62536260 -0.71944863
35 3.70792567 -0.62536260
36 -2.80714158 3.70792567
37 -2.52147467 -2.80714158
38 -4.22232167 -2.52147467
39 -1.34040902 -4.22232167
40 -3.27650863 -1.34040902
41 4.01837934 -3.27650863
42 -4.07824768 4.01837934
43 -0.82339395 -4.07824768
44 1.83989974 -0.82339395
45 -5.77939803 1.83989974
46 3.72748309 -5.77939803
47 3.69171389 3.72748309
48 -0.37208286 3.69171389
49 1.10850204 -0.37208286
50 3.95375344 1.10850204
51 -4.22549807 3.95375344
52 3.24411509 -4.22549807
53 0.24907694 3.24411509
54 -4.51914856 0.24907694
55 -0.46955704 -4.51914856
56 -1.18330427 -0.46955704
57 -0.28454473 -1.18330427
58 1.22995938 -0.28454473
59 -1.95971143 1.22995938
60 2.05063130 -1.95971143
61 0.92350310 2.05063130
62 2.47918882 0.92350310
63 -3.13082499 2.47918882
64 -0.08725257 -3.13082499
65 0.10491418 -0.08725257
66 0.53396746 0.10491418
67 1.51922305 0.53396746
68 -4.33036846 1.51922305
69 2.82737467 -4.33036846
70 1.54687067 2.82737467
71 -2.87383276 1.54687067
72 3.23205873 -2.87383276
73 NA 3.23205873
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.50937370 -0.67112109
[2,] -1.56842410 0.50937370
[3,] 3.69815246 -1.56842410
[4,] 3.10324947 3.69815246
[5,] -2.82482165 3.10324947
[6,] 1.78880543 -2.82482165
[7,] -0.07702925 1.78880543
[8,] -1.12916177 -0.07702925
[9,] 3.28230276 -1.12916177
[10,] -1.09030792 3.28230276
[11,] -3.32108524 -1.09030792
[12,] 1.84061809 -3.32108524
[13,] 1.37501450 1.84061809
[14,] -3.07973411 1.37501450
[15,] 3.00989165 -3.07973411
[16,] -0.64907694 3.00989165
[17,] -3.50028736 -0.64907694
[18,] 2.97486431 -3.50028736
[19,] -2.57808516 2.97486431
[20,] 0.15698722 -2.57808516
[21,] 0.67371396 0.15698722
[22,] -4.78864262 0.67371396
[23,] 0.75498987 -4.78864262
[24,] -3.27296259 0.75498987
[25,] -1.39491868 -3.27296259
[26,] 2.43753762 -1.39491868
[27,] 1.98868797 2.43753762
[28,] -2.33452642 1.98868797
[29,] 1.95273855 -2.33452642
[30,] 3.29975904 1.95273855
[31,] 2.42884235 3.29975904
[32,] 4.64594754 2.42884235
[33,] -0.71944863 4.64594754
[34,] -0.62536260 -0.71944863
[35,] 3.70792567 -0.62536260
[36,] -2.80714158 3.70792567
[37,] -2.52147467 -2.80714158
[38,] -4.22232167 -2.52147467
[39,] -1.34040902 -4.22232167
[40,] -3.27650863 -1.34040902
[41,] 4.01837934 -3.27650863
[42,] -4.07824768 4.01837934
[43,] -0.82339395 -4.07824768
[44,] 1.83989974 -0.82339395
[45,] -5.77939803 1.83989974
[46,] 3.72748309 -5.77939803
[47,] 3.69171389 3.72748309
[48,] -0.37208286 3.69171389
[49,] 1.10850204 -0.37208286
[50,] 3.95375344 1.10850204
[51,] -4.22549807 3.95375344
[52,] 3.24411509 -4.22549807
[53,] 0.24907694 3.24411509
[54,] -4.51914856 0.24907694
[55,] -0.46955704 -4.51914856
[56,] -1.18330427 -0.46955704
[57,] -0.28454473 -1.18330427
[58,] 1.22995938 -0.28454473
[59,] -1.95971143 1.22995938
[60,] 2.05063130 -1.95971143
[61,] 0.92350310 2.05063130
[62,] 2.47918882 0.92350310
[63,] -3.13082499 2.47918882
[64,] -0.08725257 -3.13082499
[65,] 0.10491418 -0.08725257
[66,] 0.53396746 0.10491418
[67,] 1.51922305 0.53396746
[68,] -4.33036846 1.51922305
[69,] 2.82737467 -4.33036846
[70,] 1.54687067 2.82737467
[71,] -2.87383276 1.54687067
[72,] 3.23205873 -2.87383276
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.50937370 -0.67112109
2 -1.56842410 0.50937370
3 3.69815246 -1.56842410
4 3.10324947 3.69815246
5 -2.82482165 3.10324947
6 1.78880543 -2.82482165
7 -0.07702925 1.78880543
8 -1.12916177 -0.07702925
9 3.28230276 -1.12916177
10 -1.09030792 3.28230276
11 -3.32108524 -1.09030792
12 1.84061809 -3.32108524
13 1.37501450 1.84061809
14 -3.07973411 1.37501450
15 3.00989165 -3.07973411
16 -0.64907694 3.00989165
17 -3.50028736 -0.64907694
18 2.97486431 -3.50028736
19 -2.57808516 2.97486431
20 0.15698722 -2.57808516
21 0.67371396 0.15698722
22 -4.78864262 0.67371396
23 0.75498987 -4.78864262
24 -3.27296259 0.75498987
25 -1.39491868 -3.27296259
26 2.43753762 -1.39491868
27 1.98868797 2.43753762
28 -2.33452642 1.98868797
29 1.95273855 -2.33452642
30 3.29975904 1.95273855
31 2.42884235 3.29975904
32 4.64594754 2.42884235
33 -0.71944863 4.64594754
34 -0.62536260 -0.71944863
35 3.70792567 -0.62536260
36 -2.80714158 3.70792567
37 -2.52147467 -2.80714158
38 -4.22232167 -2.52147467
39 -1.34040902 -4.22232167
40 -3.27650863 -1.34040902
41 4.01837934 -3.27650863
42 -4.07824768 4.01837934
43 -0.82339395 -4.07824768
44 1.83989974 -0.82339395
45 -5.77939803 1.83989974
46 3.72748309 -5.77939803
47 3.69171389 3.72748309
48 -0.37208286 3.69171389
49 1.10850204 -0.37208286
50 3.95375344 1.10850204
51 -4.22549807 3.95375344
52 3.24411509 -4.22549807
53 0.24907694 3.24411509
54 -4.51914856 0.24907694
55 -0.46955704 -4.51914856
56 -1.18330427 -0.46955704
57 -0.28454473 -1.18330427
58 1.22995938 -0.28454473
59 -1.95971143 1.22995938
60 2.05063130 -1.95971143
61 0.92350310 2.05063130
62 2.47918882 0.92350310
63 -3.13082499 2.47918882
64 -0.08725257 -3.13082499
65 0.10491418 -0.08725257
66 0.53396746 0.10491418
67 1.51922305 0.53396746
68 -4.33036846 1.51922305
69 2.82737467 -4.33036846
70 1.54687067 2.82737467
71 -2.87383276 1.54687067
72 3.23205873 -2.87383276
> 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/72r2r1258644500.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/8qq9i1258644500.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/90uvx1258644500.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/10nuou1258644500.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/117ckh1258644500.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/12fln21258644500.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/13xuev1258644501.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/14akh81258644501.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/15alcx1258644501.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/16nts51258644501.tab")
+ }
>
> system("convert tmp/1igy51258644500.ps tmp/1igy51258644500.png")
> system("convert tmp/2h4rf1258644500.ps tmp/2h4rf1258644500.png")
> system("convert tmp/38bg01258644500.ps tmp/38bg01258644500.png")
> system("convert tmp/4re5o1258644500.ps tmp/4re5o1258644500.png")
> system("convert tmp/5i1p71258644500.ps tmp/5i1p71258644500.png")
> system("convert tmp/6z9xz1258644500.ps tmp/6z9xz1258644500.png")
> system("convert tmp/72r2r1258644500.ps tmp/72r2r1258644500.png")
> system("convert tmp/8qq9i1258644500.ps tmp/8qq9i1258644500.png")
> system("convert tmp/90uvx1258644500.ps tmp/90uvx1258644500.png")
> system("convert tmp/10nuou1258644500.ps tmp/10nuou1258644500.png")
>
>
> proc.time()
user system elapsed
2.598 1.607 3.999