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(111.4,91.2,111.5,92.2,111.6,93.2,111.7,94.2,111.8,95.2,111.9,96.2,111.10,97.2,111.11,98.2,111.12,99.2,111.13,100.2,111.14,101.2,111.15,102.2,111.16,103.2,111.17,104.2,111.18,105.2,111.19,106.2,111.20,107.2,111.21,108.2,111.22,109.2,111.23,110.2,111.24,111.2,111.25,112.2,111.26,113.2,111.27,114.2,111.28,115.2,111.29,116.2,111.30,117.2,111.31,118.2,111.32,119.2,111.33,120.2,111.34,121.2,111.35,122.2,111.36,123.2,111.37,124.2,111.38,125.2,111.39,126.2,111.40,127.2,111.41,128.2,111.42,129.2,111.43,130.2,111.44,131.2,111.45,132.2,111.46,133.2,111.47,134.2,111.48,135.2,111.49,136.2,111.50,137.2,111.51,138.2,111.52,139.2,111.53,140.2,111.54,141.2,111.55,142.2,111.56,143.2,111.57,144.2,111.58,145.2,111.59,146.2,111.60,147.2,111.61,148.2,111.62,149.2,111.63,150.2,111.64,151.2),dim=c(2,61),dimnames=list(c('biti','bikl'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('biti','bikl'),1:61))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No 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
biti bikl M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 111.40 91.2 1 0 0 0 0 0 0 0 0 0 0
2 111.50 92.2 0 1 0 0 0 0 0 0 0 0 0
3 111.60 93.2 0 0 1 0 0 0 0 0 0 0 0
4 111.70 94.2 0 0 0 1 0 0 0 0 0 0 0
5 111.80 95.2 0 0 0 0 1 0 0 0 0 0 0
6 111.90 96.2 0 0 0 0 0 1 0 0 0 0 0
7 111.10 97.2 0 0 0 0 0 0 1 0 0 0 0
8 111.11 98.2 0 0 0 0 0 0 0 1 0 0 0
9 111.12 99.2 0 0 0 0 0 0 0 0 1 0 0
10 111.13 100.2 0 0 0 0 0 0 0 0 0 1 0
11 111.14 101.2 0 0 0 0 0 0 0 0 0 0 1
12 111.15 102.2 0 0 0 0 0 0 0 0 0 0 0
13 111.16 103.2 1 0 0 0 0 0 0 0 0 0 0
14 111.17 104.2 0 1 0 0 0 0 0 0 0 0 0
15 111.18 105.2 0 0 1 0 0 0 0 0 0 0 0
16 111.19 106.2 0 0 0 1 0 0 0 0 0 0 0
17 111.20 107.2 0 0 0 0 1 0 0 0 0 0 0
18 111.21 108.2 0 0 0 0 0 1 0 0 0 0 0
19 111.22 109.2 0 0 0 0 0 0 1 0 0 0 0
20 111.23 110.2 0 0 0 0 0 0 0 1 0 0 0
21 111.24 111.2 0 0 0 0 0 0 0 0 1 0 0
22 111.25 112.2 0 0 0 0 0 0 0 0 0 1 0
23 111.26 113.2 0 0 0 0 0 0 0 0 0 0 1
24 111.27 114.2 0 0 0 0 0 0 0 0 0 0 0
25 111.28 115.2 1 0 0 0 0 0 0 0 0 0 0
26 111.29 116.2 0 1 0 0 0 0 0 0 0 0 0
27 111.30 117.2 0 0 1 0 0 0 0 0 0 0 0
28 111.31 118.2 0 0 0 1 0 0 0 0 0 0 0
29 111.32 119.2 0 0 0 0 1 0 0 0 0 0 0
30 111.33 120.2 0 0 0 0 0 1 0 0 0 0 0
31 111.34 121.2 0 0 0 0 0 0 1 0 0 0 0
32 111.35 122.2 0 0 0 0 0 0 0 1 0 0 0
33 111.36 123.2 0 0 0 0 0 0 0 0 1 0 0
34 111.37 124.2 0 0 0 0 0 0 0 0 0 1 0
35 111.38 125.2 0 0 0 0 0 0 0 0 0 0 1
36 111.39 126.2 0 0 0 0 0 0 0 0 0 0 0
37 111.40 127.2 1 0 0 0 0 0 0 0 0 0 0
38 111.41 128.2 0 1 0 0 0 0 0 0 0 0 0
39 111.42 129.2 0 0 1 0 0 0 0 0 0 0 0
40 111.43 130.2 0 0 0 1 0 0 0 0 0 0 0
41 111.44 131.2 0 0 0 0 1 0 0 0 0 0 0
42 111.45 132.2 0 0 0 0 0 1 0 0 0 0 0
43 111.46 133.2 0 0 0 0 0 0 1 0 0 0 0
44 111.47 134.2 0 0 0 0 0 0 0 1 0 0 0
45 111.48 135.2 0 0 0 0 0 0 0 0 1 0 0
46 111.49 136.2 0 0 0 0 0 0 0 0 0 1 0
47 111.50 137.2 0 0 0 0 0 0 0 0 0 0 1
48 111.51 138.2 0 0 0 0 0 0 0 0 0 0 0
49 111.52 139.2 1 0 0 0 0 0 0 0 0 0 0
50 111.53 140.2 0 1 0 0 0 0 0 0 0 0 0
51 111.54 141.2 0 0 1 0 0 0 0 0 0 0 0
52 111.55 142.2 0 0 0 1 0 0 0 0 0 0 0
53 111.56 143.2 0 0 0 0 1 0 0 0 0 0 0
54 111.57 144.2 0 0 0 0 0 1 0 0 0 0 0
55 111.58 145.2 0 0 0 0 0 0 1 0 0 0 0
56 111.59 146.2 0 0 0 0 0 0 0 1 0 0 0
57 111.60 147.2 0 0 0 0 0 0 0 0 1 0 0
58 111.61 148.2 0 0 0 0 0 0 0 0 0 1 0
59 111.62 149.2 0 0 0 0 0 0 0 0 0 0 1
60 111.63 150.2 0 0 0 0 0 0 0 0 0 0 0
61 111.64 151.2 1 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) bikl M1 M2 M3 M4
110.721882 0.005294 0.036471 0.042941 0.065647 0.088353
M5 M6 M7 M8 M9 M10
0.111059 0.133765 -0.023529 -0.018824 -0.014118 -0.009412
M11
-0.004706
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.21847 -0.10800 -0.03176 0.05647 0.53506
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 110.721882 0.173513 638.117 < 2e-16 ***
bikl 0.005294 0.001239 4.271 9.13e-05 ***
M1 0.036471 0.101882 0.358 0.722
M2 0.042941 0.106936 0.402 0.690
M3 0.065647 0.106800 0.615 0.542
M4 0.088353 0.106677 0.828 0.412
M5 0.111059 0.106569 1.042 0.303
M6 0.133765 0.106476 1.256 0.215
M7 -0.023529 0.106396 -0.221 0.826
M8 -0.018824 0.106331 -0.177 0.860
M9 -0.014118 0.106281 -0.133 0.895
M10 -0.009412 0.106245 -0.089 0.930
M11 -0.004706 0.106223 -0.044 0.965
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.1679 on 48 degrees of freedom
Multiple R-squared: 0.318, Adjusted R-squared: 0.1475
F-statistic: 1.865 on 12 and 48 DF, p-value: 0.0637
> 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 0.000000e+00 0.000000e+00
[2,] 1 0.000000e+00 0.000000e+00
[3,] 1 0.000000e+00 0.000000e+00
[4,] 1 0.000000e+00 0.000000e+00
[5,] 1 0.000000e+00 0.000000e+00
[6,] 1 0.000000e+00 0.000000e+00
[7,] 1 0.000000e+00 0.000000e+00
[8,] 1 1.995147e-313 9.975737e-314
[9,] 1 8.550811e-306 4.275405e-306
[10,] 1 8.347287e-291 4.173644e-291
[11,] 1 2.531072e-289 1.265536e-289
[12,] 1 9.249969e-263 4.624985e-263
[13,] 1 1.806006e-252 9.030030e-253
[14,] 1 4.509464e-236 2.254732e-236
[15,] 1 2.296436e-240 1.148218e-240
[16,] 1 2.093258e-218 1.046629e-218
[17,] 1 3.549372e-201 1.774686e-201
[18,] 1 2.466530e-186 1.233265e-186
[19,] 1 2.934338e-177 1.467169e-177
[20,] 1 3.941141e-170 1.970571e-170
[21,] 1 1.037729e-161 5.188646e-162
[22,] 1 4.001928e-139 2.000964e-139
[23,] 1 4.199988e-132 2.099994e-132
[24,] 1 2.649862e-114 1.324931e-114
[25,] 1 4.602547e-103 2.301274e-103
[26,] 1 4.243236e-88 2.121618e-88
[27,] 1 3.252568e-76 1.626284e-76
[28,] 1 2.174706e-64 1.087353e-64
[29,] 1 2.037917e-54 1.018959e-54
[30,] 1 6.308864e-39 3.154432e-39
> postscript(file="/var/www/html/rcomp/tmp/13zr71258726675.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/23zn41258726675.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/3hcd21258726675.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/4sl1s1258726675.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/5oulu1258726675.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 61
Frequency = 1
1 2 3 4 5
1.588235e-01 2.470588e-01 3.190588e-01 3.910588e-01 4.630588e-01
6 7 8 9 10
5.350588e-01 -1.129412e-01 -1.129412e-01 -1.129412e-01 -1.129412e-01
11 12 13 14 15
-1.129412e-01 -1.129412e-01 -1.447059e-01 -1.464706e-01 -1.644706e-01
16 17 18 19 20
-1.824706e-01 -2.004706e-01 -2.184706e-01 -5.647059e-02 -5.647059e-02
21 22 23 24 25
-5.647059e-02 -5.647059e-02 -5.647059e-02 -5.647059e-02 -8.823529e-02
26 27 28 29 30
-9.000000e-02 -1.080000e-01 -1.260000e-01 -1.440000e-01 -1.620000e-01
31 32 33 34 35
5.665607e-15 -5.752343e-15 0.000000e+00 5.641321e-15 -5.689893e-15
36 37 38 39 40
-2.567391e-16 -3.176471e-02 -3.352941e-02 -5.152941e-02 -6.952941e-02
41 42 43 44 45
-8.752941e-02 -1.055294e-01 5.647059e-02 5.647059e-02 5.647059e-02
46 47 48 49 50
5.647059e-02 5.647059e-02 5.647059e-02 2.470588e-02 2.294118e-02
51 52 53 54 55
4.941176e-03 -1.305882e-02 -3.105882e-02 -4.905882e-02 1.129412e-01
56 57 58 59 60
1.129412e-01 1.129412e-01 1.129412e-01 1.129412e-01 1.129412e-01
61
8.117647e-02
> postscript(file="/var/www/html/rcomp/tmp/674k51258726675.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 61
Frequency = 1
lag(myerror, k = 1) myerror
0 1.588235e-01 NA
1 2.470588e-01 1.588235e-01
2 3.190588e-01 2.470588e-01
3 3.910588e-01 3.190588e-01
4 4.630588e-01 3.910588e-01
5 5.350588e-01 4.630588e-01
6 -1.129412e-01 5.350588e-01
7 -1.129412e-01 -1.129412e-01
8 -1.129412e-01 -1.129412e-01
9 -1.129412e-01 -1.129412e-01
10 -1.129412e-01 -1.129412e-01
11 -1.129412e-01 -1.129412e-01
12 -1.447059e-01 -1.129412e-01
13 -1.464706e-01 -1.447059e-01
14 -1.644706e-01 -1.464706e-01
15 -1.824706e-01 -1.644706e-01
16 -2.004706e-01 -1.824706e-01
17 -2.184706e-01 -2.004706e-01
18 -5.647059e-02 -2.184706e-01
19 -5.647059e-02 -5.647059e-02
20 -5.647059e-02 -5.647059e-02
21 -5.647059e-02 -5.647059e-02
22 -5.647059e-02 -5.647059e-02
23 -5.647059e-02 -5.647059e-02
24 -8.823529e-02 -5.647059e-02
25 -9.000000e-02 -8.823529e-02
26 -1.080000e-01 -9.000000e-02
27 -1.260000e-01 -1.080000e-01
28 -1.440000e-01 -1.260000e-01
29 -1.620000e-01 -1.440000e-01
30 5.665607e-15 -1.620000e-01
31 -5.752343e-15 5.665607e-15
32 0.000000e+00 -5.752343e-15
33 5.641321e-15 0.000000e+00
34 -5.689893e-15 5.641321e-15
35 -2.567391e-16 -5.689893e-15
36 -3.176471e-02 -2.567391e-16
37 -3.352941e-02 -3.176471e-02
38 -5.152941e-02 -3.352941e-02
39 -6.952941e-02 -5.152941e-02
40 -8.752941e-02 -6.952941e-02
41 -1.055294e-01 -8.752941e-02
42 5.647059e-02 -1.055294e-01
43 5.647059e-02 5.647059e-02
44 5.647059e-02 5.647059e-02
45 5.647059e-02 5.647059e-02
46 5.647059e-02 5.647059e-02
47 5.647059e-02 5.647059e-02
48 2.470588e-02 5.647059e-02
49 2.294118e-02 2.470588e-02
50 4.941176e-03 2.294118e-02
51 -1.305882e-02 4.941176e-03
52 -3.105882e-02 -1.305882e-02
53 -4.905882e-02 -3.105882e-02
54 1.129412e-01 -4.905882e-02
55 1.129412e-01 1.129412e-01
56 1.129412e-01 1.129412e-01
57 1.129412e-01 1.129412e-01
58 1.129412e-01 1.129412e-01
59 1.129412e-01 1.129412e-01
60 8.117647e-02 1.129412e-01
61 NA 8.117647e-02
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.470588e-01 1.588235e-01
[2,] 3.190588e-01 2.470588e-01
[3,] 3.910588e-01 3.190588e-01
[4,] 4.630588e-01 3.910588e-01
[5,] 5.350588e-01 4.630588e-01
[6,] -1.129412e-01 5.350588e-01
[7,] -1.129412e-01 -1.129412e-01
[8,] -1.129412e-01 -1.129412e-01
[9,] -1.129412e-01 -1.129412e-01
[10,] -1.129412e-01 -1.129412e-01
[11,] -1.129412e-01 -1.129412e-01
[12,] -1.447059e-01 -1.129412e-01
[13,] -1.464706e-01 -1.447059e-01
[14,] -1.644706e-01 -1.464706e-01
[15,] -1.824706e-01 -1.644706e-01
[16,] -2.004706e-01 -1.824706e-01
[17,] -2.184706e-01 -2.004706e-01
[18,] -5.647059e-02 -2.184706e-01
[19,] -5.647059e-02 -5.647059e-02
[20,] -5.647059e-02 -5.647059e-02
[21,] -5.647059e-02 -5.647059e-02
[22,] -5.647059e-02 -5.647059e-02
[23,] -5.647059e-02 -5.647059e-02
[24,] -8.823529e-02 -5.647059e-02
[25,] -9.000000e-02 -8.823529e-02
[26,] -1.080000e-01 -9.000000e-02
[27,] -1.260000e-01 -1.080000e-01
[28,] -1.440000e-01 -1.260000e-01
[29,] -1.620000e-01 -1.440000e-01
[30,] 5.665607e-15 -1.620000e-01
[31,] -5.752343e-15 5.665607e-15
[32,] 0.000000e+00 -5.752343e-15
[33,] 5.641321e-15 0.000000e+00
[34,] -5.689893e-15 5.641321e-15
[35,] -2.567391e-16 -5.689893e-15
[36,] -3.176471e-02 -2.567391e-16
[37,] -3.352941e-02 -3.176471e-02
[38,] -5.152941e-02 -3.352941e-02
[39,] -6.952941e-02 -5.152941e-02
[40,] -8.752941e-02 -6.952941e-02
[41,] -1.055294e-01 -8.752941e-02
[42,] 5.647059e-02 -1.055294e-01
[43,] 5.647059e-02 5.647059e-02
[44,] 5.647059e-02 5.647059e-02
[45,] 5.647059e-02 5.647059e-02
[46,] 5.647059e-02 5.647059e-02
[47,] 5.647059e-02 5.647059e-02
[48,] 2.470588e-02 5.647059e-02
[49,] 2.294118e-02 2.470588e-02
[50,] 4.941176e-03 2.294118e-02
[51,] -1.305882e-02 4.941176e-03
[52,] -3.105882e-02 -1.305882e-02
[53,] -4.905882e-02 -3.105882e-02
[54,] 1.129412e-01 -4.905882e-02
[55,] 1.129412e-01 1.129412e-01
[56,] 1.129412e-01 1.129412e-01
[57,] 1.129412e-01 1.129412e-01
[58,] 1.129412e-01 1.129412e-01
[59,] 1.129412e-01 1.129412e-01
[60,] 8.117647e-02 1.129412e-01
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.470588e-01 1.588235e-01
2 3.190588e-01 2.470588e-01
3 3.910588e-01 3.190588e-01
4 4.630588e-01 3.910588e-01
5 5.350588e-01 4.630588e-01
6 -1.129412e-01 5.350588e-01
7 -1.129412e-01 -1.129412e-01
8 -1.129412e-01 -1.129412e-01
9 -1.129412e-01 -1.129412e-01
10 -1.129412e-01 -1.129412e-01
11 -1.129412e-01 -1.129412e-01
12 -1.447059e-01 -1.129412e-01
13 -1.464706e-01 -1.447059e-01
14 -1.644706e-01 -1.464706e-01
15 -1.824706e-01 -1.644706e-01
16 -2.004706e-01 -1.824706e-01
17 -2.184706e-01 -2.004706e-01
18 -5.647059e-02 -2.184706e-01
19 -5.647059e-02 -5.647059e-02
20 -5.647059e-02 -5.647059e-02
21 -5.647059e-02 -5.647059e-02
22 -5.647059e-02 -5.647059e-02
23 -5.647059e-02 -5.647059e-02
24 -8.823529e-02 -5.647059e-02
25 -9.000000e-02 -8.823529e-02
26 -1.080000e-01 -9.000000e-02
27 -1.260000e-01 -1.080000e-01
28 -1.440000e-01 -1.260000e-01
29 -1.620000e-01 -1.440000e-01
30 5.665607e-15 -1.620000e-01
31 -5.752343e-15 5.665607e-15
32 0.000000e+00 -5.752343e-15
33 5.641321e-15 0.000000e+00
34 -5.689893e-15 5.641321e-15
35 -2.567391e-16 -5.689893e-15
36 -3.176471e-02 -2.567391e-16
37 -3.352941e-02 -3.176471e-02
38 -5.152941e-02 -3.352941e-02
39 -6.952941e-02 -5.152941e-02
40 -8.752941e-02 -6.952941e-02
41 -1.055294e-01 -8.752941e-02
42 5.647059e-02 -1.055294e-01
43 5.647059e-02 5.647059e-02
44 5.647059e-02 5.647059e-02
45 5.647059e-02 5.647059e-02
46 5.647059e-02 5.647059e-02
47 5.647059e-02 5.647059e-02
48 2.470588e-02 5.647059e-02
49 2.294118e-02 2.470588e-02
50 4.941176e-03 2.294118e-02
51 -1.305882e-02 4.941176e-03
52 -3.105882e-02 -1.305882e-02
53 -4.905882e-02 -3.105882e-02
54 1.129412e-01 -4.905882e-02
55 1.129412e-01 1.129412e-01
56 1.129412e-01 1.129412e-01
57 1.129412e-01 1.129412e-01
58 1.129412e-01 1.129412e-01
59 1.129412e-01 1.129412e-01
60 8.117647e-02 1.129412e-01
> 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/7ekpv1258726676.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/8bfku1258726676.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/9a8y61258726676.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/102gzo1258726676.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/11d6an1258726676.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/12w6tc1258726676.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/13hsuu1258726676.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/14k3fm1258726676.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/15uch51258726676.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/16l59f1258726676.tab")
+ }
>
> system("convert tmp/13zr71258726675.ps tmp/13zr71258726675.png")
> system("convert tmp/23zn41258726675.ps tmp/23zn41258726675.png")
> system("convert tmp/3hcd21258726675.ps tmp/3hcd21258726675.png")
> system("convert tmp/4sl1s1258726675.ps tmp/4sl1s1258726675.png")
> system("convert tmp/5oulu1258726675.ps tmp/5oulu1258726675.png")
> system("convert tmp/674k51258726675.ps tmp/674k51258726675.png")
> system("convert tmp/7ekpv1258726676.ps tmp/7ekpv1258726676.png")
> system("convert tmp/8bfku1258726676.ps tmp/8bfku1258726676.png")
> system("convert tmp/9a8y61258726676.ps tmp/9a8y61258726676.png")
> system("convert tmp/102gzo1258726676.ps tmp/102gzo1258726676.png")
>
>
> proc.time()
user system elapsed
2.400 1.556 2.818