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(5560,611,3922,594,3759,595,4138,591,4634,589,3996,584,4308,573,4143,567,4429,569,5219,621,4929,629,5755,628,5592,612,4163,595,4962,597,5208,593,4755,590,4491,580,5732,574,5731,573,5040,573,6102,620,4904,626,5369,620,5578,588,4619,566,4731,557,5011,561,5299,549,4146,532,4625,526,4736,511,4219,499,5116,555,4205,565,4121,542,5103,527,4300,510,4578,514,3809,517,5526,508,4247,493,3830,490,4394,469,4826,478,4409,528,4569,534,4106,518,4794,506,3914,502,3793,516,4405,528,4022,533,4100,536,4788,537,3163,524,3585,536),dim=c(2,57),dimnames=list(c('Y','X'),1:57))
> y <- array(NA,dim=c(2,57),dimnames=list(c('Y','X'),1:57))
> 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'
> 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 5560 611 1 0 0 0 0 0 0 0 0 0 0
2 3922 594 0 1 0 0 0 0 0 0 0 0 0
3 3759 595 0 0 1 0 0 0 0 0 0 0 0
4 4138 591 0 0 0 1 0 0 0 0 0 0 0
5 4634 589 0 0 0 0 1 0 0 0 0 0 0
6 3996 584 0 0 0 0 0 1 0 0 0 0 0
7 4308 573 0 0 0 0 0 0 1 0 0 0 0
8 4143 567 0 0 0 0 0 0 0 1 0 0 0
9 4429 569 0 0 0 0 0 0 0 0 1 0 0
10 5219 621 0 0 0 0 0 0 0 0 0 1 0
11 4929 629 0 0 0 0 0 0 0 0 0 0 1
12 5755 628 0 0 0 0 0 0 0 0 0 0 0
13 5592 612 1 0 0 0 0 0 0 0 0 0 0
14 4163 595 0 1 0 0 0 0 0 0 0 0 0
15 4962 597 0 0 1 0 0 0 0 0 0 0 0
16 5208 593 0 0 0 1 0 0 0 0 0 0 0
17 4755 590 0 0 0 0 1 0 0 0 0 0 0
18 4491 580 0 0 0 0 0 1 0 0 0 0 0
19 5732 574 0 0 0 0 0 0 1 0 0 0 0
20 5731 573 0 0 0 0 0 0 0 1 0 0 0
21 5040 573 0 0 0 0 0 0 0 0 1 0 0
22 6102 620 0 0 0 0 0 0 0 0 0 1 0
23 4904 626 0 0 0 0 0 0 0 0 0 0 1
24 5369 620 0 0 0 0 0 0 0 0 0 0 0
25 5578 588 1 0 0 0 0 0 0 0 0 0 0
26 4619 566 0 1 0 0 0 0 0 0 0 0 0
27 4731 557 0 0 1 0 0 0 0 0 0 0 0
28 5011 561 0 0 0 1 0 0 0 0 0 0 0
29 5299 549 0 0 0 0 1 0 0 0 0 0 0
30 4146 532 0 0 0 0 0 1 0 0 0 0 0
31 4625 526 0 0 0 0 0 0 1 0 0 0 0
32 4736 511 0 0 0 0 0 0 0 1 0 0 0
33 4219 499 0 0 0 0 0 0 0 0 1 0 0
34 5116 555 0 0 0 0 0 0 0 0 0 1 0
35 4205 565 0 0 0 0 0 0 0 0 0 0 1
36 4121 542 0 0 0 0 0 0 0 0 0 0 0
37 5103 527 1 0 0 0 0 0 0 0 0 0 0
38 4300 510 0 1 0 0 0 0 0 0 0 0 0
39 4578 514 0 0 1 0 0 0 0 0 0 0 0
40 3809 517 0 0 0 1 0 0 0 0 0 0 0
41 5526 508 0 0 0 0 1 0 0 0 0 0 0
42 4247 493 0 0 0 0 0 1 0 0 0 0 0
43 3830 490 0 0 0 0 0 0 1 0 0 0 0
44 4394 469 0 0 0 0 0 0 0 1 0 0 0
45 4826 478 0 0 0 0 0 0 0 0 1 0 0
46 4409 528 0 0 0 0 0 0 0 0 0 1 0
47 4569 534 0 0 0 0 0 0 0 0 0 0 1
48 4106 518 0 0 0 0 0 0 0 0 0 0 0
49 4794 506 1 0 0 0 0 0 0 0 0 0 0
50 3914 502 0 1 0 0 0 0 0 0 0 0 0
51 3793 516 0 0 1 0 0 0 0 0 0 0 0
52 4405 528 0 0 0 1 0 0 0 0 0 0 0
53 4022 533 0 0 0 0 1 0 0 0 0 0 0
54 4100 536 0 0 0 0 0 1 0 0 0 0 0
55 4788 537 0 0 0 0 0 0 1 0 0 0 0
56 3163 524 0 0 0 0 0 0 0 1 0 0 0
57 3585 536 0 0 0 0 0 0 0 0 1 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
1424.564 5.915 536.156 -514.547 -347.744 -211.157
M5 M6 M7 M8 M9 M10
146.687 -452.457 37.720 -119.228 -145.842 350.088
M11
-254.027
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1242.01 -382.74 30.42 359.30 1036.14
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1424.564 1124.391 1.267 0.21183
X 5.915 1.892 3.127 0.00312 **
M1 536.156 363.057 1.477 0.14686
M2 -514.547 365.462 -1.408 0.16618
M3 -347.744 364.936 -0.953 0.34585
M4 -211.157 364.502 -0.579 0.56534
M5 146.687 365.371 0.401 0.69001
M6 -452.457 367.741 -1.230 0.22510
M7 37.720 369.416 0.102 0.91914
M8 -119.228 374.008 -0.319 0.75140
M9 -145.842 373.016 -0.391 0.69770
M10 350.088 382.421 0.915 0.36494
M11 -254.027 382.965 -0.663 0.51059
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 540.7 on 44 degrees of freedom
Multiple R-squared: 0.4327, Adjusted R-squared: 0.278
F-statistic: 2.797 on 12 and 44 DF, p-value: 0.006378
> 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.09052515 0.1810503 0.9094748
[2,] 0.05652959 0.1130592 0.9434704
[3,] 0.46409401 0.9281880 0.5359060
[4,] 0.64304260 0.7139148 0.3569574
[5,] 0.60914162 0.7817168 0.3908584
[6,] 0.50158059 0.9968388 0.4984194
[7,] 0.58689174 0.8262165 0.4131083
[8,] 0.50767229 0.9846554 0.4923277
[9,] 0.51964351 0.9607130 0.4803565
[10,] 0.61627925 0.7674415 0.3837208
[11,] 0.60069318 0.7986136 0.3993068
[12,] 0.53204634 0.9359073 0.4679537
[13,] 0.53476236 0.9304753 0.4652376
[14,] 0.49040612 0.9808122 0.5095939
[15,] 0.41112419 0.8222484 0.5888758
[16,] 0.36336616 0.7267323 0.6366338
[17,] 0.41209664 0.8241933 0.5879034
[18,] 0.33468948 0.6693790 0.6653105
[19,] 0.34331610 0.6866322 0.6566839
[20,] 0.26637294 0.5327459 0.7336271
[21,] 0.24723234 0.4944647 0.7527677
[22,] 0.18512391 0.3702478 0.8148761
[23,] 0.13868430 0.2773686 0.8613157
[24,] 0.11569755 0.2313951 0.8843025
[25,] 0.09652639 0.1930528 0.9034736
[26,] 0.16290229 0.3258046 0.8370977
> postscript(file="/var/www/html/rcomp/tmp/1azr41261328185.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/2o2tl1261328185.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/3dv8m1261328185.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/493qe1261328185.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/53mjl1261328185.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 = 57
Frequency = 1
1 2 3 4 5 6
-15.02986 -501.76522 -837.48366 -571.40818 -421.42206 -430.70058
7 8 9 10 11 12
-543.80818 -516.36826 -215.58518 -229.11598 37.67632 615.56462
13 14 15 16 17 18
11.05474 -266.68062 353.68554 486.76102 -306.33746 87.96102
19 20 21 22 23 24
874.27642 1036.13934 371.75322 659.79942 30.42252 276.88782
25 26 27 28 29 30
139.02433 360.86597 359.30152 479.05380 480.19392 26.90019
31 32 33 34 35 36
51.21559 407.89411 -11.50722 58.30039 -307.73811 -509.71102
37 38 39 40 41 42
24.86370 373.12834 460.66370 -462.66862 949.72530 358.60078
43 44 45 46 47 48
-530.83002 314.34089 719.71617 -488.98383 239.63927 -382.74143
49 50 51 52 53 54
-159.91291 34.45154 -336.16710 68.26199 -702.15969 -42.76140
55 56 57
149.14620 -1242.00608 -864.37700
> postscript(file="/var/www/html/rcomp/tmp/6bhxf1261328185.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 = 57
Frequency = 1
lag(myerror, k = 1) myerror
0 -15.02986 NA
1 -501.76522 -15.02986
2 -837.48366 -501.76522
3 -571.40818 -837.48366
4 -421.42206 -571.40818
5 -430.70058 -421.42206
6 -543.80818 -430.70058
7 -516.36826 -543.80818
8 -215.58518 -516.36826
9 -229.11598 -215.58518
10 37.67632 -229.11598
11 615.56462 37.67632
12 11.05474 615.56462
13 -266.68062 11.05474
14 353.68554 -266.68062
15 486.76102 353.68554
16 -306.33746 486.76102
17 87.96102 -306.33746
18 874.27642 87.96102
19 1036.13934 874.27642
20 371.75322 1036.13934
21 659.79942 371.75322
22 30.42252 659.79942
23 276.88782 30.42252
24 139.02433 276.88782
25 360.86597 139.02433
26 359.30152 360.86597
27 479.05380 359.30152
28 480.19392 479.05380
29 26.90019 480.19392
30 51.21559 26.90019
31 407.89411 51.21559
32 -11.50722 407.89411
33 58.30039 -11.50722
34 -307.73811 58.30039
35 -509.71102 -307.73811
36 24.86370 -509.71102
37 373.12834 24.86370
38 460.66370 373.12834
39 -462.66862 460.66370
40 949.72530 -462.66862
41 358.60078 949.72530
42 -530.83002 358.60078
43 314.34089 -530.83002
44 719.71617 314.34089
45 -488.98383 719.71617
46 239.63927 -488.98383
47 -382.74143 239.63927
48 -159.91291 -382.74143
49 34.45154 -159.91291
50 -336.16710 34.45154
51 68.26199 -336.16710
52 -702.15969 68.26199
53 -42.76140 -702.15969
54 149.14620 -42.76140
55 -1242.00608 149.14620
56 -864.37700 -1242.00608
57 NA -864.37700
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -501.76522 -15.02986
[2,] -837.48366 -501.76522
[3,] -571.40818 -837.48366
[4,] -421.42206 -571.40818
[5,] -430.70058 -421.42206
[6,] -543.80818 -430.70058
[7,] -516.36826 -543.80818
[8,] -215.58518 -516.36826
[9,] -229.11598 -215.58518
[10,] 37.67632 -229.11598
[11,] 615.56462 37.67632
[12,] 11.05474 615.56462
[13,] -266.68062 11.05474
[14,] 353.68554 -266.68062
[15,] 486.76102 353.68554
[16,] -306.33746 486.76102
[17,] 87.96102 -306.33746
[18,] 874.27642 87.96102
[19,] 1036.13934 874.27642
[20,] 371.75322 1036.13934
[21,] 659.79942 371.75322
[22,] 30.42252 659.79942
[23,] 276.88782 30.42252
[24,] 139.02433 276.88782
[25,] 360.86597 139.02433
[26,] 359.30152 360.86597
[27,] 479.05380 359.30152
[28,] 480.19392 479.05380
[29,] 26.90019 480.19392
[30,] 51.21559 26.90019
[31,] 407.89411 51.21559
[32,] -11.50722 407.89411
[33,] 58.30039 -11.50722
[34,] -307.73811 58.30039
[35,] -509.71102 -307.73811
[36,] 24.86370 -509.71102
[37,] 373.12834 24.86370
[38,] 460.66370 373.12834
[39,] -462.66862 460.66370
[40,] 949.72530 -462.66862
[41,] 358.60078 949.72530
[42,] -530.83002 358.60078
[43,] 314.34089 -530.83002
[44,] 719.71617 314.34089
[45,] -488.98383 719.71617
[46,] 239.63927 -488.98383
[47,] -382.74143 239.63927
[48,] -159.91291 -382.74143
[49,] 34.45154 -159.91291
[50,] -336.16710 34.45154
[51,] 68.26199 -336.16710
[52,] -702.15969 68.26199
[53,] -42.76140 -702.15969
[54,] 149.14620 -42.76140
[55,] -1242.00608 149.14620
[56,] -864.37700 -1242.00608
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -501.76522 -15.02986
2 -837.48366 -501.76522
3 -571.40818 -837.48366
4 -421.42206 -571.40818
5 -430.70058 -421.42206
6 -543.80818 -430.70058
7 -516.36826 -543.80818
8 -215.58518 -516.36826
9 -229.11598 -215.58518
10 37.67632 -229.11598
11 615.56462 37.67632
12 11.05474 615.56462
13 -266.68062 11.05474
14 353.68554 -266.68062
15 486.76102 353.68554
16 -306.33746 486.76102
17 87.96102 -306.33746
18 874.27642 87.96102
19 1036.13934 874.27642
20 371.75322 1036.13934
21 659.79942 371.75322
22 30.42252 659.79942
23 276.88782 30.42252
24 139.02433 276.88782
25 360.86597 139.02433
26 359.30152 360.86597
27 479.05380 359.30152
28 480.19392 479.05380
29 26.90019 480.19392
30 51.21559 26.90019
31 407.89411 51.21559
32 -11.50722 407.89411
33 58.30039 -11.50722
34 -307.73811 58.30039
35 -509.71102 -307.73811
36 24.86370 -509.71102
37 373.12834 24.86370
38 460.66370 373.12834
39 -462.66862 460.66370
40 949.72530 -462.66862
41 358.60078 949.72530
42 -530.83002 358.60078
43 314.34089 -530.83002
44 719.71617 314.34089
45 -488.98383 719.71617
46 239.63927 -488.98383
47 -382.74143 239.63927
48 -159.91291 -382.74143
49 34.45154 -159.91291
50 -336.16710 34.45154
51 68.26199 -336.16710
52 -702.15969 68.26199
53 -42.76140 -702.15969
54 149.14620 -42.76140
55 -1242.00608 149.14620
56 -864.37700 -1242.00608
> 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/799p41261328185.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/8gfei1261328185.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/96x3i1261328185.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/10plii1261328185.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/11n6tk1261328185.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/12szm51261328185.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/13y7k41261328185.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/14cl841261328185.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/15h0dy1261328185.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/16j6mr1261328186.tab")
+ }
>
> try(system("convert tmp/1azr41261328185.ps tmp/1azr41261328185.png",intern=TRUE))
character(0)
> try(system("convert tmp/2o2tl1261328185.ps tmp/2o2tl1261328185.png",intern=TRUE))
character(0)
> try(system("convert tmp/3dv8m1261328185.ps tmp/3dv8m1261328185.png",intern=TRUE))
character(0)
> try(system("convert tmp/493qe1261328185.ps tmp/493qe1261328185.png",intern=TRUE))
character(0)
> try(system("convert tmp/53mjl1261328185.ps tmp/53mjl1261328185.png",intern=TRUE))
character(0)
> try(system("convert tmp/6bhxf1261328185.ps tmp/6bhxf1261328185.png",intern=TRUE))
character(0)
> try(system("convert tmp/799p41261328185.ps tmp/799p41261328185.png",intern=TRUE))
character(0)
> try(system("convert tmp/8gfei1261328185.ps tmp/8gfei1261328185.png",intern=TRUE))
character(0)
> try(system("convert tmp/96x3i1261328185.ps tmp/96x3i1261328185.png",intern=TRUE))
character(0)
> try(system("convert tmp/10plii1261328185.ps tmp/10plii1261328185.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.374 1.555 3.263