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(8.9,95.05,8.8,96.84,8.3,96.92,7.5,97.44,7.2,97.78,7.4,97.69,8.8,96.67,9.3,98.29,9.3,98.2,8.7,98.71,8.2,98.54,8.3,98.2,8.5,96.92,8.6,99.06,8.5,99.65,8.2,99.82,8.1,99.99,7.9,100.33,8.6,99.31,8.7,101.1,8.7,101.1,8.5,100.93,8.4,100.85,8.5,100.93,8.7,99.6,8.7,101.88,8.6,101.81,8.5,102.38,8.3,102.74,8,102.82,8.2,101.72,8.1,103.47,8.1,102.98,8,102.68,7.9,102.9,7.9,103.03,8,101.29,8,103.69,7.9,103.68,8,104.2,7.7,104.08,7.2,104.16,7.5,103.05,7.3,104.66,7,104.46,7,104.95,7,105.85,7.2,106.23,7.3,104.86,7.1,107.44,6.8,108.23,6.4,108.45,6.1,109.39,6.5,110.15,7.7,109.13,7.9,110.28,7.5,110.17,6.9,109.99,6.6,109.26,6.9,109.11),dim=c(2,60),dimnames=list(c('Werkloosheidsgraad','Consumptieprijs'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Werkloosheidsgraad','Consumptieprijs'),1:60))
> 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 = 'Include Monthly Dummies'
> par1 = '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
Werkloosheidsgraad Consumptieprijs M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 8.9 95.05 1 0 0 0 0 0 0 0 0 0 0
2 8.8 96.84 0 1 0 0 0 0 0 0 0 0 0
3 8.3 96.92 0 0 1 0 0 0 0 0 0 0 0
4 7.5 97.44 0 0 0 1 0 0 0 0 0 0 0
5 7.2 97.78 0 0 0 0 1 0 0 0 0 0 0
6 7.4 97.69 0 0 0 0 0 1 0 0 0 0 0
7 8.8 96.67 0 0 0 0 0 0 1 0 0 0 0
8 9.3 98.29 0 0 0 0 0 0 0 1 0 0 0
9 9.3 98.20 0 0 0 0 0 0 0 0 1 0 0
10 8.7 98.71 0 0 0 0 0 0 0 0 0 1 0
11 8.2 98.54 0 0 0 0 0 0 0 0 0 0 1
12 8.3 98.20 0 0 0 0 0 0 0 0 0 0 0
13 8.5 96.92 1 0 0 0 0 0 0 0 0 0 0
14 8.6 99.06 0 1 0 0 0 0 0 0 0 0 0
15 8.5 99.65 0 0 1 0 0 0 0 0 0 0 0
16 8.2 99.82 0 0 0 1 0 0 0 0 0 0 0
17 8.1 99.99 0 0 0 0 1 0 0 0 0 0 0
18 7.9 100.33 0 0 0 0 0 1 0 0 0 0 0
19 8.6 99.31 0 0 0 0 0 0 1 0 0 0 0
20 8.7 101.10 0 0 0 0 0 0 0 1 0 0 0
21 8.7 101.10 0 0 0 0 0 0 0 0 1 0 0
22 8.5 100.93 0 0 0 0 0 0 0 0 0 1 0
23 8.4 100.85 0 0 0 0 0 0 0 0 0 0 1
24 8.5 100.93 0 0 0 0 0 0 0 0 0 0 0
25 8.7 99.60 1 0 0 0 0 0 0 0 0 0 0
26 8.7 101.88 0 1 0 0 0 0 0 0 0 0 0
27 8.6 101.81 0 0 1 0 0 0 0 0 0 0 0
28 8.5 102.38 0 0 0 1 0 0 0 0 0 0 0
29 8.3 102.74 0 0 0 0 1 0 0 0 0 0 0
30 8.0 102.82 0 0 0 0 0 1 0 0 0 0 0
31 8.2 101.72 0 0 0 0 0 0 1 0 0 0 0
32 8.1 103.47 0 0 0 0 0 0 0 1 0 0 0
33 8.1 102.98 0 0 0 0 0 0 0 0 1 0 0
34 8.0 102.68 0 0 0 0 0 0 0 0 0 1 0
35 7.9 102.90 0 0 0 0 0 0 0 0 0 0 1
36 7.9 103.03 0 0 0 0 0 0 0 0 0 0 0
37 8.0 101.29 1 0 0 0 0 0 0 0 0 0 0
38 8.0 103.69 0 1 0 0 0 0 0 0 0 0 0
39 7.9 103.68 0 0 1 0 0 0 0 0 0 0 0
40 8.0 104.20 0 0 0 1 0 0 0 0 0 0 0
41 7.7 104.08 0 0 0 0 1 0 0 0 0 0 0
42 7.2 104.16 0 0 0 0 0 1 0 0 0 0 0
43 7.5 103.05 0 0 0 0 0 0 1 0 0 0 0
44 7.3 104.66 0 0 0 0 0 0 0 1 0 0 0
45 7.0 104.46 0 0 0 0 0 0 0 0 1 0 0
46 7.0 104.95 0 0 0 0 0 0 0 0 0 1 0
47 7.0 105.85 0 0 0 0 0 0 0 0 0 0 1
48 7.2 106.23 0 0 0 0 0 0 0 0 0 0 0
49 7.3 104.86 1 0 0 0 0 0 0 0 0 0 0
50 7.1 107.44 0 1 0 0 0 0 0 0 0 0 0
51 6.8 108.23 0 0 1 0 0 0 0 0 0 0 0
52 6.4 108.45 0 0 0 1 0 0 0 0 0 0 0
53 6.1 109.39 0 0 0 0 1 0 0 0 0 0 0
54 6.5 110.15 0 0 0 0 0 1 0 0 0 0 0
55 7.7 109.13 0 0 0 0 0 0 1 0 0 0 0
56 7.9 110.28 0 0 0 0 0 0 0 1 0 0 0
57 7.5 110.17 0 0 0 0 0 0 0 0 1 0 0
58 6.9 109.99 0 0 0 0 0 0 0 0 0 1 0
59 6.6 109.26 0 0 0 0 0 0 0 0 0 0 1
60 6.9 109.11 0 0 0 0 0 0 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Consumptieprijs M1 M2
21.91735 -0.13679 -0.02113 0.24500
M3 M4 M5 M6
0.06275 -0.18253 -0.37630 -0.42429
M7 M8 M9 M10
0.19154 0.50821 0.34386 0.05343
M11
-0.14274
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.97254 -0.19728 0.01314 0.31116 0.81234
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 21.91735 1.62684 13.472 < 2e-16 ***
Consumptieprijs -0.13679 0.01559 -8.775 1.82e-11 ***
M1 -0.02113 0.30247 -0.070 0.9446
M2 0.24500 0.29733 0.824 0.4141
M3 0.06275 0.29697 0.211 0.8336
M4 -0.18253 0.29656 -0.615 0.5412
M5 -0.37630 0.29632 -1.270 0.2104
M6 -0.42429 0.29621 -1.432 0.1586
M7 0.19154 0.29707 0.645 0.5222
M8 0.50821 0.29612 1.716 0.0927 .
M9 0.34386 0.29612 1.161 0.2514
M10 0.05343 0.29612 0.180 0.8576
M11 -0.14274 0.29612 -0.482 0.6320
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.4682 on 47 degrees of freedom
Multiple R-squared: 0.6839, Adjusted R-squared: 0.6032
F-statistic: 8.475 on 12 and 47 DF, p-value: 3.133e-08
> 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.37476156 0.74952313 0.6252384
[2,] 0.43974884 0.87949768 0.5602512
[3,] 0.30644969 0.61289938 0.6935503
[4,] 0.26395044 0.52790087 0.7360496
[5,] 0.32340522 0.64681045 0.6765948
[6,] 0.32661843 0.65323685 0.6733816
[7,] 0.24180226 0.48360452 0.7581977
[8,] 0.17312671 0.34625343 0.8268733
[9,] 0.11766126 0.23532253 0.8823387
[10,] 0.07861169 0.15722337 0.9213883
[11,] 0.05308571 0.10617142 0.9469143
[12,] 0.03817276 0.07634552 0.9618272
[13,] 0.05065736 0.10131473 0.9493426
[14,] 0.06625702 0.13251405 0.9337430
[15,] 0.05146561 0.10293122 0.9485344
[16,] 0.05888786 0.11777571 0.9411121
[17,] 0.10637294 0.21274587 0.8936271
[18,] 0.14056135 0.28112271 0.8594386
[19,] 0.13358377 0.26716754 0.8664162
[20,] 0.11911958 0.23823916 0.8808804
[21,] 0.09567226 0.19134452 0.9043277
[22,] 0.08127172 0.16254344 0.9187283
[23,] 0.07199263 0.14398527 0.9280074
[24,] 0.06728205 0.13456410 0.9327179
[25,] 0.15942907 0.31885813 0.8405709
[26,] 0.59888422 0.80223155 0.4011158
[27,] 0.76756090 0.46487820 0.2324391
[28,] 0.67127019 0.65745963 0.3287298
[29,] 0.71425934 0.57148133 0.2857407
> postscript(file="/var/www/html/rcomp/tmp/1m10l1258554812.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/2cink1258554812.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/343y21258554812.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/4m7q11258554812.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/5ti1h1258554812.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 = 60
Frequency = 1
1 2 3 4 5 6
0.005283970 -0.115996133 -0.422806178 -0.906391865 -0.966118293 -0.730436938
7 8 9 10 11 12
-0.085786216 0.319138078 0.471175241 0.231361056 -0.095722561 -0.184965501
13 14 15 16 17 18
-0.138926316 -0.012331338 0.150619448 0.119158681 0.236178642 0.130677952
19 20 21 22 23 24
0.075328675 0.103506579 0.267854477 0.335025850 0.420252969 0.388460125
25 26 27 28 29 30
0.427660013 0.473405022 0.546077086 0.769330696 0.812339987 0.571274952
31 32 33 34 35 36
0.004982798 -0.172310735 -0.074987949 0.074401252 0.200664153 0.075710607
37 38 39 40 41 42
-0.041171743 0.020987580 0.101866800 0.518281114 0.395633151 -0.045431884
43 44 45 46 47 48
-0.513091897 -0.809535462 -0.972544753 -0.615094657 -0.295817314 -0.186574374
49 50 51 52 53 54
-0.252845924 -0.366065132 -0.375757157 -0.500378626 -0.478033488 0.073915918
55 56 57 58 59 60
0.518566640 0.559201541 0.308502985 -0.025693501 -0.229377246 -0.092630857
> postscript(file="/var/www/html/rcomp/tmp/622ar1258554812.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 = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 0.005283970 NA
1 -0.115996133 0.005283970
2 -0.422806178 -0.115996133
3 -0.906391865 -0.422806178
4 -0.966118293 -0.906391865
5 -0.730436938 -0.966118293
6 -0.085786216 -0.730436938
7 0.319138078 -0.085786216
8 0.471175241 0.319138078
9 0.231361056 0.471175241
10 -0.095722561 0.231361056
11 -0.184965501 -0.095722561
12 -0.138926316 -0.184965501
13 -0.012331338 -0.138926316
14 0.150619448 -0.012331338
15 0.119158681 0.150619448
16 0.236178642 0.119158681
17 0.130677952 0.236178642
18 0.075328675 0.130677952
19 0.103506579 0.075328675
20 0.267854477 0.103506579
21 0.335025850 0.267854477
22 0.420252969 0.335025850
23 0.388460125 0.420252969
24 0.427660013 0.388460125
25 0.473405022 0.427660013
26 0.546077086 0.473405022
27 0.769330696 0.546077086
28 0.812339987 0.769330696
29 0.571274952 0.812339987
30 0.004982798 0.571274952
31 -0.172310735 0.004982798
32 -0.074987949 -0.172310735
33 0.074401252 -0.074987949
34 0.200664153 0.074401252
35 0.075710607 0.200664153
36 -0.041171743 0.075710607
37 0.020987580 -0.041171743
38 0.101866800 0.020987580
39 0.518281114 0.101866800
40 0.395633151 0.518281114
41 -0.045431884 0.395633151
42 -0.513091897 -0.045431884
43 -0.809535462 -0.513091897
44 -0.972544753 -0.809535462
45 -0.615094657 -0.972544753
46 -0.295817314 -0.615094657
47 -0.186574374 -0.295817314
48 -0.252845924 -0.186574374
49 -0.366065132 -0.252845924
50 -0.375757157 -0.366065132
51 -0.500378626 -0.375757157
52 -0.478033488 -0.500378626
53 0.073915918 -0.478033488
54 0.518566640 0.073915918
55 0.559201541 0.518566640
56 0.308502985 0.559201541
57 -0.025693501 0.308502985
58 -0.229377246 -0.025693501
59 -0.092630857 -0.229377246
60 NA -0.092630857
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.115996133 0.005283970
[2,] -0.422806178 -0.115996133
[3,] -0.906391865 -0.422806178
[4,] -0.966118293 -0.906391865
[5,] -0.730436938 -0.966118293
[6,] -0.085786216 -0.730436938
[7,] 0.319138078 -0.085786216
[8,] 0.471175241 0.319138078
[9,] 0.231361056 0.471175241
[10,] -0.095722561 0.231361056
[11,] -0.184965501 -0.095722561
[12,] -0.138926316 -0.184965501
[13,] -0.012331338 -0.138926316
[14,] 0.150619448 -0.012331338
[15,] 0.119158681 0.150619448
[16,] 0.236178642 0.119158681
[17,] 0.130677952 0.236178642
[18,] 0.075328675 0.130677952
[19,] 0.103506579 0.075328675
[20,] 0.267854477 0.103506579
[21,] 0.335025850 0.267854477
[22,] 0.420252969 0.335025850
[23,] 0.388460125 0.420252969
[24,] 0.427660013 0.388460125
[25,] 0.473405022 0.427660013
[26,] 0.546077086 0.473405022
[27,] 0.769330696 0.546077086
[28,] 0.812339987 0.769330696
[29,] 0.571274952 0.812339987
[30,] 0.004982798 0.571274952
[31,] -0.172310735 0.004982798
[32,] -0.074987949 -0.172310735
[33,] 0.074401252 -0.074987949
[34,] 0.200664153 0.074401252
[35,] 0.075710607 0.200664153
[36,] -0.041171743 0.075710607
[37,] 0.020987580 -0.041171743
[38,] 0.101866800 0.020987580
[39,] 0.518281114 0.101866800
[40,] 0.395633151 0.518281114
[41,] -0.045431884 0.395633151
[42,] -0.513091897 -0.045431884
[43,] -0.809535462 -0.513091897
[44,] -0.972544753 -0.809535462
[45,] -0.615094657 -0.972544753
[46,] -0.295817314 -0.615094657
[47,] -0.186574374 -0.295817314
[48,] -0.252845924 -0.186574374
[49,] -0.366065132 -0.252845924
[50,] -0.375757157 -0.366065132
[51,] -0.500378626 -0.375757157
[52,] -0.478033488 -0.500378626
[53,] 0.073915918 -0.478033488
[54,] 0.518566640 0.073915918
[55,] 0.559201541 0.518566640
[56,] 0.308502985 0.559201541
[57,] -0.025693501 0.308502985
[58,] -0.229377246 -0.025693501
[59,] -0.092630857 -0.229377246
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.115996133 0.005283970
2 -0.422806178 -0.115996133
3 -0.906391865 -0.422806178
4 -0.966118293 -0.906391865
5 -0.730436938 -0.966118293
6 -0.085786216 -0.730436938
7 0.319138078 -0.085786216
8 0.471175241 0.319138078
9 0.231361056 0.471175241
10 -0.095722561 0.231361056
11 -0.184965501 -0.095722561
12 -0.138926316 -0.184965501
13 -0.012331338 -0.138926316
14 0.150619448 -0.012331338
15 0.119158681 0.150619448
16 0.236178642 0.119158681
17 0.130677952 0.236178642
18 0.075328675 0.130677952
19 0.103506579 0.075328675
20 0.267854477 0.103506579
21 0.335025850 0.267854477
22 0.420252969 0.335025850
23 0.388460125 0.420252969
24 0.427660013 0.388460125
25 0.473405022 0.427660013
26 0.546077086 0.473405022
27 0.769330696 0.546077086
28 0.812339987 0.769330696
29 0.571274952 0.812339987
30 0.004982798 0.571274952
31 -0.172310735 0.004982798
32 -0.074987949 -0.172310735
33 0.074401252 -0.074987949
34 0.200664153 0.074401252
35 0.075710607 0.200664153
36 -0.041171743 0.075710607
37 0.020987580 -0.041171743
38 0.101866800 0.020987580
39 0.518281114 0.101866800
40 0.395633151 0.518281114
41 -0.045431884 0.395633151
42 -0.513091897 -0.045431884
43 -0.809535462 -0.513091897
44 -0.972544753 -0.809535462
45 -0.615094657 -0.972544753
46 -0.295817314 -0.615094657
47 -0.186574374 -0.295817314
48 -0.252845924 -0.186574374
49 -0.366065132 -0.252845924
50 -0.375757157 -0.366065132
51 -0.500378626 -0.375757157
52 -0.478033488 -0.500378626
53 0.073915918 -0.478033488
54 0.518566640 0.073915918
55 0.559201541 0.518566640
56 0.308502985 0.559201541
57 -0.025693501 0.308502985
58 -0.229377246 -0.025693501
59 -0.092630857 -0.229377246
> 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/7fofc1258554812.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/8w3xw1258554812.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/9txmr1258554812.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/10tvv41258554812.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/11ag2c1258554812.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/12ay8j1258554812.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/138ux81258554812.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/145ejq1258554812.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/15mkq41258554812.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/169hzt1258554813.tab")
+ }
>
> system("convert tmp/1m10l1258554812.ps tmp/1m10l1258554812.png")
> system("convert tmp/2cink1258554812.ps tmp/2cink1258554812.png")
> system("convert tmp/343y21258554812.ps tmp/343y21258554812.png")
> system("convert tmp/4m7q11258554812.ps tmp/4m7q11258554812.png")
> system("convert tmp/5ti1h1258554812.ps tmp/5ti1h1258554812.png")
> system("convert tmp/622ar1258554812.ps tmp/622ar1258554812.png")
> system("convert tmp/7fofc1258554812.ps tmp/7fofc1258554812.png")
> system("convert tmp/8w3xw1258554812.ps tmp/8w3xw1258554812.png")
> system("convert tmp/9txmr1258554812.ps tmp/9txmr1258554812.png")
> system("convert tmp/10tvv41258554812.ps tmp/10tvv41258554812.png")
>
>
> proc.time()
user system elapsed
2.342 1.563 2.844