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(104.3,0,119.8,0,116.8,0,118.2,0,107.4,0,110.8,0,94.8,0,96.5,0,113.4,0,109.8,0,118.7,0,117.2,0,110.3,0,111.6,0,128.1,0,121.3,0,107.3,0,120.5,0,98.5,0,97.7,0,113.2,0,114.6,0,118.3,0,123.9,0,113.6,0,117.5,0,130.1,0,124.7,0,114.2,0,127.3,0,105.9,0,101.5,0,120.2,0,117.1,0,131.1,0,130,0,120.6,0,123.1,0,135.3,0,134.1,0,123.7,0,134.6,0,108.3,1,110.4,1,127.8,1,126.6,1,131.4,1,141.1,1,127,1,127.3,1,143.6,1,149.4,1,126.6,1,136.5,1,116,1,118,1,131.4,1,140.7,1,144.9,1,143.9,1,127.1,1),dim=c(2,61),dimnames=list(c('x','y'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('x','y'),1:61))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'Linear Trend'
> par2 = 'Include Monthly Dummies'
> par1 = '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
x y M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 104.3 0 1 0 0 0 0 0 0 0 0 0 0 1
2 119.8 0 0 1 0 0 0 0 0 0 0 0 0 2
3 116.8 0 0 0 1 0 0 0 0 0 0 0 0 3
4 118.2 0 0 0 0 1 0 0 0 0 0 0 0 4
5 107.4 0 0 0 0 0 1 0 0 0 0 0 0 5
6 110.8 0 0 0 0 0 0 1 0 0 0 0 0 6
7 94.8 0 0 0 0 0 0 0 1 0 0 0 0 7
8 96.5 0 0 0 0 0 0 0 0 1 0 0 0 8
9 113.4 0 0 0 0 0 0 0 0 0 1 0 0 9
10 109.8 0 0 0 0 0 0 0 0 0 0 1 0 10
11 118.7 0 0 0 0 0 0 0 0 0 0 0 1 11
12 117.2 0 0 0 0 0 0 0 0 0 0 0 0 12
13 110.3 0 1 0 0 0 0 0 0 0 0 0 0 13
14 111.6 0 0 1 0 0 0 0 0 0 0 0 0 14
15 128.1 0 0 0 1 0 0 0 0 0 0 0 0 15
16 121.3 0 0 0 0 1 0 0 0 0 0 0 0 16
17 107.3 0 0 0 0 0 1 0 0 0 0 0 0 17
18 120.5 0 0 0 0 0 0 1 0 0 0 0 0 18
19 98.5 0 0 0 0 0 0 0 1 0 0 0 0 19
20 97.7 0 0 0 0 0 0 0 0 1 0 0 0 20
21 113.2 0 0 0 0 0 0 0 0 0 1 0 0 21
22 114.6 0 0 0 0 0 0 0 0 0 0 1 0 22
23 118.3 0 0 0 0 0 0 0 0 0 0 0 1 23
24 123.9 0 0 0 0 0 0 0 0 0 0 0 0 24
25 113.6 0 1 0 0 0 0 0 0 0 0 0 0 25
26 117.5 0 0 1 0 0 0 0 0 0 0 0 0 26
27 130.1 0 0 0 1 0 0 0 0 0 0 0 0 27
28 124.7 0 0 0 0 1 0 0 0 0 0 0 0 28
29 114.2 0 0 0 0 0 1 0 0 0 0 0 0 29
30 127.3 0 0 0 0 0 0 1 0 0 0 0 0 30
31 105.9 0 0 0 0 0 0 0 1 0 0 0 0 31
32 101.5 0 0 0 0 0 0 0 0 1 0 0 0 32
33 120.2 0 0 0 0 0 0 0 0 0 1 0 0 33
34 117.1 0 0 0 0 0 0 0 0 0 0 1 0 34
35 131.1 0 0 0 0 0 0 0 0 0 0 0 1 35
36 130.0 0 0 0 0 0 0 0 0 0 0 0 0 36
37 120.6 0 1 0 0 0 0 0 0 0 0 0 0 37
38 123.1 0 0 1 0 0 0 0 0 0 0 0 0 38
39 135.3 0 0 0 1 0 0 0 0 0 0 0 0 39
40 134.1 0 0 0 0 1 0 0 0 0 0 0 0 40
41 123.7 0 0 0 0 0 1 0 0 0 0 0 0 41
42 134.6 0 0 0 0 0 0 1 0 0 0 0 0 42
43 108.3 1 0 0 0 0 0 0 1 0 0 0 0 43
44 110.4 1 0 0 0 0 0 0 0 1 0 0 0 44
45 127.8 1 0 0 0 0 0 0 0 0 1 0 0 45
46 126.6 1 0 0 0 0 0 0 0 0 0 1 0 46
47 131.4 1 0 0 0 0 0 0 0 0 0 0 1 47
48 141.1 1 0 0 0 0 0 0 0 0 0 0 0 48
49 127.0 1 1 0 0 0 0 0 0 0 0 0 0 49
50 127.3 1 0 1 0 0 0 0 0 0 0 0 0 50
51 143.6 1 0 0 1 0 0 0 0 0 0 0 0 51
52 149.4 1 0 0 0 1 0 0 0 0 0 0 0 52
53 126.6 1 0 0 0 0 1 0 0 0 0 0 0 53
54 136.5 1 0 0 0 0 0 1 0 0 0 0 0 54
55 116.0 1 0 0 0 0 0 0 1 0 0 0 0 55
56 118.0 1 0 0 0 0 0 0 0 1 0 0 0 56
57 131.4 1 0 0 0 0 0 0 0 0 1 0 0 57
58 140.7 1 0 0 0 0 0 0 0 0 0 1 0 58
59 144.9 1 0 0 0 0 0 0 0 0 0 0 1 59
60 143.9 1 0 0 0 0 0 0 0 0 0 0 0 60
61 127.1 1 1 0 0 0 0 0 0 0 0 0 0 61
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) y M1 M2 M3 M4
114.7996 2.5922 -11.7606 -6.5684 3.9243 2.2570
M5 M6 M7 M8 M9 M10
-11.8703 -2.1976 -24.3834 -24.6907 -8.7380 -8.6054
M11 t
-1.9127 0.4273
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-4.8895 -1.8416 -0.1616 1.7058 10.7141
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 114.79962 1.88303 60.965 < 2e-16 ***
y 2.59225 1.62503 1.595 0.117371
M1 -11.76059 2.09262 -5.620 1.01e-06 ***
M2 -6.56836 2.19553 -2.992 0.004408 **
M3 3.92432 2.19276 1.790 0.079950 .
M4 2.25700 2.19081 1.030 0.308181
M5 -11.87032 2.18968 -5.421 2.00e-06 ***
M6 -2.19764 2.18937 -1.004 0.320627
M7 -24.38340 2.19099 -11.129 9.07e-15 ***
M8 -24.69072 2.18728 -11.288 5.56e-15 ***
M9 -8.73804 2.18440 -4.000 0.000223 ***
M10 -8.60536 2.18233 -3.943 0.000266 ***
M11 -1.91268 2.18109 -0.877 0.384982
t 0.42732 0.04246 10.065 2.60e-13 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.448 on 47 degrees of freedom
Multiple R-squared: 0.9413, Adjusted R-squared: 0.925
F-statistic: 57.93 on 13 and 47 DF, p-value: < 2.2e-16
> 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.98265272 0.03469456 0.01734728
[2,] 0.98067833 0.03864335 0.01932167
[3,] 0.96042595 0.07914809 0.03957405
[4,] 0.93167176 0.13665648 0.06832824
[5,] 0.89696314 0.20607371 0.10303686
[6,] 0.84033461 0.31933078 0.15966539
[7,] 0.80497898 0.39004205 0.19502102
[8,] 0.75126200 0.49747601 0.24873800
[9,] 0.67836069 0.64327862 0.32163931
[10,] 0.62427847 0.75144306 0.37572153
[11,] 0.55501814 0.88996371 0.44498186
[12,] 0.55209163 0.89581674 0.44790837
[13,] 0.46285763 0.92571527 0.53714237
[14,] 0.48540892 0.97081784 0.51459108
[15,] 0.45797276 0.91594552 0.54202724
[16,] 0.38066573 0.76133147 0.61933427
[17,] 0.29242703 0.58485406 0.70757297
[18,] 0.32237532 0.64475064 0.67762468
[19,] 0.33902993 0.67805986 0.66097007
[20,] 0.28932912 0.57865825 0.71067088
[21,] 0.23982526 0.47965051 0.76017474
[22,] 0.18168053 0.36336106 0.81831947
[23,] 0.12188451 0.24376903 0.87811549
[24,] 0.30936309 0.61872618 0.69063691
[25,] 0.24032486 0.48064973 0.75967514
[26,] 0.17915448 0.35830897 0.82084552
[27,] 0.10219307 0.20438615 0.89780693
[28,] 0.05161467 0.10322935 0.94838533
> postscript(file="/var/www/html/rcomp/tmp/1yn8t1227792777.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/2wbez1227792777.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/3v3fw1227792777.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/4pq9j1227792777.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/5ud3c1227792777.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 61
Frequency = 1
1 2 3 4 5 6
0.83365273 10.71410569 -3.20589431 -0.56589431 2.33410569 -4.36589431
7 8 9 10 11 12
1.39255517 2.97255517 3.49255517 -0.66744483 1.11255517 -2.72744483
13 14 15 16 17 18
1.70582462 -2.61372242 2.96627758 -2.59372242 -2.89372242 0.20627758
19 20 21 22 23 24
-0.03527294 -0.95527294 -1.83527294 -0.99527294 -4.41527294 -1.15527294
25 26 27 28 29 30
-0.12200348 -1.84155052 -0.16155052 -4.32155052 -1.12155052 1.87844948
31 32 33 34 35 36
2.23689895 -2.28310105 0.03689895 -3.62310105 3.25689895 -0.18310105
37 38 39 40 41 42
1.75016841 -1.36937863 -0.08937863 -0.04937863 3.25062137 4.05062137
43 44 45 46 47 48
-3.08317654 -1.10317654 -0.08317654 -1.84317654 -4.16317654 3.19682346
49 50 51 52 53 54
0.43009292 -4.88945412 0.49054588 7.53054588 -1.56945412 -1.76945412
55 56 57 58 59 60
-0.51100465 1.36899535 -1.61100465 7.12899535 4.20899535 0.86899535
61
-4.59773519
> postscript(file="/var/www/html/rcomp/tmp/6jqt21227792777.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 61
Frequency = 1
lag(myerror, k = 1) myerror
0 0.83365273 NA
1 10.71410569 0.83365273
2 -3.20589431 10.71410569
3 -0.56589431 -3.20589431
4 2.33410569 -0.56589431
5 -4.36589431 2.33410569
6 1.39255517 -4.36589431
7 2.97255517 1.39255517
8 3.49255517 2.97255517
9 -0.66744483 3.49255517
10 1.11255517 -0.66744483
11 -2.72744483 1.11255517
12 1.70582462 -2.72744483
13 -2.61372242 1.70582462
14 2.96627758 -2.61372242
15 -2.59372242 2.96627758
16 -2.89372242 -2.59372242
17 0.20627758 -2.89372242
18 -0.03527294 0.20627758
19 -0.95527294 -0.03527294
20 -1.83527294 -0.95527294
21 -0.99527294 -1.83527294
22 -4.41527294 -0.99527294
23 -1.15527294 -4.41527294
24 -0.12200348 -1.15527294
25 -1.84155052 -0.12200348
26 -0.16155052 -1.84155052
27 -4.32155052 -0.16155052
28 -1.12155052 -4.32155052
29 1.87844948 -1.12155052
30 2.23689895 1.87844948
31 -2.28310105 2.23689895
32 0.03689895 -2.28310105
33 -3.62310105 0.03689895
34 3.25689895 -3.62310105
35 -0.18310105 3.25689895
36 1.75016841 -0.18310105
37 -1.36937863 1.75016841
38 -0.08937863 -1.36937863
39 -0.04937863 -0.08937863
40 3.25062137 -0.04937863
41 4.05062137 3.25062137
42 -3.08317654 4.05062137
43 -1.10317654 -3.08317654
44 -0.08317654 -1.10317654
45 -1.84317654 -0.08317654
46 -4.16317654 -1.84317654
47 3.19682346 -4.16317654
48 0.43009292 3.19682346
49 -4.88945412 0.43009292
50 0.49054588 -4.88945412
51 7.53054588 0.49054588
52 -1.56945412 7.53054588
53 -1.76945412 -1.56945412
54 -0.51100465 -1.76945412
55 1.36899535 -0.51100465
56 -1.61100465 1.36899535
57 7.12899535 -1.61100465
58 4.20899535 7.12899535
59 0.86899535 4.20899535
60 -4.59773519 0.86899535
61 NA -4.59773519
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 10.71410569 0.83365273
[2,] -3.20589431 10.71410569
[3,] -0.56589431 -3.20589431
[4,] 2.33410569 -0.56589431
[5,] -4.36589431 2.33410569
[6,] 1.39255517 -4.36589431
[7,] 2.97255517 1.39255517
[8,] 3.49255517 2.97255517
[9,] -0.66744483 3.49255517
[10,] 1.11255517 -0.66744483
[11,] -2.72744483 1.11255517
[12,] 1.70582462 -2.72744483
[13,] -2.61372242 1.70582462
[14,] 2.96627758 -2.61372242
[15,] -2.59372242 2.96627758
[16,] -2.89372242 -2.59372242
[17,] 0.20627758 -2.89372242
[18,] -0.03527294 0.20627758
[19,] -0.95527294 -0.03527294
[20,] -1.83527294 -0.95527294
[21,] -0.99527294 -1.83527294
[22,] -4.41527294 -0.99527294
[23,] -1.15527294 -4.41527294
[24,] -0.12200348 -1.15527294
[25,] -1.84155052 -0.12200348
[26,] -0.16155052 -1.84155052
[27,] -4.32155052 -0.16155052
[28,] -1.12155052 -4.32155052
[29,] 1.87844948 -1.12155052
[30,] 2.23689895 1.87844948
[31,] -2.28310105 2.23689895
[32,] 0.03689895 -2.28310105
[33,] -3.62310105 0.03689895
[34,] 3.25689895 -3.62310105
[35,] -0.18310105 3.25689895
[36,] 1.75016841 -0.18310105
[37,] -1.36937863 1.75016841
[38,] -0.08937863 -1.36937863
[39,] -0.04937863 -0.08937863
[40,] 3.25062137 -0.04937863
[41,] 4.05062137 3.25062137
[42,] -3.08317654 4.05062137
[43,] -1.10317654 -3.08317654
[44,] -0.08317654 -1.10317654
[45,] -1.84317654 -0.08317654
[46,] -4.16317654 -1.84317654
[47,] 3.19682346 -4.16317654
[48,] 0.43009292 3.19682346
[49,] -4.88945412 0.43009292
[50,] 0.49054588 -4.88945412
[51,] 7.53054588 0.49054588
[52,] -1.56945412 7.53054588
[53,] -1.76945412 -1.56945412
[54,] -0.51100465 -1.76945412
[55,] 1.36899535 -0.51100465
[56,] -1.61100465 1.36899535
[57,] 7.12899535 -1.61100465
[58,] 4.20899535 7.12899535
[59,] 0.86899535 4.20899535
[60,] -4.59773519 0.86899535
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 10.71410569 0.83365273
2 -3.20589431 10.71410569
3 -0.56589431 -3.20589431
4 2.33410569 -0.56589431
5 -4.36589431 2.33410569
6 1.39255517 -4.36589431
7 2.97255517 1.39255517
8 3.49255517 2.97255517
9 -0.66744483 3.49255517
10 1.11255517 -0.66744483
11 -2.72744483 1.11255517
12 1.70582462 -2.72744483
13 -2.61372242 1.70582462
14 2.96627758 -2.61372242
15 -2.59372242 2.96627758
16 -2.89372242 -2.59372242
17 0.20627758 -2.89372242
18 -0.03527294 0.20627758
19 -0.95527294 -0.03527294
20 -1.83527294 -0.95527294
21 -0.99527294 -1.83527294
22 -4.41527294 -0.99527294
23 -1.15527294 -4.41527294
24 -0.12200348 -1.15527294
25 -1.84155052 -0.12200348
26 -0.16155052 -1.84155052
27 -4.32155052 -0.16155052
28 -1.12155052 -4.32155052
29 1.87844948 -1.12155052
30 2.23689895 1.87844948
31 -2.28310105 2.23689895
32 0.03689895 -2.28310105
33 -3.62310105 0.03689895
34 3.25689895 -3.62310105
35 -0.18310105 3.25689895
36 1.75016841 -0.18310105
37 -1.36937863 1.75016841
38 -0.08937863 -1.36937863
39 -0.04937863 -0.08937863
40 3.25062137 -0.04937863
41 4.05062137 3.25062137
42 -3.08317654 4.05062137
43 -1.10317654 -3.08317654
44 -0.08317654 -1.10317654
45 -1.84317654 -0.08317654
46 -4.16317654 -1.84317654
47 3.19682346 -4.16317654
48 0.43009292 3.19682346
49 -4.88945412 0.43009292
50 0.49054588 -4.88945412
51 7.53054588 0.49054588
52 -1.56945412 7.53054588
53 -1.76945412 -1.56945412
54 -0.51100465 -1.76945412
55 1.36899535 -0.51100465
56 -1.61100465 1.36899535
57 7.12899535 -1.61100465
58 4.20899535 7.12899535
59 0.86899535 4.20899535
60 -4.59773519 0.86899535
> 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/7x46o1227792777.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/88q231227792777.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/9hq551227792777.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/1035i51227792777.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/11wmvw1227792777.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/12wt3i1227792777.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/13ooz11227792777.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/14qvcp1227792777.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/15cdpm1227792777.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/161g3g1227792777.tab")
+ }
>
> system("convert tmp/1yn8t1227792777.ps tmp/1yn8t1227792777.png")
> system("convert tmp/2wbez1227792777.ps tmp/2wbez1227792777.png")
> system("convert tmp/3v3fw1227792777.ps tmp/3v3fw1227792777.png")
> system("convert tmp/4pq9j1227792777.ps tmp/4pq9j1227792777.png")
> system("convert tmp/5ud3c1227792777.ps tmp/5ud3c1227792777.png")
> system("convert tmp/6jqt21227792777.ps tmp/6jqt21227792777.png")
> system("convert tmp/7x46o1227792777.ps tmp/7x46o1227792777.png")
> system("convert tmp/88q231227792777.ps tmp/88q231227792777.png")
> system("convert tmp/9hq551227792777.ps tmp/9hq551227792777.png")
> system("convert tmp/1035i51227792777.ps tmp/1035i51227792777.png")
>
>
> proc.time()
user system elapsed
2.388 1.529 2.861