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(1.79,194.9,1.95,195.5,2.26,196,2.04,196.2,2.16,196.2,2.75,196.2,2.79,196.2,2.88,197,3.36,197.7,2.97,198,3.1,198.2,2.49,198.5,2.2,198.6,2.25,199.5,2.09,200,2.79,201.3,3.14,202.2,2.93,202.9,2.65,203.5,2.67,203.5,2.26,204,2.35,204.1,2.13,204.3,2.18,204.5,2.9,204.8,2.63,205.1,2.67,205.7,1.81,206.5,1.33,206.9,0.88,207.1,1.28,207.8,1.26,208,1.26,208.5,1.29,208.6,1.1,209,1.37,209.1,1.21,209.7,1.74,209.8,1.76,209.9,1.48,210,1.04,210.8,1.62,211.4,1.49,211.7,1.79,212,1.8,212.2,1.58,212.4,1.86,212.9,1.74,213.4,1.59,213.7,1.26,214,1.13,214.3,1.92,214.8,2.61,215,2.26,215.9,2.41,216.4,2.26,216.9,2.03,217.2,2.86,217.5,2.55,217.9,2.27,218.1,2.26,218.6,2.57,218.9,3.07,219.3,2.76,220.4,2.51,220.9,2.87,221,3.14,221.8,3.11,222,3.16,222.2,2.47,222.5,2.57,222.9,2.89,223.1),dim=c(2,72),dimnames=list(c('Xt','Yt'),1:72))
> y <- array(NA,dim=c(2,72),dimnames=list(c('Xt','Yt'),1:72))
> 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
Xt Yt
1 1.79 194.9
2 1.95 195.5
3 2.26 196.0
4 2.04 196.2
5 2.16 196.2
6 2.75 196.2
7 2.79 196.2
8 2.88 197.0
9 3.36 197.7
10 2.97 198.0
11 3.10 198.2
12 2.49 198.5
13 2.20 198.6
14 2.25 199.5
15 2.09 200.0
16 2.79 201.3
17 3.14 202.2
18 2.93 202.9
19 2.65 203.5
20 2.67 203.5
21 2.26 204.0
22 2.35 204.1
23 2.13 204.3
24 2.18 204.5
25 2.90 204.8
26 2.63 205.1
27 2.67 205.7
28 1.81 206.5
29 1.33 206.9
30 0.88 207.1
31 1.28 207.8
32 1.26 208.0
33 1.26 208.5
34 1.29 208.6
35 1.10 209.0
36 1.37 209.1
37 1.21 209.7
38 1.74 209.8
39 1.76 209.9
40 1.48 210.0
41 1.04 210.8
42 1.62 211.4
43 1.49 211.7
44 1.79 212.0
45 1.80 212.2
46 1.58 212.4
47 1.86 212.9
48 1.74 213.4
49 1.59 213.7
50 1.26 214.0
51 1.13 214.3
52 1.92 214.8
53 2.61 215.0
54 2.26 215.9
55 2.41 216.4
56 2.26 216.9
57 2.03 217.2
58 2.86 217.5
59 2.55 217.9
60 2.27 218.1
61 2.26 218.6
62 2.57 218.9
63 3.07 219.3
64 2.76 220.4
65 2.51 220.9
66 2.87 221.0
67 3.14 221.8
68 3.11 222.0
69 3.16 222.2
70 2.47 222.5
71 2.57 222.9
72 2.89 223.1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Yt
2.012803 0.000842
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.30718 -0.45021 0.06499 0.50480 1.18074
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.012803 1.908997 1.054 0.295
Yt 0.000842 0.009121 0.092 0.927
Residual standard error: 0.6416 on 70 degrees of freedom
Multiple R-squared: 0.0001217, Adjusted R-squared: -0.01416
F-statistic: 0.008522 on 1 and 70 DF, p-value: 0.9267
> 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.006891756 0.0137835126 0.9931082437
[2,] 0.045648249 0.0912964974 0.9543517513
[3,] 0.044766741 0.0895334815 0.9552332593
[4,] 0.018625927 0.0372518543 0.9813740728
[5,] 0.008713841 0.0174276825 0.9912861588
[6,] 0.008921157 0.0178423140 0.9910788430
[7,] 0.005630786 0.0112615711 0.9943692144
[8,] 0.027129295 0.0542585900 0.9728707050
[9,] 0.072044465 0.1440889310 0.9279555345
[10,] 0.103617709 0.2072354186 0.8963822907
[11,] 0.125407078 0.2508141557 0.8745929222
[12,] 0.099897976 0.1997959521 0.9001020240
[13,] 0.105369263 0.2107385267 0.8946307366
[14,] 0.102100330 0.2042006594 0.8978996703
[15,] 0.104889388 0.2097787759 0.8951106120
[16,] 0.110323018 0.2206460351 0.8896769825
[17,] 0.138202211 0.2764044213 0.8617977894
[18,] 0.152354301 0.3047086026 0.8476456987
[19,] 0.179577876 0.3591557518 0.8204221241
[20,] 0.200068045 0.4001360896 0.7999319552
[21,] 0.392990125 0.7859802508 0.6070098746
[22,] 0.627120286 0.7457594276 0.3728797138
[23,] 0.933171941 0.1336561174 0.0668280587
[24,] 0.984162966 0.0316740682 0.0158370341
[25,] 0.996679819 0.0066403628 0.0033201814
[26,] 0.999612680 0.0007746407 0.0003873204
[27,] 0.999705206 0.0005895881 0.0002947940
[28,] 0.999711831 0.0005763382 0.0002881691
[29,] 0.999647001 0.0007059977 0.0003529988
[30,] 0.999508095 0.0009838092 0.0004919046
[31,] 0.999420859 0.0011582815 0.0005791408
[32,] 0.999037814 0.0019243712 0.0009621856
[33,] 0.998562654 0.0028746912 0.0014373456
[34,] 0.998227192 0.0035456151 0.0017728075
[35,] 0.998060839 0.0038783212 0.0019391606
[36,] 0.996852077 0.0062958453 0.0031479226
[37,] 0.996826463 0.0063470743 0.0031735371
[38,] 0.994776920 0.0104461602 0.0052230801
[39,] 0.991392629 0.0172147417 0.0086073709
[40,] 0.988069433 0.0238611340 0.0119305670
[41,] 0.983694882 0.0326102352 0.0163051176
[42,] 0.974597159 0.0508056824 0.0254028412
[43,] 0.966730052 0.0665398961 0.0332699481
[44,] 0.952012187 0.0959756259 0.0479878129
[45,] 0.934080933 0.1318381349 0.0659190674
[46,] 0.952653454 0.0946930919 0.0473465460
[47,] 0.993520104 0.0129597916 0.0064798958
[48,] 0.993398002 0.0132039961 0.0066019981
[49,] 0.996277569 0.0074448624 0.0037224312
[50,] 0.994663023 0.0106739544 0.0053369772
[51,] 0.992821083 0.0143578335 0.0071789168
[52,] 0.989394526 0.0212109483 0.0106054741
[53,] 0.991401095 0.0171978093 0.0085989046
[54,] 0.993484770 0.0130304610 0.0065152305
[55,] 0.989084541 0.0218309183 0.0109154592
[56,] 0.984488369 0.0310232627 0.0155116314
[57,] 0.987048361 0.0259032788 0.0129516394
[58,] 0.983532410 0.0329351797 0.0164675898
[59,] 0.975252748 0.0494945034 0.0247472517
[60,] 0.951299916 0.0974001687 0.0487000844
[61,] 0.956903954 0.0861920913 0.0430960457
[62,] 0.947039232 0.1059215350 0.0529607675
[63,] 0.873548719 0.2529025624 0.1264512812
> postscript(file="/var/www/html/rcomp/tmp/1g9po1291415732.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/2g9po1291415732.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/3g9po1291415732.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/49i791291415732.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/59i791291415732.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 72
Frequency = 1
1 2 3 4 5 6
-0.386904743 -0.227409929 0.082169082 -0.137999314 -0.017999314 0.572000686
7 8 9 10 11 12
0.612000686 0.701327104 1.180737720 0.790485127 0.920316731 0.310064138
13 14 15 16 17 18
0.019979940 0.069222161 -0.091198828 0.607706601 0.956948822 0.746359437
19 20 21 22 23 24
0.465854251 0.485854251 0.075433262 0.165349064 -0.054819331 -0.004987727
25 26 27 28 29 30
0.714759680 0.444507087 0.484001900 -0.376671682 -0.857008473 -1.307176868
31 32 33 34 35 36
-0.907766252 -0.927934648 -0.928355636 -0.898439834 -1.088776625 -0.818860823
37 38 39 40 41 42
-0.979366009 -0.449450207 -0.429534405 -0.709618603 -1.150292185 -0.570797371
43 44 45 46 47 48
-0.701049964 -0.401302558 -0.391470953 -0.611639349 -0.332060337 -0.452481326
49 50 51 52 53 54
-0.602733919 -0.932986513 -1.063239106 -0.273660095 0.416171510 0.065413730
55 56 57 58 59 60
0.214992742 0.064571753 -0.165680840 0.664066566 0.353729775 0.073561380
61 62 63 64 65 66
0.063140391 0.372887798 0.872551007 0.561624832 0.311203843 0.671119645
67 68 69 70 71 72
0.940446063 0.910277668 0.960109272 0.269856679 0.369519888 0.689351493
> postscript(file="/var/www/html/rcomp/tmp/69i791291415732.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 72
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.386904743 NA
1 -0.227409929 -0.386904743
2 0.082169082 -0.227409929
3 -0.137999314 0.082169082
4 -0.017999314 -0.137999314
5 0.572000686 -0.017999314
6 0.612000686 0.572000686
7 0.701327104 0.612000686
8 1.180737720 0.701327104
9 0.790485127 1.180737720
10 0.920316731 0.790485127
11 0.310064138 0.920316731
12 0.019979940 0.310064138
13 0.069222161 0.019979940
14 -0.091198828 0.069222161
15 0.607706601 -0.091198828
16 0.956948822 0.607706601
17 0.746359437 0.956948822
18 0.465854251 0.746359437
19 0.485854251 0.465854251
20 0.075433262 0.485854251
21 0.165349064 0.075433262
22 -0.054819331 0.165349064
23 -0.004987727 -0.054819331
24 0.714759680 -0.004987727
25 0.444507087 0.714759680
26 0.484001900 0.444507087
27 -0.376671682 0.484001900
28 -0.857008473 -0.376671682
29 -1.307176868 -0.857008473
30 -0.907766252 -1.307176868
31 -0.927934648 -0.907766252
32 -0.928355636 -0.927934648
33 -0.898439834 -0.928355636
34 -1.088776625 -0.898439834
35 -0.818860823 -1.088776625
36 -0.979366009 -0.818860823
37 -0.449450207 -0.979366009
38 -0.429534405 -0.449450207
39 -0.709618603 -0.429534405
40 -1.150292185 -0.709618603
41 -0.570797371 -1.150292185
42 -0.701049964 -0.570797371
43 -0.401302558 -0.701049964
44 -0.391470953 -0.401302558
45 -0.611639349 -0.391470953
46 -0.332060337 -0.611639349
47 -0.452481326 -0.332060337
48 -0.602733919 -0.452481326
49 -0.932986513 -0.602733919
50 -1.063239106 -0.932986513
51 -0.273660095 -1.063239106
52 0.416171510 -0.273660095
53 0.065413730 0.416171510
54 0.214992742 0.065413730
55 0.064571753 0.214992742
56 -0.165680840 0.064571753
57 0.664066566 -0.165680840
58 0.353729775 0.664066566
59 0.073561380 0.353729775
60 0.063140391 0.073561380
61 0.372887798 0.063140391
62 0.872551007 0.372887798
63 0.561624832 0.872551007
64 0.311203843 0.561624832
65 0.671119645 0.311203843
66 0.940446063 0.671119645
67 0.910277668 0.940446063
68 0.960109272 0.910277668
69 0.269856679 0.960109272
70 0.369519888 0.269856679
71 0.689351493 0.369519888
72 NA 0.689351493
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.227409929 -0.386904743
[2,] 0.082169082 -0.227409929
[3,] -0.137999314 0.082169082
[4,] -0.017999314 -0.137999314
[5,] 0.572000686 -0.017999314
[6,] 0.612000686 0.572000686
[7,] 0.701327104 0.612000686
[8,] 1.180737720 0.701327104
[9,] 0.790485127 1.180737720
[10,] 0.920316731 0.790485127
[11,] 0.310064138 0.920316731
[12,] 0.019979940 0.310064138
[13,] 0.069222161 0.019979940
[14,] -0.091198828 0.069222161
[15,] 0.607706601 -0.091198828
[16,] 0.956948822 0.607706601
[17,] 0.746359437 0.956948822
[18,] 0.465854251 0.746359437
[19,] 0.485854251 0.465854251
[20,] 0.075433262 0.485854251
[21,] 0.165349064 0.075433262
[22,] -0.054819331 0.165349064
[23,] -0.004987727 -0.054819331
[24,] 0.714759680 -0.004987727
[25,] 0.444507087 0.714759680
[26,] 0.484001900 0.444507087
[27,] -0.376671682 0.484001900
[28,] -0.857008473 -0.376671682
[29,] -1.307176868 -0.857008473
[30,] -0.907766252 -1.307176868
[31,] -0.927934648 -0.907766252
[32,] -0.928355636 -0.927934648
[33,] -0.898439834 -0.928355636
[34,] -1.088776625 -0.898439834
[35,] -0.818860823 -1.088776625
[36,] -0.979366009 -0.818860823
[37,] -0.449450207 -0.979366009
[38,] -0.429534405 -0.449450207
[39,] -0.709618603 -0.429534405
[40,] -1.150292185 -0.709618603
[41,] -0.570797371 -1.150292185
[42,] -0.701049964 -0.570797371
[43,] -0.401302558 -0.701049964
[44,] -0.391470953 -0.401302558
[45,] -0.611639349 -0.391470953
[46,] -0.332060337 -0.611639349
[47,] -0.452481326 -0.332060337
[48,] -0.602733919 -0.452481326
[49,] -0.932986513 -0.602733919
[50,] -1.063239106 -0.932986513
[51,] -0.273660095 -1.063239106
[52,] 0.416171510 -0.273660095
[53,] 0.065413730 0.416171510
[54,] 0.214992742 0.065413730
[55,] 0.064571753 0.214992742
[56,] -0.165680840 0.064571753
[57,] 0.664066566 -0.165680840
[58,] 0.353729775 0.664066566
[59,] 0.073561380 0.353729775
[60,] 0.063140391 0.073561380
[61,] 0.372887798 0.063140391
[62,] 0.872551007 0.372887798
[63,] 0.561624832 0.872551007
[64,] 0.311203843 0.561624832
[65,] 0.671119645 0.311203843
[66,] 0.940446063 0.671119645
[67,] 0.910277668 0.940446063
[68,] 0.960109272 0.910277668
[69,] 0.269856679 0.960109272
[70,] 0.369519888 0.269856679
[71,] 0.689351493 0.369519888
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.227409929 -0.386904743
2 0.082169082 -0.227409929
3 -0.137999314 0.082169082
4 -0.017999314 -0.137999314
5 0.572000686 -0.017999314
6 0.612000686 0.572000686
7 0.701327104 0.612000686
8 1.180737720 0.701327104
9 0.790485127 1.180737720
10 0.920316731 0.790485127
11 0.310064138 0.920316731
12 0.019979940 0.310064138
13 0.069222161 0.019979940
14 -0.091198828 0.069222161
15 0.607706601 -0.091198828
16 0.956948822 0.607706601
17 0.746359437 0.956948822
18 0.465854251 0.746359437
19 0.485854251 0.465854251
20 0.075433262 0.485854251
21 0.165349064 0.075433262
22 -0.054819331 0.165349064
23 -0.004987727 -0.054819331
24 0.714759680 -0.004987727
25 0.444507087 0.714759680
26 0.484001900 0.444507087
27 -0.376671682 0.484001900
28 -0.857008473 -0.376671682
29 -1.307176868 -0.857008473
30 -0.907766252 -1.307176868
31 -0.927934648 -0.907766252
32 -0.928355636 -0.927934648
33 -0.898439834 -0.928355636
34 -1.088776625 -0.898439834
35 -0.818860823 -1.088776625
36 -0.979366009 -0.818860823
37 -0.449450207 -0.979366009
38 -0.429534405 -0.449450207
39 -0.709618603 -0.429534405
40 -1.150292185 -0.709618603
41 -0.570797371 -1.150292185
42 -0.701049964 -0.570797371
43 -0.401302558 -0.701049964
44 -0.391470953 -0.401302558
45 -0.611639349 -0.391470953
46 -0.332060337 -0.611639349
47 -0.452481326 -0.332060337
48 -0.602733919 -0.452481326
49 -0.932986513 -0.602733919
50 -1.063239106 -0.932986513
51 -0.273660095 -1.063239106
52 0.416171510 -0.273660095
53 0.065413730 0.416171510
54 0.214992742 0.065413730
55 0.064571753 0.214992742
56 -0.165680840 0.064571753
57 0.664066566 -0.165680840
58 0.353729775 0.664066566
59 0.073561380 0.353729775
60 0.063140391 0.073561380
61 0.372887798 0.063140391
62 0.872551007 0.372887798
63 0.561624832 0.872551007
64 0.311203843 0.561624832
65 0.671119645 0.311203843
66 0.940446063 0.671119645
67 0.910277668 0.940446063
68 0.960109272 0.910277668
69 0.269856679 0.960109272
70 0.369519888 0.269856679
71 0.689351493 0.369519888
> 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/71aou1291415732.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/8cj5x1291415732.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/9cj5x1291415732.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/www/html/rcomp/tmp/10ns4i1291415732.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/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/118bl61291415732.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/12bb1c1291415732.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/137lhk1291415732.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/14t4yr1291415732.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/15w4wx1291415732.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/16indk1291415732.tab")
+ }
>
> try(system("convert tmp/1g9po1291415732.ps tmp/1g9po1291415732.png",intern=TRUE))
character(0)
> try(system("convert tmp/2g9po1291415732.ps tmp/2g9po1291415732.png",intern=TRUE))
character(0)
> try(system("convert tmp/3g9po1291415732.ps tmp/3g9po1291415732.png",intern=TRUE))
character(0)
> try(system("convert tmp/49i791291415732.ps tmp/49i791291415732.png",intern=TRUE))
character(0)
> try(system("convert tmp/59i791291415732.ps tmp/59i791291415732.png",intern=TRUE))
character(0)
> try(system("convert tmp/69i791291415732.ps tmp/69i791291415732.png",intern=TRUE))
character(0)
> try(system("convert tmp/71aou1291415732.ps tmp/71aou1291415732.png",intern=TRUE))
character(0)
> try(system("convert tmp/8cj5x1291415732.ps tmp/8cj5x1291415732.png",intern=TRUE))
character(0)
> try(system("convert tmp/9cj5x1291415732.ps tmp/9cj5x1291415732.png",intern=TRUE))
character(0)
> try(system("convert tmp/10ns4i1291415732.ps tmp/10ns4i1291415732.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.605 1.579 6.109