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(577992,0,565464,0,547344,0,554788,0,562325,0,560854,0,555332,1,543599,1,536662,1,542722,1,593530,1,610763,1,612613,1,611324,1,594167,1,595454,1,590865,1,589379,1,584428,1,573100,1,567456,1,569028,1,620735,1,628884,1,628232,1,612117,1,595404,1,597141,1,593408,1,590072,1,579799,1,574205,1,572775,1,572942,1,619567,1,625809,1,619916,1,587625,1,565742,1,557274,1,560576,1,548854,1,531673,1,525919,1,511038,1,498662,1,555362,1,564591,1,541657,1,527070,1,509846,1,514258,1,516922,1,507561,1,492622,1,490243,1,469357,1,477580,1,528379,1,533590,1,517945,1),dim=c(2,61),dimnames=list(c('Werkloosheid','Aanslag'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('Werkloosheid','Aanslag'),1:61))
> 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
Werkloosheid Aanslag M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 577992 0 1 0 0 0 0 0 0 0 0 0 0 1
2 565464 0 0 1 0 0 0 0 0 0 0 0 0 2
3 547344 0 0 0 1 0 0 0 0 0 0 0 0 3
4 554788 0 0 0 0 1 0 0 0 0 0 0 0 4
5 562325 0 0 0 0 0 1 0 0 0 0 0 0 5
6 560854 0 0 0 0 0 0 1 0 0 0 0 0 6
7 555332 1 0 0 0 0 0 0 1 0 0 0 0 7
8 543599 1 0 0 0 0 0 0 0 1 0 0 0 8
9 536662 1 0 0 0 0 0 0 0 0 1 0 0 9
10 542722 1 0 0 0 0 0 0 0 0 0 1 0 10
11 593530 1 0 0 0 0 0 0 0 0 0 0 1 11
12 610763 1 0 0 0 0 0 0 0 0 0 0 0 12
13 612613 1 1 0 0 0 0 0 0 0 0 0 0 13
14 611324 1 0 1 0 0 0 0 0 0 0 0 0 14
15 594167 1 0 0 1 0 0 0 0 0 0 0 0 15
16 595454 1 0 0 0 1 0 0 0 0 0 0 0 16
17 590865 1 0 0 0 0 1 0 0 0 0 0 0 17
18 589379 1 0 0 0 0 0 1 0 0 0 0 0 18
19 584428 1 0 0 0 0 0 0 1 0 0 0 0 19
20 573100 1 0 0 0 0 0 0 0 1 0 0 0 20
21 567456 1 0 0 0 0 0 0 0 0 1 0 0 21
22 569028 1 0 0 0 0 0 0 0 0 0 1 0 22
23 620735 1 0 0 0 0 0 0 0 0 0 0 1 23
24 628884 1 0 0 0 0 0 0 0 0 0 0 0 24
25 628232 1 1 0 0 0 0 0 0 0 0 0 0 25
26 612117 1 0 1 0 0 0 0 0 0 0 0 0 26
27 595404 1 0 0 1 0 0 0 0 0 0 0 0 27
28 597141 1 0 0 0 1 0 0 0 0 0 0 0 28
29 593408 1 0 0 0 0 1 0 0 0 0 0 0 29
30 590072 1 0 0 0 0 0 1 0 0 0 0 0 30
31 579799 1 0 0 0 0 0 0 1 0 0 0 0 31
32 574205 1 0 0 0 0 0 0 0 1 0 0 0 32
33 572775 1 0 0 0 0 0 0 0 0 1 0 0 33
34 572942 1 0 0 0 0 0 0 0 0 0 1 0 34
35 619567 1 0 0 0 0 0 0 0 0 0 0 1 35
36 625809 1 0 0 0 0 0 0 0 0 0 0 0 36
37 619916 1 1 0 0 0 0 0 0 0 0 0 0 37
38 587625 1 0 1 0 0 0 0 0 0 0 0 0 38
39 565742 1 0 0 1 0 0 0 0 0 0 0 0 39
40 557274 1 0 0 0 1 0 0 0 0 0 0 0 40
41 560576 1 0 0 0 0 1 0 0 0 0 0 0 41
42 548854 1 0 0 0 0 0 1 0 0 0 0 0 42
43 531673 1 0 0 0 0 0 0 1 0 0 0 0 43
44 525919 1 0 0 0 0 0 0 0 1 0 0 0 44
45 511038 1 0 0 0 0 0 0 0 0 1 0 0 45
46 498662 1 0 0 0 0 0 0 0 0 0 1 0 46
47 555362 1 0 0 0 0 0 0 0 0 0 0 1 47
48 564591 1 0 0 0 0 0 0 0 0 0 0 0 48
49 541657 1 1 0 0 0 0 0 0 0 0 0 0 49
50 527070 1 0 1 0 0 0 0 0 0 0 0 0 50
51 509846 1 0 0 1 0 0 0 0 0 0 0 0 51
52 514258 1 0 0 0 1 0 0 0 0 0 0 0 52
53 516922 1 0 0 0 0 1 0 0 0 0 0 0 53
54 507561 1 0 0 0 0 0 1 0 0 0 0 0 54
55 492622 1 0 0 0 0 0 0 1 0 0 0 0 55
56 490243 1 0 0 0 0 0 0 0 1 0 0 0 56
57 469357 1 0 0 0 0 0 0 0 0 1 0 0 57
58 477580 1 0 0 0 0 0 0 0 0 0 1 0 58
59 528379 1 0 0 0 0 0 0 0 0 0 0 1 59
60 533590 1 0 0 0 0 0 0 0 0 0 0 0 60
61 517945 1 1 0 0 0 0 0 0 0 0 0 0 61
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Aanslag M1 M2 M3 M4
592486 66679 -7782 -17127 -33500 -30373
M5 M6 M7 M8 M9 M10
-27491 -31121 -53184 -58696 -66806 -64232
M11 t
-11058 -1846
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-42106 -14778 -3811 14695 41317
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 592486.0 14835.4 39.937 < 2e-16 ***
Aanslag 66679.5 12217.3 5.458 1.76e-06 ***
M1 -7782.5 14161.6 -0.550 0.585231
M2 -17126.5 14846.8 -1.154 0.254518
M3 -33500.4 14838.1 -2.258 0.028648 *
M4 -30372.5 14832.0 -2.048 0.046194 *
M5 -27490.8 14828.6 -1.854 0.070034 .
M6 -31120.5 14827.8 -2.099 0.041234 *
M7 -53184.1 14710.1 -3.615 0.000729 ***
M8 -58696.2 14698.1 -3.993 0.000227 ***
M9 -66806.3 14688.7 -4.548 3.81e-05 ***
M10 -64231.6 14682.1 -4.375 6.71e-05 ***
M11 -11058.3 14678.0 -0.753 0.454973
t -1845.5 198.2 -9.310 3.05e-12 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 23210 on 47 degrees of freedom
Multiple R-squared: 0.7365, Adjusted R-squared: 0.6636
F-statistic: 10.1 on 13 and 47 DF, p-value: 1.205e-09
> 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.088428918 0.176857836 0.91157108
[2,] 0.063891073 0.127782146 0.93610893
[3,] 0.026934168 0.053868337 0.97306583
[4,] 0.013438851 0.026877702 0.98656115
[5,] 0.006645250 0.013290499 0.99335475
[6,] 0.003815021 0.007630042 0.99618498
[7,] 0.002622440 0.005244880 0.99737756
[8,] 0.006550999 0.013101999 0.99344900
[9,] 0.016397331 0.032794662 0.98360267
[10,] 0.064798955 0.129597910 0.93520104
[11,] 0.090132438 0.180264877 0.90986756
[12,] 0.111376614 0.222753228 0.88862339
[13,] 0.186731069 0.373462138 0.81326893
[14,] 0.232785570 0.465571140 0.76721443
[15,] 0.204427326 0.408854653 0.79557267
[16,] 0.148873571 0.297747142 0.85112643
[17,] 0.117750525 0.235501050 0.88224947
[18,] 0.110074099 0.220148198 0.88992590
[19,] 0.090405181 0.180810362 0.90959482
[20,] 0.091202968 0.182405935 0.90879703
[21,] 0.371689550 0.743379100 0.62831045
[22,] 0.816869590 0.366260819 0.18313041
[23,] 0.963583157 0.072833685 0.03641684
[24,] 0.979415989 0.041168022 0.02058401
[25,] 0.982258117 0.035483766 0.01774188
[26,] 0.981562738 0.036874524 0.01843726
[27,] 0.971869623 0.056260754 0.02813038
[28,] 0.935924515 0.128150970 0.06407549
> postscript(file="/var/www/html/freestat/rcomp/tmp/18dld1227561789.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/2scqq1227561789.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/38r6b1227561789.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/4z39z1227561789.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/5hjy61227561789.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 = 61
Frequency = 1
1 2 3 4 5 6
-4865.9710 -6204.4458 -6105.0458 56.5542 6557.3542 10561.5542
7 8 9 10 11 12
-37730.8319 -42106.2319 -39087.6319 -33756.8319 -34276.6319 -26256.4319
13 14 15 16 17 18
-14778.4377 -4877.9125 -3815.5125 -3810.9125 -9436.1125 -5446.9125
19 20 21 22 23 24
13511.1841 9540.7841 13852.3841 14695.1841 15074.3841 14010.5841
25 26 27 28 29 30
22986.5783 18061.1035 19567.5035 20022.1035 15252.9035 17392.1035
31 32 33 34 35 36
31028.2000 32791.8000 41317.4000 40755.2000 36052.4000 33081.6000
37 38 39 40 41 42
36816.5942 15715.1194 12051.5194 2301.1194 4566.9194 -1679.8806
43 44 45 46 47 48
5048.2159 6651.8159 1726.4159 -11378.7841 -6006.5841 -5990.3841
49 50 51 52 53 54
-19296.3899 -22693.8646 -21698.4646 -18568.8646 -16941.0646 -20826.8646
55 56 57 58 59 60
-11856.7681 -6878.1681 -17808.5681 -10314.7681 -10843.5681 -14845.3681
61
-20862.3739
> postscript(file="/var/www/html/freestat/rcomp/tmp/6xopr1227561789.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 = 61
Frequency = 1
lag(myerror, k = 1) myerror
0 -4865.9710 NA
1 -6204.4458 -4865.9710
2 -6105.0458 -6204.4458
3 56.5542 -6105.0458
4 6557.3542 56.5542
5 10561.5542 6557.3542
6 -37730.8319 10561.5542
7 -42106.2319 -37730.8319
8 -39087.6319 -42106.2319
9 -33756.8319 -39087.6319
10 -34276.6319 -33756.8319
11 -26256.4319 -34276.6319
12 -14778.4377 -26256.4319
13 -4877.9125 -14778.4377
14 -3815.5125 -4877.9125
15 -3810.9125 -3815.5125
16 -9436.1125 -3810.9125
17 -5446.9125 -9436.1125
18 13511.1841 -5446.9125
19 9540.7841 13511.1841
20 13852.3841 9540.7841
21 14695.1841 13852.3841
22 15074.3841 14695.1841
23 14010.5841 15074.3841
24 22986.5783 14010.5841
25 18061.1035 22986.5783
26 19567.5035 18061.1035
27 20022.1035 19567.5035
28 15252.9035 20022.1035
29 17392.1035 15252.9035
30 31028.2000 17392.1035
31 32791.8000 31028.2000
32 41317.4000 32791.8000
33 40755.2000 41317.4000
34 36052.4000 40755.2000
35 33081.6000 36052.4000
36 36816.5942 33081.6000
37 15715.1194 36816.5942
38 12051.5194 15715.1194
39 2301.1194 12051.5194
40 4566.9194 2301.1194
41 -1679.8806 4566.9194
42 5048.2159 -1679.8806
43 6651.8159 5048.2159
44 1726.4159 6651.8159
45 -11378.7841 1726.4159
46 -6006.5841 -11378.7841
47 -5990.3841 -6006.5841
48 -19296.3899 -5990.3841
49 -22693.8646 -19296.3899
50 -21698.4646 -22693.8646
51 -18568.8646 -21698.4646
52 -16941.0646 -18568.8646
53 -20826.8646 -16941.0646
54 -11856.7681 -20826.8646
55 -6878.1681 -11856.7681
56 -17808.5681 -6878.1681
57 -10314.7681 -17808.5681
58 -10843.5681 -10314.7681
59 -14845.3681 -10843.5681
60 -20862.3739 -14845.3681
61 NA -20862.3739
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -6204.4458 -4865.9710
[2,] -6105.0458 -6204.4458
[3,] 56.5542 -6105.0458
[4,] 6557.3542 56.5542
[5,] 10561.5542 6557.3542
[6,] -37730.8319 10561.5542
[7,] -42106.2319 -37730.8319
[8,] -39087.6319 -42106.2319
[9,] -33756.8319 -39087.6319
[10,] -34276.6319 -33756.8319
[11,] -26256.4319 -34276.6319
[12,] -14778.4377 -26256.4319
[13,] -4877.9125 -14778.4377
[14,] -3815.5125 -4877.9125
[15,] -3810.9125 -3815.5125
[16,] -9436.1125 -3810.9125
[17,] -5446.9125 -9436.1125
[18,] 13511.1841 -5446.9125
[19,] 9540.7841 13511.1841
[20,] 13852.3841 9540.7841
[21,] 14695.1841 13852.3841
[22,] 15074.3841 14695.1841
[23,] 14010.5841 15074.3841
[24,] 22986.5783 14010.5841
[25,] 18061.1035 22986.5783
[26,] 19567.5035 18061.1035
[27,] 20022.1035 19567.5035
[28,] 15252.9035 20022.1035
[29,] 17392.1035 15252.9035
[30,] 31028.2000 17392.1035
[31,] 32791.8000 31028.2000
[32,] 41317.4000 32791.8000
[33,] 40755.2000 41317.4000
[34,] 36052.4000 40755.2000
[35,] 33081.6000 36052.4000
[36,] 36816.5942 33081.6000
[37,] 15715.1194 36816.5942
[38,] 12051.5194 15715.1194
[39,] 2301.1194 12051.5194
[40,] 4566.9194 2301.1194
[41,] -1679.8806 4566.9194
[42,] 5048.2159 -1679.8806
[43,] 6651.8159 5048.2159
[44,] 1726.4159 6651.8159
[45,] -11378.7841 1726.4159
[46,] -6006.5841 -11378.7841
[47,] -5990.3841 -6006.5841
[48,] -19296.3899 -5990.3841
[49,] -22693.8646 -19296.3899
[50,] -21698.4646 -22693.8646
[51,] -18568.8646 -21698.4646
[52,] -16941.0646 -18568.8646
[53,] -20826.8646 -16941.0646
[54,] -11856.7681 -20826.8646
[55,] -6878.1681 -11856.7681
[56,] -17808.5681 -6878.1681
[57,] -10314.7681 -17808.5681
[58,] -10843.5681 -10314.7681
[59,] -14845.3681 -10843.5681
[60,] -20862.3739 -14845.3681
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -6204.4458 -4865.9710
2 -6105.0458 -6204.4458
3 56.5542 -6105.0458
4 6557.3542 56.5542
5 10561.5542 6557.3542
6 -37730.8319 10561.5542
7 -42106.2319 -37730.8319
8 -39087.6319 -42106.2319
9 -33756.8319 -39087.6319
10 -34276.6319 -33756.8319
11 -26256.4319 -34276.6319
12 -14778.4377 -26256.4319
13 -4877.9125 -14778.4377
14 -3815.5125 -4877.9125
15 -3810.9125 -3815.5125
16 -9436.1125 -3810.9125
17 -5446.9125 -9436.1125
18 13511.1841 -5446.9125
19 9540.7841 13511.1841
20 13852.3841 9540.7841
21 14695.1841 13852.3841
22 15074.3841 14695.1841
23 14010.5841 15074.3841
24 22986.5783 14010.5841
25 18061.1035 22986.5783
26 19567.5035 18061.1035
27 20022.1035 19567.5035
28 15252.9035 20022.1035
29 17392.1035 15252.9035
30 31028.2000 17392.1035
31 32791.8000 31028.2000
32 41317.4000 32791.8000
33 40755.2000 41317.4000
34 36052.4000 40755.2000
35 33081.6000 36052.4000
36 36816.5942 33081.6000
37 15715.1194 36816.5942
38 12051.5194 15715.1194
39 2301.1194 12051.5194
40 4566.9194 2301.1194
41 -1679.8806 4566.9194
42 5048.2159 -1679.8806
43 6651.8159 5048.2159
44 1726.4159 6651.8159
45 -11378.7841 1726.4159
46 -6006.5841 -11378.7841
47 -5990.3841 -6006.5841
48 -19296.3899 -5990.3841
49 -22693.8646 -19296.3899
50 -21698.4646 -22693.8646
51 -18568.8646 -21698.4646
52 -16941.0646 -18568.8646
53 -20826.8646 -16941.0646
54 -11856.7681 -20826.8646
55 -6878.1681 -11856.7681
56 -17808.5681 -6878.1681
57 -10314.7681 -17808.5681
58 -10843.5681 -10314.7681
59 -14845.3681 -10843.5681
60 -20862.3739 -14845.3681
> 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/7tbax1227561789.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/80ezb1227561789.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/9ke1s1227561789.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/10ykvh1227561789.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/11ubwy1227561789.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/12vcin1227561789.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/131xu01227561790.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/149sbu1227561790.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/15537t1227561790.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/16b1ax1227561790.tab")
+ }
>
> system("convert tmp/18dld1227561789.ps tmp/18dld1227561789.png")
> system("convert tmp/2scqq1227561789.ps tmp/2scqq1227561789.png")
> system("convert tmp/38r6b1227561789.ps tmp/38r6b1227561789.png")
> system("convert tmp/4z39z1227561789.ps tmp/4z39z1227561789.png")
> system("convert tmp/5hjy61227561789.ps tmp/5hjy61227561789.png")
> system("convert tmp/6xopr1227561789.ps tmp/6xopr1227561789.png")
> system("convert tmp/7tbax1227561789.ps tmp/7tbax1227561789.png")
> system("convert tmp/80ezb1227561789.ps tmp/80ezb1227561789.png")
> system("convert tmp/9ke1s1227561789.ps tmp/9ke1s1227561789.png")
> system("convert tmp/10ykvh1227561789.ps tmp/10ykvh1227561789.png")
>
>
> proc.time()
user system elapsed
3.583 2.448 3.920