R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-pc-linux-gnu (32-bit)
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(7.1
+ ,426
+ ,3.2
+ ,24776
+ ,7.2
+ ,396
+ ,2.9
+ ,19814
+ ,7.2
+ ,458
+ ,2.7
+ ,12738
+ ,7.1
+ ,315
+ ,3.1
+ ,31566
+ ,6.9
+ ,337
+ ,2.7
+ ,30111
+ ,6.8
+ ,386
+ ,2.6
+ ,30019
+ ,6.8
+ ,352
+ ,1.8
+ ,31934
+ ,6.8
+ ,384
+ ,2.3
+ ,25826
+ ,6.9
+ ,439
+ ,2.2
+ ,26835
+ ,7.1
+ ,397
+ ,1.8
+ ,20205
+ ,7.2
+ ,453
+ ,1.4
+ ,17789
+ ,7.2
+ ,364
+ ,0.3
+ ,20520
+ ,7.1
+ ,367
+ ,0.8
+ ,22518
+ ,7.1
+ ,474
+ ,-0.5
+ ,15572
+ ,7.2
+ ,373
+ ,-2.2
+ ,11509
+ ,7.5
+ ,404
+ ,-2.9
+ ,25447
+ ,7.7
+ ,385
+ ,-5.1
+ ,24090
+ ,7.8
+ ,365
+ ,-7.2
+ ,27786
+ ,7.7
+ ,366
+ ,-7.9
+ ,26195
+ ,7.7
+ ,421
+ ,-10.9
+ ,20516
+ ,7.8
+ ,354
+ ,-12.7
+ ,22759
+ ,8
+ ,367
+ ,-14
+ ,19028
+ ,8.1
+ ,413
+ ,-15.6
+ ,16971
+ ,8.1
+ ,362
+ ,-16
+ ,20036
+ ,8
+ ,385
+ ,-17.2
+ ,22485
+ ,8.1
+ ,343
+ ,-17.6
+ ,18730
+ ,8.2
+ ,369
+ ,-15.5
+ ,14538
+ ,8.4
+ ,363
+ ,-13.7
+ ,27561
+ ,8.5
+ ,318
+ ,-11.4
+ ,25985
+ ,8.5
+ ,393
+ ,-9.2
+ ,34670
+ ,8.5
+ ,325
+ ,-6.3
+ ,32066
+ ,8.5
+ ,403
+ ,-3.1
+ ,27186
+ ,8.5
+ ,392
+ ,0
+ ,29586
+ ,8.4
+ ,409
+ ,3
+ ,21359
+ ,8.3
+ ,485
+ ,5.4
+ ,21553
+ ,8.2
+ ,423
+ ,7.6
+ ,19573
+ ,8.1
+ ,428
+ ,9.7
+ ,24256
+ ,7.9
+ ,431
+ ,12
+ ,22380
+ ,7.6
+ ,416
+ ,11.6
+ ,16167
+ ,7.3
+ ,330
+ ,10
+ ,27297
+ ,7.1
+ ,314
+ ,10.8
+ ,28287
+ ,7
+ ,345
+ ,11.3
+ ,33474
+ ,7.1
+ ,365
+ ,10.1
+ ,28229
+ ,7.1
+ ,417
+ ,9.4
+ ,28785
+ ,7.1
+ ,356
+ ,9.6
+ ,25597
+ ,7.3
+ ,477
+ ,7.9
+ ,18130
+ ,7.3
+ ,423
+ ,7.3
+ ,20198
+ ,7.3
+ ,386
+ ,6.2
+ ,22849
+ ,7.2
+ ,390
+ ,4.9
+ ,23118
+ ,7.2
+ ,407
+ ,3.6
+ ,21925
+ ,7.1
+ ,398
+ ,2.9
+ ,20801
+ ,7.1
+ ,327
+ ,3.1
+ ,18785
+ ,7.1
+ ,304
+ ,1.7
+ ,20659
+ ,7.2
+ ,378
+ ,0.6
+ ,29367
+ ,7.3
+ ,311
+ ,-0.4
+ ,23992
+ ,7.4
+ ,376
+ ,-1.1
+ ,20645
+ ,7.4
+ ,340
+ ,-2.9
+ ,22356
+ ,7.5
+ ,383
+ ,-2.8
+ ,17902
+ ,7.4
+ ,467
+ ,-3
+ ,15879
+ ,7.4
+ ,439
+ ,-3.2
+ ,16963)
+ ,dim=c(4
+ ,60)
+ ,dimnames=list(c('werkloosheidsgraad'
+ ,'bouwvergunningen'
+ ,'uitvoer'
+ ,'personenwagens')
+ ,1:60))
> y <- array(NA,dim=c(4,60),dimnames=list(c('werkloosheidsgraad','bouwvergunningen','uitvoer','personenwagens'),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 = 'Do not include Seasonal Dummies'
> par1 = '1'
> par3 <- 'No Linear Trend'
> par2 <- 'Do not include Seasonal 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, 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
werkloosheidsgraad bouwvergunningen uitvoer personenwagens
1 7.1 426 3.2 24776
2 7.2 396 2.9 19814
3 7.2 458 2.7 12738
4 7.1 315 3.1 31566
5 6.9 337 2.7 30111
6 6.8 386 2.6 30019
7 6.8 352 1.8 31934
8 6.8 384 2.3 25826
9 6.9 439 2.2 26835
10 7.1 397 1.8 20205
11 7.2 453 1.4 17789
12 7.2 364 0.3 20520
13 7.1 367 0.8 22518
14 7.1 474 -0.5 15572
15 7.2 373 -2.2 11509
16 7.5 404 -2.9 25447
17 7.7 385 -5.1 24090
18 7.8 365 -7.2 27786
19 7.7 366 -7.9 26195
20 7.7 421 -10.9 20516
21 7.8 354 -12.7 22759
22 8.0 367 -14.0 19028
23 8.1 413 -15.6 16971
24 8.1 362 -16.0 20036
25 8.0 385 -17.2 22485
26 8.1 343 -17.6 18730
27 8.2 369 -15.5 14538
28 8.4 363 -13.7 27561
29 8.5 318 -11.4 25985
30 8.5 393 -9.2 34670
31 8.5 325 -6.3 32066
32 8.5 403 -3.1 27186
33 8.5 392 0.0 29586
34 8.4 409 3.0 21359
35 8.3 485 5.4 21553
36 8.2 423 7.6 19573
37 8.1 428 9.7 24256
38 7.9 431 12.0 22380
39 7.6 416 11.6 16167
40 7.3 330 10.0 27297
41 7.1 314 10.8 28287
42 7.0 345 11.3 33474
43 7.1 365 10.1 28229
44 7.1 417 9.4 28785
45 7.1 356 9.6 25597
46 7.3 477 7.9 18130
47 7.3 423 7.3 20198
48 7.3 386 6.2 22849
49 7.2 390 4.9 23118
50 7.2 407 3.6 21925
51 7.1 398 2.9 20801
52 7.1 327 3.1 18785
53 7.1 304 1.7 20659
54 7.2 378 0.6 29367
55 7.3 311 -0.4 23992
56 7.4 376 -1.1 20645
57 7.4 340 -2.9 22356
58 7.5 383 -2.8 17902
59 7.4 467 -3.0 15879
60 7.4 439 -3.2 16963
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) bouwvergunningen uitvoer personenwagens
6.014533 0.002739 -0.038419 0.000019
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.7421 -0.2589 -0.0765 0.1058 0.9748
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 6.0145334 0.7556107 7.960 9.00e-11 ***
bouwvergunningen 0.0027385 0.0014889 1.839 0.0712 .
uitvoer -0.0384193 0.0074713 -5.142 3.59e-06 ***
personenwagens 0.0000190 0.0000124 1.533 0.1310
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.4389 on 56 degrees of freedom
Multiple R-squared: 0.3223, Adjusted R-squared: 0.286
F-statistic: 8.879 on 3 and 56 DF, p-value: 6.599e-05
> 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,] 1.034080e-02 2.068161e-02 9.896592e-01
[2,] 5.075320e-03 1.015064e-02 9.949247e-01
[3,] 2.294391e-03 4.588782e-03 9.977056e-01
[4,] 1.172968e-03 2.345936e-03 9.988270e-01
[5,] 1.276450e-03 2.552900e-03 9.987236e-01
[6,] 5.063762e-04 1.012752e-03 9.994936e-01
[7,] 1.464870e-04 2.929741e-04 9.998535e-01
[8,] 4.870366e-05 9.740731e-05 9.999513e-01
[9,] 1.804416e-05 3.608832e-05 9.999820e-01
[10,] 8.594298e-04 1.718860e-03 9.991406e-01
[11,] 8.477565e-04 1.695513e-03 9.991522e-01
[12,] 4.033104e-04 8.066208e-04 9.995967e-01
[13,] 1.799585e-04 3.599170e-04 9.998200e-01
[14,] 2.276145e-04 4.552290e-04 9.997724e-01
[15,] 1.425584e-04 2.851168e-04 9.998574e-01
[16,] 5.499610e-05 1.099922e-04 9.999450e-01
[17,] 2.086103e-05 4.172206e-05 9.999791e-01
[18,] 7.449101e-06 1.489820e-05 9.999926e-01
[19,] 5.207089e-06 1.041418e-05 9.999948e-01
[20,] 2.005278e-06 4.010556e-06 9.999980e-01
[21,] 8.818312e-07 1.763662e-06 9.999991e-01
[22,] 7.218982e-06 1.443796e-05 9.999928e-01
[23,] 2.220737e-04 4.441474e-04 9.997779e-01
[24,] 1.439776e-03 2.879551e-03 9.985602e-01
[25,] 1.541635e-02 3.083271e-02 9.845836e-01
[26,] 1.314133e-01 2.628265e-01 8.685867e-01
[27,] 5.993727e-01 8.012546e-01 4.006273e-01
[28,] 9.564429e-01 8.711416e-02 4.355708e-02
[29,] 9.918969e-01 1.620629e-02 8.103147e-03
[30,] 9.995395e-01 9.210120e-04 4.605060e-04
[31,] 9.999953e-01 9.376936e-06 4.688468e-06
[32,] 1.000000e+00 2.570971e-08 1.285486e-08
[33,] 1.000000e+00 2.291124e-09 1.145562e-09
[34,] 1.000000e+00 1.027430e-09 5.137151e-10
[35,] 1.000000e+00 4.355784e-09 2.177892e-09
[36,] 1.000000e+00 2.482543e-08 1.241271e-08
[37,] 9.999999e-01 1.348764e-07 6.743820e-08
[38,] 9.999997e-01 6.557521e-07 3.278760e-07
[39,] 9.999983e-01 3.406706e-06 1.703353e-06
[40,] 9.999925e-01 1.502435e-05 7.512175e-06
[41,] 9.999838e-01 3.234825e-05 1.617413e-05
[42,] 9.999926e-01 1.472506e-05 7.362530e-06
[43,] 9.999877e-01 2.461454e-05 1.230727e-05
[44,] 9.999827e-01 3.466373e-05 1.733187e-05
[45,] 9.998639e-01 2.721230e-04 1.360615e-04
[46,] 9.990688e-01 1.862319e-03 9.311596e-04
[47,] 9.982137e-01 3.572553e-03 1.786277e-03
> postscript(file="/var/wessaorg/rcomp/tmp/17n6a1355667428.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/wessaorg/rcomp/tmp/2858k1355667428.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/wessaorg/rcomp/tmp/3etnd1355667428.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/wessaorg/rcomp/tmp/4dyw61355667428.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/wessaorg/rcomp/tmp/57qpw1355667428.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 = 60
Frequency = 1
1 2 3 4 5 6
-0.428954050 -0.164044108 -0.207068509 -0.257834136 -0.505803486 -0.742084549
7 8 9 10 11 12
-0.716096435 -0.668464353 -0.742096015 -0.316473058 -0.339292425 -0.189716233
13 14 15 16 17 18
-0.316685050 -0.527673885 -0.139197937 -0.215813921 -0.022521030 -0.018657062
19 20 21 22 23 24
-0.118059355 -0.276031914 -0.104324322 0.081020630 0.032662047 0.098722084
25 26 27 28 29 30
-0.156899066 0.114097544 0.303226725 0.341369483 0.682911780 0.397026684
31 32 33 34 35 36
0.744138872 0.746198914 0.849821336 0.974841422 0.755234656 0.947165944
37 38 39 40 41 42
0.825174755 0.740968532 0.584728421 0.247294475 0.103035688 -0.161204009
43 44 45 46 47 48
-0.062420011 -0.242280513 -0.006973815 -0.061770327 0.023764855 0.032458368
49 50 51 52 53 54
-0.133551931 -0.207384223 -0.288274598 -0.047851311 -0.074259423 -0.384626776
55 56 57 58 59 60
-0.037438156 -0.078740507 -0.081818592 -0.011104664 -0.310385736 -0.261987723
> postscript(file="/var/wessaorg/rcomp/tmp/6jgmm1355667428.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 = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.428954050 NA
1 -0.164044108 -0.428954050
2 -0.207068509 -0.164044108
3 -0.257834136 -0.207068509
4 -0.505803486 -0.257834136
5 -0.742084549 -0.505803486
6 -0.716096435 -0.742084549
7 -0.668464353 -0.716096435
8 -0.742096015 -0.668464353
9 -0.316473058 -0.742096015
10 -0.339292425 -0.316473058
11 -0.189716233 -0.339292425
12 -0.316685050 -0.189716233
13 -0.527673885 -0.316685050
14 -0.139197937 -0.527673885
15 -0.215813921 -0.139197937
16 -0.022521030 -0.215813921
17 -0.018657062 -0.022521030
18 -0.118059355 -0.018657062
19 -0.276031914 -0.118059355
20 -0.104324322 -0.276031914
21 0.081020630 -0.104324322
22 0.032662047 0.081020630
23 0.098722084 0.032662047
24 -0.156899066 0.098722084
25 0.114097544 -0.156899066
26 0.303226725 0.114097544
27 0.341369483 0.303226725
28 0.682911780 0.341369483
29 0.397026684 0.682911780
30 0.744138872 0.397026684
31 0.746198914 0.744138872
32 0.849821336 0.746198914
33 0.974841422 0.849821336
34 0.755234656 0.974841422
35 0.947165944 0.755234656
36 0.825174755 0.947165944
37 0.740968532 0.825174755
38 0.584728421 0.740968532
39 0.247294475 0.584728421
40 0.103035688 0.247294475
41 -0.161204009 0.103035688
42 -0.062420011 -0.161204009
43 -0.242280513 -0.062420011
44 -0.006973815 -0.242280513
45 -0.061770327 -0.006973815
46 0.023764855 -0.061770327
47 0.032458368 0.023764855
48 -0.133551931 0.032458368
49 -0.207384223 -0.133551931
50 -0.288274598 -0.207384223
51 -0.047851311 -0.288274598
52 -0.074259423 -0.047851311
53 -0.384626776 -0.074259423
54 -0.037438156 -0.384626776
55 -0.078740507 -0.037438156
56 -0.081818592 -0.078740507
57 -0.011104664 -0.081818592
58 -0.310385736 -0.011104664
59 -0.261987723 -0.310385736
60 NA -0.261987723
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.164044108 -0.428954050
[2,] -0.207068509 -0.164044108
[3,] -0.257834136 -0.207068509
[4,] -0.505803486 -0.257834136
[5,] -0.742084549 -0.505803486
[6,] -0.716096435 -0.742084549
[7,] -0.668464353 -0.716096435
[8,] -0.742096015 -0.668464353
[9,] -0.316473058 -0.742096015
[10,] -0.339292425 -0.316473058
[11,] -0.189716233 -0.339292425
[12,] -0.316685050 -0.189716233
[13,] -0.527673885 -0.316685050
[14,] -0.139197937 -0.527673885
[15,] -0.215813921 -0.139197937
[16,] -0.022521030 -0.215813921
[17,] -0.018657062 -0.022521030
[18,] -0.118059355 -0.018657062
[19,] -0.276031914 -0.118059355
[20,] -0.104324322 -0.276031914
[21,] 0.081020630 -0.104324322
[22,] 0.032662047 0.081020630
[23,] 0.098722084 0.032662047
[24,] -0.156899066 0.098722084
[25,] 0.114097544 -0.156899066
[26,] 0.303226725 0.114097544
[27,] 0.341369483 0.303226725
[28,] 0.682911780 0.341369483
[29,] 0.397026684 0.682911780
[30,] 0.744138872 0.397026684
[31,] 0.746198914 0.744138872
[32,] 0.849821336 0.746198914
[33,] 0.974841422 0.849821336
[34,] 0.755234656 0.974841422
[35,] 0.947165944 0.755234656
[36,] 0.825174755 0.947165944
[37,] 0.740968532 0.825174755
[38,] 0.584728421 0.740968532
[39,] 0.247294475 0.584728421
[40,] 0.103035688 0.247294475
[41,] -0.161204009 0.103035688
[42,] -0.062420011 -0.161204009
[43,] -0.242280513 -0.062420011
[44,] -0.006973815 -0.242280513
[45,] -0.061770327 -0.006973815
[46,] 0.023764855 -0.061770327
[47,] 0.032458368 0.023764855
[48,] -0.133551931 0.032458368
[49,] -0.207384223 -0.133551931
[50,] -0.288274598 -0.207384223
[51,] -0.047851311 -0.288274598
[52,] -0.074259423 -0.047851311
[53,] -0.384626776 -0.074259423
[54,] -0.037438156 -0.384626776
[55,] -0.078740507 -0.037438156
[56,] -0.081818592 -0.078740507
[57,] -0.011104664 -0.081818592
[58,] -0.310385736 -0.011104664
[59,] -0.261987723 -0.310385736
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.164044108 -0.428954050
2 -0.207068509 -0.164044108
3 -0.257834136 -0.207068509
4 -0.505803486 -0.257834136
5 -0.742084549 -0.505803486
6 -0.716096435 -0.742084549
7 -0.668464353 -0.716096435
8 -0.742096015 -0.668464353
9 -0.316473058 -0.742096015
10 -0.339292425 -0.316473058
11 -0.189716233 -0.339292425
12 -0.316685050 -0.189716233
13 -0.527673885 -0.316685050
14 -0.139197937 -0.527673885
15 -0.215813921 -0.139197937
16 -0.022521030 -0.215813921
17 -0.018657062 -0.022521030
18 -0.118059355 -0.018657062
19 -0.276031914 -0.118059355
20 -0.104324322 -0.276031914
21 0.081020630 -0.104324322
22 0.032662047 0.081020630
23 0.098722084 0.032662047
24 -0.156899066 0.098722084
25 0.114097544 -0.156899066
26 0.303226725 0.114097544
27 0.341369483 0.303226725
28 0.682911780 0.341369483
29 0.397026684 0.682911780
30 0.744138872 0.397026684
31 0.746198914 0.744138872
32 0.849821336 0.746198914
33 0.974841422 0.849821336
34 0.755234656 0.974841422
35 0.947165944 0.755234656
36 0.825174755 0.947165944
37 0.740968532 0.825174755
38 0.584728421 0.740968532
39 0.247294475 0.584728421
40 0.103035688 0.247294475
41 -0.161204009 0.103035688
42 -0.062420011 -0.161204009
43 -0.242280513 -0.062420011
44 -0.006973815 -0.242280513
45 -0.061770327 -0.006973815
46 0.023764855 -0.061770327
47 0.032458368 0.023764855
48 -0.133551931 0.032458368
49 -0.207384223 -0.133551931
50 -0.288274598 -0.207384223
51 -0.047851311 -0.288274598
52 -0.074259423 -0.047851311
53 -0.384626776 -0.074259423
54 -0.037438156 -0.384626776
55 -0.078740507 -0.037438156
56 -0.081818592 -0.078740507
57 -0.011104664 -0.081818592
58 -0.310385736 -0.011104664
59 -0.261987723 -0.310385736
> 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/wessaorg/rcomp/tmp/7xdj81355667428.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/wessaorg/rcomp/tmp/8rv4x1355667428.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/wessaorg/rcomp/tmp/9ra8e1355667428.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/wessaorg/rcomp/tmp/107a4h1355667428.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/11ek7v1355667428.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/wessaorg/rcomp/tmp/12ycuz1355667428.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/wessaorg/rcomp/tmp/13743e1355667428.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/wessaorg/rcomp/tmp/14qh2q1355667428.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/wessaorg/rcomp/tmp/1523rp1355667429.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/wessaorg/rcomp/tmp/16qe9b1355667429.tab")
+ }
>
> try(system("convert tmp/17n6a1355667428.ps tmp/17n6a1355667428.png",intern=TRUE))
character(0)
> try(system("convert tmp/2858k1355667428.ps tmp/2858k1355667428.png",intern=TRUE))
character(0)
> try(system("convert tmp/3etnd1355667428.ps tmp/3etnd1355667428.png",intern=TRUE))
character(0)
> try(system("convert tmp/4dyw61355667428.ps tmp/4dyw61355667428.png",intern=TRUE))
character(0)
> try(system("convert tmp/57qpw1355667428.ps tmp/57qpw1355667428.png",intern=TRUE))
character(0)
> try(system("convert tmp/6jgmm1355667428.ps tmp/6jgmm1355667428.png",intern=TRUE))
character(0)
> try(system("convert tmp/7xdj81355667428.ps tmp/7xdj81355667428.png",intern=TRUE))
character(0)
> try(system("convert tmp/8rv4x1355667428.ps tmp/8rv4x1355667428.png",intern=TRUE))
character(0)
> try(system("convert tmp/9ra8e1355667428.ps tmp/9ra8e1355667428.png",intern=TRUE))
character(0)
> try(system("convert tmp/107a4h1355667428.ps tmp/107a4h1355667428.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
7.977 1.196 9.151