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(90.8,0,96.4,0,90,0,92.1,0,97.2,0,95.1,0,88.5,0,91,0,90.5,1,75,1,66.3,1,66,0,68.4,0,70.6,0,83.9,0,90.1,0,90.6,0,87.1,0,90.8,0,94.1,0,99.8,0,96.8,0,87,0,96.3,0,107.1,0,115.2,0,106.1,1,89.5,1,91.3,1,97.6,1,100.7,1,104.6,1,94.7,1,101.8,1,102.5,1,105.3,1,110.3,1,109.8,1,117.3,1,118.8,1,131.3,1,125.9,1,133.1,1,147,1,145.8,1,164.4,1,149.8,1,137.7,1,151.7,1,156.8,1,180,1,180.4,1,170.4,1,191.6,1,199.5,1,218.2,1,217.5,1,205,1,194,1,199.3,1),dim=c(2,60),dimnames=list(c('Y','t'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Y','t'),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 t M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 90.8 0 1 0 0 0 0 0 0 0 0 0 0
2 96.4 0 0 1 0 0 0 0 0 0 0 0 0
3 90.0 0 0 0 1 0 0 0 0 0 0 0 0
4 92.1 0 0 0 0 1 0 0 0 0 0 0 0
5 97.2 0 0 0 0 0 1 0 0 0 0 0 0
6 95.1 0 0 0 0 0 0 1 0 0 0 0 0
7 88.5 0 0 0 0 0 0 0 1 0 0 0 0
8 91.0 0 0 0 0 0 0 0 0 1 0 0 0
9 90.5 1 0 0 0 0 0 0 0 0 1 0 0
10 75.0 1 0 0 0 0 0 0 0 0 0 1 0
11 66.3 1 0 0 0 0 0 0 0 0 0 0 1
12 66.0 0 0 0 0 0 0 0 0 0 0 0 0
13 68.4 0 1 0 0 0 0 0 0 0 0 0 0
14 70.6 0 0 1 0 0 0 0 0 0 0 0 0
15 83.9 0 0 0 1 0 0 0 0 0 0 0 0
16 90.1 0 0 0 0 1 0 0 0 0 0 0 0
17 90.6 0 0 0 0 0 1 0 0 0 0 0 0
18 87.1 0 0 0 0 0 0 1 0 0 0 0 0
19 90.8 0 0 0 0 0 0 0 1 0 0 0 0
20 94.1 0 0 0 0 0 0 0 0 1 0 0 0
21 99.8 0 0 0 0 0 0 0 0 0 1 0 0
22 96.8 0 0 0 0 0 0 0 0 0 0 1 0
23 87.0 0 0 0 0 0 0 0 0 0 0 0 1
24 96.3 0 0 0 0 0 0 0 0 0 0 0 0
25 107.1 0 1 0 0 0 0 0 0 0 0 0 0
26 115.2 0 0 1 0 0 0 0 0 0 0 0 0
27 106.1 1 0 0 1 0 0 0 0 0 0 0 0
28 89.5 1 0 0 0 1 0 0 0 0 0 0 0
29 91.3 1 0 0 0 0 1 0 0 0 0 0 0
30 97.6 1 0 0 0 0 0 1 0 0 0 0 0
31 100.7 1 0 0 0 0 0 0 1 0 0 0 0
32 104.6 1 0 0 0 0 0 0 0 1 0 0 0
33 94.7 1 0 0 0 0 0 0 0 0 1 0 0
34 101.8 1 0 0 0 0 0 0 0 0 0 1 0
35 102.5 1 0 0 0 0 0 0 0 0 0 0 1
36 105.3 1 0 0 0 0 0 0 0 0 0 0 0
37 110.3 1 1 0 0 0 0 0 0 0 0 0 0
38 109.8 1 0 1 0 0 0 0 0 0 0 0 0
39 117.3 1 0 0 1 0 0 0 0 0 0 0 0
40 118.8 1 0 0 0 1 0 0 0 0 0 0 0
41 131.3 1 0 0 0 0 1 0 0 0 0 0 0
42 125.9 1 0 0 0 0 0 1 0 0 0 0 0
43 133.1 1 0 0 0 0 0 0 1 0 0 0 0
44 147.0 1 0 0 0 0 0 0 0 1 0 0 0
45 145.8 1 0 0 0 0 0 0 0 0 1 0 0
46 164.4 1 0 0 0 0 0 0 0 0 0 1 0
47 149.8 1 0 0 0 0 0 0 0 0 0 0 1
48 137.7 1 0 0 0 0 0 0 0 0 0 0 0
49 151.7 1 1 0 0 0 0 0 0 0 0 0 0
50 156.8 1 0 1 0 0 0 0 0 0 0 0 0
51 180.0 1 0 0 1 0 0 0 0 0 0 0 0
52 180.4 1 0 0 0 1 0 0 0 0 0 0 0
53 170.4 1 0 0 0 0 1 0 0 0 0 0 0
54 191.6 1 0 0 0 0 0 1 0 0 0 0 0
55 199.5 1 0 0 0 0 0 0 1 0 0 0 0
56 218.2 1 0 0 0 0 0 0 0 1 0 0 0
57 217.5 1 0 0 0 0 0 0 0 0 1 0 0
58 205.0 1 0 0 0 0 0 0 0 0 0 1 0
59 194.0 1 0 0 0 0 0 0 0 0 0 0 1
60 199.3 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) t M1 M2 M3 M4
92.7882 46.8864 -5.8827 -1.7827 -5.4600 -6.7400
M5 M6 M7 M8 M9 M10
-4.7600 -1.4600 1.6000 10.0600 -0.6373 -1.6973
M11
-10.3773
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-62.997 -24.316 -2.355 18.158 78.463
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 92.7882 18.0416 5.143 5.18e-06 ***
t 46.8864 10.4163 4.501 4.44e-05 ***
M1 -5.8827 24.0254 -0.245 0.808
M2 -1.7827 24.0254 -0.074 0.941
M3 -5.4600 23.9349 -0.228 0.821
M4 -6.7400 23.9349 -0.282 0.779
M5 -4.7600 23.9349 -0.199 0.843
M6 -1.4600 23.9349 -0.061 0.952
M7 1.6000 23.9349 0.067 0.947
M8 10.0600 23.9349 0.420 0.676
M9 -0.6373 24.0254 -0.027 0.979
M10 -1.6973 24.0254 -0.071 0.944
M11 -10.3773 24.0254 -0.432 0.668
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 37.84 on 47 degrees of freedom
Multiple R-squared: 0.3248, Adjusted R-squared: 0.1524
F-statistic: 1.884 on 12 and 47 DF, p-value: 0.06142
> 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,] 5.220121e-02 1.044024e-01 0.9477988
[2,] 1.515320e-02 3.030640e-02 0.9848468
[3,] 4.203151e-03 8.406302e-03 0.9957968
[4,] 9.749936e-04 1.949987e-03 0.9990250
[5,] 2.124855e-04 4.249709e-04 0.9997875
[6,] 4.159385e-05 8.318770e-05 0.9999584
[7,] 9.840892e-06 1.968178e-05 0.9999902
[8,] 1.905619e-06 3.811239e-06 0.9999981
[9,] 4.444085e-06 8.888171e-06 0.9999956
[10,] 6.566673e-06 1.313335e-05 0.9999934
[11,] 1.080353e-05 2.160705e-05 0.9999892
[12,] 1.328805e-05 2.657610e-05 0.9999867
[13,] 5.020860e-06 1.004172e-05 0.9999950
[14,] 1.872570e-06 3.745140e-06 0.9999981
[15,] 8.513097e-07 1.702619e-06 0.9999991
[16,] 4.813668e-07 9.627335e-07 0.9999995
[17,] 3.710017e-07 7.420033e-07 0.9999996
[18,] 3.428718e-07 6.857436e-07 0.9999997
[19,] 5.540822e-07 1.108164e-06 0.9999994
[20,] 1.312389e-06 2.624777e-06 0.9999987
[21,] 2.087496e-06 4.174991e-06 0.9999979
[22,] 1.319588e-06 2.639176e-06 0.9999987
[23,] 7.188183e-07 1.437637e-06 0.9999993
[24,] 1.020332e-06 2.040664e-06 0.9999990
[25,] 1.900517e-06 3.801035e-06 0.9999981
[26,] 3.106754e-06 6.213508e-06 0.9999969
[27,] 8.393357e-06 1.678671e-05 0.9999916
[28,] 3.754438e-05 7.508877e-05 0.9999625
[29,] 4.053572e-04 8.107144e-04 0.9995946
> postscript(file="/var/www/html/rcomp/tmp/1apq21229598562.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/2z0ye1229598562.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/35i7j1229598562.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/4nztt1229598562.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/5lgdr1229598562.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 7
3.894545 5.394545 2.671818 6.051818 9.171818 3.771818 -5.888182
8 9 10 11 12 13 14
-11.848182 -48.537273 -62.977273 -62.997273 -26.788182 -18.505455 -20.405455
15 16 17 18 19 20 21
-3.428182 4.051818 2.571818 -4.228182 -3.588182 -8.748182 7.649091
22 23 24 25 26 27 28
5.709091 4.589091 3.511818 20.194545 24.194545 -28.114545 -43.434545
29 30 31 32 33 34 35
-43.614545 -40.614545 -40.574545 -45.134545 -44.337273 -36.177273 -26.797273
36 37 38 39 40 41 42
-34.374545 -23.491818 -28.091818 -16.914545 -14.134545 -3.614545 -12.314545
43 44 45 46 47 48 49
-8.174545 -2.734545 6.762727 26.422727 20.502727 -1.974545 17.908182
50 51 52 53 54 55 56
18.908182 45.785455 47.465455 35.485455 53.385455 58.225455 68.465455
57 58 59 60
78.462727 67.022727 64.702727 59.625455
> postscript(file="/var/www/html/rcomp/tmp/6ertt1229598562.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 3.894545 NA
1 5.394545 3.894545
2 2.671818 5.394545
3 6.051818 2.671818
4 9.171818 6.051818
5 3.771818 9.171818
6 -5.888182 3.771818
7 -11.848182 -5.888182
8 -48.537273 -11.848182
9 -62.977273 -48.537273
10 -62.997273 -62.977273
11 -26.788182 -62.997273
12 -18.505455 -26.788182
13 -20.405455 -18.505455
14 -3.428182 -20.405455
15 4.051818 -3.428182
16 2.571818 4.051818
17 -4.228182 2.571818
18 -3.588182 -4.228182
19 -8.748182 -3.588182
20 7.649091 -8.748182
21 5.709091 7.649091
22 4.589091 5.709091
23 3.511818 4.589091
24 20.194545 3.511818
25 24.194545 20.194545
26 -28.114545 24.194545
27 -43.434545 -28.114545
28 -43.614545 -43.434545
29 -40.614545 -43.614545
30 -40.574545 -40.614545
31 -45.134545 -40.574545
32 -44.337273 -45.134545
33 -36.177273 -44.337273
34 -26.797273 -36.177273
35 -34.374545 -26.797273
36 -23.491818 -34.374545
37 -28.091818 -23.491818
38 -16.914545 -28.091818
39 -14.134545 -16.914545
40 -3.614545 -14.134545
41 -12.314545 -3.614545
42 -8.174545 -12.314545
43 -2.734545 -8.174545
44 6.762727 -2.734545
45 26.422727 6.762727
46 20.502727 26.422727
47 -1.974545 20.502727
48 17.908182 -1.974545
49 18.908182 17.908182
50 45.785455 18.908182
51 47.465455 45.785455
52 35.485455 47.465455
53 53.385455 35.485455
54 58.225455 53.385455
55 68.465455 58.225455
56 78.462727 68.465455
57 67.022727 78.462727
58 64.702727 67.022727
59 59.625455 64.702727
60 NA 59.625455
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 5.394545 3.894545
[2,] 2.671818 5.394545
[3,] 6.051818 2.671818
[4,] 9.171818 6.051818
[5,] 3.771818 9.171818
[6,] -5.888182 3.771818
[7,] -11.848182 -5.888182
[8,] -48.537273 -11.848182
[9,] -62.977273 -48.537273
[10,] -62.997273 -62.977273
[11,] -26.788182 -62.997273
[12,] -18.505455 -26.788182
[13,] -20.405455 -18.505455
[14,] -3.428182 -20.405455
[15,] 4.051818 -3.428182
[16,] 2.571818 4.051818
[17,] -4.228182 2.571818
[18,] -3.588182 -4.228182
[19,] -8.748182 -3.588182
[20,] 7.649091 -8.748182
[21,] 5.709091 7.649091
[22,] 4.589091 5.709091
[23,] 3.511818 4.589091
[24,] 20.194545 3.511818
[25,] 24.194545 20.194545
[26,] -28.114545 24.194545
[27,] -43.434545 -28.114545
[28,] -43.614545 -43.434545
[29,] -40.614545 -43.614545
[30,] -40.574545 -40.614545
[31,] -45.134545 -40.574545
[32,] -44.337273 -45.134545
[33,] -36.177273 -44.337273
[34,] -26.797273 -36.177273
[35,] -34.374545 -26.797273
[36,] -23.491818 -34.374545
[37,] -28.091818 -23.491818
[38,] -16.914545 -28.091818
[39,] -14.134545 -16.914545
[40,] -3.614545 -14.134545
[41,] -12.314545 -3.614545
[42,] -8.174545 -12.314545
[43,] -2.734545 -8.174545
[44,] 6.762727 -2.734545
[45,] 26.422727 6.762727
[46,] 20.502727 26.422727
[47,] -1.974545 20.502727
[48,] 17.908182 -1.974545
[49,] 18.908182 17.908182
[50,] 45.785455 18.908182
[51,] 47.465455 45.785455
[52,] 35.485455 47.465455
[53,] 53.385455 35.485455
[54,] 58.225455 53.385455
[55,] 68.465455 58.225455
[56,] 78.462727 68.465455
[57,] 67.022727 78.462727
[58,] 64.702727 67.022727
[59,] 59.625455 64.702727
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 5.394545 3.894545
2 2.671818 5.394545
3 6.051818 2.671818
4 9.171818 6.051818
5 3.771818 9.171818
6 -5.888182 3.771818
7 -11.848182 -5.888182
8 -48.537273 -11.848182
9 -62.977273 -48.537273
10 -62.997273 -62.977273
11 -26.788182 -62.997273
12 -18.505455 -26.788182
13 -20.405455 -18.505455
14 -3.428182 -20.405455
15 4.051818 -3.428182
16 2.571818 4.051818
17 -4.228182 2.571818
18 -3.588182 -4.228182
19 -8.748182 -3.588182
20 7.649091 -8.748182
21 5.709091 7.649091
22 4.589091 5.709091
23 3.511818 4.589091
24 20.194545 3.511818
25 24.194545 20.194545
26 -28.114545 24.194545
27 -43.434545 -28.114545
28 -43.614545 -43.434545
29 -40.614545 -43.614545
30 -40.574545 -40.614545
31 -45.134545 -40.574545
32 -44.337273 -45.134545
33 -36.177273 -44.337273
34 -26.797273 -36.177273
35 -34.374545 -26.797273
36 -23.491818 -34.374545
37 -28.091818 -23.491818
38 -16.914545 -28.091818
39 -14.134545 -16.914545
40 -3.614545 -14.134545
41 -12.314545 -3.614545
42 -8.174545 -12.314545
43 -2.734545 -8.174545
44 6.762727 -2.734545
45 26.422727 6.762727
46 20.502727 26.422727
47 -1.974545 20.502727
48 17.908182 -1.974545
49 18.908182 17.908182
50 45.785455 18.908182
51 47.465455 45.785455
52 35.485455 47.465455
53 53.385455 35.485455
54 58.225455 53.385455
55 68.465455 58.225455
56 78.462727 68.465455
57 67.022727 78.462727
58 64.702727 67.022727
59 59.625455 64.702727
> 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/7rpqr1229598562.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/8fh1c1229598562.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/92j4q1229598562.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/10nzop1229598562.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/11n1ku1229598562.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/12fq8r1229598562.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/13xu4h1229598562.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/14bsr81229598563.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/15ckr11229598563.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/16sk1f1229598563.tab")
+ }
>
> system("convert tmp/1apq21229598562.ps tmp/1apq21229598562.png")
> system("convert tmp/2z0ye1229598562.ps tmp/2z0ye1229598562.png")
> system("convert tmp/35i7j1229598562.ps tmp/35i7j1229598562.png")
> system("convert tmp/4nztt1229598562.ps tmp/4nztt1229598562.png")
> system("convert tmp/5lgdr1229598562.ps tmp/5lgdr1229598562.png")
> system("convert tmp/6ertt1229598562.ps tmp/6ertt1229598562.png")
> system("convert tmp/7rpqr1229598562.ps tmp/7rpqr1229598562.png")
> system("convert tmp/8fh1c1229598562.ps tmp/8fh1c1229598562.png")
> system("convert tmp/92j4q1229598562.ps tmp/92j4q1229598562.png")
> system("convert tmp/10nzop1229598562.ps tmp/10nzop1229598562.png")
>
>
> proc.time()
user system elapsed
2.427 1.594 3.207