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,4.15,3.186,3.93,3.902,3.7,4.164,3.7,3.499,3.65,4.145,3.55,3.796,3.43,3.711,3.47,3.949,3.58,3.74,3.67,3.243,3.72,4.407,3.8,4.814,3.76,3.908,3.63,5.25,3.48,3.937,3.41,4.004,3.43,5.56,3.5,3.922,3.62,3.759,3.58,4.138,3.52,4.634,3.45,3.996,3.36,4.308,3.27,4.143,3.21,4.429,3.19,5.219,3.16,4.929,3.12,5.761,3.06,5.592,3.01,4.163,2.98,4.962,2.97,5.208,3.02,4.755,3.07,4.491,3.18,5.732,3.29,5.731,3.43,5.04,3.61,6.102,3.74,4.904,3.87,5.369,3.88,5.578,4.09,4.619,4.19,4.731,4.2,5.011,4.29,5.299,4.37,4.146,4.47,4.625,4.61,4.736,4.65,4.219,4.69,5.116,4.82,4.205,4.86,4.121,4.87,5.103,5.01,4.3,5.03,4.578,5.13,3.809,5.18,5.657,5.21,4.248,5.26,3.83,5.25,4.736,5.2,4.839,5.16,4.411,5.19,4.57,5.39,4.104,5.58,4.801,5.76,3.953,5.89,3.828,5.98,4.44,6.02,4.026,5.62,4.109,4.87,4.785),dim=c(2,72),dimnames=list(c('Lening','Huis'),1:72))
> y <- array(NA,dim=c(2,72),dimnames=list(c('Lening','Huis'),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 = '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
Lening Huis M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 4.24 3.353 1 0 0 0 0 0 0 0 0 0 0 1
2 4.15 3.186 0 1 0 0 0 0 0 0 0 0 0 2
3 3.93 3.902 0 0 1 0 0 0 0 0 0 0 0 3
4 3.70 4.164 0 0 0 1 0 0 0 0 0 0 0 4
5 3.70 3.499 0 0 0 0 1 0 0 0 0 0 0 5
6 3.65 4.145 0 0 0 0 0 1 0 0 0 0 0 6
7 3.55 3.796 0 0 0 0 0 0 1 0 0 0 0 7
8 3.43 3.711 0 0 0 0 0 0 0 1 0 0 0 8
9 3.47 3.949 0 0 0 0 0 0 0 0 1 0 0 9
10 3.58 3.740 0 0 0 0 0 0 0 0 0 1 0 10
11 3.67 3.243 0 0 0 0 0 0 0 0 0 0 1 11
12 3.72 4.407 0 0 0 0 0 0 0 0 0 0 0 12
13 3.80 4.814 1 0 0 0 0 0 0 0 0 0 0 13
14 3.76 3.908 0 1 0 0 0 0 0 0 0 0 0 14
15 3.63 5.250 0 0 1 0 0 0 0 0 0 0 0 15
16 3.48 3.937 0 0 0 1 0 0 0 0 0 0 0 16
17 3.41 4.004 0 0 0 0 1 0 0 0 0 0 0 17
18 3.43 5.560 0 0 0 0 0 1 0 0 0 0 0 18
19 3.50 3.922 0 0 0 0 0 0 1 0 0 0 0 19
20 3.62 3.759 0 0 0 0 0 0 0 1 0 0 0 20
21 3.58 4.138 0 0 0 0 0 0 0 0 1 0 0 21
22 3.52 4.634 0 0 0 0 0 0 0 0 0 1 0 22
23 3.45 3.996 0 0 0 0 0 0 0 0 0 0 1 23
24 3.36 4.308 0 0 0 0 0 0 0 0 0 0 0 24
25 3.27 4.143 1 0 0 0 0 0 0 0 0 0 0 25
26 3.21 4.429 0 1 0 0 0 0 0 0 0 0 0 26
27 3.19 5.219 0 0 1 0 0 0 0 0 0 0 0 27
28 3.16 4.929 0 0 0 1 0 0 0 0 0 0 0 28
29 3.12 5.761 0 0 0 0 1 0 0 0 0 0 0 29
30 3.06 5.592 0 0 0 0 0 1 0 0 0 0 0 30
31 3.01 4.163 0 0 0 0 0 0 1 0 0 0 0 31
32 2.98 4.962 0 0 0 0 0 0 0 1 0 0 0 32
33 2.97 5.208 0 0 0 0 0 0 0 0 1 0 0 33
34 3.02 4.755 0 0 0 0 0 0 0 0 0 1 0 34
35 3.07 4.491 0 0 0 0 0 0 0 0 0 0 1 35
36 3.18 5.732 0 0 0 0 0 0 0 0 0 0 0 36
37 3.29 5.731 1 0 0 0 0 0 0 0 0 0 0 37
38 3.43 5.040 0 1 0 0 0 0 0 0 0 0 0 38
39 3.61 6.102 0 0 1 0 0 0 0 0 0 0 0 39
40 3.74 4.904 0 0 0 1 0 0 0 0 0 0 0 40
41 3.87 5.369 0 0 0 0 1 0 0 0 0 0 0 41
42 3.88 5.578 0 0 0 0 0 1 0 0 0 0 0 42
43 4.09 4.619 0 0 0 0 0 0 1 0 0 0 0 43
44 4.19 4.731 0 0 0 0 0 0 0 1 0 0 0 44
45 4.20 5.011 0 0 0 0 0 0 0 0 1 0 0 45
46 4.29 5.299 0 0 0 0 0 0 0 0 0 1 0 46
47 4.37 4.146 0 0 0 0 0 0 0 0 0 0 1 47
48 4.47 4.625 0 0 0 0 0 0 0 0 0 0 0 48
49 4.61 4.736 1 0 0 0 0 0 0 0 0 0 0 49
50 4.65 4.219 0 1 0 0 0 0 0 0 0 0 0 50
51 4.69 5.116 0 0 1 0 0 0 0 0 0 0 0 51
52 4.82 4.205 0 0 0 1 0 0 0 0 0 0 0 52
53 4.86 4.121 0 0 0 0 1 0 0 0 0 0 0 53
54 4.87 5.103 0 0 0 0 0 1 0 0 0 0 0 54
55 5.01 4.300 0 0 0 0 0 0 1 0 0 0 0 55
56 5.03 4.578 0 0 0 0 0 0 0 1 0 0 0 56
57 5.13 3.809 0 0 0 0 0 0 0 0 1 0 0 57
58 5.18 5.657 0 0 0 0 0 0 0 0 0 1 0 58
59 5.21 4.248 0 0 0 0 0 0 0 0 0 0 1 59
60 5.26 3.830 0 0 0 0 0 0 0 0 0 0 0 60
61 5.25 4.736 1 0 0 0 0 0 0 0 0 0 0 61
62 5.20 4.839 0 1 0 0 0 0 0 0 0 0 0 62
63 5.16 4.411 0 0 1 0 0 0 0 0 0 0 0 63
64 5.19 4.570 0 0 0 1 0 0 0 0 0 0 0 64
65 5.39 4.104 0 0 0 0 1 0 0 0 0 0 0 65
66 5.58 4.801 0 0 0 0 0 1 0 0 0 0 0 66
67 5.76 3.953 0 0 0 0 0 0 1 0 0 0 0 67
68 5.89 3.828 0 0 0 0 0 0 0 1 0 0 0 68
69 5.98 4.440 0 0 0 0 0 0 0 0 1 0 0 69
70 6.02 4.026 0 0 0 0 0 0 0 0 0 1 0 70
71 5.62 4.109 0 0 0 0 0 0 0 0 0 0 1 71
72 4.87 4.785 0 0 0 0 0 0 0 0 0 0 0 72
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Huis M1 M2 M3 M4
5.81626 -0.72028 0.34480 0.06837 0.52308 0.06870
M5 M6 M7 M8 M9 M10
0.09062 0.54202 -0.14569 -0.05037 0.06036 0.25451
M11 t
-0.28700 0.03931
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.96220 -0.19758 0.04286 0.22411 0.90417
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.816260 0.414094 14.046 < 2e-16 ***
Huis -0.720282 0.086582 -8.319 1.79e-11 ***
M1 0.344801 0.233715 1.475 0.1455
M2 0.068367 0.234453 0.292 0.7716
M3 0.523081 0.236629 2.211 0.0310 *
M4 0.068701 0.233125 0.295 0.7693
M5 0.090617 0.232910 0.389 0.6987
M6 0.542016 0.237810 2.279 0.0264 *
M7 -0.145692 0.235709 -0.618 0.5389
M8 -0.050372 0.234059 -0.215 0.8304
M9 0.060355 0.232779 0.259 0.7963
M10 0.254510 0.232423 1.095 0.2780
M11 -0.287004 0.237392 -1.209 0.2316
t 0.039305 0.002436 16.137 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.4023 on 58 degrees of freedom
Multiple R-squared: 0.8259, Adjusted R-squared: 0.7869
F-statistic: 21.17 on 13 and 58 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.004731354 0.009462709 0.99526865
[2,] 0.004237557 0.008475114 0.99576244
[3,] 0.004659393 0.009318785 0.99534061
[4,] 0.017784023 0.035568046 0.98221598
[5,] 0.015454886 0.030909772 0.98454511
[6,] 0.011130691 0.022261381 0.98886931
[7,] 0.006536111 0.013072222 0.99346389
[8,] 0.015135319 0.030270639 0.98486468
[9,] 0.078837170 0.157674340 0.92116283
[10,] 0.102808095 0.205616190 0.89719190
[11,] 0.080984580 0.161969159 0.91901542
[12,] 0.054623843 0.109247686 0.94537616
[13,] 0.036215656 0.072431311 0.96378434
[14,] 0.020889857 0.041779714 0.97911014
[15,] 0.015304467 0.030608934 0.98469553
[16,] 0.011645458 0.023290916 0.98835454
[17,] 0.010433165 0.020866329 0.98956684
[18,] 0.029015566 0.058031133 0.97098443
[19,] 0.049330262 0.098660525 0.95066974
[20,] 0.034792487 0.069584974 0.96520751
[21,] 0.038337665 0.076675329 0.96166234
[22,] 0.084592587 0.169185174 0.91540741
[23,] 0.241990605 0.483981210 0.75800940
[24,] 0.555124764 0.889750472 0.44487524
[25,] 0.777176251 0.445647499 0.22282375
[26,] 0.860230155 0.279539690 0.13976984
[27,] 0.929781851 0.140436299 0.07021815
[28,] 0.957434369 0.085131263 0.04256563
[29,] 0.967674849 0.064650302 0.03232515
[30,] 0.984034468 0.031931064 0.01596553
[31,] 0.984896862 0.030206275 0.01510314
[32,] 0.979994407 0.040011185 0.02000559
[33,] 0.964881583 0.070236834 0.03511842
[34,] 0.945938959 0.108122082 0.05406104
[35,] 0.918859989 0.162280022 0.08114001
[36,] 0.855349071 0.289301859 0.14465093
[37,] 0.754666077 0.490667845 0.24533392
[38,] 0.630613434 0.738773132 0.36938657
[39,] 0.497317882 0.994635764 0.50268212
> postscript(file="/var/www/html/rcomp/tmp/1muxk1293482116.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/2muxk1293482116.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/3f4eo1293482116.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/4f4eo1293482116.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/5f4eo1293482116.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.45473819 0.48157997 0.28328274 0.65707105 0.11686340 0.04146129
7 8 9 10 11 12
0.33848589 0.02263697 0.08403105 -0.18996754 0.04426119 0.60636025
13 14 15 16 17 18
0.59540892 0.13996254 0.48256164 -0.19809371 -0.28105516 0.36899906
19 20 21 22 23 24
-0.09241944 -0.22445033 -0.14149652 -0.07769653 -0.10502751 -0.29660845
25 26 27 28 29 30
-0.88956091 -0.50643152 -0.45142790 -0.27523509 0.22281895 -0.44961274
31 32 33 34 35 36
-0.88049236 -0.46961227 -0.45245593 -0.96220326 -0.60014889 0.07741186
37 38 39 40 41 42
-0.19741440 -0.31800022 0.13292001 -0.18490294 0.21880771 -0.11135750
43 44 45 46 47 48
0.05629527 0.10234184 0.16398776 0.22796917 -0.02030689 0.09839922
49 50 51 52 53 54
-0.06575549 -0.16101230 0.03106145 -0.08004066 -0.16176465 0.06484789
55 56 57 58 59 60
0.27486460 0.36047793 -0.24345164 0.90416920 0.42150103 -0.15588554
61 62 63 64 65 66
0.10258369 0.36390153 -0.47839795 0.08120135 -0.11567025 0.08566200
67 68 69 70 71 72
0.30326604 0.20860585 0.58938529 0.09772895 0.25972106 -0.32967734
> postscript(file="/var/www/html/rcomp/tmp/6qvw81293482116.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.45473819 NA
1 0.48157997 0.45473819
2 0.28328274 0.48157997
3 0.65707105 0.28328274
4 0.11686340 0.65707105
5 0.04146129 0.11686340
6 0.33848589 0.04146129
7 0.02263697 0.33848589
8 0.08403105 0.02263697
9 -0.18996754 0.08403105
10 0.04426119 -0.18996754
11 0.60636025 0.04426119
12 0.59540892 0.60636025
13 0.13996254 0.59540892
14 0.48256164 0.13996254
15 -0.19809371 0.48256164
16 -0.28105516 -0.19809371
17 0.36899906 -0.28105516
18 -0.09241944 0.36899906
19 -0.22445033 -0.09241944
20 -0.14149652 -0.22445033
21 -0.07769653 -0.14149652
22 -0.10502751 -0.07769653
23 -0.29660845 -0.10502751
24 -0.88956091 -0.29660845
25 -0.50643152 -0.88956091
26 -0.45142790 -0.50643152
27 -0.27523509 -0.45142790
28 0.22281895 -0.27523509
29 -0.44961274 0.22281895
30 -0.88049236 -0.44961274
31 -0.46961227 -0.88049236
32 -0.45245593 -0.46961227
33 -0.96220326 -0.45245593
34 -0.60014889 -0.96220326
35 0.07741186 -0.60014889
36 -0.19741440 0.07741186
37 -0.31800022 -0.19741440
38 0.13292001 -0.31800022
39 -0.18490294 0.13292001
40 0.21880771 -0.18490294
41 -0.11135750 0.21880771
42 0.05629527 -0.11135750
43 0.10234184 0.05629527
44 0.16398776 0.10234184
45 0.22796917 0.16398776
46 -0.02030689 0.22796917
47 0.09839922 -0.02030689
48 -0.06575549 0.09839922
49 -0.16101230 -0.06575549
50 0.03106145 -0.16101230
51 -0.08004066 0.03106145
52 -0.16176465 -0.08004066
53 0.06484789 -0.16176465
54 0.27486460 0.06484789
55 0.36047793 0.27486460
56 -0.24345164 0.36047793
57 0.90416920 -0.24345164
58 0.42150103 0.90416920
59 -0.15588554 0.42150103
60 0.10258369 -0.15588554
61 0.36390153 0.10258369
62 -0.47839795 0.36390153
63 0.08120135 -0.47839795
64 -0.11567025 0.08120135
65 0.08566200 -0.11567025
66 0.30326604 0.08566200
67 0.20860585 0.30326604
68 0.58938529 0.20860585
69 0.09772895 0.58938529
70 0.25972106 0.09772895
71 -0.32967734 0.25972106
72 NA -0.32967734
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.48157997 0.45473819
[2,] 0.28328274 0.48157997
[3,] 0.65707105 0.28328274
[4,] 0.11686340 0.65707105
[5,] 0.04146129 0.11686340
[6,] 0.33848589 0.04146129
[7,] 0.02263697 0.33848589
[8,] 0.08403105 0.02263697
[9,] -0.18996754 0.08403105
[10,] 0.04426119 -0.18996754
[11,] 0.60636025 0.04426119
[12,] 0.59540892 0.60636025
[13,] 0.13996254 0.59540892
[14,] 0.48256164 0.13996254
[15,] -0.19809371 0.48256164
[16,] -0.28105516 -0.19809371
[17,] 0.36899906 -0.28105516
[18,] -0.09241944 0.36899906
[19,] -0.22445033 -0.09241944
[20,] -0.14149652 -0.22445033
[21,] -0.07769653 -0.14149652
[22,] -0.10502751 -0.07769653
[23,] -0.29660845 -0.10502751
[24,] -0.88956091 -0.29660845
[25,] -0.50643152 -0.88956091
[26,] -0.45142790 -0.50643152
[27,] -0.27523509 -0.45142790
[28,] 0.22281895 -0.27523509
[29,] -0.44961274 0.22281895
[30,] -0.88049236 -0.44961274
[31,] -0.46961227 -0.88049236
[32,] -0.45245593 -0.46961227
[33,] -0.96220326 -0.45245593
[34,] -0.60014889 -0.96220326
[35,] 0.07741186 -0.60014889
[36,] -0.19741440 0.07741186
[37,] -0.31800022 -0.19741440
[38,] 0.13292001 -0.31800022
[39,] -0.18490294 0.13292001
[40,] 0.21880771 -0.18490294
[41,] -0.11135750 0.21880771
[42,] 0.05629527 -0.11135750
[43,] 0.10234184 0.05629527
[44,] 0.16398776 0.10234184
[45,] 0.22796917 0.16398776
[46,] -0.02030689 0.22796917
[47,] 0.09839922 -0.02030689
[48,] -0.06575549 0.09839922
[49,] -0.16101230 -0.06575549
[50,] 0.03106145 -0.16101230
[51,] -0.08004066 0.03106145
[52,] -0.16176465 -0.08004066
[53,] 0.06484789 -0.16176465
[54,] 0.27486460 0.06484789
[55,] 0.36047793 0.27486460
[56,] -0.24345164 0.36047793
[57,] 0.90416920 -0.24345164
[58,] 0.42150103 0.90416920
[59,] -0.15588554 0.42150103
[60,] 0.10258369 -0.15588554
[61,] 0.36390153 0.10258369
[62,] -0.47839795 0.36390153
[63,] 0.08120135 -0.47839795
[64,] -0.11567025 0.08120135
[65,] 0.08566200 -0.11567025
[66,] 0.30326604 0.08566200
[67,] 0.20860585 0.30326604
[68,] 0.58938529 0.20860585
[69,] 0.09772895 0.58938529
[70,] 0.25972106 0.09772895
[71,] -0.32967734 0.25972106
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.48157997 0.45473819
2 0.28328274 0.48157997
3 0.65707105 0.28328274
4 0.11686340 0.65707105
5 0.04146129 0.11686340
6 0.33848589 0.04146129
7 0.02263697 0.33848589
8 0.08403105 0.02263697
9 -0.18996754 0.08403105
10 0.04426119 -0.18996754
11 0.60636025 0.04426119
12 0.59540892 0.60636025
13 0.13996254 0.59540892
14 0.48256164 0.13996254
15 -0.19809371 0.48256164
16 -0.28105516 -0.19809371
17 0.36899906 -0.28105516
18 -0.09241944 0.36899906
19 -0.22445033 -0.09241944
20 -0.14149652 -0.22445033
21 -0.07769653 -0.14149652
22 -0.10502751 -0.07769653
23 -0.29660845 -0.10502751
24 -0.88956091 -0.29660845
25 -0.50643152 -0.88956091
26 -0.45142790 -0.50643152
27 -0.27523509 -0.45142790
28 0.22281895 -0.27523509
29 -0.44961274 0.22281895
30 -0.88049236 -0.44961274
31 -0.46961227 -0.88049236
32 -0.45245593 -0.46961227
33 -0.96220326 -0.45245593
34 -0.60014889 -0.96220326
35 0.07741186 -0.60014889
36 -0.19741440 0.07741186
37 -0.31800022 -0.19741440
38 0.13292001 -0.31800022
39 -0.18490294 0.13292001
40 0.21880771 -0.18490294
41 -0.11135750 0.21880771
42 0.05629527 -0.11135750
43 0.10234184 0.05629527
44 0.16398776 0.10234184
45 0.22796917 0.16398776
46 -0.02030689 0.22796917
47 0.09839922 -0.02030689
48 -0.06575549 0.09839922
49 -0.16101230 -0.06575549
50 0.03106145 -0.16101230
51 -0.08004066 0.03106145
52 -0.16176465 -0.08004066
53 0.06484789 -0.16176465
54 0.27486460 0.06484789
55 0.36047793 0.27486460
56 -0.24345164 0.36047793
57 0.90416920 -0.24345164
58 0.42150103 0.90416920
59 -0.15588554 0.42150103
60 0.10258369 -0.15588554
61 0.36390153 0.10258369
62 -0.47839795 0.36390153
63 0.08120135 -0.47839795
64 -0.11567025 0.08120135
65 0.08566200 -0.11567025
66 0.30326604 0.08566200
67 0.20860585 0.30326604
68 0.58938529 0.20860585
69 0.09772895 0.58938529
70 0.25972106 0.09772895
71 -0.32967734 0.25972106
> 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/7qvw81293482116.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/8imdt1293482116.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/9imdt1293482116.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/10tdue1293482116.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/11wwa21293482116.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/120f9q1293482116.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/13e67z1293482116.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/14hp551293482116.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/15374t1293482116.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/16o82y1293482116.tab")
+ }
>
> try(system("convert tmp/1muxk1293482116.ps tmp/1muxk1293482116.png",intern=TRUE))
character(0)
> try(system("convert tmp/2muxk1293482116.ps tmp/2muxk1293482116.png",intern=TRUE))
character(0)
> try(system("convert tmp/3f4eo1293482116.ps tmp/3f4eo1293482116.png",intern=TRUE))
character(0)
> try(system("convert tmp/4f4eo1293482116.ps tmp/4f4eo1293482116.png",intern=TRUE))
character(0)
> try(system("convert tmp/5f4eo1293482116.ps tmp/5f4eo1293482116.png",intern=TRUE))
character(0)
> try(system("convert tmp/6qvw81293482116.ps tmp/6qvw81293482116.png",intern=TRUE))
character(0)
> try(system("convert tmp/7qvw81293482116.ps tmp/7qvw81293482116.png",intern=TRUE))
character(0)
> try(system("convert tmp/8imdt1293482116.ps tmp/8imdt1293482116.png",intern=TRUE))
character(0)
> try(system("convert tmp/9imdt1293482116.ps tmp/9imdt1293482116.png",intern=TRUE))
character(0)
> try(system("convert tmp/10tdue1293482116.ps tmp/10tdue1293482116.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.575 1.640 8.420