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(89.1
+ ,72.7
+ ,103.5
+ ,8.2
+ ,82.6
+ ,79.7
+ ,104.6
+ ,8.3
+ ,102.7
+ ,115.8
+ ,118.6
+ ,8.1
+ ,91.8
+ ,87.8
+ ,106.3
+ ,7.4
+ ,94.1
+ ,99.2
+ ,110.7
+ ,7.3
+ ,103.1
+ ,111.4
+ ,121.6
+ ,7.7
+ ,93.2
+ ,102.3
+ ,107
+ ,8
+ ,91
+ ,94.4
+ ,107.6
+ ,8
+ ,94.3
+ ,118.5
+ ,125.6
+ ,7.7
+ ,99.4
+ ,112.1
+ ,113.5
+ ,6.9
+ ,115.7
+ ,136.5
+ ,129.2
+ ,6.6
+ ,116.8
+ ,139.8
+ ,130.9
+ ,6.9
+ ,99.8
+ ,104.5
+ ,104.7
+ ,7.5
+ ,96
+ ,123.3
+ ,115.2
+ ,7.9
+ ,115.9
+ ,156.6
+ ,124.5
+ ,7.7
+ ,109.1
+ ,136.2
+ ,112.3
+ ,6.5
+ ,117.3
+ ,147.5
+ ,127.5
+ ,6.1
+ ,109.8
+ ,143.8
+ ,120.6
+ ,6.4
+ ,112.8
+ ,135.8
+ ,117.5
+ ,6.8
+ ,110.7
+ ,121.6
+ ,117.7
+ ,7.1
+ ,100
+ ,128
+ ,120.4
+ ,7.3
+ ,113.3
+ ,129.7
+ ,125
+ ,7.2
+ ,122.4
+ ,136.2
+ ,131.6
+ ,7
+ ,112.5
+ ,130.5
+ ,121.1
+ ,7
+ ,104.2
+ ,99.2
+ ,114.2
+ ,7
+ ,92.5
+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,121.1
+ ,8.2
+ ,114.1
+ ,113.6
+ ,128.4
+ ,8.7)
+ ,dim=c(4
+ ,60)
+ ,dimnames=list(c('TotaleIndustrieleProductie'
+ ,'Investeringsgoederen'
+ ,'Consumptiegoederen'
+ ,'BrutoInflatie')
+ ,1:60))
> y <- array(NA,dim=c(4,60),dimnames=list(c('TotaleIndustrieleProductie','Investeringsgoederen','Consumptiegoederen','BrutoInflatie'),1:60))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = '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
TotaleIndustrieleProductie Investeringsgoederen Consumptiegoederen
1 89.1 72.7 103.5
2 82.6 79.7 104.6
3 102.7 115.8 118.6
4 91.8 87.8 106.3
5 94.1 99.2 110.7
6 103.1 111.4 121.6
7 93.2 102.3 107.0
8 91.0 94.4 107.6
9 94.3 118.5 125.6
10 99.4 112.1 113.5
11 115.7 136.5 129.2
12 116.8 139.8 130.9
13 99.8 104.5 104.7
14 96.0 123.3 115.2
15 115.9 156.6 124.5
16 109.1 136.2 112.3
17 117.3 147.5 127.5
18 109.8 143.8 120.6
19 112.8 135.8 117.5
20 110.7 121.6 117.7
21 100.0 128.0 120.4
22 113.3 129.7 125.0
23 122.4 136.2 131.6
24 112.5 130.5 121.1
25 104.2 99.2 114.2
26 92.5 110.4 112.1
27 117.2 151.6 127.0
28 109.3 129.6 116.8
29 106.1 123.6 112.0
30 118.8 142.7 129.7
31 105.3 119.0 113.6
32 106.0 118.1 115.7
33 102.0 120.0 119.5
34 112.9 124.3 125.8
35 116.5 123.3 129.6
36 114.8 122.4 128.0
37 100.5 90.5 112.8
38 85.4 91.0 101.6
39 114.6 137.0 123.9
40 109.9 127.7 118.8
41 100.7 105.1 109.1
42 115.5 135.6 130.6
43 100.7 112.4 112.4
44 99.0 102.5 111.0
45 102.3 112.6 116.2
46 108.8 110.8 119.8
47 105.9 103.4 117.2
48 113.2 117.6 127.3
49 95.7 87.5 107.7
50 80.9 87.0 97.5
51 113.9 130.0 120.1
52 98.1 102.9 110.6
53 102.8 111.1 111.3
54 104.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 0 0 0 0 0 30
31 7.9 0 0 0 0 0 0 1 0 0 0 0 31
32 8.0 0 0 0 0 0 0 0 1 0 0 0 32
33 8.0 0 0 0 0 0 0 0 0 1 0 0 33
34 7.9 0 0 0 0 0 0 0 0 0 1 0 34
35 7.9 0 0 0 0 0 0 0 0 0 0 1 35
36 8.0 0 0 0 0 0 0 0 0 0 0 0 36
37 8.1 1 0 0 0 0 0 0 0 0 0 0 37
38 8.1 0 1 0 0 0 0 0 0 0 0 0 38
39 8.2 0 0 1 0 0 0 0 0 0 0 0 39
40 8.0 0 0 0 1 0 0 0 0 0 0 0 40
41 8.3 0 0 0 0 1 0 0 0 0 0 0 41
42 8.5 0 0 0 0 0 1 0 0 0 0 0 42
43 8.6 0 0 0 0 0 0 1 0 0 0 0 43
44 8.7 0 0 0 0 0 0 0 1 0 0 0 44
45 8.7 0 0 0 0 0 0 0 0 1 0 0 45
46 8.5 0 0 0 0 0 0 0 0 0 1 0 46
47 8.4 0 0 0 0 0 0 0 0 0 0 1 47
48 8.5 0 0 0 0 0 0 0 0 0 0 0 48
49 8.7 1 0 0 0 0 0 0 0 0 0 0 49
50 8.7 0 1 0 0 0 0 0 0 0 0 0 50
51 8.6 0 0 1 0 0 0 0 0 0 0 0 51
52 7.9 0 0 0 1 0 0 0 0 0 0 0 52
53 8.1 0 0 0 0 1 0 0 0 0 0 0 53
54 8.2 0 0 0 0 0 1 0 0 0 0 0 54
55 8.5 0 0 0 0 0 0 1 0 0 0 0 55
56 8.6 0 0 0 0 0 0 0 1 0 0 0 56
57 8.5 0 0 0 0 0 0 0 0 1 0 0 57
58 8.3 0 0 0 0 0 0 0 0 0 1 0 58
59 8.2 0 0 0 0 0 0 0 0 0 0 1 59
60 8.7 0 0 0 0 0 0 0 0 0 0 0 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Investeringsgoederen Consumptiegoederen
9.66386 0.29795 0.47936
BrutoInflatie M1 M2
0.57481 3.14166 -8.44974
M3 M4 M5
-2.96336 -0.79174 -1.03781
M6 M7 M8
-4.54221 -1.99582 -1.49535
M9 M10 M11
-9.69478 -0.83470 1.41278
t
0.05547
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-6.1091 -1.2594 0.1007 1.2274 5.5829
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.66386 12.33521 0.783 0.437567
Investeringsgoederen 0.29795 0.04543 6.558 5.10e-08 ***
Consumptiegoederen 0.47936 0.09224 5.197 5.02e-06 ***
BrutoInflatie 0.57481 0.99729 0.576 0.567302
M1 3.14166 1.96662 1.597 0.117314
M2 -8.44974 2.07068 -4.081 0.000186 ***
M3 -2.96336 1.90285 -1.557 0.126558
M4 -0.79174 1.87727 -0.422 0.675259
M5 -1.03781 1.81570 -0.572 0.570518
M6 -4.54221 1.60629 -2.828 0.007030 **
M7 -1.99582 1.95724 -1.020 0.313440
M8 -1.49535 1.82000 -0.822 0.415722
M9 -9.69478 1.54515 -6.274 1.33e-07 ***
M10 -0.83470 1.56529 -0.533 0.596540
M11 1.41278 1.51618 0.932 0.356521
t 0.05547 0.02797 1.983 0.053628 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.367 on 44 degrees of freedom
Multiple R-squared: 0.9549, Adjusted R-squared: 0.9395
F-statistic: 62.11 on 15 and 44 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.6813920 0.63721607 0.31860804
[2,] 0.7154936 0.56901282 0.28450641
[3,] 0.7049114 0.59017728 0.29508864
[4,] 0.6381050 0.72379007 0.36189504
[5,] 0.5470126 0.90597472 0.45298736
[6,] 0.5225047 0.95499051 0.47749526
[7,] 0.9246693 0.15066132 0.07533066
[8,] 0.9446897 0.11062062 0.05531031
[9,] 0.9583457 0.08330858 0.04165429
[10,] 0.9375747 0.12485059 0.06242530
[11,] 0.9171966 0.16560675 0.08280338
[12,] 0.9176319 0.16473628 0.08236814
[13,] 0.9166517 0.16669658 0.08334829
[14,] 0.9110739 0.17785215 0.08892607
[15,] 0.9109204 0.17815916 0.08907958
[16,] 0.8650890 0.26982208 0.13491104
[17,] 0.8115149 0.37697016 0.18848508
[18,] 0.7373897 0.52522065 0.26261032
[19,] 0.7592302 0.48153969 0.24076984
[20,] 0.9518723 0.09625543 0.04812771
[21,] 0.9143269 0.17134622 0.08567311
[22,] 0.9676612 0.06467758 0.03233879
[23,] 0.9057326 0.18853474 0.09426737
> postscript(file="/var/www/html/rcomp/tmp/1yjos1258722422.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/2hoc51258722422.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/38hcf1258722422.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/4zru61258722422.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/5bf0j1258722422.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 60
Frequency = 1
1 2 3 4 5 6
0.25079326 2.61628803 -0.17764820 1.33636623 -1.62137699 1.73760035
7 8 9 10 11 12
-1.22668992 -1.91644354 -6.10913196 -1.75769934 -2.38415942 -1.89743969
13 14 15 16 17 18
0.63743009 -2.49131907 -2.39800074 1.19105848 -0.84153865 -0.65505574
19 20 21 22 23 24
3.38278428 4.68941998 -1.18273757 0.54761429 2.35916439 0.54807578
25 26 27 28 29 30
1.68437474 -0.98253076 -1.35736141 0.13237086 0.92419476 2.72514504
31 32 33 34 35 36
1.45989419 0.80796653 2.56425101 0.30501931 0.07844472 0.71340670
37 38 39 40 41 42
-0.05031435 1.60547054 0.81069248 -0.78576367 1.41586394 0.15609126
43 44 45 46 47 48
-1.66643970 -0.35905269 5.58293408 2.09295342 0.39864812 -0.07395652
49 50 51 52 53 54
-2.52228373 -0.74790874 3.12231787 -1.87403191 0.12285694 -3.96378091
55 56 57 58 59 60
-1.94954885 -3.22189028 -0.85531555 -1.18788768 -0.45209780 0.70991373
> postscript(file="/var/www/html/rcomp/tmp/6m4ky1258722422.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 0.25079326 NA
1 2.61628803 0.25079326
2 -0.17764820 2.61628803
3 1.33636623 -0.17764820
4 -1.62137699 1.33636623
5 1.73760035 -1.62137699
6 -1.22668992 1.73760035
7 -1.91644354 -1.22668992
8 -6.10913196 -1.91644354
9 -1.75769934 -6.10913196
10 -2.38415942 -1.75769934
11 -1.89743969 -2.38415942
12 0.63743009 -1.89743969
13 -2.49131907 0.63743009
14 -2.39800074 -2.49131907
15 1.19105848 -2.39800074
16 -0.84153865 1.19105848
17 -0.65505574 -0.84153865
18 3.38278428 -0.65505574
19 4.68941998 3.38278428
20 -1.18273757 4.68941998
21 0.54761429 -1.18273757
22 2.35916439 0.54761429
23 0.54807578 2.35916439
24 1.68437474 0.54807578
25 -0.98253076 1.68437474
26 -1.35736141 -0.98253076
27 0.13237086 -1.35736141
28 0.92419476 0.13237086
29 2.72514504 0.92419476
30 1.45989419 2.72514504
31 0.80796653 1.45989419
32 2.56425101 0.80796653
33 0.30501931 2.56425101
34 0.07844472 0.30501931
35 0.71340670 0.07844472
36 -0.05031435 0.71340670
37 1.60547054 -0.05031435
38 0.81069248 1.60547054
39 -0.78576367 0.81069248
40 1.41586394 -0.78576367
41 0.15609126 1.41586394
42 -1.66643970 0.15609126
43 -0.35905269 -1.66643970
44 5.58293408 -0.35905269
45 2.09295342 5.58293408
46 0.39864812 2.09295342
47 -0.07395652 0.39864812
48 -2.52228373 -0.07395652
49 -0.74790874 -2.52228373
50 3.12231787 -0.74790874
51 -1.87403191 3.12231787
52 0.12285694 -1.87403191
53 -3.96378091 0.12285694
54 -1.94954885 -3.96378091
55 -3.22189028 -1.94954885
56 -0.85531555 -3.22189028
57 -1.18788768 -0.85531555
58 -0.45209780 -1.18788768
59 0.70991373 -0.45209780
60 NA 0.70991373
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.61628803 0.25079326
[2,] -0.17764820 2.61628803
[3,] 1.33636623 -0.17764820
[4,] -1.62137699 1.33636623
[5,] 1.73760035 -1.62137699
[6,] -1.22668992 1.73760035
[7,] -1.91644354 -1.22668992
[8,] -6.10913196 -1.91644354
[9,] -1.75769934 -6.10913196
[10,] -2.38415942 -1.75769934
[11,] -1.89743969 -2.38415942
[12,] 0.63743009 -1.89743969
[13,] -2.49131907 0.63743009
[14,] -2.39800074 -2.49131907
[15,] 1.19105848 -2.39800074
[16,] -0.84153865 1.19105848
[17,] -0.65505574 -0.84153865
[18,] 3.38278428 -0.65505574
[19,] 4.68941998 3.38278428
[20,] -1.18273757 4.68941998
[21,] 0.54761429 -1.18273757
[22,] 2.35916439 0.54761429
[23,] 0.54807578 2.35916439
[24,] 1.68437474 0.54807578
[25,] -0.98253076 1.68437474
[26,] -1.35736141 -0.98253076
[27,] 0.13237086 -1.35736141
[28,] 0.92419476 0.13237086
[29,] 2.72514504 0.92419476
[30,] 1.45989419 2.72514504
[31,] 0.80796653 1.45989419
[32,] 2.56425101 0.80796653
[33,] 0.30501931 2.56425101
[34,] 0.07844472 0.30501931
[35,] 0.71340670 0.07844472
[36,] -0.05031435 0.71340670
[37,] 1.60547054 -0.05031435
[38,] 0.81069248 1.60547054
[39,] -0.78576367 0.81069248
[40,] 1.41586394 -0.78576367
[41,] 0.15609126 1.41586394
[42,] -1.66643970 0.15609126
[43,] -0.35905269 -1.66643970
[44,] 5.58293408 -0.35905269
[45,] 2.09295342 5.58293408
[46,] 0.39864812 2.09295342
[47,] -0.07395652 0.39864812
[48,] -2.52228373 -0.07395652
[49,] -0.74790874 -2.52228373
[50,] 3.12231787 -0.74790874
[51,] -1.87403191 3.12231787
[52,] 0.12285694 -1.87403191
[53,] -3.96378091 0.12285694
[54,] -1.94954885 -3.96378091
[55,] -3.22189028 -1.94954885
[56,] -0.85531555 -3.22189028
[57,] -1.18788768 -0.85531555
[58,] -0.45209780 -1.18788768
[59,] 0.70991373 -0.45209780
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.61628803 0.25079326
2 -0.17764820 2.61628803
3 1.33636623 -0.17764820
4 -1.62137699 1.33636623
5 1.73760035 -1.62137699
6 -1.22668992 1.73760035
7 -1.91644354 -1.22668992
8 -6.10913196 -1.91644354
9 -1.75769934 -6.10913196
10 -2.38415942 -1.75769934
11 -1.89743969 -2.38415942
12 0.63743009 -1.89743969
13 -2.49131907 0.63743009
14 -2.39800074 -2.49131907
15 1.19105848 -2.39800074
16 -0.84153865 1.19105848
17 -0.65505574 -0.84153865
18 3.38278428 -0.65505574
19 4.68941998 3.38278428
20 -1.18273757 4.68941998
21 0.54761429 -1.18273757
22 2.35916439 0.54761429
23 0.54807578 2.35916439
24 1.68437474 0.54807578
25 -0.98253076 1.68437474
26 -1.35736141 -0.98253076
27 0.13237086 -1.35736141
28 0.92419476 0.13237086
29 2.72514504 0.92419476
30 1.45989419 2.72514504
31 0.80796653 1.45989419
32 2.56425101 0.80796653
33 0.30501931 2.56425101
34 0.07844472 0.30501931
35 0.71340670 0.07844472
36 -0.05031435 0.71340670
37 1.60547054 -0.05031435
38 0.81069248 1.60547054
39 -0.78576367 0.81069248
40 1.41586394 -0.78576367
41 0.15609126 1.41586394
42 -1.66643970 0.15609126
43 -0.35905269 -1.66643970
44 5.58293408 -0.35905269
45 2.09295342 5.58293408
46 0.39864812 2.09295342
47 -0.07395652 0.39864812
48 -2.52228373 -0.07395652
49 -0.74790874 -2.52228373
50 3.12231787 -0.74790874
51 -1.87403191 3.12231787
52 0.12285694 -1.87403191
53 -3.96378091 0.12285694
54 -1.94954885 -3.96378091
55 -3.22189028 -1.94954885
56 -0.85531555 -3.22189028
57 -1.18788768 -0.85531555
58 -0.45209780 -1.18788768
59 0.70991373 -0.45209780
> 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/7l1591258722422.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/84m0x1258722422.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/9jcbi1258722422.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/10386l1258722422.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/11qugr1258722422.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/12kv9n1258722422.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/13lek01258722422.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/14ssh41258722422.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/15qge71258722422.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/16lozh1258722422.tab")
+ }
>
> system("convert tmp/1yjos1258722422.ps tmp/1yjos1258722422.png")
> system("convert tmp/2hoc51258722422.ps tmp/2hoc51258722422.png")
> system("convert tmp/38hcf1258722422.ps tmp/38hcf1258722422.png")
> system("convert tmp/4zru61258722422.ps tmp/4zru61258722422.png")
> system("convert tmp/5bf0j1258722422.ps tmp/5bf0j1258722422.png")
> system("convert tmp/6m4ky1258722422.ps tmp/6m4ky1258722422.png")
> system("convert tmp/7l1591258722422.ps tmp/7l1591258722422.png")
> system("convert tmp/84m0x1258722422.ps tmp/84m0x1258722422.png")
> system("convert tmp/9jcbi1258722422.ps tmp/9jcbi1258722422.png")
> system("convert tmp/10386l1258722422.ps tmp/10386l1258722422.png")
>
>
> proc.time()
user system elapsed
2.346 1.603 2.791