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(101.3,163095,102,159044,109.2,155511,88.6,153745,94.3,150569,98.3,150605,86.4,179612,80.6,194690,104.1,189917,108.2,184128,93.4,175335,71.9,179566,94.1,181140,94.9,177876,96.4,175041,91.1,169292,84.4,166070,86.4,166972,88,206348,75.1,215706,109.7,202108,103,195411,82.1,193111,68,195198,96.4,198770,94.3,194163,90,190420,88,189733,76.1,186029,82.5,191531,81.4,232571,66.5,243477,97.2,227247,94.1,217859,80.7,208679,70.5,213188,87.8,216234,89.5,213586,99.6,209465,84.2,204045,75.1,200237,92,203666,80.8,241476,73.1,260307,99.8,243324,90,244460,83.1,233575,72.4,237217,78.8,235243,87.3,230354,91,227184,80.1,221678,73.6,217142,86.4,219452,74.5,256446,71.2,265845,92.4,248624,81.5,241114,85.3,229245,69.9,231805,84.2,219277,90.7,219313,100.3,212610,79.4,214771,84.8,211142,92.9,211457,81.6,240048,76,240636,98.7,230580,89.1,208795,88.7,197922,67.1,194596),dim=c(2,72),dimnames=list(c('textiel','invoer'),1:72))
> y <- array(NA,dim=c(2,72),dimnames=list(c('textiel','invoer'),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
textiel invoer
1 101.3 163095
2 102.0 159044
3 109.2 155511
4 88.6 153745
5 94.3 150569
6 98.3 150605
7 86.4 179612
8 80.6 194690
9 104.1 189917
10 108.2 184128
11 93.4 175335
12 71.9 179566
13 94.1 181140
14 94.9 177876
15 96.4 175041
16 91.1 169292
17 84.4 166070
18 86.4 166972
19 88.0 206348
20 75.1 215706
21 109.7 202108
22 103.0 195411
23 82.1 193111
24 68.0 195198
25 96.4 198770
26 94.3 194163
27 90.0 190420
28 88.0 189733
29 76.1 186029
30 82.5 191531
31 81.4 232571
32 66.5 243477
33 97.2 227247
34 94.1 217859
35 80.7 208679
36 70.5 213188
37 87.8 216234
38 89.5 213586
39 99.6 209465
40 84.2 204045
41 75.1 200237
42 92.0 203666
43 80.8 241476
44 73.1 260307
45 99.8 243324
46 90.0 244460
47 83.1 233575
48 72.4 237217
49 78.8 235243
50 87.3 230354
51 91.0 227184
52 80.1 221678
53 73.6 217142
54 86.4 219452
55 74.5 256446
56 71.2 265845
57 92.4 248624
58 81.5 241114
59 85.3 229245
60 69.9 231805
61 84.2 219277
62 90.7 219313
63 100.3 212610
64 79.4 214771
65 84.8 211142
66 92.9 211457
67 81.6 240048
68 76.0 240636
69 98.7 230580
70 89.1 208795
71 88.7 197922
72 67.1 194596
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) invoer
1.196e+02 -1.575e-04
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-21.83331 -6.39386 0.09255 5.90087 21.95002
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.196e+02 8.568e+00 13.96 < 2e-16 ***
invoer -1.575e-04 4.102e-05 -3.84 0.000267 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 9.668 on 70 degrees of freedom
Multiple R-squared: 0.174, Adjusted R-squared: 0.1622
F-statistic: 14.75 on 1 and 70 DF, p-value: 0.0002668
> 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.4414377 0.8828755 0.55856227
[2,] 0.2897315 0.5794631 0.71026845
[3,] 0.3561199 0.7122398 0.64388009
[4,] 0.2526997 0.5053994 0.74730029
[5,] 0.4785171 0.9570342 0.52148290
[6,] 0.6196436 0.7607128 0.38035640
[7,] 0.5254173 0.9491654 0.47458268
[8,] 0.8253397 0.3493206 0.17466029
[9,] 0.7626706 0.4746587 0.23732936
[10,] 0.6927127 0.6145747 0.30728734
[11,] 0.6227310 0.7545379 0.37726896
[12,] 0.5496148 0.9007703 0.45038516
[13,] 0.5512658 0.8974685 0.44873423
[14,] 0.5145379 0.9709241 0.48546206
[15,] 0.4338089 0.8676177 0.56619113
[16,] 0.4294396 0.8588792 0.57056040
[17,] 0.7301459 0.5397082 0.26985410
[18,] 0.7826467 0.4347065 0.21735325
[19,] 0.7620375 0.4759251 0.23796254
[20,] 0.9049426 0.1901147 0.09505736
[21,] 0.8965625 0.2068750 0.10343752
[22,] 0.8746495 0.2507011 0.12535054
[23,] 0.8366227 0.3267546 0.16337729
[24,] 0.7918567 0.4162866 0.20814328
[25,] 0.8291767 0.3416466 0.17082328
[26,] 0.8006384 0.3987232 0.19936160
[27,] 0.7490943 0.5018114 0.25090568
[28,] 0.7987051 0.4025897 0.20129486
[29,] 0.8513832 0.2972336 0.14861679
[30,] 0.8485543 0.3028914 0.15144568
[31,] 0.8174805 0.3650390 0.18251951
[32,] 0.8704468 0.2591064 0.12955320
[33,] 0.8342330 0.3315339 0.16576695
[34,] 0.7967120 0.4065760 0.20328802
[35,] 0.8448043 0.3103913 0.15519567
[36,] 0.8015864 0.3968272 0.19841362
[37,] 0.8254776 0.3490448 0.17452242
[38,] 0.7918165 0.4163669 0.20818346
[39,] 0.7379287 0.5241426 0.26207130
[40,] 0.7067598 0.5864805 0.29324024
[41,] 0.8427861 0.3144278 0.15721390
[42,] 0.8349203 0.3301594 0.16507969
[43,] 0.7848387 0.4303227 0.21516133
[44,] 0.7876429 0.4247142 0.21235708
[45,] 0.7381743 0.5236514 0.26182570
[46,] 0.6841842 0.6316315 0.31581575
[47,] 0.6565516 0.6868969 0.34344843
[48,] 0.5942509 0.8114983 0.40574914
[49,] 0.6210247 0.7579506 0.37897531
[50,] 0.5430209 0.9139581 0.45697906
[51,] 0.4876217 0.9752433 0.51237835
[52,] 0.4979653 0.9959306 0.50203472
[53,] 0.4860855 0.9721709 0.51391454
[54,] 0.4004636 0.8009272 0.59953640
[55,] 0.3153518 0.6307036 0.68464819
[56,] 0.4287461 0.8574922 0.57125388
[57,] 0.3364926 0.6729853 0.66350737
[58,] 0.2647268 0.5294537 0.73527317
[59,] 0.3846668 0.7693335 0.61533323
[60,] 0.3028673 0.6057345 0.69713274
[61,] 0.2025439 0.4050879 0.79745607
[62,] 0.1712594 0.3425189 0.82874056
[63,] 0.1025766 0.2051532 0.89742341
> postscript(file="/var/www/html/rcomp/tmp/1lee91229714378.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/245ec1229714378.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/3y0i11229714378.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/4941z1229714378.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/5mauu1229714378.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 = 72
Frequency = 1
1 2 3 4 5 6
7.4044755 7.4663391 14.1098009 -6.7683894 -1.5686908 2.4369801
7 8 9 10 11 12
-4.8936733 -8.3185016 14.4296285 17.6177125 1.4325894 -19.4009195
13 14 15 16 17 18
3.0470259 3.3328621 4.3862769 -1.8193381 -9.0268857 -6.8847976
19 20 21 22 23 24
0.9179325 -10.5079425 21.9500237 14.1950744 -7.0672346 -20.8384785
25 26 27 28 29 30
8.1242031 5.2984824 0.4088639 -1.6993562 -14.1828312 -6.9161251
31 32 33 34 35 36
-1.5512724 -14.7332976 13.4100611 8.8312103 -6.0148752 -15.5045921
37 38 39 40 41 42
2.2752311 3.5581031 13.0089399 -3.2448491 -12.9447068 4.4954487
43 44 45 46 47 48
-0.7485064 -5.4821409 18.5426010 8.9215501 0.3068834 -9.8194082
49 50 51 52 53 54
-3.7303638 3.9994933 7.2001370 -4.5671993 -11.7817356 1.3821486
55 56 57 58 59 60
-4.6903474 -6.5097638 11.9774869 -0.1055307 1.8247973 -13.1719370
61 62 63 64 65 66
-0.8454184 5.6602525 14.2043581 -6.3552290 -1.5268895 6.6227310
67 68 69 70 71 72
-0.1734531 -5.6808280 15.4350941 2.4033977 0.2906213 -21.8333090
> postscript(file="/var/www/html/rcomp/tmp/6ngnl1229714378.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 = 72
Frequency = 1
lag(myerror, k = 1) myerror
0 7.4044755 NA
1 7.4663391 7.4044755
2 14.1098009 7.4663391
3 -6.7683894 14.1098009
4 -1.5686908 -6.7683894
5 2.4369801 -1.5686908
6 -4.8936733 2.4369801
7 -8.3185016 -4.8936733
8 14.4296285 -8.3185016
9 17.6177125 14.4296285
10 1.4325894 17.6177125
11 -19.4009195 1.4325894
12 3.0470259 -19.4009195
13 3.3328621 3.0470259
14 4.3862769 3.3328621
15 -1.8193381 4.3862769
16 -9.0268857 -1.8193381
17 -6.8847976 -9.0268857
18 0.9179325 -6.8847976
19 -10.5079425 0.9179325
20 21.9500237 -10.5079425
21 14.1950744 21.9500237
22 -7.0672346 14.1950744
23 -20.8384785 -7.0672346
24 8.1242031 -20.8384785
25 5.2984824 8.1242031
26 0.4088639 5.2984824
27 -1.6993562 0.4088639
28 -14.1828312 -1.6993562
29 -6.9161251 -14.1828312
30 -1.5512724 -6.9161251
31 -14.7332976 -1.5512724
32 13.4100611 -14.7332976
33 8.8312103 13.4100611
34 -6.0148752 8.8312103
35 -15.5045921 -6.0148752
36 2.2752311 -15.5045921
37 3.5581031 2.2752311
38 13.0089399 3.5581031
39 -3.2448491 13.0089399
40 -12.9447068 -3.2448491
41 4.4954487 -12.9447068
42 -0.7485064 4.4954487
43 -5.4821409 -0.7485064
44 18.5426010 -5.4821409
45 8.9215501 18.5426010
46 0.3068834 8.9215501
47 -9.8194082 0.3068834
48 -3.7303638 -9.8194082
49 3.9994933 -3.7303638
50 7.2001370 3.9994933
51 -4.5671993 7.2001370
52 -11.7817356 -4.5671993
53 1.3821486 -11.7817356
54 -4.6903474 1.3821486
55 -6.5097638 -4.6903474
56 11.9774869 -6.5097638
57 -0.1055307 11.9774869
58 1.8247973 -0.1055307
59 -13.1719370 1.8247973
60 -0.8454184 -13.1719370
61 5.6602525 -0.8454184
62 14.2043581 5.6602525
63 -6.3552290 14.2043581
64 -1.5268895 -6.3552290
65 6.6227310 -1.5268895
66 -0.1734531 6.6227310
67 -5.6808280 -0.1734531
68 15.4350941 -5.6808280
69 2.4033977 15.4350941
70 0.2906213 2.4033977
71 -21.8333090 0.2906213
72 NA -21.8333090
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 7.4663391 7.4044755
[2,] 14.1098009 7.4663391
[3,] -6.7683894 14.1098009
[4,] -1.5686908 -6.7683894
[5,] 2.4369801 -1.5686908
[6,] -4.8936733 2.4369801
[7,] -8.3185016 -4.8936733
[8,] 14.4296285 -8.3185016
[9,] 17.6177125 14.4296285
[10,] 1.4325894 17.6177125
[11,] -19.4009195 1.4325894
[12,] 3.0470259 -19.4009195
[13,] 3.3328621 3.0470259
[14,] 4.3862769 3.3328621
[15,] -1.8193381 4.3862769
[16,] -9.0268857 -1.8193381
[17,] -6.8847976 -9.0268857
[18,] 0.9179325 -6.8847976
[19,] -10.5079425 0.9179325
[20,] 21.9500237 -10.5079425
[21,] 14.1950744 21.9500237
[22,] -7.0672346 14.1950744
[23,] -20.8384785 -7.0672346
[24,] 8.1242031 -20.8384785
[25,] 5.2984824 8.1242031
[26,] 0.4088639 5.2984824
[27,] -1.6993562 0.4088639
[28,] -14.1828312 -1.6993562
[29,] -6.9161251 -14.1828312
[30,] -1.5512724 -6.9161251
[31,] -14.7332976 -1.5512724
[32,] 13.4100611 -14.7332976
[33,] 8.8312103 13.4100611
[34,] -6.0148752 8.8312103
[35,] -15.5045921 -6.0148752
[36,] 2.2752311 -15.5045921
[37,] 3.5581031 2.2752311
[38,] 13.0089399 3.5581031
[39,] -3.2448491 13.0089399
[40,] -12.9447068 -3.2448491
[41,] 4.4954487 -12.9447068
[42,] -0.7485064 4.4954487
[43,] -5.4821409 -0.7485064
[44,] 18.5426010 -5.4821409
[45,] 8.9215501 18.5426010
[46,] 0.3068834 8.9215501
[47,] -9.8194082 0.3068834
[48,] -3.7303638 -9.8194082
[49,] 3.9994933 -3.7303638
[50,] 7.2001370 3.9994933
[51,] -4.5671993 7.2001370
[52,] -11.7817356 -4.5671993
[53,] 1.3821486 -11.7817356
[54,] -4.6903474 1.3821486
[55,] -6.5097638 -4.6903474
[56,] 11.9774869 -6.5097638
[57,] -0.1055307 11.9774869
[58,] 1.8247973 -0.1055307
[59,] -13.1719370 1.8247973
[60,] -0.8454184 -13.1719370
[61,] 5.6602525 -0.8454184
[62,] 14.2043581 5.6602525
[63,] -6.3552290 14.2043581
[64,] -1.5268895 -6.3552290
[65,] 6.6227310 -1.5268895
[66,] -0.1734531 6.6227310
[67,] -5.6808280 -0.1734531
[68,] 15.4350941 -5.6808280
[69,] 2.4033977 15.4350941
[70,] 0.2906213 2.4033977
[71,] -21.8333090 0.2906213
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 7.4663391 7.4044755
2 14.1098009 7.4663391
3 -6.7683894 14.1098009
4 -1.5686908 -6.7683894
5 2.4369801 -1.5686908
6 -4.8936733 2.4369801
7 -8.3185016 -4.8936733
8 14.4296285 -8.3185016
9 17.6177125 14.4296285
10 1.4325894 17.6177125
11 -19.4009195 1.4325894
12 3.0470259 -19.4009195
13 3.3328621 3.0470259
14 4.3862769 3.3328621
15 -1.8193381 4.3862769
16 -9.0268857 -1.8193381
17 -6.8847976 -9.0268857
18 0.9179325 -6.8847976
19 -10.5079425 0.9179325
20 21.9500237 -10.5079425
21 14.1950744 21.9500237
22 -7.0672346 14.1950744
23 -20.8384785 -7.0672346
24 8.1242031 -20.8384785
25 5.2984824 8.1242031
26 0.4088639 5.2984824
27 -1.6993562 0.4088639
28 -14.1828312 -1.6993562
29 -6.9161251 -14.1828312
30 -1.5512724 -6.9161251
31 -14.7332976 -1.5512724
32 13.4100611 -14.7332976
33 8.8312103 13.4100611
34 -6.0148752 8.8312103
35 -15.5045921 -6.0148752
36 2.2752311 -15.5045921
37 3.5581031 2.2752311
38 13.0089399 3.5581031
39 -3.2448491 13.0089399
40 -12.9447068 -3.2448491
41 4.4954487 -12.9447068
42 -0.7485064 4.4954487
43 -5.4821409 -0.7485064
44 18.5426010 -5.4821409
45 8.9215501 18.5426010
46 0.3068834 8.9215501
47 -9.8194082 0.3068834
48 -3.7303638 -9.8194082
49 3.9994933 -3.7303638
50 7.2001370 3.9994933
51 -4.5671993 7.2001370
52 -11.7817356 -4.5671993
53 1.3821486 -11.7817356
54 -4.6903474 1.3821486
55 -6.5097638 -4.6903474
56 11.9774869 -6.5097638
57 -0.1055307 11.9774869
58 1.8247973 -0.1055307
59 -13.1719370 1.8247973
60 -0.8454184 -13.1719370
61 5.6602525 -0.8454184
62 14.2043581 5.6602525
63 -6.3552290 14.2043581
64 -1.5268895 -6.3552290
65 6.6227310 -1.5268895
66 -0.1734531 6.6227310
67 -5.6808280 -0.1734531
68 15.4350941 -5.6808280
69 2.4033977 15.4350941
70 0.2906213 2.4033977
71 -21.8333090 0.2906213
> 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/717z91229714378.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/8qzwq1229714378.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/90glq1229714378.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/10tqgi1229714378.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/113y8n1229714378.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/12zh7e1229714378.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/13y5jb1229714378.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/14izdq1229714378.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/15facl1229714378.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/16g7ba1229714378.tab")
+ }
>
> system("convert tmp/1lee91229714378.ps tmp/1lee91229714378.png")
> system("convert tmp/245ec1229714378.ps tmp/245ec1229714378.png")
> system("convert tmp/3y0i11229714378.ps tmp/3y0i11229714378.png")
> system("convert tmp/4941z1229714378.ps tmp/4941z1229714378.png")
> system("convert tmp/5mauu1229714378.ps tmp/5mauu1229714378.png")
> system("convert tmp/6ngnl1229714378.ps tmp/6ngnl1229714378.png")
> system("convert tmp/717z91229714378.ps tmp/717z91229714378.png")
> system("convert tmp/8qzwq1229714378.ps tmp/8qzwq1229714378.png")
> system("convert tmp/90glq1229714378.ps tmp/90glq1229714378.png")
> system("convert tmp/10tqgi1229714378.ps tmp/10tqgi1229714378.png")
>
>
> proc.time()
user system elapsed
2.649 1.639 3.852