R version 2.12.1 (2010-12-16)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-pc-linux-gnu (32-bit)
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(61,65,55,56,91,80,135,129,129,130,109,126,73,68,74,95,105,108,127,108,126,154,127,103,95,59,68,82,92,124,139,167,138,146,128,145,91,66,89,98,113,130,127,157,157,136,145,112,71,95,95,105,116,104,128,181,130,124,123,152),dim=c(1,60),dimnames=list(c('MaandelijkseSterfgevallenInOntario'),1:60))
> y <- array(NA,dim=c(1,60),dimnames=list(c('MaandelijkseSterfgevallenInOntario'),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 = 'Linear Trend'
> par2 = 'Include Monthly Dummies'
> par1 = '1'
> library(lattice)
> library(lmtest)
Loading required package: zoo
> 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
MaandelijkseSterfgevallenInOntario M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 61 1 0 0 0 0 0 0 0 0 0 0 1
2 65 0 1 0 0 0 0 0 0 0 0 0 2
3 55 0 0 1 0 0 0 0 0 0 0 0 3
4 56 0 0 0 1 0 0 0 0 0 0 0 4
5 91 0 0 0 0 1 0 0 0 0 0 0 5
6 80 0 0 0 0 0 1 0 0 0 0 0 6
7 135 0 0 0 0 0 0 1 0 0 0 0 7
8 129 0 0 0 0 0 0 0 1 0 0 0 8
9 129 0 0 0 0 0 0 0 0 1 0 0 9
10 130 0 0 0 0 0 0 0 0 0 1 0 10
11 109 0 0 0 0 0 0 0 0 0 0 1 11
12 126 0 0 0 0 0 0 0 0 0 0 0 12
13 73 1 0 0 0 0 0 0 0 0 0 0 13
14 68 0 1 0 0 0 0 0 0 0 0 0 14
15 74 0 0 1 0 0 0 0 0 0 0 0 15
16 95 0 0 0 1 0 0 0 0 0 0 0 16
17 105 0 0 0 0 1 0 0 0 0 0 0 17
18 108 0 0 0 0 0 1 0 0 0 0 0 18
19 127 0 0 0 0 0 0 1 0 0 0 0 19
20 108 0 0 0 0 0 0 0 1 0 0 0 20
21 126 0 0 0 0 0 0 0 0 1 0 0 21
22 154 0 0 0 0 0 0 0 0 0 1 0 22
23 127 0 0 0 0 0 0 0 0 0 0 1 23
24 103 0 0 0 0 0 0 0 0 0 0 0 24
25 95 1 0 0 0 0 0 0 0 0 0 0 25
26 59 0 1 0 0 0 0 0 0 0 0 0 26
27 68 0 0 1 0 0 0 0 0 0 0 0 27
28 82 0 0 0 1 0 0 0 0 0 0 0 28
29 92 0 0 0 0 1 0 0 0 0 0 0 29
30 124 0 0 0 0 0 1 0 0 0 0 0 30
31 139 0 0 0 0 0 0 1 0 0 0 0 31
32 167 0 0 0 0 0 0 0 1 0 0 0 32
33 138 0 0 0 0 0 0 0 0 1 0 0 33
34 146 0 0 0 0 0 0 0 0 0 1 0 34
35 128 0 0 0 0 0 0 0 0 0 0 1 35
36 145 0 0 0 0 0 0 0 0 0 0 0 36
37 91 1 0 0 0 0 0 0 0 0 0 0 37
38 66 0 1 0 0 0 0 0 0 0 0 0 38
39 89 0 0 1 0 0 0 0 0 0 0 0 39
40 98 0 0 0 1 0 0 0 0 0 0 0 40
41 113 0 0 0 0 1 0 0 0 0 0 0 41
42 130 0 0 0 0 0 1 0 0 0 0 0 42
43 127 0 0 0 0 0 0 1 0 0 0 0 43
44 157 0 0 0 0 0 0 0 1 0 0 0 44
45 157 0 0 0 0 0 0 0 0 1 0 0 45
46 136 0 0 0 0 0 0 0 0 0 1 0 46
47 145 0 0 0 0 0 0 0 0 0 0 1 47
48 112 0 0 0 0 0 0 0 0 0 0 0 48
49 71 1 0 0 0 0 0 0 0 0 0 0 49
50 95 0 1 0 0 0 0 0 0 0 0 0 50
51 95 0 0 1 0 0 0 0 0 0 0 0 51
52 105 0 0 0 1 0 0 0 0 0 0 0 52
53 116 0 0 0 0 1 0 0 0 0 0 0 53
54 104 0 0 0 0 0 1 0 0 0 0 0 54
55 128 0 0 0 0 0 0 1 0 0 0 0 55
56 181 0 0 0 0 0 0 0 1 0 0 0 56
57 130 0 0 0 0 0 0 0 0 1 0 0 57
58 124 0 0 0 0 0 0 0 0 0 1 0 58
59 123 0 0 0 0 0 0 0 0 0 0 1 59
60 152 0 0 0 0 0 0 0 0 0 0 0 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) M1 M2 M3 M4 M5
110.8750 -44.2896 -52.3542 -47.2188 -36.6833 -20.9479
M6 M7 M8 M9 M10 M11
-15.6125 5.9229 22.6583 9.7937 11.3292 -0.7354
t
0.4646
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-34.825 -9.844 3.000 7.850 21.575
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 110.8750 7.5423 14.700 < 2e-16 ***
M1 -44.2896 9.1756 -4.827 1.51e-05 ***
M2 -52.3542 9.1619 -5.714 7.26e-07 ***
M3 -47.2188 9.1495 -5.161 4.87e-06 ***
M4 -36.6833 9.1383 -4.014 0.000213 ***
M5 -20.9479 9.1285 -2.295 0.026257 *
M6 -15.6125 9.1200 -1.712 0.093507 .
M7 5.9229 9.1128 0.650 0.518884
M8 22.6583 9.1069 2.488 0.016447 *
M9 9.7937 9.1022 1.076 0.287433
M10 11.3292 9.0990 1.245 0.219265
M11 -0.7354 9.0970 -0.081 0.935911
t 0.4646 0.1094 4.246 0.000102 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 14.38 on 47 degrees of freedom
Multiple R-squared: 0.8218, Adjusted R-squared: 0.7763
F-statistic: 18.06 on 12 and 47 DF, p-value: 1.059e-13
> 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.28949364 0.57898727 0.7105064
[2,] 0.15408562 0.30817124 0.8459144
[3,] 0.09178935 0.18357870 0.9082106
[4,] 0.14893304 0.29786607 0.8510670
[5,] 0.46484800 0.92969600 0.5351520
[6,] 0.39349424 0.78698848 0.6065058
[7,] 0.37670875 0.75341750 0.6232913
[8,] 0.28400068 0.56800136 0.7159993
[9,] 0.47499676 0.94999351 0.5250032
[10,] 0.44727112 0.89454223 0.5527289
[11,] 0.48613727 0.97227454 0.5138627
[12,] 0.46394898 0.92789797 0.5360510
[13,] 0.42225700 0.84451401 0.5777430
[14,] 0.46519883 0.93039766 0.5348012
[15,] 0.44967649 0.89935299 0.5503235
[16,] 0.36927793 0.73855586 0.6307221
[17,] 0.48247560 0.96495121 0.5175244
[18,] 0.39591014 0.79182029 0.6040899
[19,] 0.34385375 0.68770751 0.6561462
[20,] 0.26454828 0.52909656 0.7354517
[21,] 0.23518897 0.47037794 0.7648110
[22,] 0.20639616 0.41279232 0.7936038
[23,] 0.24441930 0.48883861 0.7555807
[24,] 0.17434409 0.34868819 0.8256559
[25,] 0.11708379 0.23416758 0.8829162
[26,] 0.06988842 0.13977684 0.9301116
[27,] 0.06766724 0.13533448 0.9323328
[28,] 0.04615523 0.09231046 0.9538448
[29,] 0.04356524 0.08713048 0.9564348
> postscript(file="/var/www/rcomp/tmp/1ye1d1322567754.ps",horizontal=F,onefile=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/rcomp/tmp/2jvz81322567754.ps",horizontal=F,onefile=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/rcomp/tmp/3xaoq1322567754.ps",horizontal=F,onefile=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/rcomp/tmp/4a8d21322567754.ps",horizontal=F,onefile=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/rcomp/tmp/5pyjg1322567754.ps",horizontal=F,onefile=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 9 10
-6.050 5.550 -10.050 -20.050 -1.250 -18.050 14.950 -8.250 4.150 3.150
11 12 13 14 15 16 17 18 19 20
-6.250 9.550 0.375 2.975 3.375 13.375 7.175 4.375 1.375 -34.825
21 22 23 24 25 26 27 28 29 30
-4.425 21.575 6.175 -19.025 16.800 -11.600 -8.200 -5.200 -11.400 14.800
31 32 33 34 35 36 37 38 39 40
7.800 18.600 2.000 8.000 1.600 17.400 7.225 -10.175 7.225 5.225
41 42 43 44 45 46 47 48 49 50
4.025 15.225 -9.775 3.025 15.425 -7.575 13.025 -21.175 -18.350 13.250
51 52 53 54 55 56 57 58 59 60
7.650 6.650 1.450 -16.350 -14.350 21.450 -17.150 -25.150 -14.550 13.250
> postscript(file="/var/www/rcomp/tmp/65w6f1322567754.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 -6.050 NA
1 5.550 -6.050
2 -10.050 5.550
3 -20.050 -10.050
4 -1.250 -20.050
5 -18.050 -1.250
6 14.950 -18.050
7 -8.250 14.950
8 4.150 -8.250
9 3.150 4.150
10 -6.250 3.150
11 9.550 -6.250
12 0.375 9.550
13 2.975 0.375
14 3.375 2.975
15 13.375 3.375
16 7.175 13.375
17 4.375 7.175
18 1.375 4.375
19 -34.825 1.375
20 -4.425 -34.825
21 21.575 -4.425
22 6.175 21.575
23 -19.025 6.175
24 16.800 -19.025
25 -11.600 16.800
26 -8.200 -11.600
27 -5.200 -8.200
28 -11.400 -5.200
29 14.800 -11.400
30 7.800 14.800
31 18.600 7.800
32 2.000 18.600
33 8.000 2.000
34 1.600 8.000
35 17.400 1.600
36 7.225 17.400
37 -10.175 7.225
38 7.225 -10.175
39 5.225 7.225
40 4.025 5.225
41 15.225 4.025
42 -9.775 15.225
43 3.025 -9.775
44 15.425 3.025
45 -7.575 15.425
46 13.025 -7.575
47 -21.175 13.025
48 -18.350 -21.175
49 13.250 -18.350
50 7.650 13.250
51 6.650 7.650
52 1.450 6.650
53 -16.350 1.450
54 -14.350 -16.350
55 21.450 -14.350
56 -17.150 21.450
57 -25.150 -17.150
58 -14.550 -25.150
59 13.250 -14.550
60 NA 13.250
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 5.550 -6.050
[2,] -10.050 5.550
[3,] -20.050 -10.050
[4,] -1.250 -20.050
[5,] -18.050 -1.250
[6,] 14.950 -18.050
[7,] -8.250 14.950
[8,] 4.150 -8.250
[9,] 3.150 4.150
[10,] -6.250 3.150
[11,] 9.550 -6.250
[12,] 0.375 9.550
[13,] 2.975 0.375
[14,] 3.375 2.975
[15,] 13.375 3.375
[16,] 7.175 13.375
[17,] 4.375 7.175
[18,] 1.375 4.375
[19,] -34.825 1.375
[20,] -4.425 -34.825
[21,] 21.575 -4.425
[22,] 6.175 21.575
[23,] -19.025 6.175
[24,] 16.800 -19.025
[25,] -11.600 16.800
[26,] -8.200 -11.600
[27,] -5.200 -8.200
[28,] -11.400 -5.200
[29,] 14.800 -11.400
[30,] 7.800 14.800
[31,] 18.600 7.800
[32,] 2.000 18.600
[33,] 8.000 2.000
[34,] 1.600 8.000
[35,] 17.400 1.600
[36,] 7.225 17.400
[37,] -10.175 7.225
[38,] 7.225 -10.175
[39,] 5.225 7.225
[40,] 4.025 5.225
[41,] 15.225 4.025
[42,] -9.775 15.225
[43,] 3.025 -9.775
[44,] 15.425 3.025
[45,] -7.575 15.425
[46,] 13.025 -7.575
[47,] -21.175 13.025
[48,] -18.350 -21.175
[49,] 13.250 -18.350
[50,] 7.650 13.250
[51,] 6.650 7.650
[52,] 1.450 6.650
[53,] -16.350 1.450
[54,] -14.350 -16.350
[55,] 21.450 -14.350
[56,] -17.150 21.450
[57,] -25.150 -17.150
[58,] -14.550 -25.150
[59,] 13.250 -14.550
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 5.550 -6.050
2 -10.050 5.550
3 -20.050 -10.050
4 -1.250 -20.050
5 -18.050 -1.250
6 14.950 -18.050
7 -8.250 14.950
8 4.150 -8.250
9 3.150 4.150
10 -6.250 3.150
11 9.550 -6.250
12 0.375 9.550
13 2.975 0.375
14 3.375 2.975
15 13.375 3.375
16 7.175 13.375
17 4.375 7.175
18 1.375 4.375
19 -34.825 1.375
20 -4.425 -34.825
21 21.575 -4.425
22 6.175 21.575
23 -19.025 6.175
24 16.800 -19.025
25 -11.600 16.800
26 -8.200 -11.600
27 -5.200 -8.200
28 -11.400 -5.200
29 14.800 -11.400
30 7.800 14.800
31 18.600 7.800
32 2.000 18.600
33 8.000 2.000
34 1.600 8.000
35 17.400 1.600
36 7.225 17.400
37 -10.175 7.225
38 7.225 -10.175
39 5.225 7.225
40 4.025 5.225
41 15.225 4.025
42 -9.775 15.225
43 3.025 -9.775
44 15.425 3.025
45 -7.575 15.425
46 13.025 -7.575
47 -21.175 13.025
48 -18.350 -21.175
49 13.250 -18.350
50 7.650 13.250
51 6.650 7.650
52 1.450 6.650
53 -16.350 1.450
54 -14.350 -16.350
55 21.450 -14.350
56 -17.150 21.450
57 -25.150 -17.150
58 -14.550 -25.150
59 13.250 -14.550
> 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/rcomp/tmp/74vhh1322567754.ps",horizontal=F,onefile=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/rcomp/tmp/824l11322567754.ps",horizontal=F,onefile=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/rcomp/tmp/9jnf31322567754.ps",horizontal=F,onefile=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/rcomp/tmp/10jfbg1322567755.ps",horizontal=F,onefile=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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/rcomp/tmp/11p0601322567755.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/rcomp/tmp/128k3x1322567755.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/rcomp/tmp/13jmeo1322567755.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/rcomp/tmp/14il4n1322567755.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/rcomp/tmp/15gl4j1322567755.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/rcomp/tmp/16qpl91322567755.tab")
+ }
>
> try(system("convert tmp/1ye1d1322567754.ps tmp/1ye1d1322567754.png",intern=TRUE))
character(0)
> try(system("convert tmp/2jvz81322567754.ps tmp/2jvz81322567754.png",intern=TRUE))
character(0)
> try(system("convert tmp/3xaoq1322567754.ps tmp/3xaoq1322567754.png",intern=TRUE))
character(0)
> try(system("convert tmp/4a8d21322567754.ps tmp/4a8d21322567754.png",intern=TRUE))
character(0)
> try(system("convert tmp/5pyjg1322567754.ps tmp/5pyjg1322567754.png",intern=TRUE))
character(0)
> try(system("convert tmp/65w6f1322567754.ps tmp/65w6f1322567754.png",intern=TRUE))
character(0)
> try(system("convert tmp/74vhh1322567754.ps tmp/74vhh1322567754.png",intern=TRUE))
character(0)
> try(system("convert tmp/824l11322567754.ps tmp/824l11322567754.png",intern=TRUE))
character(0)
> try(system("convert tmp/9jnf31322567754.ps tmp/9jnf31322567754.png",intern=TRUE))
character(0)
> try(system("convert tmp/10jfbg1322567755.ps tmp/10jfbg1322567755.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.076 0.696 4.755