R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-pc-linux-gnu (32-bit)
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(20,1,14,3,1,1,14,1,8,3,0,1,18,0,12,6,1,1,12,1,7,2,0,1,16,0,10,1,1,0,13,0,7,2,0,0,22,1,16,8,1,1,16,1,11,1,1,0,20,0,14,4,1,1,10,0,6,0,0,0,22,0,16,4,1,0,17,1,11,2,0,1,21,0,16,1,1,1,18,1,12,2,1,1,13,0,7,3,0,0,17,0,13,1,1,0,17,1,11,2,1,1,19,1,15,6,1,0,12,1,7,0,0,1,14,1,9,1,0,1,13,0,7,3,0,1,20,1,14,5,1,1,20,1,15,0,1,1,13,1,7,1,0,1,21,1,15,3,1,1,21,1,17,6,1,1,19,1,15,5,1,0,18,1,14,4,1,0,20,0,14,4,0,0,14,1,8,4,1,1,14,0,8,0,0,1,20,1,14,3,1,0,21,1,14,5,1,1,14,0,8,3,0,0,16,1,11,1,1,1,21,1,16,5,1,1,16,1,10,5,1,1,14,1,8,0,0,1,19,1,14,3,1,1,22,1,16,6,1,0,19,0,13,3,1,1,11,1,5,1,0,0,13,1,8,2,0,1,16,1,10,2,0,0,14,0,8,2,0,1,19,1,13,4,1,1,21,1,15,4,1,1,12,0,6,0,0,1,17,0,12,3,1,1,21,1,16,6,0,1,11,1,5,3,1,0,19,0,15,1,1,1,18,0,12,4,1,0,14,0,8,3,0,1,19,0,13,3,1,1,20,1,14,3,1,1,18,0,12,2,1,1,22,0,16,6,1,1,16,1,10,5,1,1,20,0,15,5,1,0,14,0,8,2,0,1,22,1,16,4,1,1,25,0,19,2,1,1,20,0,14,5,1,0),dim=c(6,64),dimnames=list(c('Income','Change','Size','Complex','Big4','Product'),1:64))
> y <- array(NA,dim=c(6,64),dimnames=list(c('Income','Change','Size','Complex','Big4','Product'),1:64))
> 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
> 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
Income Change Size Complex Big4 Product
1 20 1 14 3 1 1
2 14 1 8 3 0 1
3 18 0 12 6 1 1
4 12 1 7 2 0 1
5 16 0 10 1 1 0
6 13 0 7 2 0 0
7 22 1 16 8 1 1
8 16 1 11 1 1 0
9 20 0 14 4 1 1
10 10 0 6 0 0 0
11 22 0 16 4 1 0
12 17 1 11 2 0 1
13 21 0 16 1 1 1
14 18 1 12 2 1 1
15 13 0 7 3 0 0
16 17 0 13 1 1 0
17 17 1 11 2 1 1
18 19 1 15 6 1 0
19 12 1 7 0 0 1
20 14 1 9 1 0 1
21 13 0 7 3 0 1
22 20 1 14 5 1 1
23 20 1 15 0 1 1
24 13 1 7 1 0 1
25 21 1 15 3 1 1
26 21 1 17 6 1 1
27 19 1 15 5 1 0
28 18 1 14 4 1 0
29 20 0 14 4 0 0
30 14 1 8 4 1 1
31 14 0 8 0 0 1
32 20 1 14 3 1 0
33 21 1 14 5 1 1
34 14 0 8 3 0 0
35 16 1 11 1 1 1
36 21 1 16 5 1 1
37 16 1 10 5 1 1
38 14 1 8 0 0 1
39 19 1 14 3 1 1
40 22 1 16 6 1 0
41 19 0 13 3 1 1
42 11 1 5 1 0 0
43 13 1 8 2 0 1
44 16 1 10 2 0 0
45 14 0 8 2 0 1
46 19 1 13 4 1 1
47 21 1 15 4 1 1
48 12 0 6 0 0 1
49 17 0 12 3 1 1
50 21 1 16 6 0 1
51 11 1 5 3 1 0
52 19 0 15 1 1 1
53 18 0 12 4 1 0
54 14 0 8 3 0 1
55 19 0 13 3 1 1
56 20 1 14 3 1 1
57 18 0 12 2 1 1
58 22 0 16 6 1 1
59 16 1 10 5 1 1
60 20 0 15 5 1 0
61 14 0 8 2 0 1
62 22 1 16 4 1 1
63 25 0 19 2 1 1
64 20 0 14 5 1 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Change Size Complex Big4 Product
5.9739 -0.2268 0.9199 0.1167 0.1079 0.3889
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.5817 -0.4654 0.1697 0.4861 1.2946
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.97387 0.33744 17.703 <2e-16 ***
Change -0.22679 0.17698 -1.281 0.2051
Size 0.91986 0.03633 25.323 <2e-16 ***
Complex 0.11669 0.05500 2.122 0.0382 *
Big4 0.10792 0.25103 0.430 0.6688
Product 0.38889 0.18761 2.073 0.0426 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.6767 on 58 degrees of freedom
Multiple R-squared: 0.9656, Adjusted R-squared: 0.9626
F-statistic: 325.5 on 5 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.2844024 0.56880488 0.71559756
[2,] 0.7534130 0.49317402 0.24658701
[3,] 0.6444383 0.71112339 0.35556170
[4,] 0.5524699 0.89506023 0.44753011
[5,] 0.5394689 0.92106219 0.46053110
[6,] 0.4707157 0.94143145 0.52928427
[7,] 0.3982224 0.79644487 0.60177756
[8,] 0.6120887 0.77582251 0.38791125
[9,] 0.5436890 0.91262193 0.45631096
[10,] 0.7985762 0.40284763 0.20142381
[11,] 0.7692553 0.46148946 0.23074473
[12,] 0.7273411 0.54531777 0.27265888
[13,] 0.6531769 0.69364613 0.34682307
[14,] 0.5826226 0.83475471 0.41737736
[15,] 0.4993549 0.99870988 0.50064506
[16,] 0.4423004 0.88460083 0.55769958
[17,] 0.4131929 0.82638582 0.58680709
[18,] 0.7099157 0.58016870 0.29008435
[19,] 0.8120523 0.37589549 0.18794774
[20,] 0.9225837 0.15483270 0.07741635
[21,] 0.9378991 0.12420172 0.06210086
[22,] 0.9100751 0.17984989 0.08992494
[23,] 0.8806156 0.23876878 0.11938439
[24,] 0.9119448 0.17611033 0.08805517
[25,] 0.9721370 0.05572606 0.02786303
[26,] 0.9598770 0.08024598 0.04012299
[27,] 0.9545217 0.09095666 0.04547833
[28,] 0.9512213 0.09755737 0.04877868
[29,] 0.9263683 0.14726334 0.07363167
[30,] 0.9078899 0.18422016 0.09211008
[31,] 0.9034719 0.19305614 0.09652807
[32,] 0.8909316 0.21813678 0.10906839
[33,] 0.8516964 0.29660716 0.14830358
[34,] 0.8133182 0.37336350 0.18668175
[35,] 0.8478740 0.30425208 0.15212604
[36,] 0.8216819 0.35663630 0.17831815
[37,] 0.7583910 0.48321801 0.24160901
[38,] 0.6844057 0.63118850 0.31559425
[39,] 0.6160166 0.76796679 0.38398339
[40,] 0.5317545 0.93649091 0.46824545
[41,] 0.5882173 0.82356545 0.41178273
[42,] 0.6062017 0.78759665 0.39379833
[43,] 0.4962110 0.99242204 0.50378898
[44,] 0.9753332 0.04933351 0.02466675
[45,] 0.9642643 0.07147136 0.03573568
[46,] 0.9114744 0.17705114 0.08852557
[47,] 0.8030086 0.39398277 0.19699139
> postscript(file="/var/wessaorg/rcomp/tmp/1t8ff1321898965.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/wessaorg/rcomp/tmp/2d8it1321898965.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/wessaorg/rcomp/tmp/3a0wf1321898965.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/wessaorg/rcomp/tmp/4kq5t1321898965.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/wessaorg/rcomp/tmp/5qgjc1321898965.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 = 64
Frequency = 1
1 2 3 4 5 6
0.52793386 0.15503843 -0.20920822 -0.80840477 0.60287784 0.35369839
7 8 9 10 11 12
0.10474068 -0.09019604 0.18445094 -1.49305162 0.73361661 0.51214079
13 14 15 16 17 18
-0.30519670 0.48435427 0.23700520 -1.15671299 0.40421788 -1.35311644
19 20 21 22 23 24
-0.57501838 -0.53143880 -0.15188769 0.29454748 -0.04185017 0.30828842
25 26 27 28 29 30
0.60807025 -1.58173655 -1.23642325 -1.19986645 0.68126674 -0.06957768
31 32 33 34 35 36
0.27832828 0.91682674 1.29454748 0.31714159 -0.47908893 -0.54517974
37 38 39 40 41 42
-0.02599809 0.50511801 -0.47206614 0.72701995 0.22100775 0.53690853
43 44 45 46 47 48
-0.72826838 0.82089729 0.04494190 0.33110428 0.49137706 0.11805550
49 50 51 52 53 54
-0.85912865 -0.55395002 0.19559923 -1.38533309 0.41307105 -0.07175130
55 56 57 58 59 60
0.22100775 0.52793386 0.25756455 0.11133734 -0.02599809 -0.46321298
61 62 63 64
0.04494190 0.57151345 0.81851928 0.45665063
> postscript(file="/var/wessaorg/rcomp/tmp/6ajba1321898965.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 = 64
Frequency = 1
lag(myerror, k = 1) myerror
0 0.52793386 NA
1 0.15503843 0.52793386
2 -0.20920822 0.15503843
3 -0.80840477 -0.20920822
4 0.60287784 -0.80840477
5 0.35369839 0.60287784
6 0.10474068 0.35369839
7 -0.09019604 0.10474068
8 0.18445094 -0.09019604
9 -1.49305162 0.18445094
10 0.73361661 -1.49305162
11 0.51214079 0.73361661
12 -0.30519670 0.51214079
13 0.48435427 -0.30519670
14 0.23700520 0.48435427
15 -1.15671299 0.23700520
16 0.40421788 -1.15671299
17 -1.35311644 0.40421788
18 -0.57501838 -1.35311644
19 -0.53143880 -0.57501838
20 -0.15188769 -0.53143880
21 0.29454748 -0.15188769
22 -0.04185017 0.29454748
23 0.30828842 -0.04185017
24 0.60807025 0.30828842
25 -1.58173655 0.60807025
26 -1.23642325 -1.58173655
27 -1.19986645 -1.23642325
28 0.68126674 -1.19986645
29 -0.06957768 0.68126674
30 0.27832828 -0.06957768
31 0.91682674 0.27832828
32 1.29454748 0.91682674
33 0.31714159 1.29454748
34 -0.47908893 0.31714159
35 -0.54517974 -0.47908893
36 -0.02599809 -0.54517974
37 0.50511801 -0.02599809
38 -0.47206614 0.50511801
39 0.72701995 -0.47206614
40 0.22100775 0.72701995
41 0.53690853 0.22100775
42 -0.72826838 0.53690853
43 0.82089729 -0.72826838
44 0.04494190 0.82089729
45 0.33110428 0.04494190
46 0.49137706 0.33110428
47 0.11805550 0.49137706
48 -0.85912865 0.11805550
49 -0.55395002 -0.85912865
50 0.19559923 -0.55395002
51 -1.38533309 0.19559923
52 0.41307105 -1.38533309
53 -0.07175130 0.41307105
54 0.22100775 -0.07175130
55 0.52793386 0.22100775
56 0.25756455 0.52793386
57 0.11133734 0.25756455
58 -0.02599809 0.11133734
59 -0.46321298 -0.02599809
60 0.04494190 -0.46321298
61 0.57151345 0.04494190
62 0.81851928 0.57151345
63 0.45665063 0.81851928
64 NA 0.45665063
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.15503843 0.52793386
[2,] -0.20920822 0.15503843
[3,] -0.80840477 -0.20920822
[4,] 0.60287784 -0.80840477
[5,] 0.35369839 0.60287784
[6,] 0.10474068 0.35369839
[7,] -0.09019604 0.10474068
[8,] 0.18445094 -0.09019604
[9,] -1.49305162 0.18445094
[10,] 0.73361661 -1.49305162
[11,] 0.51214079 0.73361661
[12,] -0.30519670 0.51214079
[13,] 0.48435427 -0.30519670
[14,] 0.23700520 0.48435427
[15,] -1.15671299 0.23700520
[16,] 0.40421788 -1.15671299
[17,] -1.35311644 0.40421788
[18,] -0.57501838 -1.35311644
[19,] -0.53143880 -0.57501838
[20,] -0.15188769 -0.53143880
[21,] 0.29454748 -0.15188769
[22,] -0.04185017 0.29454748
[23,] 0.30828842 -0.04185017
[24,] 0.60807025 0.30828842
[25,] -1.58173655 0.60807025
[26,] -1.23642325 -1.58173655
[27,] -1.19986645 -1.23642325
[28,] 0.68126674 -1.19986645
[29,] -0.06957768 0.68126674
[30,] 0.27832828 -0.06957768
[31,] 0.91682674 0.27832828
[32,] 1.29454748 0.91682674
[33,] 0.31714159 1.29454748
[34,] -0.47908893 0.31714159
[35,] -0.54517974 -0.47908893
[36,] -0.02599809 -0.54517974
[37,] 0.50511801 -0.02599809
[38,] -0.47206614 0.50511801
[39,] 0.72701995 -0.47206614
[40,] 0.22100775 0.72701995
[41,] 0.53690853 0.22100775
[42,] -0.72826838 0.53690853
[43,] 0.82089729 -0.72826838
[44,] 0.04494190 0.82089729
[45,] 0.33110428 0.04494190
[46,] 0.49137706 0.33110428
[47,] 0.11805550 0.49137706
[48,] -0.85912865 0.11805550
[49,] -0.55395002 -0.85912865
[50,] 0.19559923 -0.55395002
[51,] -1.38533309 0.19559923
[52,] 0.41307105 -1.38533309
[53,] -0.07175130 0.41307105
[54,] 0.22100775 -0.07175130
[55,] 0.52793386 0.22100775
[56,] 0.25756455 0.52793386
[57,] 0.11133734 0.25756455
[58,] -0.02599809 0.11133734
[59,] -0.46321298 -0.02599809
[60,] 0.04494190 -0.46321298
[61,] 0.57151345 0.04494190
[62,] 0.81851928 0.57151345
[63,] 0.45665063 0.81851928
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.15503843 0.52793386
2 -0.20920822 0.15503843
3 -0.80840477 -0.20920822
4 0.60287784 -0.80840477
5 0.35369839 0.60287784
6 0.10474068 0.35369839
7 -0.09019604 0.10474068
8 0.18445094 -0.09019604
9 -1.49305162 0.18445094
10 0.73361661 -1.49305162
11 0.51214079 0.73361661
12 -0.30519670 0.51214079
13 0.48435427 -0.30519670
14 0.23700520 0.48435427
15 -1.15671299 0.23700520
16 0.40421788 -1.15671299
17 -1.35311644 0.40421788
18 -0.57501838 -1.35311644
19 -0.53143880 -0.57501838
20 -0.15188769 -0.53143880
21 0.29454748 -0.15188769
22 -0.04185017 0.29454748
23 0.30828842 -0.04185017
24 0.60807025 0.30828842
25 -1.58173655 0.60807025
26 -1.23642325 -1.58173655
27 -1.19986645 -1.23642325
28 0.68126674 -1.19986645
29 -0.06957768 0.68126674
30 0.27832828 -0.06957768
31 0.91682674 0.27832828
32 1.29454748 0.91682674
33 0.31714159 1.29454748
34 -0.47908893 0.31714159
35 -0.54517974 -0.47908893
36 -0.02599809 -0.54517974
37 0.50511801 -0.02599809
38 -0.47206614 0.50511801
39 0.72701995 -0.47206614
40 0.22100775 0.72701995
41 0.53690853 0.22100775
42 -0.72826838 0.53690853
43 0.82089729 -0.72826838
44 0.04494190 0.82089729
45 0.33110428 0.04494190
46 0.49137706 0.33110428
47 0.11805550 0.49137706
48 -0.85912865 0.11805550
49 -0.55395002 -0.85912865
50 0.19559923 -0.55395002
51 -1.38533309 0.19559923
52 0.41307105 -1.38533309
53 -0.07175130 0.41307105
54 0.22100775 -0.07175130
55 0.52793386 0.22100775
56 0.25756455 0.52793386
57 0.11133734 0.25756455
58 -0.02599809 0.11133734
59 -0.46321298 -0.02599809
60 0.04494190 -0.46321298
61 0.57151345 0.04494190
62 0.81851928 0.57151345
63 0.45665063 0.81851928
> 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/wessaorg/rcomp/tmp/7t25e1321898965.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/wessaorg/rcomp/tmp/8l6te1321898965.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/wessaorg/rcomp/tmp/9f9ts1321898965.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/wessaorg/rcomp/tmp/10hcmr1321898965.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/11di7x1321898965.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/wessaorg/rcomp/tmp/129crz1321898965.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/wessaorg/rcomp/tmp/13sac31321898965.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/wessaorg/rcomp/tmp/14tndm1321898965.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/wessaorg/rcomp/tmp/15qj1b1321898965.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/wessaorg/rcomp/tmp/16pvq41321898965.tab")
+ }
>
> try(system("convert tmp/1t8ff1321898965.ps tmp/1t8ff1321898965.png",intern=TRUE))
character(0)
> try(system("convert tmp/2d8it1321898965.ps tmp/2d8it1321898965.png",intern=TRUE))
character(0)
> try(system("convert tmp/3a0wf1321898965.ps tmp/3a0wf1321898965.png",intern=TRUE))
character(0)
> try(system("convert tmp/4kq5t1321898965.ps tmp/4kq5t1321898965.png",intern=TRUE))
character(0)
> try(system("convert tmp/5qgjc1321898965.ps tmp/5qgjc1321898965.png",intern=TRUE))
character(0)
> try(system("convert tmp/6ajba1321898965.ps tmp/6ajba1321898965.png",intern=TRUE))
character(0)
> try(system("convert tmp/7t25e1321898965.ps tmp/7t25e1321898965.png",intern=TRUE))
character(0)
> try(system("convert tmp/8l6te1321898965.ps tmp/8l6te1321898965.png",intern=TRUE))
character(0)
> try(system("convert tmp/9f9ts1321898965.ps tmp/9f9ts1321898965.png",intern=TRUE))
character(0)
> try(system("convert tmp/10hcmr1321898965.ps tmp/10hcmr1321898965.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.170 0.473 3.656