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(594,139,595,135,591,130,589,127,584,122,573,117,567,112,569,113,621,149,629,157,628,157,612,147,595,137,597,132,593,125,590,123,580,117,574,114,573,111,573,112,620,144,626,150,620,149,588,134,566,123,557,116,561,117,549,111,532,105,526,102,511,95,499,93,555,124,565,130,542,124,527,115,510,106,514,105,517,105,508,101,493,95,490,93,469,84,478,87,528,116,534,120,518,117,506,109,502,105,516,107,528,109,533,109,536,108,537,107,524,99,536,103,587,131,597,137,581,135,564,124),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 = '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
Y X
1 594 139
2 595 135
3 591 130
4 589 127
5 584 122
6 573 117
7 567 112
8 569 113
9 621 149
10 629 157
11 628 157
12 612 147
13 595 137
14 597 132
15 593 125
16 590 123
17 580 117
18 574 114
19 573 111
20 573 112
21 620 144
22 626 150
23 620 149
24 588 134
25 566 123
26 557 116
27 561 117
28 549 111
29 532 105
30 526 102
31 511 95
32 499 93
33 555 124
34 565 130
35 542 124
36 527 115
37 510 106
38 514 105
39 517 105
40 508 101
41 493 95
42 490 93
43 469 84
44 478 87
45 528 116
46 534 120
47 518 117
48 506 109
49 502 105
50 516 107
51 528 109
52 533 109
53 536 108
54 537 107
55 524 99
56 536 103
57 587 131
58 597 137
59 581 135
60 564 124
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X
295.990 2.193
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-34.628 -11.274 -1.241 9.614 33.533
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 295.9899 14.6641 20.18 <2e-16 ***
X 2.1935 0.1223 17.93 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 16.24 on 58 degrees of freedom
Multiple R-squared: 0.8472, Adjusted R-squared: 0.8446
F-statistic: 321.7 on 1 and 58 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,] 1.508165e-03 3.016330e-03 0.998491835
[2,] 3.537976e-03 7.075952e-03 0.996462024
[3,] 1.360142e-03 2.720285e-03 0.998639858
[4,] 3.299249e-04 6.598497e-04 0.999670075
[5,] 6.040936e-04 1.208187e-03 0.999395906
[6,] 1.737976e-04 3.475953e-04 0.999826202
[7,] 4.204610e-05 8.409219e-05 0.999957954
[8,] 1.038737e-05 2.077473e-05 0.999989613
[9,] 5.386792e-06 1.077358e-05 0.999994613
[10,] 1.898274e-06 3.796548e-06 0.999998102
[11,] 4.224519e-06 8.449038e-06 0.999995775
[12,] 5.402593e-06 1.080519e-05 0.999994597
[13,] 4.018804e-06 8.037608e-06 0.999995981
[14,] 2.599739e-06 5.199478e-06 0.999997400
[15,] 4.207283e-06 8.414566e-06 0.999995793
[16,] 7.360606e-06 1.472121e-05 0.999992639
[17,] 2.146441e-05 4.292883e-05 0.999978536
[18,] 2.143078e-05 4.286156e-05 0.999978569
[19,] 9.018477e-06 1.803695e-05 0.999990982
[20,] 2.227185e-05 4.454370e-05 0.999977728
[21,] 3.541568e-04 7.083136e-04 0.999645843
[22,] 1.739436e-03 3.478872e-03 0.998260564
[23,] 3.661972e-03 7.323945e-03 0.996338028
[24,] 9.983899e-03 1.996780e-02 0.990016101
[25,] 3.787770e-02 7.575540e-02 0.962122299
[26,] 8.473177e-02 1.694635e-01 0.915268234
[27,] 1.587889e-01 3.175779e-01 0.841211055
[28,] 2.721864e-01 5.443728e-01 0.727813611
[29,] 3.286529e-01 6.573059e-01 0.671347064
[30,] 3.755915e-01 7.511830e-01 0.624408483
[31,] 5.901071e-01 8.197859e-01 0.409892942
[32,] 7.054183e-01 5.891635e-01 0.294581746
[33,] 7.685652e-01 4.628697e-01 0.231434838
[34,] 7.606108e-01 4.787783e-01 0.239389158
[35,] 7.284668e-01 5.430664e-01 0.271533212
[36,] 6.913540e-01 6.172919e-01 0.308645973
[37,] 6.566461e-01 6.867078e-01 0.343353906
[38,] 6.058051e-01 7.883899e-01 0.394194925
[39,] 5.558467e-01 8.883067e-01 0.444153349
[40,] 4.870191e-01 9.740383e-01 0.512980871
[41,] 5.054592e-01 9.890817e-01 0.494540841
[42,] 5.582582e-01 8.834837e-01 0.441741850
[43,] 7.940633e-01 4.118735e-01 0.205936743
[44,] 9.227029e-01 1.545941e-01 0.077297070
[45,] 9.847942e-01 3.041161e-02 0.015205806
[46,] 9.957751e-01 8.449839e-03 0.004224919
[47,] 9.970795e-01 5.840991e-03 0.002920495
[48,] 9.960511e-01 7.897839e-03 0.003948920
[49,] 9.897108e-01 2.057850e-02 0.010289250
[50,] 9.688447e-01 6.231053e-02 0.031155264
[51,] 9.135827e-01 1.728346e-01 0.086417320
> postscript(file="/var/www/html/rcomp/tmp/1o4km1258739434.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/20i4t1258739434.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/33ypx1258739434.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/4qxbr1258739434.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/5lxmw1258739434.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
-6.8841817 2.8897557 9.8571774 14.4376305 20.4050522 20.3724739
7 8 9 10 11 12
25.3398956 25.1464113 -1.8190251 -11.3668999 -12.3668999 -6.4320564
13 14 15 16 17 18
-1.4972130 11.4702087 22.8245992 24.2115678 27.3724739 27.9529269
19 20 21 22 23 24
33.5333800 31.3398956 8.1483966 0.9874905 -2.8190251 -1.9167599
25 26 27 28 29 30
0.2115678 6.5659583 8.3724739 9.5333800 5.6942860 6.2747391
31 32 33 34 35 36
6.6291295 -0.9839018 -12.9819165 -16.1428226 -25.9819165 -21.2405574
37 38 39 40 41 42
-18.4991983 -12.3057140 -9.3057140 -9.5317766 -11.3708705 -9.9839018
43 44 45 46 47 48
-11.2425427 -8.8229958 -22.4340417 -25.2079791 -34.6275261 -29.0796513
49 50 51 52 53 54
-24.3057140 -14.6926827 -7.0796513 -2.0796513 3.1138330 6.3073173
55 56 57 58 59 60
10.8551921 14.0812547 3.6636931 0.5027870 -11.1102443 -3.9819165
> postscript(file="/var/www/html/rcomp/tmp/6908h1258739434.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 -6.8841817 NA
1 2.8897557 -6.8841817
2 9.8571774 2.8897557
3 14.4376305 9.8571774
4 20.4050522 14.4376305
5 20.3724739 20.4050522
6 25.3398956 20.3724739
7 25.1464113 25.3398956
8 -1.8190251 25.1464113
9 -11.3668999 -1.8190251
10 -12.3668999 -11.3668999
11 -6.4320564 -12.3668999
12 -1.4972130 -6.4320564
13 11.4702087 -1.4972130
14 22.8245992 11.4702087
15 24.2115678 22.8245992
16 27.3724739 24.2115678
17 27.9529269 27.3724739
18 33.5333800 27.9529269
19 31.3398956 33.5333800
20 8.1483966 31.3398956
21 0.9874905 8.1483966
22 -2.8190251 0.9874905
23 -1.9167599 -2.8190251
24 0.2115678 -1.9167599
25 6.5659583 0.2115678
26 8.3724739 6.5659583
27 9.5333800 8.3724739
28 5.6942860 9.5333800
29 6.2747391 5.6942860
30 6.6291295 6.2747391
31 -0.9839018 6.6291295
32 -12.9819165 -0.9839018
33 -16.1428226 -12.9819165
34 -25.9819165 -16.1428226
35 -21.2405574 -25.9819165
36 -18.4991983 -21.2405574
37 -12.3057140 -18.4991983
38 -9.3057140 -12.3057140
39 -9.5317766 -9.3057140
40 -11.3708705 -9.5317766
41 -9.9839018 -11.3708705
42 -11.2425427 -9.9839018
43 -8.8229958 -11.2425427
44 -22.4340417 -8.8229958
45 -25.2079791 -22.4340417
46 -34.6275261 -25.2079791
47 -29.0796513 -34.6275261
48 -24.3057140 -29.0796513
49 -14.6926827 -24.3057140
50 -7.0796513 -14.6926827
51 -2.0796513 -7.0796513
52 3.1138330 -2.0796513
53 6.3073173 3.1138330
54 10.8551921 6.3073173
55 14.0812547 10.8551921
56 3.6636931 14.0812547
57 0.5027870 3.6636931
58 -11.1102443 0.5027870
59 -3.9819165 -11.1102443
60 NA -3.9819165
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.8897557 -6.8841817
[2,] 9.8571774 2.8897557
[3,] 14.4376305 9.8571774
[4,] 20.4050522 14.4376305
[5,] 20.3724739 20.4050522
[6,] 25.3398956 20.3724739
[7,] 25.1464113 25.3398956
[8,] -1.8190251 25.1464113
[9,] -11.3668999 -1.8190251
[10,] -12.3668999 -11.3668999
[11,] -6.4320564 -12.3668999
[12,] -1.4972130 -6.4320564
[13,] 11.4702087 -1.4972130
[14,] 22.8245992 11.4702087
[15,] 24.2115678 22.8245992
[16,] 27.3724739 24.2115678
[17,] 27.9529269 27.3724739
[18,] 33.5333800 27.9529269
[19,] 31.3398956 33.5333800
[20,] 8.1483966 31.3398956
[21,] 0.9874905 8.1483966
[22,] -2.8190251 0.9874905
[23,] -1.9167599 -2.8190251
[24,] 0.2115678 -1.9167599
[25,] 6.5659583 0.2115678
[26,] 8.3724739 6.5659583
[27,] 9.5333800 8.3724739
[28,] 5.6942860 9.5333800
[29,] 6.2747391 5.6942860
[30,] 6.6291295 6.2747391
[31,] -0.9839018 6.6291295
[32,] -12.9819165 -0.9839018
[33,] -16.1428226 -12.9819165
[34,] -25.9819165 -16.1428226
[35,] -21.2405574 -25.9819165
[36,] -18.4991983 -21.2405574
[37,] -12.3057140 -18.4991983
[38,] -9.3057140 -12.3057140
[39,] -9.5317766 -9.3057140
[40,] -11.3708705 -9.5317766
[41,] -9.9839018 -11.3708705
[42,] -11.2425427 -9.9839018
[43,] -8.8229958 -11.2425427
[44,] -22.4340417 -8.8229958
[45,] -25.2079791 -22.4340417
[46,] -34.6275261 -25.2079791
[47,] -29.0796513 -34.6275261
[48,] -24.3057140 -29.0796513
[49,] -14.6926827 -24.3057140
[50,] -7.0796513 -14.6926827
[51,] -2.0796513 -7.0796513
[52,] 3.1138330 -2.0796513
[53,] 6.3073173 3.1138330
[54,] 10.8551921 6.3073173
[55,] 14.0812547 10.8551921
[56,] 3.6636931 14.0812547
[57,] 0.5027870 3.6636931
[58,] -11.1102443 0.5027870
[59,] -3.9819165 -11.1102443
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.8897557 -6.8841817
2 9.8571774 2.8897557
3 14.4376305 9.8571774
4 20.4050522 14.4376305
5 20.3724739 20.4050522
6 25.3398956 20.3724739
7 25.1464113 25.3398956
8 -1.8190251 25.1464113
9 -11.3668999 -1.8190251
10 -12.3668999 -11.3668999
11 -6.4320564 -12.3668999
12 -1.4972130 -6.4320564
13 11.4702087 -1.4972130
14 22.8245992 11.4702087
15 24.2115678 22.8245992
16 27.3724739 24.2115678
17 27.9529269 27.3724739
18 33.5333800 27.9529269
19 31.3398956 33.5333800
20 8.1483966 31.3398956
21 0.9874905 8.1483966
22 -2.8190251 0.9874905
23 -1.9167599 -2.8190251
24 0.2115678 -1.9167599
25 6.5659583 0.2115678
26 8.3724739 6.5659583
27 9.5333800 8.3724739
28 5.6942860 9.5333800
29 6.2747391 5.6942860
30 6.6291295 6.2747391
31 -0.9839018 6.6291295
32 -12.9819165 -0.9839018
33 -16.1428226 -12.9819165
34 -25.9819165 -16.1428226
35 -21.2405574 -25.9819165
36 -18.4991983 -21.2405574
37 -12.3057140 -18.4991983
38 -9.3057140 -12.3057140
39 -9.5317766 -9.3057140
40 -11.3708705 -9.5317766
41 -9.9839018 -11.3708705
42 -11.2425427 -9.9839018
43 -8.8229958 -11.2425427
44 -22.4340417 -8.8229958
45 -25.2079791 -22.4340417
46 -34.6275261 -25.2079791
47 -29.0796513 -34.6275261
48 -24.3057140 -29.0796513
49 -14.6926827 -24.3057140
50 -7.0796513 -14.6926827
51 -2.0796513 -7.0796513
52 3.1138330 -2.0796513
53 6.3073173 3.1138330
54 10.8551921 6.3073173
55 14.0812547 10.8551921
56 3.6636931 14.0812547
57 0.5027870 3.6636931
58 -11.1102443 0.5027870
59 -3.9819165 -11.1102443
> 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/78kw81258739434.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/8n0qz1258739434.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/939d01258739434.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/10c63h1258739434.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/11co4m1258739434.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/12fega1258739434.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/13pson1258739434.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/147khq1258739434.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/15y6nt1258739434.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/16aapl1258739434.tab")
+ }
>
> system("convert tmp/1o4km1258739434.ps tmp/1o4km1258739434.png")
> system("convert tmp/20i4t1258739434.ps tmp/20i4t1258739434.png")
> system("convert tmp/33ypx1258739434.ps tmp/33ypx1258739434.png")
> system("convert tmp/4qxbr1258739434.ps tmp/4qxbr1258739434.png")
> system("convert tmp/5lxmw1258739434.ps tmp/5lxmw1258739434.png")
> system("convert tmp/6908h1258739434.ps tmp/6908h1258739434.png")
> system("convert tmp/78kw81258739434.ps tmp/78kw81258739434.png")
> system("convert tmp/8n0qz1258739434.ps tmp/8n0qz1258739434.png")
> system("convert tmp/939d01258739434.ps tmp/939d01258739434.png")
> system("convert tmp/10c63h1258739434.ps tmp/10c63h1258739434.png")
>
>
> proc.time()
user system elapsed
2.476 1.557 2.822