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.
Natural language support but running in an English locale
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(300,2.26,302,2.57,400,3.07,392,2.76,373,2.51,379,2.87,303,3.14,324,3.11,353,3.16,392,2.47,327,2.57,376,2.89,329,2.63,359,2.38,413,1.69,338,1.96,422,2.19,390,1.87,370,1.60,367,1.63,406,1.22,418,1.21,346,1.49,350,1.64,330,1.66,318,1.77,382,1.82,337,1.78,372,1.28,422,1.29,428,1.37,426,1.12,396,1.51,458,2.24,315,2.94,337,3.09,386,3.46,352,3.64,383,4.39,439,4.15,397,5.21,453,5.80,363,5.91,365,5.39,474,5.46,373,4.72,403,3.14,384,2.63,364,2.32,361,1.93,419,0.62,352,0.60,363,-0.37,410,-1.10,361,-1.68,383,-0.78,342,-1.19,369,-0.79,361,-0.12,317,0.26,386,0.62,318,0.70,407,1.66,393,1.80,404,2.27,498,2.46,438,2.57),dim=c(2,67),dimnames=list(c('Aantal_vergunningen','Inflatie'),1:67))
> y <- array(NA,dim=c(2,67),dimnames=list(c('Aantal_vergunningen','Inflatie'),1:67))
> 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
Aantal_vergunningen Inflatie M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 300 2.26 1 0 0 0 0 0 0 0 0 0 0 1
2 302 2.57 0 1 0 0 0 0 0 0 0 0 0 2
3 400 3.07 0 0 1 0 0 0 0 0 0 0 0 3
4 392 2.76 0 0 0 1 0 0 0 0 0 0 0 4
5 373 2.51 0 0 0 0 1 0 0 0 0 0 0 5
6 379 2.87 0 0 0 0 0 1 0 0 0 0 0 6
7 303 3.14 0 0 0 0 0 0 1 0 0 0 0 7
8 324 3.11 0 0 0 0 0 0 0 1 0 0 0 8
9 353 3.16 0 0 0 0 0 0 0 0 1 0 0 9
10 392 2.47 0 0 0 0 0 0 0 0 0 1 0 10
11 327 2.57 0 0 0 0 0 0 0 0 0 0 1 11
12 376 2.89 0 0 0 0 0 0 0 0 0 0 0 12
13 329 2.63 1 0 0 0 0 0 0 0 0 0 0 13
14 359 2.38 0 1 0 0 0 0 0 0 0 0 0 14
15 413 1.69 0 0 1 0 0 0 0 0 0 0 0 15
16 338 1.96 0 0 0 1 0 0 0 0 0 0 0 16
17 422 2.19 0 0 0 0 1 0 0 0 0 0 0 17
18 390 1.87 0 0 0 0 0 1 0 0 0 0 0 18
19 370 1.60 0 0 0 0 0 0 1 0 0 0 0 19
20 367 1.63 0 0 0 0 0 0 0 1 0 0 0 20
21 406 1.22 0 0 0 0 0 0 0 0 1 0 0 21
22 418 1.21 0 0 0 0 0 0 0 0 0 1 0 22
23 346 1.49 0 0 0 0 0 0 0 0 0 0 1 23
24 350 1.64 0 0 0 0 0 0 0 0 0 0 0 24
25 330 1.66 1 0 0 0 0 0 0 0 0 0 0 25
26 318 1.77 0 1 0 0 0 0 0 0 0 0 0 26
27 382 1.82 0 0 1 0 0 0 0 0 0 0 0 27
28 337 1.78 0 0 0 1 0 0 0 0 0 0 0 28
29 372 1.28 0 0 0 0 1 0 0 0 0 0 0 29
30 422 1.29 0 0 0 0 0 1 0 0 0 0 0 30
31 428 1.37 0 0 0 0 0 0 1 0 0 0 0 31
32 426 1.12 0 0 0 0 0 0 0 1 0 0 0 32
33 396 1.51 0 0 0 0 0 0 0 0 1 0 0 33
34 458 2.24 0 0 0 0 0 0 0 0 0 1 0 34
35 315 2.94 0 0 0 0 0 0 0 0 0 0 1 35
36 337 3.09 0 0 0 0 0 0 0 0 0 0 0 36
37 386 3.46 1 0 0 0 0 0 0 0 0 0 0 37
38 352 3.64 0 1 0 0 0 0 0 0 0 0 0 38
39 383 4.39 0 0 1 0 0 0 0 0 0 0 0 39
40 439 4.15 0 0 0 1 0 0 0 0 0 0 0 40
41 397 5.21 0 0 0 0 1 0 0 0 0 0 0 41
42 453 5.80 0 0 0 0 0 1 0 0 0 0 0 42
43 363 5.91 0 0 0 0 0 0 1 0 0 0 0 43
44 365 5.39 0 0 0 0 0 0 0 1 0 0 0 44
45 474 5.46 0 0 0 0 0 0 0 0 1 0 0 45
46 373 4.72 0 0 0 0 0 0 0 0 0 1 0 46
47 403 3.14 0 0 0 0 0 0 0 0 0 0 1 47
48 384 2.63 0 0 0 0 0 0 0 0 0 0 0 48
49 364 2.32 1 0 0 0 0 0 0 0 0 0 0 49
50 361 1.93 0 1 0 0 0 0 0 0 0 0 0 50
51 419 0.62 0 0 1 0 0 0 0 0 0 0 0 51
52 352 0.60 0 0 0 1 0 0 0 0 0 0 0 52
53 363 -0.37 0 0 0 0 1 0 0 0 0 0 0 53
54 410 -1.10 0 0 0 0 0 1 0 0 0 0 0 54
55 361 -1.68 0 0 0 0 0 0 1 0 0 0 0 55
56 383 -0.78 0 0 0 0 0 0 0 1 0 0 0 56
57 342 -1.19 0 0 0 0 0 0 0 0 1 0 0 57
58 369 -0.79 0 0 0 0 0 0 0 0 0 1 0 58
59 361 -0.12 0 0 0 0 0 0 0 0 0 0 1 59
60 317 0.26 0 0 0 0 0 0 0 0 0 0 0 60
61 386 0.62 1 0 0 0 0 0 0 0 0 0 0 61
62 318 0.70 0 1 0 0 0 0 0 0 0 0 0 62
63 407 1.66 0 0 1 0 0 0 0 0 0 0 0 63
64 393 1.80 0 0 0 1 0 0 0 0 0 0 0 64
65 404 2.27 0 0 0 0 1 0 0 0 0 0 0 65
66 498 2.46 0 0 0 0 0 1 0 0 0 0 0 66
67 438 2.57 0 0 0 0 0 0 1 0 0 0 0 67
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Inflatie M1 M2 M3 M4
314.7058 5.9610 -0.4186 -15.3351 49.3632 23.3517
M5 M6 M7 M8 M9 M10
35.9352 71.9591 23.3605 23.0881 43.9476 51.4071
M11 t
-1.1057 0.7101
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-58.755 -23.087 1.088 22.116 59.754
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 314.7058 18.3093 17.188 < 2e-16 ***
Inflatie 5.9610 2.6196 2.276 0.026943 *
M1 -0.4186 20.1517 -0.021 0.983507
M2 -15.3351 20.1414 -0.761 0.449809
M3 49.3632 20.1339 2.452 0.017545 *
M4 23.3517 20.1282 1.160 0.251187
M5 35.9352 20.1253 1.786 0.079890 .
M6 71.9591 20.1252 3.576 0.000756 ***
M7 23.3605 20.1256 1.161 0.250951
M8 23.0881 21.0368 1.098 0.277378
M9 43.9476 21.0309 2.090 0.041463 *
M10 51.4071 21.0277 2.445 0.017854 *
M11 -1.1057 21.0218 -0.053 0.958250
t 0.7101 0.2182 3.254 0.001984 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 33.23 on 53 degrees of freedom
Multiple R-squared: 0.5007, Adjusted R-squared: 0.3783
F-statistic: 4.089 on 13 and 53 DF, p-value: 0.0001221
> 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.56929676 0.8614065 0.43070324
[2,] 0.41202012 0.8240402 0.58797988
[3,] 0.49530523 0.9906105 0.50469477
[4,] 0.37962225 0.7592445 0.62037775
[5,] 0.28692891 0.5738578 0.71307109
[6,] 0.20188431 0.4037686 0.79811569
[7,] 0.13107432 0.2621486 0.86892568
[8,] 0.15436249 0.3087250 0.84563751
[9,] 0.11208369 0.2241674 0.88791631
[10,] 0.10195341 0.2039068 0.89804659
[11,] 0.09282445 0.1856489 0.90717555
[12,] 0.09131152 0.1826230 0.90868848
[13,] 0.07753017 0.1550603 0.92246983
[14,] 0.06087785 0.1217557 0.93912215
[15,] 0.15570024 0.3114005 0.84429976
[16,] 0.23665133 0.4733027 0.76334867
[17,] 0.17227267 0.3445453 0.82772733
[18,] 0.38798056 0.7759611 0.61201944
[19,] 0.40008625 0.8001725 0.59991375
[20,] 0.32750270 0.6550054 0.67249730
[21,] 0.36283199 0.7256640 0.63716801
[22,] 0.28870571 0.5774114 0.71129429
[23,] 0.25720261 0.5144052 0.74279739
[24,] 0.42069648 0.8413930 0.57930352
[25,] 0.33017700 0.6603540 0.66982300
[26,] 0.28037006 0.5607401 0.71962994
[27,] 0.39355866 0.7871173 0.60644134
[28,] 0.64727492 0.7054502 0.35272508
[29,] 0.73122859 0.5375428 0.26877141
[30,] 0.90953248 0.1809350 0.09046752
[31,] 0.86332988 0.2733402 0.13667012
[32,] 0.81892047 0.3621591 0.18107953
[33,] 0.93920009 0.1215998 0.06079991
[34,] 0.84865929 0.3026814 0.15134071
> postscript(file="/var/www/html/freestat/rcomp/tmp/18dut1292503213.ps",horizontal=F,onefile=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/28dut1292503213.ps",horizontal=F,onefile=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/38dut1292503213.ps",horizontal=F,onefile=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/415tw1292503213.ps",horizontal=F,onefile=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/515tw1292503213.ps",horizontal=F,onefile=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 = 67
Frequency = 1
1 2 3 4 5 6 7
-28.469263 -14.110772 15.500364 34.649579 3.846240 -29.033709 -58.754698
8 9 10 11 12 13 14
-38.013640 -30.881274 4.062244 -9.731183 35.545471 -10.196215 35.500446
15 16 17 18 19 20 21
28.205191 -23.102984 46.232389 -20.594069 8.903891 5.287287 25.161721
22 23 24 25 26 27 28
29.051748 7.185338 8.475365 -11.935406 -10.384711 -12.091117 -31.551377
29 30 31 32 33 34 35
-6.864463 6.341944 59.753549 58.806030 4.911650 54.390526 -40.979511
36 37 38 39 40 41 42
-21.689484 24.813389 3.946813 -34.932305 47.799639 -13.812632 1.936386
43 44 45 46 47 48 49
-40.830840 -36.168885 50.844261 -53.914170 37.306910 19.531208 1.087572
50 51 52 53 54 55 56
14.618775 15.019350 -26.560130 -23.071538 -8.453979 -6.108104 10.089208
57 58 59 60 61 62 63
-50.036358 -33.590348 6.218446 -41.862560 24.699923 -29.570551 -11.701483
64 65 66 67
-1.234726 -6.329996 49.803428 37.036202
> postscript(file="/var/www/html/freestat/rcomp/tmp/615tw1292503213.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 67
Frequency = 1
lag(myerror, k = 1) myerror
0 -28.469263 NA
1 -14.110772 -28.469263
2 15.500364 -14.110772
3 34.649579 15.500364
4 3.846240 34.649579
5 -29.033709 3.846240
6 -58.754698 -29.033709
7 -38.013640 -58.754698
8 -30.881274 -38.013640
9 4.062244 -30.881274
10 -9.731183 4.062244
11 35.545471 -9.731183
12 -10.196215 35.545471
13 35.500446 -10.196215
14 28.205191 35.500446
15 -23.102984 28.205191
16 46.232389 -23.102984
17 -20.594069 46.232389
18 8.903891 -20.594069
19 5.287287 8.903891
20 25.161721 5.287287
21 29.051748 25.161721
22 7.185338 29.051748
23 8.475365 7.185338
24 -11.935406 8.475365
25 -10.384711 -11.935406
26 -12.091117 -10.384711
27 -31.551377 -12.091117
28 -6.864463 -31.551377
29 6.341944 -6.864463
30 59.753549 6.341944
31 58.806030 59.753549
32 4.911650 58.806030
33 54.390526 4.911650
34 -40.979511 54.390526
35 -21.689484 -40.979511
36 24.813389 -21.689484
37 3.946813 24.813389
38 -34.932305 3.946813
39 47.799639 -34.932305
40 -13.812632 47.799639
41 1.936386 -13.812632
42 -40.830840 1.936386
43 -36.168885 -40.830840
44 50.844261 -36.168885
45 -53.914170 50.844261
46 37.306910 -53.914170
47 19.531208 37.306910
48 1.087572 19.531208
49 14.618775 1.087572
50 15.019350 14.618775
51 -26.560130 15.019350
52 -23.071538 -26.560130
53 -8.453979 -23.071538
54 -6.108104 -8.453979
55 10.089208 -6.108104
56 -50.036358 10.089208
57 -33.590348 -50.036358
58 6.218446 -33.590348
59 -41.862560 6.218446
60 24.699923 -41.862560
61 -29.570551 24.699923
62 -11.701483 -29.570551
63 -1.234726 -11.701483
64 -6.329996 -1.234726
65 49.803428 -6.329996
66 37.036202 49.803428
67 NA 37.036202
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -14.110772 -28.469263
[2,] 15.500364 -14.110772
[3,] 34.649579 15.500364
[4,] 3.846240 34.649579
[5,] -29.033709 3.846240
[6,] -58.754698 -29.033709
[7,] -38.013640 -58.754698
[8,] -30.881274 -38.013640
[9,] 4.062244 -30.881274
[10,] -9.731183 4.062244
[11,] 35.545471 -9.731183
[12,] -10.196215 35.545471
[13,] 35.500446 -10.196215
[14,] 28.205191 35.500446
[15,] -23.102984 28.205191
[16,] 46.232389 -23.102984
[17,] -20.594069 46.232389
[18,] 8.903891 -20.594069
[19,] 5.287287 8.903891
[20,] 25.161721 5.287287
[21,] 29.051748 25.161721
[22,] 7.185338 29.051748
[23,] 8.475365 7.185338
[24,] -11.935406 8.475365
[25,] -10.384711 -11.935406
[26,] -12.091117 -10.384711
[27,] -31.551377 -12.091117
[28,] -6.864463 -31.551377
[29,] 6.341944 -6.864463
[30,] 59.753549 6.341944
[31,] 58.806030 59.753549
[32,] 4.911650 58.806030
[33,] 54.390526 4.911650
[34,] -40.979511 54.390526
[35,] -21.689484 -40.979511
[36,] 24.813389 -21.689484
[37,] 3.946813 24.813389
[38,] -34.932305 3.946813
[39,] 47.799639 -34.932305
[40,] -13.812632 47.799639
[41,] 1.936386 -13.812632
[42,] -40.830840 1.936386
[43,] -36.168885 -40.830840
[44,] 50.844261 -36.168885
[45,] -53.914170 50.844261
[46,] 37.306910 -53.914170
[47,] 19.531208 37.306910
[48,] 1.087572 19.531208
[49,] 14.618775 1.087572
[50,] 15.019350 14.618775
[51,] -26.560130 15.019350
[52,] -23.071538 -26.560130
[53,] -8.453979 -23.071538
[54,] -6.108104 -8.453979
[55,] 10.089208 -6.108104
[56,] -50.036358 10.089208
[57,] -33.590348 -50.036358
[58,] 6.218446 -33.590348
[59,] -41.862560 6.218446
[60,] 24.699923 -41.862560
[61,] -29.570551 24.699923
[62,] -11.701483 -29.570551
[63,] -1.234726 -11.701483
[64,] -6.329996 -1.234726
[65,] 49.803428 -6.329996
[66,] 37.036202 49.803428
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -14.110772 -28.469263
2 15.500364 -14.110772
3 34.649579 15.500364
4 3.846240 34.649579
5 -29.033709 3.846240
6 -58.754698 -29.033709
7 -38.013640 -58.754698
8 -30.881274 -38.013640
9 4.062244 -30.881274
10 -9.731183 4.062244
11 35.545471 -9.731183
12 -10.196215 35.545471
13 35.500446 -10.196215
14 28.205191 35.500446
15 -23.102984 28.205191
16 46.232389 -23.102984
17 -20.594069 46.232389
18 8.903891 -20.594069
19 5.287287 8.903891
20 25.161721 5.287287
21 29.051748 25.161721
22 7.185338 29.051748
23 8.475365 7.185338
24 -11.935406 8.475365
25 -10.384711 -11.935406
26 -12.091117 -10.384711
27 -31.551377 -12.091117
28 -6.864463 -31.551377
29 6.341944 -6.864463
30 59.753549 6.341944
31 58.806030 59.753549
32 4.911650 58.806030
33 54.390526 4.911650
34 -40.979511 54.390526
35 -21.689484 -40.979511
36 24.813389 -21.689484
37 3.946813 24.813389
38 -34.932305 3.946813
39 47.799639 -34.932305
40 -13.812632 47.799639
41 1.936386 -13.812632
42 -40.830840 1.936386
43 -36.168885 -40.830840
44 50.844261 -36.168885
45 -53.914170 50.844261
46 37.306910 -53.914170
47 19.531208 37.306910
48 1.087572 19.531208
49 14.618775 1.087572
50 15.019350 14.618775
51 -26.560130 15.019350
52 -23.071538 -26.560130
53 -8.453979 -23.071538
54 -6.108104 -8.453979
55 10.089208 -6.108104
56 -50.036358 10.089208
57 -33.590348 -50.036358
58 6.218446 -33.590348
59 -41.862560 6.218446
60 24.699923 -41.862560
61 -29.570551 24.699923
62 -11.701483 -29.570551
63 -1.234726 -11.701483
64 -6.329996 -1.234726
65 49.803428 -6.329996
66 37.036202 49.803428
> 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/7cetz1292503213.ps",horizontal=F,onefile=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/8m5a21292503213.ps",horizontal=F,onefile=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/9m5a21292503213.ps",horizontal=F,onefile=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/10m5a21292503213.ps",horizontal=F,onefile=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/11ix8t1292503213.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/124yoz1292503213.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/13ipmq1292503213.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/14ahla1292503213.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/15whkg1292503213.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/16srzp1292503213.tab")
+ }
>
> try(system("convert tmp/18dut1292503213.ps tmp/18dut1292503213.png",intern=TRUE))
character(0)
> try(system("convert tmp/28dut1292503213.ps tmp/28dut1292503213.png",intern=TRUE))
character(0)
> try(system("convert tmp/38dut1292503213.ps tmp/38dut1292503213.png",intern=TRUE))
character(0)
> try(system("convert tmp/415tw1292503213.ps tmp/415tw1292503213.png",intern=TRUE))
character(0)
> try(system("convert tmp/515tw1292503213.ps tmp/515tw1292503213.png",intern=TRUE))
character(0)
> try(system("convert tmp/615tw1292503213.ps tmp/615tw1292503213.png",intern=TRUE))
character(0)
> try(system("convert tmp/7cetz1292503213.ps tmp/7cetz1292503213.png",intern=TRUE))
character(0)
> try(system("convert tmp/8m5a21292503213.ps tmp/8m5a21292503213.png",intern=TRUE))
character(0)
> try(system("convert tmp/9m5a21292503213.ps tmp/9m5a21292503213.png",intern=TRUE))
character(0)
> try(system("convert tmp/10m5a21292503213.ps tmp/10m5a21292503213.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.910 2.529 4.287