R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-pc-linux-gnu (32-bit)
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,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1,1,1,0,0,0,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,1,0,0,0,0),dim=c(2,86),dimnames=list(c('T40','CorrectAnalysis
'),1:86))
> y <- array(NA,dim=c(2,86),dimnames=list(c('T40','CorrectAnalysis
'),1:86))
> 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 = '2'
> par3 <- 'Linear Trend'
> par2 <- 'Do not include Seasonal Dummies'
> par1 <- '2'
> #'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, 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
CorrectAnalysis\r\r T40 t
1 0 1 1
2 0 0 2
3 0 0 3
4 0 0 4
5 0 0 5
6 0 0 6
7 0 0 7
8 0 1 8
9 0 0 9
10 0 0 10
11 0 1 11
12 0 0 12
13 0 0 13
14 0 1 14
15 0 0 15
16 0 1 16
17 1 1 17
18 0 1 18
19 0 0 19
20 1 1 20
21 0 0 21
22 0 0 22
23 0 0 23
24 0 0 24
25 0 1 25
26 0 0 26
27 0 0 27
28 0 0 28
29 0 0 29
30 0 0 30
31 0 0 31
32 0 0 32
33 0 0 33
34 0 1 34
35 0 0 35
36 0 0 36
37 0 1 37
38 0 0 38
39 0 0 39
40 0 1 40
41 1 0 41
42 0 0 42
43 0 0 43
44 0 1 44
45 0 0 45
46 0 0 46
47 0 0 47
48 0 0 48
49 0 0 49
50 0 0 50
51 0 1 51
52 1 1 52
53 0 0 53
54 1 0 54
55 0 0 55
56 0 1 56
57 0 0 57
58 0 0 58
59 0 0 59
60 1 1 60
61 0 1 61
62 0 0 62
63 0 0 63
64 0 1 64
65 0 0 65
66 0 0 66
67 1 1 67
68 0 0 68
69 0 0 69
70 0 0 70
71 0 0 71
72 0 0 72
73 0 0 73
74 0 0 74
75 0 0 75
76 0 1 76
77 0 0 77
78 0 0 78
79 1 1 79
80 0 1 80
81 0 0 81
82 0 0 82
83 0 0 83
84 1 0 84
85 0 0 85
86 0 0 86
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) T40 t
-0.034733 0.220866 0.001846
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.33384 -0.11343 -0.05481 -0.00450 0.95903
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.034733 0.067781 -0.512 0.60972
T40 0.220866 0.071508 3.089 0.00273 **
t 0.001846 0.001275 1.448 0.15136
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2927 on 83 degrees of freedom
Multiple R-squared: 0.1174, Adjusted R-squared: 0.09612
F-statistic: 5.519 on 2 and 83 DF, p-value: 0.005617
> 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.000000000 0.000000000 1.0000000
[2,] 0.000000000 0.000000000 1.0000000
[3,] 0.000000000 0.000000000 1.0000000
[4,] 0.000000000 0.000000000 1.0000000
[5,] 0.000000000 0.000000000 1.0000000
[6,] 0.000000000 0.000000000 1.0000000
[7,] 0.000000000 0.000000000 1.0000000
[8,] 0.000000000 0.000000000 1.0000000
[9,] 0.000000000 0.000000000 1.0000000
[10,] 0.000000000 0.000000000 1.0000000
[11,] 0.000000000 0.000000000 1.0000000
[12,] 0.110757094 0.221514188 0.8892429
[13,] 0.103475194 0.206950388 0.8965248
[14,] 0.074247661 0.148495322 0.9257523
[15,] 0.375432709 0.750865418 0.6245673
[16,] 0.329793850 0.659587701 0.6702061
[17,] 0.279440654 0.558881308 0.7205593
[18,] 0.229833579 0.459667159 0.7701664
[19,] 0.183980506 0.367961013 0.8160195
[20,] 0.190075360 0.380150719 0.8099246
[21,] 0.146907606 0.293815211 0.8530924
[22,] 0.110796340 0.221592679 0.8892037
[23,] 0.081557015 0.163114031 0.9184430
[24,] 0.058602064 0.117204129 0.9413979
[25,] 0.041108190 0.082216379 0.9588918
[26,] 0.028154769 0.056309537 0.9718452
[27,] 0.018829072 0.037658143 0.9811709
[28,] 0.012297251 0.024594503 0.9877027
[29,] 0.011381589 0.022763179 0.9886184
[30,] 0.007219284 0.014438569 0.9927807
[31,] 0.004475887 0.008951773 0.9955241
[32,] 0.003853317 0.007706634 0.9961467
[33,] 0.002330365 0.004660730 0.9976696
[34,] 0.001380015 0.002760030 0.9986200
[35,] 0.001171478 0.002342956 0.9988285
[36,] 0.090921195 0.181842391 0.9090788
[37,] 0.068561180 0.137122359 0.9314388
[38,] 0.050601765 0.101203530 0.9493982
[39,] 0.048282299 0.096564598 0.9517177
[40,] 0.034707326 0.069414651 0.9652927
[41,] 0.024426278 0.048852556 0.9755737
[42,] 0.016832267 0.033664534 0.9831677
[43,] 0.011360416 0.022720832 0.9886396
[44,] 0.007513307 0.015026614 0.9924867
[45,] 0.004873303 0.009746607 0.9951267
[46,] 0.005133223 0.010266447 0.9948668
[47,] 0.035568189 0.071136379 0.9644318
[48,] 0.025299536 0.050599072 0.9747005
[49,] 0.298968624 0.597937249 0.7010314
[50,] 0.250392405 0.500784811 0.7496076
[51,] 0.257351172 0.514702345 0.7426488
[52,] 0.209767588 0.419535177 0.7902324
[53,] 0.167186181 0.334372362 0.8328138
[54,] 0.130122162 0.260244323 0.8698778
[55,] 0.347297940 0.694595880 0.6527021
[56,] 0.342849309 0.685698618 0.6571507
[57,] 0.284208505 0.568417010 0.7157915
[58,] 0.229931999 0.459863997 0.7700680
[59,] 0.252077454 0.504154907 0.7479225
[60,] 0.198462406 0.396924812 0.8015376
[61,] 0.151724846 0.303449691 0.8482752
[62,] 0.381604728 0.763209456 0.6183953
[63,] 0.313299530 0.626599061 0.6867005
[64,] 0.249420239 0.498840478 0.7505798
[65,] 0.191879927 0.383759854 0.8081201
[66,] 0.142097992 0.284195984 0.8579020
[67,] 0.100867367 0.201734734 0.8991326
[68,] 0.068307644 0.136615288 0.9316924
[69,] 0.043914999 0.087829999 0.9560850
[70,] 0.026708519 0.053417038 0.9732915
[71,] 0.024737674 0.049475348 0.9752623
[72,] 0.013105211 0.026210421 0.9868948
[73,] 0.006537365 0.013074729 0.9934626
[74,] 0.047224028 0.094448056 0.9527760
[75,] 0.023063703 0.046127406 0.9769363
> postscript(file="/var/fisher/rcomp/tmp/13bgf1356024072.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/fisher/rcomp/tmp/2xyi81356024072.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/fisher/rcomp/tmp/3t9c51356024072.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/fisher/rcomp/tmp/45trp1356024072.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/fisher/rcomp/tmp/5yvkw1356024072.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 = 86
Frequency = 1
1 2 3 4 5
-0.1879801580 0.0310399427 0.0291936251 0.0273473076 0.0255009900
6 7 8 9 10
0.0236546724 0.0218083548 -0.2009043811 0.0181157196 0.0162694021
11 12 13 14 15
-0.2064433339 0.0125767669 0.0107304493 -0.2119822866 0.0070378141
16 17 18 19 20
-0.2156749218 0.7824787606 -0.2193675570 -0.0003474562 0.7769398079
21 22 23 24 25
-0.0040400913 -0.0058864089 -0.0077327265 -0.0095790441 -0.2322917800
26 27 28 29 30
-0.0132716793 -0.0151179968 -0.0169643144 -0.0188106320 -0.0206569496
31 32 33 34 35
-0.0225032672 -0.0243495848 -0.0261959023 -0.2489086383 -0.0298885375
36 37 38 39 40
-0.0317348551 -0.2544475910 -0.0354274902 -0.0372738078 -0.2599865438
41 42 43 44 45
0.9590335570 -0.0428127606 -0.0446590782 -0.2673718141 -0.0483517133
46 47 48 49 50
-0.0501980309 -0.0520443485 -0.0538906661 -0.0557369837 -0.0575833012
51 52 53 54 55
-0.2802960372 0.7178576452 -0.0631222540 0.9350314284 -0.0668148892
56 57 58 59 60
-0.2895276251 -0.0705075243 -0.0723538419 -0.0742001595 0.7030871046
61 62 63 64 65
-0.2987592130 -0.0797391122 -0.0815854298 -0.3042981657 -0.0852780650
66 67 68 69 70
-0.0871243826 0.6901628815 -0.0908170177 -0.0926633353 -0.0945096529
71 72 73 74 75
-0.0963559705 -0.0982022881 -0.1000486056 -0.1018949232 -0.1037412408
76 77 78 79 80
-0.3264539767 -0.1074338760 -0.1092801935 0.6680070705 -0.3338392471
81 82 83 84 85
-0.1148191463 -0.1166654639 -0.1185117815 0.8796419010 -0.1222044166
86
-0.1240507342
> postscript(file="/var/fisher/rcomp/tmp/6jsqz1356024072.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 = 86
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.1879801580 NA
1 0.0310399427 -0.1879801580
2 0.0291936251 0.0310399427
3 0.0273473076 0.0291936251
4 0.0255009900 0.0273473076
5 0.0236546724 0.0255009900
6 0.0218083548 0.0236546724
7 -0.2009043811 0.0218083548
8 0.0181157196 -0.2009043811
9 0.0162694021 0.0181157196
10 -0.2064433339 0.0162694021
11 0.0125767669 -0.2064433339
12 0.0107304493 0.0125767669
13 -0.2119822866 0.0107304493
14 0.0070378141 -0.2119822866
15 -0.2156749218 0.0070378141
16 0.7824787606 -0.2156749218
17 -0.2193675570 0.7824787606
18 -0.0003474562 -0.2193675570
19 0.7769398079 -0.0003474562
20 -0.0040400913 0.7769398079
21 -0.0058864089 -0.0040400913
22 -0.0077327265 -0.0058864089
23 -0.0095790441 -0.0077327265
24 -0.2322917800 -0.0095790441
25 -0.0132716793 -0.2322917800
26 -0.0151179968 -0.0132716793
27 -0.0169643144 -0.0151179968
28 -0.0188106320 -0.0169643144
29 -0.0206569496 -0.0188106320
30 -0.0225032672 -0.0206569496
31 -0.0243495848 -0.0225032672
32 -0.0261959023 -0.0243495848
33 -0.2489086383 -0.0261959023
34 -0.0298885375 -0.2489086383
35 -0.0317348551 -0.0298885375
36 -0.2544475910 -0.0317348551
37 -0.0354274902 -0.2544475910
38 -0.0372738078 -0.0354274902
39 -0.2599865438 -0.0372738078
40 0.9590335570 -0.2599865438
41 -0.0428127606 0.9590335570
42 -0.0446590782 -0.0428127606
43 -0.2673718141 -0.0446590782
44 -0.0483517133 -0.2673718141
45 -0.0501980309 -0.0483517133
46 -0.0520443485 -0.0501980309
47 -0.0538906661 -0.0520443485
48 -0.0557369837 -0.0538906661
49 -0.0575833012 -0.0557369837
50 -0.2802960372 -0.0575833012
51 0.7178576452 -0.2802960372
52 -0.0631222540 0.7178576452
53 0.9350314284 -0.0631222540
54 -0.0668148892 0.9350314284
55 -0.2895276251 -0.0668148892
56 -0.0705075243 -0.2895276251
57 -0.0723538419 -0.0705075243
58 -0.0742001595 -0.0723538419
59 0.7030871046 -0.0742001595
60 -0.2987592130 0.7030871046
61 -0.0797391122 -0.2987592130
62 -0.0815854298 -0.0797391122
63 -0.3042981657 -0.0815854298
64 -0.0852780650 -0.3042981657
65 -0.0871243826 -0.0852780650
66 0.6901628815 -0.0871243826
67 -0.0908170177 0.6901628815
68 -0.0926633353 -0.0908170177
69 -0.0945096529 -0.0926633353
70 -0.0963559705 -0.0945096529
71 -0.0982022881 -0.0963559705
72 -0.1000486056 -0.0982022881
73 -0.1018949232 -0.1000486056
74 -0.1037412408 -0.1018949232
75 -0.3264539767 -0.1037412408
76 -0.1074338760 -0.3264539767
77 -0.1092801935 -0.1074338760
78 0.6680070705 -0.1092801935
79 -0.3338392471 0.6680070705
80 -0.1148191463 -0.3338392471
81 -0.1166654639 -0.1148191463
82 -0.1185117815 -0.1166654639
83 0.8796419010 -0.1185117815
84 -0.1222044166 0.8796419010
85 -0.1240507342 -0.1222044166
86 NA -0.1240507342
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.0310399427 -0.1879801580
[2,] 0.0291936251 0.0310399427
[3,] 0.0273473076 0.0291936251
[4,] 0.0255009900 0.0273473076
[5,] 0.0236546724 0.0255009900
[6,] 0.0218083548 0.0236546724
[7,] -0.2009043811 0.0218083548
[8,] 0.0181157196 -0.2009043811
[9,] 0.0162694021 0.0181157196
[10,] -0.2064433339 0.0162694021
[11,] 0.0125767669 -0.2064433339
[12,] 0.0107304493 0.0125767669
[13,] -0.2119822866 0.0107304493
[14,] 0.0070378141 -0.2119822866
[15,] -0.2156749218 0.0070378141
[16,] 0.7824787606 -0.2156749218
[17,] -0.2193675570 0.7824787606
[18,] -0.0003474562 -0.2193675570
[19,] 0.7769398079 -0.0003474562
[20,] -0.0040400913 0.7769398079
[21,] -0.0058864089 -0.0040400913
[22,] -0.0077327265 -0.0058864089
[23,] -0.0095790441 -0.0077327265
[24,] -0.2322917800 -0.0095790441
[25,] -0.0132716793 -0.2322917800
[26,] -0.0151179968 -0.0132716793
[27,] -0.0169643144 -0.0151179968
[28,] -0.0188106320 -0.0169643144
[29,] -0.0206569496 -0.0188106320
[30,] -0.0225032672 -0.0206569496
[31,] -0.0243495848 -0.0225032672
[32,] -0.0261959023 -0.0243495848
[33,] -0.2489086383 -0.0261959023
[34,] -0.0298885375 -0.2489086383
[35,] -0.0317348551 -0.0298885375
[36,] -0.2544475910 -0.0317348551
[37,] -0.0354274902 -0.2544475910
[38,] -0.0372738078 -0.0354274902
[39,] -0.2599865438 -0.0372738078
[40,] 0.9590335570 -0.2599865438
[41,] -0.0428127606 0.9590335570
[42,] -0.0446590782 -0.0428127606
[43,] -0.2673718141 -0.0446590782
[44,] -0.0483517133 -0.2673718141
[45,] -0.0501980309 -0.0483517133
[46,] -0.0520443485 -0.0501980309
[47,] -0.0538906661 -0.0520443485
[48,] -0.0557369837 -0.0538906661
[49,] -0.0575833012 -0.0557369837
[50,] -0.2802960372 -0.0575833012
[51,] 0.7178576452 -0.2802960372
[52,] -0.0631222540 0.7178576452
[53,] 0.9350314284 -0.0631222540
[54,] -0.0668148892 0.9350314284
[55,] -0.2895276251 -0.0668148892
[56,] -0.0705075243 -0.2895276251
[57,] -0.0723538419 -0.0705075243
[58,] -0.0742001595 -0.0723538419
[59,] 0.7030871046 -0.0742001595
[60,] -0.2987592130 0.7030871046
[61,] -0.0797391122 -0.2987592130
[62,] -0.0815854298 -0.0797391122
[63,] -0.3042981657 -0.0815854298
[64,] -0.0852780650 -0.3042981657
[65,] -0.0871243826 -0.0852780650
[66,] 0.6901628815 -0.0871243826
[67,] -0.0908170177 0.6901628815
[68,] -0.0926633353 -0.0908170177
[69,] -0.0945096529 -0.0926633353
[70,] -0.0963559705 -0.0945096529
[71,] -0.0982022881 -0.0963559705
[72,] -0.1000486056 -0.0982022881
[73,] -0.1018949232 -0.1000486056
[74,] -0.1037412408 -0.1018949232
[75,] -0.3264539767 -0.1037412408
[76,] -0.1074338760 -0.3264539767
[77,] -0.1092801935 -0.1074338760
[78,] 0.6680070705 -0.1092801935
[79,] -0.3338392471 0.6680070705
[80,] -0.1148191463 -0.3338392471
[81,] -0.1166654639 -0.1148191463
[82,] -0.1185117815 -0.1166654639
[83,] 0.8796419010 -0.1185117815
[84,] -0.1222044166 0.8796419010
[85,] -0.1240507342 -0.1222044166
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.0310399427 -0.1879801580
2 0.0291936251 0.0310399427
3 0.0273473076 0.0291936251
4 0.0255009900 0.0273473076
5 0.0236546724 0.0255009900
6 0.0218083548 0.0236546724
7 -0.2009043811 0.0218083548
8 0.0181157196 -0.2009043811
9 0.0162694021 0.0181157196
10 -0.2064433339 0.0162694021
11 0.0125767669 -0.2064433339
12 0.0107304493 0.0125767669
13 -0.2119822866 0.0107304493
14 0.0070378141 -0.2119822866
15 -0.2156749218 0.0070378141
16 0.7824787606 -0.2156749218
17 -0.2193675570 0.7824787606
18 -0.0003474562 -0.2193675570
19 0.7769398079 -0.0003474562
20 -0.0040400913 0.7769398079
21 -0.0058864089 -0.0040400913
22 -0.0077327265 -0.0058864089
23 -0.0095790441 -0.0077327265
24 -0.2322917800 -0.0095790441
25 -0.0132716793 -0.2322917800
26 -0.0151179968 -0.0132716793
27 -0.0169643144 -0.0151179968
28 -0.0188106320 -0.0169643144
29 -0.0206569496 -0.0188106320
30 -0.0225032672 -0.0206569496
31 -0.0243495848 -0.0225032672
32 -0.0261959023 -0.0243495848
33 -0.2489086383 -0.0261959023
34 -0.0298885375 -0.2489086383
35 -0.0317348551 -0.0298885375
36 -0.2544475910 -0.0317348551
37 -0.0354274902 -0.2544475910
38 -0.0372738078 -0.0354274902
39 -0.2599865438 -0.0372738078
40 0.9590335570 -0.2599865438
41 -0.0428127606 0.9590335570
42 -0.0446590782 -0.0428127606
43 -0.2673718141 -0.0446590782
44 -0.0483517133 -0.2673718141
45 -0.0501980309 -0.0483517133
46 -0.0520443485 -0.0501980309
47 -0.0538906661 -0.0520443485
48 -0.0557369837 -0.0538906661
49 -0.0575833012 -0.0557369837
50 -0.2802960372 -0.0575833012
51 0.7178576452 -0.2802960372
52 -0.0631222540 0.7178576452
53 0.9350314284 -0.0631222540
54 -0.0668148892 0.9350314284
55 -0.2895276251 -0.0668148892
56 -0.0705075243 -0.2895276251
57 -0.0723538419 -0.0705075243
58 -0.0742001595 -0.0723538419
59 0.7030871046 -0.0742001595
60 -0.2987592130 0.7030871046
61 -0.0797391122 -0.2987592130
62 -0.0815854298 -0.0797391122
63 -0.3042981657 -0.0815854298
64 -0.0852780650 -0.3042981657
65 -0.0871243826 -0.0852780650
66 0.6901628815 -0.0871243826
67 -0.0908170177 0.6901628815
68 -0.0926633353 -0.0908170177
69 -0.0945096529 -0.0926633353
70 -0.0963559705 -0.0945096529
71 -0.0982022881 -0.0963559705
72 -0.1000486056 -0.0982022881
73 -0.1018949232 -0.1000486056
74 -0.1037412408 -0.1018949232
75 -0.3264539767 -0.1037412408
76 -0.1074338760 -0.3264539767
77 -0.1092801935 -0.1074338760
78 0.6680070705 -0.1092801935
79 -0.3338392471 0.6680070705
80 -0.1148191463 -0.3338392471
81 -0.1166654639 -0.1148191463
82 -0.1185117815 -0.1166654639
83 0.8796419010 -0.1185117815
84 -0.1222044166 0.8796419010
85 -0.1240507342 -0.1222044166
> 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/fisher/rcomp/tmp/7xxat1356024072.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/fisher/rcomp/tmp/89ope1356024072.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/fisher/rcomp/tmp/9ba9b1356024072.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/fisher/rcomp/tmp/10hzaq1356024072.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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/fisher/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/fisher/rcomp/tmp/110p9m1356024072.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/fisher/rcomp/tmp/12qpnm1356024072.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/fisher/rcomp/tmp/13qczn1356024072.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/fisher/rcomp/tmp/14b4zf1356024072.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/fisher/rcomp/tmp/15x7li1356024072.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/fisher/rcomp/tmp/16o87o1356024072.tab")
+ }
>
> try(system("convert tmp/13bgf1356024072.ps tmp/13bgf1356024072.png",intern=TRUE))
character(0)
> try(system("convert tmp/2xyi81356024072.ps tmp/2xyi81356024072.png",intern=TRUE))
character(0)
> try(system("convert tmp/3t9c51356024072.ps tmp/3t9c51356024072.png",intern=TRUE))
character(0)
> try(system("convert tmp/45trp1356024072.ps tmp/45trp1356024072.png",intern=TRUE))
character(0)
> try(system("convert tmp/5yvkw1356024072.ps tmp/5yvkw1356024072.png",intern=TRUE))
character(0)
> try(system("convert tmp/6jsqz1356024072.ps tmp/6jsqz1356024072.png",intern=TRUE))
character(0)
> try(system("convert tmp/7xxat1356024072.ps tmp/7xxat1356024072.png",intern=TRUE))
character(0)
> try(system("convert tmp/89ope1356024072.ps tmp/89ope1356024072.png",intern=TRUE))
character(0)
> try(system("convert tmp/9ba9b1356024072.ps tmp/9ba9b1356024072.png",intern=TRUE))
character(0)
> try(system("convert tmp/10hzaq1356024072.ps tmp/10hzaq1356024072.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
7.023 1.866 8.887