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(104.89,124,105.15,118.63,105.24,121.86,105.57,119.97,105.62,125.03,106.17,130.09,106.27,126.65,106.41,121.7,106.94,119.24,107.16,122.63,107.32,116.66,107.32,114.12,107.35,113.11,107.55,112.61,107.87,113.4,108.37,115.18,108.38,121.01,107.92,119.44,108.03,116.68,108.14,117.07,108.3,117.41,108.64,119.58,108.66,120.92,109.04,117.09,109.03,116.77,109.03,119.39,109.54,122.49,109.75,124.08,109.83,118.29,109.65,112.94,109.82,113.79,109.95,114.43,110.12,118.7,110.15,120.36,110.21,118.27,109.99,118.34,110.14,117.82,110.14,117.65,110.81,118.18,110.97,121.02,110.99,124.78,109.73,131.16,109.81,130.14,110.02,131.75,110.18,134.73,110.21,135.35,110.25,140.32,110.36,136.35,110.51,131.6,110.6,128.9,110.95,133.89,111.18,138.25,111.19,146.23,111.69,144.76,111.7,149.3,111.83,156.8,111.77,159.08,111.73,165.12,112.01,163.14,111.86,153.43,112.04,151.01),dim=c(2,61),dimnames=list(c('AKW','AKB'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('AKW','AKB'),1:61))
> 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
AKW AKB
1 104.89 124.00
2 105.15 118.63
3 105.24 121.86
4 105.57 119.97
5 105.62 125.03
6 106.17 130.09
7 106.27 126.65
8 106.41 121.70
9 106.94 119.24
10 107.16 122.63
11 107.32 116.66
12 107.32 114.12
13 107.35 113.11
14 107.55 112.61
15 107.87 113.40
16 108.37 115.18
17 108.38 121.01
18 107.92 119.44
19 108.03 116.68
20 108.14 117.07
21 108.30 117.41
22 108.64 119.58
23 108.66 120.92
24 109.04 117.09
25 109.03 116.77
26 109.03 119.39
27 109.54 122.49
28 109.75 124.08
29 109.83 118.29
30 109.65 112.94
31 109.82 113.79
32 109.95 114.43
33 110.12 118.70
34 110.15 120.36
35 110.21 118.27
36 109.99 118.34
37 110.14 117.82
38 110.14 117.65
39 110.81 118.18
40 110.97 121.02
41 110.99 124.78
42 109.73 131.16
43 109.81 130.14
44 110.02 131.75
45 110.18 134.73
46 110.21 135.35
47 110.25 140.32
48 110.36 136.35
49 110.51 131.60
50 110.60 128.90
51 110.95 133.89
52 111.18 138.25
53 111.19 146.23
54 111.69 144.76
55 111.70 149.30
56 111.83 156.80
57 111.77 159.08
58 111.73 165.12
59 112.01 163.14
60 111.86 153.43
61 112.04 151.01
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) AKB
98.45745 0.08474
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-4.0757 -0.4505 0.3050 1.0067 2.3375
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 98.45745 1.91860 51.317 < 2e-16 ***
AKB 0.08474 0.01503 5.638 5.12e-07 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.575 on 59 degrees of freedom
Multiple R-squared: 0.3501, Adjusted R-squared: 0.3391
F-statistic: 31.78 on 1 and 59 DF, p-value: 5.119e-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,] 0.03178973 6.357945e-02 9.682103e-01
[2,] 0.02351737 4.703474e-02 9.764826e-01
[3,] 0.02396217 4.792435e-02 9.760378e-01
[4,] 0.07705662 1.541132e-01 9.229434e-01
[5,] 0.27363541 5.472708e-01 7.263646e-01
[6,] 0.48262587 9.652517e-01 5.173741e-01
[7,] 0.62606700 7.478660e-01 3.739330e-01
[8,] 0.65279824 6.944035e-01 3.472018e-01
[9,] 0.65440535 6.911893e-01 3.455946e-01
[10,] 0.65378960 6.924208e-01 3.462104e-01
[11,] 0.67600506 6.479899e-01 3.239949e-01
[12,] 0.77064589 4.587082e-01 2.293541e-01
[13,] 0.93024159 1.395168e-01 6.975841e-02
[14,] 0.97006928 5.986144e-02 2.993072e-02
[15,] 0.98374289 3.251421e-02 1.625711e-02
[16,] 0.99305095 1.389809e-02 6.949045e-03
[17,] 0.99770464 4.590714e-03 2.295357e-03
[18,] 0.99960980 7.804039e-04 3.902020e-04
[19,] 0.99996681 6.637267e-05 3.318633e-05
[20,] 0.99998816 2.368936e-05 1.184468e-05
[21,] 0.99999532 9.350571e-06 4.675285e-06
[22,] 0.99999927 1.467337e-06 7.336686e-07
[23,] 0.99999991 1.716482e-07 8.582410e-08
[24,] 0.99999999 2.756410e-08 1.378205e-08
[25,] 0.99999999 2.397493e-08 1.198747e-08
[26,] 0.99999998 4.781919e-08 2.390959e-08
[27,] 0.99999995 9.563500e-08 4.781750e-08
[28,] 0.99999991 1.857696e-07 9.288480e-08
[29,] 0.99999989 2.264885e-07 1.132442e-07
[30,] 0.99999987 2.636502e-07 1.318251e-07
[31,] 0.99999979 4.141517e-07 2.070759e-07
[32,] 0.99999960 7.991936e-07 3.995968e-07
[33,] 0.99999921 1.589950e-06 7.949749e-07
[34,] 0.99999833 3.331894e-06 1.665947e-06
[35,] 0.99999904 1.925008e-06 9.625038e-07
[36,] 0.99999978 4.320567e-07 2.160284e-07
[37,] 0.99999997 6.206696e-08 3.103348e-08
[38,] 0.99999997 6.990264e-08 3.495132e-08
[39,] 0.99999994 1.150554e-07 5.752770e-08
[40,] 0.99999988 2.314014e-07 1.157007e-07
[41,] 0.99999979 4.228264e-07 2.114132e-07
[42,] 0.99999968 6.492318e-07 3.246159e-07
[43,] 0.99999990 2.044903e-07 1.022452e-07
[44,] 0.99999994 1.219424e-07 6.097121e-08
[45,] 0.99999987 2.697255e-07 1.348628e-07
[46,] 0.99999960 8.081777e-07 4.040889e-07
[47,] 0.99999829 3.420296e-06 1.710148e-06
[48,] 0.99999252 1.495415e-05 7.477075e-06
[49,] 0.99999818 3.644937e-06 1.822468e-06
[50,] 0.99998430 3.139454e-05 1.569727e-05
[51,] 0.99992729 1.454278e-04 7.271388e-05
[52,] 0.99907869 1.842621e-03 9.213105e-04
> postscript(file="/var/www/html/rcomp/tmp/1s4sn1258912669.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/2dclj1258912669.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/3aw5o1258912669.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/4d1221258912669.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/5ncdf1258912669.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 = 61
Frequency = 1
1 2 3 4 5 6
-4.07569037 -3.36061562 -3.54433842 -3.05417245 -3.43297658 -3.31178072
7 8 9 10 11 12
-2.92026170 -2.36077940 -1.62230940 -1.68959122 -1.02367014 -0.80842063
13 14 15 16 17 18
-0.69282929 -0.45045734 -0.19740502 0.15175084 -0.33230610 -0.65925818
19 20 21 22 23 24
-0.31536501 -0.23841514 -0.10722806 0.04887767 -0.04467915 0.65988999
25 26 27 28 29 30
0.67700803 0.45497902 0.70227292 0.77753012 1.34819731 1.62157717
31 32 33 34 35 36
1.71954486 1.79530876 1.60345231 1.49277743 1.72989218 1.50396011
37 38 39 40 41 42
1.69802694 1.71243340 2.33751913 2.25684646 1.95820939 0.15754330
43 44 45 46 47 48
0.32398208 0.39754440 0.30500758 0.28246636 -0.09871083 0.34772246
49 50 51 52 53 54
0.90025599 1.21906452 1.14619246 1.00670905 0.34045272 0.96502625
55 56 57 58 59 60
0.59028895 0.08470969 -0.16850640 -0.72035956 -0.27256664 0.40029664
61
0.78537688
> postscript(file="/var/www/html/rcomp/tmp/6kcd11258912669.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 = 61
Frequency = 1
lag(myerror, k = 1) myerror
0 -4.07569037 NA
1 -3.36061562 -4.07569037
2 -3.54433842 -3.36061562
3 -3.05417245 -3.54433842
4 -3.43297658 -3.05417245
5 -3.31178072 -3.43297658
6 -2.92026170 -3.31178072
7 -2.36077940 -2.92026170
8 -1.62230940 -2.36077940
9 -1.68959122 -1.62230940
10 -1.02367014 -1.68959122
11 -0.80842063 -1.02367014
12 -0.69282929 -0.80842063
13 -0.45045734 -0.69282929
14 -0.19740502 -0.45045734
15 0.15175084 -0.19740502
16 -0.33230610 0.15175084
17 -0.65925818 -0.33230610
18 -0.31536501 -0.65925818
19 -0.23841514 -0.31536501
20 -0.10722806 -0.23841514
21 0.04887767 -0.10722806
22 -0.04467915 0.04887767
23 0.65988999 -0.04467915
24 0.67700803 0.65988999
25 0.45497902 0.67700803
26 0.70227292 0.45497902
27 0.77753012 0.70227292
28 1.34819731 0.77753012
29 1.62157717 1.34819731
30 1.71954486 1.62157717
31 1.79530876 1.71954486
32 1.60345231 1.79530876
33 1.49277743 1.60345231
34 1.72989218 1.49277743
35 1.50396011 1.72989218
36 1.69802694 1.50396011
37 1.71243340 1.69802694
38 2.33751913 1.71243340
39 2.25684646 2.33751913
40 1.95820939 2.25684646
41 0.15754330 1.95820939
42 0.32398208 0.15754330
43 0.39754440 0.32398208
44 0.30500758 0.39754440
45 0.28246636 0.30500758
46 -0.09871083 0.28246636
47 0.34772246 -0.09871083
48 0.90025599 0.34772246
49 1.21906452 0.90025599
50 1.14619246 1.21906452
51 1.00670905 1.14619246
52 0.34045272 1.00670905
53 0.96502625 0.34045272
54 0.59028895 0.96502625
55 0.08470969 0.59028895
56 -0.16850640 0.08470969
57 -0.72035956 -0.16850640
58 -0.27256664 -0.72035956
59 0.40029664 -0.27256664
60 0.78537688 0.40029664
61 NA 0.78537688
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -3.36061562 -4.07569037
[2,] -3.54433842 -3.36061562
[3,] -3.05417245 -3.54433842
[4,] -3.43297658 -3.05417245
[5,] -3.31178072 -3.43297658
[6,] -2.92026170 -3.31178072
[7,] -2.36077940 -2.92026170
[8,] -1.62230940 -2.36077940
[9,] -1.68959122 -1.62230940
[10,] -1.02367014 -1.68959122
[11,] -0.80842063 -1.02367014
[12,] -0.69282929 -0.80842063
[13,] -0.45045734 -0.69282929
[14,] -0.19740502 -0.45045734
[15,] 0.15175084 -0.19740502
[16,] -0.33230610 0.15175084
[17,] -0.65925818 -0.33230610
[18,] -0.31536501 -0.65925818
[19,] -0.23841514 -0.31536501
[20,] -0.10722806 -0.23841514
[21,] 0.04887767 -0.10722806
[22,] -0.04467915 0.04887767
[23,] 0.65988999 -0.04467915
[24,] 0.67700803 0.65988999
[25,] 0.45497902 0.67700803
[26,] 0.70227292 0.45497902
[27,] 0.77753012 0.70227292
[28,] 1.34819731 0.77753012
[29,] 1.62157717 1.34819731
[30,] 1.71954486 1.62157717
[31,] 1.79530876 1.71954486
[32,] 1.60345231 1.79530876
[33,] 1.49277743 1.60345231
[34,] 1.72989218 1.49277743
[35,] 1.50396011 1.72989218
[36,] 1.69802694 1.50396011
[37,] 1.71243340 1.69802694
[38,] 2.33751913 1.71243340
[39,] 2.25684646 2.33751913
[40,] 1.95820939 2.25684646
[41,] 0.15754330 1.95820939
[42,] 0.32398208 0.15754330
[43,] 0.39754440 0.32398208
[44,] 0.30500758 0.39754440
[45,] 0.28246636 0.30500758
[46,] -0.09871083 0.28246636
[47,] 0.34772246 -0.09871083
[48,] 0.90025599 0.34772246
[49,] 1.21906452 0.90025599
[50,] 1.14619246 1.21906452
[51,] 1.00670905 1.14619246
[52,] 0.34045272 1.00670905
[53,] 0.96502625 0.34045272
[54,] 0.59028895 0.96502625
[55,] 0.08470969 0.59028895
[56,] -0.16850640 0.08470969
[57,] -0.72035956 -0.16850640
[58,] -0.27256664 -0.72035956
[59,] 0.40029664 -0.27256664
[60,] 0.78537688 0.40029664
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -3.36061562 -4.07569037
2 -3.54433842 -3.36061562
3 -3.05417245 -3.54433842
4 -3.43297658 -3.05417245
5 -3.31178072 -3.43297658
6 -2.92026170 -3.31178072
7 -2.36077940 -2.92026170
8 -1.62230940 -2.36077940
9 -1.68959122 -1.62230940
10 -1.02367014 -1.68959122
11 -0.80842063 -1.02367014
12 -0.69282929 -0.80842063
13 -0.45045734 -0.69282929
14 -0.19740502 -0.45045734
15 0.15175084 -0.19740502
16 -0.33230610 0.15175084
17 -0.65925818 -0.33230610
18 -0.31536501 -0.65925818
19 -0.23841514 -0.31536501
20 -0.10722806 -0.23841514
21 0.04887767 -0.10722806
22 -0.04467915 0.04887767
23 0.65988999 -0.04467915
24 0.67700803 0.65988999
25 0.45497902 0.67700803
26 0.70227292 0.45497902
27 0.77753012 0.70227292
28 1.34819731 0.77753012
29 1.62157717 1.34819731
30 1.71954486 1.62157717
31 1.79530876 1.71954486
32 1.60345231 1.79530876
33 1.49277743 1.60345231
34 1.72989218 1.49277743
35 1.50396011 1.72989218
36 1.69802694 1.50396011
37 1.71243340 1.69802694
38 2.33751913 1.71243340
39 2.25684646 2.33751913
40 1.95820939 2.25684646
41 0.15754330 1.95820939
42 0.32398208 0.15754330
43 0.39754440 0.32398208
44 0.30500758 0.39754440
45 0.28246636 0.30500758
46 -0.09871083 0.28246636
47 0.34772246 -0.09871083
48 0.90025599 0.34772246
49 1.21906452 0.90025599
50 1.14619246 1.21906452
51 1.00670905 1.14619246
52 0.34045272 1.00670905
53 0.96502625 0.34045272
54 0.59028895 0.96502625
55 0.08470969 0.59028895
56 -0.16850640 0.08470969
57 -0.72035956 -0.16850640
58 -0.27256664 -0.72035956
59 0.40029664 -0.27256664
60 0.78537688 0.40029664
> 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/7kd2y1258912669.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/88ptg1258912669.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/983841258912669.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/105lqq1258912669.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/11ornz1258912669.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/126vbv1258912669.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/136met1258912669.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/1408301258912669.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/15s2tc1258912669.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/169x3p1258912669.tab")
+ }
>
> system("convert tmp/1s4sn1258912669.ps tmp/1s4sn1258912669.png")
> system("convert tmp/2dclj1258912669.ps tmp/2dclj1258912669.png")
> system("convert tmp/3aw5o1258912669.ps tmp/3aw5o1258912669.png")
> system("convert tmp/4d1221258912669.ps tmp/4d1221258912669.png")
> system("convert tmp/5ncdf1258912669.ps tmp/5ncdf1258912669.png")
> system("convert tmp/6kcd11258912669.ps tmp/6kcd11258912669.png")
> system("convert tmp/7kd2y1258912669.ps tmp/7kd2y1258912669.png")
> system("convert tmp/88ptg1258912669.ps tmp/88ptg1258912669.png")
> system("convert tmp/983841258912669.ps tmp/983841258912669.png")
> system("convert tmp/105lqq1258912669.ps tmp/105lqq1258912669.png")
>
>
> proc.time()
user system elapsed
2.481 1.591 2.915