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(20366,0,22782,0,19169,0,13807,0,29743,0,25591,0,29096,0,26482,0,22405,0,27044,0,17970,0,18730,0,19684,0,19785,0,18479,0,10698,0,31956,0,29506,0,34506,0,27165,0,26736,0,23691,0,18157,0,17328,0,18205,0,20995,0,17382,0,9367,0,31124,0,26551,0,30651,0,25859,0,25100,0,25778,0,20418,0,18688,0,20424,0,24776,0,19814,0,12738,0,31566,0,30111,0,30019,0,31934,1,25826,1,26835,1,20205,1,17789,1,20520,1,22518,1,15572,1,11509,1,25447,1,24090,1,27786,1,26195,1,20516,1,22759,1,19028,1,16971,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 = '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
Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 20366 0 1 0 0 0 0 0 0 0 0 0 0
2 22782 0 0 1 0 0 0 0 0 0 0 0 0
3 19169 0 0 0 1 0 0 0 0 0 0 0 0
4 13807 0 0 0 0 1 0 0 0 0 0 0 0
5 29743 0 0 0 0 0 1 0 0 0 0 0 0
6 25591 0 0 0 0 0 0 1 0 0 0 0 0
7 29096 0 0 0 0 0 0 0 1 0 0 0 0
8 26482 0 0 0 0 0 0 0 0 1 0 0 0
9 22405 0 0 0 0 0 0 0 0 0 1 0 0
10 27044 0 0 0 0 0 0 0 0 0 0 1 0
11 17970 0 0 0 0 0 0 0 0 0 0 0 1
12 18730 0 0 0 0 0 0 0 0 0 0 0 0
13 19684 0 1 0 0 0 0 0 0 0 0 0 0
14 19785 0 0 1 0 0 0 0 0 0 0 0 0
15 18479 0 0 0 1 0 0 0 0 0 0 0 0
16 10698 0 0 0 0 1 0 0 0 0 0 0 0
17 31956 0 0 0 0 0 1 0 0 0 0 0 0
18 29506 0 0 0 0 0 0 1 0 0 0 0 0
19 34506 0 0 0 0 0 0 0 1 0 0 0 0
20 27165 0 0 0 0 0 0 0 0 1 0 0 0
21 26736 0 0 0 0 0 0 0 0 0 1 0 0
22 23691 0 0 0 0 0 0 0 0 0 0 1 0
23 18157 0 0 0 0 0 0 0 0 0 0 0 1
24 17328 0 0 0 0 0 0 0 0 0 0 0 0
25 18205 0 1 0 0 0 0 0 0 0 0 0 0
26 20995 0 0 1 0 0 0 0 0 0 0 0 0
27 17382 0 0 0 1 0 0 0 0 0 0 0 0
28 9367 0 0 0 0 1 0 0 0 0 0 0 0
29 31124 0 0 0 0 0 1 0 0 0 0 0 0
30 26551 0 0 0 0 0 0 1 0 0 0 0 0
31 30651 0 0 0 0 0 0 0 1 0 0 0 0
32 25859 0 0 0 0 0 0 0 0 1 0 0 0
33 25100 0 0 0 0 0 0 0 0 0 1 0 0
34 25778 0 0 0 0 0 0 0 0 0 0 1 0
35 20418 0 0 0 0 0 0 0 0 0 0 0 1
36 18688 0 0 0 0 0 0 0 0 0 0 0 0
37 20424 0 1 0 0 0 0 0 0 0 0 0 0
38 24776 0 0 1 0 0 0 0 0 0 0 0 0
39 19814 0 0 0 1 0 0 0 0 0 0 0 0
40 12738 0 0 0 0 1 0 0 0 0 0 0 0
41 31566 0 0 0 0 0 1 0 0 0 0 0 0
42 30111 0 0 0 0 0 0 1 0 0 0 0 0
43 30019 0 0 0 0 0 0 0 1 0 0 0 0
44 31934 1 0 0 0 0 0 0 0 1 0 0 0
45 25826 1 0 0 0 0 0 0 0 0 1 0 0
46 26835 1 0 0 0 0 0 0 0 0 0 1 0
47 20205 1 0 0 0 0 0 0 0 0 0 0 1
48 17789 1 0 0 0 0 0 0 0 0 0 0 0
49 20520 1 1 0 0 0 0 0 0 0 0 0 0
50 22518 1 0 1 0 0 0 0 0 0 0 0 0
51 15572 1 0 0 1 0 0 0 0 0 0 0 0
52 11509 1 0 0 0 1 0 0 0 0 0 0 0
53 25447 1 0 0 0 0 1 0 0 0 0 0 0
54 24090 1 0 0 0 0 0 1 0 0 0 0 0
55 27786 1 0 0 0 0 0 0 1 0 0 0 0
56 26195 1 0 0 0 0 0 0 0 1 0 0 0
57 20516 1 0 0 0 0 0 0 0 0 1 0 0
58 22759 1 0 0 0 0 0 0 0 0 0 1 0
59 19028 1 0 0 0 0 0 0 0 0 0 0 1
60 16971 1 0 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) X M1 M2 M3 M4
18301.55 -1000.88 1738.42 4069.82 -18.18 -6477.58
M5 M6 M7 M8 M9 M10
11865.82 9068.42 12310.22 9625.80 6215.40 7320.20
M11
1254.40
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-3719.5 -1463.0 175.9 1210.3 5007.5
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 18301.55 915.18 19.998 < 2e-16 ***
X -1000.88 581.14 -1.722 0.09160 .
M1 1738.42 1257.20 1.383 0.17327
M2 4069.82 1257.20 3.237 0.00222 **
M3 -18.18 1257.20 -0.014 0.98853
M4 -6477.58 1257.20 -5.152 5.02e-06 ***
M5 11865.82 1257.20 9.438 2.00e-12 ***
M6 9068.42 1257.20 7.213 3.89e-09 ***
M7 12310.22 1257.20 9.792 6.29e-13 ***
M8 9625.80 1251.82 7.689 7.43e-10 ***
M9 6215.40 1251.82 4.965 9.46e-06 ***
M10 7320.20 1251.82 5.848 4.57e-07 ***
M11 1254.40 1251.82 1.002 0.32144
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1979 on 47 degrees of freedom
Multiple R-squared: 0.9058, Adjusted R-squared: 0.8818
F-statistic: 37.68 on 12 and 47 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.43421537 0.86843074 0.5657846
[2,] 0.36203435 0.72406869 0.6379657
[3,] 0.45827495 0.91654991 0.5417250
[4,] 0.71227784 0.57544433 0.2877222
[5,] 0.60968466 0.78063068 0.3903153
[6,] 0.67090551 0.65818897 0.3290945
[7,] 0.66517946 0.66964108 0.3348205
[8,] 0.59079326 0.81841348 0.4092067
[9,] 0.50808385 0.98383229 0.4919161
[10,] 0.47776450 0.95552901 0.5222355
[11,] 0.43692835 0.87385669 0.5630717
[12,] 0.36469444 0.72938888 0.6353056
[13,] 0.41718956 0.83437912 0.5828104
[14,] 0.34062577 0.68125154 0.6593742
[15,] 0.27298599 0.54597198 0.7270140
[16,] 0.20847090 0.41694180 0.7915291
[17,] 0.30182436 0.60364871 0.6981756
[18,] 0.22382084 0.44764167 0.7761792
[19,] 0.16871729 0.33743459 0.8312827
[20,] 0.15463918 0.30927836 0.8453608
[21,] 0.11501567 0.23003135 0.8849843
[22,] 0.11229629 0.22459259 0.8877037
[23,] 0.12015359 0.24030718 0.8798464
[24,] 0.07944118 0.15888237 0.9205588
[25,] 0.07114104 0.14228208 0.9288590
[26,] 0.04427139 0.08854278 0.9557286
[27,] 0.04196028 0.08392056 0.9580397
[28,] 0.02094830 0.04189659 0.9790517
[29,] 0.05957785 0.11915570 0.9404222
> postscript(file="/var/www/html/rcomp/tmp/1ufwr1260972119.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/2s1fm1260972119.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/3sy1k1260972119.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/486c61260972119.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/5bkrx1260972119.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
326.02414 410.62414 885.62414 1983.02414 -424.37586 -1778.97586
7 8 9 10 11 12
-1515.77586 -1445.35172 -2111.95172 1422.24828 -1585.95172 428.44828
13 14 15 16 17 18
-355.97586 -2586.37586 195.62414 -1125.97586 1788.62414 2136.02414
19 20 21 22 23 24
3894.22414 -762.35172 2219.04828 -1930.75172 -1398.95172 -973.55172
25 26 27 28 29 30
-1834.97586 -1376.37586 -901.37586 -2456.97586 956.62414 -818.97586
31 32 33 34 35 36
39.22414 -2068.35172 583.04828 156.24828 862.04828 386.44828
37 38 39 40 41 42
384.02414 2404.62414 1530.62414 914.02414 1398.62414 2741.02414
43 44 45 46 47 48
-592.77586 5007.52759 2309.92759 2214.12759 1649.92759 488.32759
49 50 51 52 53 54
1480.90345 1147.50345 -1710.49655 685.90345 -3719.49655 -2279.09655
55 56 57 58 59 60
-1824.89655 -731.47241 -3000.07241 -1861.87241 472.92759 -329.67241
> postscript(file="/var/www/html/rcomp/tmp/6ypmw1260972119.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 326.02414 NA
1 410.62414 326.02414
2 885.62414 410.62414
3 1983.02414 885.62414
4 -424.37586 1983.02414
5 -1778.97586 -424.37586
6 -1515.77586 -1778.97586
7 -1445.35172 -1515.77586
8 -2111.95172 -1445.35172
9 1422.24828 -2111.95172
10 -1585.95172 1422.24828
11 428.44828 -1585.95172
12 -355.97586 428.44828
13 -2586.37586 -355.97586
14 195.62414 -2586.37586
15 -1125.97586 195.62414
16 1788.62414 -1125.97586
17 2136.02414 1788.62414
18 3894.22414 2136.02414
19 -762.35172 3894.22414
20 2219.04828 -762.35172
21 -1930.75172 2219.04828
22 -1398.95172 -1930.75172
23 -973.55172 -1398.95172
24 -1834.97586 -973.55172
25 -1376.37586 -1834.97586
26 -901.37586 -1376.37586
27 -2456.97586 -901.37586
28 956.62414 -2456.97586
29 -818.97586 956.62414
30 39.22414 -818.97586
31 -2068.35172 39.22414
32 583.04828 -2068.35172
33 156.24828 583.04828
34 862.04828 156.24828
35 386.44828 862.04828
36 384.02414 386.44828
37 2404.62414 384.02414
38 1530.62414 2404.62414
39 914.02414 1530.62414
40 1398.62414 914.02414
41 2741.02414 1398.62414
42 -592.77586 2741.02414
43 5007.52759 -592.77586
44 2309.92759 5007.52759
45 2214.12759 2309.92759
46 1649.92759 2214.12759
47 488.32759 1649.92759
48 1480.90345 488.32759
49 1147.50345 1480.90345
50 -1710.49655 1147.50345
51 685.90345 -1710.49655
52 -3719.49655 685.90345
53 -2279.09655 -3719.49655
54 -1824.89655 -2279.09655
55 -731.47241 -1824.89655
56 -3000.07241 -731.47241
57 -1861.87241 -3000.07241
58 472.92759 -1861.87241
59 -329.67241 472.92759
60 NA -329.67241
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 410.62414 326.02414
[2,] 885.62414 410.62414
[3,] 1983.02414 885.62414
[4,] -424.37586 1983.02414
[5,] -1778.97586 -424.37586
[6,] -1515.77586 -1778.97586
[7,] -1445.35172 -1515.77586
[8,] -2111.95172 -1445.35172
[9,] 1422.24828 -2111.95172
[10,] -1585.95172 1422.24828
[11,] 428.44828 -1585.95172
[12,] -355.97586 428.44828
[13,] -2586.37586 -355.97586
[14,] 195.62414 -2586.37586
[15,] -1125.97586 195.62414
[16,] 1788.62414 -1125.97586
[17,] 2136.02414 1788.62414
[18,] 3894.22414 2136.02414
[19,] -762.35172 3894.22414
[20,] 2219.04828 -762.35172
[21,] -1930.75172 2219.04828
[22,] -1398.95172 -1930.75172
[23,] -973.55172 -1398.95172
[24,] -1834.97586 -973.55172
[25,] -1376.37586 -1834.97586
[26,] -901.37586 -1376.37586
[27,] -2456.97586 -901.37586
[28,] 956.62414 -2456.97586
[29,] -818.97586 956.62414
[30,] 39.22414 -818.97586
[31,] -2068.35172 39.22414
[32,] 583.04828 -2068.35172
[33,] 156.24828 583.04828
[34,] 862.04828 156.24828
[35,] 386.44828 862.04828
[36,] 384.02414 386.44828
[37,] 2404.62414 384.02414
[38,] 1530.62414 2404.62414
[39,] 914.02414 1530.62414
[40,] 1398.62414 914.02414
[41,] 2741.02414 1398.62414
[42,] -592.77586 2741.02414
[43,] 5007.52759 -592.77586
[44,] 2309.92759 5007.52759
[45,] 2214.12759 2309.92759
[46,] 1649.92759 2214.12759
[47,] 488.32759 1649.92759
[48,] 1480.90345 488.32759
[49,] 1147.50345 1480.90345
[50,] -1710.49655 1147.50345
[51,] 685.90345 -1710.49655
[52,] -3719.49655 685.90345
[53,] -2279.09655 -3719.49655
[54,] -1824.89655 -2279.09655
[55,] -731.47241 -1824.89655
[56,] -3000.07241 -731.47241
[57,] -1861.87241 -3000.07241
[58,] 472.92759 -1861.87241
[59,] -329.67241 472.92759
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 410.62414 326.02414
2 885.62414 410.62414
3 1983.02414 885.62414
4 -424.37586 1983.02414
5 -1778.97586 -424.37586
6 -1515.77586 -1778.97586
7 -1445.35172 -1515.77586
8 -2111.95172 -1445.35172
9 1422.24828 -2111.95172
10 -1585.95172 1422.24828
11 428.44828 -1585.95172
12 -355.97586 428.44828
13 -2586.37586 -355.97586
14 195.62414 -2586.37586
15 -1125.97586 195.62414
16 1788.62414 -1125.97586
17 2136.02414 1788.62414
18 3894.22414 2136.02414
19 -762.35172 3894.22414
20 2219.04828 -762.35172
21 -1930.75172 2219.04828
22 -1398.95172 -1930.75172
23 -973.55172 -1398.95172
24 -1834.97586 -973.55172
25 -1376.37586 -1834.97586
26 -901.37586 -1376.37586
27 -2456.97586 -901.37586
28 956.62414 -2456.97586
29 -818.97586 956.62414
30 39.22414 -818.97586
31 -2068.35172 39.22414
32 583.04828 -2068.35172
33 156.24828 583.04828
34 862.04828 156.24828
35 386.44828 862.04828
36 384.02414 386.44828
37 2404.62414 384.02414
38 1530.62414 2404.62414
39 914.02414 1530.62414
40 1398.62414 914.02414
41 2741.02414 1398.62414
42 -592.77586 2741.02414
43 5007.52759 -592.77586
44 2309.92759 5007.52759
45 2214.12759 2309.92759
46 1649.92759 2214.12759
47 488.32759 1649.92759
48 1480.90345 488.32759
49 1147.50345 1480.90345
50 -1710.49655 1147.50345
51 685.90345 -1710.49655
52 -3719.49655 685.90345
53 -2279.09655 -3719.49655
54 -1824.89655 -2279.09655
55 -731.47241 -1824.89655
56 -3000.07241 -731.47241
57 -1861.87241 -3000.07241
58 472.92759 -1861.87241
59 -329.67241 472.92759
> 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/71gqp1260972119.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/8k2w91260972119.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/9zc8x1260972119.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/10vbkz1260972119.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/11ycbp1260972119.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/12f77q1260972119.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/13gc3k1260972119.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/148fw51260972119.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/15f1331260972119.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/16tvdk1260972119.tab")
+ }
>
> try(system("convert tmp/1ufwr1260972119.ps tmp/1ufwr1260972119.png",intern=TRUE))
character(0)
> try(system("convert tmp/2s1fm1260972119.ps tmp/2s1fm1260972119.png",intern=TRUE))
character(0)
> try(system("convert tmp/3sy1k1260972119.ps tmp/3sy1k1260972119.png",intern=TRUE))
character(0)
> try(system("convert tmp/486c61260972119.ps tmp/486c61260972119.png",intern=TRUE))
character(0)
> try(system("convert tmp/5bkrx1260972119.ps tmp/5bkrx1260972119.png",intern=TRUE))
character(0)
> try(system("convert tmp/6ypmw1260972119.ps tmp/6ypmw1260972119.png",intern=TRUE))
character(0)
> try(system("convert tmp/71gqp1260972119.ps tmp/71gqp1260972119.png",intern=TRUE))
character(0)
> try(system("convert tmp/8k2w91260972119.ps tmp/8k2w91260972119.png",intern=TRUE))
character(0)
> try(system("convert tmp/9zc8x1260972119.ps tmp/9zc8x1260972119.png",intern=TRUE))
character(0)
> try(system("convert tmp/10vbkz1260972119.ps tmp/10vbkz1260972119.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.432 1.601 3.536