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(267413,21.4,267366,26.4,264777,26.4,258863,29.4,254844,34.4,254868,24.4,277267,26.4,285351,25.4,286602,31.4,283042,27.4,276687,27.4,277915,29.4,277128,32.4,277103,26.4,275037,22.4,270150,19.4,267140,21.4,264993,23.4,287259,23.4,291186,25.4,292300,28.4,288186,27.4,281477,21.4,282656,17.4,280190,24.4,280408,26.4,276836,22.4,275216,14.4,274352,18.4,271311,25.4,289802,29.4,290726,26.4,292300,26.4,278506,20.4,269826,26.4,265861,29.4,269034,33.4,264176,32.4,255198,35.4,253353,34.4,246057,36.4,235372,32.4,258556,34.4,260993,31.4,254663,27.4,250643,27.4,243422,30.4,247105,32.4,248541,32.4,245039,27.4,237080,31.4,237085,29.4,225554,27.4,226839,25.4,247934,26.4,248333,23.4,246969,18.4,245098,22.4,246263,17.4,255765,17.4,264319,11.4,268347,9.4,273046,6.4,273963,0,267430,7.8,271993,7.9,292710,12,295881,16.9,293299,12.3),dim=c(2,69),dimnames=list(c('Y','X'),1:69))
> y <- array(NA,dim=c(2,69),dimnames=list(c('Y','X'),1:69))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
Y X
1 267413 21.4
2 267366 26.4
3 264777 26.4
4 258863 29.4
5 254844 34.4
6 254868 24.4
7 277267 26.4
8 285351 25.4
9 286602 31.4
10 283042 27.4
11 276687 27.4
12 277915 29.4
13 277128 32.4
14 277103 26.4
15 275037 22.4
16 270150 19.4
17 267140 21.4
18 264993 23.4
19 287259 23.4
20 291186 25.4
21 292300 28.4
22 288186 27.4
23 281477 21.4
24 282656 17.4
25 280190 24.4
26 280408 26.4
27 276836 22.4
28 275216 14.4
29 274352 18.4
30 271311 25.4
31 289802 29.4
32 290726 26.4
33 292300 26.4
34 278506 20.4
35 269826 26.4
36 265861 29.4
37 269034 33.4
38 264176 32.4
39 255198 35.4
40 253353 34.4
41 246057 36.4
42 235372 32.4
43 258556 34.4
44 260993 31.4
45 254663 27.4
46 250643 27.4
47 243422 30.4
48 247105 32.4
49 248541 32.4
50 245039 27.4
51 237080 31.4
52 237085 29.4
53 225554 27.4
54 226839 25.4
55 247934 26.4
56 248333 23.4
57 246969 18.4
58 245098 22.4
59 246263 17.4
60 255765 17.4
61 264319 11.4
62 268347 9.4
63 273046 6.4
64 273963 0.0
65 267430 7.8
66 271993 7.9
67 292710 12.0
68 295881 16.9
69 293299 12.3
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X
282428.0 -644.7
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-39213.4 -11829.1 -630.7 12845.7 28181.7
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 282428.0 6765.9 41.74 <2e-16 ***
X -644.7 265.3 -2.43 0.0178 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 16810 on 67 degrees of freedom
Multiple R-squared: 0.081, Adjusted R-squared: 0.06728
F-statistic: 5.905 on 1 and 67 DF, p-value: 0.01778
> 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.004355894 0.008711787 0.99564411
[2,] 0.016083305 0.032166610 0.98391670
[3,] 0.041025655 0.082051309 0.95897435
[4,] 0.100984023 0.201968046 0.89901598
[5,] 0.204742025 0.409484049 0.79525798
[6,] 0.192818020 0.385636040 0.80718198
[7,] 0.136949240 0.273898479 0.86305076
[8,] 0.099728436 0.199456872 0.90027156
[9,] 0.069776940 0.139553879 0.93022306
[10,] 0.046208528 0.092417056 0.95379147
[11,] 0.027613656 0.055227313 0.97238634
[12,] 0.015524781 0.031049563 0.98447522
[13,] 0.008849768 0.017699536 0.99115023
[14,] 0.005236345 0.010472689 0.99476366
[15,] 0.007271496 0.014542992 0.99272850
[16,] 0.013773202 0.027546403 0.98622680
[17,] 0.026530109 0.053060218 0.97346989
[18,] 0.032636276 0.065272552 0.96736372
[19,] 0.025461487 0.050922975 0.97453851
[20,] 0.019332371 0.038664742 0.98066763
[21,] 0.014701704 0.029403408 0.98529830
[22,] 0.011899438 0.023798876 0.98810056
[23,] 0.008045393 0.016090786 0.99195461
[24,] 0.004858560 0.009717120 0.99514144
[25,] 0.002954044 0.005908089 0.99704596
[26,] 0.001925202 0.003850403 0.99807480
[27,] 0.004548911 0.009097821 0.99545109
[28,] 0.011111577 0.022223154 0.98888842
[29,] 0.034668601 0.069337201 0.96533140
[30,] 0.031181808 0.062363616 0.96881819
[31,] 0.028631649 0.057263298 0.97136835
[32,] 0.029358903 0.058717806 0.97064110
[33,] 0.036998363 0.073996727 0.96300164
[34,] 0.044243092 0.088486184 0.95575691
[35,] 0.059509548 0.119019096 0.94049045
[36,] 0.073490668 0.146981336 0.92650933
[37,] 0.094594355 0.189188711 0.90540564
[38,] 0.182068080 0.364136159 0.81793192
[39,] 0.197920256 0.395840513 0.80207974
[40,] 0.223545668 0.447091335 0.77645433
[41,] 0.224099173 0.448198347 0.77590083
[42,] 0.228324524 0.456649048 0.77167548
[43,] 0.240412884 0.480825767 0.75958712
[44,] 0.239646497 0.479292993 0.76035350
[45,] 0.249946653 0.499893305 0.75005335
[46,] 0.252056958 0.504113916 0.74794304
[47,] 0.256389592 0.512779183 0.74361041
[48,] 0.258855873 0.517711746 0.74114413
[49,] 0.379019812 0.758039623 0.62098019
[50,] 0.546949292 0.906101417 0.45305071
[51,] 0.481532456 0.963064912 0.51846754
[52,] 0.431471299 0.862942597 0.56852870
[53,] 0.454852828 0.909705657 0.54514717
[54,] 0.498949806 0.997899612 0.50105019
[55,] 0.702361521 0.595276957 0.29763848
[56,] 0.897642506 0.204714987 0.10235749
[57,] 0.939003633 0.121992733 0.06099637
[58,] 0.940961849 0.118076302 0.05903815
[59,] 0.878528001 0.242943999 0.12147200
[60,] 0.914490897 0.171018206 0.08550910
> postscript(file="/var/www/html/rcomp/tmp/1qc8g1258713718.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/237s31258713718.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/3vnm21258713718.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/4l9r31258713718.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/531541258713718.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 = 69
Frequency = 1
1 2 3 4 5 6
-1218.2692 1958.2759 -630.7241 -4610.5971 -5406.0520 -11829.1422
7 8 9 10 11 12
11859.2759 19298.5669 24417.8210 18278.9849 11923.9849 14441.4029
13 14 15 16 17 18
15588.5300 11695.2759 7050.4398 229.3127 -1491.2692 -2348.8512
19 20 21 22 23 24
19917.1488 25133.5669 28181.6939 23422.9849 12845.7308 11445.8947
25 26 27 28 29 30
13492.8578 15000.2759 8849.4398 2071.7677 3786.6037 5258.5669
31 32 33 34 35 36
26328.4029 25318.2759 26892.2759 9230.0218 4418.2759 2387.4029
37 38 39 40 41 42
8139.2390 2636.5300 -4407.3430 -6897.0520 -12903.6339 -26167.4700
43 44 45 46 47 48
-1694.0520 -1191.1790 -10100.0151 -14120.0151 -19406.8881 -14434.4700
49 50 51 52 53 54
-12998.4700 -19724.0151 -25104.1790 -26388.5971 -39209.0151 -39213.4331
55 56 57 58 59 60
-17473.7241 -19008.8512 -23596.3963 -22888.5602 -24947.1053 -15445.1053
61 62 63 64 65 66
-10759.3594 -8020.7774 -5255.9045 -8465.0422 -9969.3119 -5341.8410
67 68 69
18018.4660 24348.5402 18800.8787
> postscript(file="/var/www/html/rcomp/tmp/625g41258713718.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 = 69
Frequency = 1
lag(myerror, k = 1) myerror
0 -1218.2692 NA
1 1958.2759 -1218.2692
2 -630.7241 1958.2759
3 -4610.5971 -630.7241
4 -5406.0520 -4610.5971
5 -11829.1422 -5406.0520
6 11859.2759 -11829.1422
7 19298.5669 11859.2759
8 24417.8210 19298.5669
9 18278.9849 24417.8210
10 11923.9849 18278.9849
11 14441.4029 11923.9849
12 15588.5300 14441.4029
13 11695.2759 15588.5300
14 7050.4398 11695.2759
15 229.3127 7050.4398
16 -1491.2692 229.3127
17 -2348.8512 -1491.2692
18 19917.1488 -2348.8512
19 25133.5669 19917.1488
20 28181.6939 25133.5669
21 23422.9849 28181.6939
22 12845.7308 23422.9849
23 11445.8947 12845.7308
24 13492.8578 11445.8947
25 15000.2759 13492.8578
26 8849.4398 15000.2759
27 2071.7677 8849.4398
28 3786.6037 2071.7677
29 5258.5669 3786.6037
30 26328.4029 5258.5669
31 25318.2759 26328.4029
32 26892.2759 25318.2759
33 9230.0218 26892.2759
34 4418.2759 9230.0218
35 2387.4029 4418.2759
36 8139.2390 2387.4029
37 2636.5300 8139.2390
38 -4407.3430 2636.5300
39 -6897.0520 -4407.3430
40 -12903.6339 -6897.0520
41 -26167.4700 -12903.6339
42 -1694.0520 -26167.4700
43 -1191.1790 -1694.0520
44 -10100.0151 -1191.1790
45 -14120.0151 -10100.0151
46 -19406.8881 -14120.0151
47 -14434.4700 -19406.8881
48 -12998.4700 -14434.4700
49 -19724.0151 -12998.4700
50 -25104.1790 -19724.0151
51 -26388.5971 -25104.1790
52 -39209.0151 -26388.5971
53 -39213.4331 -39209.0151
54 -17473.7241 -39213.4331
55 -19008.8512 -17473.7241
56 -23596.3963 -19008.8512
57 -22888.5602 -23596.3963
58 -24947.1053 -22888.5602
59 -15445.1053 -24947.1053
60 -10759.3594 -15445.1053
61 -8020.7774 -10759.3594
62 -5255.9045 -8020.7774
63 -8465.0422 -5255.9045
64 -9969.3119 -8465.0422
65 -5341.8410 -9969.3119
66 18018.4660 -5341.8410
67 24348.5402 18018.4660
68 18800.8787 24348.5402
69 NA 18800.8787
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 1958.2759 -1218.2692
[2,] -630.7241 1958.2759
[3,] -4610.5971 -630.7241
[4,] -5406.0520 -4610.5971
[5,] -11829.1422 -5406.0520
[6,] 11859.2759 -11829.1422
[7,] 19298.5669 11859.2759
[8,] 24417.8210 19298.5669
[9,] 18278.9849 24417.8210
[10,] 11923.9849 18278.9849
[11,] 14441.4029 11923.9849
[12,] 15588.5300 14441.4029
[13,] 11695.2759 15588.5300
[14,] 7050.4398 11695.2759
[15,] 229.3127 7050.4398
[16,] -1491.2692 229.3127
[17,] -2348.8512 -1491.2692
[18,] 19917.1488 -2348.8512
[19,] 25133.5669 19917.1488
[20,] 28181.6939 25133.5669
[21,] 23422.9849 28181.6939
[22,] 12845.7308 23422.9849
[23,] 11445.8947 12845.7308
[24,] 13492.8578 11445.8947
[25,] 15000.2759 13492.8578
[26,] 8849.4398 15000.2759
[27,] 2071.7677 8849.4398
[28,] 3786.6037 2071.7677
[29,] 5258.5669 3786.6037
[30,] 26328.4029 5258.5669
[31,] 25318.2759 26328.4029
[32,] 26892.2759 25318.2759
[33,] 9230.0218 26892.2759
[34,] 4418.2759 9230.0218
[35,] 2387.4029 4418.2759
[36,] 8139.2390 2387.4029
[37,] 2636.5300 8139.2390
[38,] -4407.3430 2636.5300
[39,] -6897.0520 -4407.3430
[40,] -12903.6339 -6897.0520
[41,] -26167.4700 -12903.6339
[42,] -1694.0520 -26167.4700
[43,] -1191.1790 -1694.0520
[44,] -10100.0151 -1191.1790
[45,] -14120.0151 -10100.0151
[46,] -19406.8881 -14120.0151
[47,] -14434.4700 -19406.8881
[48,] -12998.4700 -14434.4700
[49,] -19724.0151 -12998.4700
[50,] -25104.1790 -19724.0151
[51,] -26388.5971 -25104.1790
[52,] -39209.0151 -26388.5971
[53,] -39213.4331 -39209.0151
[54,] -17473.7241 -39213.4331
[55,] -19008.8512 -17473.7241
[56,] -23596.3963 -19008.8512
[57,] -22888.5602 -23596.3963
[58,] -24947.1053 -22888.5602
[59,] -15445.1053 -24947.1053
[60,] -10759.3594 -15445.1053
[61,] -8020.7774 -10759.3594
[62,] -5255.9045 -8020.7774
[63,] -8465.0422 -5255.9045
[64,] -9969.3119 -8465.0422
[65,] -5341.8410 -9969.3119
[66,] 18018.4660 -5341.8410
[67,] 24348.5402 18018.4660
[68,] 18800.8787 24348.5402
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 1958.2759 -1218.2692
2 -630.7241 1958.2759
3 -4610.5971 -630.7241
4 -5406.0520 -4610.5971
5 -11829.1422 -5406.0520
6 11859.2759 -11829.1422
7 19298.5669 11859.2759
8 24417.8210 19298.5669
9 18278.9849 24417.8210
10 11923.9849 18278.9849
11 14441.4029 11923.9849
12 15588.5300 14441.4029
13 11695.2759 15588.5300
14 7050.4398 11695.2759
15 229.3127 7050.4398
16 -1491.2692 229.3127
17 -2348.8512 -1491.2692
18 19917.1488 -2348.8512
19 25133.5669 19917.1488
20 28181.6939 25133.5669
21 23422.9849 28181.6939
22 12845.7308 23422.9849
23 11445.8947 12845.7308
24 13492.8578 11445.8947
25 15000.2759 13492.8578
26 8849.4398 15000.2759
27 2071.7677 8849.4398
28 3786.6037 2071.7677
29 5258.5669 3786.6037
30 26328.4029 5258.5669
31 25318.2759 26328.4029
32 26892.2759 25318.2759
33 9230.0218 26892.2759
34 4418.2759 9230.0218
35 2387.4029 4418.2759
36 8139.2390 2387.4029
37 2636.5300 8139.2390
38 -4407.3430 2636.5300
39 -6897.0520 -4407.3430
40 -12903.6339 -6897.0520
41 -26167.4700 -12903.6339
42 -1694.0520 -26167.4700
43 -1191.1790 -1694.0520
44 -10100.0151 -1191.1790
45 -14120.0151 -10100.0151
46 -19406.8881 -14120.0151
47 -14434.4700 -19406.8881
48 -12998.4700 -14434.4700
49 -19724.0151 -12998.4700
50 -25104.1790 -19724.0151
51 -26388.5971 -25104.1790
52 -39209.0151 -26388.5971
53 -39213.4331 -39209.0151
54 -17473.7241 -39213.4331
55 -19008.8512 -17473.7241
56 -23596.3963 -19008.8512
57 -22888.5602 -23596.3963
58 -24947.1053 -22888.5602
59 -15445.1053 -24947.1053
60 -10759.3594 -15445.1053
61 -8020.7774 -10759.3594
62 -5255.9045 -8020.7774
63 -8465.0422 -5255.9045
64 -9969.3119 -8465.0422
65 -5341.8410 -9969.3119
66 18018.4660 -5341.8410
67 24348.5402 18018.4660
68 18800.8787 24348.5402
> 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/7b5nx1258713718.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/8yclj1258713718.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/91h0g1258713718.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/10tbfo1258713718.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/116lyw1258713719.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/12l5vt1258713719.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/13l1b91258713719.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/147ru21258713719.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/157o8a1258713719.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/16k5wr1258713719.tab")
+ }
>
> system("convert tmp/1qc8g1258713718.ps tmp/1qc8g1258713718.png")
> system("convert tmp/237s31258713718.ps tmp/237s31258713718.png")
> system("convert tmp/3vnm21258713718.ps tmp/3vnm21258713718.png")
> system("convert tmp/4l9r31258713718.ps tmp/4l9r31258713718.png")
> system("convert tmp/531541258713718.ps tmp/531541258713718.png")
> system("convert tmp/625g41258713718.ps tmp/625g41258713718.png")
> system("convert tmp/7b5nx1258713718.ps tmp/7b5nx1258713718.png")
> system("convert tmp/8yclj1258713718.ps tmp/8yclj1258713718.png")
> system("convert tmp/91h0g1258713718.ps tmp/91h0g1258713718.png")
> system("convert tmp/10tbfo1258713718.ps tmp/10tbfo1258713718.png")
>
>
> proc.time()
user system elapsed
2.560 1.592 2.954