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(9,1,14,3,1,1,9,1,8,3,0,1,9,0,12,6,1,1,9,1,7,2,0,1,9,0,10,1,1,0,9,0,7,2,0,0,9,1,16,8,1,1,9,1,11,1,1,0,9,0,14,4,1,1,9,0,6,0,0,0,9,0,16,4,1,0,9,1,11,2,0,1,9,0,16,1,1,1,9,1,12,2,1,1,9,0,7,3,0,0,9,0,13,1,1,0,9,1,11,2,1,1,9,1,15,6,1,0,9,1,7,0,0,1,9,1,9,1,0,1,9,0,7,3,0,1,9,1,14,5,1,1,9,1,15,0,1,1,9,1,7,1,0,1,9,1,15,3,1,1,9,1,17,6,1,1,9,1,15,5,1,0,9,1,14,4,1,0,9,0,14,4,0,0,9,1,8,4,1,1,9,0,8,0,0,1,9,1,14,3,1,0,9,1,14,5,1,1,9,0,8,3,0,0,9,1,11,1,1,1,9,1,16,5,1,1,9,1,10,5,1,1,9,1,8,0,0,1,9,1,14,3,1,1,9,1,16,6,1,0,9,0,13,3,1,1,9,1,5,1,0,0,9,1,8,2,0,1,9,1,10,2,0,0,9,0,8,2,0,1,9,1,13,4,1,1,9,1,15,4,1,1,9,0,6,0,0,1,9,0,12,3,1,1,9,1,16,6,0,1,9,1,5,3,1,0,9,0,15,1,1,1,9,0,12,4,1,0,9,0,8,3,0,1,9,0,13,3,1,1,9,1,14,3,1,1,10,0,12,2,1,1,10,0,16,6,1,1,10,1,10,5,1,1,10,0,15,5,1,0,10,0,8,2,0,1,10,1,16,4,1,1,10,0,19,2,1,1,10,0,14,5,1,0),dim=c(6,64),dimnames=list(c('Month','Change','Size','Complex','Big4','Product'),1:64))
> y <- array(NA,dim=c(6,64),dimnames=list(c('Month','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 = '4'
> 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
Complex Month Change Size Big4 Product
1 3 9 1 14 1 1
2 3 9 1 8 0 1
3 6 9 0 12 1 1
4 2 9 1 7 0 1
5 1 9 0 10 1 0
6 2 9 0 7 0 0
7 8 9 1 16 1 1
8 1 9 1 11 1 0
9 4 9 0 14 1 1
10 0 9 0 6 0 0
11 4 9 0 16 1 0
12 2 9 1 11 0 1
13 1 9 0 16 1 1
14 2 9 1 12 1 1
15 3 9 0 7 0 0
16 1 9 0 13 1 0
17 2 9 1 11 1 1
18 6 9 1 15 1 0
19 0 9 1 7 0 1
20 1 9 1 9 0 1
21 3 9 0 7 0 1
22 5 9 1 14 1 1
23 0 9 1 15 1 1
24 1 9 1 7 0 1
25 3 9 1 15 1 1
26 6 9 1 17 1 1
27 5 9 1 15 1 0
28 4 9 1 14 1 0
29 4 9 0 14 0 0
30 4 9 1 8 1 1
31 0 9 0 8 0 1
32 3 9 1 14 1 0
33 5 9 1 14 1 1
34 3 9 0 8 0 0
35 1 9 1 11 1 1
36 5 9 1 16 1 1
37 5 9 1 10 1 1
38 0 9 1 8 0 1
39 3 9 1 14 1 1
40 6 9 1 16 1 0
41 3 9 0 13 1 1
42 1 9 1 5 0 0
43 2 9 1 8 0 1
44 2 9 1 10 0 0
45 2 9 0 8 0 1
46 4 9 1 13 1 1
47 4 9 1 15 1 1
48 0 9 0 6 0 1
49 3 9 0 12 1 1
50 6 9 1 16 0 1
51 3 9 1 5 1 0
52 1 9 0 15 1 1
53 4 9 0 12 1 0
54 3 9 0 8 0 1
55 3 9 0 13 1 1
56 3 9 1 14 1 1
57 2 10 0 12 1 1
58 6 10 0 16 1 1
59 5 10 1 10 1 1
60 5 10 0 15 1 0
61 2 10 0 8 0 1
62 4 10 1 16 1 1
63 2 10 0 19 1 1
64 5 10 0 14 1 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Month Change Size Big4 Product
-5.4221 0.5915 0.5661 0.2414 0.3001 -0.4547
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-3.9337 -1.0128 0.0908 1.0841 3.8249
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -5.42209 5.87999 -0.922 0.36028
Month 0.59148 0.64962 0.910 0.36633
Change 0.56606 0.43385 1.305 0.19713
Size 0.24139 0.08032 3.005 0.00391 **
Big4 0.30014 0.59478 0.505 0.61574
Product -0.45466 0.44328 -1.026 0.30930
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.604 on 58 degrees of freedom
Multiple R-squared: 0.3247, Adjusted R-squared: 0.2664
F-statistic: 5.576 on 5 and 58 DF, p-value: 0.0002918
> 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.8512906 0.29741874 0.14870937
[2,] 0.7782870 0.44342597 0.22171298
[3,] 0.6989927 0.60201456 0.30100728
[4,] 0.7431302 0.51373963 0.25686981
[5,] 0.9617930 0.07641393 0.03820697
[6,] 0.9521985 0.09560295 0.04780147
[7,] 0.9473997 0.10520057 0.05260028
[8,] 0.9526013 0.09479740 0.04739870
[9,] 0.9313632 0.13727356 0.06863678
[10,] 0.9466177 0.10676467 0.05338233
[11,] 0.9462854 0.10742918 0.05371459
[12,] 0.9348862 0.13022759 0.06511379
[13,] 0.9334166 0.13316687 0.06658343
[14,] 0.9213253 0.15734949 0.07867475
[15,] 0.9895362 0.02092762 0.01046381
[16,] 0.9836578 0.03268447 0.01634223
[17,] 0.9769923 0.04601536 0.02300768
[18,] 0.9750767 0.04984655 0.02492328
[19,] 0.9650370 0.06992603 0.03496301
[20,] 0.9489681 0.10206383 0.05103192
[21,] 0.9289082 0.14218366 0.07109183
[22,] 0.9387940 0.12241204 0.06120602
[23,] 0.9325881 0.13482370 0.06741185
[24,] 0.9241529 0.15169427 0.07584713
[25,] 0.9118517 0.17629669 0.08814834
[26,] 0.8905188 0.21896245 0.10948122
[27,] 0.9114907 0.17701852 0.08850926
[28,] 0.8818857 0.23622855 0.11811428
[29,] 0.9148488 0.17030231 0.08515116
[30,] 0.9321231 0.13575373 0.06787686
[31,] 0.9081907 0.18361864 0.09180932
[32,] 0.8927621 0.21447571 0.10723785
[33,] 0.8481169 0.30376627 0.15188313
[34,] 0.8372236 0.32555286 0.16277643
[35,] 0.7842864 0.43142724 0.21571362
[36,] 0.8582132 0.28357370 0.14178685
[37,] 0.7993041 0.40139177 0.20069588
[38,] 0.7301339 0.53973215 0.26986608
[39,] 0.6421236 0.71575274 0.35787637
[40,] 0.6584308 0.68313842 0.34156921
[41,] 0.5939456 0.81210883 0.40605442
[42,] 0.5748637 0.85027265 0.42513633
[43,] 0.5755445 0.84891097 0.42445548
[44,] 0.5799315 0.84013692 0.42006846
[45,] 0.4597172 0.91943430 0.54028285
[46,] 0.3883784 0.77675676 0.61162162
[47,] 0.2552367 0.51047350 0.74476325
> postscript(file="/var/wessaorg/rcomp/tmp/1rb0b1321899401.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/26u191321899401.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/3se8t1321899401.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/4kcyr1321899401.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/5q5zk1321899401.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
-0.69227050 1.05623520 3.35658078 0.29762973 -1.61529016 0.40903195
7 8 9 10 11 12
3.82494044 -2.42274690 0.87379172 -1.34957352 -0.06365734 -0.66794839
13 14 15 16 17 18
-2.60899734 -1.20948143 1.40903195 -2.33947375 -0.96808690 1.61167498
19 20 21 22 23 24
-1.70237027 -1.18515933 1.86369195 1.30772950 -3.93366503 -0.70237027
25 26 27 28 29 30
-0.93366503 1.58354591 0.61167498 -0.14693049 0.71927024 1.75609669
31 32 33 34 35 36
-1.37770258 -1.14693049 1.30772950 1.16763742 -1.96808690 0.82494044
37 38 39 40 41 42
2.27330763 -1.94376480 -0.69227050 1.37028045 0.11518625 -0.67424120
43 44 45 46 47 48
0.05623520 -0.88121385 0.62229742 0.54912404 0.06633497 -0.89491352
49 50 51 52 53 54
0.35658078 2.12507896 1.02562028 -2.36760281 0.90192078 1.62229742
55 56 57 58 59 60
0.11518625 -0.69227050 -1.23489633 1.79952554 1.68183051 0.58626008
61 62 63 64
0.03082030 -0.76653667 -2.92465805 0.82765461
> postscript(file="/var/wessaorg/rcomp/tmp/6yz9g1321899401.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 -0.69227050 NA
1 1.05623520 -0.69227050
2 3.35658078 1.05623520
3 0.29762973 3.35658078
4 -1.61529016 0.29762973
5 0.40903195 -1.61529016
6 3.82494044 0.40903195
7 -2.42274690 3.82494044
8 0.87379172 -2.42274690
9 -1.34957352 0.87379172
10 -0.06365734 -1.34957352
11 -0.66794839 -0.06365734
12 -2.60899734 -0.66794839
13 -1.20948143 -2.60899734
14 1.40903195 -1.20948143
15 -2.33947375 1.40903195
16 -0.96808690 -2.33947375
17 1.61167498 -0.96808690
18 -1.70237027 1.61167498
19 -1.18515933 -1.70237027
20 1.86369195 -1.18515933
21 1.30772950 1.86369195
22 -3.93366503 1.30772950
23 -0.70237027 -3.93366503
24 -0.93366503 -0.70237027
25 1.58354591 -0.93366503
26 0.61167498 1.58354591
27 -0.14693049 0.61167498
28 0.71927024 -0.14693049
29 1.75609669 0.71927024
30 -1.37770258 1.75609669
31 -1.14693049 -1.37770258
32 1.30772950 -1.14693049
33 1.16763742 1.30772950
34 -1.96808690 1.16763742
35 0.82494044 -1.96808690
36 2.27330763 0.82494044
37 -1.94376480 2.27330763
38 -0.69227050 -1.94376480
39 1.37028045 -0.69227050
40 0.11518625 1.37028045
41 -0.67424120 0.11518625
42 0.05623520 -0.67424120
43 -0.88121385 0.05623520
44 0.62229742 -0.88121385
45 0.54912404 0.62229742
46 0.06633497 0.54912404
47 -0.89491352 0.06633497
48 0.35658078 -0.89491352
49 2.12507896 0.35658078
50 1.02562028 2.12507896
51 -2.36760281 1.02562028
52 0.90192078 -2.36760281
53 1.62229742 0.90192078
54 0.11518625 1.62229742
55 -0.69227050 0.11518625
56 -1.23489633 -0.69227050
57 1.79952554 -1.23489633
58 1.68183051 1.79952554
59 0.58626008 1.68183051
60 0.03082030 0.58626008
61 -0.76653667 0.03082030
62 -2.92465805 -0.76653667
63 0.82765461 -2.92465805
64 NA 0.82765461
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 1.05623520 -0.69227050
[2,] 3.35658078 1.05623520
[3,] 0.29762973 3.35658078
[4,] -1.61529016 0.29762973
[5,] 0.40903195 -1.61529016
[6,] 3.82494044 0.40903195
[7,] -2.42274690 3.82494044
[8,] 0.87379172 -2.42274690
[9,] -1.34957352 0.87379172
[10,] -0.06365734 -1.34957352
[11,] -0.66794839 -0.06365734
[12,] -2.60899734 -0.66794839
[13,] -1.20948143 -2.60899734
[14,] 1.40903195 -1.20948143
[15,] -2.33947375 1.40903195
[16,] -0.96808690 -2.33947375
[17,] 1.61167498 -0.96808690
[18,] -1.70237027 1.61167498
[19,] -1.18515933 -1.70237027
[20,] 1.86369195 -1.18515933
[21,] 1.30772950 1.86369195
[22,] -3.93366503 1.30772950
[23,] -0.70237027 -3.93366503
[24,] -0.93366503 -0.70237027
[25,] 1.58354591 -0.93366503
[26,] 0.61167498 1.58354591
[27,] -0.14693049 0.61167498
[28,] 0.71927024 -0.14693049
[29,] 1.75609669 0.71927024
[30,] -1.37770258 1.75609669
[31,] -1.14693049 -1.37770258
[32,] 1.30772950 -1.14693049
[33,] 1.16763742 1.30772950
[34,] -1.96808690 1.16763742
[35,] 0.82494044 -1.96808690
[36,] 2.27330763 0.82494044
[37,] -1.94376480 2.27330763
[38,] -0.69227050 -1.94376480
[39,] 1.37028045 -0.69227050
[40,] 0.11518625 1.37028045
[41,] -0.67424120 0.11518625
[42,] 0.05623520 -0.67424120
[43,] -0.88121385 0.05623520
[44,] 0.62229742 -0.88121385
[45,] 0.54912404 0.62229742
[46,] 0.06633497 0.54912404
[47,] -0.89491352 0.06633497
[48,] 0.35658078 -0.89491352
[49,] 2.12507896 0.35658078
[50,] 1.02562028 2.12507896
[51,] -2.36760281 1.02562028
[52,] 0.90192078 -2.36760281
[53,] 1.62229742 0.90192078
[54,] 0.11518625 1.62229742
[55,] -0.69227050 0.11518625
[56,] -1.23489633 -0.69227050
[57,] 1.79952554 -1.23489633
[58,] 1.68183051 1.79952554
[59,] 0.58626008 1.68183051
[60,] 0.03082030 0.58626008
[61,] -0.76653667 0.03082030
[62,] -2.92465805 -0.76653667
[63,] 0.82765461 -2.92465805
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 1.05623520 -0.69227050
2 3.35658078 1.05623520
3 0.29762973 3.35658078
4 -1.61529016 0.29762973
5 0.40903195 -1.61529016
6 3.82494044 0.40903195
7 -2.42274690 3.82494044
8 0.87379172 -2.42274690
9 -1.34957352 0.87379172
10 -0.06365734 -1.34957352
11 -0.66794839 -0.06365734
12 -2.60899734 -0.66794839
13 -1.20948143 -2.60899734
14 1.40903195 -1.20948143
15 -2.33947375 1.40903195
16 -0.96808690 -2.33947375
17 1.61167498 -0.96808690
18 -1.70237027 1.61167498
19 -1.18515933 -1.70237027
20 1.86369195 -1.18515933
21 1.30772950 1.86369195
22 -3.93366503 1.30772950
23 -0.70237027 -3.93366503
24 -0.93366503 -0.70237027
25 1.58354591 -0.93366503
26 0.61167498 1.58354591
27 -0.14693049 0.61167498
28 0.71927024 -0.14693049
29 1.75609669 0.71927024
30 -1.37770258 1.75609669
31 -1.14693049 -1.37770258
32 1.30772950 -1.14693049
33 1.16763742 1.30772950
34 -1.96808690 1.16763742
35 0.82494044 -1.96808690
36 2.27330763 0.82494044
37 -1.94376480 2.27330763
38 -0.69227050 -1.94376480
39 1.37028045 -0.69227050
40 0.11518625 1.37028045
41 -0.67424120 0.11518625
42 0.05623520 -0.67424120
43 -0.88121385 0.05623520
44 0.62229742 -0.88121385
45 0.54912404 0.62229742
46 0.06633497 0.54912404
47 -0.89491352 0.06633497
48 0.35658078 -0.89491352
49 2.12507896 0.35658078
50 1.02562028 2.12507896
51 -2.36760281 1.02562028
52 0.90192078 -2.36760281
53 1.62229742 0.90192078
54 0.11518625 1.62229742
55 -0.69227050 0.11518625
56 -1.23489633 -0.69227050
57 1.79952554 -1.23489633
58 1.68183051 1.79952554
59 0.58626008 1.68183051
60 0.03082030 0.58626008
61 -0.76653667 0.03082030
62 -2.92465805 -0.76653667
63 0.82765461 -2.92465805
> 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/7qhq21321899401.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/88sh01321899401.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/93hca1321899401.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/10cej51321899401.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/11ssyd1321899401.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/124x5u1321899401.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/1324f01321899401.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/144ohu1321899401.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/1558we1321899401.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/160ee41321899401.tab")
+ }
>
> try(system("convert tmp/1rb0b1321899401.ps tmp/1rb0b1321899401.png",intern=TRUE))
character(0)
> try(system("convert tmp/26u191321899401.ps tmp/26u191321899401.png",intern=TRUE))
character(0)
> try(system("convert tmp/3se8t1321899401.ps tmp/3se8t1321899401.png",intern=TRUE))
character(0)
> try(system("convert tmp/4kcyr1321899401.ps tmp/4kcyr1321899401.png",intern=TRUE))
character(0)
> try(system("convert tmp/5q5zk1321899401.ps tmp/5q5zk1321899401.png",intern=TRUE))
character(0)
> try(system("convert tmp/6yz9g1321899401.ps tmp/6yz9g1321899401.png",intern=TRUE))
character(0)
> try(system("convert tmp/7qhq21321899401.ps tmp/7qhq21321899401.png",intern=TRUE))
character(0)
> try(system("convert tmp/88sh01321899401.ps tmp/88sh01321899401.png",intern=TRUE))
character(0)
> try(system("convert tmp/93hca1321899401.ps tmp/93hca1321899401.png",intern=TRUE))
character(0)
> try(system("convert tmp/10cej51321899401.ps tmp/10cej51321899401.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.354 0.514 3.922