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,543,3922,594,3759,611,4138,613,4634,611,3996,594,4308,595,4143,591,4429,589,5219,584,4929,573,5755,567,5592,569,4163,621,4962,629,5208,628,4755,612,4491,595,5732,597,5731,593,5040,590,6102,580,4904,574,5369,573,5578,573,4619,620,4731,626,5011,620,5299,588,4146,566,4625,557,4736,561,4219,549,5116,532,4205,526,4121,511,5103,499,4300,555,4578,565,3809,542,5526,527,4247,510,3830,514,4394,517,4826,508,4409,493,4569,490,4106,469,4794,478,3914,528,3793,534,4405,518,4022,506,4100,502,4788,516,3163,528,3585,533,3903,536,4178,537,3863,524,4187,536),dim=c(2,61),dimnames=list(c('Y','X'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('Y','X'),1:61))
> 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'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 5560 543 1 0 0 0 0 0 0 0 0 0 0 1
2 3922 594 0 1 0 0 0 0 0 0 0 0 0 2
3 3759 611 0 0 1 0 0 0 0 0 0 0 0 3
4 4138 613 0 0 0 1 0 0 0 0 0 0 0 4
5 4634 611 0 0 0 0 1 0 0 0 0 0 0 5
6 3996 594 0 0 0 0 0 1 0 0 0 0 0 6
7 4308 595 0 0 0 0 0 0 1 0 0 0 0 7
8 4143 591 0 0 0 0 0 0 0 1 0 0 0 8
9 4429 589 0 0 0 0 0 0 0 0 1 0 0 9
10 5219 584 0 0 0 0 0 0 0 0 0 1 0 10
11 4929 573 0 0 0 0 0 0 0 0 0 0 1 11
12 5755 567 0 0 0 0 0 0 0 0 0 0 0 12
13 5592 569 1 0 0 0 0 0 0 0 0 0 0 13
14 4163 621 0 1 0 0 0 0 0 0 0 0 0 14
15 4962 629 0 0 1 0 0 0 0 0 0 0 0 15
16 5208 628 0 0 0 1 0 0 0 0 0 0 0 16
17 4755 612 0 0 0 0 1 0 0 0 0 0 0 17
18 4491 595 0 0 0 0 0 1 0 0 0 0 0 18
19 5732 597 0 0 0 0 0 0 1 0 0 0 0 19
20 5731 593 0 0 0 0 0 0 0 1 0 0 0 20
21 5040 590 0 0 0 0 0 0 0 0 1 0 0 21
22 6102 580 0 0 0 0 0 0 0 0 0 1 0 22
23 4904 574 0 0 0 0 0 0 0 0 0 0 1 23
24 5369 573 0 0 0 0 0 0 0 0 0 0 0 24
25 5578 573 1 0 0 0 0 0 0 0 0 0 0 25
26 4619 620 0 1 0 0 0 0 0 0 0 0 0 26
27 4731 626 0 0 1 0 0 0 0 0 0 0 0 27
28 5011 620 0 0 0 1 0 0 0 0 0 0 0 28
29 5299 588 0 0 0 0 1 0 0 0 0 0 0 29
30 4146 566 0 0 0 0 0 1 0 0 0 0 0 30
31 4625 557 0 0 0 0 0 0 1 0 0 0 0 31
32 4736 561 0 0 0 0 0 0 0 1 0 0 0 32
33 4219 549 0 0 0 0 0 0 0 0 1 0 0 33
34 5116 532 0 0 0 0 0 0 0 0 0 1 0 34
35 4205 526 0 0 0 0 0 0 0 0 0 0 1 35
36 4121 511 0 0 0 0 0 0 0 0 0 0 0 36
37 5103 499 1 0 0 0 0 0 0 0 0 0 0 37
38 4300 555 0 1 0 0 0 0 0 0 0 0 0 38
39 4578 565 0 0 1 0 0 0 0 0 0 0 0 39
40 3809 542 0 0 0 1 0 0 0 0 0 0 0 40
41 5526 527 0 0 0 0 1 0 0 0 0 0 0 41
42 4247 510 0 0 0 0 0 1 0 0 0 0 0 42
43 3830 514 0 0 0 0 0 0 1 0 0 0 0 43
44 4394 517 0 0 0 0 0 0 0 1 0 0 0 44
45 4826 508 0 0 0 0 0 0 0 0 1 0 0 45
46 4409 493 0 0 0 0 0 0 0 0 0 1 0 46
47 4569 490 0 0 0 0 0 0 0 0 0 0 1 47
48 4106 469 0 0 0 0 0 0 0 0 0 0 0 48
49 4794 478 1 0 0 0 0 0 0 0 0 0 0 49
50 3914 528 0 1 0 0 0 0 0 0 0 0 0 50
51 3793 534 0 0 1 0 0 0 0 0 0 0 0 51
52 4405 518 0 0 0 1 0 0 0 0 0 0 0 52
53 4022 506 0 0 0 0 1 0 0 0 0 0 0 53
54 4100 502 0 0 0 0 0 1 0 0 0 0 0 54
55 4788 516 0 0 0 0 0 0 1 0 0 0 0 55
56 3163 528 0 0 0 0 0 0 0 1 0 0 0 56
57 3585 533 0 0 0 0 0 0 0 0 1 0 0 57
58 3903 536 0 0 0 0 0 0 0 0 0 1 0 58
59 4178 537 0 0 0 0 0 0 0 0 0 0 1 59
60 3863 524 0 0 0 0 0 0 0 0 0 0 0 60
61 4187 536 1 0 0 0 0 0 0 0 0 0 0 61
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X M1 M2 M3 M4
2496.367 4.584 435.089 -787.435 -641.816 -444.175
M5 M6 M7 M8 M9 M10
-32.882 -605.788 -148.484 -374.063 -360.706 217.335
M11 t
-144.842 -7.705
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-947.97 -382.68 49.13 339.93 1044.71
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2496.367 1889.462 1.321 0.1928
X 4.584 3.164 1.448 0.1541
M1 435.089 332.044 1.310 0.1964
M2 -787.435 368.108 -2.139 0.0376 *
M3 -641.816 380.554 -1.687 0.0983 .
M4 -444.175 371.635 -1.195 0.2380
M5 -32.882 358.190 -0.092 0.9272
M6 -605.788 349.679 -1.732 0.0898 .
M7 -148.484 351.349 -0.423 0.6745
M8 -374.063 353.408 -1.058 0.2953
M9 -360.706 351.751 -1.025 0.3104
M10 217.335 348.321 0.624 0.5357
M11 -144.842 347.195 -0.417 0.6784
t -7.705 6.745 -1.142 0.2591
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 546.9 on 47 degrees of freedom
Multiple R-squared: 0.416, Adjusted R-squared: 0.2545
F-statistic: 2.576 on 13 and 47 DF, p-value: 0.008943
> 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.62318803 0.75362394 0.37681197
[2,] 0.47226111 0.94452222 0.52773889
[3,] 0.52247758 0.95504485 0.47752242
[4,] 0.57547450 0.84905099 0.42452550
[5,] 0.47798443 0.95596886 0.52201557
[6,] 0.43219105 0.86438209 0.56780895
[7,] 0.49965179 0.99930358 0.50034821
[8,] 0.65391276 0.69217448 0.34608724
[9,] 0.67692023 0.64615953 0.32307977
[10,] 0.58176999 0.83646002 0.41823001
[11,] 0.50874681 0.98250639 0.49125319
[12,] 0.47730071 0.95460141 0.52269929
[13,] 0.38954545 0.77909091 0.61045455
[14,] 0.37953389 0.75906778 0.62046611
[15,] 0.33891640 0.67783280 0.66108360
[16,] 0.30363431 0.60726862 0.69636569
[17,] 0.25953497 0.51906994 0.74046503
[18,] 0.22039618 0.44079236 0.77960382
[19,] 0.20739411 0.41478822 0.79260589
[20,] 0.21297452 0.42594903 0.78702548
[21,] 0.14863006 0.29726013 0.85136994
[22,] 0.11534666 0.23069332 0.88465334
[23,] 0.09359546 0.18719092 0.90640454
[24,] 0.11906615 0.23813230 0.88093385
[25,] 0.30199001 0.60398002 0.69800999
[26,] 0.21189687 0.42379373 0.78810313
[27,] 0.97439013 0.05121974 0.02560987
[28,] 0.92737182 0.14525636 0.07262818
> postscript(file="/var/www/html/rcomp/tmp/1el5q1259005873.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/2qxgu1259005873.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/3o38s1259005873.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/4p0g61259005873.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/5mjuz1259005873.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 = 61
Frequency = 1
1 2 3 4 5 6 7
147.34046 -494.19500 -873.03055 -693.13370 -591.55427 -571.02048 -713.20340
8 9 10 11 12 13 14
-626.58493 -337.06890 -94.48668 35.81507 752.18022 152.62886 -284.49022
15 16 17 18 19 20 21
339.92685 400.57458 -382.67525 11.85855 794.09200 1044.71048 361.81013
22 23 24 25 26 27 28
899.31048 98.69410 431.14113 212.75701 268.55605 215.14038 332.70623
29 30 31 32 33 34 35
363.79440 -107.75367 -37.10035 288.84913 -178.79860 225.78712 -287.82925
36 37 38 39 40 41 42
-440.21148 169.40791 339.95432 434.20415 -419.30838 962.85817 342.39197
43 44 45 46 47 48 49
-542.54183 240.99127 708.59267 -209.98885 333.64390 -170.23658 49.12668
50 51 52 53 54 55 56
170.17485 -116.24083 379.16127 -352.42305 324.52362 498.75358 -947.96595
57 58 59 60 61
-554.53530 -820.62207 -180.32382 -572.87330 -731.26092
> postscript(file="/var/www/html/rcomp/tmp/6prwa1259005873.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 = 61
Frequency = 1
lag(myerror, k = 1) myerror
0 147.34046 NA
1 -494.19500 147.34046
2 -873.03055 -494.19500
3 -693.13370 -873.03055
4 -591.55427 -693.13370
5 -571.02048 -591.55427
6 -713.20340 -571.02048
7 -626.58493 -713.20340
8 -337.06890 -626.58493
9 -94.48668 -337.06890
10 35.81507 -94.48668
11 752.18022 35.81507
12 152.62886 752.18022
13 -284.49022 152.62886
14 339.92685 -284.49022
15 400.57458 339.92685
16 -382.67525 400.57458
17 11.85855 -382.67525
18 794.09200 11.85855
19 1044.71048 794.09200
20 361.81013 1044.71048
21 899.31048 361.81013
22 98.69410 899.31048
23 431.14113 98.69410
24 212.75701 431.14113
25 268.55605 212.75701
26 215.14038 268.55605
27 332.70623 215.14038
28 363.79440 332.70623
29 -107.75367 363.79440
30 -37.10035 -107.75367
31 288.84913 -37.10035
32 -178.79860 288.84913
33 225.78712 -178.79860
34 -287.82925 225.78712
35 -440.21148 -287.82925
36 169.40791 -440.21148
37 339.95432 169.40791
38 434.20415 339.95432
39 -419.30838 434.20415
40 962.85817 -419.30838
41 342.39197 962.85817
42 -542.54183 342.39197
43 240.99127 -542.54183
44 708.59267 240.99127
45 -209.98885 708.59267
46 333.64390 -209.98885
47 -170.23658 333.64390
48 49.12668 -170.23658
49 170.17485 49.12668
50 -116.24083 170.17485
51 379.16127 -116.24083
52 -352.42305 379.16127
53 324.52362 -352.42305
54 498.75358 324.52362
55 -947.96595 498.75358
56 -554.53530 -947.96595
57 -820.62207 -554.53530
58 -180.32382 -820.62207
59 -572.87330 -180.32382
60 -731.26092 -572.87330
61 NA -731.26092
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -494.19500 147.34046
[2,] -873.03055 -494.19500
[3,] -693.13370 -873.03055
[4,] -591.55427 -693.13370
[5,] -571.02048 -591.55427
[6,] -713.20340 -571.02048
[7,] -626.58493 -713.20340
[8,] -337.06890 -626.58493
[9,] -94.48668 -337.06890
[10,] 35.81507 -94.48668
[11,] 752.18022 35.81507
[12,] 152.62886 752.18022
[13,] -284.49022 152.62886
[14,] 339.92685 -284.49022
[15,] 400.57458 339.92685
[16,] -382.67525 400.57458
[17,] 11.85855 -382.67525
[18,] 794.09200 11.85855
[19,] 1044.71048 794.09200
[20,] 361.81013 1044.71048
[21,] 899.31048 361.81013
[22,] 98.69410 899.31048
[23,] 431.14113 98.69410
[24,] 212.75701 431.14113
[25,] 268.55605 212.75701
[26,] 215.14038 268.55605
[27,] 332.70623 215.14038
[28,] 363.79440 332.70623
[29,] -107.75367 363.79440
[30,] -37.10035 -107.75367
[31,] 288.84913 -37.10035
[32,] -178.79860 288.84913
[33,] 225.78712 -178.79860
[34,] -287.82925 225.78712
[35,] -440.21148 -287.82925
[36,] 169.40791 -440.21148
[37,] 339.95432 169.40791
[38,] 434.20415 339.95432
[39,] -419.30838 434.20415
[40,] 962.85817 -419.30838
[41,] 342.39197 962.85817
[42,] -542.54183 342.39197
[43,] 240.99127 -542.54183
[44,] 708.59267 240.99127
[45,] -209.98885 708.59267
[46,] 333.64390 -209.98885
[47,] -170.23658 333.64390
[48,] 49.12668 -170.23658
[49,] 170.17485 49.12668
[50,] -116.24083 170.17485
[51,] 379.16127 -116.24083
[52,] -352.42305 379.16127
[53,] 324.52362 -352.42305
[54,] 498.75358 324.52362
[55,] -947.96595 498.75358
[56,] -554.53530 -947.96595
[57,] -820.62207 -554.53530
[58,] -180.32382 -820.62207
[59,] -572.87330 -180.32382
[60,] -731.26092 -572.87330
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -494.19500 147.34046
2 -873.03055 -494.19500
3 -693.13370 -873.03055
4 -591.55427 -693.13370
5 -571.02048 -591.55427
6 -713.20340 -571.02048
7 -626.58493 -713.20340
8 -337.06890 -626.58493
9 -94.48668 -337.06890
10 35.81507 -94.48668
11 752.18022 35.81507
12 152.62886 752.18022
13 -284.49022 152.62886
14 339.92685 -284.49022
15 400.57458 339.92685
16 -382.67525 400.57458
17 11.85855 -382.67525
18 794.09200 11.85855
19 1044.71048 794.09200
20 361.81013 1044.71048
21 899.31048 361.81013
22 98.69410 899.31048
23 431.14113 98.69410
24 212.75701 431.14113
25 268.55605 212.75701
26 215.14038 268.55605
27 332.70623 215.14038
28 363.79440 332.70623
29 -107.75367 363.79440
30 -37.10035 -107.75367
31 288.84913 -37.10035
32 -178.79860 288.84913
33 225.78712 -178.79860
34 -287.82925 225.78712
35 -440.21148 -287.82925
36 169.40791 -440.21148
37 339.95432 169.40791
38 434.20415 339.95432
39 -419.30838 434.20415
40 962.85817 -419.30838
41 342.39197 962.85817
42 -542.54183 342.39197
43 240.99127 -542.54183
44 708.59267 240.99127
45 -209.98885 708.59267
46 333.64390 -209.98885
47 -170.23658 333.64390
48 49.12668 -170.23658
49 170.17485 49.12668
50 -116.24083 170.17485
51 379.16127 -116.24083
52 -352.42305 379.16127
53 324.52362 -352.42305
54 498.75358 324.52362
55 -947.96595 498.75358
56 -554.53530 -947.96595
57 -820.62207 -554.53530
58 -180.32382 -820.62207
59 -572.87330 -180.32382
60 -731.26092 -572.87330
> 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/7qluo1259005873.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/82hp31259005873.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/9q7021259005873.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/105u7c1259005873.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/11i6cn1259005874.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/120y7v1259005874.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/139emt1259005874.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/14y9j71259005874.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/15b5li1259005874.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/16d4af1259005874.tab")
+ }
>
> system("convert tmp/1el5q1259005873.ps tmp/1el5q1259005873.png")
> system("convert tmp/2qxgu1259005873.ps tmp/2qxgu1259005873.png")
> system("convert tmp/3o38s1259005873.ps tmp/3o38s1259005873.png")
> system("convert tmp/4p0g61259005873.ps tmp/4p0g61259005873.png")
> system("convert tmp/5mjuz1259005873.ps tmp/5mjuz1259005873.png")
> system("convert tmp/6prwa1259005873.ps tmp/6prwa1259005873.png")
> system("convert tmp/7qluo1259005873.ps tmp/7qluo1259005873.png")
> system("convert tmp/82hp31259005873.ps tmp/82hp31259005873.png")
> system("convert tmp/9q7021259005873.ps tmp/9q7021259005873.png")
> system("convert tmp/105u7c1259005873.ps tmp/105u7c1259005873.png")
>
>
> proc.time()
user system elapsed
2.368 1.563 2.855