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/11/2010
+ ,0
+ ,8
+ ,17
+ ,2
+ ,6
+ ,31/10/2010
+ ,-2
+ ,3
+ ,23
+ ,3
+ ,7
+ ,30/09/2010
+ ,-4
+ ,3
+ ,24
+ ,1
+ ,4
+ ,31/08/2010
+ ,-4
+ ,7
+ ,27
+ ,1
+ ,3
+ ,31/07/2010
+ ,-7
+ ,4
+ ,31
+ ,0
+ ,0
+ ,30/06/2010
+ ,-9
+ ,-4
+ ,40
+ ,1
+ ,6
+ ,31/05/2010
+ ,-13
+ ,-6
+ ,47
+ ,-1
+ ,3
+ ,30/04/2010
+ ,-8
+ ,8
+ ,43
+ ,2
+ ,1
+ ,31/03/2010
+ ,-13
+ ,2
+ ,60
+ ,2
+ ,6
+ ,28/02/2010
+ ,-15
+ ,-1
+ ,64
+ ,0
+ ,5
+ ,31/01/2010
+ ,-15
+ ,-2
+ ,65
+ ,1
+ ,7
+ ,31/12/2009
+ ,-15
+ ,0
+ ,65
+ ,1
+ ,4
+ ,30/11/2009
+ ,-10
+ ,10
+ ,55
+ ,3
+ ,3
+ ,31/10/2009
+ ,-12
+ ,3
+ ,57
+ ,3
+ ,6
+ ,30/09/2009
+ ,-11
+ ,6
+ ,57
+ ,1
+ ,6
+ ,31/08/2009
+ ,-11
+ ,7
+ ,57
+ ,1
+ ,5
+ ,31/07/2009
+ ,-17
+ ,-4
+ ,65
+ ,-2
+ ,2
+ ,30/06/2009
+ ,-18
+ ,-5
+ ,69
+ ,1
+ ,3
+ ,31/05/2009
+ ,-19
+ ,-7
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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
CVI Maand Econ.Sit. Werkloos Fin.Sit. Spaarverm.\r t
1 0 0.001356852 8 17 2 6 1
2 -2 0.001542289 3 23 3 7 2
3 -4 0.001658375 3 24 1 4 3
4 -4 0.001927861 7 27 1 3 4
5 -7 0.002203269 4 31 0 0 5
6 -9 0.002487562 -4 40 1 6 6
7 -13 0.003084577 -6 47 -1 3 7
8 -8 0.003731343 8 43 2 1 8
9 -13 0.005140962 2 60 2 6 9
10 -15 0.006965174 -1 64 0 5 10
11 -15 0.015422886 -2 65 1 7 11
12 -15 0.001285880 0 65 1 4 12
13 -10 0.001357527 10 55 3 3 13
14 -12 0.001543056 3 57 3 6 14
15 -11 0.001659200 6 57 1 6 15
16 -11 0.001928820 7 57 1 5 16
17 -17 0.002204366 -4 65 -2 2 17
18 -18 0.002488800 -5 69 1 3 18
19 -19 0.003086112 -7 70 1 -2 19
20 -22 0.003733201 -10 71 -1 -4 20
21 -24 0.005143521 -21 71 -4 0 21
22 -24 0.006968641 -22 73 -2 1 22
23 -20 0.015430562 -16 68 -1 4 23
24 -25 0.001286521 -25 65 -5 -3 24
25 -22 0.001358204 -22 57 -4 -3 25
26 -17 0.001543825 -22 41 -5 0 26
27 -9 0.001660027 -19 21 0 6 27
28 -11 0.001929781 -21 21 -2 -1 28
29 -13 0.002205464 -31 17 -4 0 29
30 -11 0.002490040 -28 9 -6 -1 30
31 -9 0.003087649 -23 11 -2 1 31
32 -7 0.003735060 -17 6 -2 -4 32
33 -3 0.005146082 -12 -2 -2 -1 33
34 -3 0.007221116 -14 0 1 -1 34
35 -6 0.015438247 -18 5 -2 0 35
36 -4 0.001287162 -16 3 0 3 36
37 -8 0.001358880 -22 7 -1 0 37
38 -1 0.001544594 -9 4 2 8 38
39 -2 0.001660854 -10 8 3 8 39
40 -2 0.001930742 -10 9 2 8 40
41 -1 0.002206563 0 14 3 8 41
42 1 0.002491281 3 12 4 11 42
43 2 0.003089188 2 12 5 13 43
44 2 0.003736921 4 7 5 5 44
45 -1 0.005148646 -3 15 4 12 45
46 1 0.006975585 0 14 5 13 46
47 -1 0.015445939 -1 19 6 9 47
48 -8 0.001287803 -7 39 4 11 48
49 1 0.001359558 2 12 6 7 49
50 2 0.001545364 3 11 6 12 50
51 -2 0.001661682 -3 17 3 11 51
52 -2 0.001931705 -5 16 5 10 52
53 -2 0.002207663 0 25 5 13 53
54 -2 0.002492522 -3 24 5 14 54
55 -6 0.003090728 -7 28 3 10 55
56 -4 0.003738784 -7 25 5 13 56
57 -5 0.005151213 -7 31 5 12 57
58 -2 0.006979063 -4 24 6 13 58
59 -1 0.015453639 -3 24 6 17 59
60 -5 0.001288446 -6 33 5 15 60
61 -9 0.001360236 -10 37 4 6 61
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Maand Econ.Sit. Werkloos Fin.Sit.
0.112888 26.088739 0.250165 -0.253625 0.283963
`Spaarverm.\r` t
0.221587 -0.002488
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.59357 -0.26239 0.04187 0.20189 0.53174
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.112888 0.130251 0.867 0.3899
Maand 26.088739 10.273489 2.539 0.0140 *
Econ.Sit. 0.250165 0.009522 26.273 < 2e-16 ***
Werkloos -0.253625 0.001967 -128.952 < 2e-16 ***
Fin.Sit. 0.283963 0.039338 7.218 1.82e-09 ***
`Spaarverm.\r` 0.221587 0.014498 15.284 < 2e-16 ***
t -0.002488 0.004826 -0.516 0.6082
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2982 on 54 degrees of freedom
Multiple R-squared: 0.9985, Adjusted R-squared: 0.9984
F-statistic: 6145 on 6 and 54 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.1723910 0.3447820 0.82760898
[2,] 0.4780338 0.9560675 0.52196625
[3,] 0.3487328 0.6974655 0.65126723
[4,] 0.3673472 0.7346944 0.63265279
[5,] 0.6013206 0.7973589 0.39867944
[6,] 0.6216600 0.7566801 0.37834003
[7,] 0.5560449 0.8879103 0.44395514
[8,] 0.6633984 0.6732032 0.33660162
[9,] 0.5899098 0.8201804 0.41009021
[10,] 0.8999770 0.2000460 0.10002301
[11,] 0.9470475 0.1059051 0.05295253
[12,] 0.9248762 0.1502475 0.07512376
[13,] 0.8907125 0.2185750 0.10928750
[14,] 0.8684297 0.2631406 0.13157031
[15,] 0.9063305 0.1873389 0.09366946
[16,] 0.9445510 0.1108981 0.05544903
[17,] 0.9174431 0.1651139 0.08255694
[18,] 0.9262598 0.1474804 0.07374018
[19,] 0.9201612 0.1596776 0.07983882
[20,] 0.8881139 0.2237722 0.11188608
[21,] 0.8692851 0.2614297 0.13071487
[22,] 0.8348074 0.3303853 0.16519263
[23,] 0.7903178 0.4193643 0.20968216
[24,] 0.7722712 0.4554576 0.22772879
[25,] 0.7477385 0.5045230 0.25226149
[26,] 0.6979637 0.6040727 0.30203633
[27,] 0.6741675 0.6516650 0.32583250
[28,] 0.7241074 0.5517853 0.27589263
[29,] 0.6459266 0.7081469 0.35407343
[30,] 0.5926227 0.8147547 0.40737734
[31,] 0.8482854 0.3034292 0.15171458
[32,] 0.7985029 0.4029941 0.20149707
[33,] 0.7620172 0.4759657 0.23798283
[34,] 0.8023371 0.3953259 0.19766294
[35,] 0.7574983 0.4850035 0.24250174
[36,] 0.6831799 0.6336402 0.31682012
[37,] 0.7661983 0.4676034 0.23380172
[38,] 0.6722210 0.6555580 0.32777902
[39,] 0.5977943 0.8044114 0.40220570
[40,] 0.5394246 0.9211507 0.46057535
[41,] 0.4662664 0.9325329 0.53373357
[42,] 0.4892698 0.9785396 0.51073018
> postscript(file="/var/www/html/rcomp/tmp/1i9231291125844.ps",horizontal=F,onefile=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/2i9231291125844.ps",horizontal=F,onefile=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/3bjjo1291125844.ps",horizontal=F,onefile=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/4bjjo1291125844.ps",horizontal=F,onefile=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/5bjjo1291125844.ps",horizontal=F,onefile=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.267062738 0.531741362 0.017512060 -0.005229186 -0.296206621 0.369331854
7 8 9 10 11 12
-0.135362548 -0.075278489 -0.404877841 0.104528427 -0.336979805 0.198754181
13 14 15 16 17 18
-0.184871049 -0.593574968 0.223313617 0.190189183 0.482957397 -0.330784382
19 20 21 22 23 24
0.518009229 -0.481163874 0.201892405 0.124668754 0.188555988 -0.262385505
25 26 27 28 29 30
-0.325227685 0.233618580 -0.339258628 0.275554508 0.104342466 0.109421868
31 32 33 34 35 36
-0.226281969 0.098131158 0.119220235 0.223265416 -0.089530997 0.041874749
37 38 39 40 41 42
-0.493292792 -0.133255089 -0.153096773 0.379938815 -0.142258641 -0.353667029
43 44 45 46 47 48
0.156251928 0.146077348 -0.375248351 0.069906867 -0.027911357 0.042193598
49 50 51 52 53 54
0.261862179 -0.352219918 -0.256547515 -0.360737898 0.001591809 0.271932752
55 56 57 58 59 60
-0.271751177 -0.279730966 0.429246577 0.352626897 -0.002487056 0.129812044
61
0.423831122
> postscript(file="/var/www/html/rcomp/tmp/6ma0r1291125844.ps",horizontal=F,onefile=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.267062738 NA
1 0.531741362 0.267062738
2 0.017512060 0.531741362
3 -0.005229186 0.017512060
4 -0.296206621 -0.005229186
5 0.369331854 -0.296206621
6 -0.135362548 0.369331854
7 -0.075278489 -0.135362548
8 -0.404877841 -0.075278489
9 0.104528427 -0.404877841
10 -0.336979805 0.104528427
11 0.198754181 -0.336979805
12 -0.184871049 0.198754181
13 -0.593574968 -0.184871049
14 0.223313617 -0.593574968
15 0.190189183 0.223313617
16 0.482957397 0.190189183
17 -0.330784382 0.482957397
18 0.518009229 -0.330784382
19 -0.481163874 0.518009229
20 0.201892405 -0.481163874
21 0.124668754 0.201892405
22 0.188555988 0.124668754
23 -0.262385505 0.188555988
24 -0.325227685 -0.262385505
25 0.233618580 -0.325227685
26 -0.339258628 0.233618580
27 0.275554508 -0.339258628
28 0.104342466 0.275554508
29 0.109421868 0.104342466
30 -0.226281969 0.109421868
31 0.098131158 -0.226281969
32 0.119220235 0.098131158
33 0.223265416 0.119220235
34 -0.089530997 0.223265416
35 0.041874749 -0.089530997
36 -0.493292792 0.041874749
37 -0.133255089 -0.493292792
38 -0.153096773 -0.133255089
39 0.379938815 -0.153096773
40 -0.142258641 0.379938815
41 -0.353667029 -0.142258641
42 0.156251928 -0.353667029
43 0.146077348 0.156251928
44 -0.375248351 0.146077348
45 0.069906867 -0.375248351
46 -0.027911357 0.069906867
47 0.042193598 -0.027911357
48 0.261862179 0.042193598
49 -0.352219918 0.261862179
50 -0.256547515 -0.352219918
51 -0.360737898 -0.256547515
52 0.001591809 -0.360737898
53 0.271932752 0.001591809
54 -0.271751177 0.271932752
55 -0.279730966 -0.271751177
56 0.429246577 -0.279730966
57 0.352626897 0.429246577
58 -0.002487056 0.352626897
59 0.129812044 -0.002487056
60 0.423831122 0.129812044
61 NA 0.423831122
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.531741362 0.267062738
[2,] 0.017512060 0.531741362
[3,] -0.005229186 0.017512060
[4,] -0.296206621 -0.005229186
[5,] 0.369331854 -0.296206621
[6,] -0.135362548 0.369331854
[7,] -0.075278489 -0.135362548
[8,] -0.404877841 -0.075278489
[9,] 0.104528427 -0.404877841
[10,] -0.336979805 0.104528427
[11,] 0.198754181 -0.336979805
[12,] -0.184871049 0.198754181
[13,] -0.593574968 -0.184871049
[14,] 0.223313617 -0.593574968
[15,] 0.190189183 0.223313617
[16,] 0.482957397 0.190189183
[17,] -0.330784382 0.482957397
[18,] 0.518009229 -0.330784382
[19,] -0.481163874 0.518009229
[20,] 0.201892405 -0.481163874
[21,] 0.124668754 0.201892405
[22,] 0.188555988 0.124668754
[23,] -0.262385505 0.188555988
[24,] -0.325227685 -0.262385505
[25,] 0.233618580 -0.325227685
[26,] -0.339258628 0.233618580
[27,] 0.275554508 -0.339258628
[28,] 0.104342466 0.275554508
[29,] 0.109421868 0.104342466
[30,] -0.226281969 0.109421868
[31,] 0.098131158 -0.226281969
[32,] 0.119220235 0.098131158
[33,] 0.223265416 0.119220235
[34,] -0.089530997 0.223265416
[35,] 0.041874749 -0.089530997
[36,] -0.493292792 0.041874749
[37,] -0.133255089 -0.493292792
[38,] -0.153096773 -0.133255089
[39,] 0.379938815 -0.153096773
[40,] -0.142258641 0.379938815
[41,] -0.353667029 -0.142258641
[42,] 0.156251928 -0.353667029
[43,] 0.146077348 0.156251928
[44,] -0.375248351 0.146077348
[45,] 0.069906867 -0.375248351
[46,] -0.027911357 0.069906867
[47,] 0.042193598 -0.027911357
[48,] 0.261862179 0.042193598
[49,] -0.352219918 0.261862179
[50,] -0.256547515 -0.352219918
[51,] -0.360737898 -0.256547515
[52,] 0.001591809 -0.360737898
[53,] 0.271932752 0.001591809
[54,] -0.271751177 0.271932752
[55,] -0.279730966 -0.271751177
[56,] 0.429246577 -0.279730966
[57,] 0.352626897 0.429246577
[58,] -0.002487056 0.352626897
[59,] 0.129812044 -0.002487056
[60,] 0.423831122 0.129812044
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.531741362 0.267062738
2 0.017512060 0.531741362
3 -0.005229186 0.017512060
4 -0.296206621 -0.005229186
5 0.369331854 -0.296206621
6 -0.135362548 0.369331854
7 -0.075278489 -0.135362548
8 -0.404877841 -0.075278489
9 0.104528427 -0.404877841
10 -0.336979805 0.104528427
11 0.198754181 -0.336979805
12 -0.184871049 0.198754181
13 -0.593574968 -0.184871049
14 0.223313617 -0.593574968
15 0.190189183 0.223313617
16 0.482957397 0.190189183
17 -0.330784382 0.482957397
18 0.518009229 -0.330784382
19 -0.481163874 0.518009229
20 0.201892405 -0.481163874
21 0.124668754 0.201892405
22 0.188555988 0.124668754
23 -0.262385505 0.188555988
24 -0.325227685 -0.262385505
25 0.233618580 -0.325227685
26 -0.339258628 0.233618580
27 0.275554508 -0.339258628
28 0.104342466 0.275554508
29 0.109421868 0.104342466
30 -0.226281969 0.109421868
31 0.098131158 -0.226281969
32 0.119220235 0.098131158
33 0.223265416 0.119220235
34 -0.089530997 0.223265416
35 0.041874749 -0.089530997
36 -0.493292792 0.041874749
37 -0.133255089 -0.493292792
38 -0.153096773 -0.133255089
39 0.379938815 -0.153096773
40 -0.142258641 0.379938815
41 -0.353667029 -0.142258641
42 0.156251928 -0.353667029
43 0.146077348 0.156251928
44 -0.375248351 0.146077348
45 0.069906867 -0.375248351
46 -0.027911357 0.069906867
47 0.042193598 -0.027911357
48 0.261862179 0.042193598
49 -0.352219918 0.261862179
50 -0.256547515 -0.352219918
51 -0.360737898 -0.256547515
52 0.001591809 -0.360737898
53 0.271932752 0.001591809
54 -0.271751177 0.271932752
55 -0.279730966 -0.271751177
56 0.429246577 -0.279730966
57 0.352626897 0.429246577
58 -0.002487056 0.352626897
59 0.129812044 -0.002487056
60 0.423831122 0.129812044
> 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/7w10c1291125844.ps",horizontal=F,onefile=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/8w10c1291125844.ps",horizontal=F,onefile=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/9pshf1291125844.ps",horizontal=F,onefile=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/10pshf1291125844.ps",horizontal=F,onefile=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/11stf31291125844.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/12wte91291125844.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/13kut31291125844.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/14vma61291125844.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/15hmrt1291125844.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/16vwok1291125844.tab")
+ }
>
> try(system("convert tmp/1i9231291125844.ps tmp/1i9231291125844.png",intern=TRUE))
character(0)
> try(system("convert tmp/2i9231291125844.ps tmp/2i9231291125844.png",intern=TRUE))
character(0)
> try(system("convert tmp/3bjjo1291125844.ps tmp/3bjjo1291125844.png",intern=TRUE))
character(0)
> try(system("convert tmp/4bjjo1291125844.ps tmp/4bjjo1291125844.png",intern=TRUE))
character(0)
> try(system("convert tmp/5bjjo1291125844.ps tmp/5bjjo1291125844.png",intern=TRUE))
character(0)
> try(system("convert tmp/6ma0r1291125844.ps tmp/6ma0r1291125844.png",intern=TRUE))
character(0)
> try(system("convert tmp/7w10c1291125844.ps tmp/7w10c1291125844.png",intern=TRUE))
character(0)
> try(system("convert tmp/8w10c1291125844.ps tmp/8w10c1291125844.png",intern=TRUE))
character(0)
> try(system("convert tmp/9pshf1291125844.ps tmp/9pshf1291125844.png",intern=TRUE))
character(0)
> try(system("convert tmp/10pshf1291125844.ps tmp/10pshf1291125844.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.512 1.637 5.920