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(902.2,0,891.9,0,874,0,930.9,0,944.2,0,935.9,0,937.1,0,885.1,0,892.4,0,987.3,0,946.3,0,799.6,0,875.4,0,846.2,0,880.6,0,885.7,0,868.9,0,882.5,0,789.6,0,773.3,0,804.3,0,817.8,0,836.7,0,721.8,0,760.8,0,841.4,0,1045.6,0,949.2,0,850.1,0,957.4,0,851.8,0,913.9,0,888,0,973.8,0,927.6,1,833,1,879.5,1,797.3,1,834.5,1,735.1,1,835,1,892.8,1,697.2,1,821.1,1,732.7,1,797.6,1,866.3,1,826.3,1,778.6,1,779.2,1,951,1,692.3,1,841.4,1,857.3,1,760.7,1,841.2,1,810.3,1,1007.4,1,931.3,1,931.2,1),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 = 'Include Monthly Dummies'
> par1 = '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 902.2 0 1 0 0 0 0 0 0 0 0 0 0
2 891.9 0 0 1 0 0 0 0 0 0 0 0 0
3 874.0 0 0 0 1 0 0 0 0 0 0 0 0
4 930.9 0 0 0 0 1 0 0 0 0 0 0 0
5 944.2 0 0 0 0 0 1 0 0 0 0 0 0
6 935.9 0 0 0 0 0 0 1 0 0 0 0 0
7 937.1 0 0 0 0 0 0 0 1 0 0 0 0
8 885.1 0 0 0 0 0 0 0 0 1 0 0 0
9 892.4 0 0 0 0 0 0 0 0 0 1 0 0
10 987.3 0 0 0 0 0 0 0 0 0 0 1 0
11 946.3 0 0 0 0 0 0 0 0 0 0 0 1
12 799.6 0 0 0 0 0 0 0 0 0 0 0 0
13 875.4 0 1 0 0 0 0 0 0 0 0 0 0
14 846.2 0 0 1 0 0 0 0 0 0 0 0 0
15 880.6 0 0 0 1 0 0 0 0 0 0 0 0
16 885.7 0 0 0 0 1 0 0 0 0 0 0 0
17 868.9 0 0 0 0 0 1 0 0 0 0 0 0
18 882.5 0 0 0 0 0 0 1 0 0 0 0 0
19 789.6 0 0 0 0 0 0 0 1 0 0 0 0
20 773.3 0 0 0 0 0 0 0 0 1 0 0 0
21 804.3 0 0 0 0 0 0 0 0 0 1 0 0
22 817.8 0 0 0 0 0 0 0 0 0 0 1 0
23 836.7 0 0 0 0 0 0 0 0 0 0 0 1
24 721.8 0 0 0 0 0 0 0 0 0 0 0 0
25 760.8 0 1 0 0 0 0 0 0 0 0 0 0
26 841.4 0 0 1 0 0 0 0 0 0 0 0 0
27 1045.6 0 0 0 1 0 0 0 0 0 0 0 0
28 949.2 0 0 0 0 1 0 0 0 0 0 0 0
29 850.1 0 0 0 0 0 1 0 0 0 0 0 0
30 957.4 0 0 0 0 0 0 1 0 0 0 0 0
31 851.8 0 0 0 0 0 0 0 1 0 0 0 0
32 913.9 0 0 0 0 0 0 0 0 1 0 0 0
33 888.0 0 0 0 0 0 0 0 0 0 1 0 0
34 973.8 0 0 0 0 0 0 0 0 0 0 1 0
35 927.6 1 0 0 0 0 0 0 0 0 0 0 1
36 833.0 1 0 0 0 0 0 0 0 0 0 0 0
37 879.5 1 1 0 0 0 0 0 0 0 0 0 0
38 797.3 1 0 1 0 0 0 0 0 0 0 0 0
39 834.5 1 0 0 1 0 0 0 0 0 0 0 0
40 735.1 1 0 0 0 1 0 0 0 0 0 0 0
41 835.0 1 0 0 0 0 1 0 0 0 0 0 0
42 892.8 1 0 0 0 0 0 1 0 0 0 0 0
43 697.2 1 0 0 0 0 0 0 1 0 0 0 0
44 821.1 1 0 0 0 0 0 0 0 1 0 0 0
45 732.7 1 0 0 0 0 0 0 0 0 1 0 0
46 797.6 1 0 0 0 0 0 0 0 0 0 1 0
47 866.3 1 0 0 0 0 0 0 0 0 0 0 1
48 826.3 1 0 0 0 0 0 0 0 0 0 0 0
49 778.6 1 1 0 0 0 0 0 0 0 0 0 0
50 779.2 1 0 1 0 0 0 0 0 0 0 0 0
51 951.0 1 0 0 1 0 0 0 0 0 0 0 0
52 692.3 1 0 0 0 1 0 0 0 0 0 0 0
53 841.4 1 0 0 0 0 1 0 0 0 0 0 0
54 857.3 1 0 0 0 0 0 1 0 0 0 0 0
55 760.7 1 0 0 0 0 0 0 1 0 0 0 0
56 841.2 1 0 0 0 0 0 0 0 1 0 0 0
57 810.3 1 0 0 0 0 0 0 0 0 1 0 0
58 1007.4 1 0 0 0 0 0 0 0 0 0 1 0
59 931.3 1 0 0 0 0 0 0 0 0 0 0 1
60 931.2 1 0 0 0 0 0 0 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X M1 M2 M3 M4
851.795 -49.025 7.115 -0.985 84.955 6.455
M5 M6 M7 M8 M9 M10
35.735 72.995 -24.905 14.735 -6.645 84.595
M11
79.260
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-129.995 -41.210 7.353 42.960 128.430
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 851.795 32.639 26.098 < 2e-16 ***
X -49.025 18.133 -2.704 0.00952 **
M1 7.115 43.669 0.163 0.87127
M2 -0.985 43.669 -0.023 0.98210
M3 84.955 43.669 1.945 0.05772 .
M4 6.455 43.669 0.148 0.88312
M5 35.735 43.669 0.818 0.41731
M6 72.995 43.669 1.672 0.10126
M7 -24.905 43.669 -0.570 0.57118
M8 14.735 43.669 0.337 0.73730
M9 -6.645 43.669 -0.152 0.87971
M10 84.595 43.669 1.937 0.05875 .
M11 79.260 43.518 1.821 0.07493 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 68.81 on 47 degrees of freedom
Multiple R-squared: 0.3552, Adjusted R-squared: 0.1906
F-statistic: 2.158 on 12 and 47 DF, p-value: 0.03049
> 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.07411025 0.1482205 0.9258898
[2,] 0.08798816 0.1759763 0.9120118
[3,] 0.05853565 0.1170713 0.9414644
[4,] 0.20167433 0.4033487 0.7983257
[5,] 0.25033398 0.5006680 0.7496660
[6,] 0.22459666 0.4491933 0.7754033
[7,] 0.42052598 0.8410520 0.5794740
[8,] 0.46974803 0.9394961 0.5302520
[9,] 0.65040293 0.6991941 0.3495971
[10,] 0.82588871 0.3482226 0.1741113
[11,] 0.77416730 0.4516654 0.2258327
[12,] 0.85908185 0.2818363 0.1409181
[13,] 0.90256111 0.1948778 0.0974389
[14,] 0.89294911 0.2141018 0.1070509
[15,] 0.84951240 0.3009752 0.1504876
[16,] 0.79010214 0.4197957 0.2098979
[17,] 0.74673075 0.5065385 0.2532692
[18,] 0.67703912 0.6459218 0.3229609
[19,] 0.60778285 0.7844343 0.3922171
[20,] 0.51406110 0.9718778 0.4859389
[21,] 0.43441880 0.8688376 0.5655812
[22,] 0.41264258 0.8252852 0.5873574
[23,] 0.35634533 0.7126907 0.6436547
[24,] 0.41462538 0.8292508 0.5853746
[25,] 0.42378415 0.8475683 0.5762159
[26,] 0.30581519 0.6116304 0.6941848
[27,] 0.20799449 0.4159890 0.7920055
[28,] 0.16649104 0.3329821 0.8335090
[29,] 0.08821428 0.1764286 0.9117857
> postscript(file="/var/www/html/rcomp/tmp/12qtv1258570287.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/2ueje1258570287.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/3ec601258570287.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/4vm2c1258570287.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/5ptf31258570287.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 7 8
43.290 41.090 -62.750 72.650 56.670 11.110 110.210 18.570
9 10 11 12 13 14 15 16
47.250 50.910 15.245 -52.195 16.490 -4.610 -56.150 27.450
17 18 19 20 21 22 23 24
-18.630 -42.290 -37.290 -93.230 -40.850 -118.590 -94.355 -129.995
25 26 27 28 29 30 31 32
-98.110 -9.410 108.850 90.950 -37.430 32.610 24.910 47.370
33 34 35 36 37 38 39 40
42.850 37.410 45.570 30.230 69.615 -4.485 -53.225 -74.125
41 42 43 44 45 46 47 48
-3.505 17.035 -80.665 3.595 -63.425 -89.765 -15.730 23.530
49 50 51 52 53 54 55 56
-31.285 -22.585 63.275 -116.925 2.895 -18.465 -17.165 23.695
57 58 59 60
14.175 120.035 49.270 128.430
> postscript(file="/var/www/html/rcomp/tmp/6cfdu1258570287.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 43.290 NA
1 41.090 43.290
2 -62.750 41.090
3 72.650 -62.750
4 56.670 72.650
5 11.110 56.670
6 110.210 11.110
7 18.570 110.210
8 47.250 18.570
9 50.910 47.250
10 15.245 50.910
11 -52.195 15.245
12 16.490 -52.195
13 -4.610 16.490
14 -56.150 -4.610
15 27.450 -56.150
16 -18.630 27.450
17 -42.290 -18.630
18 -37.290 -42.290
19 -93.230 -37.290
20 -40.850 -93.230
21 -118.590 -40.850
22 -94.355 -118.590
23 -129.995 -94.355
24 -98.110 -129.995
25 -9.410 -98.110
26 108.850 -9.410
27 90.950 108.850
28 -37.430 90.950
29 32.610 -37.430
30 24.910 32.610
31 47.370 24.910
32 42.850 47.370
33 37.410 42.850
34 45.570 37.410
35 30.230 45.570
36 69.615 30.230
37 -4.485 69.615
38 -53.225 -4.485
39 -74.125 -53.225
40 -3.505 -74.125
41 17.035 -3.505
42 -80.665 17.035
43 3.595 -80.665
44 -63.425 3.595
45 -89.765 -63.425
46 -15.730 -89.765
47 23.530 -15.730
48 -31.285 23.530
49 -22.585 -31.285
50 63.275 -22.585
51 -116.925 63.275
52 2.895 -116.925
53 -18.465 2.895
54 -17.165 -18.465
55 23.695 -17.165
56 14.175 23.695
57 120.035 14.175
58 49.270 120.035
59 128.430 49.270
60 NA 128.430
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 41.090 43.290
[2,] -62.750 41.090
[3,] 72.650 -62.750
[4,] 56.670 72.650
[5,] 11.110 56.670
[6,] 110.210 11.110
[7,] 18.570 110.210
[8,] 47.250 18.570
[9,] 50.910 47.250
[10,] 15.245 50.910
[11,] -52.195 15.245
[12,] 16.490 -52.195
[13,] -4.610 16.490
[14,] -56.150 -4.610
[15,] 27.450 -56.150
[16,] -18.630 27.450
[17,] -42.290 -18.630
[18,] -37.290 -42.290
[19,] -93.230 -37.290
[20,] -40.850 -93.230
[21,] -118.590 -40.850
[22,] -94.355 -118.590
[23,] -129.995 -94.355
[24,] -98.110 -129.995
[25,] -9.410 -98.110
[26,] 108.850 -9.410
[27,] 90.950 108.850
[28,] -37.430 90.950
[29,] 32.610 -37.430
[30,] 24.910 32.610
[31,] 47.370 24.910
[32,] 42.850 47.370
[33,] 37.410 42.850
[34,] 45.570 37.410
[35,] 30.230 45.570
[36,] 69.615 30.230
[37,] -4.485 69.615
[38,] -53.225 -4.485
[39,] -74.125 -53.225
[40,] -3.505 -74.125
[41,] 17.035 -3.505
[42,] -80.665 17.035
[43,] 3.595 -80.665
[44,] -63.425 3.595
[45,] -89.765 -63.425
[46,] -15.730 -89.765
[47,] 23.530 -15.730
[48,] -31.285 23.530
[49,] -22.585 -31.285
[50,] 63.275 -22.585
[51,] -116.925 63.275
[52,] 2.895 -116.925
[53,] -18.465 2.895
[54,] -17.165 -18.465
[55,] 23.695 -17.165
[56,] 14.175 23.695
[57,] 120.035 14.175
[58,] 49.270 120.035
[59,] 128.430 49.270
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 41.090 43.290
2 -62.750 41.090
3 72.650 -62.750
4 56.670 72.650
5 11.110 56.670
6 110.210 11.110
7 18.570 110.210
8 47.250 18.570
9 50.910 47.250
10 15.245 50.910
11 -52.195 15.245
12 16.490 -52.195
13 -4.610 16.490
14 -56.150 -4.610
15 27.450 -56.150
16 -18.630 27.450
17 -42.290 -18.630
18 -37.290 -42.290
19 -93.230 -37.290
20 -40.850 -93.230
21 -118.590 -40.850
22 -94.355 -118.590
23 -129.995 -94.355
24 -98.110 -129.995
25 -9.410 -98.110
26 108.850 -9.410
27 90.950 108.850
28 -37.430 90.950
29 32.610 -37.430
30 24.910 32.610
31 47.370 24.910
32 42.850 47.370
33 37.410 42.850
34 45.570 37.410
35 30.230 45.570
36 69.615 30.230
37 -4.485 69.615
38 -53.225 -4.485
39 -74.125 -53.225
40 -3.505 -74.125
41 17.035 -3.505
42 -80.665 17.035
43 3.595 -80.665
44 -63.425 3.595
45 -89.765 -63.425
46 -15.730 -89.765
47 23.530 -15.730
48 -31.285 23.530
49 -22.585 -31.285
50 63.275 -22.585
51 -116.925 63.275
52 2.895 -116.925
53 -18.465 2.895
54 -17.165 -18.465
55 23.695 -17.165
56 14.175 23.695
57 120.035 14.175
58 49.270 120.035
59 128.430 49.270
> 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/7czkr1258570287.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/8xovc1258570287.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/9utvj1258570287.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/10yul91258570287.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/11hnz11258570287.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/123dpt1258570287.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/13x1211258570287.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/14pwy21258570287.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/15cfir1258570287.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/16mv061258570287.tab")
+ }
>
> system("convert tmp/12qtv1258570287.ps tmp/12qtv1258570287.png")
> system("convert tmp/2ueje1258570287.ps tmp/2ueje1258570287.png")
> system("convert tmp/3ec601258570287.ps tmp/3ec601258570287.png")
> system("convert tmp/4vm2c1258570287.ps tmp/4vm2c1258570287.png")
> system("convert tmp/5ptf31258570287.ps tmp/5ptf31258570287.png")
> system("convert tmp/6cfdu1258570287.ps tmp/6cfdu1258570287.png")
> system("convert tmp/7czkr1258570287.ps tmp/7czkr1258570287.png")
> system("convert tmp/8xovc1258570287.ps tmp/8xovc1258570287.png")
> system("convert tmp/9utvj1258570287.ps tmp/9utvj1258570287.png")
> system("convert tmp/10yul91258570287.ps tmp/10yul91258570287.png")
>
>
> proc.time()
user system elapsed
2.402 1.591 2.825