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(3.75
+ ,99.9
+ ,100.1
+ ,100.7
+ ,101.1
+ ,101.2
+ ,4.11
+ ,99.7
+ ,99.9
+ ,100.1
+ ,100.7
+ ,101.1
+ ,4.25
+ ,99.5
+ ,99.7
+ ,99.9
+ ,100.1
+ ,100.7
+ ,4.25
+ ,99.2
+ ,99.5
+ ,99.7
+ ,99.9
+ ,100.1
+ ,4.5
+ ,99
+ ,99.2
+ ,99.5
+ ,99.7
+ ,99.9
+ ,4.7
+ ,99
+ ,99
+ ,99.2
+ ,99.5
+ ,99.7
+ ,4.75
+ ,99.3
+ ,99
+ ,99
+ ,99.2
+ ,99.5
+ ,4.75
+ ,99.5
+ ,99.3
+ ,99
+ ,99
+ ,99.2
+ ,4.75
+ ,99.7
+ ,99.5
+ ,99.3
+ ,99
+ ,99
+ ,4.75
+ ,100
+ ,99.7
+ ,99.5
+ ,99.3
+ ,99
+ ,4.75
+ ,100.4
+ ,100
+ ,99.7
+ ,99.5
+ ,99.3
+ ,4.75
+ ,100.6
+ ,100.4
+ ,100
+ ,99.7
+ ,99.5
+ ,4.58
+ ,100.7
+ ,100.6
+ ,100.4
+ ,100
+ ,99.7
+ ,4.5
+ ,100.7
+ ,100.7
+ ,100.6
+ ,100.4
+ ,100
+ ,4.5
+ ,100.6
+ ,100.7
+ ,100.7
+ ,100.6
+ ,100.4
+ ,4.49
+ ,100.5
+ ,100.6
+ ,100.7
+ ,100.7
+ ,100.6
+ ,4.03
+ ,100.6
+ ,100.5
+ ,100.6
+ ,100.7
+ ,100.7
+ ,3.75
+ ,100.5
+ ,100.6
+ ,100.5
+ ,100.6
+ ,100.7
+ ,3.39
+ ,100.4
+ ,100.5
+ ,100.6
+ ,100.5
+ ,100.6
+ ,3.25
+ ,100.3
+ ,100.4
+ ,100.5
+ ,100.6
+ ,100.5
+ ,3.25
+ ,100.4
+ ,100.3
+ ,100.4
+ ,100.5
+ ,100.6
+ ,3.25
+ ,100.4
+ ,100.4
+ ,100.3
+ ,100.4
+ ,100.5
+ ,3.25
+ ,100.4
+ ,100.4
+ ,100.4
+ ,100.3
+ ,100.4
+ ,3.25
+ ,100.4
+ ,100.4
+ ,100.4
+ ,100.4
+ ,100.3
+ ,3.25
+ ,100.4
+ ,100.4
+ ,100.4
+ ,100.4
+ ,100.4
+ ,3.25
+ ,100.5
+ ,100.4
+ ,100.4
+ ,100.4
+ ,100.4
+ ,3.25
+ ,100.6
+ ,100.5
+ ,100.4
+ ,100.4
+ ,100.4
+ ,3.25
+ ,100.6
+ ,100.6
+ ,100.5
+ ,100.4
+ ,100.4
+ ,3.25
+ ,100.5
+ ,100.6
+ ,100.6
+ ,100.5
+ ,100.4
+ ,3.25
+ ,100.5
+ ,100.5
+ ,100.6
+ ,100.6
+ ,100.5
+ ,3.25
+ ,100.7
+ ,100.5
+ ,100.5
+ ,100.6
+ ,100.6
+ ,2.85
+ ,101.1
+ ,100.7
+ ,100.5
+ ,100.5
+ ,100.6
+ ,2.75
+ ,101.5
+ ,101.1
+ ,100.7
+ ,100.5
+ ,100.5
+ ,2.75
+ ,101.9
+ ,101.5
+ ,101.1
+ ,100.7
+ ,100.5
+ ,2.55
+ ,102.1
+ ,101.9
+ ,101.5
+ ,101.1
+ ,100.7
+ ,2.5
+ ,102.1
+ ,102.1
+ ,101.9
+ ,101.5
+ ,101.1
+ ,2.5
+ ,102.1
+ ,102.1
+ ,102.1
+ ,101.9
+ ,101.5
+ ,2.1
+ ,102.4
+ ,102.1
+ ,102.1
+ ,102.1
+ ,101.9
+ ,2
+ ,102.8
+ ,102.4
+ ,102.1
+ ,102.1
+ ,102.1
+ ,2
+ ,103.1
+ ,102.8
+ ,102.4
+ ,102.1
+ ,102.1
+ ,2
+ ,103.1
+ ,103.1
+ ,102.8
+ ,102.4
+ ,102.1
+ ,2
+ ,102.9
+ ,103.1
+ ,103.1
+ ,102.8
+ ,102.4
+ ,2
+ ,102.4
+ ,102.9
+ ,103.1
+ ,103.1
+ ,102.8
+ ,2
+ ,101.9
+ ,102.4
+ ,102.9
+ ,103.1
+ ,103.1
+ ,2
+ ,101.3
+ ,101.9
+ ,102.4
+ ,102.9
+ ,103.1
+ ,2
+ ,100.7
+ ,101.3
+ ,101.9
+ ,102.4
+ ,102.9
+ ,2
+ ,100.6
+ ,100.7
+ ,101.3
+ ,101.9
+ ,102.4
+ ,2
+ ,101
+ ,100.6
+ ,100.7
+ ,101.3
+ ,101.9
+ ,2
+ ,101.5
+ ,101
+ ,100.6
+ ,100.7
+ ,101.3
+ ,2
+ ,101.9
+ ,101.5
+ ,101
+ ,100.6
+ ,100.7
+ ,2
+ ,102.1
+ ,101.9
+ ,101.5
+ ,101
+ ,100.6
+ ,2
+ ,102.3
+ ,102.1
+ ,101.9
+ ,101.5
+ ,101
+ ,2
+ ,102.5
+ ,102.3
+ ,102.1
+ ,101.9
+ ,101.5
+ ,2
+ ,102.9
+ ,102.5
+ ,102.3
+ ,102.1
+ ,101.9
+ ,2
+ ,103.6
+ ,102.9
+ ,102.5
+ ,102.3
+ ,102.1
+ ,2
+ ,104.3
+ ,103.6
+ ,102.9
+ ,102.5
+ ,102.3)
+ ,dim=c(6
+ ,56)
+ ,dimnames=list(c('Rente'
+ ,'Tprod'
+ ,'y1'
+ ,'y2'
+ ,'y3'
+ ,'y4')
+ ,1:56))
> y <- array(NA,dim=c(6,56),dimnames=list(c('Rente','Tprod','y1','y2','y3','y4'),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 = 'Do not include Seasonal Dummies'
> par1 = '2'
> #'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
Tprod Rente y1 y2 y3 y4 t
1 99.9 3.75 100.1 100.7 101.1 101.2 1
2 99.7 4.11 99.9 100.1 100.7 101.1 2
3 99.5 4.25 99.7 99.9 100.1 100.7 3
4 99.2 4.25 99.5 99.7 99.9 100.1 4
5 99.0 4.50 99.2 99.5 99.7 99.9 5
6 99.0 4.70 99.0 99.2 99.5 99.7 6
7 99.3 4.75 99.0 99.0 99.2 99.5 7
8 99.5 4.75 99.3 99.0 99.0 99.2 8
9 99.7 4.75 99.5 99.3 99.0 99.0 9
10 100.0 4.75 99.7 99.5 99.3 99.0 10
11 100.4 4.75 100.0 99.7 99.5 99.3 11
12 100.6 4.75 100.4 100.0 99.7 99.5 12
13 100.7 4.58 100.6 100.4 100.0 99.7 13
14 100.7 4.50 100.7 100.6 100.4 100.0 14
15 100.6 4.50 100.7 100.7 100.6 100.4 15
16 100.5 4.49 100.6 100.7 100.7 100.6 16
17 100.6 4.03 100.5 100.6 100.7 100.7 17
18 100.5 3.75 100.6 100.5 100.6 100.7 18
19 100.4 3.39 100.5 100.6 100.5 100.6 19
20 100.3 3.25 100.4 100.5 100.6 100.5 20
21 100.4 3.25 100.3 100.4 100.5 100.6 21
22 100.4 3.25 100.4 100.3 100.4 100.5 22
23 100.4 3.25 100.4 100.4 100.3 100.4 23
24 100.4 3.25 100.4 100.4 100.4 100.3 24
25 100.4 3.25 100.4 100.4 100.4 100.4 25
26 100.5 3.25 100.4 100.4 100.4 100.4 26
27 100.6 3.25 100.5 100.4 100.4 100.4 27
28 100.6 3.25 100.6 100.5 100.4 100.4 28
29 100.5 3.25 100.6 100.6 100.5 100.4 29
30 100.5 3.25 100.5 100.6 100.6 100.5 30
31 100.7 3.25 100.5 100.5 100.6 100.6 31
32 101.1 2.85 100.7 100.5 100.5 100.6 32
33 101.5 2.75 101.1 100.7 100.5 100.5 33
34 101.9 2.75 101.5 101.1 100.7 100.5 34
35 102.1 2.55 101.9 101.5 101.1 100.7 35
36 102.1 2.50 102.1 101.9 101.5 101.1 36
37 102.1 2.50 102.1 102.1 101.9 101.5 37
38 102.4 2.10 102.1 102.1 102.1 101.9 38
39 102.8 2.00 102.4 102.1 102.1 102.1 39
40 103.1 2.00 102.8 102.4 102.1 102.1 40
41 103.1 2.00 103.1 102.8 102.4 102.1 41
42 102.9 2.00 103.1 103.1 102.8 102.4 42
43 102.4 2.00 102.9 103.1 103.1 102.8 43
44 101.9 2.00 102.4 102.9 103.1 103.1 44
45 101.3 2.00 101.9 102.4 102.9 103.1 45
46 100.7 2.00 101.3 101.9 102.4 102.9 46
47 100.6 2.00 100.7 101.3 101.9 102.4 47
48 101.0 2.00 100.6 100.7 101.3 101.9 48
49 101.5 2.00 101.0 100.6 100.7 101.3 49
50 101.9 2.00 101.5 101.0 100.6 100.7 50
51 102.1 2.00 101.9 101.5 101.0 100.6 51
52 102.3 2.00 102.1 101.9 101.5 101.0 52
53 102.5 2.00 102.3 102.1 101.9 101.5 53
54 102.9 2.00 102.5 102.3 102.1 101.9 54
55 103.6 2.00 102.9 102.5 102.3 102.1 55
56 104.3 2.00 103.6 102.9 102.5 102.3 56
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Rente y1 y2 y3 y4
9.032874 0.010054 2.060889 -1.659978 0.663978 -0.156268
t
0.006733
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.29081 -0.08347 0.01121 0.08913 0.37372
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.032874 4.691774 1.925 0.0600 .
Rente 0.010054 0.071091 0.141 0.8881
y1 2.060889 0.141620 14.552 < 2e-16 ***
y2 -1.659978 0.316673 -5.242 3.36e-06 ***
y3 0.663978 0.322999 2.056 0.0452 *
y4 -0.156268 0.152604 -1.024 0.3109
t 0.006733 0.003976 1.693 0.0967 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.1472 on 49 degrees of freedom
Multiple R-squared: 0.9871, Adjusted R-squared: 0.9855
F-statistic: 624.3 on 6 and 49 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.27118153 0.54236307 0.7288185
[2,] 0.61748432 0.76503135 0.3825157
[3,] 0.74868232 0.50263536 0.2513177
[4,] 0.71444641 0.57110718 0.2855536
[5,] 0.63128678 0.73742644 0.3687132
[6,] 0.51896363 0.96207274 0.4810364
[7,] 0.42911315 0.85822630 0.5708869
[8,] 0.43330930 0.86661860 0.5666907
[9,] 0.52274650 0.95450700 0.4772535
[10,] 0.45621379 0.91242759 0.5437862
[11,] 0.38290459 0.76580919 0.6170954
[12,] 0.42165493 0.84330986 0.5783451
[13,] 0.40305162 0.80610323 0.5969484
[14,] 0.34006267 0.68012535 0.6599373
[15,] 0.27237377 0.54474754 0.7276262
[16,] 0.20447300 0.40894600 0.7955270
[17,] 0.15979051 0.31958102 0.8402095
[18,] 0.11811894 0.23623787 0.8818811
[19,] 0.09192104 0.18384208 0.9080790
[20,] 0.08865292 0.17730583 0.9113471
[21,] 0.05803414 0.11606829 0.9419659
[22,] 0.05334903 0.10669805 0.9466510
[23,] 0.09054944 0.18109888 0.9094506
[24,] 0.08101785 0.16203570 0.9189821
[25,] 0.07274191 0.14548382 0.9272581
[26,] 0.06133667 0.12267334 0.9386633
[27,] 0.04482286 0.08964572 0.9551771
[28,] 0.07870222 0.15740444 0.9212978
[29,] 0.10711173 0.21422346 0.8928883
[30,] 0.10196621 0.20393243 0.8980338
[31,] 0.10342010 0.20684021 0.8965799
[32,] 0.08975362 0.17950723 0.9102464
[33,] 0.18582346 0.37164692 0.8141765
[34,] 0.18813346 0.37626692 0.8118665
[35,] 0.65302482 0.69395036 0.3469752
[36,] 0.67389386 0.65221228 0.3261061
[37,] 0.62029133 0.75941734 0.3797087
> postscript(file="/var/www/html/rcomp/tmp/1ou2z1258663651.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/2caqh1258663651.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/3ell81258663651.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/449mg1258663651.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/5x3zz1258663651.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 6
0.373722582 -0.170474288 0.037446782 -0.150069361 0.028497387 0.035480120
7 8 9 10 11 12
0.164188641 -0.174895865 0.072933250 0.086824998 0.107906141 -0.126730665
13 14 15 16 17 18
0.052119475 -0.046612808 -0.057635917 0.006676676 0.160286490 -0.249320229
19 20 21 22 23 24
0.070423882 -0.076834897 0.138548028 -0.189500539 0.020535385 -0.068221997
25 26 27 28 29 30
-0.059327931 0.033939289 -0.078882391 -0.125706274 -0.132839014 0.015746196
31 32 33 34 35 36
0.058642466 0.110151073 -0.003563201 0.096544096 -0.102879710 -0.060380061
37 38 39 40 41 42
0.061799115 0.288799641 0.096059215 0.062964225 -0.097237335 -0.024687209
43 44 45 46 47 48
-0.255928071 -0.017331408 -0.290813162 -0.190266444 0.197401938 0.121023580
49 50 51 52 53 54
-0.071437140 -0.071986557 -0.154303822 0.021295393 -0.053076382 0.189720507
55 56
0.289085905 0.102180197
> postscript(file="/var/www/html/rcomp/tmp/6z8ho1258663651.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.373722582 NA
1 -0.170474288 0.373722582
2 0.037446782 -0.170474288
3 -0.150069361 0.037446782
4 0.028497387 -0.150069361
5 0.035480120 0.028497387
6 0.164188641 0.035480120
7 -0.174895865 0.164188641
8 0.072933250 -0.174895865
9 0.086824998 0.072933250
10 0.107906141 0.086824998
11 -0.126730665 0.107906141
12 0.052119475 -0.126730665
13 -0.046612808 0.052119475
14 -0.057635917 -0.046612808
15 0.006676676 -0.057635917
16 0.160286490 0.006676676
17 -0.249320229 0.160286490
18 0.070423882 -0.249320229
19 -0.076834897 0.070423882
20 0.138548028 -0.076834897
21 -0.189500539 0.138548028
22 0.020535385 -0.189500539
23 -0.068221997 0.020535385
24 -0.059327931 -0.068221997
25 0.033939289 -0.059327931
26 -0.078882391 0.033939289
27 -0.125706274 -0.078882391
28 -0.132839014 -0.125706274
29 0.015746196 -0.132839014
30 0.058642466 0.015746196
31 0.110151073 0.058642466
32 -0.003563201 0.110151073
33 0.096544096 -0.003563201
34 -0.102879710 0.096544096
35 -0.060380061 -0.102879710
36 0.061799115 -0.060380061
37 0.288799641 0.061799115
38 0.096059215 0.288799641
39 0.062964225 0.096059215
40 -0.097237335 0.062964225
41 -0.024687209 -0.097237335
42 -0.255928071 -0.024687209
43 -0.017331408 -0.255928071
44 -0.290813162 -0.017331408
45 -0.190266444 -0.290813162
46 0.197401938 -0.190266444
47 0.121023580 0.197401938
48 -0.071437140 0.121023580
49 -0.071986557 -0.071437140
50 -0.154303822 -0.071986557
51 0.021295393 -0.154303822
52 -0.053076382 0.021295393
53 0.189720507 -0.053076382
54 0.289085905 0.189720507
55 0.102180197 0.289085905
56 NA 0.102180197
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.170474288 0.373722582
[2,] 0.037446782 -0.170474288
[3,] -0.150069361 0.037446782
[4,] 0.028497387 -0.150069361
[5,] 0.035480120 0.028497387
[6,] 0.164188641 0.035480120
[7,] -0.174895865 0.164188641
[8,] 0.072933250 -0.174895865
[9,] 0.086824998 0.072933250
[10,] 0.107906141 0.086824998
[11,] -0.126730665 0.107906141
[12,] 0.052119475 -0.126730665
[13,] -0.046612808 0.052119475
[14,] -0.057635917 -0.046612808
[15,] 0.006676676 -0.057635917
[16,] 0.160286490 0.006676676
[17,] -0.249320229 0.160286490
[18,] 0.070423882 -0.249320229
[19,] -0.076834897 0.070423882
[20,] 0.138548028 -0.076834897
[21,] -0.189500539 0.138548028
[22,] 0.020535385 -0.189500539
[23,] -0.068221997 0.020535385
[24,] -0.059327931 -0.068221997
[25,] 0.033939289 -0.059327931
[26,] -0.078882391 0.033939289
[27,] -0.125706274 -0.078882391
[28,] -0.132839014 -0.125706274
[29,] 0.015746196 -0.132839014
[30,] 0.058642466 0.015746196
[31,] 0.110151073 0.058642466
[32,] -0.003563201 0.110151073
[33,] 0.096544096 -0.003563201
[34,] -0.102879710 0.096544096
[35,] -0.060380061 -0.102879710
[36,] 0.061799115 -0.060380061
[37,] 0.288799641 0.061799115
[38,] 0.096059215 0.288799641
[39,] 0.062964225 0.096059215
[40,] -0.097237335 0.062964225
[41,] -0.024687209 -0.097237335
[42,] -0.255928071 -0.024687209
[43,] -0.017331408 -0.255928071
[44,] -0.290813162 -0.017331408
[45,] -0.190266444 -0.290813162
[46,] 0.197401938 -0.190266444
[47,] 0.121023580 0.197401938
[48,] -0.071437140 0.121023580
[49,] -0.071986557 -0.071437140
[50,] -0.154303822 -0.071986557
[51,] 0.021295393 -0.154303822
[52,] -0.053076382 0.021295393
[53,] 0.189720507 -0.053076382
[54,] 0.289085905 0.189720507
[55,] 0.102180197 0.289085905
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.170474288 0.373722582
2 0.037446782 -0.170474288
3 -0.150069361 0.037446782
4 0.028497387 -0.150069361
5 0.035480120 0.028497387
6 0.164188641 0.035480120
7 -0.174895865 0.164188641
8 0.072933250 -0.174895865
9 0.086824998 0.072933250
10 0.107906141 0.086824998
11 -0.126730665 0.107906141
12 0.052119475 -0.126730665
13 -0.046612808 0.052119475
14 -0.057635917 -0.046612808
15 0.006676676 -0.057635917
16 0.160286490 0.006676676
17 -0.249320229 0.160286490
18 0.070423882 -0.249320229
19 -0.076834897 0.070423882
20 0.138548028 -0.076834897
21 -0.189500539 0.138548028
22 0.020535385 -0.189500539
23 -0.068221997 0.020535385
24 -0.059327931 -0.068221997
25 0.033939289 -0.059327931
26 -0.078882391 0.033939289
27 -0.125706274 -0.078882391
28 -0.132839014 -0.125706274
29 0.015746196 -0.132839014
30 0.058642466 0.015746196
31 0.110151073 0.058642466
32 -0.003563201 0.110151073
33 0.096544096 -0.003563201
34 -0.102879710 0.096544096
35 -0.060380061 -0.102879710
36 0.061799115 -0.060380061
37 0.288799641 0.061799115
38 0.096059215 0.288799641
39 0.062964225 0.096059215
40 -0.097237335 0.062964225
41 -0.024687209 -0.097237335
42 -0.255928071 -0.024687209
43 -0.017331408 -0.255928071
44 -0.290813162 -0.017331408
45 -0.190266444 -0.290813162
46 0.197401938 -0.190266444
47 0.121023580 0.197401938
48 -0.071437140 0.121023580
49 -0.071986557 -0.071437140
50 -0.154303822 -0.071986557
51 0.021295393 -0.154303822
52 -0.053076382 0.021295393
53 0.189720507 -0.053076382
54 0.289085905 0.189720507
55 0.102180197 0.289085905
> 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/76fxi1258663651.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/8bkr01258663651.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/9rvhb1258663651.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/10h5ld1258663651.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/11rf9b1258663651.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/129e1o1258663651.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/134mpb1258663651.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/14bev91258663651.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/15eiqi1258663651.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/16yin81258663651.tab")
+ }
> system("convert tmp/1ou2z1258663651.ps tmp/1ou2z1258663651.png")
> system("convert tmp/2caqh1258663651.ps tmp/2caqh1258663651.png")
> system("convert tmp/3ell81258663651.ps tmp/3ell81258663651.png")
> system("convert tmp/449mg1258663651.ps tmp/449mg1258663651.png")
> system("convert tmp/5x3zz1258663651.ps tmp/5x3zz1258663651.png")
> system("convert tmp/6z8ho1258663651.ps tmp/6z8ho1258663651.png")
> system("convert tmp/76fxi1258663651.ps tmp/76fxi1258663651.png")
> system("convert tmp/8bkr01258663651.ps tmp/8bkr01258663651.png")
> system("convert tmp/9rvhb1258663651.ps tmp/9rvhb1258663651.png")
> system("convert tmp/10h5ld1258663651.ps tmp/10h5ld1258663651.png")
>
>
> proc.time()
user system elapsed
2.439 1.567 2.913