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(103.63,100.30,103.64,98.50,103.66,95.10,103.77,93.10,103.88,92.20,103.91,89.00,103.91,86.40,103.92,84.50,104.05,82.70,104.23,80.80,104.30,81.80,104.31,81.80,104.31,82.90,104.34,83.80,104.55,86.20,104.65,86.10,104.73,86.20,104.75,88.80,104.75,89.60,104.76,87.80,104.94,88.30,105.29,88.60,105.38,91.00,105.43,91.50,105.43,95.40,105.42,98.70,105.52,99.90,105.69,98.60,105.72,100.30,105.74,100.20,105.74,100.40,105.74,101.40,105.95,103.00,106.17,109.10,106.34,111.40,106.37,114.10,106.37,121.80,106.36,127.60,106.44,129.90,106.29,128.00,106.23,123.50,106.23,124.00,106.23,127.40,106.23,127.60,106.34,128.40,106.44,131.40,106.44,135.10,106.48,134.00,106.50,144.50,106.57,147.30,106.40,150.90,106.37,148.70,106.25,141.40,106.21,138.90,106.21,139.80,106.24,145.60,106.19,147.90,106.08,148.50,106.13,151.10,106.09,157.50),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 103.63 100.3 1 0 0 0 0 0 0 0 0 0 0 1
2 103.64 98.5 0 1 0 0 0 0 0 0 0 0 0 2
3 103.66 95.1 0 0 1 0 0 0 0 0 0 0 0 3
4 103.77 93.1 0 0 0 1 0 0 0 0 0 0 0 4
5 103.88 92.2 0 0 0 0 1 0 0 0 0 0 0 5
6 103.91 89.0 0 0 0 0 0 1 0 0 0 0 0 6
7 103.91 86.4 0 0 0 0 0 0 1 0 0 0 0 7
8 103.92 84.5 0 0 0 0 0 0 0 1 0 0 0 8
9 104.05 82.7 0 0 0 0 0 0 0 0 1 0 0 9
10 104.23 80.8 0 0 0 0 0 0 0 0 0 1 0 10
11 104.30 81.8 0 0 0 0 0 0 0 0 0 0 1 11
12 104.31 81.8 0 0 0 0 0 0 0 0 0 0 0 12
13 104.31 82.9 1 0 0 0 0 0 0 0 0 0 0 13
14 104.34 83.8 0 1 0 0 0 0 0 0 0 0 0 14
15 104.55 86.2 0 0 1 0 0 0 0 0 0 0 0 15
16 104.65 86.1 0 0 0 1 0 0 0 0 0 0 0 16
17 104.73 86.2 0 0 0 0 1 0 0 0 0 0 0 17
18 104.75 88.8 0 0 0 0 0 1 0 0 0 0 0 18
19 104.75 89.6 0 0 0 0 0 0 1 0 0 0 0 19
20 104.76 87.8 0 0 0 0 0 0 0 1 0 0 0 20
21 104.94 88.3 0 0 0 0 0 0 0 0 1 0 0 21
22 105.29 88.6 0 0 0 0 0 0 0 0 0 1 0 22
23 105.38 91.0 0 0 0 0 0 0 0 0 0 0 1 23
24 105.43 91.5 0 0 0 0 0 0 0 0 0 0 0 24
25 105.43 95.4 1 0 0 0 0 0 0 0 0 0 0 25
26 105.42 98.7 0 1 0 0 0 0 0 0 0 0 0 26
27 105.52 99.9 0 0 1 0 0 0 0 0 0 0 0 27
28 105.69 98.6 0 0 0 1 0 0 0 0 0 0 0 28
29 105.72 100.3 0 0 0 0 1 0 0 0 0 0 0 29
30 105.74 100.2 0 0 0 0 0 1 0 0 0 0 0 30
31 105.74 100.4 0 0 0 0 0 0 1 0 0 0 0 31
32 105.74 101.4 0 0 0 0 0 0 0 1 0 0 0 32
33 105.95 103.0 0 0 0 0 0 0 0 0 1 0 0 33
34 106.17 109.1 0 0 0 0 0 0 0 0 0 1 0 34
35 106.34 111.4 0 0 0 0 0 0 0 0 0 0 1 35
36 106.37 114.1 0 0 0 0 0 0 0 0 0 0 0 36
37 106.37 121.8 1 0 0 0 0 0 0 0 0 0 0 37
38 106.36 127.6 0 1 0 0 0 0 0 0 0 0 0 38
39 106.44 129.9 0 0 1 0 0 0 0 0 0 0 0 39
40 106.29 128.0 0 0 0 1 0 0 0 0 0 0 0 40
41 106.23 123.5 0 0 0 0 1 0 0 0 0 0 0 41
42 106.23 124.0 0 0 0 0 0 1 0 0 0 0 0 42
43 106.23 127.4 0 0 0 0 0 0 1 0 0 0 0 43
44 106.23 127.6 0 0 0 0 0 0 0 1 0 0 0 44
45 106.34 128.4 0 0 0 0 0 0 0 0 1 0 0 45
46 106.44 131.4 0 0 0 0 0 0 0 0 0 1 0 46
47 106.44 135.1 0 0 0 0 0 0 0 0 0 0 1 47
48 106.48 134.0 0 0 0 0 0 0 0 0 0 0 0 48
49 106.50 144.5 1 0 0 0 0 0 0 0 0 0 0 49
50 106.57 147.3 0 1 0 0 0 0 0 0 0 0 0 50
51 106.40 150.9 0 0 1 0 0 0 0 0 0 0 0 51
52 106.37 148.7 0 0 0 1 0 0 0 0 0 0 0 52
53 106.25 141.4 0 0 0 0 1 0 0 0 0 0 0 53
54 106.21 138.9 0 0 0 0 0 1 0 0 0 0 0 54
55 106.21 139.8 0 0 0 0 0 0 1 0 0 0 0 55
56 106.24 145.6 0 0 0 0 0 0 0 1 0 0 0 56
57 106.19 147.9 0 0 0 0 0 0 0 0 1 0 0 57
58 106.08 148.5 0 0 0 0 0 0 0 0 0 1 0 58
59 106.13 151.1 0 0 0 0 0 0 0 0 0 0 1 59
60 106.09 157.5 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
105.38411 -0.02187 0.24460 0.23060 0.22516 0.15223
M5 M6 M7 M8 M9 M10
0.03243 -0.05351 -0.12182 -0.17750 -0.12675 -0.02344
M11 t
0.02494 0.08012
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.70117 -0.16348 0.01238 0.20317 0.59725
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 105.384112 0.428976 245.665 < 2e-16 ***
X -0.021873 0.005622 -3.891 0.00032 ***
M1 0.244600 0.229863 1.064 0.29283
M2 0.230600 0.230516 1.000 0.32237
M3 0.225164 0.230118 0.978 0.33296
M4 0.152232 0.227147 0.670 0.50609
M5 0.032426 0.225045 0.144 0.88606
M6 -0.053507 0.224536 -0.238 0.81271
M7 -0.121817 0.224374 -0.543 0.58981
M8 -0.177502 0.224306 -0.791 0.43281
M9 -0.126750 0.224325 -0.565 0.57480
M10 -0.023437 0.224171 -0.105 0.91719
M11 0.024937 0.223977 0.111 0.91183
t 0.080122 0.007817 10.250 1.85e-13 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.3541 on 46 degrees of freedom
Multiple R-squared: 0.8955, Adjusted R-squared: 0.866
F-statistic: 30.34 on 13 and 46 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,] 9.264876e-04 1.852975e-03 0.9990735
[2,] 7.189442e-04 1.437888e-03 0.9992811
[3,] 2.677226e-04 5.354452e-04 0.9997323
[4,] 9.285373e-05 1.857075e-04 0.9999071
[5,] 4.004564e-05 8.009127e-05 0.9999600
[6,] 7.968637e-05 1.593727e-04 0.9999203
[7,] 9.244199e-05 1.848840e-04 0.9999076
[8,] 1.048257e-04 2.096515e-04 0.9998952
[9,] 6.008624e-05 1.201725e-04 0.9999399
[10,] 4.117091e-05 8.234182e-05 0.9999588
[11,] 2.366089e-05 4.732177e-05 0.9999763
[12,] 7.060429e-06 1.412086e-05 0.9999929
[13,] 7.481438e-06 1.496288e-05 0.9999925
[14,] 1.124559e-05 2.249118e-05 0.9999888
[15,] 1.953692e-05 3.907384e-05 0.9999805
[16,] 9.784133e-05 1.956827e-04 0.9999022
[17,] 1.903341e-04 3.806682e-04 0.9998097
[18,] 4.862273e-04 9.724545e-04 0.9995138
[19,] 1.998704e-04 3.997408e-04 0.9998001
[20,] 7.969080e-05 1.593816e-04 0.9999203
[21,] 1.014297e-04 2.028593e-04 0.9998986
[22,] 9.063732e-04 1.812746e-03 0.9990936
[23,] 1.228974e-03 2.457949e-03 0.9987710
[24,] 1.035686e-01 2.071371e-01 0.8964314
[25,] 3.861615e-01 7.723230e-01 0.6138385
[26,] 4.548784e-01 9.097568e-01 0.5451216
[27,] 4.109190e-01 8.218379e-01 0.5890810
> postscript(file="/var/www/html/rcomp/tmp/1jixy1258205473.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/2avat1258205473.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/3q6ga1258205473.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/4xul11258205473.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/5iram1258205473.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.115061280 0.019567934 -0.109486880 -0.050423548 0.079574323 0.045391248
7 8 9 10 11 12
-0.023291028 -0.079286769 -0.119532644 -0.164526788 -0.201149458 -0.246334130
13 14 15 16 17 18
-0.546995693 -0.563431030 -0.375620493 -0.284997822 -0.163126615 -0.080444339
19 20 21 22 23 24
-0.074757272 -0.128565679 -0.068502880 0.104624316 0.118624316 0.124376313
25 26 27 28 29 30
-0.115039908 -0.118979238 -0.067416705 0.066957963 0.173826508 0.197450776
31 32 33 34 35 36
0.190013841 0.187450776 0.301574245 0.471566792 0.563379459 0.597252795
37 38 39 40 41 42
0.440955252 0.491699263 0.547322467 0.348573132 0.229826992 0.246575262
43 44 45 46 47 48
0.309133004 0.289071269 0.285696069 0.267881273 0.220316611 0.181071269
49 50 51 52 53 54
0.106019068 0.171143070 0.005201611 -0.080109725 -0.320101207 -0.408972946
55 56 57 58 59 60
-0.401098545 -0.268669596 -0.399234791 -0.679545594 -0.701170927 -0.656366246
> postscript(file="/var/www/html/rcomp/tmp/61zhg1258205473.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.115061280 NA
1 0.019567934 0.115061280
2 -0.109486880 0.019567934
3 -0.050423548 -0.109486880
4 0.079574323 -0.050423548
5 0.045391248 0.079574323
6 -0.023291028 0.045391248
7 -0.079286769 -0.023291028
8 -0.119532644 -0.079286769
9 -0.164526788 -0.119532644
10 -0.201149458 -0.164526788
11 -0.246334130 -0.201149458
12 -0.546995693 -0.246334130
13 -0.563431030 -0.546995693
14 -0.375620493 -0.563431030
15 -0.284997822 -0.375620493
16 -0.163126615 -0.284997822
17 -0.080444339 -0.163126615
18 -0.074757272 -0.080444339
19 -0.128565679 -0.074757272
20 -0.068502880 -0.128565679
21 0.104624316 -0.068502880
22 0.118624316 0.104624316
23 0.124376313 0.118624316
24 -0.115039908 0.124376313
25 -0.118979238 -0.115039908
26 -0.067416705 -0.118979238
27 0.066957963 -0.067416705
28 0.173826508 0.066957963
29 0.197450776 0.173826508
30 0.190013841 0.197450776
31 0.187450776 0.190013841
32 0.301574245 0.187450776
33 0.471566792 0.301574245
34 0.563379459 0.471566792
35 0.597252795 0.563379459
36 0.440955252 0.597252795
37 0.491699263 0.440955252
38 0.547322467 0.491699263
39 0.348573132 0.547322467
40 0.229826992 0.348573132
41 0.246575262 0.229826992
42 0.309133004 0.246575262
43 0.289071269 0.309133004
44 0.285696069 0.289071269
45 0.267881273 0.285696069
46 0.220316611 0.267881273
47 0.181071269 0.220316611
48 0.106019068 0.181071269
49 0.171143070 0.106019068
50 0.005201611 0.171143070
51 -0.080109725 0.005201611
52 -0.320101207 -0.080109725
53 -0.408972946 -0.320101207
54 -0.401098545 -0.408972946
55 -0.268669596 -0.401098545
56 -0.399234791 -0.268669596
57 -0.679545594 -0.399234791
58 -0.701170927 -0.679545594
59 -0.656366246 -0.701170927
60 NA -0.656366246
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.019567934 0.115061280
[2,] -0.109486880 0.019567934
[3,] -0.050423548 -0.109486880
[4,] 0.079574323 -0.050423548
[5,] 0.045391248 0.079574323
[6,] -0.023291028 0.045391248
[7,] -0.079286769 -0.023291028
[8,] -0.119532644 -0.079286769
[9,] -0.164526788 -0.119532644
[10,] -0.201149458 -0.164526788
[11,] -0.246334130 -0.201149458
[12,] -0.546995693 -0.246334130
[13,] -0.563431030 -0.546995693
[14,] -0.375620493 -0.563431030
[15,] -0.284997822 -0.375620493
[16,] -0.163126615 -0.284997822
[17,] -0.080444339 -0.163126615
[18,] -0.074757272 -0.080444339
[19,] -0.128565679 -0.074757272
[20,] -0.068502880 -0.128565679
[21,] 0.104624316 -0.068502880
[22,] 0.118624316 0.104624316
[23,] 0.124376313 0.118624316
[24,] -0.115039908 0.124376313
[25,] -0.118979238 -0.115039908
[26,] -0.067416705 -0.118979238
[27,] 0.066957963 -0.067416705
[28,] 0.173826508 0.066957963
[29,] 0.197450776 0.173826508
[30,] 0.190013841 0.197450776
[31,] 0.187450776 0.190013841
[32,] 0.301574245 0.187450776
[33,] 0.471566792 0.301574245
[34,] 0.563379459 0.471566792
[35,] 0.597252795 0.563379459
[36,] 0.440955252 0.597252795
[37,] 0.491699263 0.440955252
[38,] 0.547322467 0.491699263
[39,] 0.348573132 0.547322467
[40,] 0.229826992 0.348573132
[41,] 0.246575262 0.229826992
[42,] 0.309133004 0.246575262
[43,] 0.289071269 0.309133004
[44,] 0.285696069 0.289071269
[45,] 0.267881273 0.285696069
[46,] 0.220316611 0.267881273
[47,] 0.181071269 0.220316611
[48,] 0.106019068 0.181071269
[49,] 0.171143070 0.106019068
[50,] 0.005201611 0.171143070
[51,] -0.080109725 0.005201611
[52,] -0.320101207 -0.080109725
[53,] -0.408972946 -0.320101207
[54,] -0.401098545 -0.408972946
[55,] -0.268669596 -0.401098545
[56,] -0.399234791 -0.268669596
[57,] -0.679545594 -0.399234791
[58,] -0.701170927 -0.679545594
[59,] -0.656366246 -0.701170927
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.019567934 0.115061280
2 -0.109486880 0.019567934
3 -0.050423548 -0.109486880
4 0.079574323 -0.050423548
5 0.045391248 0.079574323
6 -0.023291028 0.045391248
7 -0.079286769 -0.023291028
8 -0.119532644 -0.079286769
9 -0.164526788 -0.119532644
10 -0.201149458 -0.164526788
11 -0.246334130 -0.201149458
12 -0.546995693 -0.246334130
13 -0.563431030 -0.546995693
14 -0.375620493 -0.563431030
15 -0.284997822 -0.375620493
16 -0.163126615 -0.284997822
17 -0.080444339 -0.163126615
18 -0.074757272 -0.080444339
19 -0.128565679 -0.074757272
20 -0.068502880 -0.128565679
21 0.104624316 -0.068502880
22 0.118624316 0.104624316
23 0.124376313 0.118624316
24 -0.115039908 0.124376313
25 -0.118979238 -0.115039908
26 -0.067416705 -0.118979238
27 0.066957963 -0.067416705
28 0.173826508 0.066957963
29 0.197450776 0.173826508
30 0.190013841 0.197450776
31 0.187450776 0.190013841
32 0.301574245 0.187450776
33 0.471566792 0.301574245
34 0.563379459 0.471566792
35 0.597252795 0.563379459
36 0.440955252 0.597252795
37 0.491699263 0.440955252
38 0.547322467 0.491699263
39 0.348573132 0.547322467
40 0.229826992 0.348573132
41 0.246575262 0.229826992
42 0.309133004 0.246575262
43 0.289071269 0.309133004
44 0.285696069 0.289071269
45 0.267881273 0.285696069
46 0.220316611 0.267881273
47 0.181071269 0.220316611
48 0.106019068 0.181071269
49 0.171143070 0.106019068
50 0.005201611 0.171143070
51 -0.080109725 0.005201611
52 -0.320101207 -0.080109725
53 -0.408972946 -0.320101207
54 -0.401098545 -0.408972946
55 -0.268669596 -0.401098545
56 -0.399234791 -0.268669596
57 -0.679545594 -0.399234791
58 -0.701170927 -0.679545594
59 -0.656366246 -0.701170927
> 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/7zteu1258205473.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/8d3kh1258205473.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/91bxp1258205473.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/10s4ow1258205473.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/115u8k1258205473.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/12egct1258205473.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/13kzp61258205473.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/14dn291258205473.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/1580x11258205473.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/16vuov1258205473.tab")
+ }
>
> system("convert tmp/1jixy1258205473.ps tmp/1jixy1258205473.png")
> system("convert tmp/2avat1258205473.ps tmp/2avat1258205473.png")
> system("convert tmp/3q6ga1258205473.ps tmp/3q6ga1258205473.png")
> system("convert tmp/4xul11258205473.ps tmp/4xul11258205473.png")
> system("convert tmp/5iram1258205473.ps tmp/5iram1258205473.png")
> system("convert tmp/61zhg1258205473.ps tmp/61zhg1258205473.png")
> system("convert tmp/7zteu1258205473.ps tmp/7zteu1258205473.png")
> system("convert tmp/8d3kh1258205473.ps tmp/8d3kh1258205473.png")
> system("convert tmp/91bxp1258205473.ps tmp/91bxp1258205473.png")
> system("convert tmp/10s4ow1258205473.ps tmp/10s4ow1258205473.png")
>
>
> proc.time()
user system elapsed
2.461 1.617 2.907