R version 2.9.0 (2009-04-17)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> x <- array(list(4.24,3.353,0,4.15,3.186,0,3.93,3.902,0,3.7,4.164,0,3.7,3.499,0,3.65,4.145,0,3.55,3.796,0,3.43,3.711,0,3.47,3.949,0,3.58,3.74,0,3.67,3.243,0,3.72,4.407,0,3.8,4.814,0,3.76,3.908,0,3.63,5.25,0,3.48,3.937,0,3.41,4.004,0,3.43,5.56,0,3.5,3.922,0,3.62,3.759,0,3.58,4.138,0,3.52,4.634,0,3.45,3.996,0,3.36,4.308,0,3.27,4.143,0,3.21,4.429,0,3.19,5.219,0,3.16,4.929,0,3.12,5.761,0,3.06,5.592,0,3.01,4.163,0,2.98,4.962,0,2.97,5.208,0,3.02,4.755,0,3.07,4.491,0,3.18,5.732,0,3.29,5.731,1,3.43,5.04,1,3.61,6.102,1,3.74,4.904,1,3.87,5.369,1,3.88,5.578,1,4.09,4.619,1,4.19,4.731,1,4.2,5.011,1,4.29,5.299,1,4.37,4.146,1,4.47,4.625,1,4.61,4.736,1,4.65,4.219,1,4.69,5.116,1,4.82,4.205,1,4.86,4.121,1,4.87,5.103,1,5.01,4.3,1,5.03,4.578,1,5.13,3.809,1,5.18,5.657,1,5.21,4.248,1,5.26,3.83,1,5.25,4.736,1,5.2,4.839,1,5.16,4.411,1,5.19,4.57,1,5.39,4.104,1,5.58,4.801,1,5.76,3.953,1,5.89,3.828,1,5.98,4.44,1,6.02,4.026,1,5.62,4.109,1,4.87,4.785,1),dim=c(3,72),dimnames=list(c('Rente','Woonhuis','dummy'),1:72))
> y <- array(NA,dim=c(3,72),dimnames=list(c('Rente','Woonhuis','dummy'),1:72))
> 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'
> #'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
Rente Woonhuis dummy
1 4.24 3.353 0
2 4.15 3.186 0
3 3.93 3.902 0
4 3.70 4.164 0
5 3.70 3.499 0
6 3.65 4.145 0
7 3.55 3.796 0
8 3.43 3.711 0
9 3.47 3.949 0
10 3.58 3.740 0
11 3.67 3.243 0
12 3.72 4.407 0
13 3.80 4.814 0
14 3.76 3.908 0
15 3.63 5.250 0
16 3.48 3.937 0
17 3.41 4.004 0
18 3.43 5.560 0
19 3.50 3.922 0
20 3.62 3.759 0
21 3.58 4.138 0
22 3.52 4.634 0
23 3.45 3.996 0
24 3.36 4.308 0
25 3.27 4.143 0
26 3.21 4.429 0
27 3.19 5.219 0
28 3.16 4.929 0
29 3.12 5.761 0
30 3.06 5.592 0
31 3.01 4.163 0
32 2.98 4.962 0
33 2.97 5.208 0
34 3.02 4.755 0
35 3.07 4.491 0
36 3.18 5.732 0
37 3.29 5.731 1
38 3.43 5.040 1
39 3.61 6.102 1
40 3.74 4.904 1
41 3.87 5.369 1
42 3.88 5.578 1
43 4.09 4.619 1
44 4.19 4.731 1
45 4.20 5.011 1
46 4.29 5.299 1
47 4.37 4.146 1
48 4.47 4.625 1
49 4.61 4.736 1
50 4.65 4.219 1
51 4.69 5.116 1
52 4.82 4.205 1
53 4.86 4.121 1
54 4.87 5.103 1
55 5.01 4.300 1
56 5.03 4.578 1
57 5.13 3.809 1
58 5.18 5.657 1
59 5.21 4.248 1
60 5.26 3.830 1
61 5.25 4.736 1
62 5.20 4.839 1
63 5.16 4.411 1
64 5.19 4.570 1
65 5.39 4.104 1
66 5.58 4.801 1
67 5.76 3.953 1
68 5.89 3.828 1
69 5.98 4.440 1
70 6.02 4.026 1
71 5.62 4.109 1
72 4.87 4.785 1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Woonhuis dummy
5.6554 -0.5043 1.4895
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.17336 -0.22910 -0.03449 0.27832 1.07408
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.65536 0.37454 15.100 < 2e-16 ***
Woonhuis -0.50427 0.08425 -5.985 8.66e-08 ***
dummy 1.48949 0.11050 13.480 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.456 on 69 degrees of freedom
Multiple R-squared: 0.7339, Adjusted R-squared: 0.7262
F-statistic: 95.15 on 2 and 69 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,] 1.051844e-01 2.103689e-01 0.8948156
[2,] 8.300670e-02 1.660134e-01 0.9169933
[3,] 1.023059e-01 2.046119e-01 0.8976941
[4,] 6.172865e-02 1.234573e-01 0.9382713
[5,] 3.495161e-02 6.990322e-02 0.9650484
[6,] 2.793042e-02 5.586085e-02 0.9720696
[7,] 1.776041e-02 3.552082e-02 0.9822396
[8,] 1.472709e-02 2.945418e-02 0.9852729
[9,] 6.933469e-03 1.386694e-02 0.9930665
[10,] 3.800861e-03 7.601721e-03 0.9961991
[11,] 2.623029e-03 5.246057e-03 0.9973770
[12,] 2.143542e-03 4.287083e-03 0.9978565
[13,] 1.206634e-03 2.413268e-03 0.9987934
[14,] 7.095721e-04 1.419144e-03 0.9992904
[15,] 3.294441e-04 6.588881e-04 0.9996706
[16,] 1.428114e-04 2.856228e-04 0.9998572
[17,] 6.141641e-05 1.228328e-04 0.9999386
[18,] 3.746706e-05 7.493412e-05 0.9999625
[19,] 2.566822e-05 5.133643e-05 0.9999743
[20,] 3.093786e-05 6.187571e-05 0.9999691
[21,] 3.385143e-05 6.770286e-05 0.9999661
[22,] 1.973764e-05 3.947529e-05 0.9999803
[23,] 1.320367e-05 2.640733e-05 0.9999868
[24,] 7.474237e-06 1.494847e-05 0.9999925
[25,] 4.527831e-06 9.055661e-06 0.9999955
[26,] 2.049003e-05 4.098006e-05 0.9999795
[27,] 1.943063e-05 3.886127e-05 0.9999806
[28,] 1.325111e-05 2.650222e-05 0.9999867
[29,] 1.194641e-05 2.389281e-05 0.9999881
[30,] 1.906191e-05 3.812382e-05 0.9999809
[31,] 9.086369e-06 1.817274e-05 0.9999909
[32,] 6.471842e-06 1.294368e-05 0.9999935
[33,] 1.389846e-05 2.779693e-05 0.9999861
[34,] 1.359233e-05 2.718465e-05 0.9999864
[35,] 2.516812e-05 5.033623e-05 0.9999748
[36,] 3.178930e-05 6.357860e-05 0.9999682
[37,] 3.870524e-05 7.741047e-05 0.9999613
[38,] 9.152208e-05 1.830442e-04 0.9999085
[39,] 2.068154e-04 4.136309e-04 0.9997932
[40,] 4.377079e-04 8.754159e-04 0.9995623
[41,] 9.849565e-04 1.969913e-03 0.9990150
[42,] 3.446861e-03 6.893722e-03 0.9965531
[43,] 8.553409e-03 1.710682e-02 0.9914466
[44,] 1.848576e-02 3.697152e-02 0.9815142
[45,] 4.202610e-02 8.405220e-02 0.9579739
[46,] 7.544721e-02 1.508944e-01 0.9245528
[47,] 1.237163e-01 2.474326e-01 0.8762837
[48,] 2.021446e-01 4.042893e-01 0.7978554
[49,] 2.649176e-01 5.298352e-01 0.7350824
[50,] 3.230824e-01 6.461648e-01 0.6769176
[51,] 3.671533e-01 7.343066e-01 0.6328467
[52,] 4.520283e-01 9.040566e-01 0.5479717
[53,] 5.730199e-01 8.539602e-01 0.4269801
[54,] 5.750446e-01 8.499109e-01 0.4249554
[55,] 7.013382e-01 5.973236e-01 0.2986618
[56,] 6.479058e-01 7.041883e-01 0.3520942
[57,] 5.761253e-01 8.477494e-01 0.4238747
[58,] 5.584894e-01 8.830211e-01 0.4415106
[59,] 4.942806e-01 9.885612e-01 0.5057194
[60,] 4.835353e-01 9.670706e-01 0.5164647
[61,] 4.603630e-01 9.207261e-01 0.5396370
> postscript(file="/var/www/html/rcomp/tmp/12sk81293565073.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/rcomp/tmp/22sk81293565073.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/rcomp/tmp/3d1kb1293565073.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/rcomp/tmp/4d1kb1293565073.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/rcomp/tmp/5d1kb1293565073.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 = 72
Frequency = 1
1 2 3 4 5 6
0.27544170 0.10122919 0.24228401 0.14440184 -0.19093539 0.08482078
7 8 9 10 11 12
-0.19116824 -0.35403089 -0.19401546 -0.18940716 -0.35002762 0.28693861
13 14 15 16 17 18
0.57217508 0.07530961 0.62203528 -0.19006666 -0.22628080 0.57835790
19 20 21 22 23 24
-0.17763065 -0.13982610 0.01129091 0.20140711 -0.19031493 -0.12298378
25 26 27 28 29 30
-0.29618775 -0.21196753 0.16640302 -0.00983427 0.36971547 0.22449443
31 32 33 34 35 36
-0.54610242 -0.17319348 -0.05914391 -0.23757664 -0.32070301 0.41509174
37 38 39 40 41 42
-0.96490707 -1.17335523 -0.45782419 -0.93193548 -0.56745155 -0.45205985
43 44 45 46 47 48
-0.72565144 -0.56917359 -0.41797896 -0.18275021 -0.68416950 -0.34262584
49 50 51 52 53 54
-0.14665226 -0.36735805 0.12496902 -0.20441778 -0.20677617 0.29841356
55 56 57 58 59 60
0.03348754 0.19367363 -0.09410732 0.88777721 0.20726568 0.04648228
61 62 63 64 65 66
0.49334774 0.49528720 0.23946113 0.34963950 0.31465130 0.85612507
67 68 69 70 71 72
0.60850706 0.67547374 1.07408485 0.90531852 0.54717264 0.13805680
> postscript(file="/var/www/html/rcomp/tmp/66aje1293565073.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 = 72
Frequency = 1
lag(myerror, k = 1) myerror
0 0.27544170 NA
1 0.10122919 0.27544170
2 0.24228401 0.10122919
3 0.14440184 0.24228401
4 -0.19093539 0.14440184
5 0.08482078 -0.19093539
6 -0.19116824 0.08482078
7 -0.35403089 -0.19116824
8 -0.19401546 -0.35403089
9 -0.18940716 -0.19401546
10 -0.35002762 -0.18940716
11 0.28693861 -0.35002762
12 0.57217508 0.28693861
13 0.07530961 0.57217508
14 0.62203528 0.07530961
15 -0.19006666 0.62203528
16 -0.22628080 -0.19006666
17 0.57835790 -0.22628080
18 -0.17763065 0.57835790
19 -0.13982610 -0.17763065
20 0.01129091 -0.13982610
21 0.20140711 0.01129091
22 -0.19031493 0.20140711
23 -0.12298378 -0.19031493
24 -0.29618775 -0.12298378
25 -0.21196753 -0.29618775
26 0.16640302 -0.21196753
27 -0.00983427 0.16640302
28 0.36971547 -0.00983427
29 0.22449443 0.36971547
30 -0.54610242 0.22449443
31 -0.17319348 -0.54610242
32 -0.05914391 -0.17319348
33 -0.23757664 -0.05914391
34 -0.32070301 -0.23757664
35 0.41509174 -0.32070301
36 -0.96490707 0.41509174
37 -1.17335523 -0.96490707
38 -0.45782419 -1.17335523
39 -0.93193548 -0.45782419
40 -0.56745155 -0.93193548
41 -0.45205985 -0.56745155
42 -0.72565144 -0.45205985
43 -0.56917359 -0.72565144
44 -0.41797896 -0.56917359
45 -0.18275021 -0.41797896
46 -0.68416950 -0.18275021
47 -0.34262584 -0.68416950
48 -0.14665226 -0.34262584
49 -0.36735805 -0.14665226
50 0.12496902 -0.36735805
51 -0.20441778 0.12496902
52 -0.20677617 -0.20441778
53 0.29841356 -0.20677617
54 0.03348754 0.29841356
55 0.19367363 0.03348754
56 -0.09410732 0.19367363
57 0.88777721 -0.09410732
58 0.20726568 0.88777721
59 0.04648228 0.20726568
60 0.49334774 0.04648228
61 0.49528720 0.49334774
62 0.23946113 0.49528720
63 0.34963950 0.23946113
64 0.31465130 0.34963950
65 0.85612507 0.31465130
66 0.60850706 0.85612507
67 0.67547374 0.60850706
68 1.07408485 0.67547374
69 0.90531852 1.07408485
70 0.54717264 0.90531852
71 0.13805680 0.54717264
72 NA 0.13805680
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.10122919 0.27544170
[2,] 0.24228401 0.10122919
[3,] 0.14440184 0.24228401
[4,] -0.19093539 0.14440184
[5,] 0.08482078 -0.19093539
[6,] -0.19116824 0.08482078
[7,] -0.35403089 -0.19116824
[8,] -0.19401546 -0.35403089
[9,] -0.18940716 -0.19401546
[10,] -0.35002762 -0.18940716
[11,] 0.28693861 -0.35002762
[12,] 0.57217508 0.28693861
[13,] 0.07530961 0.57217508
[14,] 0.62203528 0.07530961
[15,] -0.19006666 0.62203528
[16,] -0.22628080 -0.19006666
[17,] 0.57835790 -0.22628080
[18,] -0.17763065 0.57835790
[19,] -0.13982610 -0.17763065
[20,] 0.01129091 -0.13982610
[21,] 0.20140711 0.01129091
[22,] -0.19031493 0.20140711
[23,] -0.12298378 -0.19031493
[24,] -0.29618775 -0.12298378
[25,] -0.21196753 -0.29618775
[26,] 0.16640302 -0.21196753
[27,] -0.00983427 0.16640302
[28,] 0.36971547 -0.00983427
[29,] 0.22449443 0.36971547
[30,] -0.54610242 0.22449443
[31,] -0.17319348 -0.54610242
[32,] -0.05914391 -0.17319348
[33,] -0.23757664 -0.05914391
[34,] -0.32070301 -0.23757664
[35,] 0.41509174 -0.32070301
[36,] -0.96490707 0.41509174
[37,] -1.17335523 -0.96490707
[38,] -0.45782419 -1.17335523
[39,] -0.93193548 -0.45782419
[40,] -0.56745155 -0.93193548
[41,] -0.45205985 -0.56745155
[42,] -0.72565144 -0.45205985
[43,] -0.56917359 -0.72565144
[44,] -0.41797896 -0.56917359
[45,] -0.18275021 -0.41797896
[46,] -0.68416950 -0.18275021
[47,] -0.34262584 -0.68416950
[48,] -0.14665226 -0.34262584
[49,] -0.36735805 -0.14665226
[50,] 0.12496902 -0.36735805
[51,] -0.20441778 0.12496902
[52,] -0.20677617 -0.20441778
[53,] 0.29841356 -0.20677617
[54,] 0.03348754 0.29841356
[55,] 0.19367363 0.03348754
[56,] -0.09410732 0.19367363
[57,] 0.88777721 -0.09410732
[58,] 0.20726568 0.88777721
[59,] 0.04648228 0.20726568
[60,] 0.49334774 0.04648228
[61,] 0.49528720 0.49334774
[62,] 0.23946113 0.49528720
[63,] 0.34963950 0.23946113
[64,] 0.31465130 0.34963950
[65,] 0.85612507 0.31465130
[66,] 0.60850706 0.85612507
[67,] 0.67547374 0.60850706
[68,] 1.07408485 0.67547374
[69,] 0.90531852 1.07408485
[70,] 0.54717264 0.90531852
[71,] 0.13805680 0.54717264
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.10122919 0.27544170
2 0.24228401 0.10122919
3 0.14440184 0.24228401
4 -0.19093539 0.14440184
5 0.08482078 -0.19093539
6 -0.19116824 0.08482078
7 -0.35403089 -0.19116824
8 -0.19401546 -0.35403089
9 -0.18940716 -0.19401546
10 -0.35002762 -0.18940716
11 0.28693861 -0.35002762
12 0.57217508 0.28693861
13 0.07530961 0.57217508
14 0.62203528 0.07530961
15 -0.19006666 0.62203528
16 -0.22628080 -0.19006666
17 0.57835790 -0.22628080
18 -0.17763065 0.57835790
19 -0.13982610 -0.17763065
20 0.01129091 -0.13982610
21 0.20140711 0.01129091
22 -0.19031493 0.20140711
23 -0.12298378 -0.19031493
24 -0.29618775 -0.12298378
25 -0.21196753 -0.29618775
26 0.16640302 -0.21196753
27 -0.00983427 0.16640302
28 0.36971547 -0.00983427
29 0.22449443 0.36971547
30 -0.54610242 0.22449443
31 -0.17319348 -0.54610242
32 -0.05914391 -0.17319348
33 -0.23757664 -0.05914391
34 -0.32070301 -0.23757664
35 0.41509174 -0.32070301
36 -0.96490707 0.41509174
37 -1.17335523 -0.96490707
38 -0.45782419 -1.17335523
39 -0.93193548 -0.45782419
40 -0.56745155 -0.93193548
41 -0.45205985 -0.56745155
42 -0.72565144 -0.45205985
43 -0.56917359 -0.72565144
44 -0.41797896 -0.56917359
45 -0.18275021 -0.41797896
46 -0.68416950 -0.18275021
47 -0.34262584 -0.68416950
48 -0.14665226 -0.34262584
49 -0.36735805 -0.14665226
50 0.12496902 -0.36735805
51 -0.20441778 0.12496902
52 -0.20677617 -0.20441778
53 0.29841356 -0.20677617
54 0.03348754 0.29841356
55 0.19367363 0.03348754
56 -0.09410732 0.19367363
57 0.88777721 -0.09410732
58 0.20726568 0.88777721
59 0.04648228 0.20726568
60 0.49334774 0.04648228
61 0.49528720 0.49334774
62 0.23946113 0.49528720
63 0.34963950 0.23946113
64 0.31465130 0.34963950
65 0.85612507 0.31465130
66 0.60850706 0.85612507
67 0.67547374 0.60850706
68 1.07408485 0.67547374
69 0.90531852 1.07408485
70 0.54717264 0.90531852
71 0.13805680 0.54717264
> plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals')
> lines(lowess(z))
> abline(lm(z))
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/7gj0h1293565073.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/rcomp/tmp/8gj0h1293565073.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/rcomp/tmp/9gj0h1293565073.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/rcomp/tmp/10rbzk1293565073.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/rcomp/createtable")
>
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE)
> a<-table.row.end(a)
> myeq <- colnames(x)[1]
> myeq <- paste(myeq, '[t] = ', sep='')
> for (i in 1:k){
+ if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '')
+ myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ')
+ if (rownames(mysum$coefficients)[i] != '(Intercept)') {
+ myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='')
+ if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='')
+ }
+ }
> myeq <- paste(myeq, ' + e[t]')
> a<-table.row.start(a)
> a<-table.element(a, myeq)
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/11vbgq1293565073.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'Variable',header=TRUE)
> a<-table.element(a,'Parameter',header=TRUE)
> a<-table.element(a,'S.D.',header=TRUE)
> a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE)
> a<-table.element(a,'2-tail p-value',header=TRUE)
> a<-table.element(a,'1-tail p-value',header=TRUE)
> a<-table.row.end(a)
> for (i in 1:k){
+ a<-table.row.start(a)
+ a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE)
+ a<-table.element(a,mysum$coefficients[i,1])
+ a<-table.element(a, round(mysum$coefficients[i,2],6))
+ a<-table.element(a, round(mysum$coefficients[i,3],4))
+ a<-table.element(a, round(mysum$coefficients[i,4],6))
+ a<-table.element(a, round(mysum$coefficients[i,4]/2,6))
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/12yuww1293565073.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple R',1,TRUE)
> a<-table.element(a, sqrt(mysum$r.squared))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'R-squared',1,TRUE)
> a<-table.element(a, mysum$r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Adjusted R-squared',1,TRUE)
> a<-table.element(a, mysum$adj.r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (value)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[1])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[2])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[3])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'p-value',1,TRUE)
> a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3]))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Residual Standard Deviation',1,TRUE)
> a<-table.element(a, mysum$sigma)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Sum Squared Residuals',1,TRUE)
> a<-table.element(a, sum(myerror*myerror))
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/13u3cm1293565073.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Time or Index', 1, TRUE)
> a<-table.element(a, 'Actuals', 1, TRUE)
> a<-table.element(a, 'Interpolation
Forecast', 1, TRUE)
> a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE)
> a<-table.row.end(a)
> for (i in 1:n) {
+ a<-table.row.start(a)
+ a<-table.element(a,i, 1, TRUE)
+ a<-table.element(a,x[i])
+ a<-table.element(a,x[i]-mysum$resid[i])
+ a<-table.element(a,mysum$resid[i])
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/14g4ts1293565073.tab")
> if (n > n25) {
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'p-values',header=TRUE)
+ a<-table.element(a,'Alternative Hypothesis',3,header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'breakpoint index',header=TRUE)
+ a<-table.element(a,'greater',header=TRUE)
+ a<-table.element(a,'2-sided',header=TRUE)
+ a<-table.element(a,'less',header=TRUE)
+ a<-table.row.end(a)
+ for (mypoint in kp3:nmkm3) {
+ a<-table.row.start(a)
+ a<-table.element(a,mypoint,header=TRUE)
+ a<-table.element(a,gqarr[mypoint-kp3+1,1])
+ a<-table.element(a,gqarr[mypoint-kp3+1,2])
+ a<-table.element(a,gqarr[mypoint-kp3+1,3])
+ a<-table.row.end(a)
+ }
+ a<-table.end(a)
+ table.save(a,file="/var/www/html/rcomp/tmp/15j5rg1293565073.tab")
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'Description',header=TRUE)
+ a<-table.element(a,'# significant tests',header=TRUE)
+ a<-table.element(a,'% significant tests',header=TRUE)
+ a<-table.element(a,'OK/NOK',header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'1% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant1)
+ a<-table.element(a,numsignificant1/numgqtests)
+ if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'5% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant5)
+ a<-table.element(a,numsignificant5/numgqtests)
+ if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'10% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant10)
+ a<-table.element(a,numsignificant10/numgqtests)
+ if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.end(a)
+ table.save(a,file="/var/www/html/rcomp/tmp/16m5q41293565073.tab")
+ }
>
> try(system("convert tmp/12sk81293565073.ps tmp/12sk81293565073.png",intern=TRUE))
character(0)
> try(system("convert tmp/22sk81293565073.ps tmp/22sk81293565073.png",intern=TRUE))
character(0)
> try(system("convert tmp/3d1kb1293565073.ps tmp/3d1kb1293565073.png",intern=TRUE))
character(0)
> try(system("convert tmp/4d1kb1293565073.ps tmp/4d1kb1293565073.png",intern=TRUE))
character(0)
> try(system("convert tmp/5d1kb1293565073.ps tmp/5d1kb1293565073.png",intern=TRUE))
character(0)
> try(system("convert tmp/66aje1293565073.ps tmp/66aje1293565073.png",intern=TRUE))
character(0)
> try(system("convert tmp/7gj0h1293565073.ps tmp/7gj0h1293565073.png",intern=TRUE))
character(0)
> try(system("convert tmp/8gj0h1293565073.ps tmp/8gj0h1293565073.png",intern=TRUE))
character(0)
> try(system("convert tmp/9gj0h1293565073.ps tmp/9gj0h1293565073.png",intern=TRUE))
character(0)
> try(system("convert tmp/10rbzk1293565073.ps tmp/10rbzk1293565073.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.640 1.692 8.402