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(151.7,105.2,121.3,105.2,133.0,105.6,119.6,105.6,122.2,106.2,117.4,106.3,106.7,106.4,87.5,106.9,81.0,107.2,110.3,107.3,87.0,107.3,55.7,107.4,146.0,107.55,137.5,107.87,138.5,108.37,135.6,108.38,107.3,107.92,99.0,108.03,91.4,108.14,68.4,108.3,82.6,108.64,98.4,108.66,71.3,109.04,47.6,109.03,130.8,109.03,113.6,109.54,125.7,109.75,113.6,109.83,97.1,109.65,104.4,109.82,91.8,109.95,75.1,110.12,89.2,110.15,110.2,110.2,78.4,109.99,68.4,110.14,122.8,110.14,129.7,110.81,159.1,110.97,139.0,110.99,102.2,109.73,113.6,109.81,81.5,110.02,77.4,110.18,87.6,110.21,101.2,110.25,87.2,110.36,64.9,110.51,133.1,110.64,118.0,110.95,135.9,111.18,125.7,111.19,108.0,111.69,128.3,111.7,84.7,111.83,86.4,111.77,92.2,111.73,95.8,112.01,92.3,111.86,54.3,112.04),dim=c(2,60),dimnames=list(c('Yt','Xt'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Yt','Xt'),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 = '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
Yt Xt
1 151.7 105.20
2 121.3 105.20
3 133.0 105.60
4 119.6 105.60
5 122.2 106.20
6 117.4 106.30
7 106.7 106.40
8 87.5 106.90
9 81.0 107.20
10 110.3 107.30
11 87.0 107.30
12 55.7 107.40
13 146.0 107.55
14 137.5 107.87
15 138.5 108.37
16 135.6 108.38
17 107.3 107.92
18 99.0 108.03
19 91.4 108.14
20 68.4 108.30
21 82.6 108.64
22 98.4 108.66
23 71.3 109.04
24 47.6 109.03
25 130.8 109.03
26 113.6 109.54
27 125.7 109.75
28 113.6 109.83
29 97.1 109.65
30 104.4 109.82
31 91.8 109.95
32 75.1 110.12
33 89.2 110.15
34 110.2 110.20
35 78.4 109.99
36 68.4 110.14
37 122.8 110.14
38 129.7 110.81
39 159.1 110.97
40 139.0 110.99
41 102.2 109.73
42 113.6 109.81
43 81.5 110.02
44 77.4 110.18
45 87.6 110.21
46 101.2 110.25
47 87.2 110.36
48 64.9 110.51
49 133.1 110.64
50 118.0 110.95
51 135.9 111.18
52 125.7 111.19
53 108.0 111.69
54 128.3 111.70
55 84.7 111.83
56 86.4 111.77
57 92.2 111.73
58 95.8 112.01
59 92.3 111.86
60 54.3 112.04
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Xt
365.826 -2.396
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-56.955 -16.636 -0.554 20.396 59.194
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 365.826 194.027 1.885 0.0644 .
Xt -2.396 1.775 -1.350 0.1823
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 25.47 on 58 degrees of freedom
Multiple R-squared: 0.03046, Adjusted R-squared: 0.01375
F-statistic: 1.822 on 1 and 58 DF, p-value: 0.1823
> 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.171100589 0.34220118 0.82889941
[2,] 0.073476964 0.14695393 0.92652304
[3,] 0.034893599 0.06978720 0.96510640
[4,] 0.020704325 0.04140865 0.97929567
[5,] 0.008932837 0.01786567 0.99106716
[6,] 0.017825665 0.03565133 0.98217434
[7,] 0.008141555 0.01628311 0.99185845
[8,] 0.028464637 0.05692927 0.97153536
[9,] 0.386808980 0.77361796 0.61319102
[10,] 0.578222635 0.84355473 0.42177736
[11,] 0.695382827 0.60923435 0.30461717
[12,] 0.732788766 0.53442247 0.26721123
[13,] 0.668857462 0.66228508 0.33114254
[14,] 0.603762286 0.79247543 0.39623771
[15,] 0.546885769 0.90622846 0.45311423
[16,] 0.593274398 0.81345120 0.40672560
[17,] 0.538659596 0.92268081 0.46134040
[18,] 0.458786733 0.91757347 0.54121327
[19,] 0.444344895 0.88868979 0.55565510
[20,] 0.628596083 0.74280783 0.37140392
[21,] 0.705638263 0.58872347 0.29436174
[22,] 0.681884512 0.63623098 0.31811549
[23,] 0.710055894 0.57988821 0.28994411
[24,] 0.672036341 0.65592732 0.32796366
[25,] 0.600194082 0.79961184 0.39980592
[26,] 0.530671789 0.93865642 0.46932821
[27,] 0.457995879 0.91599176 0.54200412
[28,] 0.438387727 0.87677545 0.56161227
[29,] 0.373645423 0.74729085 0.62635458
[30,] 0.321875919 0.64375184 0.67812408
[31,] 0.296991450 0.59398290 0.70300855
[32,] 0.332040847 0.66408169 0.66795915
[33,] 0.321647037 0.64329407 0.67835296
[34,] 0.356066465 0.71213293 0.64393354
[35,] 0.688376509 0.62324698 0.31162349
[36,] 0.782321633 0.43535673 0.21767837
[37,] 0.715754355 0.56849129 0.28424564
[38,] 0.665456524 0.66908695 0.33454348
[39,] 0.622454116 0.75509177 0.37754588
[40,] 0.612826686 0.77434663 0.38717331
[41,] 0.565619320 0.86876136 0.43438068
[42,] 0.480480804 0.96096161 0.51951920
[43,] 0.475408062 0.95081612 0.52459194
[44,] 0.940428383 0.11914323 0.05957162
[45,] 0.925951593 0.14809681 0.07404841
[46,] 0.940842398 0.11831520 0.05915760
[47,] 0.901813145 0.19637371 0.09818685
[48,] 0.885004228 0.22999154 0.11499577
[49,] 0.796074175 0.40785165 0.20392583
[50,] 0.862796489 0.27440702 0.13720351
[51,] 0.733258260 0.53348348 0.26674174
> postscript(file="/var/www/html/rcomp/tmp/1qdkn1258730064.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/23a9w1258730064.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/3ihd31258730064.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/43wuf1258730064.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/5ixb01258730064.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
37.96755134 7.56755134 20.22608181 6.82608181 10.86387751 6.30351012
7 8 9 10 11 12
-4.15685726 -22.15869417 -27.93979632 1.59983629 -21.70016371 -52.76053109
13 14 15 16 17 18
37.89891784 30.16574221 32.36390530 29.48786856 0.08555852 -7.95084560
19 20 21 22 23 24
-15.28724972 -37.90383754 -22.88908664 -7.04116011 -33.23055617 -56.95451943
25 26 27 28 29 30
26.24548057 10.26760692 22.87083541 10.96254151 -5.96879721 1.73857824
31 32 33 34 35 36
-10.54989935 -26.84252391 -12.67063412 8.44918219 -23.85404631 -33.49459738
37 38 39 40 41 42
20.90540262 29.41094115 59.19435334 39.14227986 -0.67709111 10.91461498
43 44 45 46 47 48
-20.68215652 -24.39874434 -14.12685455 -0.43100150 -14.16740562 -36.10795670
49 50 51 52 53 54
32.40356570 18.04642682 36.49758184 26.32154510 9.81970818 30.14367144
55 56 57 58 59 60
-13.14480615 -11.58858572 -5.88443877 -1.61346744 -5.47291637 -43.04157766
> postscript(file="/var/www/html/rcomp/tmp/6216n1258730064.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 37.96755134 NA
1 7.56755134 37.96755134
2 20.22608181 7.56755134
3 6.82608181 20.22608181
4 10.86387751 6.82608181
5 6.30351012 10.86387751
6 -4.15685726 6.30351012
7 -22.15869417 -4.15685726
8 -27.93979632 -22.15869417
9 1.59983629 -27.93979632
10 -21.70016371 1.59983629
11 -52.76053109 -21.70016371
12 37.89891784 -52.76053109
13 30.16574221 37.89891784
14 32.36390530 30.16574221
15 29.48786856 32.36390530
16 0.08555852 29.48786856
17 -7.95084560 0.08555852
18 -15.28724972 -7.95084560
19 -37.90383754 -15.28724972
20 -22.88908664 -37.90383754
21 -7.04116011 -22.88908664
22 -33.23055617 -7.04116011
23 -56.95451943 -33.23055617
24 26.24548057 -56.95451943
25 10.26760692 26.24548057
26 22.87083541 10.26760692
27 10.96254151 22.87083541
28 -5.96879721 10.96254151
29 1.73857824 -5.96879721
30 -10.54989935 1.73857824
31 -26.84252391 -10.54989935
32 -12.67063412 -26.84252391
33 8.44918219 -12.67063412
34 -23.85404631 8.44918219
35 -33.49459738 -23.85404631
36 20.90540262 -33.49459738
37 29.41094115 20.90540262
38 59.19435334 29.41094115
39 39.14227986 59.19435334
40 -0.67709111 39.14227986
41 10.91461498 -0.67709111
42 -20.68215652 10.91461498
43 -24.39874434 -20.68215652
44 -14.12685455 -24.39874434
45 -0.43100150 -14.12685455
46 -14.16740562 -0.43100150
47 -36.10795670 -14.16740562
48 32.40356570 -36.10795670
49 18.04642682 32.40356570
50 36.49758184 18.04642682
51 26.32154510 36.49758184
52 9.81970818 26.32154510
53 30.14367144 9.81970818
54 -13.14480615 30.14367144
55 -11.58858572 -13.14480615
56 -5.88443877 -11.58858572
57 -1.61346744 -5.88443877
58 -5.47291637 -1.61346744
59 -43.04157766 -5.47291637
60 NA -43.04157766
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 7.56755134 37.96755134
[2,] 20.22608181 7.56755134
[3,] 6.82608181 20.22608181
[4,] 10.86387751 6.82608181
[5,] 6.30351012 10.86387751
[6,] -4.15685726 6.30351012
[7,] -22.15869417 -4.15685726
[8,] -27.93979632 -22.15869417
[9,] 1.59983629 -27.93979632
[10,] -21.70016371 1.59983629
[11,] -52.76053109 -21.70016371
[12,] 37.89891784 -52.76053109
[13,] 30.16574221 37.89891784
[14,] 32.36390530 30.16574221
[15,] 29.48786856 32.36390530
[16,] 0.08555852 29.48786856
[17,] -7.95084560 0.08555852
[18,] -15.28724972 -7.95084560
[19,] -37.90383754 -15.28724972
[20,] -22.88908664 -37.90383754
[21,] -7.04116011 -22.88908664
[22,] -33.23055617 -7.04116011
[23,] -56.95451943 -33.23055617
[24,] 26.24548057 -56.95451943
[25,] 10.26760692 26.24548057
[26,] 22.87083541 10.26760692
[27,] 10.96254151 22.87083541
[28,] -5.96879721 10.96254151
[29,] 1.73857824 -5.96879721
[30,] -10.54989935 1.73857824
[31,] -26.84252391 -10.54989935
[32,] -12.67063412 -26.84252391
[33,] 8.44918219 -12.67063412
[34,] -23.85404631 8.44918219
[35,] -33.49459738 -23.85404631
[36,] 20.90540262 -33.49459738
[37,] 29.41094115 20.90540262
[38,] 59.19435334 29.41094115
[39,] 39.14227986 59.19435334
[40,] -0.67709111 39.14227986
[41,] 10.91461498 -0.67709111
[42,] -20.68215652 10.91461498
[43,] -24.39874434 -20.68215652
[44,] -14.12685455 -24.39874434
[45,] -0.43100150 -14.12685455
[46,] -14.16740562 -0.43100150
[47,] -36.10795670 -14.16740562
[48,] 32.40356570 -36.10795670
[49,] 18.04642682 32.40356570
[50,] 36.49758184 18.04642682
[51,] 26.32154510 36.49758184
[52,] 9.81970818 26.32154510
[53,] 30.14367144 9.81970818
[54,] -13.14480615 30.14367144
[55,] -11.58858572 -13.14480615
[56,] -5.88443877 -11.58858572
[57,] -1.61346744 -5.88443877
[58,] -5.47291637 -1.61346744
[59,] -43.04157766 -5.47291637
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 7.56755134 37.96755134
2 20.22608181 7.56755134
3 6.82608181 20.22608181
4 10.86387751 6.82608181
5 6.30351012 10.86387751
6 -4.15685726 6.30351012
7 -22.15869417 -4.15685726
8 -27.93979632 -22.15869417
9 1.59983629 -27.93979632
10 -21.70016371 1.59983629
11 -52.76053109 -21.70016371
12 37.89891784 -52.76053109
13 30.16574221 37.89891784
14 32.36390530 30.16574221
15 29.48786856 32.36390530
16 0.08555852 29.48786856
17 -7.95084560 0.08555852
18 -15.28724972 -7.95084560
19 -37.90383754 -15.28724972
20 -22.88908664 -37.90383754
21 -7.04116011 -22.88908664
22 -33.23055617 -7.04116011
23 -56.95451943 -33.23055617
24 26.24548057 -56.95451943
25 10.26760692 26.24548057
26 22.87083541 10.26760692
27 10.96254151 22.87083541
28 -5.96879721 10.96254151
29 1.73857824 -5.96879721
30 -10.54989935 1.73857824
31 -26.84252391 -10.54989935
32 -12.67063412 -26.84252391
33 8.44918219 -12.67063412
34 -23.85404631 8.44918219
35 -33.49459738 -23.85404631
36 20.90540262 -33.49459738
37 29.41094115 20.90540262
38 59.19435334 29.41094115
39 39.14227986 59.19435334
40 -0.67709111 39.14227986
41 10.91461498 -0.67709111
42 -20.68215652 10.91461498
43 -24.39874434 -20.68215652
44 -14.12685455 -24.39874434
45 -0.43100150 -14.12685455
46 -14.16740562 -0.43100150
47 -36.10795670 -14.16740562
48 32.40356570 -36.10795670
49 18.04642682 32.40356570
50 36.49758184 18.04642682
51 26.32154510 36.49758184
52 9.81970818 26.32154510
53 30.14367144 9.81970818
54 -13.14480615 30.14367144
55 -11.58858572 -13.14480615
56 -5.88443877 -11.58858572
57 -1.61346744 -5.88443877
58 -5.47291637 -1.61346744
59 -43.04157766 -5.47291637
> 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/7p5hq1258730064.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/8kkn81258730064.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/9wzrg1258730064.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/10q1xm1258730064.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/114e7e1258730064.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/12yf4x1258730064.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/138bt11258730064.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/142l931258730064.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/153fom1258730064.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/16b2zs1258730064.tab")
+ }
>
> system("convert tmp/1qdkn1258730064.ps tmp/1qdkn1258730064.png")
> system("convert tmp/23a9w1258730064.ps tmp/23a9w1258730064.png")
> system("convert tmp/3ihd31258730064.ps tmp/3ihd31258730064.png")
> system("convert tmp/43wuf1258730064.ps tmp/43wuf1258730064.png")
> system("convert tmp/5ixb01258730064.ps tmp/5ixb01258730064.png")
> system("convert tmp/6216n1258730064.ps tmp/6216n1258730064.png")
> system("convert tmp/7p5hq1258730064.ps tmp/7p5hq1258730064.png")
> system("convert tmp/8kkn81258730064.ps tmp/8kkn81258730064.png")
> system("convert tmp/9wzrg1258730064.ps tmp/9wzrg1258730064.png")
> system("convert tmp/10q1xm1258730064.ps tmp/10q1xm1258730064.png")
>
>
> proc.time()
user system elapsed
2.479 1.599 2.908