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(105.8
+ ,93.7
+ ,105.9
+ ,106
+ ,106.1
+ ,105.7
+ ,105.7
+ ,104.5
+ ,105.8
+ ,105.9
+ ,106
+ ,106.1
+ ,105.6
+ ,95.4
+ ,105.7
+ ,105.8
+ ,105.9
+ ,106
+ ,105.4
+ ,86.5
+ ,105.6
+ ,105.7
+ ,105.8
+ ,105.9
+ ,105.4
+ ,102.9
+ ,105.4
+ ,105.6
+ ,105.7
+ ,105.8
+ ,105.5
+ ,101.9
+ ,105.4
+ ,105.4
+ ,105.6
+ ,105.7
+ ,105.6
+ ,103.7
+ ,105.5
+ ,105.4
+ ,105.4
+ ,105.6
+ ,105.7
+ ,100.7
+ ,105.6
+ ,105.5
+ ,105.4
+ ,105.4
+ ,105.9
+ ,94.2
+ ,105.7
+ ,105.6
+ ,105.5
+ ,105.4
+ ,106.1
+ ,93.6
+ ,105.9
+ ,105.7
+ ,105.6
+ ,105.5
+ ,106
+ ,104.7
+ ,106.1
+ ,105.9
+ ,105.7
+ ,105.6
+ ,105.8
+ ,101
+ ,106
+ ,106.1
+ ,105.9
+ ,105.7
+ ,105.8
+ ,97.6
+ ,105.8
+ ,106
+ ,106.1
+ ,105.9
+ ,105.7
+ ,105.8
+ ,105.8
+ ,105.8
+ ,106
+ ,106.1
+ ,105.5
+ ,93.7
+ ,105.7
+ ,105.8
+ ,105.8
+ ,106
+ ,105.3
+ ,91.2
+ ,105.5
+ ,105.7
+ ,105.8
+ ,105.8
+ ,105.2
+ ,106.3
+ ,105.3
+ ,105.5
+ ,105.7
+ ,105.8
+ ,105.2
+ ,103.4
+ ,105.2
+ ,105.3
+ ,105.5
+ ,105.7
+ ,105
+ ,107.4
+ ,105.2
+ ,105.2
+ ,105.3
+ ,105.5
+ ,105.1
+ ,101.2
+ ,105
+ ,105.2
+ ,105.2
+ ,105.3
+ ,105.1
+ ,96.9
+ ,105.1
+ ,105
+ ,105.2
+ ,105.2
+ ,105.2
+ ,96.3
+ ,105.1
+ ,105.1
+ ,105
+ ,105.2
+ ,104.9
+ ,109.8
+ ,105.2
+ ,105.1
+ ,105.1
+ ,105
+ ,104.8
+ ,97.9
+ ,104.9
+ ,105.2
+ ,105.1
+ ,105.1
+ ,104.5
+ ,105.1
+ ,104.8
+ ,104.9
+ ,105.2
+ ,105.1
+ ,104.5
+ ,107.9
+ ,104.5
+ ,104.8
+ ,104.9
+ ,105.2
+ ,104.4
+ ,95
+ ,104.5
+ ,104.5
+ ,104.8
+ ,104.9
+ ,104.4
+ ,95.2
+ ,104.4
+ ,104.5
+ ,104.5
+ ,104.8
+ ,104.2
+ ,105.8
+ ,104.4
+ ,104.4
+ ,104.5
+ ,104.5
+ ,104.1
+ ,110.1
+ ,104.2
+ ,104.4
+ ,104.4
+ ,104.5
+ ,103.9
+ ,112.2
+ ,104.1
+ ,104.2
+ ,104.4
+ ,104.4
+ ,103.8
+ ,102.5
+ ,103.9
+ ,104.1
+ ,104.2
+ ,104.4
+ ,103.9
+ ,103.7
+ ,103.8
+ ,103.9
+ ,104.1
+ ,104.2
+ ,104.2
+ ,102
+ ,103.9
+ ,103.8
+ ,103.9
+ ,104.1
+ ,104.1
+ ,112.3
+ ,104.2
+ ,103.9
+ ,103.8
+ ,103.9
+ ,103.8
+ ,103.3
+ ,104.1
+ ,104.2
+ ,103.9
+ ,103.8
+ ,103.6
+ ,106.9
+ ,103.8
+ ,104.1
+ ,104.2
+ ,103.9
+ ,103.7
+ ,104.6
+ ,103.6
+ ,103.8
+ ,104.1
+ ,104.2
+ ,103.5
+ ,100.7
+ ,103.7
+ ,103.6
+ ,103.8
+ ,104.1
+ ,103.4
+ ,99
+ ,103.5
+ ,103.7
+ ,103.6
+ ,103.8
+ ,103.1
+ ,106.5
+ ,103.4
+ ,103.5
+ ,103.7
+ ,103.6
+ ,103.1
+ ,114.9
+ ,103.1
+ ,103.4
+ ,103.5
+ ,103.7
+ ,103.1
+ ,114.1
+ ,103.1
+ ,103.1
+ ,103.4
+ ,103.5
+ ,103.2
+ ,102.2
+ ,103.1
+ ,103.1
+ ,103.1
+ ,103.4
+ ,103.3
+ ,107
+ ,103.2
+ ,103.1
+ ,103.1
+ ,103.1
+ ,103.5
+ ,107.4
+ ,103.3
+ ,103.2
+ ,103.1
+ ,103.1
+ ,103.6
+ ,107.4
+ ,103.5
+ ,103.3
+ ,103.2
+ ,103.1
+ ,103.5
+ ,110.1
+ ,103.6
+ ,103.5
+ ,103.3
+ ,103.2
+ ,103.3
+ ,105.6
+ ,103.5
+ ,103.6
+ ,103.5
+ ,103.3
+ ,103.2
+ ,110.9
+ ,103.3
+ ,103.5
+ ,103.6
+ ,103.5
+ ,103.1
+ ,101.9
+ ,103.2
+ ,103.3
+ ,103.5
+ ,103.6
+ ,103.2
+ ,93.2
+ ,103.1
+ ,103.2
+ ,103.3
+ ,103.5
+ ,103
+ ,110.5
+ ,103.2
+ ,103.1
+ ,103.2
+ ,103.3
+ ,103
+ ,113.1
+ ,103
+ ,103.2
+ ,103.1
+ ,103.2
+ ,103.1
+ ,101.7
+ ,103
+ ,103
+ ,103.2
+ ,103.1
+ ,103.4
+ ,96.7
+ ,103.1
+ ,103
+ ,103
+ ,103.2)
+ ,dim=c(6
+ ,56)
+ ,dimnames=list(c('Werkl'
+ ,'Infl'
+ ,'Yt-1'
+ ,'Yt-2'
+ ,'Yt-3'
+ ,'Yt-4')
+ ,1:56))
> y <- array(NA,dim=c(6,56),dimnames=list(c('Werkl','Infl','Yt-1','Yt-2','Yt-3','Yt-4'),1:56))
> 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 Yt-1 Yt-2 Yt-3 Yt-4 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 105.8 93.7 105.9 106.0 106.1 105.7 1 0 0 0 0 0 0 0 0 0 0 1
2 105.7 104.5 105.8 105.9 106.0 106.1 0 1 0 0 0 0 0 0 0 0 0 2
3 105.6 95.4 105.7 105.8 105.9 106.0 0 0 1 0 0 0 0 0 0 0 0 3
4 105.4 86.5 105.6 105.7 105.8 105.9 0 0 0 1 0 0 0 0 0 0 0 4
5 105.4 102.9 105.4 105.6 105.7 105.8 0 0 0 0 1 0 0 0 0 0 0 5
6 105.5 101.9 105.4 105.4 105.6 105.7 0 0 0 0 0 1 0 0 0 0 0 6
7 105.6 103.7 105.5 105.4 105.4 105.6 0 0 0 0 0 0 1 0 0 0 0 7
8 105.7 100.7 105.6 105.5 105.4 105.4 0 0 0 0 0 0 0 1 0 0 0 8
9 105.9 94.2 105.7 105.6 105.5 105.4 0 0 0 0 0 0 0 0 1 0 0 9
10 106.1 93.6 105.9 105.7 105.6 105.5 0 0 0 0 0 0 0 0 0 1 0 10
11 106.0 104.7 106.1 105.9 105.7 105.6 0 0 0 0 0 0 0 0 0 0 1 11
12 105.8 101.0 106.0 106.1 105.9 105.7 0 0 0 0 0 0 0 0 0 0 0 12
13 105.8 97.6 105.8 106.0 106.1 105.9 1 0 0 0 0 0 0 0 0 0 0 13
14 105.7 105.8 105.8 105.8 106.0 106.1 0 1 0 0 0 0 0 0 0 0 0 14
15 105.5 93.7 105.7 105.8 105.8 106.0 0 0 1 0 0 0 0 0 0 0 0 15
16 105.3 91.2 105.5 105.7 105.8 105.8 0 0 0 1 0 0 0 0 0 0 0 16
17 105.2 106.3 105.3 105.5 105.7 105.8 0 0 0 0 1 0 0 0 0 0 0 17
18 105.2 103.4 105.2 105.3 105.5 105.7 0 0 0 0 0 1 0 0 0 0 0 18
19 105.0 107.4 105.2 105.2 105.3 105.5 0 0 0 0 0 0 1 0 0 0 0 19
20 105.1 101.2 105.0 105.2 105.2 105.3 0 0 0 0 0 0 0 1 0 0 0 20
21 105.1 96.9 105.1 105.0 105.2 105.2 0 0 0 0 0 0 0 0 1 0 0 21
22 105.2 96.3 105.1 105.1 105.0 105.2 0 0 0 0 0 0 0 0 0 1 0 22
23 104.9 109.8 105.2 105.1 105.1 105.0 0 0 0 0 0 0 0 0 0 0 1 23
24 104.8 97.9 104.9 105.2 105.1 105.1 0 0 0 0 0 0 0 0 0 0 0 24
25 104.5 105.1 104.8 104.9 105.2 105.1 1 0 0 0 0 0 0 0 0 0 0 25
26 104.5 107.9 104.5 104.8 104.9 105.2 0 1 0 0 0 0 0 0 0 0 0 26
27 104.4 95.0 104.5 104.5 104.8 104.9 0 0 1 0 0 0 0 0 0 0 0 27
28 104.4 95.2 104.4 104.5 104.5 104.8 0 0 0 1 0 0 0 0 0 0 0 28
29 104.2 105.8 104.4 104.4 104.5 104.5 0 0 0 0 1 0 0 0 0 0 0 29
30 104.1 110.1 104.2 104.4 104.4 104.5 0 0 0 0 0 1 0 0 0 0 0 30
31 103.9 112.2 104.1 104.2 104.4 104.4 0 0 0 0 0 0 1 0 0 0 0 31
32 103.8 102.5 103.9 104.1 104.2 104.4 0 0 0 0 0 0 0 1 0 0 0 32
33 103.9 103.7 103.8 103.9 104.1 104.2 0 0 0 0 0 0 0 0 1 0 0 33
34 104.2 102.0 103.9 103.8 103.9 104.1 0 0 0 0 0 0 0 0 0 1 0 34
35 104.1 112.3 104.2 103.9 103.8 103.9 0 0 0 0 0 0 0 0 0 0 1 35
36 103.8 103.3 104.1 104.2 103.9 103.8 0 0 0 0 0 0 0 0 0 0 0 36
37 103.6 106.9 103.8 104.1 104.2 103.9 1 0 0 0 0 0 0 0 0 0 0 37
38 103.7 104.6 103.6 103.8 104.1 104.2 0 1 0 0 0 0 0 0 0 0 0 38
39 103.5 100.7 103.7 103.6 103.8 104.1 0 0 1 0 0 0 0 0 0 0 0 39
40 103.4 99.0 103.5 103.7 103.6 103.8 0 0 0 1 0 0 0 0 0 0 0 40
41 103.1 106.5 103.4 103.5 103.7 103.6 0 0 0 0 1 0 0 0 0 0 0 41
42 103.1 114.9 103.1 103.4 103.5 103.7 0 0 0 0 0 1 0 0 0 0 0 42
43 103.1 114.1 103.1 103.1 103.4 103.5 0 0 0 0 0 0 1 0 0 0 0 43
44 103.2 102.2 103.1 103.1 103.1 103.4 0 0 0 0 0 0 0 1 0 0 0 44
45 103.3 107.0 103.2 103.1 103.1 103.1 0 0 0 0 0 0 0 0 1 0 0 45
46 103.5 107.4 103.3 103.2 103.1 103.1 0 0 0 0 0 0 0 0 0 1 0 46
47 103.6 107.4 103.5 103.3 103.2 103.1 0 0 0 0 0 0 0 0 0 0 1 47
48 103.5 110.1 103.6 103.5 103.3 103.2 0 0 0 0 0 0 0 0 0 0 0 48
49 103.3 105.6 103.5 103.6 103.5 103.3 1 0 0 0 0 0 0 0 0 0 0 49
50 103.2 110.9 103.3 103.5 103.6 103.5 0 1 0 0 0 0 0 0 0 0 0 50
51 103.1 101.9 103.2 103.3 103.5 103.6 0 0 1 0 0 0 0 0 0 0 0 51
52 103.2 93.2 103.1 103.2 103.3 103.5 0 0 0 1 0 0 0 0 0 0 0 52
53 103.0 110.5 103.2 103.1 103.2 103.3 0 0 0 0 1 0 0 0 0 0 0 53
54 103.0 113.1 103.0 103.2 103.1 103.2 0 0 0 0 0 1 0 0 0 0 0 54
55 103.1 101.7 103.0 103.0 103.2 103.1 0 0 0 0 0 0 1 0 0 0 0 55
56 103.4 96.7 103.1 103.0 103.0 103.2 0 0 0 0 0 0 0 1 0 0 0 56
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Infl `Yt-1` `Yt-2` `Yt-3` `Yt-4`
13.181305 -0.016750 1.017048 0.018372 -0.304695 0.159093
M1 M2 M3 M4 M5 M6
0.062392 0.205812 -0.077533 -0.106743 0.057899 0.227318
M7 M8 M9 M10 M11 t
0.177075 0.165128 0.204067 0.271448 0.142836 -0.003325
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.17644 -0.06214 0.01180 0.06365 0.16340
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 13.181305 6.770538 1.947 0.05897 .
Infl -0.016750 0.004804 -3.487 0.00125 **
`Yt-1` 1.017048 0.151537 6.712 6.06e-08 ***
`Yt-2` 0.018372 0.220522 0.083 0.93404
`Yt-3` -0.304695 0.221958 -1.373 0.17788
`Yt-4` 0.159093 0.147438 1.079 0.28737
M1 0.062392 0.085715 0.728 0.47113
M2 0.205812 0.092299 2.230 0.03174 *
M3 -0.077533 0.097660 -0.794 0.43218
M4 -0.106743 0.100624 -1.061 0.29547
M5 0.057899 0.089024 0.650 0.51936
M6 0.227318 0.089078 2.552 0.01486 *
M7 0.177075 0.095133 1.861 0.07044 .
M8 0.165128 0.087082 1.896 0.06555 .
M9 0.204067 0.090057 2.266 0.02923 *
M10 0.271448 0.087615 3.098 0.00365 **
M11 0.142836 0.093264 1.532 0.13392
t -0.003325 0.003697 -0.899 0.37417
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.1025 on 38 degrees of freedom
Multiple R-squared: 0.993, Adjusted R-squared: 0.9899
F-statistic: 318.5 on 17 and 38 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.7475151 0.50496972 0.25248486
[2,] 0.7245964 0.55080728 0.27540364
[3,] 0.6759753 0.64804943 0.32402471
[4,] 0.7596246 0.48075078 0.24037539
[5,] 0.7402807 0.51943853 0.25971926
[6,] 0.7913067 0.41738656 0.20869328
[7,] 0.7422455 0.51550899 0.25775449
[8,] 0.7329506 0.53409875 0.26704937
[9,] 0.9661310 0.06773798 0.03386899
[10,] 0.9498395 0.10032109 0.05016054
[11,] 0.9376564 0.12468714 0.06234357
[12,] 0.9345639 0.13087214 0.06543607
[13,] 0.8843279 0.23134412 0.11567206
[14,] 0.8192343 0.36153146 0.18076573
[15,] 0.7711347 0.45773065 0.22886533
> postscript(file="/var/www/html/rcomp/tmp/1nrwi1258707573.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/2b89e1258707573.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/365v51258707573.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/430741258707573.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/5641f1258707573.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 = 56
Frequency = 1
1 2 3 4 5
-0.0117053792 -0.0614656237 0.0617616551 -0.1657967423 0.1382717861
6 7 8 9 10
0.0445421809 0.0815256785 0.0748240793 0.0572620155 -0.0075303100
11 12 13 14 15
0.0178071466 0.0450532072 0.1634027754 0.0020436074 -0.0572857376
16 17 18 19 20
-0.0295606359 0.1386607785 -0.0156584868 -0.1223737272 0.0938068415
21 22 23 24 25
-0.0959539235 -0.1328358456 -0.1141913053 0.0200127155 -0.0807692754
26 27 28 29 30
0.0256692263 0.0190347886 0.0811249774 -0.0530778203 -0.0742066107
31 32 33 34 35
-0.0641751163 -0.1670704475 0.0241430908 0.0867150670 -0.0144261436
36 37 38 39 40
-0.1764430074 0.0072400462 0.0593435935 -0.0928407117 -0.0004196900
41 42 43 44 45
-0.1684452383 0.0362640301 0.0832927716 -0.0762594970 0.0145488172
46 47 48 49 50
0.0536510886 0.1108103024 0.1113770848 -0.0781681669 -0.0255908036
51 52 53 54 55
0.0693300057 0.1146520908 -0.0554095060 0.0090588864 0.0217303934
56
0.0746990236
> postscript(file="/var/www/html/rcomp/tmp/6u28c1258707573.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 = 56
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.0117053792 NA
1 -0.0614656237 -0.0117053792
2 0.0617616551 -0.0614656237
3 -0.1657967423 0.0617616551
4 0.1382717861 -0.1657967423
5 0.0445421809 0.1382717861
6 0.0815256785 0.0445421809
7 0.0748240793 0.0815256785
8 0.0572620155 0.0748240793
9 -0.0075303100 0.0572620155
10 0.0178071466 -0.0075303100
11 0.0450532072 0.0178071466
12 0.1634027754 0.0450532072
13 0.0020436074 0.1634027754
14 -0.0572857376 0.0020436074
15 -0.0295606359 -0.0572857376
16 0.1386607785 -0.0295606359
17 -0.0156584868 0.1386607785
18 -0.1223737272 -0.0156584868
19 0.0938068415 -0.1223737272
20 -0.0959539235 0.0938068415
21 -0.1328358456 -0.0959539235
22 -0.1141913053 -0.1328358456
23 0.0200127155 -0.1141913053
24 -0.0807692754 0.0200127155
25 0.0256692263 -0.0807692754
26 0.0190347886 0.0256692263
27 0.0811249774 0.0190347886
28 -0.0530778203 0.0811249774
29 -0.0742066107 -0.0530778203
30 -0.0641751163 -0.0742066107
31 -0.1670704475 -0.0641751163
32 0.0241430908 -0.1670704475
33 0.0867150670 0.0241430908
34 -0.0144261436 0.0867150670
35 -0.1764430074 -0.0144261436
36 0.0072400462 -0.1764430074
37 0.0593435935 0.0072400462
38 -0.0928407117 0.0593435935
39 -0.0004196900 -0.0928407117
40 -0.1684452383 -0.0004196900
41 0.0362640301 -0.1684452383
42 0.0832927716 0.0362640301
43 -0.0762594970 0.0832927716
44 0.0145488172 -0.0762594970
45 0.0536510886 0.0145488172
46 0.1108103024 0.0536510886
47 0.1113770848 0.1108103024
48 -0.0781681669 0.1113770848
49 -0.0255908036 -0.0781681669
50 0.0693300057 -0.0255908036
51 0.1146520908 0.0693300057
52 -0.0554095060 0.1146520908
53 0.0090588864 -0.0554095060
54 0.0217303934 0.0090588864
55 0.0746990236 0.0217303934
56 NA 0.0746990236
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.0614656237 -0.0117053792
[2,] 0.0617616551 -0.0614656237
[3,] -0.1657967423 0.0617616551
[4,] 0.1382717861 -0.1657967423
[5,] 0.0445421809 0.1382717861
[6,] 0.0815256785 0.0445421809
[7,] 0.0748240793 0.0815256785
[8,] 0.0572620155 0.0748240793
[9,] -0.0075303100 0.0572620155
[10,] 0.0178071466 -0.0075303100
[11,] 0.0450532072 0.0178071466
[12,] 0.1634027754 0.0450532072
[13,] 0.0020436074 0.1634027754
[14,] -0.0572857376 0.0020436074
[15,] -0.0295606359 -0.0572857376
[16,] 0.1386607785 -0.0295606359
[17,] -0.0156584868 0.1386607785
[18,] -0.1223737272 -0.0156584868
[19,] 0.0938068415 -0.1223737272
[20,] -0.0959539235 0.0938068415
[21,] -0.1328358456 -0.0959539235
[22,] -0.1141913053 -0.1328358456
[23,] 0.0200127155 -0.1141913053
[24,] -0.0807692754 0.0200127155
[25,] 0.0256692263 -0.0807692754
[26,] 0.0190347886 0.0256692263
[27,] 0.0811249774 0.0190347886
[28,] -0.0530778203 0.0811249774
[29,] -0.0742066107 -0.0530778203
[30,] -0.0641751163 -0.0742066107
[31,] -0.1670704475 -0.0641751163
[32,] 0.0241430908 -0.1670704475
[33,] 0.0867150670 0.0241430908
[34,] -0.0144261436 0.0867150670
[35,] -0.1764430074 -0.0144261436
[36,] 0.0072400462 -0.1764430074
[37,] 0.0593435935 0.0072400462
[38,] -0.0928407117 0.0593435935
[39,] -0.0004196900 -0.0928407117
[40,] -0.1684452383 -0.0004196900
[41,] 0.0362640301 -0.1684452383
[42,] 0.0832927716 0.0362640301
[43,] -0.0762594970 0.0832927716
[44,] 0.0145488172 -0.0762594970
[45,] 0.0536510886 0.0145488172
[46,] 0.1108103024 0.0536510886
[47,] 0.1113770848 0.1108103024
[48,] -0.0781681669 0.1113770848
[49,] -0.0255908036 -0.0781681669
[50,] 0.0693300057 -0.0255908036
[51,] 0.1146520908 0.0693300057
[52,] -0.0554095060 0.1146520908
[53,] 0.0090588864 -0.0554095060
[54,] 0.0217303934 0.0090588864
[55,] 0.0746990236 0.0217303934
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.0614656237 -0.0117053792
2 0.0617616551 -0.0614656237
3 -0.1657967423 0.0617616551
4 0.1382717861 -0.1657967423
5 0.0445421809 0.1382717861
6 0.0815256785 0.0445421809
7 0.0748240793 0.0815256785
8 0.0572620155 0.0748240793
9 -0.0075303100 0.0572620155
10 0.0178071466 -0.0075303100
11 0.0450532072 0.0178071466
12 0.1634027754 0.0450532072
13 0.0020436074 0.1634027754
14 -0.0572857376 0.0020436074
15 -0.0295606359 -0.0572857376
16 0.1386607785 -0.0295606359
17 -0.0156584868 0.1386607785
18 -0.1223737272 -0.0156584868
19 0.0938068415 -0.1223737272
20 -0.0959539235 0.0938068415
21 -0.1328358456 -0.0959539235
22 -0.1141913053 -0.1328358456
23 0.0200127155 -0.1141913053
24 -0.0807692754 0.0200127155
25 0.0256692263 -0.0807692754
26 0.0190347886 0.0256692263
27 0.0811249774 0.0190347886
28 -0.0530778203 0.0811249774
29 -0.0742066107 -0.0530778203
30 -0.0641751163 -0.0742066107
31 -0.1670704475 -0.0641751163
32 0.0241430908 -0.1670704475
33 0.0867150670 0.0241430908
34 -0.0144261436 0.0867150670
35 -0.1764430074 -0.0144261436
36 0.0072400462 -0.1764430074
37 0.0593435935 0.0072400462
38 -0.0928407117 0.0593435935
39 -0.0004196900 -0.0928407117
40 -0.1684452383 -0.0004196900
41 0.0362640301 -0.1684452383
42 0.0832927716 0.0362640301
43 -0.0762594970 0.0832927716
44 0.0145488172 -0.0762594970
45 0.0536510886 0.0145488172
46 0.1108103024 0.0536510886
47 0.1113770848 0.1108103024
48 -0.0781681669 0.1113770848
49 -0.0255908036 -0.0781681669
50 0.0693300057 -0.0255908036
51 0.1146520908 0.0693300057
52 -0.0554095060 0.1146520908
53 0.0090588864 -0.0554095060
54 0.0217303934 0.0090588864
55 0.0746990236 0.0217303934
> 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/7ck6x1258707573.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/8fehw1258707573.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/9doje1258707573.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/10842m1258707573.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/115n9e1258707573.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/12xgay1258707573.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/132xk81258707573.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/14lci21258707573.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/15jile1258707573.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/1620761258707573.tab")
+ }
>
> system("convert tmp/1nrwi1258707573.ps tmp/1nrwi1258707573.png")
> system("convert tmp/2b89e1258707573.ps tmp/2b89e1258707573.png")
> system("convert tmp/365v51258707573.ps tmp/365v51258707573.png")
> system("convert tmp/430741258707573.ps tmp/430741258707573.png")
> system("convert tmp/5641f1258707573.ps tmp/5641f1258707573.png")
> system("convert tmp/6u28c1258707573.ps tmp/6u28c1258707573.png")
> system("convert tmp/7ck6x1258707573.ps tmp/7ck6x1258707573.png")
> system("convert tmp/8fehw1258707573.ps tmp/8fehw1258707573.png")
> system("convert tmp/9doje1258707573.ps tmp/9doje1258707573.png")
> system("convert tmp/10842m1258707573.ps tmp/10842m1258707573.png")
>
>
> proc.time()
user system elapsed
2.331 1.563 3.180