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(103.8
+ ,122.5
+ ,80.2
+ ,19
+ ,103.5
+ ,122.4
+ ,74.8
+ ,18
+ ,104.1
+ ,121.9
+ ,77.8
+ ,19
+ ,101.9
+ ,122.2
+ ,73
+ ,19
+ ,102
+ ,123.7
+ ,72
+ ,22
+ ,100.7
+ ,122.6
+ ,75.8
+ ,23
+ ,99
+ ,115.7
+ ,72.6
+ ,20
+ ,96.5
+ ,116.1
+ ,71.9
+ ,14
+ ,101.8
+ ,120.5
+ ,74.8
+ ,14
+ ,100.5
+ ,122.6
+ ,72.9
+ ,14
+ ,103.3
+ ,119.9
+ ,72.9
+ ,15
+ ,102.3
+ ,120.7
+ ,79.9
+ ,11
+ ,100.4
+ ,120.2
+ ,74
+ ,17
+ ,103
+ ,122.1
+ ,76
+ ,16
+ ,99
+ ,119.3
+ ,69.6
+ ,20
+ ,104.8
+ ,121.7
+ ,77.3
+ ,24
+ ,104.5
+ ,113.5
+ ,75.2
+ ,23
+ ,104.8
+ ,123.7
+ ,75.8
+ ,20
+ ,103.8
+ ,123.4
+ ,77.6
+ ,21
+ ,106.3
+ ,126.4
+ ,76.7
+ ,19
+ ,105.2
+ ,124.1
+ ,77
+ ,23
+ ,108.2
+ ,125.6
+ ,77.9
+ ,23
+ ,106.2
+ ,124.8
+ ,76.7
+ ,23
+ ,103.9
+ ,123
+ ,71.9
+ ,23
+ ,104.9
+ ,126.9
+ ,73.4
+ ,27
+ ,106.2
+ ,127.3
+ ,72.5
+ ,26
+ ,107.9
+ ,129
+ ,73.7
+ ,17
+ ,106.9
+ ,126.2
+ ,69.5
+ ,24
+ ,110.3
+ ,125.4
+ ,74.7
+ ,26
+ ,109.8
+ ,126.3
+ ,72.5
+ ,24
+ ,108.3
+ ,126.3
+ ,72.1
+ ,27
+ ,110.9
+ ,128.4
+ ,70.7
+ ,27
+ ,109.8
+ ,127.2
+ ,71.4
+ ,26
+ ,109.3
+ ,128.5
+ ,69.5
+ ,24
+ ,109
+ ,129
+ ,73.5
+ ,23
+ ,107.9
+ ,128.9
+ ,72.4
+ ,23
+ ,108.4
+ ,128.3
+ ,74.5
+ ,24
+ ,107.2
+ ,124.6
+ ,72.2
+ ,17
+ ,109.5
+ ,126.2
+ ,73
+ ,21
+ ,109.9
+ ,129.1
+ ,73.3
+ ,19
+ ,108
+ ,127.3
+ ,71.3
+ ,22
+ ,114.7
+ ,129.2
+ ,73.6
+ ,22
+ ,115.6
+ ,130.4
+ ,71.3
+ ,18
+ ,107.6
+ ,125.9
+ ,71.2
+ ,16
+ ,115.9
+ ,135.8
+ ,81.4
+ ,14
+ ,111.8
+ ,126.4
+ ,76.1
+ ,12
+ ,110
+ ,129.5
+ ,71.1
+ ,14
+ ,109.2
+ ,128.4
+ ,75.7
+ ,16
+ ,108
+ ,125.6
+ ,70
+ ,8
+ ,105.6
+ ,127.7
+ ,68.5
+ ,3
+ ,103
+ ,126.4
+ ,56.7
+ ,0
+ ,99.6
+ ,124.2
+ ,57.9
+ ,5
+ ,97.9
+ ,126.4
+ ,58.8
+ ,1
+ ,97.6
+ ,123.7
+ ,59.3
+ ,1
+ ,96.2
+ ,121.8
+ ,61.3
+ ,3
+ ,97.9
+ ,124
+ ,62.9
+ ,6
+ ,94.5
+ ,122.7
+ ,61.4
+ ,7
+ ,95.4
+ ,122.9
+ ,64.5
+ ,8
+ ,94.4
+ ,121
+ ,63.8
+ ,14
+ ,96.3
+ ,122.8
+ ,61.6
+ ,14
+ ,95.1
+ ,122.9
+ ,64.7
+ ,13)
+ ,dim=c(4
+ ,61)
+ ,dimnames=list(c('totid'
+ ,'ndzcg'
+ ,'dzcg'
+ ,'indc
')
+ ,1:61))
> y <- array(NA,dim=c(4,61),dimnames=list(c('totid','ndzcg','dzcg','indc
'),1:61))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par20 = ''
> par19 = ''
> par18 = ''
> par17 = ''
> par16 = ''
> par15 = ''
> par14 = ''
> par13 = ''
> par12 = ''
> par11 = ''
> par10 = ''
> par9 = ''
> par8 = ''
> par7 = ''
> par6 = ''
> par5 = ''
> par4 = ''
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '3'
> ylab = ''
> xlab = ''
> main = ''
> #'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
dzcg totid ndzcg indc\r
1 80.2 103.8 122.5 19
2 74.8 103.5 122.4 18
3 77.8 104.1 121.9 19
4 73.0 101.9 122.2 19
5 72.0 102.0 123.7 22
6 75.8 100.7 122.6 23
7 72.6 99.0 115.7 20
8 71.9 96.5 116.1 14
9 74.8 101.8 120.5 14
10 72.9 100.5 122.6 14
11 72.9 103.3 119.9 15
12 79.9 102.3 120.7 11
13 74.0 100.4 120.2 17
14 76.0 103.0 122.1 16
15 69.6 99.0 119.3 20
16 77.3 104.8 121.7 24
17 75.2 104.5 113.5 23
18 75.8 104.8 123.7 20
19 77.6 103.8 123.4 21
20 76.7 106.3 126.4 19
21 77.0 105.2 124.1 23
22 77.9 108.2 125.6 23
23 76.7 106.2 124.8 23
24 71.9 103.9 123.0 23
25 73.4 104.9 126.9 27
26 72.5 106.2 127.3 26
27 73.7 107.9 129.0 17
28 69.5 106.9 126.2 24
29 74.7 110.3 125.4 26
30 72.5 109.8 126.3 24
31 72.1 108.3 126.3 27
32 70.7 110.9 128.4 27
33 71.4 109.8 127.2 26
34 69.5 109.3 128.5 24
35 73.5 109.0 129.0 23
36 72.4 107.9 128.9 23
37 74.5 108.4 128.3 24
38 72.2 107.2 124.6 17
39 73.0 109.5 126.2 21
40 73.3 109.9 129.1 19
41 71.3 108.0 127.3 22
42 73.6 114.7 129.2 22
43 71.3 115.6 130.4 18
44 71.2 107.6 125.9 16
45 81.4 115.9 135.8 14
46 76.1 111.8 126.4 12
47 71.1 110.0 129.5 14
48 75.7 109.2 128.4 16
49 70.0 108.0 125.6 8
50 68.5 105.6 127.7 3
51 56.7 103.0 126.4 0
52 57.9 99.6 124.2 5
53 58.8 97.9 126.4 1
54 59.3 97.6 123.7 1
55 61.3 96.2 121.8 3
56 62.9 97.9 124.0 6
57 61.4 94.5 122.7 7
58 64.5 95.4 122.9 8
59 63.8 94.4 121.0 14
60 61.6 96.3 122.8 14
61 64.7 95.1 122.9 13
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) totid ndzcg `indc\r`
77.4427 0.7565 -0.7202 0.2762
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-7.6224 -2.2339 -0.1524 2.4829 10.2219
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 77.44267 16.19867 4.781 1.27e-05 ***
totid 0.75648 0.16137 4.688 1.76e-05 ***
ndzcg -0.72023 0.19673 -3.661 0.000551 ***
`indc\r` 0.27624 0.08509 3.246 0.001960 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.775 on 57 degrees of freedom
Multiple R-squared: 0.5815, Adjusted R-squared: 0.5595
F-statistic: 26.4 on 3 and 57 DF, p-value: 7.78e-11
> 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.33088314 0.66176628 0.66911686
[2,] 0.30661525 0.61323050 0.69338475
[3,] 0.19075598 0.38151196 0.80924402
[4,] 0.11276139 0.22552277 0.88723861
[5,] 0.11911650 0.23823299 0.88088350
[6,] 0.26031646 0.52063291 0.73968354
[7,] 0.19174353 0.38348707 0.80825647
[8,] 0.15221739 0.30443478 0.84778261
[9,] 0.13068318 0.26136636 0.86931682
[10,] 0.09473009 0.18946018 0.90526991
[11,] 0.06398686 0.12797372 0.93601314
[12,] 0.05000273 0.10000547 0.94999727
[13,] 0.05572522 0.11145045 0.94427478
[14,] 0.05781442 0.11562885 0.94218558
[15,] 0.05386054 0.10772109 0.94613946
[16,] 0.05229868 0.10459735 0.94770132
[17,] 0.05366577 0.10733153 0.94633423
[18,] 0.07068028 0.14136056 0.92931972
[19,] 0.05380551 0.10761102 0.94619449
[20,] 0.05493601 0.10987202 0.94506399
[21,] 0.09682951 0.19365901 0.90317049
[22,] 0.20846727 0.41693454 0.79153273
[23,] 0.17720550 0.35441100 0.82279450
[24,] 0.18106354 0.36212707 0.81893646
[25,] 0.15195752 0.30391505 0.84804248
[26,] 0.20676949 0.41353897 0.79323051
[27,] 0.20975923 0.41951846 0.79024077
[28,] 0.31368441 0.62736882 0.68631559
[29,] 0.25088806 0.50177613 0.74911194
[30,] 0.20554999 0.41109999 0.79445001
[31,] 0.15603431 0.31206861 0.84396569
[32,] 0.14653076 0.29306152 0.85346924
[33,] 0.11032024 0.22064049 0.88967976
[34,] 0.07891874 0.15783748 0.92108126
[35,] 0.06928742 0.13857483 0.93071258
[36,] 0.08075066 0.16150131 0.91924934
[37,] 0.28441032 0.56882064 0.71558968
[38,] 0.27865764 0.55731528 0.72134236
[39,] 0.42552360 0.85104721 0.57447640
[40,] 0.35939162 0.71878325 0.64060838
[41,] 0.35425912 0.70851823 0.64574088
[42,] 0.28171612 0.56343223 0.71828388
[43,] 0.28297642 0.56595285 0.71702358
[44,] 0.95242380 0.09515239 0.04757620
[45,] 0.96556566 0.06886868 0.03443434
[46,] 0.96055082 0.07889837 0.03944918
[47,] 0.92982346 0.14035308 0.07017654
[48,] 0.88613171 0.22773658 0.11386829
> postscript(file="/var/www/html/rcomp/tmp/1b0cw1258745179.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/2wc2q1258745179.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/3g61q1258745179.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/40dor1258745179.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/56ksd1258745179.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 7
7.2149213 2.2460837 4.1558366 1.2361618 0.4121398 4.1270628 -1.9278155
8 9 10 11 12 13 14
1.2089294 3.2686211 3.8645373 -0.4744810 8.9631545 2.4828957 4.1607372
15 16 17 18 19 20 21
-2.3349705 1.6010437 -5.9016952 2.6464814 4.7106484 4.6326381 3.0032573
22 23 24 25 26 27 28
2.7141710 2.4509422 -1.9055776 0.5418901 -0.7771972 2.8473654 -4.5465069
29 30 31 32 33 34 35
-3.0472090 -3.6682738 -3.7622809 -5.6166345 -4.6725467 -4.7055177 0.1577856
36 37 38 39 40 41 42
-0.1821105 0.8312669 -1.2921318 -2.1846273 0.4539458 -2.2338919 -3.6338583
43 44 45 46 47 48 49
-4.6454399 -1.3821764 10.2218521 1.8056956 -0.1523979 3.7080433 -0.8909020
50 51 52 53 54 55 56
2.3183520 -7.6223804 -6.8160770 -1.9405772 -3.1582671 -2.0201260 -0.9503509
57 58 59 60 61
-1.0908679 1.1961054 -1.7733135 -4.1142020 0.2418389
> postscript(file="/var/www/html/rcomp/tmp/6mgl01258745179.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 7.2149213 NA
1 2.2460837 7.2149213
2 4.1558366 2.2460837
3 1.2361618 4.1558366
4 0.4121398 1.2361618
5 4.1270628 0.4121398
6 -1.9278155 4.1270628
7 1.2089294 -1.9278155
8 3.2686211 1.2089294
9 3.8645373 3.2686211
10 -0.4744810 3.8645373
11 8.9631545 -0.4744810
12 2.4828957 8.9631545
13 4.1607372 2.4828957
14 -2.3349705 4.1607372
15 1.6010437 -2.3349705
16 -5.9016952 1.6010437
17 2.6464814 -5.9016952
18 4.7106484 2.6464814
19 4.6326381 4.7106484
20 3.0032573 4.6326381
21 2.7141710 3.0032573
22 2.4509422 2.7141710
23 -1.9055776 2.4509422
24 0.5418901 -1.9055776
25 -0.7771972 0.5418901
26 2.8473654 -0.7771972
27 -4.5465069 2.8473654
28 -3.0472090 -4.5465069
29 -3.6682738 -3.0472090
30 -3.7622809 -3.6682738
31 -5.6166345 -3.7622809
32 -4.6725467 -5.6166345
33 -4.7055177 -4.6725467
34 0.1577856 -4.7055177
35 -0.1821105 0.1577856
36 0.8312669 -0.1821105
37 -1.2921318 0.8312669
38 -2.1846273 -1.2921318
39 0.4539458 -2.1846273
40 -2.2338919 0.4539458
41 -3.6338583 -2.2338919
42 -4.6454399 -3.6338583
43 -1.3821764 -4.6454399
44 10.2218521 -1.3821764
45 1.8056956 10.2218521
46 -0.1523979 1.8056956
47 3.7080433 -0.1523979
48 -0.8909020 3.7080433
49 2.3183520 -0.8909020
50 -7.6223804 2.3183520
51 -6.8160770 -7.6223804
52 -1.9405772 -6.8160770
53 -3.1582671 -1.9405772
54 -2.0201260 -3.1582671
55 -0.9503509 -2.0201260
56 -1.0908679 -0.9503509
57 1.1961054 -1.0908679
58 -1.7733135 1.1961054
59 -4.1142020 -1.7733135
60 0.2418389 -4.1142020
61 NA 0.2418389
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.2460837 7.2149213
[2,] 4.1558366 2.2460837
[3,] 1.2361618 4.1558366
[4,] 0.4121398 1.2361618
[5,] 4.1270628 0.4121398
[6,] -1.9278155 4.1270628
[7,] 1.2089294 -1.9278155
[8,] 3.2686211 1.2089294
[9,] 3.8645373 3.2686211
[10,] -0.4744810 3.8645373
[11,] 8.9631545 -0.4744810
[12,] 2.4828957 8.9631545
[13,] 4.1607372 2.4828957
[14,] -2.3349705 4.1607372
[15,] 1.6010437 -2.3349705
[16,] -5.9016952 1.6010437
[17,] 2.6464814 -5.9016952
[18,] 4.7106484 2.6464814
[19,] 4.6326381 4.7106484
[20,] 3.0032573 4.6326381
[21,] 2.7141710 3.0032573
[22,] 2.4509422 2.7141710
[23,] -1.9055776 2.4509422
[24,] 0.5418901 -1.9055776
[25,] -0.7771972 0.5418901
[26,] 2.8473654 -0.7771972
[27,] -4.5465069 2.8473654
[28,] -3.0472090 -4.5465069
[29,] -3.6682738 -3.0472090
[30,] -3.7622809 -3.6682738
[31,] -5.6166345 -3.7622809
[32,] -4.6725467 -5.6166345
[33,] -4.7055177 -4.6725467
[34,] 0.1577856 -4.7055177
[35,] -0.1821105 0.1577856
[36,] 0.8312669 -0.1821105
[37,] -1.2921318 0.8312669
[38,] -2.1846273 -1.2921318
[39,] 0.4539458 -2.1846273
[40,] -2.2338919 0.4539458
[41,] -3.6338583 -2.2338919
[42,] -4.6454399 -3.6338583
[43,] -1.3821764 -4.6454399
[44,] 10.2218521 -1.3821764
[45,] 1.8056956 10.2218521
[46,] -0.1523979 1.8056956
[47,] 3.7080433 -0.1523979
[48,] -0.8909020 3.7080433
[49,] 2.3183520 -0.8909020
[50,] -7.6223804 2.3183520
[51,] -6.8160770 -7.6223804
[52,] -1.9405772 -6.8160770
[53,] -3.1582671 -1.9405772
[54,] -2.0201260 -3.1582671
[55,] -0.9503509 -2.0201260
[56,] -1.0908679 -0.9503509
[57,] 1.1961054 -1.0908679
[58,] -1.7733135 1.1961054
[59,] -4.1142020 -1.7733135
[60,] 0.2418389 -4.1142020
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.2460837 7.2149213
2 4.1558366 2.2460837
3 1.2361618 4.1558366
4 0.4121398 1.2361618
5 4.1270628 0.4121398
6 -1.9278155 4.1270628
7 1.2089294 -1.9278155
8 3.2686211 1.2089294
9 3.8645373 3.2686211
10 -0.4744810 3.8645373
11 8.9631545 -0.4744810
12 2.4828957 8.9631545
13 4.1607372 2.4828957
14 -2.3349705 4.1607372
15 1.6010437 -2.3349705
16 -5.9016952 1.6010437
17 2.6464814 -5.9016952
18 4.7106484 2.6464814
19 4.6326381 4.7106484
20 3.0032573 4.6326381
21 2.7141710 3.0032573
22 2.4509422 2.7141710
23 -1.9055776 2.4509422
24 0.5418901 -1.9055776
25 -0.7771972 0.5418901
26 2.8473654 -0.7771972
27 -4.5465069 2.8473654
28 -3.0472090 -4.5465069
29 -3.6682738 -3.0472090
30 -3.7622809 -3.6682738
31 -5.6166345 -3.7622809
32 -4.6725467 -5.6166345
33 -4.7055177 -4.6725467
34 0.1577856 -4.7055177
35 -0.1821105 0.1577856
36 0.8312669 -0.1821105
37 -1.2921318 0.8312669
38 -2.1846273 -1.2921318
39 0.4539458 -2.1846273
40 -2.2338919 0.4539458
41 -3.6338583 -2.2338919
42 -4.6454399 -3.6338583
43 -1.3821764 -4.6454399
44 10.2218521 -1.3821764
45 1.8056956 10.2218521
46 -0.1523979 1.8056956
47 3.7080433 -0.1523979
48 -0.8909020 3.7080433
49 2.3183520 -0.8909020
50 -7.6223804 2.3183520
51 -6.8160770 -7.6223804
52 -1.9405772 -6.8160770
53 -3.1582671 -1.9405772
54 -2.0201260 -3.1582671
55 -0.9503509 -2.0201260
56 -1.0908679 -0.9503509
57 1.1961054 -1.0908679
58 -1.7733135 1.1961054
59 -4.1142020 -1.7733135
60 0.2418389 -4.1142020
> 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/7ybl41258745179.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/8m9r11258745179.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/9hawt1258745179.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/10nzup1258745179.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/11gd651258745179.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/12lp5l1258745179.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/131nra1258745179.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/1497ww1258745180.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/153i2r1258745180.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/1639fx1258745180.tab")
+ }
>
> system("convert tmp/1b0cw1258745179.ps tmp/1b0cw1258745179.png")
> system("convert tmp/2wc2q1258745179.ps tmp/2wc2q1258745179.png")
> system("convert tmp/3g61q1258745179.ps tmp/3g61q1258745179.png")
> system("convert tmp/40dor1258745179.ps tmp/40dor1258745179.png")
> system("convert tmp/56ksd1258745179.ps tmp/56ksd1258745179.png")
> system("convert tmp/6mgl01258745179.ps tmp/6mgl01258745179.png")
> system("convert tmp/7ybl41258745179.ps tmp/7ybl41258745179.png")
> system("convert tmp/8m9r11258745179.ps tmp/8m9r11258745179.png")
> system("convert tmp/9hawt1258745179.ps tmp/9hawt1258745179.png")
> system("convert tmp/10nzup1258745179.ps tmp/10nzup1258745179.png")
>
>
> proc.time()
user system elapsed
2.477 1.538 2.928