R version 2.12.0 (2010-10-15)
Copyright (C) 2010 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(80900
+ ,0
+ ,35600
+ ,36700
+ ,174000
+ ,0
+ ,80900
+ ,35600
+ ,169422
+ ,0
+ ,174000
+ ,80900
+ ,153452
+ ,0
+ ,169422
+ ,174000
+ ,173570
+ ,0
+ ,153452
+ ,169422
+ ,193036
+ ,0
+ ,173570
+ ,153452
+ ,174652
+ ,0
+ ,193036
+ ,173570
+ ,105367
+ ,0
+ ,174652
+ ,193036
+ ,95963
+ ,0
+ ,105367
+ ,174652
+ ,82896
+ ,0
+ ,95963
+ ,105367
+ ,121747
+ ,0
+ ,82896
+ ,95963
+ ,120196
+ ,0
+ ,121747
+ ,82896
+ ,103983
+ ,0
+ ,120196
+ ,121747
+ ,81103
+ ,0
+ ,103983
+ ,120196
+ ,70944
+ ,0
+ ,81103
+ ,103983
+ ,57248
+ ,0
+ ,70944
+ ,81103
+ ,47830
+ ,0
+ ,57248
+ ,70944
+ ,60095
+ ,0
+ ,47830
+ ,57248
+ ,60931
+ ,0
+ ,60095
+ ,47830
+ ,82955
+ ,0
+ ,60931
+ ,60095
+ ,99559
+ ,0
+ ,82955
+ ,60931
+ ,77911
+ ,0
+ ,99559
+ ,82955
+ ,70753
+ ,0
+ ,77911
+ ,99559
+ ,69287
+ ,0
+ ,70753
+ ,77911
+ ,88426
+ ,0
+ ,69287
+ ,70753
+ ,91756
+ ,1
+ ,88426
+ ,69287
+ ,96933
+ ,1
+ ,91756
+ ,88426
+ ,174484
+ ,1
+ ,96933
+ ,91756
+ ,232595
+ ,1
+ ,174484
+ ,96933
+ ,266197
+ ,1
+ ,232595
+ ,174484
+ ,290435
+ ,1
+ ,266197
+ ,232595
+ ,304296
+ ,1
+ ,290435
+ ,266197
+ ,322310
+ ,1
+ ,304296
+ ,290435
+ ,415555
+ ,1
+ ,322310
+ ,304296
+ ,490042
+ ,1
+ ,415555
+ ,322310
+ ,545109
+ ,1
+ ,490042
+ ,415555
+ ,545720
+ ,1
+ ,545109
+ ,490042
+ ,505944
+ ,1
+ ,545720
+ ,545109
+ ,477930
+ ,1
+ ,505944
+ ,545720
+ ,466106
+ ,1
+ ,477930
+ ,505944
+ ,424476
+ ,1
+ ,466106
+ ,477930
+ ,383018
+ ,1
+ ,424476
+ ,466106
+ ,364696
+ ,1
+ ,383018
+ ,424476
+ ,391116
+ ,1
+ ,364696
+ ,383018
+ ,435721
+ ,1
+ ,391116
+ ,364696
+ ,511435
+ ,1
+ ,435721
+ ,391116
+ ,553997
+ ,1
+ ,511435
+ ,435721
+ ,555252
+ ,1
+ ,553997
+ ,511435
+ ,544897
+ ,1
+ ,555252
+ ,553997
+ ,540562
+ ,1
+ ,544897
+ ,555252
+ ,505282
+ ,1
+ ,540562
+ ,544897
+ ,507626
+ ,1
+ ,505282
+ ,540562
+ ,474427
+ ,1
+ ,507626
+ ,505282
+ ,469740
+ ,1
+ ,474427
+ ,507626
+ ,491480
+ ,1
+ ,469740
+ ,474427
+ ,538974
+ ,1
+ ,491480
+ ,469740
+ ,576612
+ ,1
+ ,538974
+ ,491480)
+ ,dim=c(4
+ ,57)
+ ,dimnames=list(c('Werklozen'
+ ,'Oliecrisis'
+ ,'Y1'
+ ,'Y2')
+ ,1:57))
> y <- array(NA,dim=c(4,57),dimnames=list(c('Werklozen','Oliecrisis','Y1','Y2'),1:57))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = '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
Werklozen Oliecrisis Y1 Y2 t
1 80900 0 35600 36700 1
2 174000 0 80900 35600 2
3 169422 0 174000 80900 3
4 153452 0 169422 174000 4
5 173570 0 153452 169422 5
6 193036 0 173570 153452 6
7 174652 0 193036 173570 7
8 105367 0 174652 193036 8
9 95963 0 105367 174652 9
10 82896 0 95963 105367 10
11 121747 0 82896 95963 11
12 120196 0 121747 82896 12
13 103983 0 120196 121747 13
14 81103 0 103983 120196 14
15 70944 0 81103 103983 15
16 57248 0 70944 81103 16
17 47830 0 57248 70944 17
18 60095 0 47830 57248 18
19 60931 0 60095 47830 19
20 82955 0 60931 60095 20
21 99559 0 82955 60931 21
22 77911 0 99559 82955 22
23 70753 0 77911 99559 23
24 69287 0 70753 77911 24
25 88426 0 69287 70753 25
26 91756 1 88426 69287 26
27 96933 1 91756 88426 27
28 174484 1 96933 91756 28
29 232595 1 174484 96933 29
30 266197 1 232595 174484 30
31 290435 1 266197 232595 31
32 304296 1 290435 266197 32
33 322310 1 304296 290435 33
34 415555 1 322310 304296 34
35 490042 1 415555 322310 35
36 545109 1 490042 415555 36
37 545720 1 545109 490042 37
38 505944 1 545720 545109 38
39 477930 1 505944 545720 39
40 466106 1 477930 505944 40
41 424476 1 466106 477930 41
42 383018 1 424476 466106 42
43 364696 1 383018 424476 43
44 391116 1 364696 383018 44
45 435721 1 391116 364696 45
46 511435 1 435721 391116 46
47 553997 1 511435 435721 47
48 555252 1 553997 511435 48
49 544897 1 555252 553997 49
50 540562 1 544897 555252 50
51 505282 1 540562 544897 51
52 507626 1 505282 540562 52
53 474427 1 507626 505282 53
54 469740 1 474427 507626 54
55 491480 1 469740 474427 55
56 538974 1 491480 469740 56
57 576612 1 538974 491480 57
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Oliecrisis Y1 Y2 t
7083.614 27769.286 1.417 -0.535 496.549
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-49857 -15948 -4562 19162 70355
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 7083.6143 8192.6137 0.865 0.3912
Oliecrisis 27769.2857 15843.5596 1.753 0.0855 .
Y1 1.4167 0.1170 12.105 < 2e-16 ***
Y2 -0.5350 0.1139 -4.697 1.97e-05 ***
t 496.5495 543.7941 0.913 0.3654
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 27970 on 52 degrees of freedom
Multiple R-squared: 0.9799, Adjusted R-squared: 0.9783
F-statistic: 632.6 on 4 and 52 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.9674347 0.06513051 0.03256526
[2,] 0.9447170 0.11056609 0.05528305
[3,] 0.9028358 0.19432842 0.09716421
[4,] 0.9403398 0.11932046 0.05966023
[5,] 0.9017933 0.19641340 0.09820670
[6,] 0.8468331 0.30633381 0.15316691
[7,] 0.7839743 0.43205134 0.21602567
[8,] 0.7072159 0.58556824 0.29278412
[9,] 0.6247413 0.75051731 0.37525866
[10,] 0.5317027 0.93659467 0.46829734
[11,] 0.4693732 0.93874644 0.53062678
[12,] 0.3808386 0.76167728 0.61916136
[13,] 0.3964567 0.79291347 0.60354327
[14,] 0.3719971 0.74399424 0.62800288
[15,] 0.3284903 0.65698053 0.67150973
[16,] 0.2742932 0.54858634 0.72570683
[17,] 0.2221812 0.44436230 0.77781885
[18,] 0.2185148 0.43702968 0.78148516
[19,] 0.2260751 0.45215020 0.77392490
[20,] 0.2441200 0.48823993 0.75588003
[21,] 0.5236511 0.95269777 0.47634889
[22,] 0.5817475 0.83650510 0.41825255
[23,] 0.6555759 0.68884824 0.34442412
[24,] 0.7030257 0.59394855 0.29697428
[25,] 0.7725728 0.45485447 0.22742724
[26,] 0.8319583 0.33608335 0.16804168
[27,] 0.9709251 0.05814983 0.02907492
[28,] 0.9607333 0.07853344 0.03926672
[29,] 0.9523241 0.09535177 0.04767588
[30,] 0.9309042 0.13819154 0.06909577
[31,] 0.9075375 0.18492503 0.09246251
[32,] 0.9022474 0.19550515 0.09775258
[33,] 0.9169945 0.16601104 0.08300552
[34,] 0.8987175 0.20256494 0.10128247
[35,] 0.8697548 0.26049031 0.13024515
[36,] 0.8398080 0.32038390 0.16019195
[37,] 0.7814444 0.43711110 0.21855555
[38,] 0.7532855 0.49342892 0.24671446
[39,] 0.7277298 0.54454050 0.27227025
[40,] 0.6177141 0.76457174 0.38228587
[41,] 0.4818852 0.96377048 0.51811476
[42,] 0.3776500 0.75530002 0.62234999
> postscript(file="/var/www/rcomp/tmp/17ufq1292692506.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/www/rcomp/tmp/27ufq1292692506.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/www/rcomp/tmp/3imea1292692506.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/www/rcomp/tmp/4imea1292692506.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/www/rcomp/tmp/5imea1292692506.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 = 57
Frequency = 1
1 2 3 4 5 6 7
42517.345 70354.640 -42383.522 -2559.691 37237.840 19162.309 -16533.946
8 9 10 11 12 13 14
-49856.903 28565.758 -8739.476 43096.591 -20982.491 -14711.037 -15947.923
15 16 17 18 19 20 21
-2862.052 -14901.923 -10847.629 6936.763 -15138.171 11766.158 -2881.146
22 23 24 25 26 27 28
-36767.100 -4869.913 -8272.310 8617.830 -44216.978 -34015.662 37485.808
29 30 31 32 33 34 35
-11998.805 -19734.194 -12510.625 -15509.122 -4662.598 69980.000 21504.544
36 37 38 39 40 41 42
20429.478 -17623.508 -29303.134 -1135.119 4954.005 -35407.491 -24709.070
43 44 45 46 47 48 49
-7063.290 22639.123 19516.161 45674.130 4335.375 -14701.055 -4561.705
50 51 52 53 54 55 56
5948.319 -29226.214 20284.297 -35605.384 7498.905 17622.474 31312.946
57
12798.389
> postscript(file="/var/www/rcomp/tmp/6tvvd1292692506.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 = 57
Frequency = 1
lag(myerror, k = 1) myerror
0 42517.345 NA
1 70354.640 42517.345
2 -42383.522 70354.640
3 -2559.691 -42383.522
4 37237.840 -2559.691
5 19162.309 37237.840
6 -16533.946 19162.309
7 -49856.903 -16533.946
8 28565.758 -49856.903
9 -8739.476 28565.758
10 43096.591 -8739.476
11 -20982.491 43096.591
12 -14711.037 -20982.491
13 -15947.923 -14711.037
14 -2862.052 -15947.923
15 -14901.923 -2862.052
16 -10847.629 -14901.923
17 6936.763 -10847.629
18 -15138.171 6936.763
19 11766.158 -15138.171
20 -2881.146 11766.158
21 -36767.100 -2881.146
22 -4869.913 -36767.100
23 -8272.310 -4869.913
24 8617.830 -8272.310
25 -44216.978 8617.830
26 -34015.662 -44216.978
27 37485.808 -34015.662
28 -11998.805 37485.808
29 -19734.194 -11998.805
30 -12510.625 -19734.194
31 -15509.122 -12510.625
32 -4662.598 -15509.122
33 69980.000 -4662.598
34 21504.544 69980.000
35 20429.478 21504.544
36 -17623.508 20429.478
37 -29303.134 -17623.508
38 -1135.119 -29303.134
39 4954.005 -1135.119
40 -35407.491 4954.005
41 -24709.070 -35407.491
42 -7063.290 -24709.070
43 22639.123 -7063.290
44 19516.161 22639.123
45 45674.130 19516.161
46 4335.375 45674.130
47 -14701.055 4335.375
48 -4561.705 -14701.055
49 5948.319 -4561.705
50 -29226.214 5948.319
51 20284.297 -29226.214
52 -35605.384 20284.297
53 7498.905 -35605.384
54 17622.474 7498.905
55 31312.946 17622.474
56 12798.389 31312.946
57 NA 12798.389
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 70354.640 42517.345
[2,] -42383.522 70354.640
[3,] -2559.691 -42383.522
[4,] 37237.840 -2559.691
[5,] 19162.309 37237.840
[6,] -16533.946 19162.309
[7,] -49856.903 -16533.946
[8,] 28565.758 -49856.903
[9,] -8739.476 28565.758
[10,] 43096.591 -8739.476
[11,] -20982.491 43096.591
[12,] -14711.037 -20982.491
[13,] -15947.923 -14711.037
[14,] -2862.052 -15947.923
[15,] -14901.923 -2862.052
[16,] -10847.629 -14901.923
[17,] 6936.763 -10847.629
[18,] -15138.171 6936.763
[19,] 11766.158 -15138.171
[20,] -2881.146 11766.158
[21,] -36767.100 -2881.146
[22,] -4869.913 -36767.100
[23,] -8272.310 -4869.913
[24,] 8617.830 -8272.310
[25,] -44216.978 8617.830
[26,] -34015.662 -44216.978
[27,] 37485.808 -34015.662
[28,] -11998.805 37485.808
[29,] -19734.194 -11998.805
[30,] -12510.625 -19734.194
[31,] -15509.122 -12510.625
[32,] -4662.598 -15509.122
[33,] 69980.000 -4662.598
[34,] 21504.544 69980.000
[35,] 20429.478 21504.544
[36,] -17623.508 20429.478
[37,] -29303.134 -17623.508
[38,] -1135.119 -29303.134
[39,] 4954.005 -1135.119
[40,] -35407.491 4954.005
[41,] -24709.070 -35407.491
[42,] -7063.290 -24709.070
[43,] 22639.123 -7063.290
[44,] 19516.161 22639.123
[45,] 45674.130 19516.161
[46,] 4335.375 45674.130
[47,] -14701.055 4335.375
[48,] -4561.705 -14701.055
[49,] 5948.319 -4561.705
[50,] -29226.214 5948.319
[51,] 20284.297 -29226.214
[52,] -35605.384 20284.297
[53,] 7498.905 -35605.384
[54,] 17622.474 7498.905
[55,] 31312.946 17622.474
[56,] 12798.389 31312.946
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 70354.640 42517.345
2 -42383.522 70354.640
3 -2559.691 -42383.522
4 37237.840 -2559.691
5 19162.309 37237.840
6 -16533.946 19162.309
7 -49856.903 -16533.946
8 28565.758 -49856.903
9 -8739.476 28565.758
10 43096.591 -8739.476
11 -20982.491 43096.591
12 -14711.037 -20982.491
13 -15947.923 -14711.037
14 -2862.052 -15947.923
15 -14901.923 -2862.052
16 -10847.629 -14901.923
17 6936.763 -10847.629
18 -15138.171 6936.763
19 11766.158 -15138.171
20 -2881.146 11766.158
21 -36767.100 -2881.146
22 -4869.913 -36767.100
23 -8272.310 -4869.913
24 8617.830 -8272.310
25 -44216.978 8617.830
26 -34015.662 -44216.978
27 37485.808 -34015.662
28 -11998.805 37485.808
29 -19734.194 -11998.805
30 -12510.625 -19734.194
31 -15509.122 -12510.625
32 -4662.598 -15509.122
33 69980.000 -4662.598
34 21504.544 69980.000
35 20429.478 21504.544
36 -17623.508 20429.478
37 -29303.134 -17623.508
38 -1135.119 -29303.134
39 4954.005 -1135.119
40 -35407.491 4954.005
41 -24709.070 -35407.491
42 -7063.290 -24709.070
43 22639.123 -7063.290
44 19516.161 22639.123
45 45674.130 19516.161
46 4335.375 45674.130
47 -14701.055 4335.375
48 -4561.705 -14701.055
49 5948.319 -4561.705
50 -29226.214 5948.319
51 20284.297 -29226.214
52 -35605.384 20284.297
53 7498.905 -35605.384
54 17622.474 7498.905
55 31312.946 17622.474
56 12798.389 31312.946
> 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/rcomp/tmp/73mcy1292692506.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/www/rcomp/tmp/83mcy1292692506.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/www/rcomp/tmp/93mcy1292692506.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/www/rcomp/tmp/10evc11292692506.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/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/rcomp/tmp/11zeap1292692506.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/rcomp/tmp/12s59a1292692506.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/rcomp/tmp/13h6o41292692506.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/rcomp/tmp/14ag6p1292692506.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/rcomp/tmp/15vymu1292692506.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/rcomp/tmp/16gy301292692506.tab")
+ }
> try(system("convert tmp/17ufq1292692506.ps tmp/17ufq1292692506.png",intern=TRUE))
character(0)
> try(system("convert tmp/27ufq1292692506.ps tmp/27ufq1292692506.png",intern=TRUE))
character(0)
> try(system("convert tmp/3imea1292692506.ps tmp/3imea1292692506.png",intern=TRUE))
character(0)
> try(system("convert tmp/4imea1292692506.ps tmp/4imea1292692506.png",intern=TRUE))
character(0)
> try(system("convert tmp/5imea1292692506.ps tmp/5imea1292692506.png",intern=TRUE))
character(0)
> try(system("convert tmp/6tvvd1292692506.ps tmp/6tvvd1292692506.png",intern=TRUE))
character(0)
> try(system("convert tmp/73mcy1292692506.ps tmp/73mcy1292692506.png",intern=TRUE))
character(0)
> try(system("convert tmp/83mcy1292692506.ps tmp/83mcy1292692506.png",intern=TRUE))
character(0)
> try(system("convert tmp/93mcy1292692506.ps tmp/93mcy1292692506.png",intern=TRUE))
character(0)
> try(system("convert tmp/10evc11292692506.ps tmp/10evc11292692506.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.10 0.78 3.90