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(10414.9
+ ,10723.8
+ ,12476.8
+ ,13938.9
+ ,12384.6
+ ,13979.8
+ ,12266.7
+ ,13807.4
+ ,12919.9
+ ,12973.9
+ ,11497.3
+ ,12509.8
+ ,12142
+ ,12934.1
+ ,13919.4
+ ,14908.3
+ ,12656.8
+ ,13772.1
+ ,12034.1
+ ,13012.6
+ ,13199.7
+ ,14049.9
+ ,10881.3
+ ,11816.5
+ ,11301.2
+ ,11593.2
+ ,13643.9
+ ,14466.2
+ ,12517
+ ,13615.9
+ ,13981.1
+ ,14733.9
+ ,14275.7
+ ,13880.7
+ ,13435
+ ,13527.5
+ ,13565.7
+ ,13584
+ ,16216.3
+ ,16170.2
+ ,12970
+ ,13260.6
+ ,14079.9
+ ,14741.9
+ ,14235
+ ,15486.5
+ ,12213.4
+ ,13154.5
+ ,12581
+ ,12621.2
+ ,14130.4
+ ,15031.6
+ ,14210.8
+ ,15452.4
+ ,14378.5
+ ,15428
+ ,13142.8
+ ,13105.9
+ ,13714.7
+ ,14716.8
+ ,13621.9
+ ,14180
+ ,15379.8
+ ,16202.2
+ ,13306.3
+ ,14392.4
+ ,14391.2
+ ,15140.6
+ ,14909.9
+ ,15960.1
+ ,14025.4
+ ,14351.3
+ ,12951.2
+ ,13230.2
+ ,14344.3
+ ,15202.1
+ ,16093.4
+ ,17056
+ ,15413.6
+ ,16077.7
+ ,14705.7
+ ,13348.2
+ ,15972.8
+ ,16402.4
+ ,16241.4
+ ,16559.1
+ ,16626.4
+ ,16579
+ ,17136.2
+ ,17561.2
+ ,15622.9
+ ,16129.6
+ ,18003.9
+ ,18484.3
+ ,16136.1
+ ,16402.6
+ ,14423.7
+ ,14032.3
+ ,16789.4
+ ,17109.1
+ ,16782.2
+ ,17157.2
+ ,14133.8
+ ,13879.8
+ ,12607
+ ,12362.4
+ ,12004.5
+ ,12683.5
+ ,12175.4
+ ,12608.8
+ ,13268
+ ,13583.7
+ ,12299.3
+ ,12846.3
+ ,11800.6
+ ,12347.1
+ ,13873.3
+ ,13967
+ ,12269.6
+ ,13114.3)
+ ,dim=c(2
+ ,60)
+ ,dimnames=list(c('InIEU'
+ ,'UitIEU')
+ ,1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('InIEU','UitIEU'),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 = 'No 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
InIEU UitIEU M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 10414.9 10723.8 1 0 0 0 0 0 0 0 0 0 0
2 12476.8 13938.9 0 1 0 0 0 0 0 0 0 0 0
3 12384.6 13979.8 0 0 1 0 0 0 0 0 0 0 0
4 12266.7 13807.4 0 0 0 1 0 0 0 0 0 0 0
5 12919.9 12973.9 0 0 0 0 1 0 0 0 0 0 0
6 11497.3 12509.8 0 0 0 0 0 1 0 0 0 0 0
7 12142.0 12934.1 0 0 0 0 0 0 1 0 0 0 0
8 13919.4 14908.3 0 0 0 0 0 0 0 1 0 0 0
9 12656.8 13772.1 0 0 0 0 0 0 0 0 1 0 0
10 12034.1 13012.6 0 0 0 0 0 0 0 0 0 1 0
11 13199.7 14049.9 0 0 0 0 0 0 0 0 0 0 1
12 10881.3 11816.5 0 0 0 0 0 0 0 0 0 0 0
13 11301.2 11593.2 1 0 0 0 0 0 0 0 0 0 0
14 13643.9 14466.2 0 1 0 0 0 0 0 0 0 0 0
15 12517.0 13615.9 0 0 1 0 0 0 0 0 0 0 0
16 13981.1 14733.9 0 0 0 1 0 0 0 0 0 0 0
17 14275.7 13880.7 0 0 0 0 1 0 0 0 0 0 0
18 13435.0 13527.5 0 0 0 0 0 1 0 0 0 0 0
19 13565.7 13584.0 0 0 0 0 0 0 1 0 0 0 0
20 16216.3 16170.2 0 0 0 0 0 0 0 1 0 0 0
21 12970.0 13260.6 0 0 0 0 0 0 0 0 1 0 0
22 14079.9 14741.9 0 0 0 0 0 0 0 0 0 1 0
23 14235.0 15486.5 0 0 0 0 0 0 0 0 0 0 1
24 12213.4 13154.5 0 0 0 0 0 0 0 0 0 0 0
25 12581.0 12621.2 1 0 0 0 0 0 0 0 0 0 0
26 14130.4 15031.6 0 1 0 0 0 0 0 0 0 0 0
27 14210.8 15452.4 0 0 1 0 0 0 0 0 0 0 0
28 14378.5 15428.0 0 0 0 1 0 0 0 0 0 0 0
29 13142.8 13105.9 0 0 0 0 1 0 0 0 0 0 0
30 13714.7 14716.8 0 0 0 0 0 1 0 0 0 0 0
31 13621.9 14180.0 0 0 0 0 0 0 1 0 0 0 0
32 15379.8 16202.2 0 0 0 0 0 0 0 1 0 0 0
33 13306.3 14392.4 0 0 0 0 0 0 0 0 1 0 0
34 14391.2 15140.6 0 0 0 0 0 0 0 0 0 1 0
35 14909.9 15960.1 0 0 0 0 0 0 0 0 0 0 1
36 14025.4 14351.3 0 0 0 0 0 0 0 0 0 0 0
37 12951.2 13230.2 1 0 0 0 0 0 0 0 0 0 0
38 14344.3 15202.1 0 1 0 0 0 0 0 0 0 0 0
39 16093.4 17056.0 0 0 1 0 0 0 0 0 0 0 0
40 15413.6 16077.7 0 0 0 1 0 0 0 0 0 0 0
41 14705.7 13348.2 0 0 0 0 1 0 0 0 0 0 0
42 15972.8 16402.4 0 0 0 0 0 1 0 0 0 0 0
43 16241.4 16559.1 0 0 0 0 0 0 1 0 0 0 0
44 16626.4 16579.0 0 0 0 0 0 0 0 1 0 0 0
45 17136.2 17561.2 0 0 0 0 0 0 0 0 1 0 0
46 15622.9 16129.6 0 0 0 0 0 0 0 0 0 1 0
47 18003.9 18484.3 0 0 0 0 0 0 0 0 0 0 1
48 16136.1 16402.6 0 0 0 0 0 0 0 0 0 0 0
49 14423.7 14032.3 1 0 0 0 0 0 0 0 0 0 0
50 16789.4 17109.1 0 1 0 0 0 0 0 0 0 0 0
51 16782.2 17157.2 0 0 1 0 0 0 0 0 0 0 0
52 14133.8 13879.8 0 0 0 1 0 0 0 0 0 0 0
53 12607.0 12362.4 0 0 0 0 1 0 0 0 0 0 0
54 12004.5 12683.5 0 0 0 0 0 1 0 0 0 0 0
55 12175.4 12608.8 0 0 0 0 0 0 1 0 0 0 0
56 13268.0 13583.7 0 0 0 0 0 0 0 1 0 0 0
57 12299.3 12846.3 0 0 0 0 0 0 0 0 1 0 0
58 11800.6 12347.1 0 0 0 0 0 0 0 0 0 1 0
59 13873.3 13967.0 0 0 0 0 0 0 0 0 0 0 1
60 12269.6 13114.3 0 0 0 0 0 0 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) UitIEU M1 M2 M3 M4
-1948.674 1.093 680.955 -339.002 -549.314 -182.982
M5 M6 M7 M8 M9 M10
1117.864 0.844 219.578 95.244 -86.040 -73.252
M11
-252.679
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-698.73 -236.63 -32.40 179.79 1089.20
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.949e+03 5.794e+02 -3.363 0.00154 **
UitIEU 1.093e+00 3.994e-02 27.374 < 2e-16 ***
M1 6.810e+02 2.635e+02 2.584 0.01293 *
M2 -3.390e+02 2.639e+02 -1.284 0.20531
M3 -5.493e+02 2.667e+02 -2.059 0.04502 *
M4 -1.830e+02 2.613e+02 -0.700 0.48720
M5 1.118e+03 2.594e+02 4.310 8.27e-05 ***
M6 8.439e-01 2.582e+02 0.003 0.99741
M7 2.196e+02 2.582e+02 0.850 0.39948
M8 9.524e+01 2.671e+02 0.357 0.72301
M9 -8.604e+01 2.592e+02 -0.332 0.74142
M10 -7.325e+01 2.589e+02 -0.283 0.77847
M11 -2.527e+02 2.682e+02 -0.942 0.35090
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 408.1 on 47 degrees of freedom
Multiple R-squared: 0.9525, Adjusted R-squared: 0.9404
F-statistic: 78.52 on 12 and 47 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.5152610 0.9694780 0.48473899
[2,] 0.3414343 0.6828687 0.65856567
[3,] 0.2900284 0.5800568 0.70997158
[4,] 0.2377381 0.4754763 0.76226185
[5,] 0.1624283 0.3248565 0.83757174
[6,] 0.4582959 0.9165919 0.54170406
[7,] 0.4264293 0.8528586 0.57357068
[8,] 0.5688206 0.8623587 0.43117937
[9,] 0.5147668 0.9704664 0.48523319
[10,] 0.4145588 0.8291176 0.58544118
[11,] 0.3252337 0.6504674 0.67476630
[12,] 0.2859616 0.5719232 0.71403840
[13,] 0.2937942 0.5875883 0.70620584
[14,] 0.2922730 0.5845459 0.70772705
[15,] 0.3581175 0.7162351 0.64188247
[16,] 0.2892488 0.5784976 0.71075121
[17,] 0.3292376 0.6584752 0.67076239
[18,] 0.3454798 0.6909597 0.65452016
[19,] 0.2704948 0.5409895 0.72950524
[20,] 0.3086587 0.6173173 0.69134133
[21,] 0.2615489 0.5230978 0.73845109
[22,] 0.2589659 0.5179318 0.74103409
[23,] 0.2206510 0.4413021 0.77934896
[24,] 0.2030237 0.4060475 0.79697627
[25,] 0.3750049 0.7500098 0.62499511
[26,] 0.9102680 0.1794641 0.08973204
[27,] 0.8399449 0.3201101 0.16005507
[28,] 0.7200070 0.5599859 0.27999297
[29,] 0.6362231 0.7275537 0.36377686
> postscript(file="/var/www/html/rcomp/tmp/18tbr1258815880.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/2g4gv1258815880.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/3xujt1258815880.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/4u3ij1258815880.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/5n94q1258815880.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
-42.844167 -476.395662 -403.003934 -698.733022 -435.025208 -233.155898
7 8 9 10 11 12
-271.122201 -527.989236 -366.977820 -172.024502 38.812925 -90.253842
13 14 15 16 17 18
-107.151029 114.151545 127.286378 2.626654 -70.725441 591.785184
19 20 21 22 23 24
441.973474 389.142189 505.499164 -17.050872 -496.673615 -221.130586
25 26 27 28 29 30
48.627975 -17.560003 -186.953077 -358.906199 -356.454752 -428.902142
31 32 33 34 35 36
-153.496286 -482.346791 -395.717338 -141.691700 -339.610525 282.281546
37 38 39 40 41 42
-247.056059 9.914336 -57.738359 -34.191843 941.513061 -13.846686
43 44 45 46 47 48
-135.317640 352.257964 -30.601125 8.630123 -5.585038 150.078560
49 50 51 52 53 54
348.423279 369.889783 520.408991 1089.204410 -79.307660 84.119543
55 56 57 58 59 60
117.962653 268.935873 287.797120 322.136951 803.056253 -120.975679
> postscript(file="/var/www/html/rcomp/tmp/68l4r1258815880.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 -42.844167 NA
1 -476.395662 -42.844167
2 -403.003934 -476.395662
3 -698.733022 -403.003934
4 -435.025208 -698.733022
5 -233.155898 -435.025208
6 -271.122201 -233.155898
7 -527.989236 -271.122201
8 -366.977820 -527.989236
9 -172.024502 -366.977820
10 38.812925 -172.024502
11 -90.253842 38.812925
12 -107.151029 -90.253842
13 114.151545 -107.151029
14 127.286378 114.151545
15 2.626654 127.286378
16 -70.725441 2.626654
17 591.785184 -70.725441
18 441.973474 591.785184
19 389.142189 441.973474
20 505.499164 389.142189
21 -17.050872 505.499164
22 -496.673615 -17.050872
23 -221.130586 -496.673615
24 48.627975 -221.130586
25 -17.560003 48.627975
26 -186.953077 -17.560003
27 -358.906199 -186.953077
28 -356.454752 -358.906199
29 -428.902142 -356.454752
30 -153.496286 -428.902142
31 -482.346791 -153.496286
32 -395.717338 -482.346791
33 -141.691700 -395.717338
34 -339.610525 -141.691700
35 282.281546 -339.610525
36 -247.056059 282.281546
37 9.914336 -247.056059
38 -57.738359 9.914336
39 -34.191843 -57.738359
40 941.513061 -34.191843
41 -13.846686 941.513061
42 -135.317640 -13.846686
43 352.257964 -135.317640
44 -30.601125 352.257964
45 8.630123 -30.601125
46 -5.585038 8.630123
47 150.078560 -5.585038
48 348.423279 150.078560
49 369.889783 348.423279
50 520.408991 369.889783
51 1089.204410 520.408991
52 -79.307660 1089.204410
53 84.119543 -79.307660
54 117.962653 84.119543
55 268.935873 117.962653
56 287.797120 268.935873
57 322.136951 287.797120
58 803.056253 322.136951
59 -120.975679 803.056253
60 NA -120.975679
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -476.395662 -42.844167
[2,] -403.003934 -476.395662
[3,] -698.733022 -403.003934
[4,] -435.025208 -698.733022
[5,] -233.155898 -435.025208
[6,] -271.122201 -233.155898
[7,] -527.989236 -271.122201
[8,] -366.977820 -527.989236
[9,] -172.024502 -366.977820
[10,] 38.812925 -172.024502
[11,] -90.253842 38.812925
[12,] -107.151029 -90.253842
[13,] 114.151545 -107.151029
[14,] 127.286378 114.151545
[15,] 2.626654 127.286378
[16,] -70.725441 2.626654
[17,] 591.785184 -70.725441
[18,] 441.973474 591.785184
[19,] 389.142189 441.973474
[20,] 505.499164 389.142189
[21,] -17.050872 505.499164
[22,] -496.673615 -17.050872
[23,] -221.130586 -496.673615
[24,] 48.627975 -221.130586
[25,] -17.560003 48.627975
[26,] -186.953077 -17.560003
[27,] -358.906199 -186.953077
[28,] -356.454752 -358.906199
[29,] -428.902142 -356.454752
[30,] -153.496286 -428.902142
[31,] -482.346791 -153.496286
[32,] -395.717338 -482.346791
[33,] -141.691700 -395.717338
[34,] -339.610525 -141.691700
[35,] 282.281546 -339.610525
[36,] -247.056059 282.281546
[37,] 9.914336 -247.056059
[38,] -57.738359 9.914336
[39,] -34.191843 -57.738359
[40,] 941.513061 -34.191843
[41,] -13.846686 941.513061
[42,] -135.317640 -13.846686
[43,] 352.257964 -135.317640
[44,] -30.601125 352.257964
[45,] 8.630123 -30.601125
[46,] -5.585038 8.630123
[47,] 150.078560 -5.585038
[48,] 348.423279 150.078560
[49,] 369.889783 348.423279
[50,] 520.408991 369.889783
[51,] 1089.204410 520.408991
[52,] -79.307660 1089.204410
[53,] 84.119543 -79.307660
[54,] 117.962653 84.119543
[55,] 268.935873 117.962653
[56,] 287.797120 268.935873
[57,] 322.136951 287.797120
[58,] 803.056253 322.136951
[59,] -120.975679 803.056253
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -476.395662 -42.844167
2 -403.003934 -476.395662
3 -698.733022 -403.003934
4 -435.025208 -698.733022
5 -233.155898 -435.025208
6 -271.122201 -233.155898
7 -527.989236 -271.122201
8 -366.977820 -527.989236
9 -172.024502 -366.977820
10 38.812925 -172.024502
11 -90.253842 38.812925
12 -107.151029 -90.253842
13 114.151545 -107.151029
14 127.286378 114.151545
15 2.626654 127.286378
16 -70.725441 2.626654
17 591.785184 -70.725441
18 441.973474 591.785184
19 389.142189 441.973474
20 505.499164 389.142189
21 -17.050872 505.499164
22 -496.673615 -17.050872
23 -221.130586 -496.673615
24 48.627975 -221.130586
25 -17.560003 48.627975
26 -186.953077 -17.560003
27 -358.906199 -186.953077
28 -356.454752 -358.906199
29 -428.902142 -356.454752
30 -153.496286 -428.902142
31 -482.346791 -153.496286
32 -395.717338 -482.346791
33 -141.691700 -395.717338
34 -339.610525 -141.691700
35 282.281546 -339.610525
36 -247.056059 282.281546
37 9.914336 -247.056059
38 -57.738359 9.914336
39 -34.191843 -57.738359
40 941.513061 -34.191843
41 -13.846686 941.513061
42 -135.317640 -13.846686
43 352.257964 -135.317640
44 -30.601125 352.257964
45 8.630123 -30.601125
46 -5.585038 8.630123
47 150.078560 -5.585038
48 348.423279 150.078560
49 369.889783 348.423279
50 520.408991 369.889783
51 1089.204410 520.408991
52 -79.307660 1089.204410
53 84.119543 -79.307660
54 117.962653 84.119543
55 268.935873 117.962653
56 287.797120 268.935873
57 322.136951 287.797120
58 803.056253 322.136951
59 -120.975679 803.056253
> 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/7icd61258815880.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/8br821258815880.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/9eeng1258815880.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/10lv671258815880.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/11ba6b1258815880.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/125ozq1258815880.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/13sqvw1258815880.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/14jkhh1258815880.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/15c6ld1258815880.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/16c7sg1258815880.tab")
+ }
>
> system("convert tmp/18tbr1258815880.ps tmp/18tbr1258815880.png")
> system("convert tmp/2g4gv1258815880.ps tmp/2g4gv1258815880.png")
> system("convert tmp/3xujt1258815880.ps tmp/3xujt1258815880.png")
> system("convert tmp/4u3ij1258815880.ps tmp/4u3ij1258815880.png")
> system("convert tmp/5n94q1258815880.ps tmp/5n94q1258815880.png")
> system("convert tmp/68l4r1258815880.ps tmp/68l4r1258815880.png")
> system("convert tmp/7icd61258815880.ps tmp/7icd61258815880.png")
> system("convert tmp/8br821258815880.ps tmp/8br821258815880.png")
> system("convert tmp/9eeng1258815880.ps tmp/9eeng1258815880.png")
> system("convert tmp/10lv671258815880.ps tmp/10lv671258815880.png")
>
>
> proc.time()
user system elapsed
2.435 1.545 3.692