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(94
+ ,0
+ ,106.3
+ ,101.3
+ ,102.8
+ ,1
+ ,94
+ ,106.3
+ ,102
+ ,1
+ ,102.8
+ ,94
+ ,105.1
+ ,1
+ ,102
+ ,102.8
+ ,92.4
+ ,0
+ ,105.1
+ ,102
+ ,81.4
+ ,0
+ ,92.4
+ ,105.1
+ ,105.8
+ ,1
+ ,81.4
+ ,92.4
+ ,120.3
+ ,1
+ ,105.8
+ ,81.4
+ ,100.7
+ ,1
+ ,120.3
+ ,105.8
+ ,88.8
+ ,0
+ ,100.7
+ ,120.3
+ ,94.3
+ ,0
+ ,88.8
+ ,100.7
+ ,99.9
+ ,0
+ ,94.3
+ ,88.8
+ ,103.4
+ ,1
+ ,99.9
+ ,94.3
+ ,103.3
+ ,1
+ ,103.4
+ ,99.9
+ ,98.8
+ ,0
+ ,103.3
+ ,103.4
+ ,104.2
+ ,1
+ ,98.8
+ ,103.3
+ ,91.2
+ ,0
+ ,104.2
+ ,98.8
+ ,74.7
+ ,0
+ ,91.2
+ ,104.2
+ ,108.5
+ ,1
+ ,74.7
+ ,91.2
+ ,114.5
+ ,1
+ ,108.5
+ ,74.7
+ ,96.9
+ ,0
+ ,114.5
+ ,108.5
+ ,89.6
+ ,0
+ ,96.9
+ ,114.5
+ ,97.1
+ ,0
+ ,89.6
+ ,96.9
+ ,100.3
+ ,1
+ ,97.1
+ ,89.6
+ ,122.6
+ ,1
+ ,100.3
+ ,97.1
+ ,115.4
+ ,1
+ ,122.6
+ ,100.3
+ ,109
+ ,1
+ ,115.4
+ ,122.6
+ ,129.1
+ ,1
+ ,109
+ ,115.4
+ ,102.8
+ ,1
+ ,129.1
+ ,109
+ ,96.2
+ ,0
+ ,102.8
+ ,129.1
+ ,127.7
+ ,1
+ ,96.2
+ ,102.8
+ ,128.9
+ ,1
+ ,127.7
+ ,96.2
+ ,126.5
+ ,1
+ ,128.9
+ ,127.7
+ ,119.8
+ ,1
+ ,126.5
+ ,128.9
+ ,113.2
+ ,1
+ ,119.8
+ ,126.5
+ ,114.1
+ ,1
+ ,113.2
+ ,119.8
+ ,134.1
+ ,1
+ ,114.1
+ ,113.2
+ ,130
+ ,1
+ ,134.1
+ ,114.1
+ ,121.8
+ ,1
+ ,130
+ ,134.1
+ ,132.1
+ ,1
+ ,121.8
+ ,130
+ ,105.3
+ ,1
+ ,132.1
+ ,121.8
+ ,103
+ ,1
+ ,105.3
+ ,132.1
+ ,117.1
+ ,1
+ ,103
+ ,105.3
+ ,126.3
+ ,1
+ ,117.1
+ ,103
+ ,138.1
+ ,1
+ ,126.3
+ ,117.1
+ ,119.5
+ ,1
+ ,138.1
+ ,126.3
+ ,138
+ ,1
+ ,119.5
+ ,138.1
+ ,135.5
+ ,1
+ ,138
+ ,119.5
+ ,178.6
+ ,1
+ ,135.5
+ ,138
+ ,162.2
+ ,1
+ ,178.6
+ ,135.5
+ ,176.9
+ ,1
+ ,162.2
+ ,178.6
+ ,204.9
+ ,1
+ ,176.9
+ ,162.2
+ ,132.2
+ ,1
+ ,204.9
+ ,176.9
+ ,142.5
+ ,1
+ ,132.2
+ ,204.9
+ ,164.3
+ ,1
+ ,142.5
+ ,132.2
+ ,174.9
+ ,1
+ ,164.3
+ ,142.5
+ ,175.4
+ ,1
+ ,174.9
+ ,164.3
+ ,143
+ ,1
+ ,175.4
+ ,174.9)
+ ,dim=c(4
+ ,58)
+ ,dimnames=list(c('Omzet'
+ ,'Uitvoer'
+ ,'Omzet-1'
+ ,'Omzet-2')
+ ,1:58))
> y <- array(NA,dim=c(4,58),dimnames=list(c('Omzet','Uitvoer','Omzet-1','Omzet-2'),1:58))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par20 = ''
> par19 = ''
> par18 = ''
> par17 = ''
> par16 = ''
> par15 = ''
> par14 = ''
> par13 = ''
> par12 = ''
> par11 = ''
> par10 = ''
> par9 = ''
> par8 = ''
> par7 = ''
> par6 = ''
> par5 = ''
> par4 = ''
> par3 = 'Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '1'
> ylab = ''
> xlab = ''
> main = ''
> #'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
Omzet Uitvoer Omzet-1 Omzet-2 t
1 94.0 0 106.3 101.3 1
2 102.8 1 94.0 106.3 2
3 102.0 1 102.8 94.0 3
4 105.1 1 102.0 102.8 4
5 92.4 0 105.1 102.0 5
6 81.4 0 92.4 105.1 6
7 105.8 1 81.4 92.4 7
8 120.3 1 105.8 81.4 8
9 100.7 1 120.3 105.8 9
10 88.8 0 100.7 120.3 10
11 94.3 0 88.8 100.7 11
12 99.9 0 94.3 88.8 12
13 103.4 1 99.9 94.3 13
14 103.3 1 103.4 99.9 14
15 98.8 0 103.3 103.4 15
16 104.2 1 98.8 103.3 16
17 91.2 0 104.2 98.8 17
18 74.7 0 91.2 104.2 18
19 108.5 1 74.7 91.2 19
20 114.5 1 108.5 74.7 20
21 96.9 0 114.5 108.5 21
22 89.6 0 96.9 114.5 22
23 97.1 0 89.6 96.9 23
24 100.3 1 97.1 89.6 24
25 122.6 1 100.3 97.1 25
26 115.4 1 122.6 100.3 26
27 109.0 1 115.4 122.6 27
28 129.1 1 109.0 115.4 28
29 102.8 1 129.1 109.0 29
30 96.2 0 102.8 129.1 30
31 127.7 1 96.2 102.8 31
32 128.9 1 127.7 96.2 32
33 126.5 1 128.9 127.7 33
34 119.8 1 126.5 128.9 34
35 113.2 1 119.8 126.5 35
36 114.1 1 113.2 119.8 36
37 134.1 1 114.1 113.2 37
38 130.0 1 134.1 114.1 38
39 121.8 1 130.0 134.1 39
40 132.1 1 121.8 130.0 40
41 105.3 1 132.1 121.8 41
42 103.0 1 105.3 132.1 42
43 117.1 1 103.0 105.3 43
44 126.3 1 117.1 103.0 44
45 138.1 1 126.3 117.1 45
46 119.5 1 138.1 126.3 46
47 138.0 1 119.5 138.1 47
48 135.5 1 138.0 119.5 48
49 178.6 1 135.5 138.0 49
50 162.2 1 178.6 135.5 50
51 176.9 1 162.2 178.6 51
52 204.9 1 176.9 162.2 52
53 132.2 1 204.9 176.9 53
54 142.5 1 132.2 204.9 54
55 164.3 1 142.5 132.2 55
56 174.9 1 164.3 142.5 56
57 175.4 1 174.9 164.3 57
58 143.0 1 175.4 174.9 58
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Uitvoer `Omzet-1` `Omzet-2` t
44.10215 14.47977 0.37173 0.02133 0.59216
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-37.707 -7.268 -1.398 8.302 46.307
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 44.10215 12.58186 3.505 0.000937 ***
Uitvoer 14.47977 5.51783 2.624 0.011322 *
`Omzet-1` 0.37173 0.13168 2.823 0.006687 **
`Omzet-2` 0.02133 0.13471 0.158 0.874784
t 0.59216 0.21565 2.746 0.008223 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 14.96 on 53 degrees of freedom
Multiple R-squared: 0.712, Adjusted R-squared: 0.6902
F-statistic: 32.75 on 4 and 53 DF, p-value: 9.389e-14
> 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,] 6.128628e-02 1.225726e-01 0.9387137
[2,] 2.051310e-02 4.102620e-02 0.9794869
[3,] 1.825405e-02 3.650811e-02 0.9817459
[4,] 6.183888e-03 1.236778e-02 0.9938161
[5,] 1.994018e-03 3.988036e-03 0.9980060
[6,] 9.553403e-04 1.910681e-03 0.9990447
[7,] 2.849688e-04 5.699375e-04 0.9997150
[8,] 1.391457e-04 2.782914e-04 0.9998609
[9,] 3.815098e-05 7.630197e-05 0.9999618
[10,] 1.801200e-05 3.602400e-05 0.9999820
[11,] 1.465278e-04 2.930556e-04 0.9998535
[12,] 7.393355e-05 1.478671e-04 0.9999261
[13,] 2.779120e-05 5.558239e-05 0.9999722
[14,] 1.662698e-05 3.325397e-05 0.9999834
[15,] 6.023453e-06 1.204691e-05 0.9999940
[16,] 2.282947e-06 4.565893e-06 0.9999977
[17,] 1.651955e-06 3.303910e-06 0.9999983
[18,] 9.960449e-06 1.992090e-05 0.9999900
[19,] 3.884949e-06 7.769899e-06 0.9999961
[20,] 1.555652e-06 3.111304e-06 0.9999984
[21,] 1.865848e-05 3.731696e-05 0.9999813
[22,] 2.177972e-05 4.355944e-05 0.9999782
[23,] 8.936588e-06 1.787318e-05 0.9999911
[24,] 1.751356e-05 3.502713e-05 0.9999825
[25,] 1.314498e-05 2.628996e-05 0.9999869
[26,] 1.037562e-05 2.075124e-05 0.9999896
[27,] 4.203998e-06 8.407996e-06 0.9999958
[28,] 1.713000e-06 3.426000e-06 0.9999983
[29,] 6.454172e-07 1.290834e-06 0.9999994
[30,] 1.154159e-06 2.308319e-06 0.9999988
[31,] 5.703484e-07 1.140697e-06 0.9999994
[32,] 1.988047e-07 3.976094e-07 0.9999998
[33,] 1.882156e-07 3.764311e-07 0.9999998
[34,] 5.843297e-07 1.168659e-06 0.9999994
[35,] 9.026336e-07 1.805267e-06 0.9999991
[36,] 4.208619e-07 8.417239e-07 0.9999996
[37,] 1.704975e-07 3.409951e-07 0.9999998
[38,] 1.061161e-07 2.122322e-07 0.9999999
[39,] 3.109912e-07 6.219825e-07 0.9999997
[40,] 5.766453e-07 1.153291e-06 0.9999994
[41,] 1.671994e-05 3.343988e-05 0.9999833
[42,] 5.365712e-04 1.073142e-03 0.9994634
[43,] 1.117046e-03 2.234092e-03 0.9988830
> postscript(file="/var/www/html/rcomp/tmp/1rcwh1258567245.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/2w0du1258567245.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/3aen21258567245.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/4vcs01258567245.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/5zmy11258567245.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 = 58
Frequency = 1
1 2 3 4 5 6 7
7.629904 5.823601 1.422596 4.040105 4.092417 -2.844896 10.843120
8 9 10 11 12 13 14
15.915393 -10.187340 -1.223126 8.526402 11.743574 -2.027364 -4.140034
15 16 17 18 19 20 21
5.210090 -2.786918 -3.810658 -16.185515 8.953416 2.148750 -4.515025
22 23 24 25 26 27 28
-5.992722 4.004185 -10.499997 9.858322 -6.291678 -11.083071 10.957431
29 30 31 32 33 34 35
-23.269981 -6.634631 12.807880 1.847011 -2.263165 -8.688768 -13.339138
36 37 38 39 40 41 42
-10.434956 8.779117 -3.366842 -11.061536 1.781952 -29.264107 -22.413613
43 44 45 46 47 48 49
-7.479107 -4.063597 3.423554 -20.351269 4.219042 -5.353357 37.689178
50 51 52 53 54 55 56
4.728781 24.013609 46.306855 -37.707319 -1.571979 17.357843 19.042254
57 58
14.544731 -18.859406
> postscript(file="/var/www/html/rcomp/tmp/68eg31258567245.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 = 58
Frequency = 1
lag(myerror, k = 1) myerror
0 7.629904 NA
1 5.823601 7.629904
2 1.422596 5.823601
3 4.040105 1.422596
4 4.092417 4.040105
5 -2.844896 4.092417
6 10.843120 -2.844896
7 15.915393 10.843120
8 -10.187340 15.915393
9 -1.223126 -10.187340
10 8.526402 -1.223126
11 11.743574 8.526402
12 -2.027364 11.743574
13 -4.140034 -2.027364
14 5.210090 -4.140034
15 -2.786918 5.210090
16 -3.810658 -2.786918
17 -16.185515 -3.810658
18 8.953416 -16.185515
19 2.148750 8.953416
20 -4.515025 2.148750
21 -5.992722 -4.515025
22 4.004185 -5.992722
23 -10.499997 4.004185
24 9.858322 -10.499997
25 -6.291678 9.858322
26 -11.083071 -6.291678
27 10.957431 -11.083071
28 -23.269981 10.957431
29 -6.634631 -23.269981
30 12.807880 -6.634631
31 1.847011 12.807880
32 -2.263165 1.847011
33 -8.688768 -2.263165
34 -13.339138 -8.688768
35 -10.434956 -13.339138
36 8.779117 -10.434956
37 -3.366842 8.779117
38 -11.061536 -3.366842
39 1.781952 -11.061536
40 -29.264107 1.781952
41 -22.413613 -29.264107
42 -7.479107 -22.413613
43 -4.063597 -7.479107
44 3.423554 -4.063597
45 -20.351269 3.423554
46 4.219042 -20.351269
47 -5.353357 4.219042
48 37.689178 -5.353357
49 4.728781 37.689178
50 24.013609 4.728781
51 46.306855 24.013609
52 -37.707319 46.306855
53 -1.571979 -37.707319
54 17.357843 -1.571979
55 19.042254 17.357843
56 14.544731 19.042254
57 -18.859406 14.544731
58 NA -18.859406
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 5.823601 7.629904
[2,] 1.422596 5.823601
[3,] 4.040105 1.422596
[4,] 4.092417 4.040105
[5,] -2.844896 4.092417
[6,] 10.843120 -2.844896
[7,] 15.915393 10.843120
[8,] -10.187340 15.915393
[9,] -1.223126 -10.187340
[10,] 8.526402 -1.223126
[11,] 11.743574 8.526402
[12,] -2.027364 11.743574
[13,] -4.140034 -2.027364
[14,] 5.210090 -4.140034
[15,] -2.786918 5.210090
[16,] -3.810658 -2.786918
[17,] -16.185515 -3.810658
[18,] 8.953416 -16.185515
[19,] 2.148750 8.953416
[20,] -4.515025 2.148750
[21,] -5.992722 -4.515025
[22,] 4.004185 -5.992722
[23,] -10.499997 4.004185
[24,] 9.858322 -10.499997
[25,] -6.291678 9.858322
[26,] -11.083071 -6.291678
[27,] 10.957431 -11.083071
[28,] -23.269981 10.957431
[29,] -6.634631 -23.269981
[30,] 12.807880 -6.634631
[31,] 1.847011 12.807880
[32,] -2.263165 1.847011
[33,] -8.688768 -2.263165
[34,] -13.339138 -8.688768
[35,] -10.434956 -13.339138
[36,] 8.779117 -10.434956
[37,] -3.366842 8.779117
[38,] -11.061536 -3.366842
[39,] 1.781952 -11.061536
[40,] -29.264107 1.781952
[41,] -22.413613 -29.264107
[42,] -7.479107 -22.413613
[43,] -4.063597 -7.479107
[44,] 3.423554 -4.063597
[45,] -20.351269 3.423554
[46,] 4.219042 -20.351269
[47,] -5.353357 4.219042
[48,] 37.689178 -5.353357
[49,] 4.728781 37.689178
[50,] 24.013609 4.728781
[51,] 46.306855 24.013609
[52,] -37.707319 46.306855
[53,] -1.571979 -37.707319
[54,] 17.357843 -1.571979
[55,] 19.042254 17.357843
[56,] 14.544731 19.042254
[57,] -18.859406 14.544731
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 5.823601 7.629904
2 1.422596 5.823601
3 4.040105 1.422596
4 4.092417 4.040105
5 -2.844896 4.092417
6 10.843120 -2.844896
7 15.915393 10.843120
8 -10.187340 15.915393
9 -1.223126 -10.187340
10 8.526402 -1.223126
11 11.743574 8.526402
12 -2.027364 11.743574
13 -4.140034 -2.027364
14 5.210090 -4.140034
15 -2.786918 5.210090
16 -3.810658 -2.786918
17 -16.185515 -3.810658
18 8.953416 -16.185515
19 2.148750 8.953416
20 -4.515025 2.148750
21 -5.992722 -4.515025
22 4.004185 -5.992722
23 -10.499997 4.004185
24 9.858322 -10.499997
25 -6.291678 9.858322
26 -11.083071 -6.291678
27 10.957431 -11.083071
28 -23.269981 10.957431
29 -6.634631 -23.269981
30 12.807880 -6.634631
31 1.847011 12.807880
32 -2.263165 1.847011
33 -8.688768 -2.263165
34 -13.339138 -8.688768
35 -10.434956 -13.339138
36 8.779117 -10.434956
37 -3.366842 8.779117
38 -11.061536 -3.366842
39 1.781952 -11.061536
40 -29.264107 1.781952
41 -22.413613 -29.264107
42 -7.479107 -22.413613
43 -4.063597 -7.479107
44 3.423554 -4.063597
45 -20.351269 3.423554
46 4.219042 -20.351269
47 -5.353357 4.219042
48 37.689178 -5.353357
49 4.728781 37.689178
50 24.013609 4.728781
51 46.306855 24.013609
52 -37.707319 46.306855
53 -1.571979 -37.707319
54 17.357843 -1.571979
55 19.042254 17.357843
56 14.544731 19.042254
57 -18.859406 14.544731
> 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/7asca1258567245.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/8sasq1258567245.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/9lqt91258567245.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/10bin91258567245.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/1105e41258567245.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/12rme51258567245.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/135utj1258567245.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/14yvxh1258567246.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/153fyr1258567246.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/16hdo21258567246.tab")
+ }
>
> system("convert tmp/1rcwh1258567245.ps tmp/1rcwh1258567245.png")
> system("convert tmp/2w0du1258567245.ps tmp/2w0du1258567245.png")
> system("convert tmp/3aen21258567245.ps tmp/3aen21258567245.png")
> system("convert tmp/4vcs01258567245.ps tmp/4vcs01258567245.png")
> system("convert tmp/5zmy11258567245.ps tmp/5zmy11258567245.png")
> system("convert tmp/68eg31258567245.ps tmp/68eg31258567245.png")
> system("convert tmp/7asca1258567245.ps tmp/7asca1258567245.png")
> system("convert tmp/8sasq1258567245.ps tmp/8sasq1258567245.png")
> system("convert tmp/9lqt91258567245.ps tmp/9lqt91258567245.png")
> system("convert tmp/10bin91258567245.ps tmp/10bin91258567245.png")
>
>
> proc.time()
user system elapsed
2.500 1.619 5.746