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(2.5
+ ,4
+ ,3.5
+ ,0.2
+ ,2.3
+ ,1.4
+ ,0.7
+ ,0.8
+ ,1.4
+ ,0.3
+ ,5.2
+ ,1.2
+ ,0.5
+ ,-1
+ ,2.9
+ ,4.5
+ ,-2.3
+ ,-1.9
+ ,1
+ ,0.4
+ ,-3.7
+ ,-1.5
+ ,-5.5
+ ,5.9
+ ,-3.5
+ ,-0.2
+ ,-7.1
+ ,6.5
+ ,-0.2
+ ,3.4
+ ,-7.9
+ ,12.8
+ ,0.2
+ ,3
+ ,-8.9
+ ,4.2
+ ,-0.1
+ ,4.1
+ ,-7
+ ,-3.3
+ ,-1
+ ,3.4
+ ,-5.6
+ ,-12.5
+ ,-0.9
+ ,3.2
+ ,-7.3
+ ,-16.3
+ ,2.2
+ ,6.1
+ ,-7.5
+ ,-10.5
+ ,1.9
+ ,5.8
+ ,-3.5
+ ,-11.8
+ ,2.4
+ ,6.2
+ ,2.3
+ ,-11.4
+ ,2.3
+ ,5.8
+ ,3.1
+ ,-17.7
+ ,2.3
+ ,5.9
+ ,4.1
+ ,-17.3
+ ,3.8
+ ,6.7
+ ,4.2
+ ,-18.6
+ ,3
+ ,5.9
+ ,6
+ ,-17.9
+ ,2.4
+ ,3.8
+ ,5.5
+ ,-21.4
+ ,0.7
+ ,1.7
+ ,5.1
+ ,-19.4
+ ,1.4
+ ,1.4
+ ,5.6
+ ,-15.5
+ ,2.5
+ ,1.8
+ ,1
+ ,-7.7
+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.7
+ ,-4.9
+ ,4.2
+ ,-13.5
+ ,-12.5
+ ,-10.1
+ ,-3.3
+ ,-18.1
+ ,-14.4
+ ,-13.4
+ ,-6.6
+ ,-18
+ ,-16
+ ,-15.8
+ ,-8
+ ,-15.7)
+ ,dim=c(4
+ ,91)
+ ,dimnames=list(c('IndProd'
+ ,'TotOmzet'
+ ,'Invest'
+ ,'RegWag')
+ ,1:91))
> y <- array(NA,dim=c(4,91),dimnames=list(c('IndProd','TotOmzet','Invest','RegWag'),1:91))
> 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
IndProd TotOmzet Invest RegWag
1 2.5 4.0 3.5 0.2
2 2.3 1.4 0.7 0.8
3 1.4 0.3 5.2 1.2
4 0.5 -1.0 2.9 4.5
5 -2.3 -1.9 1.0 0.4
6 -3.7 -1.5 -5.5 5.9
7 -3.5 -0.2 -7.1 6.5
8 -0.2 3.4 -7.9 12.8
9 0.2 3.0 -8.9 4.2
10 -0.1 4.1 -7.0 -3.3
11 -1.0 3.4 -5.6 -12.5
12 -0.9 3.2 -7.3 -16.3
13 2.2 6.1 -7.5 -10.5
14 1.9 5.8 -3.5 -11.8
15 2.4 6.2 2.3 -11.4
16 2.3 5.8 3.1 -17.7
17 2.3 5.9 4.1 -17.3
18 3.8 6.7 4.2 -18.6
19 3.0 5.9 6.0 -17.9
20 2.4 3.8 5.5 -21.4
21 0.7 1.7 5.1 -19.4
22 1.4 1.4 5.6 -15.5
23 2.5 1.8 1.0 -7.7
24 2.9 3.0 1.6 -0.7
25 3.8 3.6 1.3 -1.6
26 2.9 4.8 1.7 1.4
27 3.0 4.3 -8.6 0.7
28 5.1 4.2 -11.2 9.5
29 3.4 2.9 -12.7 1.4
30 3.8 4.9 -3.1 4.1
31 2.7 7.2 -1.0 6.6
32 4.7 8.7 0.3 18.4
33 4.8 9.1 -2.9 16.9
34 5.5 8.9 -2.3 9.2
35 5.1 9.0 3.2 -4.3
36 7.7 11.6 5.9 -5.9
37 5.4 9.6 13.2 -7.7
38 4.8 9.1 7.2 -5.4
39 4.7 9.2 6.9 -2.3
40 5.3 10.8 8.2 -4.8
41 7.5 11.0 11.8 2.3
42 5.7 8.5 9.3 -5.2
43 3.6 6.5 5.8 -10.0
44 2.8 7.2 8.8 -17.1
45 3.4 7.8 14.6 -14.4
46 3.8 8.7 28.2 -3.9
47 1.5 7.8 19.8 3.7
48 0.3 7.5 16.5 6.5
49 0.4 7.7 -5.3 0.9
50 0.3 7.5 -2.4 -4.1
51 1.2 8.3 1.9 -7.0
52 0.9 7.9 1.6 -12.2
53 2.8 10.4 -0.1 -2.5
54 2.9 11.5 -2.0 4.4
55 4.9 14.0 3.4 13.7
56 2.3 11.9 3.3 12.3
57 4.0 11.9 3.3 13.4
58 2.3 10.3 -9.8 2.2
59 5.0 11.3 -4.6 1.7
60 2.6 9.9 -6.1 -7.2
61 1.7 8.9 10.6 -4.8
62 4.3 9.2 8.9 -2.9
63 4.0 8.8 10.7 -2.4
64 3.8 6.7 11.7 -2.5
65 2.5 7.1 13.5 -5.3
66 3.2 6.6 14.6 -7.1
67 4.0 7.2 14.1 -8.0
68 4.1 5.0 11.1 -8.9
69 3.3 5.3 9.2 -7.7
70 4.3 6.3 13.0 -1.1
71 5.8 8.0 14.4 4.0
72 8.1 7.6 16.5 9.6
73 6.8 7.0 11.7 10.9
74 5.3 6.9 11.8 13.0
75 4.8 6.8 10.4 14.9
76 5.5 7.5 12.2 20.1
77 5.2 6.4 14.7 10.8
78 6.0 8.0 15.0 11.0
79 4.0 6.4 10.3 3.8
80 6.2 9.6 11.9 10.8
81 3.7 7.5 13.1 7.6
82 5.2 9.0 15.5 10.2
83 2.7 7.8 10.3 2.2
84 0.8 7.8 5.2 -0.1
85 2.9 8.7 5.4 -1.7
86 0.2 4.3 4.3 -4.8
87 -2.6 -0.4 6.6 -9.9
88 -6.7 -4.9 4.2 -13.5
89 -12.5 -10.1 -3.3 -18.1
90 -14.4 -13.4 -6.6 -18.0
91 -16.0 -15.8 -8.0 -15.7
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) TotOmzet Invest RegWag
-1.48359 0.61854 0.07302 0.04593
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-4.383 -1.211 0.285 1.215 4.367
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.48359 0.34515 -4.298 4.47e-05 ***
TotOmzet 0.61854 0.04822 12.828 < 2e-16 ***
Invest 0.07302 0.02735 2.670 0.00904 **
RegWag 0.04593 0.02241 2.049 0.04343 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.961 on 87 degrees of freedom
Multiple R-squared: 0.7659, Adjusted R-squared: 0.7578
F-statistic: 94.86 on 3 and 87 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.2486581683 0.4973163366 0.7513418317
[2,] 0.1230831243 0.2461662486 0.8769168757
[3,] 0.1039282499 0.2078564999 0.8960717501
[4,] 0.0562380971 0.1124761941 0.9437619029
[5,] 0.0279372651 0.0558745302 0.9720627349
[6,] 0.0141618573 0.0283237145 0.9858381427
[7,] 0.0085651350 0.0171302700 0.9914348650
[8,] 0.0040758141 0.0081516281 0.9959241859
[9,] 0.0061609148 0.0123218297 0.9938390852
[10,] 0.0038748667 0.0077497335 0.9961251333
[11,] 0.0025072301 0.0050144602 0.9974927699
[12,] 0.0011882963 0.0023765926 0.9988117037
[13,] 0.0006019582 0.0012039164 0.9993980418
[14,] 0.0003470925 0.0006941849 0.9996529075
[15,] 0.0001645016 0.0003290032 0.9998354984
[16,] 0.0001042579 0.0002085159 0.9998957421
[17,] 0.0004622239 0.0009244477 0.9995377761
[18,] 0.0004516025 0.0009032049 0.9995483975
[19,] 0.0008374219 0.0016748438 0.9991625781
[20,] 0.0004667781 0.0009335561 0.9995332219
[21,] 0.0025178643 0.0050357287 0.9974821357
[22,] 0.0580140590 0.1160281179 0.9419859410
[23,] 0.2662258932 0.5324517864 0.7337741068
[24,] 0.2879002482 0.5758004963 0.7120997518
[25,] 0.3246773870 0.6493547740 0.6753226130
[26,] 0.3030837756 0.6061675511 0.6969162244
[27,] 0.2666453696 0.5332907392 0.7333546304
[28,] 0.2618623950 0.5237247900 0.7381376050
[29,] 0.2358211931 0.4716423862 0.7641788069
[30,] 0.2355372962 0.4710745925 0.7644627038
[31,] 0.2049409175 0.4098818350 0.7950590825
[32,] 0.1762529343 0.3525058686 0.8237470657
[33,] 0.1503989124 0.3007978249 0.8496010876
[34,] 0.1276469683 0.2552939365 0.8723530317
[35,] 0.1092173666 0.2184347333 0.8907826334
[36,] 0.1038644397 0.2077288795 0.8961355603
[37,] 0.1007145682 0.2014291364 0.8992854318
[38,] 0.0910726225 0.1821452450 0.9089273775
[39,] 0.0796393075 0.1592786150 0.9203606925
[40,] 0.1354089724 0.2708179447 0.8645910276
[41,] 0.3737091804 0.7474183609 0.6262908196
[42,] 0.8325550892 0.3348898217 0.1674449108
[43,] 0.8793159328 0.2413681344 0.1206840672
[44,] 0.9021768220 0.1956463560 0.0978231780
[45,] 0.9071028028 0.1857943944 0.0928971972
[46,] 0.9066181129 0.1867637742 0.0933818871
[47,] 0.8928315837 0.2143368326 0.1071684163
[48,] 0.8845265418 0.2309469163 0.1154734582
[49,] 0.8986734473 0.2026531055 0.1013265527
[50,] 0.9737109016 0.0525781968 0.0262890984
[51,] 0.9843062556 0.0313874889 0.0156937444
[52,] 0.9781155674 0.0437688651 0.0218844326
[53,] 0.9777830705 0.0444338589 0.0222169295
[54,] 0.9895133724 0.0209732553 0.0104866276
[55,] 0.9957981365 0.0084037269 0.0042018635
[56,] 0.9932066518 0.0135866964 0.0067933482
[57,] 0.9890282649 0.0219434703 0.0109717351
[58,] 0.9829206617 0.0341586766 0.0170793383
[59,] 0.9855850750 0.0288298499 0.0144149250
[60,] 0.9834620194 0.0330759612 0.0165379806
[61,] 0.9769671513 0.0460656974 0.0230328487
[62,] 0.9844038479 0.0311923043 0.0155961521
[63,] 0.9905815466 0.0188369068 0.0094184534
[64,] 0.9865497874 0.0269004251 0.0134502126
[65,] 0.9802723341 0.0394553318 0.0197276659
[66,] 0.9931582700 0.0136834599 0.0068417300
[67,] 0.9991663476 0.0016673048 0.0008336524
[68,] 0.9986639016 0.0026721967 0.0013360984
[69,] 0.9974604186 0.0050791627 0.0025395814
[70,] 0.9943165796 0.0113668409 0.0056834204
[71,] 0.9901958575 0.0196082850 0.0098041425
[72,] 0.9833510782 0.0332978436 0.0166489218
[73,] 0.9884595565 0.0230808869 0.0115404435
[74,] 0.9912978360 0.0174043280 0.0087021640
[75,] 0.9776084484 0.0447831031 0.0223915516
[76,] 0.9460717298 0.1078565403 0.0539282702
[77,] 0.8957801674 0.2084396653 0.1042198326
[78,] 0.9848774231 0.0302451538 0.0151225769
> postscript(file="/var/fisher/rcomp/tmp/1zvx21352140112.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/fisher/rcomp/tmp/2n4tf1352140112.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/fisher/rcomp/tmp/3a4y81352140112.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/fisher/rcomp/tmp/48no61352140112.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/fisher/rcomp/tmp/5wr5d1352140112.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 = 91
Frequency = 1
1 2 3 4 5 6
1.24466495 2.82977364 2.26319536 2.18368194 0.26742034 -1.15796157
7 8 9 10 11 12
-1.67278530 -0.83046559 0.28496455 -0.48970213 -0.63640604 -0.11402882
13 14 15 16 17 18
0.94042007 0.59360081 0.40428365 0.78263624 0.62938821 1.68696212
19 20 21 22 23 24
1.21820336 2.11440082 1.65068498 2.32061158 3.15084990 2.44328363
25 26 27 28 29 30
3.03540274 1.22615807 2.41970847 4.36724280 3.95290537 2.29080217
31 32 33 34 35 36
-0.50000971 -0.06471415 0.09043526 1.22398534 0.98055390 1.84867672
37 38 39 40 41 42
0.33536627 0.37713282 0.09480474 -0.27496492 1.21234881 1.48572402
43 44 45 46 47 48
1.09884254 -0.02710445 -0.34576695 -1.97781398 -3.45680309 -4.35886944
49 50 51 52 53 54
-2.53348674 -2.49189708 -2.26753008 -2.05937514 -2.02710101 -2.78566455
55 56 57 58 59 60
-3.15347722 -4.38294018 -2.73346240 -1.97279810 -0.24808945 -1.26382947
61 62 63 64 65 66
-2.87499268 -0.42368234 -0.63067120 0.39983320 -1.15042095 -0.13880284
67 68 69 70 71 72
0.36792073 2.08911186 1.18717716 0.98801914 1.10003070 3.23689578
73 74 75 76 77 78
2.59881882 1.05691908 0.63373868 0.53048829 1.15546871 0.93471231
79 80 81 82 83 84
0.59827194 0.38060353 -0.76111575 -0.48359533 -1.49419708 -2.91614586
85 86 87 88 89 90
-1.31394939 -1.06966846 -0.89624291 -1.87221433 -3.69686467 -3.31930224
91
-3.43821256
> postscript(file="/var/fisher/rcomp/tmp/6e3zg1352140112.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 = 91
Frequency = 1
lag(myerror, k = 1) myerror
0 1.24466495 NA
1 2.82977364 1.24466495
2 2.26319536 2.82977364
3 2.18368194 2.26319536
4 0.26742034 2.18368194
5 -1.15796157 0.26742034
6 -1.67278530 -1.15796157
7 -0.83046559 -1.67278530
8 0.28496455 -0.83046559
9 -0.48970213 0.28496455
10 -0.63640604 -0.48970213
11 -0.11402882 -0.63640604
12 0.94042007 -0.11402882
13 0.59360081 0.94042007
14 0.40428365 0.59360081
15 0.78263624 0.40428365
16 0.62938821 0.78263624
17 1.68696212 0.62938821
18 1.21820336 1.68696212
19 2.11440082 1.21820336
20 1.65068498 2.11440082
21 2.32061158 1.65068498
22 3.15084990 2.32061158
23 2.44328363 3.15084990
24 3.03540274 2.44328363
25 1.22615807 3.03540274
26 2.41970847 1.22615807
27 4.36724280 2.41970847
28 3.95290537 4.36724280
29 2.29080217 3.95290537
30 -0.50000971 2.29080217
31 -0.06471415 -0.50000971
32 0.09043526 -0.06471415
33 1.22398534 0.09043526
34 0.98055390 1.22398534
35 1.84867672 0.98055390
36 0.33536627 1.84867672
37 0.37713282 0.33536627
38 0.09480474 0.37713282
39 -0.27496492 0.09480474
40 1.21234881 -0.27496492
41 1.48572402 1.21234881
42 1.09884254 1.48572402
43 -0.02710445 1.09884254
44 -0.34576695 -0.02710445
45 -1.97781398 -0.34576695
46 -3.45680309 -1.97781398
47 -4.35886944 -3.45680309
48 -2.53348674 -4.35886944
49 -2.49189708 -2.53348674
50 -2.26753008 -2.49189708
51 -2.05937514 -2.26753008
52 -2.02710101 -2.05937514
53 -2.78566455 -2.02710101
54 -3.15347722 -2.78566455
55 -4.38294018 -3.15347722
56 -2.73346240 -4.38294018
57 -1.97279810 -2.73346240
58 -0.24808945 -1.97279810
59 -1.26382947 -0.24808945
60 -2.87499268 -1.26382947
61 -0.42368234 -2.87499268
62 -0.63067120 -0.42368234
63 0.39983320 -0.63067120
64 -1.15042095 0.39983320
65 -0.13880284 -1.15042095
66 0.36792073 -0.13880284
67 2.08911186 0.36792073
68 1.18717716 2.08911186
69 0.98801914 1.18717716
70 1.10003070 0.98801914
71 3.23689578 1.10003070
72 2.59881882 3.23689578
73 1.05691908 2.59881882
74 0.63373868 1.05691908
75 0.53048829 0.63373868
76 1.15546871 0.53048829
77 0.93471231 1.15546871
78 0.59827194 0.93471231
79 0.38060353 0.59827194
80 -0.76111575 0.38060353
81 -0.48359533 -0.76111575
82 -1.49419708 -0.48359533
83 -2.91614586 -1.49419708
84 -1.31394939 -2.91614586
85 -1.06966846 -1.31394939
86 -0.89624291 -1.06966846
87 -1.87221433 -0.89624291
88 -3.69686467 -1.87221433
89 -3.31930224 -3.69686467
90 -3.43821256 -3.31930224
91 NA -3.43821256
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.82977364 1.24466495
[2,] 2.26319536 2.82977364
[3,] 2.18368194 2.26319536
[4,] 0.26742034 2.18368194
[5,] -1.15796157 0.26742034
[6,] -1.67278530 -1.15796157
[7,] -0.83046559 -1.67278530
[8,] 0.28496455 -0.83046559
[9,] -0.48970213 0.28496455
[10,] -0.63640604 -0.48970213
[11,] -0.11402882 -0.63640604
[12,] 0.94042007 -0.11402882
[13,] 0.59360081 0.94042007
[14,] 0.40428365 0.59360081
[15,] 0.78263624 0.40428365
[16,] 0.62938821 0.78263624
[17,] 1.68696212 0.62938821
[18,] 1.21820336 1.68696212
[19,] 2.11440082 1.21820336
[20,] 1.65068498 2.11440082
[21,] 2.32061158 1.65068498
[22,] 3.15084990 2.32061158
[23,] 2.44328363 3.15084990
[24,] 3.03540274 2.44328363
[25,] 1.22615807 3.03540274
[26,] 2.41970847 1.22615807
[27,] 4.36724280 2.41970847
[28,] 3.95290537 4.36724280
[29,] 2.29080217 3.95290537
[30,] -0.50000971 2.29080217
[31,] -0.06471415 -0.50000971
[32,] 0.09043526 -0.06471415
[33,] 1.22398534 0.09043526
[34,] 0.98055390 1.22398534
[35,] 1.84867672 0.98055390
[36,] 0.33536627 1.84867672
[37,] 0.37713282 0.33536627
[38,] 0.09480474 0.37713282
[39,] -0.27496492 0.09480474
[40,] 1.21234881 -0.27496492
[41,] 1.48572402 1.21234881
[42,] 1.09884254 1.48572402
[43,] -0.02710445 1.09884254
[44,] -0.34576695 -0.02710445
[45,] -1.97781398 -0.34576695
[46,] -3.45680309 -1.97781398
[47,] -4.35886944 -3.45680309
[48,] -2.53348674 -4.35886944
[49,] -2.49189708 -2.53348674
[50,] -2.26753008 -2.49189708
[51,] -2.05937514 -2.26753008
[52,] -2.02710101 -2.05937514
[53,] -2.78566455 -2.02710101
[54,] -3.15347722 -2.78566455
[55,] -4.38294018 -3.15347722
[56,] -2.73346240 -4.38294018
[57,] -1.97279810 -2.73346240
[58,] -0.24808945 -1.97279810
[59,] -1.26382947 -0.24808945
[60,] -2.87499268 -1.26382947
[61,] -0.42368234 -2.87499268
[62,] -0.63067120 -0.42368234
[63,] 0.39983320 -0.63067120
[64,] -1.15042095 0.39983320
[65,] -0.13880284 -1.15042095
[66,] 0.36792073 -0.13880284
[67,] 2.08911186 0.36792073
[68,] 1.18717716 2.08911186
[69,] 0.98801914 1.18717716
[70,] 1.10003070 0.98801914
[71,] 3.23689578 1.10003070
[72,] 2.59881882 3.23689578
[73,] 1.05691908 2.59881882
[74,] 0.63373868 1.05691908
[75,] 0.53048829 0.63373868
[76,] 1.15546871 0.53048829
[77,] 0.93471231 1.15546871
[78,] 0.59827194 0.93471231
[79,] 0.38060353 0.59827194
[80,] -0.76111575 0.38060353
[81,] -0.48359533 -0.76111575
[82,] -1.49419708 -0.48359533
[83,] -2.91614586 -1.49419708
[84,] -1.31394939 -2.91614586
[85,] -1.06966846 -1.31394939
[86,] -0.89624291 -1.06966846
[87,] -1.87221433 -0.89624291
[88,] -3.69686467 -1.87221433
[89,] -3.31930224 -3.69686467
[90,] -3.43821256 -3.31930224
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.82977364 1.24466495
2 2.26319536 2.82977364
3 2.18368194 2.26319536
4 0.26742034 2.18368194
5 -1.15796157 0.26742034
6 -1.67278530 -1.15796157
7 -0.83046559 -1.67278530
8 0.28496455 -0.83046559
9 -0.48970213 0.28496455
10 -0.63640604 -0.48970213
11 -0.11402882 -0.63640604
12 0.94042007 -0.11402882
13 0.59360081 0.94042007
14 0.40428365 0.59360081
15 0.78263624 0.40428365
16 0.62938821 0.78263624
17 1.68696212 0.62938821
18 1.21820336 1.68696212
19 2.11440082 1.21820336
20 1.65068498 2.11440082
21 2.32061158 1.65068498
22 3.15084990 2.32061158
23 2.44328363 3.15084990
24 3.03540274 2.44328363
25 1.22615807 3.03540274
26 2.41970847 1.22615807
27 4.36724280 2.41970847
28 3.95290537 4.36724280
29 2.29080217 3.95290537
30 -0.50000971 2.29080217
31 -0.06471415 -0.50000971
32 0.09043526 -0.06471415
33 1.22398534 0.09043526
34 0.98055390 1.22398534
35 1.84867672 0.98055390
36 0.33536627 1.84867672
37 0.37713282 0.33536627
38 0.09480474 0.37713282
39 -0.27496492 0.09480474
40 1.21234881 -0.27496492
41 1.48572402 1.21234881
42 1.09884254 1.48572402
43 -0.02710445 1.09884254
44 -0.34576695 -0.02710445
45 -1.97781398 -0.34576695
46 -3.45680309 -1.97781398
47 -4.35886944 -3.45680309
48 -2.53348674 -4.35886944
49 -2.49189708 -2.53348674
50 -2.26753008 -2.49189708
51 -2.05937514 -2.26753008
52 -2.02710101 -2.05937514
53 -2.78566455 -2.02710101
54 -3.15347722 -2.78566455
55 -4.38294018 -3.15347722
56 -2.73346240 -4.38294018
57 -1.97279810 -2.73346240
58 -0.24808945 -1.97279810
59 -1.26382947 -0.24808945
60 -2.87499268 -1.26382947
61 -0.42368234 -2.87499268
62 -0.63067120 -0.42368234
63 0.39983320 -0.63067120
64 -1.15042095 0.39983320
65 -0.13880284 -1.15042095
66 0.36792073 -0.13880284
67 2.08911186 0.36792073
68 1.18717716 2.08911186
69 0.98801914 1.18717716
70 1.10003070 0.98801914
71 3.23689578 1.10003070
72 2.59881882 3.23689578
73 1.05691908 2.59881882
74 0.63373868 1.05691908
75 0.53048829 0.63373868
76 1.15546871 0.53048829
77 0.93471231 1.15546871
78 0.59827194 0.93471231
79 0.38060353 0.59827194
80 -0.76111575 0.38060353
81 -0.48359533 -0.76111575
82 -1.49419708 -0.48359533
83 -2.91614586 -1.49419708
84 -1.31394939 -2.91614586
85 -1.06966846 -1.31394939
86 -0.89624291 -1.06966846
87 -1.87221433 -0.89624291
88 -3.69686467 -1.87221433
89 -3.31930224 -3.69686467
90 -3.43821256 -3.31930224
> 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/fisher/rcomp/tmp/7o5fv1352140112.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/fisher/rcomp/tmp/8j7kz1352140112.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/fisher/rcomp/tmp/91ef41352140112.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/fisher/rcomp/tmp/10o9z41352140113.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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/fisher/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/fisher/rcomp/tmp/11ll5q1352140113.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/fisher/rcomp/tmp/122nx51352140113.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/fisher/rcomp/tmp/139hsa1352140113.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/fisher/rcomp/tmp/14r0oc1352140113.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/fisher/rcomp/tmp/154s2d1352140113.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/fisher/rcomp/tmp/16eat01352140113.tab")
+ }
>
> try(system("convert tmp/1zvx21352140112.ps tmp/1zvx21352140112.png",intern=TRUE))
character(0)
> try(system("convert tmp/2n4tf1352140112.ps tmp/2n4tf1352140112.png",intern=TRUE))
character(0)
> try(system("convert tmp/3a4y81352140112.ps tmp/3a4y81352140112.png",intern=TRUE))
character(0)
> try(system("convert tmp/48no61352140112.ps tmp/48no61352140112.png",intern=TRUE))
character(0)
> try(system("convert tmp/5wr5d1352140112.ps tmp/5wr5d1352140112.png",intern=TRUE))
character(0)
> try(system("convert tmp/6e3zg1352140112.ps tmp/6e3zg1352140112.png",intern=TRUE))
character(0)
> try(system("convert tmp/7o5fv1352140112.ps tmp/7o5fv1352140112.png",intern=TRUE))
character(0)
> try(system("convert tmp/8j7kz1352140112.ps tmp/8j7kz1352140112.png",intern=TRUE))
character(0)
> try(system("convert tmp/91ef41352140112.ps tmp/91ef41352140112.png",intern=TRUE))
character(0)
> try(system("convert tmp/10o9z41352140113.ps tmp/10o9z41352140113.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
6.362 1.111 7.468