R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-pc-linux-gnu (32-bit)
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(104.17
+ ,89.00
+ ,103.88
+ ,103.77
+ ,104.18
+ ,86.40
+ ,103.91
+ ,103.88
+ ,104.2
+ ,84.50
+ ,103.91
+ ,103.91
+ ,104.5
+ ,82.70
+ ,103.92
+ ,103.91
+ ,104.78
+ ,80.80
+ ,104.05
+ ,103.92
+ ,104.88
+ ,81.80
+ ,104.23
+ ,104.05
+ ,104.89
+ ,81.80
+ ,104.30
+ ,104.23
+ ,104.9
+ ,82.90
+ ,104.31
+ ,104.30
+ ,104.95
+ ,83.80
+ ,104.31
+ ,104.31
+ ,105.24
+ ,86.20
+ ,104.34
+ ,104.31
+ ,105.35
+ ,86.10
+ ,104.55
+ ,104.34
+ ,105.44
+ ,86.20
+ ,104.65
+ ,104.55
+ ,105.46
+ ,88.80
+ ,104.73
+ ,104.65
+ ,105.47
+ ,89.60
+ ,104.75
+ ,104.73
+ ,105.48
+ ,87.80
+ ,104.75
+ ,104.75
+ ,105.75
+ ,88.30
+ ,104.76
+ ,104.75
+ ,106.1
+ ,88.60
+ ,104.94
+ ,104.76
+ ,106.19
+ ,91.00
+ ,105.29
+ ,104.94
+ ,106.23
+ ,91.50
+ ,105.38
+ ,105.29
+ ,106.24
+ ,95.40
+ ,105.43
+ ,105.38
+ ,106.25
+ ,98.70
+ ,105.43
+ ,105.43
+ ,106.35
+ ,99.90
+ ,105.42
+ ,105.43
+ ,106.48
+ ,98.60
+ ,105.52
+ ,105.42
+ ,106.52
+ ,100.30
+ ,105.69
+ ,105.52
+ ,106.55
+ ,100.20
+ ,105.72
+ ,105.69
+ ,106.55
+ ,100.40
+ ,105.74
+ ,105.72
+ ,106.56
+ ,101.40
+ ,105.74
+ ,105.74
+ ,106.89
+ ,103.00
+ ,105.74
+ ,105.74
+ ,107.09
+ ,109.10
+ ,105.95
+ ,105.74
+ ,107.24
+ ,111.40
+ ,106.17
+ ,105.95
+ ,107.28
+ ,114.10
+ ,106.34
+ ,106.17
+ ,107.3
+ ,121.80
+ ,106.37
+ ,106.34
+ ,107.31
+ ,127.60
+ ,106.37
+ ,106.37
+ ,107.47
+ ,129.90
+ ,106.36
+ ,106.37
+ ,107.35
+ ,128.00
+ ,106.44
+ ,106.36
+ ,107.31
+ ,123.50
+ ,106.29
+ ,106.44
+ ,107.32
+ ,124.00
+ ,106.23
+ ,106.29
+ ,107.32
+ ,127.40
+ ,106.23
+ ,106.23
+ ,107.34
+ ,127.60
+ ,106.23
+ ,106.23
+ ,107.53
+ ,128.40
+ ,106.23
+ ,106.23
+ ,107.72
+ ,131.40
+ ,106.34
+ ,106.23
+ ,107.75
+ ,135.10
+ ,106.44
+ ,106.34
+ ,107.79
+ ,134.00
+ ,106.44
+ ,106.44
+ ,107.81
+ ,144.50
+ ,106.48
+ ,106.44
+ ,107.9
+ ,147.30
+ ,106.50
+ ,106.48
+ ,107.8
+ ,150.90
+ ,106.57
+ ,106.50
+ ,107.86
+ ,148.70
+ ,106.40
+ ,106.57
+ ,107.8
+ ,141.40
+ ,106.37
+ ,106.40
+ ,107.74
+ ,138.90
+ ,106.25
+ ,106.37
+ ,107.75
+ ,139.80
+ ,106.21
+ ,106.25
+ ,107.83
+ ,145.60
+ ,106.21
+ ,106.21
+ ,107.8
+ ,147.90
+ ,106.24
+ ,106.21
+ ,107.81
+ ,148.50
+ ,106.19
+ ,106.24
+ ,107.86
+ ,151.10
+ ,106.08
+ ,106.19
+ ,107.83
+ ,157.50
+ ,106.13
+ ,106.08)
+ ,dim=c(4
+ ,55)
+ ,dimnames=list(c('X'
+ ,'Y'
+ ,'Y1'
+ ,'Y2')
+ ,1:55))
> y <- array(NA,dim=c(4,55),dimnames=list(c('X','Y','Y1','Y2'),1:55))
> 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 = '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
> 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
X Y Y1 Y2 t
1 104.17 89.0 103.88 103.77 1
2 104.18 86.4 103.91 103.88 2
3 104.20 84.5 103.91 103.91 3
4 104.50 82.7 103.92 103.91 4
5 104.78 80.8 104.05 103.92 5
6 104.88 81.8 104.23 104.05 6
7 104.89 81.8 104.30 104.23 7
8 104.90 82.9 104.31 104.30 8
9 104.95 83.8 104.31 104.31 9
10 105.24 86.2 104.34 104.31 10
11 105.35 86.1 104.55 104.34 11
12 105.44 86.2 104.65 104.55 12
13 105.46 88.8 104.73 104.65 13
14 105.47 89.6 104.75 104.73 14
15 105.48 87.8 104.75 104.75 15
16 105.75 88.3 104.76 104.75 16
17 106.10 88.6 104.94 104.76 17
18 106.19 91.0 105.29 104.94 18
19 106.23 91.5 105.38 105.29 19
20 106.24 95.4 105.43 105.38 20
21 106.25 98.7 105.43 105.43 21
22 106.35 99.9 105.42 105.43 22
23 106.48 98.6 105.52 105.42 23
24 106.52 100.3 105.69 105.52 24
25 106.55 100.2 105.72 105.69 25
26 106.55 100.4 105.74 105.72 26
27 106.56 101.4 105.74 105.74 27
28 106.89 103.0 105.74 105.74 28
29 107.09 109.1 105.95 105.74 29
30 107.24 111.4 106.17 105.95 30
31 107.28 114.1 106.34 106.17 31
32 107.30 121.8 106.37 106.34 32
33 107.31 127.6 106.37 106.37 33
34 107.47 129.9 106.36 106.37 34
35 107.35 128.0 106.44 106.36 35
36 107.31 123.5 106.29 106.44 36
37 107.32 124.0 106.23 106.29 37
38 107.32 127.4 106.23 106.23 38
39 107.34 127.6 106.23 106.23 39
40 107.53 128.4 106.23 106.23 40
41 107.72 131.4 106.34 106.23 41
42 107.75 135.1 106.44 106.34 42
43 107.79 134.0 106.44 106.44 43
44 107.81 144.5 106.48 106.44 44
45 107.90 147.3 106.50 106.48 45
46 107.80 150.9 106.57 106.50 46
47 107.86 148.7 106.40 106.57 47
48 107.80 141.4 106.37 106.40 48
49 107.74 138.9 106.25 106.37 49
50 107.75 139.8 106.21 106.25 50
51 107.83 145.6 106.21 106.21 51
52 107.80 147.9 106.24 106.21 52
53 107.81 148.5 106.19 106.24 53
54 107.86 151.1 106.08 106.19 54
55 107.83 157.5 106.13 106.08 55
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Y Y1 Y2 t
25.726792 -0.008239 1.230030 -0.467759 0.046043
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.176947 -0.065466 -0.006052 0.051970 0.243634
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 25.726792 4.255304 6.046 1.86e-07 ***
Y -0.008239 0.002317 -3.557 0.000832 ***
Y1 1.230030 0.157414 7.814 3.23e-10 ***
Y2 -0.467759 0.163279 -2.865 0.006087 **
t 0.046043 0.004376 10.521 2.83e-14 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.09928 on 50 degrees of freedom
Multiple R-squared: 0.9934, Adjusted R-squared: 0.9929
F-statistic: 1893 on 4 and 50 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.2984299 0.5968597166 0.7015701417
[2,] 0.2199854 0.4399708556 0.7800145722
[3,] 0.1991853 0.3983705803 0.8008147098
[4,] 0.3966517 0.7933034294 0.6033482853
[5,] 0.3026606 0.6053211195 0.6973394402
[6,] 0.2142646 0.4285292462 0.7857353769
[7,] 0.1657172 0.3314344329 0.8342827836
[8,] 0.3105588 0.6211176004 0.6894411998
[9,] 0.2348879 0.4697758783 0.7651120608
[10,] 0.2997816 0.5995632253 0.7002183873
[11,] 0.2597343 0.5194686007 0.7402656997
[12,] 0.4651470 0.9302940595 0.5348529703
[13,] 0.4268900 0.8537799307 0.5731100346
[14,] 0.3563781 0.7127561340 0.6436219330
[15,] 0.3053059 0.6106118973 0.6946940513
[16,] 0.2752778 0.5505556466 0.7247221767
[17,] 0.3741362 0.7482724958 0.6258637521
[18,] 0.3690495 0.7380989192 0.6309505404
[19,] 0.5353384 0.9293231482 0.4646615741
[20,] 0.8240450 0.3519099944 0.1759549972
[21,] 0.8156848 0.3686304332 0.1843152166
[22,] 0.8099918 0.3800164803 0.1900082402
[23,] 0.8295663 0.3408673064 0.1704336532
[24,] 0.7777204 0.4445592727 0.2222796363
[25,] 0.7786760 0.4426480767 0.2213240384
[26,] 0.7348458 0.5303084553 0.2651542276
[27,] 0.8205497 0.3589006436 0.1794503218
[28,] 0.8819558 0.2360883568 0.1180441784
[29,] 0.8560906 0.2878187789 0.1439093894
[30,] 0.8527491 0.2945017129 0.1472508565
[31,] 0.8976461 0.2047078457 0.1023539229
[32,] 0.9925876 0.0148247303 0.0074123652
[33,] 0.9996514 0.0006971328 0.0003485664
[34,] 0.9991991 0.0016017088 0.0008008544
[35,] 0.9983516 0.0032967598 0.0016483799
[36,] 0.9951249 0.0097502259 0.0048751129
[37,] 0.9925743 0.0148513013 0.0074256506
[38,] 0.9926239 0.0147522293 0.0073761147
[39,] 0.9821128 0.0357743033 0.0178871517
[40,] 0.9450219 0.1099561698 0.0549780849
> postscript(file="/var/wessaorg/rcomp/tmp/1ljt01324401879.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/21i2e1324401879.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/39ojn1324401879.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/4yrl31324401879.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/5hqf51324401879.ps",horizontal=F,onefile=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 = 55
Frequency = 1
1 2 3 4 5 6
-0.105639260 -0.148551832 -0.176216629 0.050609442 0.113685575 0.015285784
7 8 9 10 11 12
-0.022662221 -0.029198548 -0.013148030 0.213683197 0.032543166 0.052550991
13 14 15 16 17 18
-0.003695450 -0.020326322 -0.061844766 0.153932075 0.243633539 -0.038948113
19 20 21 22 23 24
0.012142103 -0.011169730 0.003365878 0.079510942 0.025076464 -0.129288183
25 26 27 28 29 30
-0.103536533 -0.158499051 -0.176946993 0.120193558 0.066105430 0.016636495
31 32 33 34 35 36
-0.073357568 0.006661910 0.032440994 0.177649469 -0.107128090 -0.008323050
37 38 39 40 41 42
-0.036608018 -0.082701990 -0.107096690 0.043452289 0.076824806 0.019718773
43 44 45 46 47 48
0.051388701 0.062659296 0.123796981 -0.069330442 0.168348372 -0.040460506
49 50 51 52 53 54
-0.033530958 -0.069087958 -0.006052026 -0.100044746 -0.055609387 0.081685948
55
-0.054579088
> postscript(file="/var/wessaorg/rcomp/tmp/6fjbj1324401879.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 55
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.105639260 NA
1 -0.148551832 -0.105639260
2 -0.176216629 -0.148551832
3 0.050609442 -0.176216629
4 0.113685575 0.050609442
5 0.015285784 0.113685575
6 -0.022662221 0.015285784
7 -0.029198548 -0.022662221
8 -0.013148030 -0.029198548
9 0.213683197 -0.013148030
10 0.032543166 0.213683197
11 0.052550991 0.032543166
12 -0.003695450 0.052550991
13 -0.020326322 -0.003695450
14 -0.061844766 -0.020326322
15 0.153932075 -0.061844766
16 0.243633539 0.153932075
17 -0.038948113 0.243633539
18 0.012142103 -0.038948113
19 -0.011169730 0.012142103
20 0.003365878 -0.011169730
21 0.079510942 0.003365878
22 0.025076464 0.079510942
23 -0.129288183 0.025076464
24 -0.103536533 -0.129288183
25 -0.158499051 -0.103536533
26 -0.176946993 -0.158499051
27 0.120193558 -0.176946993
28 0.066105430 0.120193558
29 0.016636495 0.066105430
30 -0.073357568 0.016636495
31 0.006661910 -0.073357568
32 0.032440994 0.006661910
33 0.177649469 0.032440994
34 -0.107128090 0.177649469
35 -0.008323050 -0.107128090
36 -0.036608018 -0.008323050
37 -0.082701990 -0.036608018
38 -0.107096690 -0.082701990
39 0.043452289 -0.107096690
40 0.076824806 0.043452289
41 0.019718773 0.076824806
42 0.051388701 0.019718773
43 0.062659296 0.051388701
44 0.123796981 0.062659296
45 -0.069330442 0.123796981
46 0.168348372 -0.069330442
47 -0.040460506 0.168348372
48 -0.033530958 -0.040460506
49 -0.069087958 -0.033530958
50 -0.006052026 -0.069087958
51 -0.100044746 -0.006052026
52 -0.055609387 -0.100044746
53 0.081685948 -0.055609387
54 -0.054579088 0.081685948
55 NA -0.054579088
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.148551832 -0.105639260
[2,] -0.176216629 -0.148551832
[3,] 0.050609442 -0.176216629
[4,] 0.113685575 0.050609442
[5,] 0.015285784 0.113685575
[6,] -0.022662221 0.015285784
[7,] -0.029198548 -0.022662221
[8,] -0.013148030 -0.029198548
[9,] 0.213683197 -0.013148030
[10,] 0.032543166 0.213683197
[11,] 0.052550991 0.032543166
[12,] -0.003695450 0.052550991
[13,] -0.020326322 -0.003695450
[14,] -0.061844766 -0.020326322
[15,] 0.153932075 -0.061844766
[16,] 0.243633539 0.153932075
[17,] -0.038948113 0.243633539
[18,] 0.012142103 -0.038948113
[19,] -0.011169730 0.012142103
[20,] 0.003365878 -0.011169730
[21,] 0.079510942 0.003365878
[22,] 0.025076464 0.079510942
[23,] -0.129288183 0.025076464
[24,] -0.103536533 -0.129288183
[25,] -0.158499051 -0.103536533
[26,] -0.176946993 -0.158499051
[27,] 0.120193558 -0.176946993
[28,] 0.066105430 0.120193558
[29,] 0.016636495 0.066105430
[30,] -0.073357568 0.016636495
[31,] 0.006661910 -0.073357568
[32,] 0.032440994 0.006661910
[33,] 0.177649469 0.032440994
[34,] -0.107128090 0.177649469
[35,] -0.008323050 -0.107128090
[36,] -0.036608018 -0.008323050
[37,] -0.082701990 -0.036608018
[38,] -0.107096690 -0.082701990
[39,] 0.043452289 -0.107096690
[40,] 0.076824806 0.043452289
[41,] 0.019718773 0.076824806
[42,] 0.051388701 0.019718773
[43,] 0.062659296 0.051388701
[44,] 0.123796981 0.062659296
[45,] -0.069330442 0.123796981
[46,] 0.168348372 -0.069330442
[47,] -0.040460506 0.168348372
[48,] -0.033530958 -0.040460506
[49,] -0.069087958 -0.033530958
[50,] -0.006052026 -0.069087958
[51,] -0.100044746 -0.006052026
[52,] -0.055609387 -0.100044746
[53,] 0.081685948 -0.055609387
[54,] -0.054579088 0.081685948
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.148551832 -0.105639260
2 -0.176216629 -0.148551832
3 0.050609442 -0.176216629
4 0.113685575 0.050609442
5 0.015285784 0.113685575
6 -0.022662221 0.015285784
7 -0.029198548 -0.022662221
8 -0.013148030 -0.029198548
9 0.213683197 -0.013148030
10 0.032543166 0.213683197
11 0.052550991 0.032543166
12 -0.003695450 0.052550991
13 -0.020326322 -0.003695450
14 -0.061844766 -0.020326322
15 0.153932075 -0.061844766
16 0.243633539 0.153932075
17 -0.038948113 0.243633539
18 0.012142103 -0.038948113
19 -0.011169730 0.012142103
20 0.003365878 -0.011169730
21 0.079510942 0.003365878
22 0.025076464 0.079510942
23 -0.129288183 0.025076464
24 -0.103536533 -0.129288183
25 -0.158499051 -0.103536533
26 -0.176946993 -0.158499051
27 0.120193558 -0.176946993
28 0.066105430 0.120193558
29 0.016636495 0.066105430
30 -0.073357568 0.016636495
31 0.006661910 -0.073357568
32 0.032440994 0.006661910
33 0.177649469 0.032440994
34 -0.107128090 0.177649469
35 -0.008323050 -0.107128090
36 -0.036608018 -0.008323050
37 -0.082701990 -0.036608018
38 -0.107096690 -0.082701990
39 0.043452289 -0.107096690
40 0.076824806 0.043452289
41 0.019718773 0.076824806
42 0.051388701 0.019718773
43 0.062659296 0.051388701
44 0.123796981 0.062659296
45 -0.069330442 0.123796981
46 0.168348372 -0.069330442
47 -0.040460506 0.168348372
48 -0.033530958 -0.040460506
49 -0.069087958 -0.033530958
50 -0.006052026 -0.069087958
51 -0.100044746 -0.006052026
52 -0.055609387 -0.100044746
53 0.081685948 -0.055609387
54 -0.054579088 0.081685948
> 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/wessaorg/rcomp/tmp/705tk1324401879.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/8x25j1324401879.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/9lzkn1324401879.ps",horizontal=F,onefile=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/wessaorg/rcomp/tmp/10hm2r1324401879.ps",horizontal=F,onefile=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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/11bmf91324401879.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/wessaorg/rcomp/tmp/12d1dv1324401879.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/wessaorg/rcomp/tmp/13rs071324401879.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/wessaorg/rcomp/tmp/14bcrc1324401879.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/wessaorg/rcomp/tmp/15hkwf1324401879.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/wessaorg/rcomp/tmp/16m1z81324401879.tab")
+ }
>
> try(system("convert tmp/1ljt01324401879.ps tmp/1ljt01324401879.png",intern=TRUE))
character(0)
> try(system("convert tmp/21i2e1324401879.ps tmp/21i2e1324401879.png",intern=TRUE))
character(0)
> try(system("convert tmp/39ojn1324401879.ps tmp/39ojn1324401879.png",intern=TRUE))
character(0)
> try(system("convert tmp/4yrl31324401879.ps tmp/4yrl31324401879.png",intern=TRUE))
character(0)
> try(system("convert tmp/5hqf51324401879.ps tmp/5hqf51324401879.png",intern=TRUE))
character(0)
> try(system("convert tmp/6fjbj1324401879.ps tmp/6fjbj1324401879.png",intern=TRUE))
character(0)
> try(system("convert tmp/705tk1324401879.ps tmp/705tk1324401879.png",intern=TRUE))
character(0)
> try(system("convert tmp/8x25j1324401879.ps tmp/8x25j1324401879.png",intern=TRUE))
character(0)
> try(system("convert tmp/9lzkn1324401879.ps tmp/9lzkn1324401879.png",intern=TRUE))
character(0)
> try(system("convert tmp/10hm2r1324401879.ps tmp/10hm2r1324401879.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.181 0.588 3.776