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(555,0,562,0,561,0,555,0,544,0,537,0,543,0,594,0,611,0,613,0,611,0,594,0,595,0,591,0,589,0,584,0,573,0,567,0,569,0,621,0,629,0,628,0,612,0,595,0,597,0,593,0,590,0,580,0,574,0,573,0,573,0,620,0,626,0,620,0,588,0,566,0,557,0,561,0,549,0,532,0,526,0,511,0,499,0,555,0,565,0,542,0,527,0,510,0,514,0,517,0,508,0,493,0,490,1,469,1,478,1,528,1,534,1,518,1,506,1,502,1,516,1,528,1,533,1,536,1,537,1,524,1,536,1,587,1,597,1,581,1),dim=c(2,70),dimnames=list(c('Y','X'),1:70))
> y <- array(NA,dim=c(2,70),dimnames=list(c('Y','X'),1:70))
> 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 = 'Do not include Seasonal 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 t
1 555 0 1
2 562 0 2
3 561 0 3
4 555 0 4
5 544 0 5
6 537 0 6
7 543 0 7
8 594 0 8
9 611 0 9
10 613 0 10
11 611 0 11
12 594 0 12
13 595 0 13
14 591 0 14
15 589 0 15
16 584 0 16
17 573 0 17
18 567 0 18
19 569 0 19
20 621 0 20
21 629 0 21
22 628 0 22
23 612 0 23
24 595 0 24
25 597 0 25
26 593 0 26
27 590 0 27
28 580 0 28
29 574 0 29
30 573 0 30
31 573 0 31
32 620 0 32
33 626 0 33
34 620 0 34
35 588 0 35
36 566 0 36
37 557 0 37
38 561 0 38
39 549 0 39
40 532 0 40
41 526 0 41
42 511 0 42
43 499 0 43
44 555 0 44
45 565 0 45
46 542 0 46
47 527 0 47
48 510 0 48
49 514 0 49
50 517 0 50
51 508 0 51
52 493 0 52
53 490 1 53
54 469 1 54
55 478 1 55
56 528 1 56
57 534 1 57
58 518 1 58
59 506 1 59
60 502 1 60
61 516 1 61
62 528 1 62
63 533 1 63
64 536 1 64
65 537 1 65
66 524 1 66
67 536 1 67
68 587 1 68
69 597 1 69
70 581 1 70
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X t
593.2869 -9.6361 -0.9085
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-65.592 -28.888 2.185 19.313 76.036
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 593.2869 9.4593 62.720 < 2e-16 ***
X -9.6361 14.2874 -0.674 0.50235
t -0.9085 0.3091 -2.940 0.00450 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 34.13 on 67 degrees of freedom
Multiple R-squared: 0.2973, Adjusted R-squared: 0.2763
F-statistic: 14.17 on 2 and 67 DF, p-value: 7.361e-06
> 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.016091955 0.032183909 0.983908045
[2,] 0.004114913 0.008229825 0.995885087
[3,] 0.169376887 0.338753773 0.830623113
[4,] 0.267625556 0.535251111 0.732374444
[5,] 0.226444628 0.452889255 0.773555372
[6,] 0.151209106 0.302418212 0.848790894
[7,] 0.104693232 0.209386463 0.895306768
[8,] 0.071306910 0.142613820 0.928693090
[9,] 0.052972881 0.105945761 0.947027119
[10,] 0.040613484 0.081226968 0.959386516
[11,] 0.034747179 0.069494357 0.965252821
[12,] 0.040348089 0.080696179 0.959651911
[13,] 0.049346727 0.098693454 0.950653273
[14,] 0.048759753 0.097519505 0.951240247
[15,] 0.042332008 0.084664017 0.957667992
[16,] 0.039428553 0.078857105 0.960571447
[17,] 0.032301931 0.064603863 0.967698069
[18,] 0.021254859 0.042509718 0.978745141
[19,] 0.016340060 0.032680120 0.983659940
[20,] 0.011999486 0.023998972 0.988000514
[21,] 0.009378004 0.018756008 0.990621996
[22,] 0.007636128 0.015272255 0.992363872
[23,] 0.007598801 0.015197603 0.992401199
[24,] 0.008107138 0.016214275 0.991892862
[25,] 0.007904313 0.015808626 0.992095687
[26,] 0.007051759 0.014103519 0.992948241
[27,] 0.009080179 0.018160357 0.990919821
[28,] 0.019374751 0.038749501 0.980625249
[29,] 0.049691211 0.099382423 0.950308789
[30,] 0.087386617 0.174773233 0.912613383
[31,] 0.156630648 0.313261296 0.843369352
[32,] 0.261107022 0.522214044 0.738892978
[33,] 0.403962422 0.807924844 0.596037578
[34,] 0.560584785 0.878830430 0.439415215
[35,] 0.688395208 0.623209584 0.311604792
[36,] 0.769469503 0.461060995 0.230530497
[37,] 0.824446493 0.351107014 0.175553507
[38,] 0.867138875 0.265722249 0.132861125
[39,] 0.909662865 0.180674271 0.090337135
[40,] 0.976089476 0.047821047 0.023910524
[41,] 0.989938983 0.020122034 0.010061017
[42,] 0.993310742 0.013378516 0.006689258
[43,] 0.992470145 0.015059711 0.007529855
[44,] 0.991080866 0.017838267 0.008919134
[45,] 0.989999117 0.020001766 0.010000883
[46,] 0.987082433 0.025835135 0.012917567
[47,] 0.981549240 0.036901520 0.018450760
[48,] 0.969929166 0.060141667 0.030070834
[49,] 0.960290094 0.079419811 0.039709906
[50,] 0.948303477 0.103393046 0.051696523
[51,] 0.956370355 0.087259290 0.043629645
[52,] 0.981452169 0.037095662 0.018547831
[53,] 0.981981407 0.036037187 0.018018593
[54,] 0.966690987 0.066618026 0.033309013
[55,] 0.933828631 0.132342738 0.066171369
[56,] 0.881271701 0.237456599 0.118728299
[57,] 0.822824995 0.354350010 0.177175005
[58,] 0.755231874 0.489536252 0.244768126
[59,] 0.671221588 0.657556825 0.328778412
> postscript(file="/var/www/html/rcomp/tmp/15bww1258728872.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/2xlo71258728872.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/3ke411258728872.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/4rxsm1258728872.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/5p4051258728872.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 = 70
Frequency = 1
1 2 3 4 5 6
-37.3784374 -29.4699316 -29.5614257 -34.6529199 -44.7444141 -50.8359082
7 8 9 10 11 12
-43.9274024 7.9811035 25.8896093 28.7981152 27.7066210 11.6151268
13 14 15 16 17 18
13.5236327 10.4321385 9.3406444 5.2491502 -4.8423440 -9.9338381
19 20 21 22 23 24
-7.0253323 45.8831736 54.7916794 54.7001853 39.6086911 23.5171969
25 26 27 28 29 30
26.4257028 23.3342086 21.2427145 12.1512203 7.0597261 6.9682320
31 32 33 34 35 36
7.8767378 55.7852437 62.6937495 57.6022553 26.5107612 5.4192670
37 38 39 40 41 42
-2.6722271 2.2362787 -8.8552154 -24.9467096 -30.0382038 -44.1296979
43 44 45 46 47 48
-55.2211921 1.6873138 12.5958196 -9.4956746 -23.5871687 -39.6786629
49 50 51 52 53 54
-34.7701570 -30.8616512 -38.9531453 -53.0446395 -45.5000774 -65.5915716
55 56 57 58 59 60
-55.6830657 -4.7745599 2.1339459 -12.9575482 -24.0490424 -27.1405365
61 62 63 64 65 66
-12.2320307 0.6764751 6.5849810 10.4934868 12.4019927 0.3104985
67 68 69 70
13.2190043 65.1275102 76.0360160 60.9445219
> postscript(file="/var/www/html/rcomp/tmp/67qky1258728872.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 = 70
Frequency = 1
lag(myerror, k = 1) myerror
0 -37.3784374 NA
1 -29.4699316 -37.3784374
2 -29.5614257 -29.4699316
3 -34.6529199 -29.5614257
4 -44.7444141 -34.6529199
5 -50.8359082 -44.7444141
6 -43.9274024 -50.8359082
7 7.9811035 -43.9274024
8 25.8896093 7.9811035
9 28.7981152 25.8896093
10 27.7066210 28.7981152
11 11.6151268 27.7066210
12 13.5236327 11.6151268
13 10.4321385 13.5236327
14 9.3406444 10.4321385
15 5.2491502 9.3406444
16 -4.8423440 5.2491502
17 -9.9338381 -4.8423440
18 -7.0253323 -9.9338381
19 45.8831736 -7.0253323
20 54.7916794 45.8831736
21 54.7001853 54.7916794
22 39.6086911 54.7001853
23 23.5171969 39.6086911
24 26.4257028 23.5171969
25 23.3342086 26.4257028
26 21.2427145 23.3342086
27 12.1512203 21.2427145
28 7.0597261 12.1512203
29 6.9682320 7.0597261
30 7.8767378 6.9682320
31 55.7852437 7.8767378
32 62.6937495 55.7852437
33 57.6022553 62.6937495
34 26.5107612 57.6022553
35 5.4192670 26.5107612
36 -2.6722271 5.4192670
37 2.2362787 -2.6722271
38 -8.8552154 2.2362787
39 -24.9467096 -8.8552154
40 -30.0382038 -24.9467096
41 -44.1296979 -30.0382038
42 -55.2211921 -44.1296979
43 1.6873138 -55.2211921
44 12.5958196 1.6873138
45 -9.4956746 12.5958196
46 -23.5871687 -9.4956746
47 -39.6786629 -23.5871687
48 -34.7701570 -39.6786629
49 -30.8616512 -34.7701570
50 -38.9531453 -30.8616512
51 -53.0446395 -38.9531453
52 -45.5000774 -53.0446395
53 -65.5915716 -45.5000774
54 -55.6830657 -65.5915716
55 -4.7745599 -55.6830657
56 2.1339459 -4.7745599
57 -12.9575482 2.1339459
58 -24.0490424 -12.9575482
59 -27.1405365 -24.0490424
60 -12.2320307 -27.1405365
61 0.6764751 -12.2320307
62 6.5849810 0.6764751
63 10.4934868 6.5849810
64 12.4019927 10.4934868
65 0.3104985 12.4019927
66 13.2190043 0.3104985
67 65.1275102 13.2190043
68 76.0360160 65.1275102
69 60.9445219 76.0360160
70 NA 60.9445219
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -29.4699316 -37.3784374
[2,] -29.5614257 -29.4699316
[3,] -34.6529199 -29.5614257
[4,] -44.7444141 -34.6529199
[5,] -50.8359082 -44.7444141
[6,] -43.9274024 -50.8359082
[7,] 7.9811035 -43.9274024
[8,] 25.8896093 7.9811035
[9,] 28.7981152 25.8896093
[10,] 27.7066210 28.7981152
[11,] 11.6151268 27.7066210
[12,] 13.5236327 11.6151268
[13,] 10.4321385 13.5236327
[14,] 9.3406444 10.4321385
[15,] 5.2491502 9.3406444
[16,] -4.8423440 5.2491502
[17,] -9.9338381 -4.8423440
[18,] -7.0253323 -9.9338381
[19,] 45.8831736 -7.0253323
[20,] 54.7916794 45.8831736
[21,] 54.7001853 54.7916794
[22,] 39.6086911 54.7001853
[23,] 23.5171969 39.6086911
[24,] 26.4257028 23.5171969
[25,] 23.3342086 26.4257028
[26,] 21.2427145 23.3342086
[27,] 12.1512203 21.2427145
[28,] 7.0597261 12.1512203
[29,] 6.9682320 7.0597261
[30,] 7.8767378 6.9682320
[31,] 55.7852437 7.8767378
[32,] 62.6937495 55.7852437
[33,] 57.6022553 62.6937495
[34,] 26.5107612 57.6022553
[35,] 5.4192670 26.5107612
[36,] -2.6722271 5.4192670
[37,] 2.2362787 -2.6722271
[38,] -8.8552154 2.2362787
[39,] -24.9467096 -8.8552154
[40,] -30.0382038 -24.9467096
[41,] -44.1296979 -30.0382038
[42,] -55.2211921 -44.1296979
[43,] 1.6873138 -55.2211921
[44,] 12.5958196 1.6873138
[45,] -9.4956746 12.5958196
[46,] -23.5871687 -9.4956746
[47,] -39.6786629 -23.5871687
[48,] -34.7701570 -39.6786629
[49,] -30.8616512 -34.7701570
[50,] -38.9531453 -30.8616512
[51,] -53.0446395 -38.9531453
[52,] -45.5000774 -53.0446395
[53,] -65.5915716 -45.5000774
[54,] -55.6830657 -65.5915716
[55,] -4.7745599 -55.6830657
[56,] 2.1339459 -4.7745599
[57,] -12.9575482 2.1339459
[58,] -24.0490424 -12.9575482
[59,] -27.1405365 -24.0490424
[60,] -12.2320307 -27.1405365
[61,] 0.6764751 -12.2320307
[62,] 6.5849810 0.6764751
[63,] 10.4934868 6.5849810
[64,] 12.4019927 10.4934868
[65,] 0.3104985 12.4019927
[66,] 13.2190043 0.3104985
[67,] 65.1275102 13.2190043
[68,] 76.0360160 65.1275102
[69,] 60.9445219 76.0360160
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -29.4699316 -37.3784374
2 -29.5614257 -29.4699316
3 -34.6529199 -29.5614257
4 -44.7444141 -34.6529199
5 -50.8359082 -44.7444141
6 -43.9274024 -50.8359082
7 7.9811035 -43.9274024
8 25.8896093 7.9811035
9 28.7981152 25.8896093
10 27.7066210 28.7981152
11 11.6151268 27.7066210
12 13.5236327 11.6151268
13 10.4321385 13.5236327
14 9.3406444 10.4321385
15 5.2491502 9.3406444
16 -4.8423440 5.2491502
17 -9.9338381 -4.8423440
18 -7.0253323 -9.9338381
19 45.8831736 -7.0253323
20 54.7916794 45.8831736
21 54.7001853 54.7916794
22 39.6086911 54.7001853
23 23.5171969 39.6086911
24 26.4257028 23.5171969
25 23.3342086 26.4257028
26 21.2427145 23.3342086
27 12.1512203 21.2427145
28 7.0597261 12.1512203
29 6.9682320 7.0597261
30 7.8767378 6.9682320
31 55.7852437 7.8767378
32 62.6937495 55.7852437
33 57.6022553 62.6937495
34 26.5107612 57.6022553
35 5.4192670 26.5107612
36 -2.6722271 5.4192670
37 2.2362787 -2.6722271
38 -8.8552154 2.2362787
39 -24.9467096 -8.8552154
40 -30.0382038 -24.9467096
41 -44.1296979 -30.0382038
42 -55.2211921 -44.1296979
43 1.6873138 -55.2211921
44 12.5958196 1.6873138
45 -9.4956746 12.5958196
46 -23.5871687 -9.4956746
47 -39.6786629 -23.5871687
48 -34.7701570 -39.6786629
49 -30.8616512 -34.7701570
50 -38.9531453 -30.8616512
51 -53.0446395 -38.9531453
52 -45.5000774 -53.0446395
53 -65.5915716 -45.5000774
54 -55.6830657 -65.5915716
55 -4.7745599 -55.6830657
56 2.1339459 -4.7745599
57 -12.9575482 2.1339459
58 -24.0490424 -12.9575482
59 -27.1405365 -24.0490424
60 -12.2320307 -27.1405365
61 0.6764751 -12.2320307
62 6.5849810 0.6764751
63 10.4934868 6.5849810
64 12.4019927 10.4934868
65 0.3104985 12.4019927
66 13.2190043 0.3104985
67 65.1275102 13.2190043
68 76.0360160 65.1275102
69 60.9445219 76.0360160
> 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/73ema1258728872.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/8jpc31258728872.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/9tkor1258728872.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/10ll3j1258728872.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/11bs9r1258728872.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/12bokc1258728872.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/13cg6h1258728873.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/14weht1258728873.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/15ucqp1258728873.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/16mlhu1258728873.tab")
+ }
>
> system("convert tmp/15bww1258728872.ps tmp/15bww1258728872.png")
> system("convert tmp/2xlo71258728872.ps tmp/2xlo71258728872.png")
> system("convert tmp/3ke411258728872.ps tmp/3ke411258728872.png")
> system("convert tmp/4rxsm1258728872.ps tmp/4rxsm1258728872.png")
> system("convert tmp/5p4051258728872.ps tmp/5p4051258728872.png")
> system("convert tmp/67qky1258728872.ps tmp/67qky1258728872.png")
> system("convert tmp/73ema1258728872.ps tmp/73ema1258728872.png")
> system("convert tmp/8jpc31258728872.ps tmp/8jpc31258728872.png")
> system("convert tmp/9tkor1258728872.ps tmp/9tkor1258728872.png")
> system("convert tmp/10ll3j1258728872.ps tmp/10ll3j1258728872.png")
>
>
> proc.time()
user system elapsed
2.610 1.605 3.310