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(282965,1,276610,1,277838,1,277051,1,277026,1,274960,1,270073,1,267063,1,264916,1,287182,1,291109,1,292223,1,288109,1,281400,1,282579,1,280113,1,280331,1,276759,1,275139,1,274275,1,271234,1,289725,1,290649,1,292223,1,278429,0,269749,0,265784,0,268957,0,264099,0,255121,0,253276,0,245980,0,235295,0,258479,0,260916,0,254586,0,250566,0,243345,0,247028,0,248464,0,244962,0,237003,0,237008,0,225477,0,226762,0,247857,0,248256,0,246892,0,245021,0,246186,0,255688,0,264242,0,268270,0,272969,0,273886,0,267353,0,271916,0,292633,0,295804,0,293222,0),dim=c(2,60),dimnames=list(c('Y','X'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Y','X'),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 = '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
Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 282965 1 1 0 0 0 0 0 0 0 0 0 0 1
2 276610 1 0 1 0 0 0 0 0 0 0 0 0 2
3 277838 1 0 0 1 0 0 0 0 0 0 0 0 3
4 277051 1 0 0 0 1 0 0 0 0 0 0 0 4
5 277026 1 0 0 0 0 1 0 0 0 0 0 0 5
6 274960 1 0 0 0 0 0 1 0 0 0 0 0 6
7 270073 1 0 0 0 0 0 0 1 0 0 0 0 7
8 267063 1 0 0 0 0 0 0 0 1 0 0 0 8
9 264916 1 0 0 0 0 0 0 0 0 1 0 0 9
10 287182 1 0 0 0 0 0 0 0 0 0 1 0 10
11 291109 1 0 0 0 0 0 0 0 0 0 0 1 11
12 292223 1 0 0 0 0 0 0 0 0 0 0 0 12
13 288109 1 1 0 0 0 0 0 0 0 0 0 0 13
14 281400 1 0 1 0 0 0 0 0 0 0 0 0 14
15 282579 1 0 0 1 0 0 0 0 0 0 0 0 15
16 280113 1 0 0 0 1 0 0 0 0 0 0 0 16
17 280331 1 0 0 0 0 1 0 0 0 0 0 0 17
18 276759 1 0 0 0 0 0 1 0 0 0 0 0 18
19 275139 1 0 0 0 0 0 0 1 0 0 0 0 19
20 274275 1 0 0 0 0 0 0 0 1 0 0 0 20
21 271234 1 0 0 0 0 0 0 0 0 1 0 0 21
22 289725 1 0 0 0 0 0 0 0 0 0 1 0 22
23 290649 1 0 0 0 0 0 0 0 0 0 0 1 23
24 292223 1 0 0 0 0 0 0 0 0 0 0 0 24
25 278429 0 1 0 0 0 0 0 0 0 0 0 0 25
26 269749 0 0 1 0 0 0 0 0 0 0 0 0 26
27 265784 0 0 0 1 0 0 0 0 0 0 0 0 27
28 268957 0 0 0 0 1 0 0 0 0 0 0 0 28
29 264099 0 0 0 0 0 1 0 0 0 0 0 0 29
30 255121 0 0 0 0 0 0 1 0 0 0 0 0 30
31 253276 0 0 0 0 0 0 0 1 0 0 0 0 31
32 245980 0 0 0 0 0 0 0 0 1 0 0 0 32
33 235295 0 0 0 0 0 0 0 0 0 1 0 0 33
34 258479 0 0 0 0 0 0 0 0 0 0 1 0 34
35 260916 0 0 0 0 0 0 0 0 0 0 0 1 35
36 254586 0 0 0 0 0 0 0 0 0 0 0 0 36
37 250566 0 1 0 0 0 0 0 0 0 0 0 0 37
38 243345 0 0 1 0 0 0 0 0 0 0 0 0 38
39 247028 0 0 0 1 0 0 0 0 0 0 0 0 39
40 248464 0 0 0 0 1 0 0 0 0 0 0 0 40
41 244962 0 0 0 0 0 1 0 0 0 0 0 0 41
42 237003 0 0 0 0 0 0 1 0 0 0 0 0 42
43 237008 0 0 0 0 0 0 0 1 0 0 0 0 43
44 225477 0 0 0 0 0 0 0 0 1 0 0 0 44
45 226762 0 0 0 0 0 0 0 0 0 1 0 0 45
46 247857 0 0 0 0 0 0 0 0 0 0 1 0 46
47 248256 0 0 0 0 0 0 0 0 0 0 0 1 47
48 246892 0 0 0 0 0 0 0 0 0 0 0 0 48
49 245021 0 1 0 0 0 0 0 0 0 0 0 0 49
50 246186 0 0 1 0 0 0 0 0 0 0 0 0 50
51 255688 0 0 0 1 0 0 0 0 0 0 0 0 51
52 264242 0 0 0 0 1 0 0 0 0 0 0 0 52
53 268270 0 0 0 0 0 1 0 0 0 0 0 0 53
54 272969 0 0 0 0 0 0 1 0 0 0 0 0 54
55 273886 0 0 0 0 0 0 0 1 0 0 0 0 55
56 267353 0 0 0 0 0 0 0 0 1 0 0 0 56
57 271916 0 0 0 0 0 0 0 0 0 1 0 0 57
58 292633 0 0 0 0 0 0 0 0 0 0 1 0 58
59 295804 0 0 0 0 0 0 0 0 0 0 0 1 59
60 293222 0 0 0 0 0 0 0 0 0 0 0 0 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X M1 M2 M3 M4
245604.8 35991.2 -1974.9 -7974.6 -6088.8 -4546.5
M5 M6 M7 M8 M9 M10
-5814.0 -9828.8 -11754.5 -18040.9 -20485.6 225.3
M11 t
1957.3 439.7
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-21432.08 -6399.81 32.82 5220.47 23807.49
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 245604.8 11443.8 21.462 < 2e-16 ***
X 35991.2 6990.4 5.149 5.33e-06 ***
M1 -1974.9 8677.2 -0.228 0.8210
M2 -7974.6 8627.8 -0.924 0.3602
M3 -6088.8 8582.9 -0.709 0.4816
M4 -4546.5 8542.4 -0.532 0.5971
M5 -5814.0 8506.6 -0.683 0.4977
M6 -9828.8 8475.4 -1.160 0.2522
M7 -11754.5 8449.0 -1.391 0.1708
M8 -18040.9 8427.3 -2.141 0.0376 *
M9 -20485.6 8410.3 -2.436 0.0188 *
M10 225.3 8398.2 0.027 0.9787
M11 1957.3 8390.9 0.233 0.8166
t 439.7 201.8 2.179 0.0345 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 13260 on 46 degrees of freedom
Multiple R-squared: 0.5825, Adjusted R-squared: 0.4646
F-statistic: 4.938 on 13 and 46 DF, p-value: 2.510e-05
> 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,] 1.467821e-04 2.935642e-04 0.99985322
[2,] 2.971720e-05 5.943440e-05 0.99997028
[3,] 2.190065e-06 4.380129e-06 0.99999781
[4,] 7.675894e-07 1.535179e-06 0.99999923
[5,] 8.402968e-08 1.680594e-07 0.99999992
[6,] 9.844508e-09 1.968902e-08 0.99999999
[7,] 9.057513e-09 1.811503e-08 0.99999999
[8,] 2.624685e-09 5.249369e-09 1.00000000
[9,] 4.919355e-10 9.838711e-10 1.00000000
[10,] 1.321693e-10 2.643387e-10 1.00000000
[11,] 3.401501e-10 6.803002e-10 1.00000000
[12,] 8.302413e-11 1.660483e-10 1.00000000
[13,] 8.018826e-11 1.603765e-10 1.00000000
[14,] 2.092522e-09 4.185044e-09 1.00000000
[15,] 3.247353e-09 6.494706e-09 1.00000000
[16,] 5.234173e-08 1.046835e-07 0.99999995
[17,] 3.056239e-06 6.112478e-06 0.99999694
[18,] 1.061975e-05 2.123949e-05 0.99998938
[19,] 3.528876e-05 7.057753e-05 0.99996471
[20,] 4.355513e-04 8.711026e-04 0.99956445
[21,] 1.473361e-02 2.946722e-02 0.98526639
[22,] 1.021327e-01 2.042655e-01 0.89786726
[23,] 3.336743e-01 6.673485e-01 0.66632573
[24,] 6.908704e-01 6.182591e-01 0.30912957
[25,] 9.531487e-01 9.370269e-02 0.04685134
[26,] 9.598399e-01 8.032011e-02 0.04016005
[27,] 9.851849e-01 2.963015e-02 0.01481508
> postscript(file="/var/www/html/rcomp/tmp/1mhvt1259335230.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/2ib3h1259335230.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/3ulis1259335230.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/4p33h1259335230.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/5ok2h1259335230.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
2904.20000 2109.20000 1011.80000 -1757.20000 -954.40000 554.80000
7 8 9 10 11 12
-2846.20000 -9.40000 -151.40000 964.00000 2719.40000 5351.00000
13 14 15 16 17 18
2772.23333 1623.23333 476.83333 -3971.16667 -2925.36667 -2922.16667
19 20 21 22 23 24
-3056.16667 1926.63333 890.63333 -1768.96667 -3016.56667 75.03333
25 26 27 28 29 30
23807.48889 20687.48889 14397.08889 15588.08889 11557.88889 6155.08889
31 32 33 34 35 36
5796.08889 4346.88889 -4333.11111 -2299.71111 -2034.31111 -6846.71111
37 38 39 40 41 42
-9331.47778 -10992.47778 -9634.87778 -10180.87778 -12855.07778 -17238.87778
43 44 45 46 47 48
-15747.87778 -21432.07778 -18142.07778 -18197.67778 -19970.27778 -19816.67778
49 50 51 52 53 54
-20152.44444 -13427.44444 -6250.84444 321.15556 5176.95556 13451.15556
55 56 57 58 59 60
15854.15556 15167.95556 21735.95556 21302.35556 22301.75556 21237.35556
> postscript(file="/var/www/html/rcomp/tmp/6ya4n1259335230.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 2904.20000 NA
1 2109.20000 2904.20000
2 1011.80000 2109.20000
3 -1757.20000 1011.80000
4 -954.40000 -1757.20000
5 554.80000 -954.40000
6 -2846.20000 554.80000
7 -9.40000 -2846.20000
8 -151.40000 -9.40000
9 964.00000 -151.40000
10 2719.40000 964.00000
11 5351.00000 2719.40000
12 2772.23333 5351.00000
13 1623.23333 2772.23333
14 476.83333 1623.23333
15 -3971.16667 476.83333
16 -2925.36667 -3971.16667
17 -2922.16667 -2925.36667
18 -3056.16667 -2922.16667
19 1926.63333 -3056.16667
20 890.63333 1926.63333
21 -1768.96667 890.63333
22 -3016.56667 -1768.96667
23 75.03333 -3016.56667
24 23807.48889 75.03333
25 20687.48889 23807.48889
26 14397.08889 20687.48889
27 15588.08889 14397.08889
28 11557.88889 15588.08889
29 6155.08889 11557.88889
30 5796.08889 6155.08889
31 4346.88889 5796.08889
32 -4333.11111 4346.88889
33 -2299.71111 -4333.11111
34 -2034.31111 -2299.71111
35 -6846.71111 -2034.31111
36 -9331.47778 -6846.71111
37 -10992.47778 -9331.47778
38 -9634.87778 -10992.47778
39 -10180.87778 -9634.87778
40 -12855.07778 -10180.87778
41 -17238.87778 -12855.07778
42 -15747.87778 -17238.87778
43 -21432.07778 -15747.87778
44 -18142.07778 -21432.07778
45 -18197.67778 -18142.07778
46 -19970.27778 -18197.67778
47 -19816.67778 -19970.27778
48 -20152.44444 -19816.67778
49 -13427.44444 -20152.44444
50 -6250.84444 -13427.44444
51 321.15556 -6250.84444
52 5176.95556 321.15556
53 13451.15556 5176.95556
54 15854.15556 13451.15556
55 15167.95556 15854.15556
56 21735.95556 15167.95556
57 21302.35556 21735.95556
58 22301.75556 21302.35556
59 21237.35556 22301.75556
60 NA 21237.35556
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2109.20000 2904.20000
[2,] 1011.80000 2109.20000
[3,] -1757.20000 1011.80000
[4,] -954.40000 -1757.20000
[5,] 554.80000 -954.40000
[6,] -2846.20000 554.80000
[7,] -9.40000 -2846.20000
[8,] -151.40000 -9.40000
[9,] 964.00000 -151.40000
[10,] 2719.40000 964.00000
[11,] 5351.00000 2719.40000
[12,] 2772.23333 5351.00000
[13,] 1623.23333 2772.23333
[14,] 476.83333 1623.23333
[15,] -3971.16667 476.83333
[16,] -2925.36667 -3971.16667
[17,] -2922.16667 -2925.36667
[18,] -3056.16667 -2922.16667
[19,] 1926.63333 -3056.16667
[20,] 890.63333 1926.63333
[21,] -1768.96667 890.63333
[22,] -3016.56667 -1768.96667
[23,] 75.03333 -3016.56667
[24,] 23807.48889 75.03333
[25,] 20687.48889 23807.48889
[26,] 14397.08889 20687.48889
[27,] 15588.08889 14397.08889
[28,] 11557.88889 15588.08889
[29,] 6155.08889 11557.88889
[30,] 5796.08889 6155.08889
[31,] 4346.88889 5796.08889
[32,] -4333.11111 4346.88889
[33,] -2299.71111 -4333.11111
[34,] -2034.31111 -2299.71111
[35,] -6846.71111 -2034.31111
[36,] -9331.47778 -6846.71111
[37,] -10992.47778 -9331.47778
[38,] -9634.87778 -10992.47778
[39,] -10180.87778 -9634.87778
[40,] -12855.07778 -10180.87778
[41,] -17238.87778 -12855.07778
[42,] -15747.87778 -17238.87778
[43,] -21432.07778 -15747.87778
[44,] -18142.07778 -21432.07778
[45,] -18197.67778 -18142.07778
[46,] -19970.27778 -18197.67778
[47,] -19816.67778 -19970.27778
[48,] -20152.44444 -19816.67778
[49,] -13427.44444 -20152.44444
[50,] -6250.84444 -13427.44444
[51,] 321.15556 -6250.84444
[52,] 5176.95556 321.15556
[53,] 13451.15556 5176.95556
[54,] 15854.15556 13451.15556
[55,] 15167.95556 15854.15556
[56,] 21735.95556 15167.95556
[57,] 21302.35556 21735.95556
[58,] 22301.75556 21302.35556
[59,] 21237.35556 22301.75556
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2109.20000 2904.20000
2 1011.80000 2109.20000
3 -1757.20000 1011.80000
4 -954.40000 -1757.20000
5 554.80000 -954.40000
6 -2846.20000 554.80000
7 -9.40000 -2846.20000
8 -151.40000 -9.40000
9 964.00000 -151.40000
10 2719.40000 964.00000
11 5351.00000 2719.40000
12 2772.23333 5351.00000
13 1623.23333 2772.23333
14 476.83333 1623.23333
15 -3971.16667 476.83333
16 -2925.36667 -3971.16667
17 -2922.16667 -2925.36667
18 -3056.16667 -2922.16667
19 1926.63333 -3056.16667
20 890.63333 1926.63333
21 -1768.96667 890.63333
22 -3016.56667 -1768.96667
23 75.03333 -3016.56667
24 23807.48889 75.03333
25 20687.48889 23807.48889
26 14397.08889 20687.48889
27 15588.08889 14397.08889
28 11557.88889 15588.08889
29 6155.08889 11557.88889
30 5796.08889 6155.08889
31 4346.88889 5796.08889
32 -4333.11111 4346.88889
33 -2299.71111 -4333.11111
34 -2034.31111 -2299.71111
35 -6846.71111 -2034.31111
36 -9331.47778 -6846.71111
37 -10992.47778 -9331.47778
38 -9634.87778 -10992.47778
39 -10180.87778 -9634.87778
40 -12855.07778 -10180.87778
41 -17238.87778 -12855.07778
42 -15747.87778 -17238.87778
43 -21432.07778 -15747.87778
44 -18142.07778 -21432.07778
45 -18197.67778 -18142.07778
46 -19970.27778 -18197.67778
47 -19816.67778 -19970.27778
48 -20152.44444 -19816.67778
49 -13427.44444 -20152.44444
50 -6250.84444 -13427.44444
51 321.15556 -6250.84444
52 5176.95556 321.15556
53 13451.15556 5176.95556
54 15854.15556 13451.15556
55 15167.95556 15854.15556
56 21735.95556 15167.95556
57 21302.35556 21735.95556
58 22301.75556 21302.35556
59 21237.35556 22301.75556
> 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/72zrv1259335230.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/8qic61259335230.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/9p8x31259335230.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/10at4e1259335230.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/11d3s41259335230.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/122q5j1259335230.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/13anuw1259335230.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/14jh0j1259335230.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/15phpb1259335230.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/1612q61259335230.tab")
+ }
> system("convert tmp/1mhvt1259335230.ps tmp/1mhvt1259335230.png")
> system("convert tmp/2ib3h1259335230.ps tmp/2ib3h1259335230.png")
> system("convert tmp/3ulis1259335230.ps tmp/3ulis1259335230.png")
> system("convert tmp/4p33h1259335230.ps tmp/4p33h1259335230.png")
> system("convert tmp/5ok2h1259335230.ps tmp/5ok2h1259335230.png")
> system("convert tmp/6ya4n1259335230.ps tmp/6ya4n1259335230.png")
> system("convert tmp/72zrv1259335230.ps tmp/72zrv1259335230.png")
> system("convert tmp/8qic61259335230.ps tmp/8qic61259335230.png")
> system("convert tmp/9p8x31259335230.ps tmp/9p8x31259335230.png")
> system("convert tmp/10at4e1259335230.ps tmp/10at4e1259335230.png")
>
>
> proc.time()
user system elapsed
2.435 1.582 4.353