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 = '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
Lening Huis
1 4.24 3.353
2 4.15 3.186
3 3.93 3.902
4 3.70 4.164
5 3.70 3.499
6 3.65 4.145
7 3.55 3.796
8 3.43 3.711
9 3.47 3.949
10 3.58 3.740
11 3.67 3.243
12 3.72 4.407
13 3.80 4.814
14 3.76 3.908
15 3.63 5.250
16 3.48 3.937
17 3.41 4.004
18 3.43 5.560
19 3.50 3.922
20 3.62 3.759
21 3.58 4.138
22 3.52 4.634
23 3.45 3.996
24 3.36 4.308
25 3.27 4.143
26 3.21 4.429
27 3.19 5.219
28 3.16 4.929
29 3.12 5.761
30 3.06 5.592
31 3.01 4.163
32 2.98 4.962
33 2.97 5.208
34 3.02 4.755
35 3.07 4.491
36 3.18 5.732
37 3.29 5.731
38 3.43 5.040
39 3.61 6.102
40 3.74 4.904
41 3.87 5.369
42 3.88 5.578
43 4.09 4.619
44 4.19 4.731
45 4.20 5.011
46 4.29 5.299
47 4.37 4.146
48 4.47 4.625
49 4.61 4.736
50 4.65 4.219
51 4.69 5.116
52 4.82 4.205
53 4.86 4.121
54 4.87 5.103
55 5.01 4.300
56 5.03 4.578
57 5.13 3.809
58 5.18 5.657
59 5.21 4.248
60 5.26 3.830
61 5.25 4.736
62 5.20 4.839
63 5.16 4.411
64 5.19 4.570
65 5.39 4.104
66 5.58 4.801
67 5.76 3.953
68 5.89 3.828
69 5.98 4.440
70 6.02 4.026
71 5.62 4.109
72 4.87 4.785
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Huis
5.2114 -0.2404
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.2005 -0.7520 -0.2939 0.8149 1.8361
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.2114 0.7060 7.381 2.51e-10 ***
Huis -0.2404 0.1551 -1.550 0.126
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.8629 on 70 degrees of freedom
Multiple R-squared: 0.03319, Adjusted R-squared: 0.01938
F-statistic: 2.403 on 1 and 70 DF, p-value: 0.1256
> 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.769304e-02 3.538607e-02 0.982306964
[2,] 3.567592e-03 7.135184e-03 0.996432408
[3,] 1.944294e-03 3.888588e-03 0.998055706
[4,] 1.957769e-03 3.915538e-03 0.998042231
[5,] 7.081875e-04 1.416375e-03 0.999291812
[6,] 2.407157e-04 4.814314e-04 0.999759284
[7,] 1.346594e-04 2.693189e-04 0.999865341
[8,] 5.202350e-05 1.040470e-04 0.999947977
[9,] 2.529908e-05 5.059817e-05 0.999974701
[10,] 7.026301e-06 1.405260e-05 0.999992974
[11,] 1.811110e-06 3.622221e-06 0.999998189
[12,] 9.176081e-07 1.835216e-06 0.999999082
[13,] 6.116381e-07 1.223276e-06 0.999999388
[14,] 1.552918e-07 3.105836e-07 0.999999845
[15,] 7.194183e-08 1.438837e-07 0.999999928
[16,] 2.699404e-08 5.398808e-08 0.999999973
[17,] 9.213882e-09 1.842776e-08 0.999999991
[18,] 2.691065e-09 5.382131e-09 0.999999997
[19,] 1.867647e-09 3.735293e-09 0.999999998
[20,] 1.518154e-09 3.036309e-09 0.999999998
[21,] 3.292319e-09 6.584639e-09 0.999999997
[22,] 6.410584e-09 1.282117e-08 0.999999994
[23,] 3.346034e-09 6.692069e-09 0.999999997
[24,] 2.966620e-09 5.933239e-09 0.999999997
[25,] 9.685620e-10 1.937124e-09 0.999999999
[26,] 4.266406e-10 8.532812e-10 1.000000000
[27,] 1.485943e-08 2.971886e-08 0.999999985
[28,] 4.145017e-08 8.290033e-08 0.999999959
[29,] 6.878484e-08 1.375697e-07 0.999999931
[30,] 4.123732e-07 8.247465e-07 0.999999588
[31,] 8.547580e-06 1.709516e-05 0.999991452
[32,] 6.756924e-06 1.351385e-05 0.999993243
[33,] 6.221792e-06 1.244358e-05 0.999993778
[34,] 1.548147e-05 3.096295e-05 0.999984519
[35,] 3.553369e-05 7.106737e-05 0.999964466
[36,] 1.177880e-04 2.355760e-04 0.999882212
[37,] 3.587241e-04 7.174483e-04 0.999641276
[38,] 9.094263e-04 1.818853e-03 0.999090574
[39,] 4.299606e-03 8.599212e-03 0.995700394
[40,] 1.686003e-02 3.372007e-02 0.983139966
[41,] 4.703678e-02 9.407357e-02 0.952963217
[42,] 1.040723e-01 2.081445e-01 0.895927726
[43,] 2.712346e-01 5.424692e-01 0.728765386
[44,] 4.619792e-01 9.239583e-01 0.538020828
[45,] 6.316777e-01 7.366446e-01 0.368322291
[46,] 8.025324e-01 3.949352e-01 0.197467578
[47,] 8.687520e-01 2.624959e-01 0.131247963
[48,] 9.318217e-01 1.363565e-01 0.068178266
[49,] 9.686141e-01 6.277180e-02 0.031385901
[50,] 9.754349e-01 4.913020e-02 0.024565101
[51,] 9.836822e-01 3.263563e-02 0.016317816
[52,] 9.865500e-01 2.689991e-02 0.013449956
[53,] 9.921583e-01 1.568340e-02 0.007841700
[54,] 9.925154e-01 1.496916e-02 0.007484581
[55,] 9.920681e-01 1.586384e-02 0.007931919
[56,] 9.960497e-01 7.900645e-03 0.003950323
[57,] 9.928840e-01 1.423203e-02 0.007116014
[58,] 9.865245e-01 2.695098e-02 0.013475488
[59,] 9.822389e-01 3.552217e-02 0.017761085
[60,] 9.702658e-01 5.946830e-02 0.029734151
[61,] 9.615621e-01 7.687590e-02 0.038437949
[62,] 9.425228e-01 1.149544e-01 0.057477214
[63,] 8.780562e-01 2.438876e-01 0.121943822
> postscript(file="/var/www/html/rcomp/tmp/10f9q1293482010.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/2toqt1293482010.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/3toqt1293482010.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/4toqt1293482010.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/53x8w1293482010.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.165246766 -0.295396180 -0.343258575 -0.510269676 -0.670146082 -0.564837573
7 8 9 10 11 12
-0.748742634 -0.889177964 -0.791959040 -0.732205910 -0.761692488 -0.431848673
13 14 15 16 17 18
-0.253999504 -0.511816082 -0.319178281 -0.784844028 -0.838736179 -0.444649430
19 20 21 22 23 24
-0.768450262 -0.687638013 -0.636520482 -0.577274321 -0.800659504 -0.815649822
25 26 27 28 29 30
-0.945318404 -0.936559529 -0.766631166 -0.866351704 -0.706325885 -0.806956130
31 32 33 34 35 36
-1.200510091 -1.038417988 -0.989275739 -1.048184027 -1.061653758 -0.653297939
37 38 39 40 41 42
-0.543538354 -0.569665567 -0.134344149 -0.292362096 -0.050568819 0.009678051
43 44 45 46 47 48
-0.010880555 0.116045997 0.193362379 0.352602085 0.155402843 0.370561938
49 50 51 52 53 54
0.537248075 0.452953185 0.708606022 0.619587366 0.639392452 0.885480618
55 56 57 58 59 60
0.832426853 0.919262403 0.834382769 1.328670888 1.019925239 0.969431498
61 62 63 64 65 66
1.177248075 1.152010887 1.009112990 1.077339078 1.165305386 1.522875093
67 68 69 70 71 72
1.499002623 1.598950667 1.836085043 1.776552965 1.396507464 0.809028442
> postscript(file="/var/www/html/rcomp/tmp/63x8w1293482010.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.165246766 NA
1 -0.295396180 -0.165246766
2 -0.343258575 -0.295396180
3 -0.510269676 -0.343258575
4 -0.670146082 -0.510269676
5 -0.564837573 -0.670146082
6 -0.748742634 -0.564837573
7 -0.889177964 -0.748742634
8 -0.791959040 -0.889177964
9 -0.732205910 -0.791959040
10 -0.761692488 -0.732205910
11 -0.431848673 -0.761692488
12 -0.253999504 -0.431848673
13 -0.511816082 -0.253999504
14 -0.319178281 -0.511816082
15 -0.784844028 -0.319178281
16 -0.838736179 -0.784844028
17 -0.444649430 -0.838736179
18 -0.768450262 -0.444649430
19 -0.687638013 -0.768450262
20 -0.636520482 -0.687638013
21 -0.577274321 -0.636520482
22 -0.800659504 -0.577274321
23 -0.815649822 -0.800659504
24 -0.945318404 -0.815649822
25 -0.936559529 -0.945318404
26 -0.766631166 -0.936559529
27 -0.866351704 -0.766631166
28 -0.706325885 -0.866351704
29 -0.806956130 -0.706325885
30 -1.200510091 -0.806956130
31 -1.038417988 -1.200510091
32 -0.989275739 -1.038417988
33 -1.048184027 -0.989275739
34 -1.061653758 -1.048184027
35 -0.653297939 -1.061653758
36 -0.543538354 -0.653297939
37 -0.569665567 -0.543538354
38 -0.134344149 -0.569665567
39 -0.292362096 -0.134344149
40 -0.050568819 -0.292362096
41 0.009678051 -0.050568819
42 -0.010880555 0.009678051
43 0.116045997 -0.010880555
44 0.193362379 0.116045997
45 0.352602085 0.193362379
46 0.155402843 0.352602085
47 0.370561938 0.155402843
48 0.537248075 0.370561938
49 0.452953185 0.537248075
50 0.708606022 0.452953185
51 0.619587366 0.708606022
52 0.639392452 0.619587366
53 0.885480618 0.639392452
54 0.832426853 0.885480618
55 0.919262403 0.832426853
56 0.834382769 0.919262403
57 1.328670888 0.834382769
58 1.019925239 1.328670888
59 0.969431498 1.019925239
60 1.177248075 0.969431498
61 1.152010887 1.177248075
62 1.009112990 1.152010887
63 1.077339078 1.009112990
64 1.165305386 1.077339078
65 1.522875093 1.165305386
66 1.499002623 1.522875093
67 1.598950667 1.499002623
68 1.836085043 1.598950667
69 1.776552965 1.836085043
70 1.396507464 1.776552965
71 0.809028442 1.396507464
72 NA 0.809028442
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.295396180 -0.165246766
[2,] -0.343258575 -0.295396180
[3,] -0.510269676 -0.343258575
[4,] -0.670146082 -0.510269676
[5,] -0.564837573 -0.670146082
[6,] -0.748742634 -0.564837573
[7,] -0.889177964 -0.748742634
[8,] -0.791959040 -0.889177964
[9,] -0.732205910 -0.791959040
[10,] -0.761692488 -0.732205910
[11,] -0.431848673 -0.761692488
[12,] -0.253999504 -0.431848673
[13,] -0.511816082 -0.253999504
[14,] -0.319178281 -0.511816082
[15,] -0.784844028 -0.319178281
[16,] -0.838736179 -0.784844028
[17,] -0.444649430 -0.838736179
[18,] -0.768450262 -0.444649430
[19,] -0.687638013 -0.768450262
[20,] -0.636520482 -0.687638013
[21,] -0.577274321 -0.636520482
[22,] -0.800659504 -0.577274321
[23,] -0.815649822 -0.800659504
[24,] -0.945318404 -0.815649822
[25,] -0.936559529 -0.945318404
[26,] -0.766631166 -0.936559529
[27,] -0.866351704 -0.766631166
[28,] -0.706325885 -0.866351704
[29,] -0.806956130 -0.706325885
[30,] -1.200510091 -0.806956130
[31,] -1.038417988 -1.200510091
[32,] -0.989275739 -1.038417988
[33,] -1.048184027 -0.989275739
[34,] -1.061653758 -1.048184027
[35,] -0.653297939 -1.061653758
[36,] -0.543538354 -0.653297939
[37,] -0.569665567 -0.543538354
[38,] -0.134344149 -0.569665567
[39,] -0.292362096 -0.134344149
[40,] -0.050568819 -0.292362096
[41,] 0.009678051 -0.050568819
[42,] -0.010880555 0.009678051
[43,] 0.116045997 -0.010880555
[44,] 0.193362379 0.116045997
[45,] 0.352602085 0.193362379
[46,] 0.155402843 0.352602085
[47,] 0.370561938 0.155402843
[48,] 0.537248075 0.370561938
[49,] 0.452953185 0.537248075
[50,] 0.708606022 0.452953185
[51,] 0.619587366 0.708606022
[52,] 0.639392452 0.619587366
[53,] 0.885480618 0.639392452
[54,] 0.832426853 0.885480618
[55,] 0.919262403 0.832426853
[56,] 0.834382769 0.919262403
[57,] 1.328670888 0.834382769
[58,] 1.019925239 1.328670888
[59,] 0.969431498 1.019925239
[60,] 1.177248075 0.969431498
[61,] 1.152010887 1.177248075
[62,] 1.009112990 1.152010887
[63,] 1.077339078 1.009112990
[64,] 1.165305386 1.077339078
[65,] 1.522875093 1.165305386
[66,] 1.499002623 1.522875093
[67,] 1.598950667 1.499002623
[68,] 1.836085043 1.598950667
[69,] 1.776552965 1.836085043
[70,] 1.396507464 1.776552965
[71,] 0.809028442 1.396507464
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.295396180 -0.165246766
2 -0.343258575 -0.295396180
3 -0.510269676 -0.343258575
4 -0.670146082 -0.510269676
5 -0.564837573 -0.670146082
6 -0.748742634 -0.564837573
7 -0.889177964 -0.748742634
8 -0.791959040 -0.889177964
9 -0.732205910 -0.791959040
10 -0.761692488 -0.732205910
11 -0.431848673 -0.761692488
12 -0.253999504 -0.431848673
13 -0.511816082 -0.253999504
14 -0.319178281 -0.511816082
15 -0.784844028 -0.319178281
16 -0.838736179 -0.784844028
17 -0.444649430 -0.838736179
18 -0.768450262 -0.444649430
19 -0.687638013 -0.768450262
20 -0.636520482 -0.687638013
21 -0.577274321 -0.636520482
22 -0.800659504 -0.577274321
23 -0.815649822 -0.800659504
24 -0.945318404 -0.815649822
25 -0.936559529 -0.945318404
26 -0.766631166 -0.936559529
27 -0.866351704 -0.766631166
28 -0.706325885 -0.866351704
29 -0.806956130 -0.706325885
30 -1.200510091 -0.806956130
31 -1.038417988 -1.200510091
32 -0.989275739 -1.038417988
33 -1.048184027 -0.989275739
34 -1.061653758 -1.048184027
35 -0.653297939 -1.061653758
36 -0.543538354 -0.653297939
37 -0.569665567 -0.543538354
38 -0.134344149 -0.569665567
39 -0.292362096 -0.134344149
40 -0.050568819 -0.292362096
41 0.009678051 -0.050568819
42 -0.010880555 0.009678051
43 0.116045997 -0.010880555
44 0.193362379 0.116045997
45 0.352602085 0.193362379
46 0.155402843 0.352602085
47 0.370561938 0.155402843
48 0.537248075 0.370561938
49 0.452953185 0.537248075
50 0.708606022 0.452953185
51 0.619587366 0.708606022
52 0.639392452 0.619587366
53 0.885480618 0.639392452
54 0.832426853 0.885480618
55 0.919262403 0.832426853
56 0.834382769 0.919262403
57 1.328670888 0.834382769
58 1.019925239 1.328670888
59 0.969431498 1.019925239
60 1.177248075 0.969431498
61 1.152010887 1.177248075
62 1.009112990 1.152010887
63 1.077339078 1.009112990
64 1.165305386 1.077339078
65 1.522875093 1.165305386
66 1.499002623 1.522875093
67 1.598950667 1.499002623
68 1.836085043 1.598950667
69 1.776552965 1.836085043
70 1.396507464 1.776552965
71 0.809028442 1.396507464
> 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/7e67z1293482010.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/8e67z1293482010.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/9ofo21293482010.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/10ofo21293482010.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/11agnq1293482010.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/12vgld1293482010.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/13s8141293482010.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/14vris1293482010.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/15y9gg1293482010.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/16kax41293482010.tab")
+ }
>
> try(system("convert tmp/10f9q1293482010.ps tmp/10f9q1293482010.png",intern=TRUE))
character(0)
> try(system("convert tmp/2toqt1293482010.ps tmp/2toqt1293482010.png",intern=TRUE))
character(0)
> try(system("convert tmp/3toqt1293482010.ps tmp/3toqt1293482010.png",intern=TRUE))
character(0)
> try(system("convert tmp/4toqt1293482010.ps tmp/4toqt1293482010.png",intern=TRUE))
character(0)
> try(system("convert tmp/53x8w1293482010.ps tmp/53x8w1293482010.png",intern=TRUE))
character(0)
> try(system("convert tmp/63x8w1293482010.ps tmp/63x8w1293482010.png",intern=TRUE))
character(0)
> try(system("convert tmp/7e67z1293482010.ps tmp/7e67z1293482010.png",intern=TRUE))
character(0)
> try(system("convert tmp/8e67z1293482010.ps tmp/8e67z1293482010.png",intern=TRUE))
character(0)
> try(system("convert tmp/9ofo21293482010.ps tmp/9ofo21293482010.png",intern=TRUE))
character(0)
> try(system("convert tmp/10ofo21293482010.ps tmp/10ofo21293482010.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.641 1.654 7.413