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(107.11,107.56,107.57,107.70,107.81,107.67,108.75,107.67,109.43,107.72,109.62,108.35,109.54,108.25,109.53,108.26,109.84,108.31,109.67,108.33,109.79,108.36,109.56,108.36,110.22,108.97,110.40,109.62,110.69,109.60,110.72,109.64,110.89,109.65,110.58,109.64,110.94,109.93,110.91,109.81,111.22,109.77,111.09,110.10,111.00,110.40,111.06,110.50,111.55,111.89,112.32,112.10,112.64,111.92,112.36,112.15,112.04,112.16,112.37,112.17,112.59,112.32,112.89,112.38,113.22,112.34,112.85,113.14,113.06,113.18,112.99,113.21,113.32,113.76,113.74,113.99,113.91,113.95,114.52,113.93,114.96,114.01,114.91,114.10,115.30,114.11,115.44,114.10,115.52,114.12,116.08,114.68,115.94,114.71,115.56,114.73,115.88,115.81,116.66,116.01,117.41,116.12,117.68,116.49,117.85,116.51,118.21,116.60,118.92,117.01,119.03,117.01,119.17,117.12,118.95,117.22,118.92,118.38,118.90,118.80),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 107.11 107.56 1 0 0 0 0 0 0 0 0 0 0 1
2 107.57 107.70 0 1 0 0 0 0 0 0 0 0 0 2
3 107.81 107.67 0 0 1 0 0 0 0 0 0 0 0 3
4 108.75 107.67 0 0 0 1 0 0 0 0 0 0 0 4
5 109.43 107.72 0 0 0 0 1 0 0 0 0 0 0 5
6 109.62 108.35 0 0 0 0 0 1 0 0 0 0 0 6
7 109.54 108.25 0 0 0 0 0 0 1 0 0 0 0 7
8 109.53 108.26 0 0 0 0 0 0 0 1 0 0 0 8
9 109.84 108.31 0 0 0 0 0 0 0 0 1 0 0 9
10 109.67 108.33 0 0 0 0 0 0 0 0 0 1 0 10
11 109.79 108.36 0 0 0 0 0 0 0 0 0 0 1 11
12 109.56 108.36 0 0 0 0 0 0 0 0 0 0 0 12
13 110.22 108.97 1 0 0 0 0 0 0 0 0 0 0 13
14 110.40 109.62 0 1 0 0 0 0 0 0 0 0 0 14
15 110.69 109.60 0 0 1 0 0 0 0 0 0 0 0 15
16 110.72 109.64 0 0 0 1 0 0 0 0 0 0 0 16
17 110.89 109.65 0 0 0 0 1 0 0 0 0 0 0 17
18 110.58 109.64 0 0 0 0 0 1 0 0 0 0 0 18
19 110.94 109.93 0 0 0 0 0 0 1 0 0 0 0 19
20 110.91 109.81 0 0 0 0 0 0 0 1 0 0 0 20
21 111.22 109.77 0 0 0 0 0 0 0 0 1 0 0 21
22 111.09 110.10 0 0 0 0 0 0 0 0 0 1 0 22
23 111.00 110.40 0 0 0 0 0 0 0 0 0 0 1 23
24 111.06 110.50 0 0 0 0 0 0 0 0 0 0 0 24
25 111.55 111.89 1 0 0 0 0 0 0 0 0 0 0 25
26 112.32 112.10 0 1 0 0 0 0 0 0 0 0 0 26
27 112.64 111.92 0 0 1 0 0 0 0 0 0 0 0 27
28 112.36 112.15 0 0 0 1 0 0 0 0 0 0 0 28
29 112.04 112.16 0 0 0 0 1 0 0 0 0 0 0 29
30 112.37 112.17 0 0 0 0 0 1 0 0 0 0 0 30
31 112.59 112.32 0 0 0 0 0 0 1 0 0 0 0 31
32 112.89 112.38 0 0 0 0 0 0 0 1 0 0 0 32
33 113.22 112.34 0 0 0 0 0 0 0 0 1 0 0 33
34 112.85 113.14 0 0 0 0 0 0 0 0 0 1 0 34
35 113.06 113.18 0 0 0 0 0 0 0 0 0 0 1 35
36 112.99 113.21 0 0 0 0 0 0 0 0 0 0 0 36
37 113.32 113.76 1 0 0 0 0 0 0 0 0 0 0 37
38 113.74 113.99 0 1 0 0 0 0 0 0 0 0 0 38
39 113.91 113.95 0 0 1 0 0 0 0 0 0 0 0 39
40 114.52 113.93 0 0 0 1 0 0 0 0 0 0 0 40
41 114.96 114.01 0 0 0 0 1 0 0 0 0 0 0 41
42 114.91 114.10 0 0 0 0 0 1 0 0 0 0 0 42
43 115.30 114.11 0 0 0 0 0 0 1 0 0 0 0 43
44 115.44 114.10 0 0 0 0 0 0 0 1 0 0 0 44
45 115.52 114.12 0 0 0 0 0 0 0 0 1 0 0 45
46 116.08 114.68 0 0 0 0 0 0 0 0 0 1 0 46
47 115.94 114.71 0 0 0 0 0 0 0 0 0 0 1 47
48 115.56 114.73 0 0 0 0 0 0 0 0 0 0 0 48
49 115.88 115.81 1 0 0 0 0 0 0 0 0 0 0 49
50 116.66 116.01 0 1 0 0 0 0 0 0 0 0 0 50
51 117.41 116.12 0 0 1 0 0 0 0 0 0 0 0 51
52 117.68 116.49 0 0 0 1 0 0 0 0 0 0 0 52
53 117.85 116.51 0 0 0 0 1 0 0 0 0 0 0 53
54 118.21 116.60 0 0 0 0 0 1 0 0 0 0 0 54
55 118.92 117.01 0 0 0 0 0 0 1 0 0 0 0 55
56 119.03 117.01 0 0 0 0 0 0 0 1 0 0 0 56
57 119.17 117.12 0 0 0 0 0 0 0 0 1 0 0 57
58 118.95 117.22 0 0 0 0 0 0 0 0 0 1 0 58
59 118.92 118.38 0 0 0 0 0 0 0 0 0 0 1 59
60 118.90 118.80 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
39.038520 0.637407 -0.272539 -0.001504 0.304227 0.470522
M5 M6 M7 M8 M9 M10
0.608185 0.540258 0.694707 0.735689 0.888275 0.522868
M11 t
0.269330 0.068666
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.16228 -0.28173 -0.02123 0.33969 1.10310
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 39.038520 23.271399 1.678 0.10022
X 0.637407 0.218535 2.917 0.00545 **
M1 -0.272539 0.387002 -0.704 0.48484
M2 -0.001504 0.393409 -0.004 0.99697
M3 0.304227 0.379540 0.802 0.42692
M4 0.470522 0.376334 1.250 0.21752
M5 0.608185 0.371008 1.639 0.10798
M6 0.540258 0.370173 1.459 0.15123
M7 0.694707 0.369284 1.881 0.06628 .
M8 0.735689 0.368330 1.997 0.05172 .
M9 0.888275 0.371380 2.392 0.02091 *
M10 0.522868 0.367904 1.421 0.16200
M11 0.269330 0.367935 0.732 0.46788
t 0.068666 0.040555 1.693 0.09719 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.5812 on 46 degrees of freedom
Multiple R-squared: 0.9759, Adjusted R-squared: 0.9691
F-statistic: 143.4 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,] 0.6337143 0.732571405 0.366285702
[2,] 0.9052572 0.189485680 0.094742840
[3,] 0.8907536 0.218492836 0.109246418
[4,] 0.8539053 0.292189359 0.146094680
[5,] 0.8132806 0.373438893 0.186719446
[6,] 0.7962387 0.407522508 0.203761254
[7,] 0.8292095 0.341581079 0.170790540
[8,] 0.8689097 0.262180500 0.131090250
[9,] 0.8764191 0.247161774 0.123580887
[10,] 0.9501178 0.099764482 0.049882241
[11,] 0.9963125 0.007374997 0.003687499
[12,] 0.9983126 0.003374888 0.001687444
[13,] 0.9987430 0.002513970 0.001256985
[14,] 0.9981039 0.003792272 0.001896136
[15,] 0.9961721 0.007655827 0.003827913
[16,] 0.9919563 0.016087397 0.008043698
[17,] 0.9900209 0.019958123 0.009979061
[18,] 0.9848042 0.030391656 0.015195828
[19,] 0.9714505 0.057098912 0.028549456
[20,] 0.9668817 0.066236539 0.033118269
[21,] 0.9749858 0.050028309 0.025014155
[22,] 0.9624024 0.075195218 0.037597609
[23,] 0.9390908 0.121818493 0.060909246
[24,] 0.8881597 0.223680677 0.111840338
[25,] 0.8788296 0.242340725 0.121170362
[26,] 0.7800280 0.439943914 0.219971957
[27,] 0.6932134 0.613573152 0.306786576
> postscript(file="/var/www/html/rcomp/tmp/1o9cd1258751822.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/2h6hl1258751822.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/3u5pu1258751822.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/4vl4m1258751822.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/5xhut1258751822.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.28416386 -0.25310241 -0.36837723 0.33666126 0.77846275 0.56615618
7 8 9 10 11 12
0.32678279 0.20075984 0.25763762 0.37163088 0.65737970 0.62804412
13 14 15 16 17 18
1.10309904 0.52908283 0.45743394 0.22697615 0.18427392 -0.12009205
19 20 21 22 23 24
-0.16805424 -0.23121426 -0.11696983 -0.16057280 -0.25692391 -0.06000021
25 26 27 28 29 30
-0.25212290 0.04432005 0.10465631 -0.55690885 -1.08961108 -0.76672519
31 32 33 34 35 36
-0.86545037 -0.71334369 -0.57909926 -1.16228360 -0.79290885 -0.68136665
37 38 39 40 41 42
-0.49806730 -0.56437249 -0.74327324 -0.35548660 -0.17280733 -0.28091401
43 44 45 46 47 48
-0.12040219 -0.08367701 -0.23767701 0.26211637 0.28786520 0.09578147
49 50 51 52 53 54
-0.06874499 0.24407203 0.54956021 0.34875804 0.29968174 0.60157506
55 56 57 58 59 60
0.82712401 0.82747512 0.67610848 0.68910916 0.10458787 0.01754127
> postscript(file="/var/www/html/rcomp/tmp/674ou1258751822.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.28416386 NA
1 -0.25310241 -0.28416386
2 -0.36837723 -0.25310241
3 0.33666126 -0.36837723
4 0.77846275 0.33666126
5 0.56615618 0.77846275
6 0.32678279 0.56615618
7 0.20075984 0.32678279
8 0.25763762 0.20075984
9 0.37163088 0.25763762
10 0.65737970 0.37163088
11 0.62804412 0.65737970
12 1.10309904 0.62804412
13 0.52908283 1.10309904
14 0.45743394 0.52908283
15 0.22697615 0.45743394
16 0.18427392 0.22697615
17 -0.12009205 0.18427392
18 -0.16805424 -0.12009205
19 -0.23121426 -0.16805424
20 -0.11696983 -0.23121426
21 -0.16057280 -0.11696983
22 -0.25692391 -0.16057280
23 -0.06000021 -0.25692391
24 -0.25212290 -0.06000021
25 0.04432005 -0.25212290
26 0.10465631 0.04432005
27 -0.55690885 0.10465631
28 -1.08961108 -0.55690885
29 -0.76672519 -1.08961108
30 -0.86545037 -0.76672519
31 -0.71334369 -0.86545037
32 -0.57909926 -0.71334369
33 -1.16228360 -0.57909926
34 -0.79290885 -1.16228360
35 -0.68136665 -0.79290885
36 -0.49806730 -0.68136665
37 -0.56437249 -0.49806730
38 -0.74327324 -0.56437249
39 -0.35548660 -0.74327324
40 -0.17280733 -0.35548660
41 -0.28091401 -0.17280733
42 -0.12040219 -0.28091401
43 -0.08367701 -0.12040219
44 -0.23767701 -0.08367701
45 0.26211637 -0.23767701
46 0.28786520 0.26211637
47 0.09578147 0.28786520
48 -0.06874499 0.09578147
49 0.24407203 -0.06874499
50 0.54956021 0.24407203
51 0.34875804 0.54956021
52 0.29968174 0.34875804
53 0.60157506 0.29968174
54 0.82712401 0.60157506
55 0.82747512 0.82712401
56 0.67610848 0.82747512
57 0.68910916 0.67610848
58 0.10458787 0.68910916
59 0.01754127 0.10458787
60 NA 0.01754127
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.25310241 -0.28416386
[2,] -0.36837723 -0.25310241
[3,] 0.33666126 -0.36837723
[4,] 0.77846275 0.33666126
[5,] 0.56615618 0.77846275
[6,] 0.32678279 0.56615618
[7,] 0.20075984 0.32678279
[8,] 0.25763762 0.20075984
[9,] 0.37163088 0.25763762
[10,] 0.65737970 0.37163088
[11,] 0.62804412 0.65737970
[12,] 1.10309904 0.62804412
[13,] 0.52908283 1.10309904
[14,] 0.45743394 0.52908283
[15,] 0.22697615 0.45743394
[16,] 0.18427392 0.22697615
[17,] -0.12009205 0.18427392
[18,] -0.16805424 -0.12009205
[19,] -0.23121426 -0.16805424
[20,] -0.11696983 -0.23121426
[21,] -0.16057280 -0.11696983
[22,] -0.25692391 -0.16057280
[23,] -0.06000021 -0.25692391
[24,] -0.25212290 -0.06000021
[25,] 0.04432005 -0.25212290
[26,] 0.10465631 0.04432005
[27,] -0.55690885 0.10465631
[28,] -1.08961108 -0.55690885
[29,] -0.76672519 -1.08961108
[30,] -0.86545037 -0.76672519
[31,] -0.71334369 -0.86545037
[32,] -0.57909926 -0.71334369
[33,] -1.16228360 -0.57909926
[34,] -0.79290885 -1.16228360
[35,] -0.68136665 -0.79290885
[36,] -0.49806730 -0.68136665
[37,] -0.56437249 -0.49806730
[38,] -0.74327324 -0.56437249
[39,] -0.35548660 -0.74327324
[40,] -0.17280733 -0.35548660
[41,] -0.28091401 -0.17280733
[42,] -0.12040219 -0.28091401
[43,] -0.08367701 -0.12040219
[44,] -0.23767701 -0.08367701
[45,] 0.26211637 -0.23767701
[46,] 0.28786520 0.26211637
[47,] 0.09578147 0.28786520
[48,] -0.06874499 0.09578147
[49,] 0.24407203 -0.06874499
[50,] 0.54956021 0.24407203
[51,] 0.34875804 0.54956021
[52,] 0.29968174 0.34875804
[53,] 0.60157506 0.29968174
[54,] 0.82712401 0.60157506
[55,] 0.82747512 0.82712401
[56,] 0.67610848 0.82747512
[57,] 0.68910916 0.67610848
[58,] 0.10458787 0.68910916
[59,] 0.01754127 0.10458787
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.25310241 -0.28416386
2 -0.36837723 -0.25310241
3 0.33666126 -0.36837723
4 0.77846275 0.33666126
5 0.56615618 0.77846275
6 0.32678279 0.56615618
7 0.20075984 0.32678279
8 0.25763762 0.20075984
9 0.37163088 0.25763762
10 0.65737970 0.37163088
11 0.62804412 0.65737970
12 1.10309904 0.62804412
13 0.52908283 1.10309904
14 0.45743394 0.52908283
15 0.22697615 0.45743394
16 0.18427392 0.22697615
17 -0.12009205 0.18427392
18 -0.16805424 -0.12009205
19 -0.23121426 -0.16805424
20 -0.11696983 -0.23121426
21 -0.16057280 -0.11696983
22 -0.25692391 -0.16057280
23 -0.06000021 -0.25692391
24 -0.25212290 -0.06000021
25 0.04432005 -0.25212290
26 0.10465631 0.04432005
27 -0.55690885 0.10465631
28 -1.08961108 -0.55690885
29 -0.76672519 -1.08961108
30 -0.86545037 -0.76672519
31 -0.71334369 -0.86545037
32 -0.57909926 -0.71334369
33 -1.16228360 -0.57909926
34 -0.79290885 -1.16228360
35 -0.68136665 -0.79290885
36 -0.49806730 -0.68136665
37 -0.56437249 -0.49806730
38 -0.74327324 -0.56437249
39 -0.35548660 -0.74327324
40 -0.17280733 -0.35548660
41 -0.28091401 -0.17280733
42 -0.12040219 -0.28091401
43 -0.08367701 -0.12040219
44 -0.23767701 -0.08367701
45 0.26211637 -0.23767701
46 0.28786520 0.26211637
47 0.09578147 0.28786520
48 -0.06874499 0.09578147
49 0.24407203 -0.06874499
50 0.54956021 0.24407203
51 0.34875804 0.54956021
52 0.29968174 0.34875804
53 0.60157506 0.29968174
54 0.82712401 0.60157506
55 0.82747512 0.82712401
56 0.67610848 0.82747512
57 0.68910916 0.67610848
58 0.10458787 0.68910916
59 0.01754127 0.10458787
> 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/7hu8h1258751822.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/8ki8e1258751822.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/9iehi1258751822.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/10u9bd1258751822.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/11xru21258751822.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/12ln6j1258751822.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/139unh1258751822.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/14xamx1258751822.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/15ove11258751822.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/16v5471258751822.tab")
+ }
> system("convert tmp/1o9cd1258751822.ps tmp/1o9cd1258751822.png")
> system("convert tmp/2h6hl1258751822.ps tmp/2h6hl1258751822.png")
> system("convert tmp/3u5pu1258751822.ps tmp/3u5pu1258751822.png")
> system("convert tmp/4vl4m1258751822.ps tmp/4vl4m1258751822.png")
> system("convert tmp/5xhut1258751822.ps tmp/5xhut1258751822.png")
> system("convert tmp/674ou1258751822.ps tmp/674ou1258751822.png")
> system("convert tmp/7hu8h1258751822.ps tmp/7hu8h1258751822.png")
> system("convert tmp/8ki8e1258751822.ps tmp/8ki8e1258751822.png")
> system("convert tmp/9iehi1258751822.ps tmp/9iehi1258751822.png")
> system("convert tmp/10u9bd1258751822.ps tmp/10u9bd1258751822.png")
>
>
> proc.time()
user system elapsed
2.291 1.533 2.874