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(8.4,1.8,8.4,1.6,8.4,1.9,8.6,1.7,8.9,1.6,8.8,1.3,8.3,1.1,7.5,1.9,7.2,2.6,7.4,2.3,8.8,2.4,9.3,2.2,9.3,2,8.7,2.9,8.2,2.6,8.3,2.3,8.5,2.3,8.6,2.6,8.5,3.1,8.2,2.8,8.1,2.5,7.9,2.9,8.6,3.1,8.7,3.1,8.7,3.2,8.5,2.5,8.4,2.6,8.5,2.9,8.7,2.6,8.7,2.4,8.6,1.7,8.5,2,8.3,2.2,8,1.9,8.2,1.6,8.1,1.6,8.1,1.2,8,1.2,7.9,1.5,7.9,1.6,8,1.7,8,1.8,7.9,1.8,8,1.8,7.7,1.3,7.2,1.3,7.5,1.4,7.3,1.1,7,1.5,7,2.2,7,2.9,7.2,3.1,7.3,3.5,7.1,3.6,6.8,4.4,6.4,4.2,6.1,5.2,6.5,5.8,7.7,5.9,7.9,5.4,7.5,5.5),dim=c(2,61),dimnames=list(c('Twk','Ncp'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('Twk','Ncp'),1:61))
> 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 = 'Include Monthly Dummies'
> par1 = '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
Twk Ncp M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 8.4 1.8 1 0 0 0 0 0 0 0 0 0 0
2 8.4 1.6 0 1 0 0 0 0 0 0 0 0 0
3 8.4 1.9 0 0 1 0 0 0 0 0 0 0 0
4 8.6 1.7 0 0 0 1 0 0 0 0 0 0 0
5 8.9 1.6 0 0 0 0 1 0 0 0 0 0 0
6 8.8 1.3 0 0 0 0 0 1 0 0 0 0 0
7 8.3 1.1 0 0 0 0 0 0 1 0 0 0 0
8 7.5 1.9 0 0 0 0 0 0 0 1 0 0 0
9 7.2 2.6 0 0 0 0 0 0 0 0 1 0 0
10 7.4 2.3 0 0 0 0 0 0 0 0 0 1 0
11 8.8 2.4 0 0 0 0 0 0 0 0 0 0 1
12 9.3 2.2 0 0 0 0 0 0 0 0 0 0 0
13 9.3 2.0 1 0 0 0 0 0 0 0 0 0 0
14 8.7 2.9 0 1 0 0 0 0 0 0 0 0 0
15 8.2 2.6 0 0 1 0 0 0 0 0 0 0 0
16 8.3 2.3 0 0 0 1 0 0 0 0 0 0 0
17 8.5 2.3 0 0 0 0 1 0 0 0 0 0 0
18 8.6 2.6 0 0 0 0 0 1 0 0 0 0 0
19 8.5 3.1 0 0 0 0 0 0 1 0 0 0 0
20 8.2 2.8 0 0 0 0 0 0 0 1 0 0 0
21 8.1 2.5 0 0 0 0 0 0 0 0 1 0 0
22 7.9 2.9 0 0 0 0 0 0 0 0 0 1 0
23 8.6 3.1 0 0 0 0 0 0 0 0 0 0 1
24 8.7 3.1 0 0 0 0 0 0 0 0 0 0 0
25 8.7 3.2 1 0 0 0 0 0 0 0 0 0 0
26 8.5 2.5 0 1 0 0 0 0 0 0 0 0 0
27 8.4 2.6 0 0 1 0 0 0 0 0 0 0 0
28 8.5 2.9 0 0 0 1 0 0 0 0 0 0 0
29 8.7 2.6 0 0 0 0 1 0 0 0 0 0 0
30 8.7 2.4 0 0 0 0 0 1 0 0 0 0 0
31 8.6 1.7 0 0 0 0 0 0 1 0 0 0 0
32 8.5 2.0 0 0 0 0 0 0 0 1 0 0 0
33 8.3 2.2 0 0 0 0 0 0 0 0 1 0 0
34 8.0 1.9 0 0 0 0 0 0 0 0 0 1 0
35 8.2 1.6 0 0 0 0 0 0 0 0 0 0 1
36 8.1 1.6 0 0 0 0 0 0 0 0 0 0 0
37 8.1 1.2 1 0 0 0 0 0 0 0 0 0 0
38 8.0 1.2 0 1 0 0 0 0 0 0 0 0 0
39 7.9 1.5 0 0 1 0 0 0 0 0 0 0 0
40 7.9 1.6 0 0 0 1 0 0 0 0 0 0 0
41 8.0 1.7 0 0 0 0 1 0 0 0 0 0 0
42 8.0 1.8 0 0 0 0 0 1 0 0 0 0 0
43 7.9 1.8 0 0 0 0 0 0 1 0 0 0 0
44 8.0 1.8 0 0 0 0 0 0 0 1 0 0 0
45 7.7 1.3 0 0 0 0 0 0 0 0 1 0 0
46 7.2 1.3 0 0 0 0 0 0 0 0 0 1 0
47 7.5 1.4 0 0 0 0 0 0 0 0 0 0 1
48 7.3 1.1 0 0 0 0 0 0 0 0 0 0 0
49 7.0 1.5 1 0 0 0 0 0 0 0 0 0 0
50 7.0 2.2 0 1 0 0 0 0 0 0 0 0 0
51 7.0 2.9 0 0 1 0 0 0 0 0 0 0 0
52 7.2 3.1 0 0 0 1 0 0 0 0 0 0 0
53 7.3 3.5 0 0 0 0 1 0 0 0 0 0 0
54 7.1 3.6 0 0 0 0 0 1 0 0 0 0 0
55 6.8 4.4 0 0 0 0 0 0 1 0 0 0 0
56 6.4 4.2 0 0 0 0 0 0 0 1 0 0 0
57 6.1 5.2 0 0 0 0 0 0 0 0 1 0 0
58 6.5 5.8 0 0 0 0 0 0 0 0 0 1 0
59 7.7 5.9 0 0 0 0 0 0 0 0 0 0 1
60 7.9 5.4 0 0 0 0 0 0 0 0 0 0 0
61 7.5 5.5 1 0 0 0 0 0 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Ncp M1 M2 M3 M4
8.85125 -0.22062 -0.12569 -0.27237 -0.36383 -0.23942
M5 M6 M7 M8 M9 M10
-0.05501 -0.09501 -0.29736 -0.57089 -0.76235 -0.82470
M11
-0.05588
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.3946 -0.3608 0.1741 0.4774 1.0157
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 8.85125 0.35357 25.034 < 2e-16 ***
Ncp -0.22062 0.07344 -3.004 0.00423 **
M1 -0.12569 0.39784 -0.316 0.75343
M2 -0.27237 0.41771 -0.652 0.51748
M3 -0.36383 0.41632 -0.874 0.38651
M4 -0.23942 0.41622 -0.575 0.56783
M5 -0.05501 0.41613 -0.132 0.89538
M6 -0.09501 0.41613 -0.228 0.82037
M7 -0.29736 0.41582 -0.715 0.47800
M8 -0.57089 0.41551 -1.374 0.17584
M9 -0.76235 0.41542 -1.835 0.07269 .
M10 -0.82470 0.41555 -1.985 0.05292 .
M11 -0.05588 0.41564 -0.134 0.89362
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.6568 on 48 degrees of freedom
Multiple R-squared: 0.3, Adjusted R-squared: 0.125
F-statistic: 1.714 on 12 and 48 DF, p-value: 0.09314
> 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.205080273 0.410160547 0.7949197
[2,] 0.122295670 0.244591340 0.8777043
[3,] 0.058138421 0.116276842 0.9418616
[4,] 0.028832758 0.057665517 0.9711672
[5,] 0.027415860 0.054831720 0.9725841
[6,] 0.041356793 0.082713587 0.9586432
[7,] 0.027341373 0.054682745 0.9726586
[8,] 0.016060711 0.032121422 0.9839393
[9,] 0.016043972 0.032087943 0.9839560
[10,] 0.012056717 0.024113434 0.9879433
[11,] 0.008268237 0.016536475 0.9917318
[12,] 0.005484242 0.010968484 0.9945158
[13,] 0.003809230 0.007618460 0.9961908
[14,] 0.002717462 0.005434923 0.9972825
[15,] 0.002132403 0.004264805 0.9978676
[16,] 0.001713276 0.003426552 0.9982867
[17,] 0.004074993 0.008149986 0.9959250
[18,] 0.010957665 0.021915330 0.9890423
[19,] 0.011524267 0.023048535 0.9884757
[20,] 0.009738801 0.019477603 0.9902612
[21,] 0.014436934 0.028873867 0.9855631
[22,] 0.014743229 0.029486458 0.9852568
[23,] 0.014743334 0.029486669 0.9852567
[24,] 0.011924473 0.023848945 0.9880755
[25,] 0.009004279 0.018008557 0.9909957
[26,] 0.007717970 0.015435940 0.9922820
[27,] 0.007900066 0.015800133 0.9920999
[28,] 0.008468720 0.016937440 0.9915313
[29,] 0.029675220 0.059350440 0.9703248
[30,] 0.295493292 0.590986584 0.7045067
> postscript(file="/var/www/html/rcomp/tmp/1qhtm1258626511.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/24gek1258626511.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/3wk1z1258626511.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/4iafc1258626511.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/5mgza1258626511.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 = 61
Frequency = 1
1 2 3 4 5 6
0.07154885 0.17410470 0.33175392 0.36321857 0.45674475 0.33056019
7 8 9 10 11 12
-0.01121207 -0.36119373 -0.31529843 -0.11913221 0.53410470 0.93410470
13 14 15 16 17 18
1.01567189 0.76090447 0.28618456 0.19558770 0.21117539 0.41735995
19 20 21 22 23 24
0.63001834 0.53735995 0.56264005 0.51323691 0.48853535 0.53265839
25 26 27 28 29 30
0.68041014 0.47265839 0.48618456 0.52795682 0.47735995 0.47323691
31 32 33 34 35 36
0.42115705 0.66086779 0.69645549 0.39262171 -0.24238746 -0.39826442
37 38 39 40 41 42
-0.36082027 -0.31414138 -0.25649216 -0.35884295 -0.42119373 -0.35913221
43 44 45 46 47 48
-0.25678143 0.11674475 -0.10209820 -0.53974742 -0.98651050 -1.30857202
49 50 51 52 53 54
-1.39463571 -1.09352618 -0.84763088 -0.72792014 -0.72408636 -0.86202484
55 56 57 58 59 60
-0.78318189 -0.95377876 -0.84169890 -0.24697899 0.20625792 0.24007336
61
-0.01217489
> postscript(file="/var/www/html/rcomp/tmp/6bopo1258626511.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 = 61
Frequency = 1
lag(myerror, k = 1) myerror
0 0.07154885 NA
1 0.17410470 0.07154885
2 0.33175392 0.17410470
3 0.36321857 0.33175392
4 0.45674475 0.36321857
5 0.33056019 0.45674475
6 -0.01121207 0.33056019
7 -0.36119373 -0.01121207
8 -0.31529843 -0.36119373
9 -0.11913221 -0.31529843
10 0.53410470 -0.11913221
11 0.93410470 0.53410470
12 1.01567189 0.93410470
13 0.76090447 1.01567189
14 0.28618456 0.76090447
15 0.19558770 0.28618456
16 0.21117539 0.19558770
17 0.41735995 0.21117539
18 0.63001834 0.41735995
19 0.53735995 0.63001834
20 0.56264005 0.53735995
21 0.51323691 0.56264005
22 0.48853535 0.51323691
23 0.53265839 0.48853535
24 0.68041014 0.53265839
25 0.47265839 0.68041014
26 0.48618456 0.47265839
27 0.52795682 0.48618456
28 0.47735995 0.52795682
29 0.47323691 0.47735995
30 0.42115705 0.47323691
31 0.66086779 0.42115705
32 0.69645549 0.66086779
33 0.39262171 0.69645549
34 -0.24238746 0.39262171
35 -0.39826442 -0.24238746
36 -0.36082027 -0.39826442
37 -0.31414138 -0.36082027
38 -0.25649216 -0.31414138
39 -0.35884295 -0.25649216
40 -0.42119373 -0.35884295
41 -0.35913221 -0.42119373
42 -0.25678143 -0.35913221
43 0.11674475 -0.25678143
44 -0.10209820 0.11674475
45 -0.53974742 -0.10209820
46 -0.98651050 -0.53974742
47 -1.30857202 -0.98651050
48 -1.39463571 -1.30857202
49 -1.09352618 -1.39463571
50 -0.84763088 -1.09352618
51 -0.72792014 -0.84763088
52 -0.72408636 -0.72792014
53 -0.86202484 -0.72408636
54 -0.78318189 -0.86202484
55 -0.95377876 -0.78318189
56 -0.84169890 -0.95377876
57 -0.24697899 -0.84169890
58 0.20625792 -0.24697899
59 0.24007336 0.20625792
60 -0.01217489 0.24007336
61 NA -0.01217489
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.17410470 0.07154885
[2,] 0.33175392 0.17410470
[3,] 0.36321857 0.33175392
[4,] 0.45674475 0.36321857
[5,] 0.33056019 0.45674475
[6,] -0.01121207 0.33056019
[7,] -0.36119373 -0.01121207
[8,] -0.31529843 -0.36119373
[9,] -0.11913221 -0.31529843
[10,] 0.53410470 -0.11913221
[11,] 0.93410470 0.53410470
[12,] 1.01567189 0.93410470
[13,] 0.76090447 1.01567189
[14,] 0.28618456 0.76090447
[15,] 0.19558770 0.28618456
[16,] 0.21117539 0.19558770
[17,] 0.41735995 0.21117539
[18,] 0.63001834 0.41735995
[19,] 0.53735995 0.63001834
[20,] 0.56264005 0.53735995
[21,] 0.51323691 0.56264005
[22,] 0.48853535 0.51323691
[23,] 0.53265839 0.48853535
[24,] 0.68041014 0.53265839
[25,] 0.47265839 0.68041014
[26,] 0.48618456 0.47265839
[27,] 0.52795682 0.48618456
[28,] 0.47735995 0.52795682
[29,] 0.47323691 0.47735995
[30,] 0.42115705 0.47323691
[31,] 0.66086779 0.42115705
[32,] 0.69645549 0.66086779
[33,] 0.39262171 0.69645549
[34,] -0.24238746 0.39262171
[35,] -0.39826442 -0.24238746
[36,] -0.36082027 -0.39826442
[37,] -0.31414138 -0.36082027
[38,] -0.25649216 -0.31414138
[39,] -0.35884295 -0.25649216
[40,] -0.42119373 -0.35884295
[41,] -0.35913221 -0.42119373
[42,] -0.25678143 -0.35913221
[43,] 0.11674475 -0.25678143
[44,] -0.10209820 0.11674475
[45,] -0.53974742 -0.10209820
[46,] -0.98651050 -0.53974742
[47,] -1.30857202 -0.98651050
[48,] -1.39463571 -1.30857202
[49,] -1.09352618 -1.39463571
[50,] -0.84763088 -1.09352618
[51,] -0.72792014 -0.84763088
[52,] -0.72408636 -0.72792014
[53,] -0.86202484 -0.72408636
[54,] -0.78318189 -0.86202484
[55,] -0.95377876 -0.78318189
[56,] -0.84169890 -0.95377876
[57,] -0.24697899 -0.84169890
[58,] 0.20625792 -0.24697899
[59,] 0.24007336 0.20625792
[60,] -0.01217489 0.24007336
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.17410470 0.07154885
2 0.33175392 0.17410470
3 0.36321857 0.33175392
4 0.45674475 0.36321857
5 0.33056019 0.45674475
6 -0.01121207 0.33056019
7 -0.36119373 -0.01121207
8 -0.31529843 -0.36119373
9 -0.11913221 -0.31529843
10 0.53410470 -0.11913221
11 0.93410470 0.53410470
12 1.01567189 0.93410470
13 0.76090447 1.01567189
14 0.28618456 0.76090447
15 0.19558770 0.28618456
16 0.21117539 0.19558770
17 0.41735995 0.21117539
18 0.63001834 0.41735995
19 0.53735995 0.63001834
20 0.56264005 0.53735995
21 0.51323691 0.56264005
22 0.48853535 0.51323691
23 0.53265839 0.48853535
24 0.68041014 0.53265839
25 0.47265839 0.68041014
26 0.48618456 0.47265839
27 0.52795682 0.48618456
28 0.47735995 0.52795682
29 0.47323691 0.47735995
30 0.42115705 0.47323691
31 0.66086779 0.42115705
32 0.69645549 0.66086779
33 0.39262171 0.69645549
34 -0.24238746 0.39262171
35 -0.39826442 -0.24238746
36 -0.36082027 -0.39826442
37 -0.31414138 -0.36082027
38 -0.25649216 -0.31414138
39 -0.35884295 -0.25649216
40 -0.42119373 -0.35884295
41 -0.35913221 -0.42119373
42 -0.25678143 -0.35913221
43 0.11674475 -0.25678143
44 -0.10209820 0.11674475
45 -0.53974742 -0.10209820
46 -0.98651050 -0.53974742
47 -1.30857202 -0.98651050
48 -1.39463571 -1.30857202
49 -1.09352618 -1.39463571
50 -0.84763088 -1.09352618
51 -0.72792014 -0.84763088
52 -0.72408636 -0.72792014
53 -0.86202484 -0.72408636
54 -0.78318189 -0.86202484
55 -0.95377876 -0.78318189
56 -0.84169890 -0.95377876
57 -0.24697899 -0.84169890
58 0.20625792 -0.24697899
59 0.24007336 0.20625792
60 -0.01217489 0.24007336
> 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/7t2mn1258626511.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/899la1258626511.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/9p2t31258626511.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/109x3b1258626511.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/1113hx1258626511.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/12v6qo1258626511.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/13e9o11258626511.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/14mgmk1258626511.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/15bd731258626511.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/16peip1258626511.tab")
+ }
>
> system("convert tmp/1qhtm1258626511.ps tmp/1qhtm1258626511.png")
> system("convert tmp/24gek1258626511.ps tmp/24gek1258626511.png")
> system("convert tmp/3wk1z1258626511.ps tmp/3wk1z1258626511.png")
> system("convert tmp/4iafc1258626511.ps tmp/4iafc1258626511.png")
> system("convert tmp/5mgza1258626511.ps tmp/5mgza1258626511.png")
> system("convert tmp/6bopo1258626511.ps tmp/6bopo1258626511.png")
> system("convert tmp/7t2mn1258626511.ps tmp/7t2mn1258626511.png")
> system("convert tmp/899la1258626511.ps tmp/899la1258626511.png")
> system("convert tmp/9p2t31258626511.ps tmp/9p2t31258626511.png")
> system("convert tmp/109x3b1258626511.ps tmp/109x3b1258626511.png")
>
>
> proc.time()
user system elapsed
2.379 1.564 3.765