R version 2.8.0 (2008-10-20)
Copyright (C) 2008 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(15859.4,0,15258.9,0,15498.6,0,15106.5,0,15023.6,0,12083,0,15761.3,0,16942.6,0,15070.3,0,13659.6,0,14768.9,0,14725.1,0,15998.1,0,15370.6,0,14956.9,0,15469.7,0,15101.8,0,11703.7,0,16283.6,0,16726.5,0,14968.9,0,14861,0,14583.3,0,15305.8,0,17903.9,0,16379.4,0,15420.3,0,17870.5,0,15912.8,0,13866.5,0,17823.2,0,17872,0,17422,0,16704.5,0,15991.2,0,16583.6,0,19123.5,0,17838.7,0,17209.4,0,18586.5,0,16258.1,0,15141.6,1,19202.1,1,17746.5,1,19090.1,1,18040.3,1,17515.5,1,17751.8,1,21072.4,1,17170,1,19439.5,1,19795.4,1,17574.9,1,16165.4,1,19464.6,1,19932.1,1,19961.2,1,17343.4,1,18924.2,1,18574.1,1,21350.6,1,18594.6,1,19823.1,1,20844.4,1,19640.2,1,17735.4,1,19813.6,1,22238.5,1,20682.2,1,17818.6,1,21872.1,1,22117,1,21865.9,1),dim=c(2,73),dimnames=list(c('uitvoer','dummy'),1:73))
> y <- array(NA,dim=c(2,73),dimnames=list(c('uitvoer','dummy'),1:73))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'Linear Trend'
> par2 = 'Include Monthly Dummies'
> par1 = '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
uitvoer dummy M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 15859.4 0 1 0 0 0 0 0 0 0 0 0 0 1
2 15258.9 0 0 1 0 0 0 0 0 0 0 0 0 2
3 15498.6 0 0 0 1 0 0 0 0 0 0 0 0 3
4 15106.5 0 0 0 0 1 0 0 0 0 0 0 0 4
5 15023.6 0 0 0 0 0 1 0 0 0 0 0 0 5
6 12083.0 0 0 0 0 0 0 1 0 0 0 0 0 6
7 15761.3 0 0 0 0 0 0 0 1 0 0 0 0 7
8 16942.6 0 0 0 0 0 0 0 0 1 0 0 0 8
9 15070.3 0 0 0 0 0 0 0 0 0 1 0 0 9
10 13659.6 0 0 0 0 0 0 0 0 0 0 1 0 10
11 14768.9 0 0 0 0 0 0 0 0 0 0 0 1 11
12 14725.1 0 0 0 0 0 0 0 0 0 0 0 0 12
13 15998.1 0 1 0 0 0 0 0 0 0 0 0 0 13
14 15370.6 0 0 1 0 0 0 0 0 0 0 0 0 14
15 14956.9 0 0 0 1 0 0 0 0 0 0 0 0 15
16 15469.7 0 0 0 0 1 0 0 0 0 0 0 0 16
17 15101.8 0 0 0 0 0 1 0 0 0 0 0 0 17
18 11703.7 0 0 0 0 0 0 1 0 0 0 0 0 18
19 16283.6 0 0 0 0 0 0 0 1 0 0 0 0 19
20 16726.5 0 0 0 0 0 0 0 0 1 0 0 0 20
21 14968.9 0 0 0 0 0 0 0 0 0 1 0 0 21
22 14861.0 0 0 0 0 0 0 0 0 0 0 1 0 22
23 14583.3 0 0 0 0 0 0 0 0 0 0 0 1 23
24 15305.8 0 0 0 0 0 0 0 0 0 0 0 0 24
25 17903.9 0 1 0 0 0 0 0 0 0 0 0 0 25
26 16379.4 0 0 1 0 0 0 0 0 0 0 0 0 26
27 15420.3 0 0 0 1 0 0 0 0 0 0 0 0 27
28 17870.5 0 0 0 0 1 0 0 0 0 0 0 0 28
29 15912.8 0 0 0 0 0 1 0 0 0 0 0 0 29
30 13866.5 0 0 0 0 0 0 1 0 0 0 0 0 30
31 17823.2 0 0 0 0 0 0 0 1 0 0 0 0 31
32 17872.0 0 0 0 0 0 0 0 0 1 0 0 0 32
33 17422.0 0 0 0 0 0 0 0 0 0 1 0 0 33
34 16704.5 0 0 0 0 0 0 0 0 0 0 1 0 34
35 15991.2 0 0 0 0 0 0 0 0 0 0 0 1 35
36 16583.6 0 0 0 0 0 0 0 0 0 0 0 0 36
37 19123.5 0 1 0 0 0 0 0 0 0 0 0 0 37
38 17838.7 0 0 1 0 0 0 0 0 0 0 0 0 38
39 17209.4 0 0 0 1 0 0 0 0 0 0 0 0 39
40 18586.5 0 0 0 0 1 0 0 0 0 0 0 0 40
41 16258.1 0 0 0 0 0 1 0 0 0 0 0 0 41
42 15141.6 1 0 0 0 0 0 1 0 0 0 0 0 42
43 19202.1 1 0 0 0 0 0 0 1 0 0 0 0 43
44 17746.5 1 0 0 0 0 0 0 0 1 0 0 0 44
45 19090.1 1 0 0 0 0 0 0 0 0 1 0 0 45
46 18040.3 1 0 0 0 0 0 0 0 0 0 1 0 46
47 17515.5 1 0 0 0 0 0 0 0 0 0 0 1 47
48 17751.8 1 0 0 0 0 0 0 0 0 0 0 0 48
49 21072.4 1 1 0 0 0 0 0 0 0 0 0 0 49
50 17170.0 1 0 1 0 0 0 0 0 0 0 0 0 50
51 19439.5 1 0 0 1 0 0 0 0 0 0 0 0 51
52 19795.4 1 0 0 0 1 0 0 0 0 0 0 0 52
53 17574.9 1 0 0 0 0 1 0 0 0 0 0 0 53
54 16165.4 1 0 0 0 0 0 1 0 0 0 0 0 54
55 19464.6 1 0 0 0 0 0 0 1 0 0 0 0 55
56 19932.1 1 0 0 0 0 0 0 0 1 0 0 0 56
57 19961.2 1 0 0 0 0 0 0 0 0 1 0 0 57
58 17343.4 1 0 0 0 0 0 0 0 0 0 1 0 58
59 18924.2 1 0 0 0 0 0 0 0 0 0 0 1 59
60 18574.1 1 0 0 0 0 0 0 0 0 0 0 0 60
61 21350.6 1 1 0 0 0 0 0 0 0 0 0 0 61
62 18594.6 1 0 1 0 0 0 0 0 0 0 0 0 62
63 19823.1 1 0 0 1 0 0 0 0 0 0 0 0 63
64 20844.4 1 0 0 0 1 0 0 0 0 0 0 0 64
65 19640.2 1 0 0 0 0 1 0 0 0 0 0 0 65
66 17735.4 1 0 0 0 0 0 1 0 0 0 0 0 66
67 19813.6 1 0 0 0 0 0 0 1 0 0 0 0 67
68 22238.5 1 0 0 0 0 0 0 0 1 0 0 0 68
69 20682.2 1 0 0 0 0 0 0 0 0 1 0 0 69
70 17818.6 1 0 0 0 0 0 0 0 0 0 1 0 70
71 21872.1 1 0 0 0 0 0 0 0 0 0 0 1 71
72 22117.0 1 0 0 0 0 0 0 0 0 0 0 0 72
73 21865.9 1 1 0 0 0 0 0 0 0 0 0 0 73
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) dummy M1 M2 M3 M4
13846.47 413.99 1956.27 151.01 357.99 1163.24
M5 M6 M7 M8 M9 M10
-279.32 -2566.57 959.94 1395.95 603.08 -940.42
M11 t
-151.41 82.29
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1530.59 -461.09 20.49 378.87 1931.79
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 13846.467 389.943 35.509 < 2e-16 ***
dummy 413.990 365.727 1.132 0.2622
M1 1956.274 435.513 4.492 3.34e-05 ***
M2 151.014 453.552 0.333 0.7403
M3 357.992 452.997 0.790 0.4325
M4 1163.237 452.605 2.570 0.0127 *
M5 -279.318 452.376 -0.617 0.5393
M6 -2566.571 454.178 -5.651 4.87e-07 ***
M7 959.941 453.282 2.118 0.0384 *
M8 1395.953 452.548 3.085 0.0031 **
M9 603.081 451.976 1.334 0.1872
M10 -940.424 451.567 -2.083 0.0416 *
M11 -151.412 451.321 -0.335 0.7384
t 82.288 8.598 9.571 1.29e-13 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 781.6 on 59 degrees of freedom
Multiple R-squared: 0.9088, Adjusted R-squared: 0.8887
F-statistic: 45.23 on 13 and 59 DF, p-value: < 2.2e-16
> if (n > n25) {
+ kp3 <- k + 3
+ nmkm3 <- n - k - 3
+ gqarr <- array(NA, dim=c(nmkm3-kp3+1,3))
+ numgqtests <- 0
+ numsignificant1 <- 0
+ numsignificant5 <- 0
+ numsignificant10 <- 0
+ for (mypoint in kp3:nmkm3) {
+ j <- 0
+ numgqtests <- numgqtests + 1
+ for (myalt in c('greater', 'two.sided', 'less')) {
+ j <- j + 1
+ gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value
+ }
+ if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1
+ }
+ gqarr
+ }
[,1] [,2] [,3]
[1,] 0.054644824 0.109289649 0.9453552
[2,] 0.026284529 0.052569057 0.9737155
[3,] 0.017709646 0.035419291 0.9822904
[4,] 0.006710602 0.013421204 0.9932894
[5,] 0.002517393 0.005034787 0.9974826
[6,] 0.015068915 0.030137830 0.9849311
[7,] 0.008201140 0.016402280 0.9917989
[8,] 0.005010730 0.010021461 0.9949893
[9,] 0.058463224 0.116926447 0.9415368
[10,] 0.043020544 0.086041088 0.9569795
[11,] 0.033095799 0.066191599 0.9669042
[12,] 0.151159346 0.302318692 0.8488407
[13,] 0.103721693 0.207443386 0.8962783
[14,] 0.111158464 0.222316928 0.8888415
[15,] 0.100566401 0.201132803 0.8994336
[16,] 0.066611904 0.133223809 0.9333881
[17,] 0.083913288 0.167826577 0.9160867
[18,] 0.124476280 0.248952560 0.8755237
[19,] 0.100476673 0.200953346 0.8995233
[20,] 0.074259643 0.148519285 0.9257404
[21,] 0.062069939 0.124139879 0.9379301
[22,] 0.078691520 0.157383040 0.9213085
[23,] 0.052872395 0.105744790 0.9471276
[24,] 0.039954450 0.079908899 0.9600456
[25,] 0.033980153 0.067960307 0.9660198
[26,] 0.020588259 0.041176518 0.9794117
[27,] 0.019714217 0.039428435 0.9802858
[28,] 0.055280657 0.110561313 0.9447193
[29,] 0.054326537 0.108653074 0.9456735
[30,] 0.173015561 0.346031123 0.8269844
[31,] 0.147184959 0.294369917 0.8528150
[32,] 0.115586516 0.231173032 0.8844135
[33,] 0.183540574 0.367081149 0.8164594
[34,] 0.210953712 0.421907424 0.7890463
[35,] 0.212678326 0.425356652 0.7873217
[36,] 0.152428954 0.304857907 0.8475710
[37,] 0.109615783 0.219231567 0.8903842
[38,] 0.062989724 0.125979448 0.9370103
[39,] 0.059807286 0.119614573 0.9401927
[40,] 0.031640136 0.063280271 0.9683599
> postscript(file="/var/www/html/freestat/rcomp/tmp/1h2e81230641686.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/freestat/rcomp/tmp/2v05h1230641686.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/freestat/rcomp/tmp/3nikd1230641686.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/freestat/rcomp/tmp/488oa1230641686.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/freestat/rcomp/tmp/595lp1230641686.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 73
Frequency = 1
1 2 3 4 5 6
-25.628926 1096.842804 1047.276137 -232.357196 1045.009471 309.374441
7 8 9 10 11 12
378.874441 1041.874441 -119.842226 -69.325559 168.674441 -108.825559
13 14 15 16 17 18
-874.387405 221.084325 -481.882341 -856.615675 135.750992 -1057.384038
19 20 21 22 23 24
-86.284038 -161.684038 -1208.700705 144.615962 -1004.384038 -515.584038
25 26 27 28 29 30
43.954116 242.425846 -1005.940820 556.725846 -40.707487 117.957483
31 32 33 34 35 36
465.857483 -3.642517 256.940817 1000.657483 -583.942517 -225.242517
37 38 39 40 41 42
276.095638 714.267368 -204.299299 285.267368 -682.865966 -8.390817
43 44 45 46 47 48
443.309183 -1530.590817 523.592517 935.009183 -461.090817 -458.490817
49 50 51 52 53 54
823.547338 -1355.880932 624.352401 92.719068 -767.514266 27.950705
55 56 57 58 59 60
-281.649295 -332.449295 407.234038 -749.349295 -39.849295 -623.649295
61 62 63 64 65 66
114.288859 -918.739411 20.493922 154.260589 310.327256 610.492226
67 68 69 70 71 72
-920.107774 986.492226 140.775559 -1261.607774 1920.592226 1931.792226
73
-357.869620
> postscript(file="/var/www/html/freestat/rcomp/tmp/6b6fc1230641686.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 73
Frequency = 1
lag(myerror, k = 1) myerror
0 -25.628926 NA
1 1096.842804 -25.628926
2 1047.276137 1096.842804
3 -232.357196 1047.276137
4 1045.009471 -232.357196
5 309.374441 1045.009471
6 378.874441 309.374441
7 1041.874441 378.874441
8 -119.842226 1041.874441
9 -69.325559 -119.842226
10 168.674441 -69.325559
11 -108.825559 168.674441
12 -874.387405 -108.825559
13 221.084325 -874.387405
14 -481.882341 221.084325
15 -856.615675 -481.882341
16 135.750992 -856.615675
17 -1057.384038 135.750992
18 -86.284038 -1057.384038
19 -161.684038 -86.284038
20 -1208.700705 -161.684038
21 144.615962 -1208.700705
22 -1004.384038 144.615962
23 -515.584038 -1004.384038
24 43.954116 -515.584038
25 242.425846 43.954116
26 -1005.940820 242.425846
27 556.725846 -1005.940820
28 -40.707487 556.725846
29 117.957483 -40.707487
30 465.857483 117.957483
31 -3.642517 465.857483
32 256.940817 -3.642517
33 1000.657483 256.940817
34 -583.942517 1000.657483
35 -225.242517 -583.942517
36 276.095638 -225.242517
37 714.267368 276.095638
38 -204.299299 714.267368
39 285.267368 -204.299299
40 -682.865966 285.267368
41 -8.390817 -682.865966
42 443.309183 -8.390817
43 -1530.590817 443.309183
44 523.592517 -1530.590817
45 935.009183 523.592517
46 -461.090817 935.009183
47 -458.490817 -461.090817
48 823.547338 -458.490817
49 -1355.880932 823.547338
50 624.352401 -1355.880932
51 92.719068 624.352401
52 -767.514266 92.719068
53 27.950705 -767.514266
54 -281.649295 27.950705
55 -332.449295 -281.649295
56 407.234038 -332.449295
57 -749.349295 407.234038
58 -39.849295 -749.349295
59 -623.649295 -39.849295
60 114.288859 -623.649295
61 -918.739411 114.288859
62 20.493922 -918.739411
63 154.260589 20.493922
64 310.327256 154.260589
65 610.492226 310.327256
66 -920.107774 610.492226
67 986.492226 -920.107774
68 140.775559 986.492226
69 -1261.607774 140.775559
70 1920.592226 -1261.607774
71 1931.792226 1920.592226
72 -357.869620 1931.792226
73 NA -357.869620
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 1096.842804 -25.628926
[2,] 1047.276137 1096.842804
[3,] -232.357196 1047.276137
[4,] 1045.009471 -232.357196
[5,] 309.374441 1045.009471
[6,] 378.874441 309.374441
[7,] 1041.874441 378.874441
[8,] -119.842226 1041.874441
[9,] -69.325559 -119.842226
[10,] 168.674441 -69.325559
[11,] -108.825559 168.674441
[12,] -874.387405 -108.825559
[13,] 221.084325 -874.387405
[14,] -481.882341 221.084325
[15,] -856.615675 -481.882341
[16,] 135.750992 -856.615675
[17,] -1057.384038 135.750992
[18,] -86.284038 -1057.384038
[19,] -161.684038 -86.284038
[20,] -1208.700705 -161.684038
[21,] 144.615962 -1208.700705
[22,] -1004.384038 144.615962
[23,] -515.584038 -1004.384038
[24,] 43.954116 -515.584038
[25,] 242.425846 43.954116
[26,] -1005.940820 242.425846
[27,] 556.725846 -1005.940820
[28,] -40.707487 556.725846
[29,] 117.957483 -40.707487
[30,] 465.857483 117.957483
[31,] -3.642517 465.857483
[32,] 256.940817 -3.642517
[33,] 1000.657483 256.940817
[34,] -583.942517 1000.657483
[35,] -225.242517 -583.942517
[36,] 276.095638 -225.242517
[37,] 714.267368 276.095638
[38,] -204.299299 714.267368
[39,] 285.267368 -204.299299
[40,] -682.865966 285.267368
[41,] -8.390817 -682.865966
[42,] 443.309183 -8.390817
[43,] -1530.590817 443.309183
[44,] 523.592517 -1530.590817
[45,] 935.009183 523.592517
[46,] -461.090817 935.009183
[47,] -458.490817 -461.090817
[48,] 823.547338 -458.490817
[49,] -1355.880932 823.547338
[50,] 624.352401 -1355.880932
[51,] 92.719068 624.352401
[52,] -767.514266 92.719068
[53,] 27.950705 -767.514266
[54,] -281.649295 27.950705
[55,] -332.449295 -281.649295
[56,] 407.234038 -332.449295
[57,] -749.349295 407.234038
[58,] -39.849295 -749.349295
[59,] -623.649295 -39.849295
[60,] 114.288859 -623.649295
[61,] -918.739411 114.288859
[62,] 20.493922 -918.739411
[63,] 154.260589 20.493922
[64,] 310.327256 154.260589
[65,] 610.492226 310.327256
[66,] -920.107774 610.492226
[67,] 986.492226 -920.107774
[68,] 140.775559 986.492226
[69,] -1261.607774 140.775559
[70,] 1920.592226 -1261.607774
[71,] 1931.792226 1920.592226
[72,] -357.869620 1931.792226
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 1096.842804 -25.628926
2 1047.276137 1096.842804
3 -232.357196 1047.276137
4 1045.009471 -232.357196
5 309.374441 1045.009471
6 378.874441 309.374441
7 1041.874441 378.874441
8 -119.842226 1041.874441
9 -69.325559 -119.842226
10 168.674441 -69.325559
11 -108.825559 168.674441
12 -874.387405 -108.825559
13 221.084325 -874.387405
14 -481.882341 221.084325
15 -856.615675 -481.882341
16 135.750992 -856.615675
17 -1057.384038 135.750992
18 -86.284038 -1057.384038
19 -161.684038 -86.284038
20 -1208.700705 -161.684038
21 144.615962 -1208.700705
22 -1004.384038 144.615962
23 -515.584038 -1004.384038
24 43.954116 -515.584038
25 242.425846 43.954116
26 -1005.940820 242.425846
27 556.725846 -1005.940820
28 -40.707487 556.725846
29 117.957483 -40.707487
30 465.857483 117.957483
31 -3.642517 465.857483
32 256.940817 -3.642517
33 1000.657483 256.940817
34 -583.942517 1000.657483
35 -225.242517 -583.942517
36 276.095638 -225.242517
37 714.267368 276.095638
38 -204.299299 714.267368
39 285.267368 -204.299299
40 -682.865966 285.267368
41 -8.390817 -682.865966
42 443.309183 -8.390817
43 -1530.590817 443.309183
44 523.592517 -1530.590817
45 935.009183 523.592517
46 -461.090817 935.009183
47 -458.490817 -461.090817
48 823.547338 -458.490817
49 -1355.880932 823.547338
50 624.352401 -1355.880932
51 92.719068 624.352401
52 -767.514266 92.719068
53 27.950705 -767.514266
54 -281.649295 27.950705
55 -332.449295 -281.649295
56 407.234038 -332.449295
57 -749.349295 407.234038
58 -39.849295 -749.349295
59 -623.649295 -39.849295
60 114.288859 -623.649295
61 -918.739411 114.288859
62 20.493922 -918.739411
63 154.260589 20.493922
64 310.327256 154.260589
65 610.492226 310.327256
66 -920.107774 610.492226
67 986.492226 -920.107774
68 140.775559 986.492226
69 -1261.607774 140.775559
70 1920.592226 -1261.607774
71 1931.792226 1920.592226
72 -357.869620 1931.792226
> 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/freestat/rcomp/tmp/7f1oj1230641686.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/freestat/rcomp/tmp/8api71230641686.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/freestat/rcomp/tmp/99pmg1230641686.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/freestat/rcomp/tmp/10t9481230641686.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/11mnpe1230641686.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/freestat/rcomp/tmp/12s7cq1230641686.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/freestat/rcomp/tmp/13whlt1230641686.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/freestat/rcomp/tmp/14nc731230641686.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/freestat/rcomp/tmp/15ky311230641686.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/freestat/rcomp/tmp/165moj1230641686.tab")
+ }
>
> system("convert tmp/1h2e81230641686.ps tmp/1h2e81230641686.png")
> system("convert tmp/2v05h1230641686.ps tmp/2v05h1230641686.png")
> system("convert tmp/3nikd1230641686.ps tmp/3nikd1230641686.png")
> system("convert tmp/488oa1230641686.ps tmp/488oa1230641686.png")
> system("convert tmp/595lp1230641686.ps tmp/595lp1230641686.png")
> system("convert tmp/6b6fc1230641686.ps tmp/6b6fc1230641686.png")
> system("convert tmp/7f1oj1230641686.ps tmp/7f1oj1230641686.png")
> system("convert tmp/8api71230641686.ps tmp/8api71230641686.png")
> system("convert tmp/99pmg1230641686.ps tmp/99pmg1230641686.png")
> system("convert tmp/10t9481230641686.ps tmp/10t9481230641686.png")
>
>
> proc.time()
user system elapsed
3.871 2.541 4.237