R version 2.8.0 (2008-10-20)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> x <- array(list(-3.3,0,-3.5,0,-3.5,0,-8.4,0,-15.7,0,-18.7,0,-22.8,0,-20.7,0,-14,0,-6.3,0,0.7,1,0.2,1,0.8,1,1.2,1,4.5,1,0.4,1,5.9,1,6.5,1,12.8,1,4.2,1,-3.3,0,-12.5,0,-16.3,0,-10.5,0,-11.8,0,-11.4,0,-17.7,0,-17.3,0,-18.6,0,-17.9,0,-21.4,0,-19.4,0,-15.5,0,-7.7,0,-0.7,0,-1.6,0,1.4,1,0.7,1,9.5,1,1.4,1,4.1,1,6.6,1,18.4,1,16.9,1,9.2,1,-4.3,0,-5.9,0,-7.7,0,-5.4,0,-2.3,0,-4.8,0,2.3,0,-5.2,0,-10,0,-17.1,0,-14.4,0,-3.9,0,3.7,1,6.5,1,0.9,1,-4.1,0,-7,0,-12.2,0,-2.5,0,4.4,1,13.7,1,12.3,1,13.4,1,2.2,1,1.7,1,-7.2,0,-4.8,0,-2.9,0,-2.4,0,-2.5,0,-5.3,0,-7.1,0,-8,0,-8.9,0,-7.7,0,-1.1,0,4,1,9.6,1,10.9,1,13,1,14.9,1,20.1,1,10.8,1,11,1,3.8,1,10.8,1,7.6,1,10.2,1,2.2,1,-0.1,0,-1.7,0,-4.8,0),dim=c(2,97),dimnames=list(c('Registraties','D'),1:97))
>  y <- array(NA,dim=c(2,97),dimnames=list(c('Registraties','D'),1:97))
>  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
   Registraties D
1          -3.3 0
2          -3.5 0
3          -3.5 0
4          -8.4 0
5         -15.7 0
6         -18.7 0
7         -22.8 0
8         -20.7 0
9         -14.0 0
10         -6.3 0
11          0.7 1
12          0.2 1
13          0.8 1
14          1.2 1
15          4.5 1
16          0.4 1
17          5.9 1
18          6.5 1
19         12.8 1
20          4.2 1
21         -3.3 0
22        -12.5 0
23        -16.3 0
24        -10.5 0
25        -11.8 0
26        -11.4 0
27        -17.7 0
28        -17.3 0
29        -18.6 0
30        -17.9 0
31        -21.4 0
32        -19.4 0
33        -15.5 0
34         -7.7 0
35         -0.7 0
36         -1.6 0
37          1.4 1
38          0.7 1
39          9.5 1
40          1.4 1
41          4.1 1
42          6.6 1
43         18.4 1
44         16.9 1
45          9.2 1
46         -4.3 0
47         -5.9 0
48         -7.7 0
49         -5.4 0
50         -2.3 0
51         -4.8 0
52          2.3 0
53         -5.2 0
54        -10.0 0
55        -17.1 0
56        -14.4 0
57         -3.9 0
58          3.7 1
59          6.5 1
60          0.9 1
61         -4.1 0
62         -7.0 0
63        -12.2 0
64         -2.5 0
65          4.4 1
66         13.7 1
67         12.3 1
68         13.4 1
69          2.2 1
70          1.7 1
71         -7.2 0
72         -4.8 0
73         -2.9 0
74         -2.4 0
75         -2.5 0
76         -5.3 0
77         -7.1 0
78         -8.0 0
79         -8.9 0
80         -7.7 0
81         -1.1 0
82          4.0 1
83          9.6 1
84         10.9 1
85         13.0 1
86         14.9 1
87         20.1 1
88         10.8 1
89         11.0 1
90          3.8 1
91         10.8 1
92          7.6 1
93         10.2 1
94          2.2 1
95         -0.1 0
96         -1.7 0
97         -4.8 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept)            D  
     -8.741       15.890  
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
    Min      1Q  Median      3Q     Max 
-14.059  -5.259   1.041   4.841  12.951 
Coefficients:
            Estimate Std. Error t value Pr(>|t|)    
(Intercept)  -8.7411     0.8096  -10.80   <2e-16 ***
D            15.8899     1.2453   12.76   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
Residual standard error: 6.059 on 95 degrees of freedom
Multiple R-squared: 0.6315,	Adjusted R-squared: 0.6276 
F-statistic: 162.8 on 1 and 95 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.6194072 0.761185644 0.380592822
 [2,] 0.8153705 0.369259074 0.184629537
 [3,] 0.9484383 0.103123381 0.051561690
 [4,] 0.9672465 0.065507100 0.032753550
 [5,] 0.9469016 0.106196890 0.053098445
 [6,] 0.9341240 0.131752054 0.065876027
 [7,] 0.9030564 0.193887268 0.096943634
 [8,] 0.8663337 0.267332633 0.133666317
 [9,] 0.8220146 0.355970765 0.177985383
[10,] 0.7712893 0.457421305 0.228710652
[11,] 0.7233516 0.553296807 0.276648404
[12,] 0.6714647 0.657070535 0.328535268
[13,] 0.6293211 0.741357733 0.370678866
[14,] 0.5858699 0.828260112 0.414130056
[15,] 0.6729922 0.654015536 0.327007768
[16,] 0.6092336 0.781532729 0.390766365
[17,] 0.6448872 0.710225637 0.355112819
[18,] 0.5869472 0.826105516 0.413052758
[19,] 0.5856788 0.828642497 0.414321248
[20,] 0.5206312 0.958737606 0.479368803
[21,] 0.4590748 0.918149543 0.540925228
[22,] 0.3979836 0.795967156 0.602016422
[23,] 0.4369952 0.873990421 0.563004790
[24,] 0.4656787 0.931357494 0.534321253
[25,] 0.5344534 0.931093164 0.465546582
[26,] 0.5866377 0.826724628 0.413362314
[27,] 0.7578333 0.484333472 0.242166736
[28,] 0.8480543 0.303891475 0.151945738
[29,] 0.8650385 0.269922951 0.134961476
[30,] 0.8567420 0.286516039 0.143258019
[31,] 0.9220750 0.155849969 0.077924985
[32,] 0.9481560 0.103688043 0.051844021
[33,] 0.9460575 0.107884919 0.053942459
[34,] 0.9491040 0.101791934 0.050895967
[35,] 0.9427722 0.114455627 0.057227814
[36,] 0.9442288 0.111542418 0.055771209
[37,] 0.9347346 0.130530836 0.065265418
[38,] 0.9197720 0.160456098 0.080228049
[39,] 0.9755932 0.048813567 0.024406783
[40,] 0.9898150 0.020369986 0.010184993
[41,] 0.9860909 0.027818138 0.013909069
[42,] 0.9852008 0.029598353 0.014799177
[43,] 0.9818668 0.036266479 0.018133239
[44,] 0.9766175 0.046765016 0.023382508
[45,] 0.9717732 0.056453674 0.028226837
[46,] 0.9734860 0.053027956 0.026513978
[47,] 0.9680841 0.063831775 0.031915888
[48,] 0.9858918 0.028216371 0.014108186
[49,] 0.9815806 0.036838709 0.018419354
[50,] 0.9766057 0.046788608 0.023394304
[51,] 0.9910723 0.017855411 0.008927706
[52,] 0.9950123 0.009975465 0.004987733
[53,] 0.9935591 0.012881761 0.006440880
[54,] 0.9926476 0.014704718 0.007352359
[55,] 0.9894723 0.021055347 0.010527674
[56,] 0.9933880 0.013223977 0.006611988
[57,] 0.9911649 0.017670143 0.008835071
[58,] 0.9875640 0.024871944 0.012435972
[59,] 0.9908152 0.018369559 0.009184780
[60,] 0.9888558 0.022288347 0.011144174
[61,] 0.9877639 0.024472137 0.012236069
[62,] 0.9879029 0.024194286 0.012097143
[63,] 0.9854055 0.029188905 0.014594453
[64,] 0.9850272 0.029945556 0.014972778
[65,] 0.9886871 0.022625873 0.011312936
[66,] 0.9939283 0.012143382 0.006071691
[67,] 0.9913727 0.017254646 0.008627323
[68,] 0.9868848 0.026230386 0.013115193
[69,] 0.9819249 0.036150159 0.018075080
[70,] 0.9763752 0.047249561 0.023624780
[71,] 0.9691684 0.061663175 0.030831588
[72,] 0.9541932 0.091613526 0.045806763
[73,] 0.9364955 0.127008959 0.063504480
[74,] 0.9208465 0.158306944 0.079153472
[75,] 0.9182253 0.163549415 0.081774708
[76,] 0.9148269 0.170346269 0.085173134
[77,] 0.8858693 0.228261360 0.114130680
[78,] 0.8973447 0.205310612 0.102655306
[79,] 0.8520711 0.295857746 0.147928873
[80,] 0.7937923 0.412415491 0.206207746
[81,] 0.7435175 0.512964948 0.256482474
[82,] 0.7375068 0.524986458 0.262493229
[83,] 0.9634216 0.073156733 0.036578366
[84,] 0.9456765 0.108647043 0.054323521
[85,] 0.9312209 0.137558149 0.068779075
[86,] 0.9071872 0.185625559 0.092812780
[87,] 0.8765563 0.246887350 0.123443675
[88,] 0.7576208 0.484758389 0.242379194
> postscript(file="/var/www/html/rcomp/tmp/1zt241227695192.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device 
          1 
> postscript(file="/var/www/html/rcomp/tmp/2c3gv1227695192.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device 
          1 
> postscript(file="/var/www/html/rcomp/tmp/3wjor1227695192.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device 
          1 
> postscript(file="/var/www/html/rcomp/tmp/4efxx1227695192.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device 
          1 
> postscript(file="/var/www/html/rcomp/tmp/5c2ar1227695192.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device 
          1 
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1 
End = 97 
Frequency = 1 
          1           2           3           4           5           6 
  5.4410714   5.2410714   5.2410714   0.3410714  -6.9589286  -9.9589286 
          7           8           9          10          11          12 
-14.0589286 -11.9589286  -5.2589286   2.4410714  -6.4487805  -6.9487805 
         13          14          15          16          17          18 
 -6.3487805  -5.9487805  -2.6487805  -6.7487805  -1.2487805  -0.6487805 
         19          20          21          22          23          24 
  5.6512195  -2.9487805   5.4410714  -3.7589286  -7.5589286  -1.7589286 
         25          26          27          28          29          30 
 -3.0589286  -2.6589286  -8.9589286  -8.5589286  -9.8589286  -9.1589286 
         31          32          33          34          35          36 
-12.6589286 -10.6589286  -6.7589286   1.0410714   8.0410714   7.1410714 
         37          38          39          40          41          42 
 -5.7487805  -6.4487805   2.3512195  -5.7487805  -3.0487805  -0.5487805 
         43          44          45          46          47          48 
 11.2512195   9.7512195   2.0512195   4.4410714   2.8410714   1.0410714 
         49          50          51          52          53          54 
  3.3410714   6.4410714   3.9410714  11.0410714   3.5410714  -1.2589286 
         55          56          57          58          59          60 
 -8.3589286  -5.6589286   4.8410714  -3.4487805  -0.6487805  -6.2487805 
         61          62          63          64          65          66 
  4.6410714   1.7410714  -3.4589286   6.2410714  -2.7487805   6.5512195 
         67          68          69          70          71          72 
  5.1512195   6.2512195  -4.9487805  -5.4487805   1.5410714   3.9410714 
         73          74          75          76          77          78 
  5.8410714   6.3410714   6.2410714   3.4410714   1.6410714   0.7410714 
         79          80          81          82          83          84 
 -0.1589286   1.0410714   7.6410714  -3.1487805   2.4512195   3.7512195 
         85          86          87          88          89          90 
  5.8512195   7.7512195  12.9512195   3.6512195   3.8512195  -3.3487805 
         91          92          93          94          95          96 
  3.6512195   0.4512195   3.0512195  -4.9487805   8.6410714   7.0410714 
         97 
  3.9410714 
> postscript(file="/var/www/html/rcomp/tmp/60vz61227695192.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0 
End = 97 
Frequency = 1 
   lag(myerror, k = 1)     myerror
 0           5.4410714          NA
 1           5.2410714   5.4410714
 2           5.2410714   5.2410714
 3           0.3410714   5.2410714
 4          -6.9589286   0.3410714
 5          -9.9589286  -6.9589286
 6         -14.0589286  -9.9589286
 7         -11.9589286 -14.0589286
 8          -5.2589286 -11.9589286
 9           2.4410714  -5.2589286
10          -6.4487805   2.4410714
11          -6.9487805  -6.4487805
12          -6.3487805  -6.9487805
13          -5.9487805  -6.3487805
14          -2.6487805  -5.9487805
15          -6.7487805  -2.6487805
16          -1.2487805  -6.7487805
17          -0.6487805  -1.2487805
18           5.6512195  -0.6487805
19          -2.9487805   5.6512195
20           5.4410714  -2.9487805
21          -3.7589286   5.4410714
22          -7.5589286  -3.7589286
23          -1.7589286  -7.5589286
24          -3.0589286  -1.7589286
25          -2.6589286  -3.0589286
26          -8.9589286  -2.6589286
27          -8.5589286  -8.9589286
28          -9.8589286  -8.5589286
29          -9.1589286  -9.8589286
30         -12.6589286  -9.1589286
31         -10.6589286 -12.6589286
32          -6.7589286 -10.6589286
33           1.0410714  -6.7589286
34           8.0410714   1.0410714
35           7.1410714   8.0410714
36          -5.7487805   7.1410714
37          -6.4487805  -5.7487805
38           2.3512195  -6.4487805
39          -5.7487805   2.3512195
40          -3.0487805  -5.7487805
41          -0.5487805  -3.0487805
42          11.2512195  -0.5487805
43           9.7512195  11.2512195
44           2.0512195   9.7512195
45           4.4410714   2.0512195
46           2.8410714   4.4410714
47           1.0410714   2.8410714
48           3.3410714   1.0410714
49           6.4410714   3.3410714
50           3.9410714   6.4410714
51          11.0410714   3.9410714
52           3.5410714  11.0410714
53          -1.2589286   3.5410714
54          -8.3589286  -1.2589286
55          -5.6589286  -8.3589286
56           4.8410714  -5.6589286
57          -3.4487805   4.8410714
58          -0.6487805  -3.4487805
59          -6.2487805  -0.6487805
60           4.6410714  -6.2487805
61           1.7410714   4.6410714
62          -3.4589286   1.7410714
63           6.2410714  -3.4589286
64          -2.7487805   6.2410714
65           6.5512195  -2.7487805
66           5.1512195   6.5512195
67           6.2512195   5.1512195
68          -4.9487805   6.2512195
69          -5.4487805  -4.9487805
70           1.5410714  -5.4487805
71           3.9410714   1.5410714
72           5.8410714   3.9410714
73           6.3410714   5.8410714
74           6.2410714   6.3410714
75           3.4410714   6.2410714
76           1.6410714   3.4410714
77           0.7410714   1.6410714
78          -0.1589286   0.7410714
79           1.0410714  -0.1589286
80           7.6410714   1.0410714
81          -3.1487805   7.6410714
82           2.4512195  -3.1487805
83           3.7512195   2.4512195
84           5.8512195   3.7512195
85           7.7512195   5.8512195
86          12.9512195   7.7512195
87           3.6512195  12.9512195
88           3.8512195   3.6512195
89          -3.3487805   3.8512195
90           3.6512195  -3.3487805
91           0.4512195   3.6512195
92           3.0512195   0.4512195
93          -4.9487805   3.0512195
94           8.6410714  -4.9487805
95           7.0410714   8.6410714
96           3.9410714   7.0410714
97                  NA   3.9410714
> dum1 <- dum[2:length(myerror),]
> dum1
      lag(myerror, k = 1)     myerror
 [1,]           5.2410714   5.4410714
 [2,]           5.2410714   5.2410714
 [3,]           0.3410714   5.2410714
 [4,]          -6.9589286   0.3410714
 [5,]          -9.9589286  -6.9589286
 [6,]         -14.0589286  -9.9589286
 [7,]         -11.9589286 -14.0589286
 [8,]          -5.2589286 -11.9589286
 [9,]           2.4410714  -5.2589286
[10,]          -6.4487805   2.4410714
[11,]          -6.9487805  -6.4487805
[12,]          -6.3487805  -6.9487805
[13,]          -5.9487805  -6.3487805
[14,]          -2.6487805  -5.9487805
[15,]          -6.7487805  -2.6487805
[16,]          -1.2487805  -6.7487805
[17,]          -0.6487805  -1.2487805
[18,]           5.6512195  -0.6487805
[19,]          -2.9487805   5.6512195
[20,]           5.4410714  -2.9487805
[21,]          -3.7589286   5.4410714
[22,]          -7.5589286  -3.7589286
[23,]          -1.7589286  -7.5589286
[24,]          -3.0589286  -1.7589286
[25,]          -2.6589286  -3.0589286
[26,]          -8.9589286  -2.6589286
[27,]          -8.5589286  -8.9589286
[28,]          -9.8589286  -8.5589286
[29,]          -9.1589286  -9.8589286
[30,]         -12.6589286  -9.1589286
[31,]         -10.6589286 -12.6589286
[32,]          -6.7589286 -10.6589286
[33,]           1.0410714  -6.7589286
[34,]           8.0410714   1.0410714
[35,]           7.1410714   8.0410714
[36,]          -5.7487805   7.1410714
[37,]          -6.4487805  -5.7487805
[38,]           2.3512195  -6.4487805
[39,]          -5.7487805   2.3512195
[40,]          -3.0487805  -5.7487805
[41,]          -0.5487805  -3.0487805
[42,]          11.2512195  -0.5487805
[43,]           9.7512195  11.2512195
[44,]           2.0512195   9.7512195
[45,]           4.4410714   2.0512195
[46,]           2.8410714   4.4410714
[47,]           1.0410714   2.8410714
[48,]           3.3410714   1.0410714
[49,]           6.4410714   3.3410714
[50,]           3.9410714   6.4410714
[51,]          11.0410714   3.9410714
[52,]           3.5410714  11.0410714
[53,]          -1.2589286   3.5410714
[54,]          -8.3589286  -1.2589286
[55,]          -5.6589286  -8.3589286
[56,]           4.8410714  -5.6589286
[57,]          -3.4487805   4.8410714
[58,]          -0.6487805  -3.4487805
[59,]          -6.2487805  -0.6487805
[60,]           4.6410714  -6.2487805
[61,]           1.7410714   4.6410714
[62,]          -3.4589286   1.7410714
[63,]           6.2410714  -3.4589286
[64,]          -2.7487805   6.2410714
[65,]           6.5512195  -2.7487805
[66,]           5.1512195   6.5512195
[67,]           6.2512195   5.1512195
[68,]          -4.9487805   6.2512195
[69,]          -5.4487805  -4.9487805
[70,]           1.5410714  -5.4487805
[71,]           3.9410714   1.5410714
[72,]           5.8410714   3.9410714
[73,]           6.3410714   5.8410714
[74,]           6.2410714   6.3410714
[75,]           3.4410714   6.2410714
[76,]           1.6410714   3.4410714
[77,]           0.7410714   1.6410714
[78,]          -0.1589286   0.7410714
[79,]           1.0410714  -0.1589286
[80,]           7.6410714   1.0410714
[81,]          -3.1487805   7.6410714
[82,]           2.4512195  -3.1487805
[83,]           3.7512195   2.4512195
[84,]           5.8512195   3.7512195
[85,]           7.7512195   5.8512195
[86,]          12.9512195   7.7512195
[87,]           3.6512195  12.9512195
[88,]           3.8512195   3.6512195
[89,]          -3.3487805   3.8512195
[90,]           3.6512195  -3.3487805
[91,]           0.4512195   3.6512195
[92,]           3.0512195   0.4512195
[93,]          -4.9487805   3.0512195
[94,]           8.6410714  -4.9487805
[95,]           7.0410714   8.6410714
[96,]           3.9410714   7.0410714
> z <- as.data.frame(dum1)
> z
   lag(myerror, k = 1)     myerror
1            5.2410714   5.4410714
2            5.2410714   5.2410714
3            0.3410714   5.2410714
4           -6.9589286   0.3410714
5           -9.9589286  -6.9589286
6          -14.0589286  -9.9589286
7          -11.9589286 -14.0589286
8           -5.2589286 -11.9589286
9            2.4410714  -5.2589286
10          -6.4487805   2.4410714
11          -6.9487805  -6.4487805
12          -6.3487805  -6.9487805
13          -5.9487805  -6.3487805
14          -2.6487805  -5.9487805
15          -6.7487805  -2.6487805
16          -1.2487805  -6.7487805
17          -0.6487805  -1.2487805
18           5.6512195  -0.6487805
19          -2.9487805   5.6512195
20           5.4410714  -2.9487805
21          -3.7589286   5.4410714
22          -7.5589286  -3.7589286
23          -1.7589286  -7.5589286
24          -3.0589286  -1.7589286
25          -2.6589286  -3.0589286
26          -8.9589286  -2.6589286
27          -8.5589286  -8.9589286
28          -9.8589286  -8.5589286
29          -9.1589286  -9.8589286
30         -12.6589286  -9.1589286
31         -10.6589286 -12.6589286
32          -6.7589286 -10.6589286
33           1.0410714  -6.7589286
34           8.0410714   1.0410714
35           7.1410714   8.0410714
36          -5.7487805   7.1410714
37          -6.4487805  -5.7487805
38           2.3512195  -6.4487805
39          -5.7487805   2.3512195
40          -3.0487805  -5.7487805
41          -0.5487805  -3.0487805
42          11.2512195  -0.5487805
43           9.7512195  11.2512195
44           2.0512195   9.7512195
45           4.4410714   2.0512195
46           2.8410714   4.4410714
47           1.0410714   2.8410714
48           3.3410714   1.0410714
49           6.4410714   3.3410714
50           3.9410714   6.4410714
51          11.0410714   3.9410714
52           3.5410714  11.0410714
53          -1.2589286   3.5410714
54          -8.3589286  -1.2589286
55          -5.6589286  -8.3589286
56           4.8410714  -5.6589286
57          -3.4487805   4.8410714
58          -0.6487805  -3.4487805
59          -6.2487805  -0.6487805
60           4.6410714  -6.2487805
61           1.7410714   4.6410714
62          -3.4589286   1.7410714
63           6.2410714  -3.4589286
64          -2.7487805   6.2410714
65           6.5512195  -2.7487805
66           5.1512195   6.5512195
67           6.2512195   5.1512195
68          -4.9487805   6.2512195
69          -5.4487805  -4.9487805
70           1.5410714  -5.4487805
71           3.9410714   1.5410714
72           5.8410714   3.9410714
73           6.3410714   5.8410714
74           6.2410714   6.3410714
75           3.4410714   6.2410714
76           1.6410714   3.4410714
77           0.7410714   1.6410714
78          -0.1589286   0.7410714
79           1.0410714  -0.1589286
80           7.6410714   1.0410714
81          -3.1487805   7.6410714
82           2.4512195  -3.1487805
83           3.7512195   2.4512195
84           5.8512195   3.7512195
85           7.7512195   5.8512195
86          12.9512195   7.7512195
87           3.6512195  12.9512195
88           3.8512195   3.6512195
89          -3.3487805   3.8512195
90           3.6512195  -3.3487805
91           0.4512195   3.6512195
92           3.0512195   0.4512195
93          -4.9487805   3.0512195
94           8.6410714  -4.9487805
95           7.0410714   8.6410714
96           3.9410714   7.0410714
> 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/7dmrd1227695192.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device 
          1 
> postscript(file="/var/www/html/rcomp/tmp/89pzt1227695192.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device 
          1 
> postscript(file="/var/www/html/rcomp/tmp/9phj41227695192.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device 
          1 
> if (n > n25) {
+ postscript(file="/var/www/html/rcomp/tmp/102m5g1227695192.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556) 
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device 
          1 
> 
> #Note: the /var/www/html/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/11a6wd1227695192.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/12okj31227695192.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/13vyls1227695192.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/14a44w1227695192.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/15plx71227695192.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/16qg5u1227695192.tab") 
+ }
> 
> system("convert tmp/1zt241227695192.ps tmp/1zt241227695192.png")
> system("convert tmp/2c3gv1227695192.ps tmp/2c3gv1227695192.png")
> system("convert tmp/3wjor1227695192.ps tmp/3wjor1227695192.png")
> system("convert tmp/4efxx1227695192.ps tmp/4efxx1227695192.png")
> system("convert tmp/5c2ar1227695192.ps tmp/5c2ar1227695192.png")
> system("convert tmp/60vz61227695192.ps tmp/60vz61227695192.png")
> system("convert tmp/7dmrd1227695192.ps tmp/7dmrd1227695192.png")
> system("convert tmp/89pzt1227695192.ps tmp/89pzt1227695192.png")
> system("convert tmp/9phj41227695192.ps tmp/9phj41227695192.png")
> system("convert tmp/102m5g1227695192.ps tmp/102m5g1227695192.png")
> 
> 
> proc.time()
   user  system elapsed 
  3.047   1.690   3.876