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(14544.5,94.6,15116.3,95.9,17413.2,104.7,16181.5,102.8,15607.4,98.1,17160.9,113.9,14915.8,80.9,13768,95.7,17487.5,113.2,16198.1,105.9,17535.2,108.8,16571.8,102.3,16198.9,99,16554.2,100.7,19554.2,115.5,15903.8,100.7,18003.8,109.9,18329.6,114.6,16260.7,85.4,14851.9,100.5,18174.1,114.8,18406.6,116.5,18466.5,112.9,16016.5,102,17428.5,106,17167.2,105.3,19630,118.8,17183.6,106.1,18344.7,109.3,19301.4,117.2,18147.5,92.5,16192.9,104.2,18374.4,112.5,20515.2,122.4,18957.2,113.3,16471.5,100,18746.8,110.7,19009.5,112.8,19211.2,109.8,20547.7,117.3,19325.8,109.1,20605.5,115.9,20056.9,96,16141.4,99.8,20359.8,116.8,19711.6,115.7,15638.6,99.4,14384.5,94.3,13855.6,91,14308.3,93.2,15290.6,103.1,14423.8,94.1,13779.7,91.8,15686.3,102.7,14733.8,82.6,12522.5,89.1,16189.4,104.5,16059.1,105.1,16007.1,95.1,15806.8,88.7,15160,86.3,15692.1,91.8,18908.9,111.5,16969.9,99.7,16997.5,97.5,19858.9,111.7,17681.2,86.2,16006.9,95.4),dim=c(2,68),dimnames=list(c('uitvoer','productie'),1:68))
> y <- array(NA,dim=c(2,68),dimnames=list(c('uitvoer','productie'),1:68))
> 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 = '2'
> #'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
productie uitvoer t
1 94.6 14544.5 1
2 95.9 15116.3 2
3 104.7 17413.2 3
4 102.8 16181.5 4
5 98.1 15607.4 5
6 113.9 17160.9 6
7 80.9 14915.8 7
8 95.7 13768.0 8
9 113.2 17487.5 9
10 105.9 16198.1 10
11 108.8 17535.2 11
12 102.3 16571.8 12
13 99.0 16198.9 13
14 100.7 16554.2 14
15 115.5 19554.2 15
16 100.7 15903.8 16
17 109.9 18003.8 17
18 114.6 18329.6 18
19 85.4 16260.7 19
20 100.5 14851.9 20
21 114.8 18174.1 21
22 116.5 18406.6 22
23 112.9 18466.5 23
24 102.0 16016.5 24
25 106.0 17428.5 25
26 105.3 17167.2 26
27 118.8 19630.0 27
28 106.1 17183.6 28
29 109.3 18344.7 29
30 117.2 19301.4 30
31 92.5 18147.5 31
32 104.2 16192.9 32
33 112.5 18374.4 33
34 122.4 20515.2 34
35 113.3 18957.2 35
36 100.0 16471.5 36
37 110.7 18746.8 37
38 112.8 19009.5 38
39 109.8 19211.2 39
40 117.3 20547.7 40
41 109.1 19325.8 41
42 115.9 20605.5 42
43 96.0 20056.9 43
44 99.8 16141.4 44
45 116.8 20359.8 45
46 115.7 19711.6 46
47 99.4 15638.6 47
48 94.3 14384.5 48
49 91.0 13855.6 49
50 93.2 14308.3 50
51 103.1 15290.6 51
52 94.1 14423.8 52
53 91.8 13779.7 53
54 102.7 15686.3 54
55 82.6 14733.8 55
56 89.1 12522.5 56
57 104.5 16189.4 57
58 105.1 16059.1 58
59 95.1 16007.1 59
60 88.7 15806.8 60
61 86.3 15160.0 61
62 91.8 15692.1 62
63 111.5 18908.9 63
64 99.7 16969.9 64
65 97.5 16997.5 65
66 111.7 19858.9 66
67 86.2 17681.2 67
68 95.4 16006.9 68
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) uitvoer t
39.426914 0.003956 -0.102801
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-18.355 -1.781 1.017 3.500 8.424
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 39.4269137 6.6255580 5.951 1.18e-07 ***
uitvoer 0.0039562 0.0003777 10.474 1.37e-15 ***
t -0.1028006 0.0371006 -2.771 0.00728 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 6.003 on 65 degrees of freedom
Multiple R-squared: 0.6469, Adjusted R-squared: 0.6361
F-statistic: 59.55 on 2 and 65 DF, p-value: 2.021e-15
> 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.2240829 0.4481657 0.7759171
[2,] 0.7145053 0.5709893 0.2854947
[3,] 0.8797752 0.2404496 0.1202248
[4,] 0.8276497 0.3447006 0.1723503
[5,] 0.7507416 0.4985168 0.2492584
[6,] 0.6742764 0.6514472 0.3257236
[7,] 0.5982345 0.8035311 0.4017655
[8,] 0.5315189 0.9369621 0.4684811
[9,] 0.4585227 0.9170454 0.5414773
[10,] 0.3925469 0.7850938 0.6074531
[11,] 0.3155061 0.6310123 0.6844939
[12,] 0.2392107 0.4784214 0.7607893
[13,] 0.1893310 0.3786619 0.8106690
[14,] 0.6380798 0.7238404 0.3619202
[15,] 0.7105569 0.5788861 0.2894431
[16,] 0.6750755 0.6498490 0.3249245
[17,] 0.6412384 0.7175231 0.3587616
[18,] 0.5669488 0.8661024 0.4330512
[19,] 0.4984084 0.9968168 0.5015916
[20,] 0.4282144 0.8564289 0.5717856
[21,] 0.3579714 0.7159427 0.6420286
[22,] 0.2993430 0.5986860 0.7006570
[23,] 0.2377649 0.4755297 0.7622351
[24,] 0.1903897 0.3807793 0.8096103
[25,] 0.1518944 0.3037889 0.8481056
[26,] 0.6367848 0.7264304 0.3632152
[27,] 0.6048225 0.7903550 0.3951775
[28,] 0.5422929 0.9154143 0.4577071
[29,] 0.5019371 0.9961259 0.4980629
[30,] 0.4339070 0.8678139 0.5660930
[31,] 0.3752198 0.7504397 0.6247802
[32,] 0.3096104 0.6192208 0.6903896
[33,] 0.2518753 0.5037506 0.7481247
[34,] 0.2096884 0.4193767 0.7903116
[35,] 0.1699581 0.3399161 0.8300419
[36,] 0.1387094 0.2774188 0.8612906
[37,] 0.1082158 0.2164316 0.8917842
[38,] 0.7100152 0.5799696 0.2899848
[39,] 0.6739667 0.6520665 0.3260333
[40,] 0.6249583 0.7500833 0.3750417
[41,] 0.5880877 0.8238245 0.4119123
[42,] 0.5539731 0.8920537 0.4460269
[43,] 0.5021797 0.9956405 0.4978203
[44,] 0.4468923 0.8937846 0.5531077
[45,] 0.3907033 0.7814066 0.6092967
[46,] 0.3480403 0.6960807 0.6519597
[47,] 0.2753692 0.5507384 0.7246308
[48,] 0.2069550 0.4139100 0.7930450
[49,] 0.1638992 0.3277984 0.8361008
[50,] 0.4108382 0.8216765 0.5891618
[51,] 0.3865565 0.7731130 0.6134435
[52,] 0.3289203 0.6578406 0.6710797
[53,] 0.4112087 0.8224174 0.5887913
[54,] 0.3098879 0.6197758 0.6901121
[55,] 0.2653701 0.5307402 0.7346299
[56,] 0.2225627 0.4451255 0.7774373
[57,] 0.1575373 0.3150746 0.8424627
> postscript(file="/var/www/html/rcomp/tmp/1e7za1290542838.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/2e7za1290542838.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/3phyv1290542838.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/4phyv1290542838.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/5phyv1290542838.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 = 68
Frequency = 1
1 2 3 4 5
-2.264415e+00 -3.123745e+00 -3.307837e+00 -2.322402e-01 -2.558211e+00
6 7 8 9 10
7.198702e+00 -1.681653e+01 2.627143e+00 5.515024e+00 3.418891e+00
11 12 13 14 15
1.131916e+00 -1.453923e+00 -3.175872e+00 -2.778694e+00 2.556406e-01
16 17 18 19 20
-9.114343e-06 9.948651e-01 4.508750e+00 -1.640356e+01 4.372673e+00
21 22 23 24 25
5.632334e+00 6.515328e+00 2.781155e+00 1.676537e+00 1.932458e-01
26 27 28 29 30
6.297898e-01 4.489371e+00 1.570510e+00 2.798184e-01 4.497765e+00
31 32 33 34 35
-1.553443e+01 4.001075e+00 3.773523e+00 5.306986e+00 2.473477e+00
36 37 38 39 40
-8.899073e-01 9.114528e-01 2.074971e+00 -1.620185e+00 6.952142e-01
41 42 43 44 45
-2.567959e+00 -7.278504e-01 -1.835470e+01 1.038424e+00 1.452579e+00
46 47 48 49 50
3.019759e+00 2.935981e+00 2.900196e+00 1.795407e+00 2.307256e+00
51 52 53 54 55
8.423925e+00 2.955921e+00 3.306881e+00 6.766876e+00 -9.462085e+00
56 57 58 59 60
5.888962e+00 6.884936e+00 8.103224e+00 -1.588256e+00 -7.093037e+00
61 62 63 64 65
-6.831395e+00 -3.333665e+00 3.742975e+00 -2.832395e-01 -2.489629e+00
66 67 68
4.930287e-01 -1.628885e+01 -3.622596e-01
> postscript(file="/var/www/html/rcomp/tmp/608xy1290542838.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 = 68
Frequency = 1
lag(myerror, k = 1) myerror
0 -2.264415e+00 NA
1 -3.123745e+00 -2.264415e+00
2 -3.307837e+00 -3.123745e+00
3 -2.322402e-01 -3.307837e+00
4 -2.558211e+00 -2.322402e-01
5 7.198702e+00 -2.558211e+00
6 -1.681653e+01 7.198702e+00
7 2.627143e+00 -1.681653e+01
8 5.515024e+00 2.627143e+00
9 3.418891e+00 5.515024e+00
10 1.131916e+00 3.418891e+00
11 -1.453923e+00 1.131916e+00
12 -3.175872e+00 -1.453923e+00
13 -2.778694e+00 -3.175872e+00
14 2.556406e-01 -2.778694e+00
15 -9.114343e-06 2.556406e-01
16 9.948651e-01 -9.114343e-06
17 4.508750e+00 9.948651e-01
18 -1.640356e+01 4.508750e+00
19 4.372673e+00 -1.640356e+01
20 5.632334e+00 4.372673e+00
21 6.515328e+00 5.632334e+00
22 2.781155e+00 6.515328e+00
23 1.676537e+00 2.781155e+00
24 1.932458e-01 1.676537e+00
25 6.297898e-01 1.932458e-01
26 4.489371e+00 6.297898e-01
27 1.570510e+00 4.489371e+00
28 2.798184e-01 1.570510e+00
29 4.497765e+00 2.798184e-01
30 -1.553443e+01 4.497765e+00
31 4.001075e+00 -1.553443e+01
32 3.773523e+00 4.001075e+00
33 5.306986e+00 3.773523e+00
34 2.473477e+00 5.306986e+00
35 -8.899073e-01 2.473477e+00
36 9.114528e-01 -8.899073e-01
37 2.074971e+00 9.114528e-01
38 -1.620185e+00 2.074971e+00
39 6.952142e-01 -1.620185e+00
40 -2.567959e+00 6.952142e-01
41 -7.278504e-01 -2.567959e+00
42 -1.835470e+01 -7.278504e-01
43 1.038424e+00 -1.835470e+01
44 1.452579e+00 1.038424e+00
45 3.019759e+00 1.452579e+00
46 2.935981e+00 3.019759e+00
47 2.900196e+00 2.935981e+00
48 1.795407e+00 2.900196e+00
49 2.307256e+00 1.795407e+00
50 8.423925e+00 2.307256e+00
51 2.955921e+00 8.423925e+00
52 3.306881e+00 2.955921e+00
53 6.766876e+00 3.306881e+00
54 -9.462085e+00 6.766876e+00
55 5.888962e+00 -9.462085e+00
56 6.884936e+00 5.888962e+00
57 8.103224e+00 6.884936e+00
58 -1.588256e+00 8.103224e+00
59 -7.093037e+00 -1.588256e+00
60 -6.831395e+00 -7.093037e+00
61 -3.333665e+00 -6.831395e+00
62 3.742975e+00 -3.333665e+00
63 -2.832395e-01 3.742975e+00
64 -2.489629e+00 -2.832395e-01
65 4.930287e-01 -2.489629e+00
66 -1.628885e+01 4.930287e-01
67 -3.622596e-01 -1.628885e+01
68 NA -3.622596e-01
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -3.123745e+00 -2.264415e+00
[2,] -3.307837e+00 -3.123745e+00
[3,] -2.322402e-01 -3.307837e+00
[4,] -2.558211e+00 -2.322402e-01
[5,] 7.198702e+00 -2.558211e+00
[6,] -1.681653e+01 7.198702e+00
[7,] 2.627143e+00 -1.681653e+01
[8,] 5.515024e+00 2.627143e+00
[9,] 3.418891e+00 5.515024e+00
[10,] 1.131916e+00 3.418891e+00
[11,] -1.453923e+00 1.131916e+00
[12,] -3.175872e+00 -1.453923e+00
[13,] -2.778694e+00 -3.175872e+00
[14,] 2.556406e-01 -2.778694e+00
[15,] -9.114343e-06 2.556406e-01
[16,] 9.948651e-01 -9.114343e-06
[17,] 4.508750e+00 9.948651e-01
[18,] -1.640356e+01 4.508750e+00
[19,] 4.372673e+00 -1.640356e+01
[20,] 5.632334e+00 4.372673e+00
[21,] 6.515328e+00 5.632334e+00
[22,] 2.781155e+00 6.515328e+00
[23,] 1.676537e+00 2.781155e+00
[24,] 1.932458e-01 1.676537e+00
[25,] 6.297898e-01 1.932458e-01
[26,] 4.489371e+00 6.297898e-01
[27,] 1.570510e+00 4.489371e+00
[28,] 2.798184e-01 1.570510e+00
[29,] 4.497765e+00 2.798184e-01
[30,] -1.553443e+01 4.497765e+00
[31,] 4.001075e+00 -1.553443e+01
[32,] 3.773523e+00 4.001075e+00
[33,] 5.306986e+00 3.773523e+00
[34,] 2.473477e+00 5.306986e+00
[35,] -8.899073e-01 2.473477e+00
[36,] 9.114528e-01 -8.899073e-01
[37,] 2.074971e+00 9.114528e-01
[38,] -1.620185e+00 2.074971e+00
[39,] 6.952142e-01 -1.620185e+00
[40,] -2.567959e+00 6.952142e-01
[41,] -7.278504e-01 -2.567959e+00
[42,] -1.835470e+01 -7.278504e-01
[43,] 1.038424e+00 -1.835470e+01
[44,] 1.452579e+00 1.038424e+00
[45,] 3.019759e+00 1.452579e+00
[46,] 2.935981e+00 3.019759e+00
[47,] 2.900196e+00 2.935981e+00
[48,] 1.795407e+00 2.900196e+00
[49,] 2.307256e+00 1.795407e+00
[50,] 8.423925e+00 2.307256e+00
[51,] 2.955921e+00 8.423925e+00
[52,] 3.306881e+00 2.955921e+00
[53,] 6.766876e+00 3.306881e+00
[54,] -9.462085e+00 6.766876e+00
[55,] 5.888962e+00 -9.462085e+00
[56,] 6.884936e+00 5.888962e+00
[57,] 8.103224e+00 6.884936e+00
[58,] -1.588256e+00 8.103224e+00
[59,] -7.093037e+00 -1.588256e+00
[60,] -6.831395e+00 -7.093037e+00
[61,] -3.333665e+00 -6.831395e+00
[62,] 3.742975e+00 -3.333665e+00
[63,] -2.832395e-01 3.742975e+00
[64,] -2.489629e+00 -2.832395e-01
[65,] 4.930287e-01 -2.489629e+00
[66,] -1.628885e+01 4.930287e-01
[67,] -3.622596e-01 -1.628885e+01
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -3.123745e+00 -2.264415e+00
2 -3.307837e+00 -3.123745e+00
3 -2.322402e-01 -3.307837e+00
4 -2.558211e+00 -2.322402e-01
5 7.198702e+00 -2.558211e+00
6 -1.681653e+01 7.198702e+00
7 2.627143e+00 -1.681653e+01
8 5.515024e+00 2.627143e+00
9 3.418891e+00 5.515024e+00
10 1.131916e+00 3.418891e+00
11 -1.453923e+00 1.131916e+00
12 -3.175872e+00 -1.453923e+00
13 -2.778694e+00 -3.175872e+00
14 2.556406e-01 -2.778694e+00
15 -9.114343e-06 2.556406e-01
16 9.948651e-01 -9.114343e-06
17 4.508750e+00 9.948651e-01
18 -1.640356e+01 4.508750e+00
19 4.372673e+00 -1.640356e+01
20 5.632334e+00 4.372673e+00
21 6.515328e+00 5.632334e+00
22 2.781155e+00 6.515328e+00
23 1.676537e+00 2.781155e+00
24 1.932458e-01 1.676537e+00
25 6.297898e-01 1.932458e-01
26 4.489371e+00 6.297898e-01
27 1.570510e+00 4.489371e+00
28 2.798184e-01 1.570510e+00
29 4.497765e+00 2.798184e-01
30 -1.553443e+01 4.497765e+00
31 4.001075e+00 -1.553443e+01
32 3.773523e+00 4.001075e+00
33 5.306986e+00 3.773523e+00
34 2.473477e+00 5.306986e+00
35 -8.899073e-01 2.473477e+00
36 9.114528e-01 -8.899073e-01
37 2.074971e+00 9.114528e-01
38 -1.620185e+00 2.074971e+00
39 6.952142e-01 -1.620185e+00
40 -2.567959e+00 6.952142e-01
41 -7.278504e-01 -2.567959e+00
42 -1.835470e+01 -7.278504e-01
43 1.038424e+00 -1.835470e+01
44 1.452579e+00 1.038424e+00
45 3.019759e+00 1.452579e+00
46 2.935981e+00 3.019759e+00
47 2.900196e+00 2.935981e+00
48 1.795407e+00 2.900196e+00
49 2.307256e+00 1.795407e+00
50 8.423925e+00 2.307256e+00
51 2.955921e+00 8.423925e+00
52 3.306881e+00 2.955921e+00
53 6.766876e+00 3.306881e+00
54 -9.462085e+00 6.766876e+00
55 5.888962e+00 -9.462085e+00
56 6.884936e+00 5.888962e+00
57 8.103224e+00 6.884936e+00
58 -1.588256e+00 8.103224e+00
59 -7.093037e+00 -1.588256e+00
60 -6.831395e+00 -7.093037e+00
61 -3.333665e+00 -6.831395e+00
62 3.742975e+00 -3.333665e+00
63 -2.832395e-01 3.742975e+00
64 -2.489629e+00 -2.832395e-01
65 4.930287e-01 -2.489629e+00
66 -1.628885e+01 4.930287e-01
67 -3.622596e-01 -1.628885e+01
> 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/7szfj1290542838.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/8szfj1290542838.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/9szfj1290542838.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/10l8wm1290542838.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/11orda1290542838.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/12a9bf1290542838.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/13zaq91290542838.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/14r17u1290542838.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/15d2oi1290542838.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/169ul91290542838.tab")
+ }
>
> try(system("convert tmp/1e7za1290542838.ps tmp/1e7za1290542838.png",intern=TRUE))
character(0)
> try(system("convert tmp/2e7za1290542838.ps tmp/2e7za1290542838.png",intern=TRUE))
character(0)
> try(system("convert tmp/3phyv1290542838.ps tmp/3phyv1290542838.png",intern=TRUE))
character(0)
> try(system("convert tmp/4phyv1290542838.ps tmp/4phyv1290542838.png",intern=TRUE))
character(0)
> try(system("convert tmp/5phyv1290542838.ps tmp/5phyv1290542838.png",intern=TRUE))
character(0)
> try(system("convert tmp/608xy1290542838.ps tmp/608xy1290542838.png",intern=TRUE))
character(0)
> try(system("convert tmp/7szfj1290542838.ps tmp/7szfj1290542838.png",intern=TRUE))
character(0)
> try(system("convert tmp/8szfj1290542838.ps tmp/8szfj1290542838.png",intern=TRUE))
character(0)
> try(system("convert tmp/9szfj1290542838.ps tmp/9szfj1290542838.png",intern=TRUE))
character(0)
> try(system("convert tmp/10l8wm1290542838.ps tmp/10l8wm1290542838.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.546 1.615 5.740