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(30.3
+ ,122.5
+ ,19
+ ,80.2
+ ,29
+ ,122.4
+ ,18
+ ,74.8
+ ,30.3
+ ,121.9
+ ,19
+ ,77.8
+ ,32
+ ,122.2
+ ,19
+ ,73
+ ,30.3
+ ,123.7
+ ,22
+ ,72
+ ,28
+ ,122.6
+ ,23
+ ,75.8
+ ,27.7
+ ,115.7
+ ,20
+ ,72.6
+ ,27
+ ,116.1
+ ,14
+ ,71.9
+ ,28.7
+ ,120.5
+ ,14
+ ,74.8
+ ,29.7
+ ,122.6
+ ,14
+ ,72.9
+ ,23
+ ,119.9
+ ,15
+ ,72.9
+ ,28
+ ,120.7
+ ,11
+ ,79.9
+ ,32
+ ,120.2
+ ,17
+ ,74
+ ,27
+ ,122.1
+ ,16
+ ,76
+ ,27.7
+ ,119.3
+ ,20
+ ,69.6
+ ,30.7
+ ,121.7
+ ,24
+ ,77.3
+ ,33
+ ,113.5
+ ,23
+ ,75.2
+ ,34.3
+ ,123.7
+ ,20
+ ,75.8
+ ,26
+ ,123.4
+ ,21
+ ,77.6
+ ,30.3
+ ,126.4
+ ,19
+ ,76.7
+ ,37.7
+ ,124.1
+ ,23
+ ,77
+ ,36.3
+ ,125.6
+ ,23
+ ,77.9
+ ,36.3
+ ,124.8
+ ,23
+ ,76.7
+ ,36.7
+ ,123
+ ,23
+ ,71.9
+ ,33.7
+ ,126.9
+ ,27
+ ,73.4
+ ,33.7
+ ,127.3
+ ,26
+ ,72.5
+ ,32.7
+ ,129
+ ,17
+ ,73.7
+ ,37.3
+ ,126.2
+ ,24
+ ,69.5
+ ,37
+ ,125.4
+ ,26
+ ,74.7
+ ,37.3
+ ,126.3
+ ,24
+ ,72.5
+ ,41.7
+ ,126.3
+ ,27
+ ,72.1
+ ,40.7
+ ,128.4
+ ,27
+ ,70.7
+ ,38.7
+ ,127.2
+ ,26
+ ,71.4
+ ,38.3
+ ,128.5
+ ,24
+ ,69.5
+ ,38.3
+ ,129
+ ,23
+ ,73.5
+ ,36.7
+ ,128.9
+ ,23
+ ,72.4
+ ,37.3
+ ,128.3
+ ,24
+ ,74.5
+ ,36.7
+ ,124.6
+ ,17
+ ,72.2
+ ,36
+ ,126.2
+ ,21
+ ,73
+ ,33.3
+ ,129.1
+ ,19
+ ,73.3
+ ,28.7
+ ,127.3
+ ,22
+ ,71.3
+ ,33.7
+ ,129.2
+ ,22
+ ,73.6
+ ,31
+ ,130.4
+ ,18
+ ,71.3
+ ,29.3
+ ,125.9
+ ,16
+ ,71.2
+ ,27.3
+ ,135.8
+ ,14
+ ,81.4
+ ,30.3
+ ,126.4
+ ,12
+ ,76.1
+ ,16.7
+ ,129.5
+ ,14
+ ,71.1
+ ,14.7
+ ,128.4
+ ,16
+ ,75.7
+ ,13.3
+ ,125.6
+ ,8
+ ,70
+ ,12.3
+ ,127.7
+ ,3
+ ,68.5
+ ,10
+ ,126.4
+ ,0
+ ,56.7
+ ,1.7
+ ,124.2
+ ,5
+ ,57.9
+ ,2.3
+ ,126.4
+ ,1
+ ,58.8
+ ,2.7
+ ,123.7
+ ,1
+ ,59.3
+ ,0.4
+ ,121.8
+ ,3
+ ,61.3
+ ,6.1
+ ,124
+ ,6
+ ,62.9
+ ,7.1
+ ,122.7
+ ,7
+ ,61.4
+ ,11.4
+ ,122.9
+ ,8
+ ,64.5
+ ,11.4
+ ,121
+ ,14
+ ,63.8
+ ,8.2
+ ,122.8
+ ,14
+ ,61.6
+ ,11.9
+ ,122.9
+ ,13
+ ,64.7)
+ ,dim=c(4
+ ,61)
+ ,dimnames=list(c('handel'
+ ,'ntdzcg'
+ ,'indcvtr'
+ ,'dzcg
')
+ ,1:61))
> y <- array(NA,dim=c(4,61),dimnames=list(c('handel','ntdzcg','indcvtr','dzcg
'),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 = 'Do not include Seasonal Dummies'
> par1 = '3'
> #'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
indcvtr handel ntdzcg dzcg\r
1 19 30.3 122.5 80.2
2 18 29.0 122.4 74.8
3 19 30.3 121.9 77.8
4 19 32.0 122.2 73.0
5 22 30.3 123.7 72.0
6 23 28.0 122.6 75.8
7 20 27.7 115.7 72.6
8 14 27.0 116.1 71.9
9 14 28.7 120.5 74.8
10 14 29.7 122.6 72.9
11 15 23.0 119.9 72.9
12 11 28.0 120.7 79.9
13 17 32.0 120.2 74.0
14 16 27.0 122.1 76.0
15 20 27.7 119.3 69.6
16 24 30.7 121.7 77.3
17 23 33.0 113.5 75.2
18 20 34.3 123.7 75.8
19 21 26.0 123.4 77.6
20 19 30.3 126.4 76.7
21 23 37.7 124.1 77.0
22 23 36.3 125.6 77.9
23 23 36.3 124.8 76.7
24 23 36.7 123.0 71.9
25 27 33.7 126.9 73.4
26 26 33.7 127.3 72.5
27 17 32.7 129.0 73.7
28 24 37.3 126.2 69.5
29 26 37.0 125.4 74.7
30 24 37.3 126.3 72.5
31 27 41.7 126.3 72.1
32 27 40.7 128.4 70.7
33 26 38.7 127.2 71.4
34 24 38.3 128.5 69.5
35 23 38.3 129.0 73.5
36 23 36.7 128.9 72.4
37 24 37.3 128.3 74.5
38 17 36.7 124.6 72.2
39 21 36.0 126.2 73.0
40 19 33.3 129.1 73.3
41 22 28.7 127.3 71.3
42 22 33.7 129.2 73.6
43 18 31.0 130.4 71.3
44 16 29.3 125.9 71.2
45 14 27.3 135.8 81.4
46 12 30.3 126.4 76.1
47 14 16.7 129.5 71.1
48 16 14.7 128.4 75.7
49 8 13.3 125.6 70.0
50 3 12.3 127.7 68.5
51 0 10.0 126.4 56.7
52 5 1.7 124.2 57.9
53 1 2.3 126.4 58.8
54 1 2.7 123.7 59.3
55 3 0.4 121.8 61.3
56 6 6.1 124.0 62.9
57 7 7.1 122.7 61.4
58 8 11.4 122.9 64.5
59 14 11.4 121.0 63.8
60 14 8.2 122.8 61.6
61 13 11.9 122.9 64.7
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) handel ntdzcg `dzcg\r`
13.42505 0.57841 -0.06916 -0.04240
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-8.0631 -1.4954 0.2558 1.7549 6.9368
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 13.42505 17.04395 0.788 0.434
handel 0.57841 0.05988 9.659 1.32e-13 ***
ntdzcg -0.06916 0.11903 -0.581 0.564
`dzcg\r` -0.04240 0.11819 -0.359 0.721
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.441 on 57 degrees of freedom
Multiple R-squared: 0.782, Adjusted R-squared: 0.7705
F-statistic: 68.14 on 3 and 57 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.17884101 0.3576820 0.8211590
[2,] 0.37879625 0.7575925 0.6212038
[3,] 0.52425915 0.9514817 0.4757408
[4,] 0.65702406 0.6859519 0.3429759
[5,] 0.55773930 0.8845214 0.4422607
[6,] 0.74672572 0.5065486 0.2532743
[7,] 0.70461095 0.5907781 0.2953890
[8,] 0.63139808 0.7372038 0.3686019
[9,] 0.55804564 0.8839087 0.4419544
[10,] 0.68971452 0.6205710 0.3102855
[11,] 0.67330217 0.6533957 0.3266978
[12,] 0.61974999 0.7605000 0.3802500
[13,] 0.65632662 0.6873468 0.3436734
[14,] 0.57591703 0.8481659 0.4240830
[15,] 0.50300559 0.9939888 0.4969944
[16,] 0.42580685 0.8516137 0.5741932
[17,] 0.35321867 0.7064373 0.6467813
[18,] 0.28937259 0.5787452 0.7106274
[19,] 0.37551127 0.7510225 0.6244887
[20,] 0.38846729 0.7769346 0.6115327
[21,] 0.44744511 0.8948902 0.5525549
[22,] 0.37495514 0.7499103 0.6250449
[23,] 0.32821419 0.6564284 0.6717858
[24,] 0.26195788 0.5239158 0.7380421
[25,] 0.20624739 0.4124948 0.7937526
[26,] 0.17647902 0.3529580 0.8235210
[27,] 0.14887255 0.2977451 0.8511275
[28,] 0.12767504 0.2553501 0.8723250
[29,] 0.10071032 0.2014206 0.8992897
[30,] 0.08177017 0.1635403 0.9182298
[31,] 0.06601411 0.1320282 0.9339859
[32,] 0.12916252 0.2583250 0.8708375
[33,] 0.09733587 0.1946717 0.9026641
[34,] 0.07294267 0.1458853 0.9270573
[35,] 0.08787835 0.1757567 0.9121217
[36,] 0.08796200 0.1759240 0.9120380
[37,] 0.11021116 0.2204223 0.8897888
[38,] 0.08973376 0.1794675 0.9102662
[39,] 0.07007957 0.1401591 0.9299204
[40,] 0.20008403 0.4001681 0.7999160
[41,] 0.24021207 0.4804241 0.7597879
[42,] 0.56089988 0.8782002 0.4391001
[43,] 0.46698804 0.9339761 0.5330120
[44,] 0.42832122 0.8566424 0.5716788
[45,] 0.65819243 0.6836151 0.3418076
[46,] 0.58014698 0.8397060 0.4198530
[47,] 0.44396059 0.8879212 0.5560394
[48,] 0.44674511 0.8934902 0.5532549
> postscript(file="/var/www/html/rcomp/tmp/1qm9c1260623580.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/2q0tr1260623580.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/3ebcv1260623580.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/4v0ro1260623580.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/51l2a1260623580.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 6
-0.07822461 -0.56215785 -0.22147633 -1.38753184 2.65710731 5.07248083
7 8 9 10 11 12
1.63311515 -3.96401268 -4.52004238 -5.03376734 -0.34516653 -6.88509525
13 14 15 16 17 18
-3.48345729 -1.37521189 1.75490359 4.51212902 1.52562862 -1.49541517
19 20 21 22 23 24
4.36094326 0.04311341 -0.38346218 0.56821025 0.46200357 -0.09736026
25 26 27 28 29 30
5.97119242 4.96069905 -3.29244027 0.67515709 3.01381896 0.80926668
31 32 33 34 35 36
1.24730999 1.91160102 2.01510260 0.25582030 -0.54000765 0.33189226
37 38 39 40 41 42
1.03238556 -5.97398231 -1.42451948 -1.64952836 3.80186437 1.13874373
43 44 45 46 47 48
-1.31407422 -2.64624682 -2.37227196 -6.98232528 2.88644284 6.16221205
49 50 51 52 53 54
-1.46333607 -5.80328482 -8.06314945 1.63636320 -2.52036831 -2.91726922
55 56 57 58 59 60
0.36645894 0.28952235 0.55760698 -0.78428420 5.05463024 6.93675331
61
3.93499109
> postscript(file="/var/www/html/rcomp/tmp/6w7nk1260623580.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 -0.07822461 NA
1 -0.56215785 -0.07822461
2 -0.22147633 -0.56215785
3 -1.38753184 -0.22147633
4 2.65710731 -1.38753184
5 5.07248083 2.65710731
6 1.63311515 5.07248083
7 -3.96401268 1.63311515
8 -4.52004238 -3.96401268
9 -5.03376734 -4.52004238
10 -0.34516653 -5.03376734
11 -6.88509525 -0.34516653
12 -3.48345729 -6.88509525
13 -1.37521189 -3.48345729
14 1.75490359 -1.37521189
15 4.51212902 1.75490359
16 1.52562862 4.51212902
17 -1.49541517 1.52562862
18 4.36094326 -1.49541517
19 0.04311341 4.36094326
20 -0.38346218 0.04311341
21 0.56821025 -0.38346218
22 0.46200357 0.56821025
23 -0.09736026 0.46200357
24 5.97119242 -0.09736026
25 4.96069905 5.97119242
26 -3.29244027 4.96069905
27 0.67515709 -3.29244027
28 3.01381896 0.67515709
29 0.80926668 3.01381896
30 1.24730999 0.80926668
31 1.91160102 1.24730999
32 2.01510260 1.91160102
33 0.25582030 2.01510260
34 -0.54000765 0.25582030
35 0.33189226 -0.54000765
36 1.03238556 0.33189226
37 -5.97398231 1.03238556
38 -1.42451948 -5.97398231
39 -1.64952836 -1.42451948
40 3.80186437 -1.64952836
41 1.13874373 3.80186437
42 -1.31407422 1.13874373
43 -2.64624682 -1.31407422
44 -2.37227196 -2.64624682
45 -6.98232528 -2.37227196
46 2.88644284 -6.98232528
47 6.16221205 2.88644284
48 -1.46333607 6.16221205
49 -5.80328482 -1.46333607
50 -8.06314945 -5.80328482
51 1.63636320 -8.06314945
52 -2.52036831 1.63636320
53 -2.91726922 -2.52036831
54 0.36645894 -2.91726922
55 0.28952235 0.36645894
56 0.55760698 0.28952235
57 -0.78428420 0.55760698
58 5.05463024 -0.78428420
59 6.93675331 5.05463024
60 3.93499109 6.93675331
61 NA 3.93499109
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.56215785 -0.07822461
[2,] -0.22147633 -0.56215785
[3,] -1.38753184 -0.22147633
[4,] 2.65710731 -1.38753184
[5,] 5.07248083 2.65710731
[6,] 1.63311515 5.07248083
[7,] -3.96401268 1.63311515
[8,] -4.52004238 -3.96401268
[9,] -5.03376734 -4.52004238
[10,] -0.34516653 -5.03376734
[11,] -6.88509525 -0.34516653
[12,] -3.48345729 -6.88509525
[13,] -1.37521189 -3.48345729
[14,] 1.75490359 -1.37521189
[15,] 4.51212902 1.75490359
[16,] 1.52562862 4.51212902
[17,] -1.49541517 1.52562862
[18,] 4.36094326 -1.49541517
[19,] 0.04311341 4.36094326
[20,] -0.38346218 0.04311341
[21,] 0.56821025 -0.38346218
[22,] 0.46200357 0.56821025
[23,] -0.09736026 0.46200357
[24,] 5.97119242 -0.09736026
[25,] 4.96069905 5.97119242
[26,] -3.29244027 4.96069905
[27,] 0.67515709 -3.29244027
[28,] 3.01381896 0.67515709
[29,] 0.80926668 3.01381896
[30,] 1.24730999 0.80926668
[31,] 1.91160102 1.24730999
[32,] 2.01510260 1.91160102
[33,] 0.25582030 2.01510260
[34,] -0.54000765 0.25582030
[35,] 0.33189226 -0.54000765
[36,] 1.03238556 0.33189226
[37,] -5.97398231 1.03238556
[38,] -1.42451948 -5.97398231
[39,] -1.64952836 -1.42451948
[40,] 3.80186437 -1.64952836
[41,] 1.13874373 3.80186437
[42,] -1.31407422 1.13874373
[43,] -2.64624682 -1.31407422
[44,] -2.37227196 -2.64624682
[45,] -6.98232528 -2.37227196
[46,] 2.88644284 -6.98232528
[47,] 6.16221205 2.88644284
[48,] -1.46333607 6.16221205
[49,] -5.80328482 -1.46333607
[50,] -8.06314945 -5.80328482
[51,] 1.63636320 -8.06314945
[52,] -2.52036831 1.63636320
[53,] -2.91726922 -2.52036831
[54,] 0.36645894 -2.91726922
[55,] 0.28952235 0.36645894
[56,] 0.55760698 0.28952235
[57,] -0.78428420 0.55760698
[58,] 5.05463024 -0.78428420
[59,] 6.93675331 5.05463024
[60,] 3.93499109 6.93675331
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.56215785 -0.07822461
2 -0.22147633 -0.56215785
3 -1.38753184 -0.22147633
4 2.65710731 -1.38753184
5 5.07248083 2.65710731
6 1.63311515 5.07248083
7 -3.96401268 1.63311515
8 -4.52004238 -3.96401268
9 -5.03376734 -4.52004238
10 -0.34516653 -5.03376734
11 -6.88509525 -0.34516653
12 -3.48345729 -6.88509525
13 -1.37521189 -3.48345729
14 1.75490359 -1.37521189
15 4.51212902 1.75490359
16 1.52562862 4.51212902
17 -1.49541517 1.52562862
18 4.36094326 -1.49541517
19 0.04311341 4.36094326
20 -0.38346218 0.04311341
21 0.56821025 -0.38346218
22 0.46200357 0.56821025
23 -0.09736026 0.46200357
24 5.97119242 -0.09736026
25 4.96069905 5.97119242
26 -3.29244027 4.96069905
27 0.67515709 -3.29244027
28 3.01381896 0.67515709
29 0.80926668 3.01381896
30 1.24730999 0.80926668
31 1.91160102 1.24730999
32 2.01510260 1.91160102
33 0.25582030 2.01510260
34 -0.54000765 0.25582030
35 0.33189226 -0.54000765
36 1.03238556 0.33189226
37 -5.97398231 1.03238556
38 -1.42451948 -5.97398231
39 -1.64952836 -1.42451948
40 3.80186437 -1.64952836
41 1.13874373 3.80186437
42 -1.31407422 1.13874373
43 -2.64624682 -1.31407422
44 -2.37227196 -2.64624682
45 -6.98232528 -2.37227196
46 2.88644284 -6.98232528
47 6.16221205 2.88644284
48 -1.46333607 6.16221205
49 -5.80328482 -1.46333607
50 -8.06314945 -5.80328482
51 1.63636320 -8.06314945
52 -2.52036831 1.63636320
53 -2.91726922 -2.52036831
54 0.36645894 -2.91726922
55 0.28952235 0.36645894
56 0.55760698 0.28952235
57 -0.78428420 0.55760698
58 5.05463024 -0.78428420
59 6.93675331 5.05463024
60 3.93499109 6.93675331
> 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/7md9g1260623580.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/88d7q1260623580.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/9el2g1260623580.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/10a9yn1260623580.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/11m0za1260623580.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/125zhs1260623580.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/13x2k61260623580.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/142fqa1260623580.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/157ogo1260623580.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/16mkiy1260623580.tab")
+ }
>
> system("convert tmp/1qm9c1260623580.ps tmp/1qm9c1260623580.png")
> system("convert tmp/2q0tr1260623580.ps tmp/2q0tr1260623580.png")
> system("convert tmp/3ebcv1260623580.ps tmp/3ebcv1260623580.png")
> system("convert tmp/4v0ro1260623580.ps tmp/4v0ro1260623580.png")
> system("convert tmp/51l2a1260623580.ps tmp/51l2a1260623580.png")
> system("convert tmp/6w7nk1260623580.ps tmp/6w7nk1260623580.png")
> system("convert tmp/7md9g1260623580.ps tmp/7md9g1260623580.png")
> system("convert tmp/88d7q1260623580.ps tmp/88d7q1260623580.png")
> system("convert tmp/9el2g1260623580.ps tmp/9el2g1260623580.png")
> system("convert tmp/10a9yn1260623580.ps tmp/10a9yn1260623580.png")
>
>
> proc.time()
user system elapsed
2.422 1.504 3.811