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(9.3,104.1,8.7,90.2,8.2,99.2,8.3,116.5,8.5,98.4,8.6,90.6,8.5,130.5,8.2,107.4,8.1,106,7.9,196.5,8.6,107.8,8.7,90.5,8.7,123.8,8.5,114.7,8.4,115.3,8.5,197,8.7,88.4,8.7,93.8,8.6,111.3,8.5,105.9,8.3,123.6,8,171,8.2,97,8.1,99.2,8.1,126.6,8,103.4,7.9,121.3,7.9,129.6,8,110.8,8,98.9,7.9,122.8,8,120.9,7.7,133.1,7.2,203.1,7.5,110.2,7.3,119.5,7,135.1,7,113.9,7,137.4,7.2,157.1,7.3,126.4,7.1,112.2,6.8,128.8,6.4,136.8,6.1,156.5,6.5,215.2,7.7,146.7,7.9,130.8,7.5,133.1,6.9,153.4,6.6,159.9,6.9,174.6,7.7,145,8,112.9,8,137.8,7.7,150.6,7.3,162.1,7.4,226.4,8.1,112.3,8.3,126.3),dim=c(2,60),dimnames=list(c('X','Y'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('X','Y'),1:60))
> 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 = 'Include Monthly 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.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 104.1 9.3 1 0 0 0 0 0 0 0 0 0 0
2 90.2 8.7 0 1 0 0 0 0 0 0 0 0 0
3 99.2 8.2 0 0 1 0 0 0 0 0 0 0 0
4 116.5 8.3 0 0 0 1 0 0 0 0 0 0 0
5 98.4 8.5 0 0 0 0 1 0 0 0 0 0 0
6 90.6 8.6 0 0 0 0 0 1 0 0 0 0 0
7 130.5 8.5 0 0 0 0 0 0 1 0 0 0 0
8 107.4 8.2 0 0 0 0 0 0 0 1 0 0 0
9 106.0 8.1 0 0 0 0 0 0 0 0 1 0 0
10 196.5 7.9 0 0 0 0 0 0 0 0 0 1 0
11 107.8 8.6 0 0 0 0 0 0 0 0 0 0 1
12 90.5 8.7 0 0 0 0 0 0 0 0 0 0 0
13 123.8 8.7 1 0 0 0 0 0 0 0 0 0 0
14 114.7 8.5 0 1 0 0 0 0 0 0 0 0 0
15 115.3 8.4 0 0 1 0 0 0 0 0 0 0 0
16 197.0 8.5 0 0 0 1 0 0 0 0 0 0 0
17 88.4 8.7 0 0 0 0 1 0 0 0 0 0 0
18 93.8 8.7 0 0 0 0 0 1 0 0 0 0 0
19 111.3 8.6 0 0 0 0 0 0 1 0 0 0 0
20 105.9 8.5 0 0 0 0 0 0 0 1 0 0 0
21 123.6 8.3 0 0 0 0 0 0 0 0 1 0 0
22 171.0 8.0 0 0 0 0 0 0 0 0 0 1 0
23 97.0 8.2 0 0 0 0 0 0 0 0 0 0 1
24 99.2 8.1 0 0 0 0 0 0 0 0 0 0 0
25 126.6 8.1 1 0 0 0 0 0 0 0 0 0 0
26 103.4 8.0 0 1 0 0 0 0 0 0 0 0 0
27 121.3 7.9 0 0 1 0 0 0 0 0 0 0 0
28 129.6 7.9 0 0 0 1 0 0 0 0 0 0 0
29 110.8 8.0 0 0 0 0 1 0 0 0 0 0 0
30 98.9 8.0 0 0 0 0 0 1 0 0 0 0 0
31 122.8 7.9 0 0 0 0 0 0 1 0 0 0 0
32 120.9 8.0 0 0 0 0 0 0 0 1 0 0 0
33 133.1 7.7 0 0 0 0 0 0 0 0 1 0 0
34 203.1 7.2 0 0 0 0 0 0 0 0 0 1 0
35 110.2 7.5 0 0 0 0 0 0 0 0 0 0 1
36 119.5 7.3 0 0 0 0 0 0 0 0 0 0 0
37 135.1 7.0 1 0 0 0 0 0 0 0 0 0 0
38 113.9 7.0 0 1 0 0 0 0 0 0 0 0 0
39 137.4 7.0 0 0 1 0 0 0 0 0 0 0 0
40 157.1 7.2 0 0 0 1 0 0 0 0 0 0 0
41 126.4 7.3 0 0 0 0 1 0 0 0 0 0 0
42 112.2 7.1 0 0 0 0 0 1 0 0 0 0 0
43 128.8 6.8 0 0 0 0 0 0 1 0 0 0 0
44 136.8 6.4 0 0 0 0 0 0 0 1 0 0 0
45 156.5 6.1 0 0 0 0 0 0 0 0 1 0 0
46 215.2 6.5 0 0 0 0 0 0 0 0 0 1 0
47 146.7 7.7 0 0 0 0 0 0 0 0 0 0 1
48 130.8 7.9 0 0 0 0 0 0 0 0 0 0 0
49 133.1 7.5 1 0 0 0 0 0 0 0 0 0 0
50 153.4 6.9 0 1 0 0 0 0 0 0 0 0 0
51 159.9 6.6 0 0 1 0 0 0 0 0 0 0 0
52 174.6 6.9 0 0 0 1 0 0 0 0 0 0 0
53 145.0 7.7 0 0 0 0 1 0 0 0 0 0 0
54 112.9 8.0 0 0 0 0 0 1 0 0 0 0 0
55 137.8 8.0 0 0 0 0 0 0 1 0 0 0 0
56 150.6 7.7 0 0 0 0 0 0 0 1 0 0 0
57 162.1 7.3 0 0 0 0 0 0 0 0 1 0 0
58 226.4 7.4 0 0 0 0 0 0 0 0 0 1 0
59 112.3 8.1 0 0 0 0 0 0 0 0 0 0 1
60 126.3 8.3 0 0 0 0 0 0 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X M1 M2 M3 M4
252.9976 -17.3372 12.3202 -2.3009 5.7316 36.4988
M5 M6 M7 M8 M9 M10
0.1933 -11.2333 11.2463 5.8588 13.2912 77.7375
M11
0.8465
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-29.098 -8.966 -2.127 5.876 54.870
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 252.9976 27.8606 9.081 6.54e-12 ***
X -17.3372 3.3333 -5.201 4.25e-06 ***
M1 12.3202 10.4326 1.181 0.24357
M2 -2.3009 10.4613 -0.220 0.82687
M3 5.7316 10.5333 0.544 0.58891
M4 36.4988 10.4785 3.483 0.00108 **
M5 0.1933 10.4309 0.019 0.98530
M6 -11.2333 10.4309 -1.077 0.28701
M7 11.2463 10.4360 1.078 0.28669
M8 5.8588 10.4785 0.559 0.57873
M9 13.2912 10.5964 1.254 0.21593
M10 77.7375 10.6602 7.292 2.95e-09 ***
M11 0.8465 10.4316 0.081 0.93567
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 16.49 on 47 degrees of freedom
Multiple R-squared: 0.7837, Adjusted R-squared: 0.7285
F-statistic: 14.19 on 12 and 47 DF, p-value: 8.014e-12
> 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.9971113 0.00577740 0.002888700
[2,] 0.9941388 0.01172247 0.005861233
[3,] 0.9860347 0.02793053 0.013965266
[4,] 0.9758759 0.04824817 0.024124086
[5,] 0.9563365 0.08732709 0.043663547
[6,] 0.9340488 0.13190242 0.065951211
[7,] 0.9447369 0.11052626 0.055263128
[8,] 0.9284266 0.14314679 0.071573396
[9,] 0.9158040 0.16839199 0.084195995
[10,] 0.8733328 0.25333445 0.126667223
[11,] 0.8385778 0.32284431 0.161422157
[12,] 0.8048827 0.39023462 0.195117310
[13,] 0.8727848 0.25443033 0.127215165
[14,] 0.8704525 0.25909497 0.129547484
[15,] 0.8252056 0.34958886 0.174794428
[16,] 0.7632801 0.47343980 0.236719898
[17,] 0.7524222 0.49515555 0.247577777
[18,] 0.7964662 0.40706754 0.203533769
[19,] 0.7825466 0.43490689 0.217453446
[20,] 0.7542241 0.49155170 0.245775850
[21,] 0.6816752 0.63664955 0.318324774
[22,] 0.5814807 0.83703861 0.418519305
[23,] 0.7648441 0.47031172 0.235155862
[24,] 0.7974201 0.40515973 0.202579867
[25,] 0.7860291 0.42794180 0.213970899
[26,] 0.7626354 0.47472921 0.237364607
[27,] 0.6406515 0.71869702 0.359348512
[28,] 0.4982883 0.99657652 0.501711738
[29,] 0.3636111 0.72722219 0.636388906
> postscript(file="/var/www/html/rcomp/tmp/1lwh71258744353.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/2cuvf1258744353.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/334d61258744353.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/400p61258744353.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/5q1ao1258744353.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 = 60
Frequency = 1
1 2 3 4 5 6
0.01786438 -9.66328758 -17.36443954 -29.09792647 -7.42490033 -2.06466993
7 8 9 10 11 12
13.62207353 -9.29164379 -19.85769608 2.72858660 3.05556046 -11.66420915
13 14 15 16 17 18
9.31556046 11.36927778 2.20299510 54.86950817 -13.95746569 2.86904739
19 20 21 22 23 24
-3.84420915 -5.59049183 1.20973856 -21.03769608 -14.67930882 -13.36651307
25 26 27 28 29 30
1.71325654 -8.59930882 -0.46559150 -22.93279575 -3.69348693 -4.16697386
31 32 33 34 35 36
-4.48023039 0.74092157 0.30743464 -2.80743464 -13.61533007 -6.93625163
37 38 39 40 41 42
-8.85763399 -15.43648203 0.03095261 -7.56881699 -0.22950817 -6.47042974
43 44 45 46 47 48
-17.55112092 -11.09855556 -4.03204248 -2.84345588 26.35210458 14.76605229
49 50 51 52 53 54
-2.18904739 22.32980065 15.59608333 4.73003105 25.30536111 9.83302614
55 56 57 58 59 60
12.25348693 25.23976961 22.37256536 23.96000000 -1.11302614 17.20092157
> postscript(file="/var/www/html/rcomp/tmp/6n0dj1258744353.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 = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 0.01786438 NA
1 -9.66328758 0.01786438
2 -17.36443954 -9.66328758
3 -29.09792647 -17.36443954
4 -7.42490033 -29.09792647
5 -2.06466993 -7.42490033
6 13.62207353 -2.06466993
7 -9.29164379 13.62207353
8 -19.85769608 -9.29164379
9 2.72858660 -19.85769608
10 3.05556046 2.72858660
11 -11.66420915 3.05556046
12 9.31556046 -11.66420915
13 11.36927778 9.31556046
14 2.20299510 11.36927778
15 54.86950817 2.20299510
16 -13.95746569 54.86950817
17 2.86904739 -13.95746569
18 -3.84420915 2.86904739
19 -5.59049183 -3.84420915
20 1.20973856 -5.59049183
21 -21.03769608 1.20973856
22 -14.67930882 -21.03769608
23 -13.36651307 -14.67930882
24 1.71325654 -13.36651307
25 -8.59930882 1.71325654
26 -0.46559150 -8.59930882
27 -22.93279575 -0.46559150
28 -3.69348693 -22.93279575
29 -4.16697386 -3.69348693
30 -4.48023039 -4.16697386
31 0.74092157 -4.48023039
32 0.30743464 0.74092157
33 -2.80743464 0.30743464
34 -13.61533007 -2.80743464
35 -6.93625163 -13.61533007
36 -8.85763399 -6.93625163
37 -15.43648203 -8.85763399
38 0.03095261 -15.43648203
39 -7.56881699 0.03095261
40 -0.22950817 -7.56881699
41 -6.47042974 -0.22950817
42 -17.55112092 -6.47042974
43 -11.09855556 -17.55112092
44 -4.03204248 -11.09855556
45 -2.84345588 -4.03204248
46 26.35210458 -2.84345588
47 14.76605229 26.35210458
48 -2.18904739 14.76605229
49 22.32980065 -2.18904739
50 15.59608333 22.32980065
51 4.73003105 15.59608333
52 25.30536111 4.73003105
53 9.83302614 25.30536111
54 12.25348693 9.83302614
55 25.23976961 12.25348693
56 22.37256536 25.23976961
57 23.96000000 22.37256536
58 -1.11302614 23.96000000
59 17.20092157 -1.11302614
60 NA 17.20092157
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -9.66328758 0.01786438
[2,] -17.36443954 -9.66328758
[3,] -29.09792647 -17.36443954
[4,] -7.42490033 -29.09792647
[5,] -2.06466993 -7.42490033
[6,] 13.62207353 -2.06466993
[7,] -9.29164379 13.62207353
[8,] -19.85769608 -9.29164379
[9,] 2.72858660 -19.85769608
[10,] 3.05556046 2.72858660
[11,] -11.66420915 3.05556046
[12,] 9.31556046 -11.66420915
[13,] 11.36927778 9.31556046
[14,] 2.20299510 11.36927778
[15,] 54.86950817 2.20299510
[16,] -13.95746569 54.86950817
[17,] 2.86904739 -13.95746569
[18,] -3.84420915 2.86904739
[19,] -5.59049183 -3.84420915
[20,] 1.20973856 -5.59049183
[21,] -21.03769608 1.20973856
[22,] -14.67930882 -21.03769608
[23,] -13.36651307 -14.67930882
[24,] 1.71325654 -13.36651307
[25,] -8.59930882 1.71325654
[26,] -0.46559150 -8.59930882
[27,] -22.93279575 -0.46559150
[28,] -3.69348693 -22.93279575
[29,] -4.16697386 -3.69348693
[30,] -4.48023039 -4.16697386
[31,] 0.74092157 -4.48023039
[32,] 0.30743464 0.74092157
[33,] -2.80743464 0.30743464
[34,] -13.61533007 -2.80743464
[35,] -6.93625163 -13.61533007
[36,] -8.85763399 -6.93625163
[37,] -15.43648203 -8.85763399
[38,] 0.03095261 -15.43648203
[39,] -7.56881699 0.03095261
[40,] -0.22950817 -7.56881699
[41,] -6.47042974 -0.22950817
[42,] -17.55112092 -6.47042974
[43,] -11.09855556 -17.55112092
[44,] -4.03204248 -11.09855556
[45,] -2.84345588 -4.03204248
[46,] 26.35210458 -2.84345588
[47,] 14.76605229 26.35210458
[48,] -2.18904739 14.76605229
[49,] 22.32980065 -2.18904739
[50,] 15.59608333 22.32980065
[51,] 4.73003105 15.59608333
[52,] 25.30536111 4.73003105
[53,] 9.83302614 25.30536111
[54,] 12.25348693 9.83302614
[55,] 25.23976961 12.25348693
[56,] 22.37256536 25.23976961
[57,] 23.96000000 22.37256536
[58,] -1.11302614 23.96000000
[59,] 17.20092157 -1.11302614
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -9.66328758 0.01786438
2 -17.36443954 -9.66328758
3 -29.09792647 -17.36443954
4 -7.42490033 -29.09792647
5 -2.06466993 -7.42490033
6 13.62207353 -2.06466993
7 -9.29164379 13.62207353
8 -19.85769608 -9.29164379
9 2.72858660 -19.85769608
10 3.05556046 2.72858660
11 -11.66420915 3.05556046
12 9.31556046 -11.66420915
13 11.36927778 9.31556046
14 2.20299510 11.36927778
15 54.86950817 2.20299510
16 -13.95746569 54.86950817
17 2.86904739 -13.95746569
18 -3.84420915 2.86904739
19 -5.59049183 -3.84420915
20 1.20973856 -5.59049183
21 -21.03769608 1.20973856
22 -14.67930882 -21.03769608
23 -13.36651307 -14.67930882
24 1.71325654 -13.36651307
25 -8.59930882 1.71325654
26 -0.46559150 -8.59930882
27 -22.93279575 -0.46559150
28 -3.69348693 -22.93279575
29 -4.16697386 -3.69348693
30 -4.48023039 -4.16697386
31 0.74092157 -4.48023039
32 0.30743464 0.74092157
33 -2.80743464 0.30743464
34 -13.61533007 -2.80743464
35 -6.93625163 -13.61533007
36 -8.85763399 -6.93625163
37 -15.43648203 -8.85763399
38 0.03095261 -15.43648203
39 -7.56881699 0.03095261
40 -0.22950817 -7.56881699
41 -6.47042974 -0.22950817
42 -17.55112092 -6.47042974
43 -11.09855556 -17.55112092
44 -4.03204248 -11.09855556
45 -2.84345588 -4.03204248
46 26.35210458 -2.84345588
47 14.76605229 26.35210458
48 -2.18904739 14.76605229
49 22.32980065 -2.18904739
50 15.59608333 22.32980065
51 4.73003105 15.59608333
52 25.30536111 4.73003105
53 9.83302614 25.30536111
54 12.25348693 9.83302614
55 25.23976961 12.25348693
56 22.37256536 25.23976961
57 23.96000000 22.37256536
58 -1.11302614 23.96000000
59 17.20092157 -1.11302614
> 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/7we211258744353.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/879lj1258744353.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/9xdos1258744353.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/10o9bo1258744353.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/11tpbw1258744353.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/12240k1258744353.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/13ix3i1258744353.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/1400xj1258744353.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/15nnvp1258744354.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/16r50i1258744354.tab")
+ }
>
> system("convert tmp/1lwh71258744353.ps tmp/1lwh71258744353.png")
> system("convert tmp/2cuvf1258744353.ps tmp/2cuvf1258744353.png")
> system("convert tmp/334d61258744353.ps tmp/334d61258744353.png")
> system("convert tmp/400p61258744353.ps tmp/400p61258744353.png")
> system("convert tmp/5q1ao1258744353.ps tmp/5q1ao1258744353.png")
> system("convert tmp/6n0dj1258744353.ps tmp/6n0dj1258744353.png")
> system("convert tmp/7we211258744353.ps tmp/7we211258744353.png")
> system("convert tmp/879lj1258744353.ps tmp/879lj1258744353.png")
> system("convert tmp/9xdos1258744353.ps tmp/9xdos1258744353.png")
> system("convert tmp/10o9bo1258744353.ps tmp/10o9bo1258744353.png")
>
>
> proc.time()
user system elapsed
2.410 1.560 2.793