R version 2.8.0 (2008-10-20)
Copyright (C) 2008 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(2490,0,3266,0,3475,0,3127,0,2955,0,3870,0,2852,0,3142,0,3029,0,3180,0,2560,0,2733,0,2452,0,2553,0,2777,0,2520,0,2318,0,2873,0,2311,0,2395,0,2099,0,2268,0,2316,0,2181,0,2175,0,2627,0,2578,0,3090,0,2634,0,3225,0,2938,0,3174,0,3350,0,2588,0,2061,0,2691,0,2061,0,2918,0,2223,0,2651,0,2379,0,3146,0,2883,0,2768,0,3258,0,2839,0,2470,0,5072,1,1463,1,1600,1,2203,1,2013,1,2169,1,2640,1,2411,1,2528,1,2292,1,1988,1,1774,1,2279,1),dim=c(2,60),dimnames=list(c('Y','X'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Y','X'),1:60))
> 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 = '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
Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 2490 0 1 0 0 0 0 0 0 0 0 0 0 1
2 3266 0 0 1 0 0 0 0 0 0 0 0 0 2
3 3475 0 0 0 1 0 0 0 0 0 0 0 0 3
4 3127 0 0 0 0 1 0 0 0 0 0 0 0 4
5 2955 0 0 0 0 0 1 0 0 0 0 0 0 5
6 3870 0 0 0 0 0 0 1 0 0 0 0 0 6
7 2852 0 0 0 0 0 0 0 1 0 0 0 0 7
8 3142 0 0 0 0 0 0 0 0 1 0 0 0 8
9 3029 0 0 0 0 0 0 0 0 0 1 0 0 9
10 3180 0 0 0 0 0 0 0 0 0 0 1 0 10
11 2560 0 0 0 0 0 0 0 0 0 0 0 1 11
12 2733 0 0 0 0 0 0 0 0 0 0 0 0 12
13 2452 0 1 0 0 0 0 0 0 0 0 0 0 13
14 2553 0 0 1 0 0 0 0 0 0 0 0 0 14
15 2777 0 0 0 1 0 0 0 0 0 0 0 0 15
16 2520 0 0 0 0 1 0 0 0 0 0 0 0 16
17 2318 0 0 0 0 0 1 0 0 0 0 0 0 17
18 2873 0 0 0 0 0 0 1 0 0 0 0 0 18
19 2311 0 0 0 0 0 0 0 1 0 0 0 0 19
20 2395 0 0 0 0 0 0 0 0 1 0 0 0 20
21 2099 0 0 0 0 0 0 0 0 0 1 0 0 21
22 2268 0 0 0 0 0 0 0 0 0 0 1 0 22
23 2316 0 0 0 0 0 0 0 0 0 0 0 1 23
24 2181 0 0 0 0 0 0 0 0 0 0 0 0 24
25 2175 0 1 0 0 0 0 0 0 0 0 0 0 25
26 2627 0 0 1 0 0 0 0 0 0 0 0 0 26
27 2578 0 0 0 1 0 0 0 0 0 0 0 0 27
28 3090 0 0 0 0 1 0 0 0 0 0 0 0 28
29 2634 0 0 0 0 0 1 0 0 0 0 0 0 29
30 3225 0 0 0 0 0 0 1 0 0 0 0 0 30
31 2938 0 0 0 0 0 0 0 1 0 0 0 0 31
32 3174 0 0 0 0 0 0 0 0 1 0 0 0 32
33 3350 0 0 0 0 0 0 0 0 0 1 0 0 33
34 2588 0 0 0 0 0 0 0 0 0 0 1 0 34
35 2061 0 0 0 0 0 0 0 0 0 0 0 1 35
36 2691 0 0 0 0 0 0 0 0 0 0 0 0 36
37 2061 0 1 0 0 0 0 0 0 0 0 0 0 37
38 2918 0 0 1 0 0 0 0 0 0 0 0 0 38
39 2223 0 0 0 1 0 0 0 0 0 0 0 0 39
40 2651 0 0 0 0 1 0 0 0 0 0 0 0 40
41 2379 0 0 0 0 0 1 0 0 0 0 0 0 41
42 3146 0 0 0 0 0 0 1 0 0 0 0 0 42
43 2883 0 0 0 0 0 0 0 1 0 0 0 0 43
44 2768 0 0 0 0 0 0 0 0 1 0 0 0 44
45 3258 0 0 0 0 0 0 0 0 0 1 0 0 45
46 2839 0 0 0 0 0 0 0 0 0 0 1 0 46
47 2470 0 0 0 0 0 0 0 0 0 0 0 1 47
48 5072 1 0 0 0 0 0 0 0 0 0 0 0 48
49 1463 1 1 0 0 0 0 0 0 0 0 0 0 49
50 1600 1 0 1 0 0 0 0 0 0 0 0 0 50
51 2203 1 0 0 1 0 0 0 0 0 0 0 0 51
52 2013 1 0 0 0 1 0 0 0 0 0 0 0 52
53 2169 1 0 0 0 0 1 0 0 0 0 0 0 53
54 2640 1 0 0 0 0 0 1 0 0 0 0 0 54
55 2411 1 0 0 0 0 0 0 1 0 0 0 0 55
56 2528 1 0 0 0 0 0 0 0 1 0 0 0 56
57 2292 1 0 0 0 0 0 0 0 0 1 0 0 57
58 1988 1 0 0 0 0 0 0 0 0 0 1 0 58
59 1774 1 0 0 0 0 0 0 0 0 0 0 1 59
60 2279 1 0 0 0 0 0 0 0 0 0 0 0 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X M1 M2 M3 M4
3379.889 -165.049 -994.603 -521.040 -453.677 -415.714
M5 M6 M7 M8 M9 M10
-595.951 72.812 -390.025 -258.662 -245.499 -469.536
M11 t
-796.973 -8.963
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-983.776 -253.278 4.269 202.977 2287.386
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3379.889 272.266 12.414 2.73e-16 ***
X -165.049 232.754 -0.709 0.48183
M1 -994.603 325.048 -3.060 0.00369 **
M2 -521.040 324.614 -1.605 0.11531
M3 -453.677 324.276 -1.399 0.16851
M4 -415.714 324.034 -1.283 0.20594
M5 -595.951 323.889 -1.840 0.07223 .
M6 72.812 323.841 0.225 0.82310
M7 -390.025 323.889 -1.204 0.23467
M8 -258.662 324.034 -0.798 0.42882
M9 -245.499 324.276 -0.757 0.45287
M10 -469.536 324.614 -1.446 0.15483
M11 -796.973 325.048 -2.452 0.01807 *
t -8.963 5.599 -1.601 0.11627
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 509.5 on 46 degrees of freedom
Multiple R-squared: 0.3702, Adjusted R-squared: 0.1922
F-statistic: 2.08 on 13 and 46 DF, p-value: 0.03449
> 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.083355455 0.166710910 0.91664454
[2,] 0.057795949 0.115591898 0.94220405
[3,] 0.021385695 0.042771390 0.97861431
[4,] 0.007929569 0.015859138 0.99207043
[5,] 0.005017266 0.010034533 0.99498273
[6,] 0.002334148 0.004668296 0.99766585
[7,] 0.001806613 0.003613227 0.99819339
[8,] 0.002156330 0.004312661 0.99784367
[9,] 0.005156533 0.010313066 0.99484347
[10,] 0.005720821 0.011441641 0.99427918
[11,] 0.002734831 0.005469661 0.99726517
[12,] 0.013718623 0.027437245 0.98628138
[13,] 0.012710700 0.025421400 0.98728930
[14,] 0.008131766 0.016263532 0.99186823
[15,] 0.012709040 0.025418079 0.98729096
[16,] 0.015257928 0.030515855 0.98474207
[17,] 0.028723637 0.057447273 0.97127636
[18,] 0.017841617 0.035683235 0.98215838
[19,] 0.022349171 0.044698341 0.97765083
[20,] 0.911939598 0.176120804 0.08806040
[21,] 0.853842960 0.292314079 0.14615704
[22,] 0.946040262 0.107919476 0.05395974
[23,] 0.968842280 0.062315440 0.03115772
[24,] 0.933564349 0.132871302 0.06643565
[25,] 0.929968028 0.140063945 0.07003197
[26,] 0.859959420 0.280081161 0.14004058
[27,] 0.766838338 0.466323324 0.23316166
> postscript(file="/var/www/html/freestat/rcomp/tmp/1i5so1229869954.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/freestat/rcomp/tmp/2j6di1229869954.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/freestat/rcomp/tmp/338lu1229869954.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/freestat/rcomp/tmp/4m3ji1229869954.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/freestat/rcomp/tmp/56lus1229869954.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 = 60
Frequency = 1
1 2 3 4 5 6
113.677217 425.077217 575.677217 198.677217 215.877217 471.077217
7 8 9 10 11 12
-75.122783 92.477217 -24.722783 359.277217 75.677217 -539.332522
13 14 15 16 17 18
183.233739 -180.366261 -14.766261 -300.766261 -313.566261 -418.366261
19 20 21 22 23 24
-508.566261 -546.966261 -847.166261 -445.166261 -60.766261 -983.776000
25 26 27 28 29 30
13.790261 1.190261 -106.209739 376.790261 109.990261 41.190261
31 32 33 34 35 36
225.990261 339.590261 511.390261 -17.609739 -208.209739 -366.219478
37 38 39 40 41 42
7.346783 399.746783 -353.653217 45.346783 -37.453217 69.746783
43 44 45 46 47 48
278.546783 41.146783 526.946783 340.946783 308.346783 2287.385739
49 50 51 52 53 54
-318.048000 -645.648000 -101.048000 -320.048000 25.152000 -163.648000
55 56 57 58 59 60
79.152000 73.752000 -166.448000 -237.448000 -115.048000 -398.057739
> postscript(file="/var/www/html/freestat/rcomp/tmp/658v61229869954.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 = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 113.677217 NA
1 425.077217 113.677217
2 575.677217 425.077217
3 198.677217 575.677217
4 215.877217 198.677217
5 471.077217 215.877217
6 -75.122783 471.077217
7 92.477217 -75.122783
8 -24.722783 92.477217
9 359.277217 -24.722783
10 75.677217 359.277217
11 -539.332522 75.677217
12 183.233739 -539.332522
13 -180.366261 183.233739
14 -14.766261 -180.366261
15 -300.766261 -14.766261
16 -313.566261 -300.766261
17 -418.366261 -313.566261
18 -508.566261 -418.366261
19 -546.966261 -508.566261
20 -847.166261 -546.966261
21 -445.166261 -847.166261
22 -60.766261 -445.166261
23 -983.776000 -60.766261
24 13.790261 -983.776000
25 1.190261 13.790261
26 -106.209739 1.190261
27 376.790261 -106.209739
28 109.990261 376.790261
29 41.190261 109.990261
30 225.990261 41.190261
31 339.590261 225.990261
32 511.390261 339.590261
33 -17.609739 511.390261
34 -208.209739 -17.609739
35 -366.219478 -208.209739
36 7.346783 -366.219478
37 399.746783 7.346783
38 -353.653217 399.746783
39 45.346783 -353.653217
40 -37.453217 45.346783
41 69.746783 -37.453217
42 278.546783 69.746783
43 41.146783 278.546783
44 526.946783 41.146783
45 340.946783 526.946783
46 308.346783 340.946783
47 2287.385739 308.346783
48 -318.048000 2287.385739
49 -645.648000 -318.048000
50 -101.048000 -645.648000
51 -320.048000 -101.048000
52 25.152000 -320.048000
53 -163.648000 25.152000
54 79.152000 -163.648000
55 73.752000 79.152000
56 -166.448000 73.752000
57 -237.448000 -166.448000
58 -115.048000 -237.448000
59 -398.057739 -115.048000
60 NA -398.057739
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 425.077217 113.677217
[2,] 575.677217 425.077217
[3,] 198.677217 575.677217
[4,] 215.877217 198.677217
[5,] 471.077217 215.877217
[6,] -75.122783 471.077217
[7,] 92.477217 -75.122783
[8,] -24.722783 92.477217
[9,] 359.277217 -24.722783
[10,] 75.677217 359.277217
[11,] -539.332522 75.677217
[12,] 183.233739 -539.332522
[13,] -180.366261 183.233739
[14,] -14.766261 -180.366261
[15,] -300.766261 -14.766261
[16,] -313.566261 -300.766261
[17,] -418.366261 -313.566261
[18,] -508.566261 -418.366261
[19,] -546.966261 -508.566261
[20,] -847.166261 -546.966261
[21,] -445.166261 -847.166261
[22,] -60.766261 -445.166261
[23,] -983.776000 -60.766261
[24,] 13.790261 -983.776000
[25,] 1.190261 13.790261
[26,] -106.209739 1.190261
[27,] 376.790261 -106.209739
[28,] 109.990261 376.790261
[29,] 41.190261 109.990261
[30,] 225.990261 41.190261
[31,] 339.590261 225.990261
[32,] 511.390261 339.590261
[33,] -17.609739 511.390261
[34,] -208.209739 -17.609739
[35,] -366.219478 -208.209739
[36,] 7.346783 -366.219478
[37,] 399.746783 7.346783
[38,] -353.653217 399.746783
[39,] 45.346783 -353.653217
[40,] -37.453217 45.346783
[41,] 69.746783 -37.453217
[42,] 278.546783 69.746783
[43,] 41.146783 278.546783
[44,] 526.946783 41.146783
[45,] 340.946783 526.946783
[46,] 308.346783 340.946783
[47,] 2287.385739 308.346783
[48,] -318.048000 2287.385739
[49,] -645.648000 -318.048000
[50,] -101.048000 -645.648000
[51,] -320.048000 -101.048000
[52,] 25.152000 -320.048000
[53,] -163.648000 25.152000
[54,] 79.152000 -163.648000
[55,] 73.752000 79.152000
[56,] -166.448000 73.752000
[57,] -237.448000 -166.448000
[58,] -115.048000 -237.448000
[59,] -398.057739 -115.048000
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 425.077217 113.677217
2 575.677217 425.077217
3 198.677217 575.677217
4 215.877217 198.677217
5 471.077217 215.877217
6 -75.122783 471.077217
7 92.477217 -75.122783
8 -24.722783 92.477217
9 359.277217 -24.722783
10 75.677217 359.277217
11 -539.332522 75.677217
12 183.233739 -539.332522
13 -180.366261 183.233739
14 -14.766261 -180.366261
15 -300.766261 -14.766261
16 -313.566261 -300.766261
17 -418.366261 -313.566261
18 -508.566261 -418.366261
19 -546.966261 -508.566261
20 -847.166261 -546.966261
21 -445.166261 -847.166261
22 -60.766261 -445.166261
23 -983.776000 -60.766261
24 13.790261 -983.776000
25 1.190261 13.790261
26 -106.209739 1.190261
27 376.790261 -106.209739
28 109.990261 376.790261
29 41.190261 109.990261
30 225.990261 41.190261
31 339.590261 225.990261
32 511.390261 339.590261
33 -17.609739 511.390261
34 -208.209739 -17.609739
35 -366.219478 -208.209739
36 7.346783 -366.219478
37 399.746783 7.346783
38 -353.653217 399.746783
39 45.346783 -353.653217
40 -37.453217 45.346783
41 69.746783 -37.453217
42 278.546783 69.746783
43 41.146783 278.546783
44 526.946783 41.146783
45 340.946783 526.946783
46 308.346783 340.946783
47 2287.385739 308.346783
48 -318.048000 2287.385739
49 -645.648000 -318.048000
50 -101.048000 -645.648000
51 -320.048000 -101.048000
52 25.152000 -320.048000
53 -163.648000 25.152000
54 79.152000 -163.648000
55 73.752000 79.152000
56 -166.448000 73.752000
57 -237.448000 -166.448000
58 -115.048000 -237.448000
59 -398.057739 -115.048000
> 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/freestat/rcomp/tmp/7fa3u1229869954.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/freestat/rcomp/tmp/8magw1229869954.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/freestat/rcomp/tmp/9tafd1229869954.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/freestat/rcomp/tmp/10k9x91229869954.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/11coyf1229869954.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/freestat/rcomp/tmp/12ufn81229869954.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/freestat/rcomp/tmp/137lm01229869954.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/freestat/rcomp/tmp/14pcyl1229869954.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/freestat/rcomp/tmp/151khc1229869954.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/freestat/rcomp/tmp/16gvmg1229869954.tab")
+ }
>
> system("convert tmp/1i5so1229869954.ps tmp/1i5so1229869954.png")
> system("convert tmp/2j6di1229869954.ps tmp/2j6di1229869954.png")
> system("convert tmp/338lu1229869954.ps tmp/338lu1229869954.png")
> system("convert tmp/4m3ji1229869954.ps tmp/4m3ji1229869954.png")
> system("convert tmp/56lus1229869954.ps tmp/56lus1229869954.png")
> system("convert tmp/658v61229869954.ps tmp/658v61229869954.png")
> system("convert tmp/7fa3u1229869954.ps tmp/7fa3u1229869954.png")
> system("convert tmp/8magw1229869954.ps tmp/8magw1229869954.png")
> system("convert tmp/9tafd1229869954.ps tmp/9tafd1229869954.png")
> system("convert tmp/10k9x91229869954.ps tmp/10k9x91229869954.png")
>
>
> proc.time()
user system elapsed
3.660 2.507 4.349