R version 2.8.0 (2008-10-20)
Copyright (C) 2008 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(3353,0,3480,0,3098,0,2944,0,3389,0,3497,0,4404,0,3849,0,3734,0,3060,0,3507,0,3287,0,3215,0,3764,0,2734,0,2837,0,2766,0,3851,0,3289,0,3848,0,3348,0,3682,0,4058,0,3655,1,3811,1,3341,1,3032,1,3475,1,3353,1,3186,1,3902,1,4164,1,3499,1,4145,1,3796,1,3711,1,3949,1,3740,1,3243,1,4407,1,4814,1,3908,1,5250,1,3937,1,4004,1,5560,1,3922,1,3759,1,4138,1,4634,1,3996,1,4308,1,4142,1,4429,1,5219,1,4929,1,5754,1,5592,1,4163,1,4962,1,5208,1,4755,1,4491,1,5732,1,5730,1,5024,1,6056,1,4901,1,5353,1,5578,1,4618,1,4724,1,5011,1,5298,1,4143,1,4617,1,4727,1,4207,1,5112,1,4190,1,4098,1,5071,1,4177,1,4598,1,3757,1,5591,1,4218,1,3780,1,4336,1,4870,1,4422,1,4727,1,4459,1),dim=c(2,93),dimnames=list(c('y','d'),1:93))
> y <- array(NA,dim=c(2,93),dimnames=list(c('y','d'),1:93))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '1'
> #'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 d
1 3353 0
2 3480 0
3 3098 0
4 2944 0
5 3389 0
6 3497 0
7 4404 0
8 3849 0
9 3734 0
10 3060 0
11 3507 0
12 3287 0
13 3215 0
14 3764 0
15 2734 0
16 2837 0
17 2766 0
18 3851 0
19 3289 0
20 3848 0
21 3348 0
22 3682 0
23 4058 0
24 3655 1
25 3811 1
26 3341 1
27 3032 1
28 3475 1
29 3353 1
30 3186 1
31 3902 1
32 4164 1
33 3499 1
34 4145 1
35 3796 1
36 3711 1
37 3949 1
38 3740 1
39 3243 1
40 4407 1
41 4814 1
42 3908 1
43 5250 1
44 3937 1
45 4004 1
46 5560 1
47 3922 1
48 3759 1
49 4138 1
50 4634 1
51 3996 1
52 4308 1
53 4142 1
54 4429 1
55 5219 1
56 4929 1
57 5754 1
58 5592 1
59 4163 1
60 4962 1
61 5208 1
62 4755 1
63 4491 1
64 5732 1
65 5730 1
66 5024 1
67 6056 1
68 4901 1
69 5353 1
70 5578 1
71 4618 1
72 4724 1
73 5011 1
74 5298 1
75 4143 1
76 4617 1
77 4727 1
78 4207 1
79 5112 1
80 4190 1
81 4098 1
82 5071 1
83 4177 1
84 4598 1
85 3757 1
86 5591 1
87 4218 1
88 3780 1
89 4336 1
90 4870 1
91 4422 1
92 4727 1
93 4459 1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) d
3435 1014
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1416.69 -490.52 -45.52 416.48 1607.31
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3434.5 136.4 25.173 < 2e-16 ***
d 1014.2 157.3 6.449 5.32e-09 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 654.3 on 91 degrees of freedom
Multiple R-squared: 0.3137, Adjusted R-squared: 0.3061
F-statistic: 41.59 on 1 and 91 DF, p-value: 5.317e-09
> 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.069532054 0.139064107 0.93046795
[2,] 0.031981197 0.063962393 0.96801880
[3,] 0.286992764 0.573985527 0.71300724
[4,] 0.218480529 0.436961058 0.78151947
[5,] 0.145024639 0.290049278 0.85497536
[6,] 0.118887791 0.237775583 0.88111221
[7,] 0.070213178 0.140426357 0.92978682
[8,] 0.042383132 0.084766264 0.95761687
[9,] 0.026220126 0.052440252 0.97377987
[10,] 0.017435412 0.034870824 0.98256459
[11,] 0.027909788 0.055819575 0.97209021
[12,] 0.029445623 0.058891247 0.97055438
[13,] 0.033643394 0.067286788 0.96635661
[14,] 0.029110104 0.058220208 0.97088990
[15,] 0.018031963 0.036063925 0.98196804
[16,] 0.014972617 0.029945234 0.98502738
[17,] 0.009005916 0.018011833 0.99099408
[18,] 0.005952494 0.011904987 0.99404751
[19,] 0.006723806 0.013447613 0.99327619
[20,] 0.004342540 0.008685081 0.99565746
[21,] 0.002716549 0.005433097 0.99728345
[22,] 0.002425559 0.004851118 0.99757444
[23,] 0.003525109 0.007050217 0.99647489
[24,] 0.002670575 0.005341149 0.99732943
[25,] 0.002285111 0.004570221 0.99771489
[26,] 0.002557396 0.005114792 0.99744260
[27,] 0.002522459 0.005044919 0.99747754
[28,] 0.003263605 0.006527210 0.99673640
[29,] 0.002915506 0.005831012 0.99708449
[30,] 0.003215720 0.006431440 0.99678428
[31,] 0.002616207 0.005232414 0.99738379
[32,] 0.002202014 0.004404028 0.99779799
[33,] 0.001887797 0.003775595 0.99811220
[34,] 0.001637981 0.003275963 0.99836202
[35,] 0.003295243 0.006590486 0.99670476
[36,] 0.005034643 0.010069287 0.99496536
[37,] 0.014731520 0.029463040 0.98526848
[38,] 0.013360763 0.026721527 0.98663924
[39,] 0.064249769 0.128499539 0.93575023
[40,] 0.059248979 0.118497959 0.94075102
[41,] 0.054078965 0.108157930 0.94592104
[42,] 0.217812741 0.435625483 0.78218726
[43,] 0.212157660 0.424315321 0.78784234
[44,] 0.231283730 0.462567461 0.76871627
[45,] 0.216492786 0.432985572 0.78350721
[46,] 0.211092687 0.422185374 0.78890731
[47,] 0.209360564 0.418721129 0.79063944
[48,] 0.192044015 0.384088030 0.80795598
[49,] 0.183196885 0.366393771 0.81680311
[50,] 0.167507051 0.335014103 0.83249295
[51,] 0.232649639 0.465299277 0.76735036
[52,] 0.239553753 0.479107506 0.76044625
[53,] 0.466799278 0.933598556 0.53320072
[54,] 0.618027791 0.763944417 0.38197221
[55,] 0.598554675 0.802890651 0.40144533
[56,] 0.578838417 0.842323167 0.42116158
[57,] 0.597481986 0.805036028 0.40251801
[58,] 0.550969875 0.898060249 0.44903012
[59,] 0.499458394 0.998916789 0.50054161
[60,] 0.658627535 0.682744930 0.34137246
[61,] 0.792053932 0.415892135 0.20794607
[62,] 0.768758761 0.462482477 0.23124124
[63,] 0.941561687 0.116876626 0.05843831
[64,] 0.925568928 0.148862145 0.07443107
[65,] 0.942240674 0.115518651 0.05775933
[66,] 0.975178201 0.049643598 0.02482180
[67,] 0.962012030 0.075975940 0.03798797
[68,] 0.945235068 0.109529864 0.05476493
[69,] 0.938198145 0.123603710 0.06180185
[70,] 0.957718500 0.084562999 0.04228150
[71,] 0.943561223 0.112877554 0.05643878
[72,] 0.916051612 0.167896775 0.08394839
[73,] 0.884122203 0.231755595 0.11587780
[74,] 0.845033209 0.309933582 0.15496679
[75,] 0.852497749 0.295004503 0.14750225
[76,] 0.802672314 0.394655371 0.19732769
[77,] 0.757188631 0.485622737 0.24281137
[78,] 0.752491642 0.495016717 0.24750836
[79,] 0.678161778 0.643676444 0.32183822
[80,] 0.572931404 0.854137192 0.42706860
[81,] 0.613562216 0.772875568 0.38643778
[82,] 0.892653561 0.214692878 0.10734644
[83,] 0.810471727 0.379056545 0.18952827
[84,] 0.928979830 0.142040340 0.07102017
> postscript(file="/var/www/html/rcomp/tmp/1v0w81227203408.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/2nz8p1227203408.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/36do61227203408.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/44cgn1227203408.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/527se1227203408.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 = 93
Frequency = 1
1 2 3 4 5 6
-81.52174 45.47826 -336.52174 -490.52174 -45.52174 62.47826
7 8 9 10 11 12
969.47826 414.47826 299.47826 -374.52174 72.47826 -147.52174
13 14 15 16 17 18
-219.52174 329.47826 -700.52174 -597.52174 -668.52174 416.47826
19 20 21 22 23 24
-145.52174 413.47826 -86.52174 247.47826 623.47826 -793.68571
25 26 27 28 29 30
-637.68571 -1107.68571 -1416.68571 -973.68571 -1095.68571 -1262.68571
31 32 33 34 35 36
-546.68571 -284.68571 -949.68571 -303.68571 -652.68571 -737.68571
37 38 39 40 41 42
-499.68571 -708.68571 -1205.68571 -41.68571 365.31429 -540.68571
43 44 45 46 47 48
801.31429 -511.68571 -444.68571 1111.31429 -526.68571 -689.68571
49 50 51 52 53 54
-310.68571 185.31429 -452.68571 -140.68571 -306.68571 -19.68571
55 56 57 58 59 60
770.31429 480.31429 1305.31429 1143.31429 -285.68571 513.31429
61 62 63 64 65 66
759.31429 306.31429 42.31429 1283.31429 1281.31429 575.31429
67 68 69 70 71 72
1607.31429 452.31429 904.31429 1129.31429 169.31429 275.31429
73 74 75 76 77 78
562.31429 849.31429 -305.68571 168.31429 278.31429 -241.68571
79 80 81 82 83 84
663.31429 -258.68571 -350.68571 622.31429 -271.68571 149.31429
85 86 87 88 89 90
-691.68571 1142.31429 -230.68571 -668.68571 -112.68571 421.31429
91 92 93
-26.68571 278.31429 10.31429
> postscript(file="/var/www/html/rcomp/tmp/62hyc1227203408.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 = 93
Frequency = 1
lag(myerror, k = 1) myerror
0 -81.52174 NA
1 45.47826 -81.52174
2 -336.52174 45.47826
3 -490.52174 -336.52174
4 -45.52174 -490.52174
5 62.47826 -45.52174
6 969.47826 62.47826
7 414.47826 969.47826
8 299.47826 414.47826
9 -374.52174 299.47826
10 72.47826 -374.52174
11 -147.52174 72.47826
12 -219.52174 -147.52174
13 329.47826 -219.52174
14 -700.52174 329.47826
15 -597.52174 -700.52174
16 -668.52174 -597.52174
17 416.47826 -668.52174
18 -145.52174 416.47826
19 413.47826 -145.52174
20 -86.52174 413.47826
21 247.47826 -86.52174
22 623.47826 247.47826
23 -793.68571 623.47826
24 -637.68571 -793.68571
25 -1107.68571 -637.68571
26 -1416.68571 -1107.68571
27 -973.68571 -1416.68571
28 -1095.68571 -973.68571
29 -1262.68571 -1095.68571
30 -546.68571 -1262.68571
31 -284.68571 -546.68571
32 -949.68571 -284.68571
33 -303.68571 -949.68571
34 -652.68571 -303.68571
35 -737.68571 -652.68571
36 -499.68571 -737.68571
37 -708.68571 -499.68571
38 -1205.68571 -708.68571
39 -41.68571 -1205.68571
40 365.31429 -41.68571
41 -540.68571 365.31429
42 801.31429 -540.68571
43 -511.68571 801.31429
44 -444.68571 -511.68571
45 1111.31429 -444.68571
46 -526.68571 1111.31429
47 -689.68571 -526.68571
48 -310.68571 -689.68571
49 185.31429 -310.68571
50 -452.68571 185.31429
51 -140.68571 -452.68571
52 -306.68571 -140.68571
53 -19.68571 -306.68571
54 770.31429 -19.68571
55 480.31429 770.31429
56 1305.31429 480.31429
57 1143.31429 1305.31429
58 -285.68571 1143.31429
59 513.31429 -285.68571
60 759.31429 513.31429
61 306.31429 759.31429
62 42.31429 306.31429
63 1283.31429 42.31429
64 1281.31429 1283.31429
65 575.31429 1281.31429
66 1607.31429 575.31429
67 452.31429 1607.31429
68 904.31429 452.31429
69 1129.31429 904.31429
70 169.31429 1129.31429
71 275.31429 169.31429
72 562.31429 275.31429
73 849.31429 562.31429
74 -305.68571 849.31429
75 168.31429 -305.68571
76 278.31429 168.31429
77 -241.68571 278.31429
78 663.31429 -241.68571
79 -258.68571 663.31429
80 -350.68571 -258.68571
81 622.31429 -350.68571
82 -271.68571 622.31429
83 149.31429 -271.68571
84 -691.68571 149.31429
85 1142.31429 -691.68571
86 -230.68571 1142.31429
87 -668.68571 -230.68571
88 -112.68571 -668.68571
89 421.31429 -112.68571
90 -26.68571 421.31429
91 278.31429 -26.68571
92 10.31429 278.31429
93 NA 10.31429
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 45.47826 -81.52174
[2,] -336.52174 45.47826
[3,] -490.52174 -336.52174
[4,] -45.52174 -490.52174
[5,] 62.47826 -45.52174
[6,] 969.47826 62.47826
[7,] 414.47826 969.47826
[8,] 299.47826 414.47826
[9,] -374.52174 299.47826
[10,] 72.47826 -374.52174
[11,] -147.52174 72.47826
[12,] -219.52174 -147.52174
[13,] 329.47826 -219.52174
[14,] -700.52174 329.47826
[15,] -597.52174 -700.52174
[16,] -668.52174 -597.52174
[17,] 416.47826 -668.52174
[18,] -145.52174 416.47826
[19,] 413.47826 -145.52174
[20,] -86.52174 413.47826
[21,] 247.47826 -86.52174
[22,] 623.47826 247.47826
[23,] -793.68571 623.47826
[24,] -637.68571 -793.68571
[25,] -1107.68571 -637.68571
[26,] -1416.68571 -1107.68571
[27,] -973.68571 -1416.68571
[28,] -1095.68571 -973.68571
[29,] -1262.68571 -1095.68571
[30,] -546.68571 -1262.68571
[31,] -284.68571 -546.68571
[32,] -949.68571 -284.68571
[33,] -303.68571 -949.68571
[34,] -652.68571 -303.68571
[35,] -737.68571 -652.68571
[36,] -499.68571 -737.68571
[37,] -708.68571 -499.68571
[38,] -1205.68571 -708.68571
[39,] -41.68571 -1205.68571
[40,] 365.31429 -41.68571
[41,] -540.68571 365.31429
[42,] 801.31429 -540.68571
[43,] -511.68571 801.31429
[44,] -444.68571 -511.68571
[45,] 1111.31429 -444.68571
[46,] -526.68571 1111.31429
[47,] -689.68571 -526.68571
[48,] -310.68571 -689.68571
[49,] 185.31429 -310.68571
[50,] -452.68571 185.31429
[51,] -140.68571 -452.68571
[52,] -306.68571 -140.68571
[53,] -19.68571 -306.68571
[54,] 770.31429 -19.68571
[55,] 480.31429 770.31429
[56,] 1305.31429 480.31429
[57,] 1143.31429 1305.31429
[58,] -285.68571 1143.31429
[59,] 513.31429 -285.68571
[60,] 759.31429 513.31429
[61,] 306.31429 759.31429
[62,] 42.31429 306.31429
[63,] 1283.31429 42.31429
[64,] 1281.31429 1283.31429
[65,] 575.31429 1281.31429
[66,] 1607.31429 575.31429
[67,] 452.31429 1607.31429
[68,] 904.31429 452.31429
[69,] 1129.31429 904.31429
[70,] 169.31429 1129.31429
[71,] 275.31429 169.31429
[72,] 562.31429 275.31429
[73,] 849.31429 562.31429
[74,] -305.68571 849.31429
[75,] 168.31429 -305.68571
[76,] 278.31429 168.31429
[77,] -241.68571 278.31429
[78,] 663.31429 -241.68571
[79,] -258.68571 663.31429
[80,] -350.68571 -258.68571
[81,] 622.31429 -350.68571
[82,] -271.68571 622.31429
[83,] 149.31429 -271.68571
[84,] -691.68571 149.31429
[85,] 1142.31429 -691.68571
[86,] -230.68571 1142.31429
[87,] -668.68571 -230.68571
[88,] -112.68571 -668.68571
[89,] 421.31429 -112.68571
[90,] -26.68571 421.31429
[91,] 278.31429 -26.68571
[92,] 10.31429 278.31429
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 45.47826 -81.52174
2 -336.52174 45.47826
3 -490.52174 -336.52174
4 -45.52174 -490.52174
5 62.47826 -45.52174
6 969.47826 62.47826
7 414.47826 969.47826
8 299.47826 414.47826
9 -374.52174 299.47826
10 72.47826 -374.52174
11 -147.52174 72.47826
12 -219.52174 -147.52174
13 329.47826 -219.52174
14 -700.52174 329.47826
15 -597.52174 -700.52174
16 -668.52174 -597.52174
17 416.47826 -668.52174
18 -145.52174 416.47826
19 413.47826 -145.52174
20 -86.52174 413.47826
21 247.47826 -86.52174
22 623.47826 247.47826
23 -793.68571 623.47826
24 -637.68571 -793.68571
25 -1107.68571 -637.68571
26 -1416.68571 -1107.68571
27 -973.68571 -1416.68571
28 -1095.68571 -973.68571
29 -1262.68571 -1095.68571
30 -546.68571 -1262.68571
31 -284.68571 -546.68571
32 -949.68571 -284.68571
33 -303.68571 -949.68571
34 -652.68571 -303.68571
35 -737.68571 -652.68571
36 -499.68571 -737.68571
37 -708.68571 -499.68571
38 -1205.68571 -708.68571
39 -41.68571 -1205.68571
40 365.31429 -41.68571
41 -540.68571 365.31429
42 801.31429 -540.68571
43 -511.68571 801.31429
44 -444.68571 -511.68571
45 1111.31429 -444.68571
46 -526.68571 1111.31429
47 -689.68571 -526.68571
48 -310.68571 -689.68571
49 185.31429 -310.68571
50 -452.68571 185.31429
51 -140.68571 -452.68571
52 -306.68571 -140.68571
53 -19.68571 -306.68571
54 770.31429 -19.68571
55 480.31429 770.31429
56 1305.31429 480.31429
57 1143.31429 1305.31429
58 -285.68571 1143.31429
59 513.31429 -285.68571
60 759.31429 513.31429
61 306.31429 759.31429
62 42.31429 306.31429
63 1283.31429 42.31429
64 1281.31429 1283.31429
65 575.31429 1281.31429
66 1607.31429 575.31429
67 452.31429 1607.31429
68 904.31429 452.31429
69 1129.31429 904.31429
70 169.31429 1129.31429
71 275.31429 169.31429
72 562.31429 275.31429
73 849.31429 562.31429
74 -305.68571 849.31429
75 168.31429 -305.68571
76 278.31429 168.31429
77 -241.68571 278.31429
78 663.31429 -241.68571
79 -258.68571 663.31429
80 -350.68571 -258.68571
81 622.31429 -350.68571
82 -271.68571 622.31429
83 149.31429 -271.68571
84 -691.68571 149.31429
85 1142.31429 -691.68571
86 -230.68571 1142.31429
87 -668.68571 -230.68571
88 -112.68571 -668.68571
89 421.31429 -112.68571
90 -26.68571 421.31429
91 278.31429 -26.68571
92 10.31429 278.31429
> 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/7cri31227203408.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/805ve1227203408.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/9b0df1227203408.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/10i28s1227203408.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/11vxcl1227203408.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/12oifz1227203408.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/130nds1227203408.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/14enbz1227203408.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/15eo1h1227203409.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/16f3xc1227203409.tab")
+ }
>
> system("convert tmp/1v0w81227203408.ps tmp/1v0w81227203408.png")
> system("convert tmp/2nz8p1227203408.ps tmp/2nz8p1227203408.png")
> system("convert tmp/36do61227203408.ps tmp/36do61227203408.png")
> system("convert tmp/44cgn1227203408.ps tmp/44cgn1227203408.png")
> system("convert tmp/527se1227203408.ps tmp/527se1227203408.png")
> system("convert tmp/62hyc1227203408.ps tmp/62hyc1227203408.png")
> system("convert tmp/7cri31227203408.ps tmp/7cri31227203408.png")
> system("convert tmp/805ve1227203408.ps tmp/805ve1227203408.png")
> system("convert tmp/9b0df1227203408.ps tmp/9b0df1227203408.png")
> system("convert tmp/10i28s1227203408.ps tmp/10i28s1227203408.png")
>
>
> proc.time()
user system elapsed
2.985 1.659 3.661