R version 2.8.0 (2008-10-20)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> x <- array(list(82.7,0,88.9,0,105.9,0,100.8,0,94,0,105,0,58.5,0,87.6,0,113.1,0,112.5,0,89.6,0,74.5,0,82.7,0,90.1,0,109.4,0,96,0,89.2,0,109.1,0,49.1,0,92.9,0,107.7,0,103.5,0,91.1,0,79.8,0,71.9,0,82.9,0,90.1,0,100.7,0,90.7,0,108.8,0,44.1,0,93.6,0,107.4,0,96.5,0,93.6,0,76.5,0,76.7,1,84,1,103.3,1,88.5,1,99,1,105.9,1,44.7,1,94,1,107.1,1,104.8,1,102.5,1,77.7,1,85.2,1,91.3,1,106.5,1,92.4,1,97.5,1,107,1,51.1,1,98.6,1,102.2,1,114.3,1,99.4,1,72.5,1,92.3,1,99.4,1,85.9,1,109.4,1,97.6,1),dim=c(2,65),dimnames=list(c('Y','d'),1:65))
> y <- array(NA,dim=c(2,65),dimnames=list(c('Y','d'),1:65))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = '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 d t
1 82.7 0 1
2 88.9 0 2
3 105.9 0 3
4 100.8 0 4
5 94.0 0 5
6 105.0 0 6
7 58.5 0 7
8 87.6 0 8
9 113.1 0 9
10 112.5 0 10
11 89.6 0 11
12 74.5 0 12
13 82.7 0 13
14 90.1 0 14
15 109.4 0 15
16 96.0 0 16
17 89.2 0 17
18 109.1 0 18
19 49.1 0 19
20 92.9 0 20
21 107.7 0 21
22 103.5 0 22
23 91.1 0 23
24 79.8 0 24
25 71.9 0 25
26 82.9 0 26
27 90.1 0 27
28 100.7 0 28
29 90.7 0 29
30 108.8 0 30
31 44.1 0 31
32 93.6 0 32
33 107.4 0 33
34 96.5 0 34
35 93.6 0 35
36 76.5 0 36
37 76.7 1 37
38 84.0 1 38
39 103.3 1 39
40 88.5 1 40
41 99.0 1 41
42 105.9 1 42
43 44.7 1 43
44 94.0 1 44
45 107.1 1 45
46 104.8 1 46
47 102.5 1 47
48 77.7 1 48
49 85.2 1 49
50 91.3 1 50
51 106.5 1 51
52 92.4 1 52
53 97.5 1 53
54 107.0 1 54
55 51.1 1 55
56 98.6 1 56
57 102.2 1 57
58 114.3 1 58
59 99.4 1 59
60 72.5 1 60
61 92.3 1 61
62 99.4 1 62
63 85.9 1 63
64 109.4 1 64
65 97.6 1 65
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) d t
90.989999 2.189809 -0.007718
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-48.148 -7.602 2.857 11.975 22.179
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 90.989999 4.822658 18.867 <2e-16 ***
d 2.189809 8.087372 0.271 0.787
t -0.007718 0.214276 -0.036 0.971
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 16.48 on 62 degrees of freedom
Multiple R-squared: 0.003594, Adjusted R-squared: -0.02855
F-statistic: 0.1118 on 2 and 62 DF, p-value: 0.8944
> 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.1433115 0.2866230 0.8566885
[2,] 0.7564300 0.4871401 0.2435700
[3,] 0.6360399 0.7279203 0.3639601
[4,] 0.7131435 0.5737130 0.2868565
[5,] 0.6894815 0.6210370 0.3105185
[6,] 0.6190526 0.7618948 0.3809474
[7,] 0.6471361 0.7057278 0.3528639
[8,] 0.5670757 0.8658486 0.4329243
[9,] 0.4687735 0.9375469 0.5312265
[10,] 0.4885372 0.9770744 0.5114628
[11,] 0.4026069 0.8052137 0.5973931
[12,] 0.3230935 0.6461870 0.6769065
[13,] 0.3224740 0.6449480 0.6775260
[14,] 0.7311676 0.5376648 0.2688324
[15,] 0.6652106 0.6695788 0.3347894
[16,] 0.6779551 0.6440899 0.3220449
[17,] 0.6508239 0.6983521 0.3491761
[18,] 0.5790612 0.8418776 0.4209388
[19,] 0.5308812 0.9382375 0.4691188
[20,] 0.5285835 0.9428330 0.4714165
[21,] 0.4583469 0.9166938 0.5416531
[22,] 0.3852802 0.7705604 0.6147198
[23,] 0.3538854 0.7077708 0.6461146
[24,] 0.2876200 0.5752401 0.7123800
[25,] 0.3201906 0.6403812 0.6798094
[26,] 0.7373991 0.5252017 0.2626009
[27,] 0.6802838 0.6394325 0.3197162
[28,] 0.6924455 0.6151090 0.3075545
[29,] 0.6436386 0.7127228 0.3563614
[30,] 0.5958060 0.8083879 0.4041940
[31,] 0.5384536 0.9230928 0.4615464
[32,] 0.4882396 0.9764791 0.5117604
[33,] 0.4241938 0.8483877 0.5758062
[34,] 0.4111972 0.8223944 0.5888028
[35,] 0.3392325 0.6784650 0.6607675
[36,] 0.2913320 0.5826640 0.7086680
[37,] 0.2866700 0.5733399 0.7133300
[38,] 0.7631692 0.4736615 0.2368308
[39,] 0.7003302 0.5993396 0.2996698
[40,] 0.6855842 0.6288316 0.3144158
[41,] 0.6596362 0.6807277 0.3403638
[42,] 0.6256036 0.7487927 0.3743964
[43,] 0.5876915 0.8246171 0.4123085
[44,] 0.5135395 0.9729209 0.4864605
[45,] 0.4241660 0.8483320 0.5758340
[46,] 0.3954233 0.7908465 0.6045767
[47,] 0.3059129 0.6118257 0.6940871
[48,] 0.2361604 0.4723208 0.7638396
[49,] 0.2520088 0.5040175 0.7479912
[50,] 0.7564811 0.4870378 0.2435189
[51,] 0.6477478 0.7045045 0.3522522
[52,] 0.5257398 0.9485204 0.4742602
[53,] 0.6616405 0.6767189 0.3383595
[54,] 0.6904098 0.6191803 0.3095902
> postscript(file="/var/www/html/rcomp/tmp/1mn3p1227286034.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/2e41w1227286034.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/3nbwz1227286034.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/4di8j1227286034.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/5t3501227286034.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 = 65
Frequency = 1
1 2 3 4 5 6
-8.28228139 -2.07456373 14.93315394 9.84087161 3.04858927 14.05630694
7 8 9 10 11 12
-32.43597539 -3.32825773 22.17945994 21.58717761 -1.30510472 -16.39738706
13 14 15 16 17 18
-8.18966939 -0.78195172 18.52576594 5.13348361 -1.65879872 18.24891894
19 20 21 22 23 24
-41.74336339 2.06435428 16.87207195 12.67978961 0.28750728 -11.00477505
25 26 27 28 29 30
-18.89705739 -7.88933972 -0.68162205 9.92609561 -0.06618672 18.04153095
31 32 33 34 35 36
-46.65075139 2.85696628 16.66468395 5.77240162 2.88011928 -14.21216305
37 38 39 40 41 42
-16.19425423 -8.88653657 10.42118110 -4.37110123 6.13661643 13.04433410
43 44 45 46 47 48
-48.14794823 1.15976943 14.26748710 11.97520477 9.68292244 -15.10935990
49 50 51 52 53 54
-7.60164223 -1.49392456 13.71379310 -0.37848923 4.72922844 14.23694610
55 56 57 58 59 60
-41.65533623 5.85238144 9.46009911 21.56781677 6.67553444 -20.21674789
61 62 63 64 65
-0.40903023 6.69868744 -6.79359489 16.71412277 4.92184044
> postscript(file="/var/www/html/rcomp/tmp/63yrc1227286034.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 = 65
Frequency = 1
lag(myerror, k = 1) myerror
0 -8.28228139 NA
1 -2.07456373 -8.28228139
2 14.93315394 -2.07456373
3 9.84087161 14.93315394
4 3.04858927 9.84087161
5 14.05630694 3.04858927
6 -32.43597539 14.05630694
7 -3.32825773 -32.43597539
8 22.17945994 -3.32825773
9 21.58717761 22.17945994
10 -1.30510472 21.58717761
11 -16.39738706 -1.30510472
12 -8.18966939 -16.39738706
13 -0.78195172 -8.18966939
14 18.52576594 -0.78195172
15 5.13348361 18.52576594
16 -1.65879872 5.13348361
17 18.24891894 -1.65879872
18 -41.74336339 18.24891894
19 2.06435428 -41.74336339
20 16.87207195 2.06435428
21 12.67978961 16.87207195
22 0.28750728 12.67978961
23 -11.00477505 0.28750728
24 -18.89705739 -11.00477505
25 -7.88933972 -18.89705739
26 -0.68162205 -7.88933972
27 9.92609561 -0.68162205
28 -0.06618672 9.92609561
29 18.04153095 -0.06618672
30 -46.65075139 18.04153095
31 2.85696628 -46.65075139
32 16.66468395 2.85696628
33 5.77240162 16.66468395
34 2.88011928 5.77240162
35 -14.21216305 2.88011928
36 -16.19425423 -14.21216305
37 -8.88653657 -16.19425423
38 10.42118110 -8.88653657
39 -4.37110123 10.42118110
40 6.13661643 -4.37110123
41 13.04433410 6.13661643
42 -48.14794823 13.04433410
43 1.15976943 -48.14794823
44 14.26748710 1.15976943
45 11.97520477 14.26748710
46 9.68292244 11.97520477
47 -15.10935990 9.68292244
48 -7.60164223 -15.10935990
49 -1.49392456 -7.60164223
50 13.71379310 -1.49392456
51 -0.37848923 13.71379310
52 4.72922844 -0.37848923
53 14.23694610 4.72922844
54 -41.65533623 14.23694610
55 5.85238144 -41.65533623
56 9.46009911 5.85238144
57 21.56781677 9.46009911
58 6.67553444 21.56781677
59 -20.21674789 6.67553444
60 -0.40903023 -20.21674789
61 6.69868744 -0.40903023
62 -6.79359489 6.69868744
63 16.71412277 -6.79359489
64 4.92184044 16.71412277
65 NA 4.92184044
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -2.07456373 -8.28228139
[2,] 14.93315394 -2.07456373
[3,] 9.84087161 14.93315394
[4,] 3.04858927 9.84087161
[5,] 14.05630694 3.04858927
[6,] -32.43597539 14.05630694
[7,] -3.32825773 -32.43597539
[8,] 22.17945994 -3.32825773
[9,] 21.58717761 22.17945994
[10,] -1.30510472 21.58717761
[11,] -16.39738706 -1.30510472
[12,] -8.18966939 -16.39738706
[13,] -0.78195172 -8.18966939
[14,] 18.52576594 -0.78195172
[15,] 5.13348361 18.52576594
[16,] -1.65879872 5.13348361
[17,] 18.24891894 -1.65879872
[18,] -41.74336339 18.24891894
[19,] 2.06435428 -41.74336339
[20,] 16.87207195 2.06435428
[21,] 12.67978961 16.87207195
[22,] 0.28750728 12.67978961
[23,] -11.00477505 0.28750728
[24,] -18.89705739 -11.00477505
[25,] -7.88933972 -18.89705739
[26,] -0.68162205 -7.88933972
[27,] 9.92609561 -0.68162205
[28,] -0.06618672 9.92609561
[29,] 18.04153095 -0.06618672
[30,] -46.65075139 18.04153095
[31,] 2.85696628 -46.65075139
[32,] 16.66468395 2.85696628
[33,] 5.77240162 16.66468395
[34,] 2.88011928 5.77240162
[35,] -14.21216305 2.88011928
[36,] -16.19425423 -14.21216305
[37,] -8.88653657 -16.19425423
[38,] 10.42118110 -8.88653657
[39,] -4.37110123 10.42118110
[40,] 6.13661643 -4.37110123
[41,] 13.04433410 6.13661643
[42,] -48.14794823 13.04433410
[43,] 1.15976943 -48.14794823
[44,] 14.26748710 1.15976943
[45,] 11.97520477 14.26748710
[46,] 9.68292244 11.97520477
[47,] -15.10935990 9.68292244
[48,] -7.60164223 -15.10935990
[49,] -1.49392456 -7.60164223
[50,] 13.71379310 -1.49392456
[51,] -0.37848923 13.71379310
[52,] 4.72922844 -0.37848923
[53,] 14.23694610 4.72922844
[54,] -41.65533623 14.23694610
[55,] 5.85238144 -41.65533623
[56,] 9.46009911 5.85238144
[57,] 21.56781677 9.46009911
[58,] 6.67553444 21.56781677
[59,] -20.21674789 6.67553444
[60,] -0.40903023 -20.21674789
[61,] 6.69868744 -0.40903023
[62,] -6.79359489 6.69868744
[63,] 16.71412277 -6.79359489
[64,] 4.92184044 16.71412277
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -2.07456373 -8.28228139
2 14.93315394 -2.07456373
3 9.84087161 14.93315394
4 3.04858927 9.84087161
5 14.05630694 3.04858927
6 -32.43597539 14.05630694
7 -3.32825773 -32.43597539
8 22.17945994 -3.32825773
9 21.58717761 22.17945994
10 -1.30510472 21.58717761
11 -16.39738706 -1.30510472
12 -8.18966939 -16.39738706
13 -0.78195172 -8.18966939
14 18.52576594 -0.78195172
15 5.13348361 18.52576594
16 -1.65879872 5.13348361
17 18.24891894 -1.65879872
18 -41.74336339 18.24891894
19 2.06435428 -41.74336339
20 16.87207195 2.06435428
21 12.67978961 16.87207195
22 0.28750728 12.67978961
23 -11.00477505 0.28750728
24 -18.89705739 -11.00477505
25 -7.88933972 -18.89705739
26 -0.68162205 -7.88933972
27 9.92609561 -0.68162205
28 -0.06618672 9.92609561
29 18.04153095 -0.06618672
30 -46.65075139 18.04153095
31 2.85696628 -46.65075139
32 16.66468395 2.85696628
33 5.77240162 16.66468395
34 2.88011928 5.77240162
35 -14.21216305 2.88011928
36 -16.19425423 -14.21216305
37 -8.88653657 -16.19425423
38 10.42118110 -8.88653657
39 -4.37110123 10.42118110
40 6.13661643 -4.37110123
41 13.04433410 6.13661643
42 -48.14794823 13.04433410
43 1.15976943 -48.14794823
44 14.26748710 1.15976943
45 11.97520477 14.26748710
46 9.68292244 11.97520477
47 -15.10935990 9.68292244
48 -7.60164223 -15.10935990
49 -1.49392456 -7.60164223
50 13.71379310 -1.49392456
51 -0.37848923 13.71379310
52 4.72922844 -0.37848923
53 14.23694610 4.72922844
54 -41.65533623 14.23694610
55 5.85238144 -41.65533623
56 9.46009911 5.85238144
57 21.56781677 9.46009911
58 6.67553444 21.56781677
59 -20.21674789 6.67553444
60 -0.40903023 -20.21674789
61 6.69868744 -0.40903023
62 -6.79359489 6.69868744
63 16.71412277 -6.79359489
64 4.92184044 16.71412277
> 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/7axem1227286034.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/8qc8r1227286034.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/9m1nb1227286034.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/10c2ky1227286034.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/11abyq1227286034.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/121ug71227286034.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/13fy7h1227286034.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/146olj1227286034.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/15xbei1227286034.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/16qrs61227286034.tab")
+ }
>
> system("convert tmp/1mn3p1227286034.ps tmp/1mn3p1227286034.png")
> system("convert tmp/2e41w1227286034.ps tmp/2e41w1227286034.png")
> system("convert tmp/3nbwz1227286034.ps tmp/3nbwz1227286034.png")
> system("convert tmp/4di8j1227286034.ps tmp/4di8j1227286034.png")
> system("convert tmp/5t3501227286034.ps tmp/5t3501227286034.png")
> system("convert tmp/63yrc1227286034.ps tmp/63yrc1227286034.png")
> system("convert tmp/7axem1227286034.ps tmp/7axem1227286034.png")
> system("convert tmp/8qc8r1227286034.ps tmp/8qc8r1227286034.png")
> system("convert tmp/9m1nb1227286034.ps tmp/9m1nb1227286034.png")
> system("convert tmp/10c2ky1227286034.ps tmp/10c2ky1227286034.png")
>
>
> proc.time()
user system elapsed
2.525 1.580 3.177