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(98.71,153.4,98.54,145,98.2,137.7,96.92,148.3,99.06,152.2,99.65,169.4,99.82,168.6,99.99,161.1,100.33,174.1,99.31,179,101.1,190.6,101.1,190,100.93,181.6,100.85,174.8,100.93,180.5,99.6,196.8,101.88,193.8,101.81,197,102.38,216.3,102.74,221.4,102.82,217.9,101.72,229.7,103.47,227.4,102.98,204.2,102.68,196.6,102.9,198.8,103.03,207.5,101.29,190.7,103.69,201.6,103.68,210.5,104.2,223.5,104.08,223.8,104.16,231.2,103.05,244,104.66,234.7,104.46,250.2,104.95,265.7,105.85,287.6,106.23,283.3,104.86,295.4,107.44,312.3,108.23,333.8,108.45,347.7,109.39,383.2,110.15,407.1,109.13,413.6,110.28,362.7,110.17,321.9,109.99,239.4,109.26,191,109.11,159.7,107.06,163.4,109.53,157.6,108.92,166.2,109.24,176.7,109.12,198.3,109,226.2,107.23,216.2,109.49,235.9,109.04,226.9),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 98.71 153.4
2 98.54 145.0
3 98.20 137.7
4 96.92 148.3
5 99.06 152.2
6 99.65 169.4
7 99.82 168.6
8 99.99 161.1
9 100.33 174.1
10 99.31 179.0
11 101.10 190.6
12 101.10 190.0
13 100.93 181.6
14 100.85 174.8
15 100.93 180.5
16 99.60 196.8
17 101.88 193.8
18 101.81 197.0
19 102.38 216.3
20 102.74 221.4
21 102.82 217.9
22 101.72 229.7
23 103.47 227.4
24 102.98 204.2
25 102.68 196.6
26 102.90 198.8
27 103.03 207.5
28 101.29 190.7
29 103.69 201.6
30 103.68 210.5
31 104.20 223.5
32 104.08 223.8
33 104.16 231.2
34 103.05 244.0
35 104.66 234.7
36 104.46 250.2
37 104.95 265.7
38 105.85 287.6
39 106.23 283.3
40 104.86 295.4
41 107.44 312.3
42 108.23 333.8
43 108.45 347.7
44 109.39 383.2
45 110.15 407.1
46 109.13 413.6
47 110.28 362.7
48 110.17 321.9
49 109.99 239.4
50 109.26 191.0
51 109.11 159.7
52 107.06 163.4
53 109.53 157.6
54 108.92 166.2
55 109.24 176.7
56 109.12 198.3
57 109.00 226.2
58 107.23 216.2
59 109.49 235.9
60 109.04 226.9
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X
96.43758 0.03528
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-4.7494 -1.9965 -0.7309 0.0473 7.5325
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 96.43758 1.43695 67.113 < 2e-16 ***
X 0.03528 0.00618 5.709 4.1e-07 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.11 on 58 degrees of freedom
Multiple R-squared: 0.3597, Adjusted R-squared: 0.3487
F-statistic: 32.59 on 1 and 58 DF, p-value: 4.097e-07
> 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,] 3.585542e-02 7.171084e-02 0.964144580
[2,] 9.729858e-03 1.945972e-02 0.990270142
[3,] 2.472731e-03 4.945462e-03 0.997527269
[4,] 9.556632e-04 1.911326e-03 0.999044337
[5,] 2.270488e-04 4.540976e-04 0.999772951
[6,] 1.566291e-04 3.132582e-04 0.999843371
[7,] 4.159438e-05 8.318876e-05 0.999958406
[8,] 1.059343e-05 2.118685e-05 0.999989407
[9,] 3.255497e-06 6.510994e-06 0.999996745
[10,] 1.465785e-06 2.931569e-06 0.999998534
[11,] 4.549462e-07 9.098925e-07 0.999999545
[12,] 3.429818e-06 6.859636e-06 0.999996570
[13,] 1.831369e-06 3.662739e-06 0.999998169
[14,] 7.445030e-07 1.489006e-06 0.999999255
[15,] 2.614145e-07 5.228290e-07 0.999999739
[16,] 8.823993e-08 1.764799e-07 0.999999912
[17,] 3.106951e-08 6.213902e-08 0.999999969
[18,] 8.639650e-08 1.727930e-07 0.999999914
[19,] 4.080049e-08 8.160098e-08 0.999999959
[20,] 5.526666e-08 1.105333e-07 0.999999945
[21,] 8.794965e-08 1.758993e-07 0.999999912
[22,] 1.427997e-07 2.855994e-07 0.999999857
[23,] 1.371458e-07 2.742917e-07 0.999999863
[24,] 2.357181e-07 4.714363e-07 0.999999764
[25,] 1.022976e-06 2.045953e-06 0.999998977
[26,] 1.772036e-06 3.544072e-06 0.999998228
[27,] 2.008700e-06 4.017399e-06 0.999997991
[28,] 2.543776e-06 5.087552e-06 0.999997456
[29,] 3.389052e-06 6.778103e-06 0.999996611
[30,] 6.290584e-05 1.258117e-04 0.999937094
[31,] 1.467337e-04 2.934675e-04 0.999853266
[32,] 6.438437e-04 1.287687e-03 0.999356156
[33,] 3.244586e-03 6.489172e-03 0.996755414
[34,] 1.008033e-02 2.016066e-02 0.989919672
[35,] 2.110328e-02 4.220655e-02 0.978896723
[36,] 5.123364e-01 9.753273e-01 0.487663636
[37,] 6.420201e-01 7.159597e-01 0.357979873
[38,] 6.673216e-01 6.653567e-01 0.332678358
[39,] 7.013048e-01 5.973904e-01 0.298695212
[40,] 6.815820e-01 6.368359e-01 0.318417962
[41,] 6.433124e-01 7.133751e-01 0.356687558
[42,] 7.599356e-01 4.801288e-01 0.240064377
[43,] 7.006473e-01 5.987054e-01 0.299352698
[44,] 7.256341e-01 5.487318e-01 0.274365900
[45,] 9.284033e-01 1.431935e-01 0.071596749
[46,] 9.713599e-01 5.728012e-02 0.028640059
[47,] 9.819863e-01 3.602733e-02 0.018013666
[48,] 9.948516e-01 1.029685e-02 0.005148427
[49,] 9.917997e-01 1.640054e-02 0.008200268
[50,] 9.788025e-01 4.239499e-02 0.021197496
[51,] 9.500178e-01 9.996447e-02 0.049982235
> postscript(file="/var/www/html/rcomp/tmp/181dx1258715790.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/2wat91258715790.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/3n0zl1258715790.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/4oh0c1258715790.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/5bss51258715790.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
-3.13935860 -3.01301601 -3.09548018 -4.74943631 -2.74702395 -2.76382069
7 8 9 10 11 12
-2.56559759 -2.13100598 -2.24963143 -3.44249795 -2.06173296 -2.04056563
13 14 15 16 17 18
-1.91422304 -1.75432665 -1.87541627 -3.78046202 -1.39462538 -1.57751780
19 20 21 22 23 24
-1.68840019 -1.50832248 -1.30484640 -2.82113719 -0.98999577 -0.66152574
25 26 27 28 29 30
-0.69340624 -0.55101978 -0.72794604 -1.87526085 0.14019935 -0.18378269
31 32 33 34 35 36
-0.12240813 -0.25299180 -0.43405551 -1.99562519 -0.05753160 -0.80435425
37 38 39 40 41 42
-0.86117689 -0.73378438 -0.20208519 -1.99895965 -0.01517273 0.01633134
43 44 45 46 47 48
-0.25404510 -0.56644537 -0.64961061 -1.89892334 1.04677169 2.37615001
49 50 51 52 53 54
5.10665767 6.08415549 7.03838445 4.85785259 7.53247010 6.61907173
55 56 57 58 59 60
6.56864348 5.68661966 4.58233889 3.16512770 4.73013375 4.59764367
> postscript(file="/var/www/html/rcomp/tmp/6t93c1258715790.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.13935860 NA
1 -3.01301601 -3.13935860
2 -3.09548018 -3.01301601
3 -4.74943631 -3.09548018
4 -2.74702395 -4.74943631
5 -2.76382069 -2.74702395
6 -2.56559759 -2.76382069
7 -2.13100598 -2.56559759
8 -2.24963143 -2.13100598
9 -3.44249795 -2.24963143
10 -2.06173296 -3.44249795
11 -2.04056563 -2.06173296
12 -1.91422304 -2.04056563
13 -1.75432665 -1.91422304
14 -1.87541627 -1.75432665
15 -3.78046202 -1.87541627
16 -1.39462538 -3.78046202
17 -1.57751780 -1.39462538
18 -1.68840019 -1.57751780
19 -1.50832248 -1.68840019
20 -1.30484640 -1.50832248
21 -2.82113719 -1.30484640
22 -0.98999577 -2.82113719
23 -0.66152574 -0.98999577
24 -0.69340624 -0.66152574
25 -0.55101978 -0.69340624
26 -0.72794604 -0.55101978
27 -1.87526085 -0.72794604
28 0.14019935 -1.87526085
29 -0.18378269 0.14019935
30 -0.12240813 -0.18378269
31 -0.25299180 -0.12240813
32 -0.43405551 -0.25299180
33 -1.99562519 -0.43405551
34 -0.05753160 -1.99562519
35 -0.80435425 -0.05753160
36 -0.86117689 -0.80435425
37 -0.73378438 -0.86117689
38 -0.20208519 -0.73378438
39 -1.99895965 -0.20208519
40 -0.01517273 -1.99895965
41 0.01633134 -0.01517273
42 -0.25404510 0.01633134
43 -0.56644537 -0.25404510
44 -0.64961061 -0.56644537
45 -1.89892334 -0.64961061
46 1.04677169 -1.89892334
47 2.37615001 1.04677169
48 5.10665767 2.37615001
49 6.08415549 5.10665767
50 7.03838445 6.08415549
51 4.85785259 7.03838445
52 7.53247010 4.85785259
53 6.61907173 7.53247010
54 6.56864348 6.61907173
55 5.68661966 6.56864348
56 4.58233889 5.68661966
57 3.16512770 4.58233889
58 4.73013375 3.16512770
59 4.59764367 4.73013375
60 NA 4.59764367
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -3.01301601 -3.13935860
[2,] -3.09548018 -3.01301601
[3,] -4.74943631 -3.09548018
[4,] -2.74702395 -4.74943631
[5,] -2.76382069 -2.74702395
[6,] -2.56559759 -2.76382069
[7,] -2.13100598 -2.56559759
[8,] -2.24963143 -2.13100598
[9,] -3.44249795 -2.24963143
[10,] -2.06173296 -3.44249795
[11,] -2.04056563 -2.06173296
[12,] -1.91422304 -2.04056563
[13,] -1.75432665 -1.91422304
[14,] -1.87541627 -1.75432665
[15,] -3.78046202 -1.87541627
[16,] -1.39462538 -3.78046202
[17,] -1.57751780 -1.39462538
[18,] -1.68840019 -1.57751780
[19,] -1.50832248 -1.68840019
[20,] -1.30484640 -1.50832248
[21,] -2.82113719 -1.30484640
[22,] -0.98999577 -2.82113719
[23,] -0.66152574 -0.98999577
[24,] -0.69340624 -0.66152574
[25,] -0.55101978 -0.69340624
[26,] -0.72794604 -0.55101978
[27,] -1.87526085 -0.72794604
[28,] 0.14019935 -1.87526085
[29,] -0.18378269 0.14019935
[30,] -0.12240813 -0.18378269
[31,] -0.25299180 -0.12240813
[32,] -0.43405551 -0.25299180
[33,] -1.99562519 -0.43405551
[34,] -0.05753160 -1.99562519
[35,] -0.80435425 -0.05753160
[36,] -0.86117689 -0.80435425
[37,] -0.73378438 -0.86117689
[38,] -0.20208519 -0.73378438
[39,] -1.99895965 -0.20208519
[40,] -0.01517273 -1.99895965
[41,] 0.01633134 -0.01517273
[42,] -0.25404510 0.01633134
[43,] -0.56644537 -0.25404510
[44,] -0.64961061 -0.56644537
[45,] -1.89892334 -0.64961061
[46,] 1.04677169 -1.89892334
[47,] 2.37615001 1.04677169
[48,] 5.10665767 2.37615001
[49,] 6.08415549 5.10665767
[50,] 7.03838445 6.08415549
[51,] 4.85785259 7.03838445
[52,] 7.53247010 4.85785259
[53,] 6.61907173 7.53247010
[54,] 6.56864348 6.61907173
[55,] 5.68661966 6.56864348
[56,] 4.58233889 5.68661966
[57,] 3.16512770 4.58233889
[58,] 4.73013375 3.16512770
[59,] 4.59764367 4.73013375
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -3.01301601 -3.13935860
2 -3.09548018 -3.01301601
3 -4.74943631 -3.09548018
4 -2.74702395 -4.74943631
5 -2.76382069 -2.74702395
6 -2.56559759 -2.76382069
7 -2.13100598 -2.56559759
8 -2.24963143 -2.13100598
9 -3.44249795 -2.24963143
10 -2.06173296 -3.44249795
11 -2.04056563 -2.06173296
12 -1.91422304 -2.04056563
13 -1.75432665 -1.91422304
14 -1.87541627 -1.75432665
15 -3.78046202 -1.87541627
16 -1.39462538 -3.78046202
17 -1.57751780 -1.39462538
18 -1.68840019 -1.57751780
19 -1.50832248 -1.68840019
20 -1.30484640 -1.50832248
21 -2.82113719 -1.30484640
22 -0.98999577 -2.82113719
23 -0.66152574 -0.98999577
24 -0.69340624 -0.66152574
25 -0.55101978 -0.69340624
26 -0.72794604 -0.55101978
27 -1.87526085 -0.72794604
28 0.14019935 -1.87526085
29 -0.18378269 0.14019935
30 -0.12240813 -0.18378269
31 -0.25299180 -0.12240813
32 -0.43405551 -0.25299180
33 -1.99562519 -0.43405551
34 -0.05753160 -1.99562519
35 -0.80435425 -0.05753160
36 -0.86117689 -0.80435425
37 -0.73378438 -0.86117689
38 -0.20208519 -0.73378438
39 -1.99895965 -0.20208519
40 -0.01517273 -1.99895965
41 0.01633134 -0.01517273
42 -0.25404510 0.01633134
43 -0.56644537 -0.25404510
44 -0.64961061 -0.56644537
45 -1.89892334 -0.64961061
46 1.04677169 -1.89892334
47 2.37615001 1.04677169
48 5.10665767 2.37615001
49 6.08415549 5.10665767
50 7.03838445 6.08415549
51 4.85785259 7.03838445
52 7.53247010 4.85785259
53 6.61907173 7.53247010
54 6.56864348 6.61907173
55 5.68661966 6.56864348
56 4.58233889 5.68661966
57 3.16512770 4.58233889
58 4.73013375 3.16512770
59 4.59764367 4.73013375
> 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/7q4d01258715791.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/8cx8e1258715791.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/96wwh1258715791.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/10f5ha1258715791.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/11kv6b1258715791.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/12w4o51258715791.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/136caf1258715791.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/14f8kz1258715791.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/15k6cd1258715791.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/168e9n1258715791.tab")
+ }
>
> system("convert tmp/181dx1258715790.ps tmp/181dx1258715790.png")
> system("convert tmp/2wat91258715790.ps tmp/2wat91258715790.png")
> system("convert tmp/3n0zl1258715790.ps tmp/3n0zl1258715790.png")
> system("convert tmp/4oh0c1258715790.ps tmp/4oh0c1258715790.png")
> system("convert tmp/5bss51258715790.ps tmp/5bss51258715790.png")
> system("convert tmp/6t93c1258715790.ps tmp/6t93c1258715790.png")
> system("convert tmp/7q4d01258715791.ps tmp/7q4d01258715791.png")
> system("convert tmp/8cx8e1258715791.ps tmp/8cx8e1258715791.png")
> system("convert tmp/96wwh1258715791.ps tmp/96wwh1258715791.png")
> system("convert tmp/10f5ha1258715791.ps tmp/10f5ha1258715791.png")
>
>
> proc.time()
user system elapsed
2.458 1.559 2.863