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(7.3,7.9,7.6,9.1,7.5,9.4,7.6,9.4,7.9,9.1,7.9,9,8.1,9.3,8.2,9.9,8,9.8,7.5,9.3,6.8,8.3,6.5,8,6.6,8.5,7.6,10.4,8,11.1,8.1,10.9,7.7,10,7.5,9.2,7.6,9.2,7.8,9.5,7.8,9.6,7.8,9.5,7.5,9.1,7.5,8.9,7.1,9,7.5,10.1,7.5,10.3,7.6,10.2,7.7,9.6,7.7,9.2,7.9,9.3,8.1,9.4,8.2,9.4,8.2,9.2,8.2,9,7.9,9,7.3,9,6.9,9.8,6.6,10,6.7,9.8,6.9,9.3,7,9,7.1,9,7.2,9.1,7.1,9.1,6.9,9.1,7,9.2,6.8,8.8,6.4,8.3,6.7,8.4,6.6,8.1,6.4,7.7,6.3,7.9,6.2,7.9,6.5,8,6.8,7.9,6.8,7.6,6.4,7.1,6.1,6.8,5.8,6.5,6.1,6.9,7.2,8.2,7.3,8.7,6.9,8.3,6.1,7.9,5.8,7.5,6.2,7.8,7.1,8.3,7.7,8.4,7.9,8.2,7.7,7.7,7.4,7.2,7.5,7.3),dim=c(2,73),dimnames=list(c('WGM','WGV'),1:73))
> y <- array(NA,dim=c(2,73),dimnames=list(c('WGM','WGV'),1:73))
> 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
WGM WGV M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 7.3 7.9 1 0 0 0 0 0 0 0 0 0 0
2 7.6 9.1 0 1 0 0 0 0 0 0 0 0 0
3 7.5 9.4 0 0 1 0 0 0 0 0 0 0 0
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68 7.1 8.3 0 0 0 0 0 0 0 1 0 0 0
69 7.7 8.4 0 0 0 0 0 0 0 0 1 0 0
70 7.9 8.2 0 0 0 0 0 0 0 0 0 1 0
71 7.7 7.7 0 0 0 0 0 0 0 0 0 0 1
72 7.4 7.2 0 0 0 0 0 0 0 0 0 0 0
73 7.5 7.3 1 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) WGV M1 M2 M3 M4
2.91557 0.50427 -0.11455 -0.37207 -0.50654 -0.43062
M5 M6 M7 M8 M9 M10
-0.33717 -0.25242 -0.10299 0.07095 0.15442 0.13049
M11
0.09046
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.85171 -0.34673 -0.03943 0.37493 1.01782
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.91557 0.58076 5.020 4.91e-06 ***
WGV 0.50427 0.06774 7.445 4.35e-10 ***
M1 -0.11455 0.26824 -0.427 0.6709
M2 -0.37207 0.29126 -1.277 0.2064
M3 -0.50654 0.29708 -1.705 0.0934 .
M4 -0.43062 0.29227 -1.473 0.1459
M5 -0.33717 0.28493 -1.183 0.2413
M6 -0.25242 0.28097 -0.898 0.3726
M7 -0.10299 0.28234 -0.365 0.7166
M8 0.07095 0.28567 0.248 0.8047
M9 0.15442 0.28517 0.541 0.5902
M10 0.13049 0.28197 0.463 0.6452
M11 0.09046 0.27899 0.324 0.7469
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.4821 on 60 degrees of freedom
Multiple R-squared: 0.5351, Adjusted R-squared: 0.4421
F-statistic: 5.755 on 12 and 60 DF, p-value: 1.726e-06
> 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.350710977 0.701421955 0.64928902
[2,] 0.237898775 0.475797550 0.76210122
[3,] 0.182552330 0.365104660 0.81744767
[4,] 0.153535132 0.307070264 0.84646487
[5,] 0.105703620 0.211407241 0.89429638
[6,] 0.060801423 0.121602846 0.93919858
[7,] 0.036680508 0.073361017 0.96331949
[8,] 0.035485881 0.070971762 0.96451412
[9,] 0.052265522 0.104531043 0.94773448
[10,] 0.030048218 0.060096435 0.96995178
[11,] 0.017489712 0.034979424 0.98251029
[12,] 0.010662412 0.021324825 0.98933759
[13,] 0.006442896 0.012885793 0.99355710
[14,] 0.003988899 0.007977798 0.99601110
[15,] 0.002790061 0.005580121 0.99720994
[16,] 0.001981697 0.003963394 0.99801830
[17,] 0.001350541 0.002701082 0.99864946
[18,] 0.001232933 0.002465866 0.99876707
[19,] 0.002342929 0.004685859 0.99765707
[20,] 0.015039298 0.030078597 0.98496070
[21,] 0.029966390 0.059932780 0.97003361
[22,] 0.019474324 0.038948649 0.98052568
[23,] 0.023897766 0.047795532 0.97610223
[24,] 0.064807684 0.129615368 0.93519232
[25,] 0.104129008 0.208258016 0.89587099
[26,] 0.108514921 0.217029842 0.89148508
[27,] 0.115032689 0.230065378 0.88496731
[28,] 0.111909348 0.223818696 0.88809065
[29,] 0.093759666 0.187519332 0.90624033
[30,] 0.090301789 0.180603578 0.90969821
[31,] 0.117543667 0.235087334 0.88245633
[32,] 0.146602473 0.293204946 0.85339753
[33,] 0.261994860 0.523989721 0.73800514
[34,] 0.910659253 0.178681493 0.08934075
[35,] 0.951311276 0.097377449 0.04868872
[36,] 0.922015829 0.155968342 0.07798417
[37,] 0.906830523 0.186338953 0.09316948
[38,] 0.859685689 0.280628621 0.14031431
[39,] 0.808463344 0.383073313 0.19153666
[40,] 0.705761219 0.588477562 0.29423878
[41,] 0.613192627 0.773614746 0.38680737
[42,] 0.546072797 0.907854406 0.45392720
> postscript(file="/var/www/html/rcomp/tmp/1hqkg1258733756.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/2efc01258733756.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/31l5i1258733756.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/4ix371258733756.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/5szb51258733756.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 = 73
Frequency = 1
1 2 3 4 5 6
0.51526125 0.46766252 0.35085359 0.37492887 0.73276427 0.69843508
7 8 9 10 11 12
0.59772375 0.22122997 -0.01181883 -0.23575184 -0.39145327 -0.44971547
13 14 15 16 17 18
-0.48729953 -0.18788582 -0.00640194 0.11852693 0.07892311 0.19758149
19 20 21 22 23 24
0.14815055 0.02293715 -0.11096524 -0.03660544 -0.09486764 0.09644337
25 26 27 28 29 30
-0.23943351 -0.13660544 -0.10298757 -0.02848550 0.28063029 0.39758149
31 32 33 34 35 36
0.39772375 0.37336395 0.38988835 0.51467495 0.65555916 0.44601657
37 38 39 40 41 42
-0.03943351 -0.58532505 -0.85170718 -0.72677832 -0.36808932 -0.20156492
43 44 45 46 47 48
-0.25099586 -0.37535566 -0.55883126 -0.73489825 -0.64529443 -0.55312984
49 50 51 52 53 54
-0.58644594 -0.07934990 0.10640194 0.03218440 -0.26211418 -0.44687016
55 56 57 58 59 60
-0.34672790 -0.17023411 -0.10242932 -0.22636233 -0.33505133 -0.39331353
61 62 63 64 65 66
-0.18047079 0.52150369 0.50384116 0.22962362 -0.46211418 -0.64516298
67 68 69 70 71 72
-0.54587431 -0.07194130 0.39415631 0.71894291 0.81110751 0.85369890
73
1.01782202
> postscript(file="/var/www/html/rcomp/tmp/68oqb1258733756.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 = 73
Frequency = 1
lag(myerror, k = 1) myerror
0 0.51526125 NA
1 0.46766252 0.51526125
2 0.35085359 0.46766252
3 0.37492887 0.35085359
4 0.73276427 0.37492887
5 0.69843508 0.73276427
6 0.59772375 0.69843508
7 0.22122997 0.59772375
8 -0.01181883 0.22122997
9 -0.23575184 -0.01181883
10 -0.39145327 -0.23575184
11 -0.44971547 -0.39145327
12 -0.48729953 -0.44971547
13 -0.18788582 -0.48729953
14 -0.00640194 -0.18788582
15 0.11852693 -0.00640194
16 0.07892311 0.11852693
17 0.19758149 0.07892311
18 0.14815055 0.19758149
19 0.02293715 0.14815055
20 -0.11096524 0.02293715
21 -0.03660544 -0.11096524
22 -0.09486764 -0.03660544
23 0.09644337 -0.09486764
24 -0.23943351 0.09644337
25 -0.13660544 -0.23943351
26 -0.10298757 -0.13660544
27 -0.02848550 -0.10298757
28 0.28063029 -0.02848550
29 0.39758149 0.28063029
30 0.39772375 0.39758149
31 0.37336395 0.39772375
32 0.38988835 0.37336395
33 0.51467495 0.38988835
34 0.65555916 0.51467495
35 0.44601657 0.65555916
36 -0.03943351 0.44601657
37 -0.58532505 -0.03943351
38 -0.85170718 -0.58532505
39 -0.72677832 -0.85170718
40 -0.36808932 -0.72677832
41 -0.20156492 -0.36808932
42 -0.25099586 -0.20156492
43 -0.37535566 -0.25099586
44 -0.55883126 -0.37535566
45 -0.73489825 -0.55883126
46 -0.64529443 -0.73489825
47 -0.55312984 -0.64529443
48 -0.58644594 -0.55312984
49 -0.07934990 -0.58644594
50 0.10640194 -0.07934990
51 0.03218440 0.10640194
52 -0.26211418 0.03218440
53 -0.44687016 -0.26211418
54 -0.34672790 -0.44687016
55 -0.17023411 -0.34672790
56 -0.10242932 -0.17023411
57 -0.22636233 -0.10242932
58 -0.33505133 -0.22636233
59 -0.39331353 -0.33505133
60 -0.18047079 -0.39331353
61 0.52150369 -0.18047079
62 0.50384116 0.52150369
63 0.22962362 0.50384116
64 -0.46211418 0.22962362
65 -0.64516298 -0.46211418
66 -0.54587431 -0.64516298
67 -0.07194130 -0.54587431
68 0.39415631 -0.07194130
69 0.71894291 0.39415631
70 0.81110751 0.71894291
71 0.85369890 0.81110751
72 1.01782202 0.85369890
73 NA 1.01782202
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.46766252 0.51526125
[2,] 0.35085359 0.46766252
[3,] 0.37492887 0.35085359
[4,] 0.73276427 0.37492887
[5,] 0.69843508 0.73276427
[6,] 0.59772375 0.69843508
[7,] 0.22122997 0.59772375
[8,] -0.01181883 0.22122997
[9,] -0.23575184 -0.01181883
[10,] -0.39145327 -0.23575184
[11,] -0.44971547 -0.39145327
[12,] -0.48729953 -0.44971547
[13,] -0.18788582 -0.48729953
[14,] -0.00640194 -0.18788582
[15,] 0.11852693 -0.00640194
[16,] 0.07892311 0.11852693
[17,] 0.19758149 0.07892311
[18,] 0.14815055 0.19758149
[19,] 0.02293715 0.14815055
[20,] -0.11096524 0.02293715
[21,] -0.03660544 -0.11096524
[22,] -0.09486764 -0.03660544
[23,] 0.09644337 -0.09486764
[24,] -0.23943351 0.09644337
[25,] -0.13660544 -0.23943351
[26,] -0.10298757 -0.13660544
[27,] -0.02848550 -0.10298757
[28,] 0.28063029 -0.02848550
[29,] 0.39758149 0.28063029
[30,] 0.39772375 0.39758149
[31,] 0.37336395 0.39772375
[32,] 0.38988835 0.37336395
[33,] 0.51467495 0.38988835
[34,] 0.65555916 0.51467495
[35,] 0.44601657 0.65555916
[36,] -0.03943351 0.44601657
[37,] -0.58532505 -0.03943351
[38,] -0.85170718 -0.58532505
[39,] -0.72677832 -0.85170718
[40,] -0.36808932 -0.72677832
[41,] -0.20156492 -0.36808932
[42,] -0.25099586 -0.20156492
[43,] -0.37535566 -0.25099586
[44,] -0.55883126 -0.37535566
[45,] -0.73489825 -0.55883126
[46,] -0.64529443 -0.73489825
[47,] -0.55312984 -0.64529443
[48,] -0.58644594 -0.55312984
[49,] -0.07934990 -0.58644594
[50,] 0.10640194 -0.07934990
[51,] 0.03218440 0.10640194
[52,] -0.26211418 0.03218440
[53,] -0.44687016 -0.26211418
[54,] -0.34672790 -0.44687016
[55,] -0.17023411 -0.34672790
[56,] -0.10242932 -0.17023411
[57,] -0.22636233 -0.10242932
[58,] -0.33505133 -0.22636233
[59,] -0.39331353 -0.33505133
[60,] -0.18047079 -0.39331353
[61,] 0.52150369 -0.18047079
[62,] 0.50384116 0.52150369
[63,] 0.22962362 0.50384116
[64,] -0.46211418 0.22962362
[65,] -0.64516298 -0.46211418
[66,] -0.54587431 -0.64516298
[67,] -0.07194130 -0.54587431
[68,] 0.39415631 -0.07194130
[69,] 0.71894291 0.39415631
[70,] 0.81110751 0.71894291
[71,] 0.85369890 0.81110751
[72,] 1.01782202 0.85369890
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.46766252 0.51526125
2 0.35085359 0.46766252
3 0.37492887 0.35085359
4 0.73276427 0.37492887
5 0.69843508 0.73276427
6 0.59772375 0.69843508
7 0.22122997 0.59772375
8 -0.01181883 0.22122997
9 -0.23575184 -0.01181883
10 -0.39145327 -0.23575184
11 -0.44971547 -0.39145327
12 -0.48729953 -0.44971547
13 -0.18788582 -0.48729953
14 -0.00640194 -0.18788582
15 0.11852693 -0.00640194
16 0.07892311 0.11852693
17 0.19758149 0.07892311
18 0.14815055 0.19758149
19 0.02293715 0.14815055
20 -0.11096524 0.02293715
21 -0.03660544 -0.11096524
22 -0.09486764 -0.03660544
23 0.09644337 -0.09486764
24 -0.23943351 0.09644337
25 -0.13660544 -0.23943351
26 -0.10298757 -0.13660544
27 -0.02848550 -0.10298757
28 0.28063029 -0.02848550
29 0.39758149 0.28063029
30 0.39772375 0.39758149
31 0.37336395 0.39772375
32 0.38988835 0.37336395
33 0.51467495 0.38988835
34 0.65555916 0.51467495
35 0.44601657 0.65555916
36 -0.03943351 0.44601657
37 -0.58532505 -0.03943351
38 -0.85170718 -0.58532505
39 -0.72677832 -0.85170718
40 -0.36808932 -0.72677832
41 -0.20156492 -0.36808932
42 -0.25099586 -0.20156492
43 -0.37535566 -0.25099586
44 -0.55883126 -0.37535566
45 -0.73489825 -0.55883126
46 -0.64529443 -0.73489825
47 -0.55312984 -0.64529443
48 -0.58644594 -0.55312984
49 -0.07934990 -0.58644594
50 0.10640194 -0.07934990
51 0.03218440 0.10640194
52 -0.26211418 0.03218440
53 -0.44687016 -0.26211418
54 -0.34672790 -0.44687016
55 -0.17023411 -0.34672790
56 -0.10242932 -0.17023411
57 -0.22636233 -0.10242932
58 -0.33505133 -0.22636233
59 -0.39331353 -0.33505133
60 -0.18047079 -0.39331353
61 0.52150369 -0.18047079
62 0.50384116 0.52150369
63 0.22962362 0.50384116
64 -0.46211418 0.22962362
65 -0.64516298 -0.46211418
66 -0.54587431 -0.64516298
67 -0.07194130 -0.54587431
68 0.39415631 -0.07194130
69 0.71894291 0.39415631
70 0.81110751 0.71894291
71 0.85369890 0.81110751
72 1.01782202 0.85369890
> 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/7kz1y1258733756.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/8bmib1258733756.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/9dmqa1258733756.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/10u8ir1258733756.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/114xyi1258733756.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/12xm9l1258733756.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/13ph0r1258733756.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/140tvp1258733756.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/156m0p1258733756.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/16e9nk1258733756.tab")
+ }
>
> system("convert tmp/1hqkg1258733756.ps tmp/1hqkg1258733756.png")
> system("convert tmp/2efc01258733756.ps tmp/2efc01258733756.png")
> system("convert tmp/31l5i1258733756.ps tmp/31l5i1258733756.png")
> system("convert tmp/4ix371258733756.ps tmp/4ix371258733756.png")
> system("convert tmp/5szb51258733756.ps tmp/5szb51258733756.png")
> system("convert tmp/68oqb1258733756.ps tmp/68oqb1258733756.png")
> system("convert tmp/7kz1y1258733756.ps tmp/7kz1y1258733756.png")
> system("convert tmp/8bmib1258733756.ps tmp/8bmib1258733756.png")
> system("convert tmp/9dmqa1258733756.ps tmp/9dmqa1258733756.png")
> system("convert tmp/10u8ir1258733756.ps tmp/10u8ir1258733756.png")
>
>
> proc.time()
user system elapsed
2.600 1.606 5.824