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(2.155,22.782,2.172,19.169,2.15,13.807,2.533,29.743,2.058,25.591,2.16,29.096,2.26,26.482,2.498,22.405,2.695,27.044,2.799,17.97,2.947,18.73,2.93,19.684,2.318,19.785,2.54,18.479,2.57,10.698,2.669,31.956,2.45,29.506,2.842,34.506,3.44,27.165,2.678,26.736,2.981,23.691,2.26,18.157,2.844,17.328,2.546,18.205,2.456,20.995,2.295,17.382,2.379,9.367,2.479,31.124,2.057,26.551,2.28,30.651,2.351,25.859,2.276,25.1,2.548,25.778,2.311,20.418,2.201,18.688,2.725,20.424,2.408,24.776,2.139,19.814,1.898,12.738,2.537,31.566,2.069,30.111,2.063,30.019,2.524,31.934,2.437,25.826,2.189,26.835,2.793,20.205,2.074,17.789,2.622,20.52,2.278,22.518,2.144,15.572,2.427,11.509,2.139,25.447,1.828,24.09,2.072,27.786,1.8,26.195,1.758,20.516,2.246,22.759,1.987,19.028,1.868,16.971,2.514,20.036,2.121,22.485),dim=c(2,61),dimnames=list(c('geb','aut'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('geb','aut'),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
geb aut M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 2.155 22.782 1 0 0 0 0 0 0 0 0 0 0
2 2.172 19.169 0 1 0 0 0 0 0 0 0 0 0
3 2.150 13.807 0 0 1 0 0 0 0 0 0 0 0
4 2.533 29.743 0 0 0 1 0 0 0 0 0 0 0
5 2.058 25.591 0 0 0 0 1 0 0 0 0 0 0
6 2.160 29.096 0 0 0 0 0 1 0 0 0 0 0
7 2.260 26.482 0 0 0 0 0 0 1 0 0 0 0
8 2.498 22.405 0 0 0 0 0 0 0 1 0 0 0
9 2.695 27.044 0 0 0 0 0 0 0 0 1 0 0
10 2.799 17.970 0 0 0 0 0 0 0 0 0 1 0
11 2.947 18.730 0 0 0 0 0 0 0 0 0 0 1
12 2.930 19.684 0 0 0 0 0 0 0 0 0 0 0
13 2.318 19.785 1 0 0 0 0 0 0 0 0 0 0
14 2.540 18.479 0 1 0 0 0 0 0 0 0 0 0
15 2.570 10.698 0 0 1 0 0 0 0 0 0 0 0
16 2.669 31.956 0 0 0 1 0 0 0 0 0 0 0
17 2.450 29.506 0 0 0 0 1 0 0 0 0 0 0
18 2.842 34.506 0 0 0 0 0 1 0 0 0 0 0
19 3.440 27.165 0 0 0 0 0 0 1 0 0 0 0
20 2.678 26.736 0 0 0 0 0 0 0 1 0 0 0
21 2.981 23.691 0 0 0 0 0 0 0 0 1 0 0
22 2.260 18.157 0 0 0 0 0 0 0 0 0 1 0
23 2.844 17.328 0 0 0 0 0 0 0 0 0 0 1
24 2.546 18.205 0 0 0 0 0 0 0 0 0 0 0
25 2.456 20.995 1 0 0 0 0 0 0 0 0 0 0
26 2.295 17.382 0 1 0 0 0 0 0 0 0 0 0
27 2.379 9.367 0 0 1 0 0 0 0 0 0 0 0
28 2.479 31.124 0 0 0 1 0 0 0 0 0 0 0
29 2.057 26.551 0 0 0 0 1 0 0 0 0 0 0
30 2.280 30.651 0 0 0 0 0 1 0 0 0 0 0
31 2.351 25.859 0 0 0 0 0 0 1 0 0 0 0
32 2.276 25.100 0 0 0 0 0 0 0 1 0 0 0
33 2.548 25.778 0 0 0 0 0 0 0 0 1 0 0
34 2.311 20.418 0 0 0 0 0 0 0 0 0 1 0
35 2.201 18.688 0 0 0 0 0 0 0 0 0 0 1
36 2.725 20.424 0 0 0 0 0 0 0 0 0 0 0
37 2.408 24.776 1 0 0 0 0 0 0 0 0 0 0
38 2.139 19.814 0 1 0 0 0 0 0 0 0 0 0
39 1.898 12.738 0 0 1 0 0 0 0 0 0 0 0
40 2.537 31.566 0 0 0 1 0 0 0 0 0 0 0
41 2.069 30.111 0 0 0 0 1 0 0 0 0 0 0
42 2.063 30.019 0 0 0 0 0 1 0 0 0 0 0
43 2.524 31.934 0 0 0 0 0 0 1 0 0 0 0
44 2.437 25.826 0 0 0 0 0 0 0 1 0 0 0
45 2.189 26.835 0 0 0 0 0 0 0 0 1 0 0
46 2.793 20.205 0 0 0 0 0 0 0 0 0 1 0
47 2.074 17.789 0 0 0 0 0 0 0 0 0 0 1
48 2.622 20.520 0 0 0 0 0 0 0 0 0 0 0
49 2.278 22.518 1 0 0 0 0 0 0 0 0 0 0
50 2.144 15.572 0 1 0 0 0 0 0 0 0 0 0
51 2.427 11.509 0 0 1 0 0 0 0 0 0 0 0
52 2.139 25.447 0 0 0 1 0 0 0 0 0 0 0
53 1.828 24.090 0 0 0 0 1 0 0 0 0 0 0
54 2.072 27.786 0 0 0 0 0 1 0 0 0 0 0
55 1.800 26.195 0 0 0 0 0 0 1 0 0 0 0
56 1.758 20.516 0 0 0 0 0 0 0 1 0 0 0
57 2.246 22.759 0 0 0 0 0 0 0 0 1 0 0
58 1.987 19.028 0 0 0 0 0 0 0 0 0 1 0
59 1.868 16.971 0 0 0 0 0 0 0 0 0 0 1
60 2.514 20.036 0 0 0 0 0 0 0 0 0 0 0
61 2.121 22.485 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) aut M1 M2 M3 M4
1.65565 0.05117 -0.50341 -0.32290 0.03441 -0.71756
M5 M6 M7 M8 M9 M10
-0.95343 -0.92830 -0.58910 -0.56021 -0.41433 -0.20577
M11
-0.18479
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.6068 -0.1668 -0.0264 0.1534 0.9835
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.65565 0.46226 3.582 0.000795 ***
aut 0.05117 0.02229 2.296 0.026111 *
M1 -0.50341 0.19649 -2.562 0.013599 *
M2 -0.32290 0.20071 -1.609 0.114220
M3 0.03441 0.26807 0.128 0.898410
M4 -0.71756 0.30081 -2.385 0.021053 *
M5 -0.95343 0.25698 -3.710 0.000538 ***
M6 -0.92830 0.30836 -3.010 0.004150 **
M7 -0.58910 0.26216 -2.247 0.029267 *
M8 -0.56021 0.21962 -2.551 0.013992 *
M9 -0.41433 0.23153 -1.790 0.079839 .
M10 -0.20577 0.19762 -1.041 0.302984
M11 -0.18479 0.20151 -0.917 0.363723
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.3117 on 48 degrees of freedom
Multiple R-squared: 0.2762, Adjusted R-squared: 0.09522
F-statistic: 1.526 on 12 and 48 DF, p-value: 0.1477
> 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.2086661 0.41733224 0.79133388
[2,] 0.3147251 0.62945013 0.68527493
[3,] 0.3913727 0.78274532 0.60862734
[4,] 0.9471083 0.10578342 0.05289171
[5,] 0.9230304 0.15393926 0.07696963
[6,] 0.9581296 0.08374082 0.04187041
[7,] 0.9552925 0.08941504 0.04470752
[8,] 0.9857880 0.02842390 0.01421195
[9,] 0.9780903 0.04381943 0.02190972
[10,] 0.9746070 0.05078590 0.02539295
[11,] 0.9593063 0.08138731 0.04069366
[12,] 0.9570491 0.08590182 0.04295091
[13,] 0.9317611 0.13647781 0.06823890
[14,] 0.9027250 0.19454993 0.09727496
[15,] 0.8633168 0.27336638 0.13668319
[16,] 0.9009999 0.19800024 0.09900012
[17,] 0.8716780 0.25664406 0.12832203
[18,] 0.8586322 0.28273553 0.14136777
[19,] 0.8223902 0.35521964 0.17760982
[20,] 0.8490460 0.30190805 0.15095403
[21,] 0.7904943 0.41901136 0.20950568
[22,] 0.7072029 0.58559425 0.29279713
[23,] 0.6656758 0.66864847 0.33432424
[24,] 0.8088708 0.38225839 0.19112920
[25,] 0.7221562 0.55568752 0.27784376
[26,] 0.6780882 0.64382356 0.32191178
[27,] 0.6151070 0.76978597 0.38489299
[28,] 0.4976486 0.99529724 0.50235138
[29,] 0.3985251 0.79705018 0.60147491
[30,] 0.8660589 0.26788220 0.13394110
> postscript(file="/var/www/html/rcomp/tmp/1hfv81258721917.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/2035e1258721917.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/3ypmw1258721917.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/4xal61258721917.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/56f1t1258721917.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.162909786 -0.141556513 -0.246506557 0.073071514 0.046381564 -0.056085441
7 8 9 10 11 12
-0.161531078 0.256176467 0.069944059 0.429662923 0.517793260 0.267194746
13 14 15 16 17 18
0.153436014 0.261748326 0.332569884 0.095840198 0.238064979 0.349104157
19 20 21 22 23 24
0.983522249 0.214574645 0.527505109 -0.118905200 0.486528599 -0.041130100
25 26 27 28 29 30
0.229524630 0.072877903 0.209672406 -0.051589330 -0.003738211 -0.015649244
31 32 33 34 35 36
-0.038654390 -0.103717070 -0.012279237 -0.183592505 -0.226057749 0.024331585
37 38 39 40 41 42
-0.011935654 -0.207558862 -0.443809640 -0.016204893 -0.173890713 -0.200312058
43 44 45 46 47 48
-0.176490470 0.020136099 -0.425362156 0.309305945 -0.307059126 -0.083580392
49 50 51 52 53 54
-0.026401848 0.014489147 0.148073907 -0.101117490 -0.106817620 -0.077057414
55 56 57 58 59 60
-0.606846311 -0.387170141 -0.159807775 -0.436471163 -0.471204984 -0.166815839
61
-0.181713356
> postscript(file="/var/www/html/rcomp/tmp/6vqhu1258721917.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.162909786 NA
1 -0.141556513 -0.162909786
2 -0.246506557 -0.141556513
3 0.073071514 -0.246506557
4 0.046381564 0.073071514
5 -0.056085441 0.046381564
6 -0.161531078 -0.056085441
7 0.256176467 -0.161531078
8 0.069944059 0.256176467
9 0.429662923 0.069944059
10 0.517793260 0.429662923
11 0.267194746 0.517793260
12 0.153436014 0.267194746
13 0.261748326 0.153436014
14 0.332569884 0.261748326
15 0.095840198 0.332569884
16 0.238064979 0.095840198
17 0.349104157 0.238064979
18 0.983522249 0.349104157
19 0.214574645 0.983522249
20 0.527505109 0.214574645
21 -0.118905200 0.527505109
22 0.486528599 -0.118905200
23 -0.041130100 0.486528599
24 0.229524630 -0.041130100
25 0.072877903 0.229524630
26 0.209672406 0.072877903
27 -0.051589330 0.209672406
28 -0.003738211 -0.051589330
29 -0.015649244 -0.003738211
30 -0.038654390 -0.015649244
31 -0.103717070 -0.038654390
32 -0.012279237 -0.103717070
33 -0.183592505 -0.012279237
34 -0.226057749 -0.183592505
35 0.024331585 -0.226057749
36 -0.011935654 0.024331585
37 -0.207558862 -0.011935654
38 -0.443809640 -0.207558862
39 -0.016204893 -0.443809640
40 -0.173890713 -0.016204893
41 -0.200312058 -0.173890713
42 -0.176490470 -0.200312058
43 0.020136099 -0.176490470
44 -0.425362156 0.020136099
45 0.309305945 -0.425362156
46 -0.307059126 0.309305945
47 -0.083580392 -0.307059126
48 -0.026401848 -0.083580392
49 0.014489147 -0.026401848
50 0.148073907 0.014489147
51 -0.101117490 0.148073907
52 -0.106817620 -0.101117490
53 -0.077057414 -0.106817620
54 -0.606846311 -0.077057414
55 -0.387170141 -0.606846311
56 -0.159807775 -0.387170141
57 -0.436471163 -0.159807775
58 -0.471204984 -0.436471163
59 -0.166815839 -0.471204984
60 -0.181713356 -0.166815839
61 NA -0.181713356
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.141556513 -0.162909786
[2,] -0.246506557 -0.141556513
[3,] 0.073071514 -0.246506557
[4,] 0.046381564 0.073071514
[5,] -0.056085441 0.046381564
[6,] -0.161531078 -0.056085441
[7,] 0.256176467 -0.161531078
[8,] 0.069944059 0.256176467
[9,] 0.429662923 0.069944059
[10,] 0.517793260 0.429662923
[11,] 0.267194746 0.517793260
[12,] 0.153436014 0.267194746
[13,] 0.261748326 0.153436014
[14,] 0.332569884 0.261748326
[15,] 0.095840198 0.332569884
[16,] 0.238064979 0.095840198
[17,] 0.349104157 0.238064979
[18,] 0.983522249 0.349104157
[19,] 0.214574645 0.983522249
[20,] 0.527505109 0.214574645
[21,] -0.118905200 0.527505109
[22,] 0.486528599 -0.118905200
[23,] -0.041130100 0.486528599
[24,] 0.229524630 -0.041130100
[25,] 0.072877903 0.229524630
[26,] 0.209672406 0.072877903
[27,] -0.051589330 0.209672406
[28,] -0.003738211 -0.051589330
[29,] -0.015649244 -0.003738211
[30,] -0.038654390 -0.015649244
[31,] -0.103717070 -0.038654390
[32,] -0.012279237 -0.103717070
[33,] -0.183592505 -0.012279237
[34,] -0.226057749 -0.183592505
[35,] 0.024331585 -0.226057749
[36,] -0.011935654 0.024331585
[37,] -0.207558862 -0.011935654
[38,] -0.443809640 -0.207558862
[39,] -0.016204893 -0.443809640
[40,] -0.173890713 -0.016204893
[41,] -0.200312058 -0.173890713
[42,] -0.176490470 -0.200312058
[43,] 0.020136099 -0.176490470
[44,] -0.425362156 0.020136099
[45,] 0.309305945 -0.425362156
[46,] -0.307059126 0.309305945
[47,] -0.083580392 -0.307059126
[48,] -0.026401848 -0.083580392
[49,] 0.014489147 -0.026401848
[50,] 0.148073907 0.014489147
[51,] -0.101117490 0.148073907
[52,] -0.106817620 -0.101117490
[53,] -0.077057414 -0.106817620
[54,] -0.606846311 -0.077057414
[55,] -0.387170141 -0.606846311
[56,] -0.159807775 -0.387170141
[57,] -0.436471163 -0.159807775
[58,] -0.471204984 -0.436471163
[59,] -0.166815839 -0.471204984
[60,] -0.181713356 -0.166815839
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.141556513 -0.162909786
2 -0.246506557 -0.141556513
3 0.073071514 -0.246506557
4 0.046381564 0.073071514
5 -0.056085441 0.046381564
6 -0.161531078 -0.056085441
7 0.256176467 -0.161531078
8 0.069944059 0.256176467
9 0.429662923 0.069944059
10 0.517793260 0.429662923
11 0.267194746 0.517793260
12 0.153436014 0.267194746
13 0.261748326 0.153436014
14 0.332569884 0.261748326
15 0.095840198 0.332569884
16 0.238064979 0.095840198
17 0.349104157 0.238064979
18 0.983522249 0.349104157
19 0.214574645 0.983522249
20 0.527505109 0.214574645
21 -0.118905200 0.527505109
22 0.486528599 -0.118905200
23 -0.041130100 0.486528599
24 0.229524630 -0.041130100
25 0.072877903 0.229524630
26 0.209672406 0.072877903
27 -0.051589330 0.209672406
28 -0.003738211 -0.051589330
29 -0.015649244 -0.003738211
30 -0.038654390 -0.015649244
31 -0.103717070 -0.038654390
32 -0.012279237 -0.103717070
33 -0.183592505 -0.012279237
34 -0.226057749 -0.183592505
35 0.024331585 -0.226057749
36 -0.011935654 0.024331585
37 -0.207558862 -0.011935654
38 -0.443809640 -0.207558862
39 -0.016204893 -0.443809640
40 -0.173890713 -0.016204893
41 -0.200312058 -0.173890713
42 -0.176490470 -0.200312058
43 0.020136099 -0.176490470
44 -0.425362156 0.020136099
45 0.309305945 -0.425362156
46 -0.307059126 0.309305945
47 -0.083580392 -0.307059126
48 -0.026401848 -0.083580392
49 0.014489147 -0.026401848
50 0.148073907 0.014489147
51 -0.101117490 0.148073907
52 -0.106817620 -0.101117490
53 -0.077057414 -0.106817620
54 -0.606846311 -0.077057414
55 -0.387170141 -0.606846311
56 -0.159807775 -0.387170141
57 -0.436471163 -0.159807775
58 -0.471204984 -0.436471163
59 -0.166815839 -0.471204984
60 -0.181713356 -0.166815839
> 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/75mbw1258721917.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/8duco1258721917.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/9h1q11258721917.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/105uek1258721917.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/11he3u1258721917.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/12gkdz1258721917.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/13kylk1258721917.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/14m6bo1258721917.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/15qf001258721917.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/16xz1c1258721917.tab")
+ }
>
> system("convert tmp/1hfv81258721917.ps tmp/1hfv81258721917.png")
> system("convert tmp/2035e1258721917.ps tmp/2035e1258721917.png")
> system("convert tmp/3ypmw1258721917.ps tmp/3ypmw1258721917.png")
> system("convert tmp/4xal61258721917.ps tmp/4xal61258721917.png")
> system("convert tmp/56f1t1258721917.ps tmp/56f1t1258721917.png")
> system("convert tmp/6vqhu1258721917.ps tmp/6vqhu1258721917.png")
> system("convert tmp/75mbw1258721917.ps tmp/75mbw1258721917.png")
> system("convert tmp/8duco1258721917.ps tmp/8duco1258721917.png")
> system("convert tmp/9h1q11258721917.ps tmp/9h1q11258721917.png")
> system("convert tmp/105uek1258721917.ps tmp/105uek1258721917.png")
>
>
> proc.time()
user system elapsed
2.383 1.548 2.773