R version 2.13.0 (2011-04-13)
Copyright (C) 2011 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(15,1,14,3,1,1,10,1,8,3,0,1,14,0,12,6,1,1,10,1,7,2,0,1,10,0,10,1,1,0,7,0,7,2,0,0,16,1,16,8,1,1,9,1,11,1,1,0,12,0,14,4,1,1,6,0,6,0,0,0,13,0,16,4,1,0,12,1,11,2,0,1,15,0,16,1,1,1,8,1,12,2,1,1,11,0,7,3,0,0,11,0,13,1,1,0,10,1,11,2,1,1,14,1,15,6,1,0,9,1,7,0,0,1,6,1,9,1,0,1,9,0,7,3,0,1,15,1,14,5,1,1,11,1,15,0,1,1,10,1,7,1,0,1,14,1,15,3,1,1,15,1,17,6,1,1,9,1,15,5,1,0,13,1,14,4,1,0,13,0,14,4,0,0,11,1,8,4,1,1,8,0,8,0,0,1,12,1,14,3,1,0,14,1,14,5,1,1,11,0,8,3,0,0,9,1,11,1,1,1,17,1,16,5,1,1,12,1,10,5,1,1,10,1,8,0,0,1,13,1,14,3,1,1,16,1,16,6,1,0,14,0,13,3,1,1,12,1,5,1,0,0,6,1,8,2,0,1,8,1,10,2,0,0,8,0,8,2,0,1,16,1,13,4,1,1,17,1,15,4,1,1,9,0,6,0,0,1,9,0,12,3,1,1,14,1,16,6,0,1,6,1,5,3,1,0,8,0,15,1,1,1,12,0,12,4,1,0,8,0,8,3,0,1,14,0,13,3,1,1,12,1,14,3,1,1,11,0,12,2,1,1,17,0,16,6,1,1,8,1,10,5,1,1,15,0,15,5,1,0,7,0,8,2,0,1,16,1,16,4,1,1,17,0,19,2,1,1,16,0,14,5,1,0),dim=c(6,64),dimnames=list(c('Loon','Change','Size','Complex','Big4','Product'),1:64))
> y <- array(NA,dim=c(6,64),dimnames=list(c('Loon','Change','Size','Complex','Big4','Product'),1:64))
> 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'
> 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
Loon Change Size Complex Big4 Product
1 15 1 14 3 1 1
2 10 1 8 3 0 1
3 14 0 12 6 1 1
4 10 1 7 2 0 1
5 10 0 10 1 1 0
6 7 0 7 2 0 0
7 16 1 16 8 1 1
8 9 1 11 1 1 0
9 12 0 14 4 1 1
10 6 0 6 0 0 0
11 13 0 16 4 1 0
12 12 1 11 2 0 1
13 15 0 16 1 1 1
14 8 1 12 2 1 1
15 11 0 7 3 0 0
16 11 0 13 1 1 0
17 10 1 11 2 1 1
18 14 1 15 6 1 0
19 9 1 7 0 0 1
20 6 1 9 1 0 1
21 9 0 7 3 0 1
22 15 1 14 5 1 1
23 11 1 15 0 1 1
24 10 1 7 1 0 1
25 14 1 15 3 1 1
26 15 1 17 6 1 1
27 9 1 15 5 1 0
28 13 1 14 4 1 0
29 13 0 14 4 0 0
30 11 1 8 4 1 1
31 8 0 8 0 0 1
32 12 1 14 3 1 0
33 14 1 14 5 1 1
34 11 0 8 3 0 0
35 9 1 11 1 1 1
36 17 1 16 5 1 1
37 12 1 10 5 1 1
38 10 1 8 0 0 1
39 13 1 14 3 1 1
40 16 1 16 6 1 0
41 14 0 13 3 1 1
42 12 1 5 1 0 0
43 6 1 8 2 0 1
44 8 1 10 2 0 0
45 8 0 8 2 0 1
46 16 1 13 4 1 1
47 17 1 15 4 1 1
48 9 0 6 0 0 1
49 9 0 12 3 1 1
50 14 1 16 6 0 1
51 6 1 5 3 1 0
52 8 0 15 1 1 1
53 12 0 12 4 1 0
54 8 0 8 3 0 1
55 14 0 13 3 1 1
56 12 1 14 3 1 1
57 11 0 12 2 1 1
58 17 0 16 6 1 1
59 8 1 10 5 1 1
60 15 0 15 5 1 0
61 7 0 8 2 0 1
62 16 1 16 4 1 1
63 17 0 19 2 1 1
64 16 0 14 5 1 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Change Size Complex Big4 Product
3.5007 -0.1109 0.5540 0.5125 -0.2356 0.3531
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-5.0268 -1.1303 0.0383 1.4645 5.3277
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.5007 1.0058 3.480 0.000957 ***
Change -0.1109 0.5275 -0.210 0.834193
Size 0.5540 0.1083 5.117 3.68e-06 ***
Complex 0.5125 0.1639 3.126 0.002769 **
Big4 -0.2356 0.7482 -0.315 0.753993
Product 0.3531 0.5592 0.631 0.530238
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.017 on 58 degrees of freedom
Multiple R-squared: 0.6334, Adjusted R-squared: 0.6018
F-statistic: 20.05 on 5 and 58 DF, p-value: 1.488e-11
> 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.251644780 0.503289560 0.7483552
[2,] 0.125393778 0.250787556 0.8746062
[3,] 0.082728998 0.165457995 0.9172710
[4,] 0.043644079 0.087288157 0.9563559
[5,] 0.022817433 0.045634865 0.9771826
[6,] 0.273973928 0.547947857 0.7260261
[7,] 0.311374970 0.622749939 0.6886250
[8,] 0.223938417 0.447876835 0.7760616
[9,] 0.155195402 0.310390804 0.8448046
[10,] 0.103397843 0.206795687 0.8966022
[11,] 0.071939123 0.143878246 0.9280609
[12,] 0.195714219 0.391428438 0.8042858
[13,] 0.143728557 0.287457115 0.8562714
[14,] 0.116785937 0.233571874 0.8832141
[15,] 0.083737360 0.167474721 0.9162626
[16,] 0.078046092 0.156092183 0.9219539
[17,] 0.053767716 0.107535431 0.9462323
[18,] 0.037984960 0.075969919 0.9620150
[19,] 0.168176561 0.336353123 0.8318234
[20,] 0.141974996 0.283949992 0.8580250
[21,] 0.103772767 0.207545534 0.8962272
[22,] 0.079642923 0.159285846 0.9203571
[23,] 0.058908660 0.117817320 0.9410913
[24,] 0.046145065 0.092290130 0.9538549
[25,] 0.030041692 0.060083384 0.9699583
[26,] 0.024762342 0.049524684 0.9752377
[27,] 0.018879615 0.037759231 0.9811204
[28,] 0.020133764 0.040267528 0.9798662
[29,] 0.012859836 0.025719671 0.9871402
[30,] 0.011233602 0.022467204 0.9887664
[31,] 0.006539373 0.013078747 0.9934606
[32,] 0.004805629 0.009611259 0.9951944
[33,] 0.003751302 0.007502604 0.9962487
[34,] 0.082023614 0.164047228 0.9179764
[35,] 0.106310002 0.212620003 0.8936900
[36,] 0.092666232 0.185332464 0.9073338
[37,] 0.068962236 0.137924472 0.9310378
[38,] 0.123964525 0.247929050 0.8760355
[39,] 0.225151409 0.450302819 0.7748486
[40,] 0.434615136 0.869230271 0.5653849
[41,] 0.473103809 0.946207617 0.5268962
[42,] 0.434248782 0.868497565 0.5657512
[43,] 0.417683154 0.835366308 0.5823168
[44,] 0.905042302 0.189915396 0.0949577
[45,] 0.830127770 0.339744461 0.1698722
[46,] 0.720481065 0.559037869 0.2795189
[47,] 0.706082353 0.587835293 0.2939176
> postscript(file="/var/wessaorg/rcomp/tmp/1302m1321893924.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/wessaorg/rcomp/tmp/2cnee1321893924.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/wessaorg/rcomp/tmp/3zriq1321893924.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/wessaorg/rcomp/tmp/4a2ck1321893924.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/wessaorg/rcomp/tmp/5v4yr1321893924.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 = 64
Frequency = 1
1 2 3 4 5 6
2.19908503 0.28762215 0.65883191 1.35410154 0.68225534 -1.40373044
7 8 9 10 11 12
-0.47124671 -0.76084274 -1.42429629 -0.82479340 -1.17924810 1.13801455
13 14 15 16 17 18
2.00503317 -3.18041382 2.08381191 0.02019009 -0.62639207 -0.53921798
19 20 21 22 23 24
1.37901684 -3.24148430 -0.26927978 1.17416973 -0.81756376 1.86655919
25 26 27 28 29 30
0.64506329 -1.00035316 -5.02676033 0.03971907 -0.30679798 1.01075787
31 32 33 34 35 36
-0.28592857 -0.44782328 0.17416973 1.52979016 -1.11393442 2.06612624
37 38 39 40 41 42
0.39025672 1.82499510 0.19908503 0.90676027 1.64218311 5.32769437
43 44 45 46 47 48
-3.19992020 -1.95487202 -1.31084387 3.24064913 3.13260564 1.82211492
49 50 51 52 53 54
-2.80379514 -1.68192478 -1.46162756 -4.44094508 0.03683889 -1.82330152
55 56 57 58 59 60
1.64218311 -0.80091497 -0.29133749 1.44274492 -3.60974328 0.86231600
61 62 63 64
-2.31084387 1.57858389 1.83051028 2.41633774
> postscript(file="/var/wessaorg/rcomp/tmp/6sg5m1321893924.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 = 64
Frequency = 1
lag(myerror, k = 1) myerror
0 2.19908503 NA
1 0.28762215 2.19908503
2 0.65883191 0.28762215
3 1.35410154 0.65883191
4 0.68225534 1.35410154
5 -1.40373044 0.68225534
6 -0.47124671 -1.40373044
7 -0.76084274 -0.47124671
8 -1.42429629 -0.76084274
9 -0.82479340 -1.42429629
10 -1.17924810 -0.82479340
11 1.13801455 -1.17924810
12 2.00503317 1.13801455
13 -3.18041382 2.00503317
14 2.08381191 -3.18041382
15 0.02019009 2.08381191
16 -0.62639207 0.02019009
17 -0.53921798 -0.62639207
18 1.37901684 -0.53921798
19 -3.24148430 1.37901684
20 -0.26927978 -3.24148430
21 1.17416973 -0.26927978
22 -0.81756376 1.17416973
23 1.86655919 -0.81756376
24 0.64506329 1.86655919
25 -1.00035316 0.64506329
26 -5.02676033 -1.00035316
27 0.03971907 -5.02676033
28 -0.30679798 0.03971907
29 1.01075787 -0.30679798
30 -0.28592857 1.01075787
31 -0.44782328 -0.28592857
32 0.17416973 -0.44782328
33 1.52979016 0.17416973
34 -1.11393442 1.52979016
35 2.06612624 -1.11393442
36 0.39025672 2.06612624
37 1.82499510 0.39025672
38 0.19908503 1.82499510
39 0.90676027 0.19908503
40 1.64218311 0.90676027
41 5.32769437 1.64218311
42 -3.19992020 5.32769437
43 -1.95487202 -3.19992020
44 -1.31084387 -1.95487202
45 3.24064913 -1.31084387
46 3.13260564 3.24064913
47 1.82211492 3.13260564
48 -2.80379514 1.82211492
49 -1.68192478 -2.80379514
50 -1.46162756 -1.68192478
51 -4.44094508 -1.46162756
52 0.03683889 -4.44094508
53 -1.82330152 0.03683889
54 1.64218311 -1.82330152
55 -0.80091497 1.64218311
56 -0.29133749 -0.80091497
57 1.44274492 -0.29133749
58 -3.60974328 1.44274492
59 0.86231600 -3.60974328
60 -2.31084387 0.86231600
61 1.57858389 -2.31084387
62 1.83051028 1.57858389
63 2.41633774 1.83051028
64 NA 2.41633774
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.28762215 2.19908503
[2,] 0.65883191 0.28762215
[3,] 1.35410154 0.65883191
[4,] 0.68225534 1.35410154
[5,] -1.40373044 0.68225534
[6,] -0.47124671 -1.40373044
[7,] -0.76084274 -0.47124671
[8,] -1.42429629 -0.76084274
[9,] -0.82479340 -1.42429629
[10,] -1.17924810 -0.82479340
[11,] 1.13801455 -1.17924810
[12,] 2.00503317 1.13801455
[13,] -3.18041382 2.00503317
[14,] 2.08381191 -3.18041382
[15,] 0.02019009 2.08381191
[16,] -0.62639207 0.02019009
[17,] -0.53921798 -0.62639207
[18,] 1.37901684 -0.53921798
[19,] -3.24148430 1.37901684
[20,] -0.26927978 -3.24148430
[21,] 1.17416973 -0.26927978
[22,] -0.81756376 1.17416973
[23,] 1.86655919 -0.81756376
[24,] 0.64506329 1.86655919
[25,] -1.00035316 0.64506329
[26,] -5.02676033 -1.00035316
[27,] 0.03971907 -5.02676033
[28,] -0.30679798 0.03971907
[29,] 1.01075787 -0.30679798
[30,] -0.28592857 1.01075787
[31,] -0.44782328 -0.28592857
[32,] 0.17416973 -0.44782328
[33,] 1.52979016 0.17416973
[34,] -1.11393442 1.52979016
[35,] 2.06612624 -1.11393442
[36,] 0.39025672 2.06612624
[37,] 1.82499510 0.39025672
[38,] 0.19908503 1.82499510
[39,] 0.90676027 0.19908503
[40,] 1.64218311 0.90676027
[41,] 5.32769437 1.64218311
[42,] -3.19992020 5.32769437
[43,] -1.95487202 -3.19992020
[44,] -1.31084387 -1.95487202
[45,] 3.24064913 -1.31084387
[46,] 3.13260564 3.24064913
[47,] 1.82211492 3.13260564
[48,] -2.80379514 1.82211492
[49,] -1.68192478 -2.80379514
[50,] -1.46162756 -1.68192478
[51,] -4.44094508 -1.46162756
[52,] 0.03683889 -4.44094508
[53,] -1.82330152 0.03683889
[54,] 1.64218311 -1.82330152
[55,] -0.80091497 1.64218311
[56,] -0.29133749 -0.80091497
[57,] 1.44274492 -0.29133749
[58,] -3.60974328 1.44274492
[59,] 0.86231600 -3.60974328
[60,] -2.31084387 0.86231600
[61,] 1.57858389 -2.31084387
[62,] 1.83051028 1.57858389
[63,] 2.41633774 1.83051028
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.28762215 2.19908503
2 0.65883191 0.28762215
3 1.35410154 0.65883191
4 0.68225534 1.35410154
5 -1.40373044 0.68225534
6 -0.47124671 -1.40373044
7 -0.76084274 -0.47124671
8 -1.42429629 -0.76084274
9 -0.82479340 -1.42429629
10 -1.17924810 -0.82479340
11 1.13801455 -1.17924810
12 2.00503317 1.13801455
13 -3.18041382 2.00503317
14 2.08381191 -3.18041382
15 0.02019009 2.08381191
16 -0.62639207 0.02019009
17 -0.53921798 -0.62639207
18 1.37901684 -0.53921798
19 -3.24148430 1.37901684
20 -0.26927978 -3.24148430
21 1.17416973 -0.26927978
22 -0.81756376 1.17416973
23 1.86655919 -0.81756376
24 0.64506329 1.86655919
25 -1.00035316 0.64506329
26 -5.02676033 -1.00035316
27 0.03971907 -5.02676033
28 -0.30679798 0.03971907
29 1.01075787 -0.30679798
30 -0.28592857 1.01075787
31 -0.44782328 -0.28592857
32 0.17416973 -0.44782328
33 1.52979016 0.17416973
34 -1.11393442 1.52979016
35 2.06612624 -1.11393442
36 0.39025672 2.06612624
37 1.82499510 0.39025672
38 0.19908503 1.82499510
39 0.90676027 0.19908503
40 1.64218311 0.90676027
41 5.32769437 1.64218311
42 -3.19992020 5.32769437
43 -1.95487202 -3.19992020
44 -1.31084387 -1.95487202
45 3.24064913 -1.31084387
46 3.13260564 3.24064913
47 1.82211492 3.13260564
48 -2.80379514 1.82211492
49 -1.68192478 -2.80379514
50 -1.46162756 -1.68192478
51 -4.44094508 -1.46162756
52 0.03683889 -4.44094508
53 -1.82330152 0.03683889
54 1.64218311 -1.82330152
55 -0.80091497 1.64218311
56 -0.29133749 -0.80091497
57 1.44274492 -0.29133749
58 -3.60974328 1.44274492
59 0.86231600 -3.60974328
60 -2.31084387 0.86231600
61 1.57858389 -2.31084387
62 1.83051028 1.57858389
63 2.41633774 1.83051028
> 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/wessaorg/rcomp/tmp/7y3ep1321893924.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/wessaorg/rcomp/tmp/8x1f01321893924.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/wessaorg/rcomp/tmp/91ine1321893924.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/wessaorg/rcomp/tmp/1051s41321893924.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/11sav31321893924.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/wessaorg/rcomp/tmp/12d7n81321893924.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/wessaorg/rcomp/tmp/13cm051321893924.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/wessaorg/rcomp/tmp/1425s11321893924.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/wessaorg/rcomp/tmp/1597r61321893924.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/wessaorg/rcomp/tmp/16867a1321893924.tab")
+ }
>
> try(system("convert tmp/1302m1321893924.ps tmp/1302m1321893924.png",intern=TRUE))
character(0)
> try(system("convert tmp/2cnee1321893924.ps tmp/2cnee1321893924.png",intern=TRUE))
character(0)
> try(system("convert tmp/3zriq1321893924.ps tmp/3zriq1321893924.png",intern=TRUE))
character(0)
> try(system("convert tmp/4a2ck1321893924.ps tmp/4a2ck1321893924.png",intern=TRUE))
character(0)
> try(system("convert tmp/5v4yr1321893924.ps tmp/5v4yr1321893924.png",intern=TRUE))
character(0)
> try(system("convert tmp/6sg5m1321893924.ps tmp/6sg5m1321893924.png",intern=TRUE))
character(0)
> try(system("convert tmp/7y3ep1321893924.ps tmp/7y3ep1321893924.png",intern=TRUE))
character(0)
> try(system("convert tmp/8x1f01321893924.ps tmp/8x1f01321893924.png",intern=TRUE))
character(0)
> try(system("convert tmp/91ine1321893924.ps tmp/91ine1321893924.png",intern=TRUE))
character(0)
> try(system("convert tmp/1051s41321893924.ps tmp/1051s41321893924.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.275 0.495 3.816