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(8.9,1.9,9,1.6,9,1.7,9,2,9,2.5,9,2.4,9,2.3,9,2.3,9,2.1,9,2.4,9,2.2,9.1,2.4,9,1.9,9,2.1,9.1,2.1,9,2.1,9,2,9,2.1,9,2.2,8.9,2.2,8.9,2.6,8.9,2.5,8.9,2.3,8.8,2.2,8.8,2.4,8.7,2.3,8.7,2.2,8.5,2.5,8.5,2.5,8.4,2.5,8.2,2.4,8.2,2.3,8.1,1.7,8.1,1.6,8,1.9,7.9,1.9,7.8,1.8,7.7,1.8,7.6,1.9,7.5,1.9,7.5,1.9,7.5,1.9,7.5,1.8,7.5,1.7,7.4,2.1,7.4,2.6,7.3,3.1,7.3,3.1,7.3,3.2,7.2,3.3,7.2,3.6,7.3,3.3,7.4,3.7,7.4,4,7.5,4,7.6,3.8,7.7,3.6,7.9,3.2,8,2.1,8.2,1.6),dim=c(2,60),dimnames=list(c('werkl','infl'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('werkl','infl'),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
werkl infl M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 8.9 1.9 1 0 0 0 0 0 0 0 0 0 0 1
2 9.0 1.6 0 1 0 0 0 0 0 0 0 0 0 2
3 9.0 1.7 0 0 1 0 0 0 0 0 0 0 0 3
4 9.0 2.0 0 0 0 1 0 0 0 0 0 0 0 4
5 9.0 2.5 0 0 0 0 1 0 0 0 0 0 0 5
6 9.0 2.4 0 0 0 0 0 1 0 0 0 0 0 6
7 9.0 2.3 0 0 0 0 0 0 1 0 0 0 0 7
8 9.0 2.3 0 0 0 0 0 0 0 1 0 0 0 8
9 9.0 2.1 0 0 0 0 0 0 0 0 1 0 0 9
10 9.0 2.4 0 0 0 0 0 0 0 0 0 1 0 10
11 9.0 2.2 0 0 0 0 0 0 0 0 0 0 1 11
12 9.1 2.4 0 0 0 0 0 0 0 0 0 0 0 12
13 9.0 1.9 1 0 0 0 0 0 0 0 0 0 0 13
14 9.0 2.1 0 1 0 0 0 0 0 0 0 0 0 14
15 9.1 2.1 0 0 1 0 0 0 0 0 0 0 0 15
16 9.0 2.1 0 0 0 1 0 0 0 0 0 0 0 16
17 9.0 2.0 0 0 0 0 1 0 0 0 0 0 0 17
18 9.0 2.1 0 0 0 0 0 1 0 0 0 0 0 18
19 9.0 2.2 0 0 0 0 0 0 1 0 0 0 0 19
20 8.9 2.2 0 0 0 0 0 0 0 1 0 0 0 20
21 8.9 2.6 0 0 0 0 0 0 0 0 1 0 0 21
22 8.9 2.5 0 0 0 0 0 0 0 0 0 1 0 22
23 8.9 2.3 0 0 0 0 0 0 0 0 0 0 1 23
24 8.8 2.2 0 0 0 0 0 0 0 0 0 0 0 24
25 8.8 2.4 1 0 0 0 0 0 0 0 0 0 0 25
26 8.7 2.3 0 1 0 0 0 0 0 0 0 0 0 26
27 8.7 2.2 0 0 1 0 0 0 0 0 0 0 0 27
28 8.5 2.5 0 0 0 1 0 0 0 0 0 0 0 28
29 8.5 2.5 0 0 0 0 1 0 0 0 0 0 0 29
30 8.4 2.5 0 0 0 0 0 1 0 0 0 0 0 30
31 8.2 2.4 0 0 0 0 0 0 1 0 0 0 0 31
32 8.2 2.3 0 0 0 0 0 0 0 1 0 0 0 32
33 8.1 1.7 0 0 0 0 0 0 0 0 1 0 0 33
34 8.1 1.6 0 0 0 0 0 0 0 0 0 1 0 34
35 8.0 1.9 0 0 0 0 0 0 0 0 0 0 1 35
36 7.9 1.9 0 0 0 0 0 0 0 0 0 0 0 36
37 7.8 1.8 1 0 0 0 0 0 0 0 0 0 0 37
38 7.7 1.8 0 1 0 0 0 0 0 0 0 0 0 38
39 7.6 1.9 0 0 1 0 0 0 0 0 0 0 0 39
40 7.5 1.9 0 0 0 1 0 0 0 0 0 0 0 40
41 7.5 1.9 0 0 0 0 1 0 0 0 0 0 0 41
42 7.5 1.9 0 0 0 0 0 1 0 0 0 0 0 42
43 7.5 1.8 0 0 0 0 0 0 1 0 0 0 0 43
44 7.5 1.7 0 0 0 0 0 0 0 1 0 0 0 44
45 7.4 2.1 0 0 0 0 0 0 0 0 1 0 0 45
46 7.4 2.6 0 0 0 0 0 0 0 0 0 1 0 46
47 7.3 3.1 0 0 0 0 0 0 0 0 0 0 1 47
48 7.3 3.1 0 0 0 0 0 0 0 0 0 0 0 48
49 7.3 3.2 1 0 0 0 0 0 0 0 0 0 0 49
50 7.2 3.3 0 1 0 0 0 0 0 0 0 0 0 50
51 7.2 3.6 0 0 1 0 0 0 0 0 0 0 0 51
52 7.3 3.3 0 0 0 1 0 0 0 0 0 0 0 52
53 7.4 3.7 0 0 0 0 1 0 0 0 0 0 0 53
54 7.4 4.0 0 0 0 0 0 1 0 0 0 0 0 54
55 7.5 4.0 0 0 0 0 0 0 1 0 0 0 0 55
56 7.6 3.8 0 0 0 0 0 0 0 1 0 0 0 56
57 7.7 3.6 0 0 0 0 0 0 0 0 1 0 0 57
58 7.9 3.2 0 0 0 0 0 0 0 0 0 1 0 58
59 8.0 2.1 0 0 0 0 0 0 0 0 0 0 1 59
60 8.2 1.6 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) infl M1 M2 M3 M4
9.50212 0.03828 -0.30573 -0.30808 -0.27426 -0.29967
M5 M6 M7 M8 M9 M10
-0.24891 -0.23432 -0.21591 -0.17596 -0.15755 -0.08219
M11 t
-0.05995 -0.03688
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.55030 -0.21461 -0.09272 0.22812 0.84974
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.502116 0.217124 43.764 <2e-16 ***
infl 0.038278 0.081753 0.468 0.642
M1 -0.305735 0.213143 -1.434 0.158
M2 -0.308084 0.212605 -1.449 0.154
M3 -0.274262 0.212696 -1.289 0.204
M4 -0.299673 0.212761 -1.408 0.166
M5 -0.248913 0.214034 -1.163 0.251
M6 -0.234325 0.214397 -1.093 0.280
M7 -0.215908 0.213464 -1.011 0.317
M8 -0.175961 0.212269 -0.829 0.411
M9 -0.157545 0.211676 -0.744 0.460
M10 -0.082191 0.211768 -0.388 0.700
M11 -0.059947 0.210832 -0.284 0.777
t -0.036885 0.002947 -12.517 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.3331 on 46 degrees of freedom
Multiple R-squared: 0.8167, Adjusted R-squared: 0.7649
F-statistic: 15.77 on 13 and 46 DF, p-value: 8.587e-13
> 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,] 2.092317e-03 4.184634e-03 0.997907683
[2,] 2.127925e-04 4.255850e-04 0.999787208
[3,] 2.109949e-05 4.219897e-05 0.999978901
[4,] 1.407319e-05 2.814637e-05 0.999985927
[5,] 6.941306e-06 1.388261e-05 0.999993059
[6,] 1.858637e-06 3.717274e-06 0.999998141
[7,] 4.404020e-07 8.808041e-07 0.999999560
[8,] 2.698103e-06 5.396206e-06 0.999997302
[9,] 1.092828e-06 2.185656e-06 0.999998907
[10,] 2.135253e-06 4.270506e-06 0.999997865
[11,] 5.838968e-06 1.167794e-05 0.999994161
[12,] 4.284529e-05 8.569057e-05 0.999957155
[13,] 1.974410e-04 3.948820e-04 0.999802559
[14,] 1.444463e-03 2.888925e-03 0.998555537
[15,] 1.489447e-02 2.978893e-02 0.985105534
[16,] 5.473763e-02 1.094753e-01 0.945262375
[17,] 9.939762e-02 1.987952e-01 0.900602380
[18,] 1.077029e-01 2.154057e-01 0.892297146
[19,] 2.124768e-01 4.249536e-01 0.787523185
[20,] 4.106508e-01 8.213017e-01 0.589349155
[21,] 5.701194e-01 8.597613e-01 0.429880646
[22,] 8.125998e-01 3.748003e-01 0.187400172
[23,] 9.470947e-01 1.058105e-01 0.052905274
[24,] 9.889411e-01 2.211788e-02 0.011058942
[25,] 9.919359e-01 1.612814e-02 0.008064068
[26,] 9.948298e-01 1.034030e-02 0.005170152
[27,] 9.902603e-01 1.947932e-02 0.009739661
> postscript(file="/var/www/html/rcomp/tmp/115ur1259345182.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/29gxm1259345182.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/33n4s1259345182.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/4p2951259345182.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/5mbh81259345182.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.33222496 -0.18150704 -0.18227260 -0.13145939 -0.16447402 -0.13834949
7 8 9 10 11 12
-0.11605279 -0.11911506 -0.09299053 -0.14294289 -0.12064619 -0.05136411
13 14 15 16 17 18
0.21039483 0.24197360 0.34503587 0.30733257 0.29728493 0.31575379
19 20 21 22 23 24
0.33039483 0.22733257 0.23049011 0.19584908 0.21814577 0.09891134
25 26 27 28 29 30
0.43387547 0.37693774 0.38382783 0.23464104 0.22076557 0.14306226
31 32 33 34 35 36
-0.03464104 -0.03387547 -0.09243962 -0.12708066 -0.22392311 -0.34698538
37 38 39 40 41 42
-0.10053775 -0.16130332 -0.26206889 -0.29977219 -0.31364766 -0.29135096
43 44 45 46 47 48
-0.26905426 -0.26828870 -0.36513115 -0.42273917 -0.52723729 -0.55029955
49 50 51 52 53 54
-0.21150759 -0.27610098 -0.28452221 -0.11074202 -0.03992881 -0.02911561
55 56 57 58 59 60
0.08935326 0.19394666 0.32007119 0.49691364 0.65366081 0.84973770
> postscript(file="/var/www/html/rcomp/tmp/6vcn01259345182.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.33222496 NA
1 -0.18150704 -0.33222496
2 -0.18227260 -0.18150704
3 -0.13145939 -0.18227260
4 -0.16447402 -0.13145939
5 -0.13834949 -0.16447402
6 -0.11605279 -0.13834949
7 -0.11911506 -0.11605279
8 -0.09299053 -0.11911506
9 -0.14294289 -0.09299053
10 -0.12064619 -0.14294289
11 -0.05136411 -0.12064619
12 0.21039483 -0.05136411
13 0.24197360 0.21039483
14 0.34503587 0.24197360
15 0.30733257 0.34503587
16 0.29728493 0.30733257
17 0.31575379 0.29728493
18 0.33039483 0.31575379
19 0.22733257 0.33039483
20 0.23049011 0.22733257
21 0.19584908 0.23049011
22 0.21814577 0.19584908
23 0.09891134 0.21814577
24 0.43387547 0.09891134
25 0.37693774 0.43387547
26 0.38382783 0.37693774
27 0.23464104 0.38382783
28 0.22076557 0.23464104
29 0.14306226 0.22076557
30 -0.03464104 0.14306226
31 -0.03387547 -0.03464104
32 -0.09243962 -0.03387547
33 -0.12708066 -0.09243962
34 -0.22392311 -0.12708066
35 -0.34698538 -0.22392311
36 -0.10053775 -0.34698538
37 -0.16130332 -0.10053775
38 -0.26206889 -0.16130332
39 -0.29977219 -0.26206889
40 -0.31364766 -0.29977219
41 -0.29135096 -0.31364766
42 -0.26905426 -0.29135096
43 -0.26828870 -0.26905426
44 -0.36513115 -0.26828870
45 -0.42273917 -0.36513115
46 -0.52723729 -0.42273917
47 -0.55029955 -0.52723729
48 -0.21150759 -0.55029955
49 -0.27610098 -0.21150759
50 -0.28452221 -0.27610098
51 -0.11074202 -0.28452221
52 -0.03992881 -0.11074202
53 -0.02911561 -0.03992881
54 0.08935326 -0.02911561
55 0.19394666 0.08935326
56 0.32007119 0.19394666
57 0.49691364 0.32007119
58 0.65366081 0.49691364
59 0.84973770 0.65366081
60 NA 0.84973770
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.18150704 -0.33222496
[2,] -0.18227260 -0.18150704
[3,] -0.13145939 -0.18227260
[4,] -0.16447402 -0.13145939
[5,] -0.13834949 -0.16447402
[6,] -0.11605279 -0.13834949
[7,] -0.11911506 -0.11605279
[8,] -0.09299053 -0.11911506
[9,] -0.14294289 -0.09299053
[10,] -0.12064619 -0.14294289
[11,] -0.05136411 -0.12064619
[12,] 0.21039483 -0.05136411
[13,] 0.24197360 0.21039483
[14,] 0.34503587 0.24197360
[15,] 0.30733257 0.34503587
[16,] 0.29728493 0.30733257
[17,] 0.31575379 0.29728493
[18,] 0.33039483 0.31575379
[19,] 0.22733257 0.33039483
[20,] 0.23049011 0.22733257
[21,] 0.19584908 0.23049011
[22,] 0.21814577 0.19584908
[23,] 0.09891134 0.21814577
[24,] 0.43387547 0.09891134
[25,] 0.37693774 0.43387547
[26,] 0.38382783 0.37693774
[27,] 0.23464104 0.38382783
[28,] 0.22076557 0.23464104
[29,] 0.14306226 0.22076557
[30,] -0.03464104 0.14306226
[31,] -0.03387547 -0.03464104
[32,] -0.09243962 -0.03387547
[33,] -0.12708066 -0.09243962
[34,] -0.22392311 -0.12708066
[35,] -0.34698538 -0.22392311
[36,] -0.10053775 -0.34698538
[37,] -0.16130332 -0.10053775
[38,] -0.26206889 -0.16130332
[39,] -0.29977219 -0.26206889
[40,] -0.31364766 -0.29977219
[41,] -0.29135096 -0.31364766
[42,] -0.26905426 -0.29135096
[43,] -0.26828870 -0.26905426
[44,] -0.36513115 -0.26828870
[45,] -0.42273917 -0.36513115
[46,] -0.52723729 -0.42273917
[47,] -0.55029955 -0.52723729
[48,] -0.21150759 -0.55029955
[49,] -0.27610098 -0.21150759
[50,] -0.28452221 -0.27610098
[51,] -0.11074202 -0.28452221
[52,] -0.03992881 -0.11074202
[53,] -0.02911561 -0.03992881
[54,] 0.08935326 -0.02911561
[55,] 0.19394666 0.08935326
[56,] 0.32007119 0.19394666
[57,] 0.49691364 0.32007119
[58,] 0.65366081 0.49691364
[59,] 0.84973770 0.65366081
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.18150704 -0.33222496
2 -0.18227260 -0.18150704
3 -0.13145939 -0.18227260
4 -0.16447402 -0.13145939
5 -0.13834949 -0.16447402
6 -0.11605279 -0.13834949
7 -0.11911506 -0.11605279
8 -0.09299053 -0.11911506
9 -0.14294289 -0.09299053
10 -0.12064619 -0.14294289
11 -0.05136411 -0.12064619
12 0.21039483 -0.05136411
13 0.24197360 0.21039483
14 0.34503587 0.24197360
15 0.30733257 0.34503587
16 0.29728493 0.30733257
17 0.31575379 0.29728493
18 0.33039483 0.31575379
19 0.22733257 0.33039483
20 0.23049011 0.22733257
21 0.19584908 0.23049011
22 0.21814577 0.19584908
23 0.09891134 0.21814577
24 0.43387547 0.09891134
25 0.37693774 0.43387547
26 0.38382783 0.37693774
27 0.23464104 0.38382783
28 0.22076557 0.23464104
29 0.14306226 0.22076557
30 -0.03464104 0.14306226
31 -0.03387547 -0.03464104
32 -0.09243962 -0.03387547
33 -0.12708066 -0.09243962
34 -0.22392311 -0.12708066
35 -0.34698538 -0.22392311
36 -0.10053775 -0.34698538
37 -0.16130332 -0.10053775
38 -0.26206889 -0.16130332
39 -0.29977219 -0.26206889
40 -0.31364766 -0.29977219
41 -0.29135096 -0.31364766
42 -0.26905426 -0.29135096
43 -0.26828870 -0.26905426
44 -0.36513115 -0.26828870
45 -0.42273917 -0.36513115
46 -0.52723729 -0.42273917
47 -0.55029955 -0.52723729
48 -0.21150759 -0.55029955
49 -0.27610098 -0.21150759
50 -0.28452221 -0.27610098
51 -0.11074202 -0.28452221
52 -0.03992881 -0.11074202
53 -0.02911561 -0.03992881
54 0.08935326 -0.02911561
55 0.19394666 0.08935326
56 0.32007119 0.19394666
57 0.49691364 0.32007119
58 0.65366081 0.49691364
59 0.84973770 0.65366081
> 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/7r8nx1259345182.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/8ksjp1259345182.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/92oyv1259345182.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/10con21259345182.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/11wii61259345182.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/12jgef1259345182.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/130xar1259345183.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/143dgj1259345183.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/15n4vp1259345183.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/16000b1259345183.tab")
+ }
>
> system("convert tmp/115ur1259345182.ps tmp/115ur1259345182.png")
> system("convert tmp/29gxm1259345182.ps tmp/29gxm1259345182.png")
> system("convert tmp/33n4s1259345182.ps tmp/33n4s1259345182.png")
> system("convert tmp/4p2951259345182.ps tmp/4p2951259345182.png")
> system("convert tmp/5mbh81259345182.ps tmp/5mbh81259345182.png")
> system("convert tmp/6vcn01259345182.ps tmp/6vcn01259345182.png")
> system("convert tmp/7r8nx1259345182.ps tmp/7r8nx1259345182.png")
> system("convert tmp/8ksjp1259345182.ps tmp/8ksjp1259345182.png")
> system("convert tmp/92oyv1259345182.ps tmp/92oyv1259345182.png")
> system("convert tmp/10con21259345182.ps tmp/10con21259345182.png")
>
>
> proc.time()
user system elapsed
2.371 1.537 3.255