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(95.1,121.8,97.0,127.6,112.7,129.9,102.9,128.0,97.4,123.5,111.4,124.0,87.4,127.4,96.8,127.6,114.1,128.4,110.3,131.4,103.9,135.1,101.6,134.0,94.6,144.5,95.9,147.3,104.7,150.9,102.8,148.7,98.1,141.4,113.9,138.9,80.9,139.8,95.7,145.6,113.2,147.9,105.9,148.5,108.8,151.1,102.3,157.5,99.0,167.5,100.7,172.3,115.5,173.5,100.7,187.5,109.9,205.5,114.6,195.1,85.4,204.5,100.5,204.5,114.8,201.7,116.5,207.0,112.9,206.6,102.0,210.6,106.0,211.1,105.3,215.0,118.8,223.9,106.1,238.2,109.3,238.9,117.2,229.6,92.5,232.2,104.2,222.1,112.5,221.6,122.4,227.3,113.3,221.0,100.0,213.6,110.7,243.4,112.8,253.8,109.8,265.3,117.3,268.2,109.1,268.5,115.9,266.9,96.0,268.4,99.8,250.8,116.8,231.2,115.7,192.0,99.4,171.4,94.3,160.0),dim=c(2,60),dimnames=list(c('TIP','Grondstofprijzen'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('TIP','Grondstofprijzen'),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
TIP Grondstofprijzen M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 95.1 121.8 1 0 0 0 0 0 0 0 0 0 0
2 97.0 127.6 0 1 0 0 0 0 0 0 0 0 0
3 112.7 129.9 0 0 1 0 0 0 0 0 0 0 0
4 102.9 128.0 0 0 0 1 0 0 0 0 0 0 0
5 97.4 123.5 0 0 0 0 1 0 0 0 0 0 0
6 111.4 124.0 0 0 0 0 0 1 0 0 0 0 0
7 87.4 127.4 0 0 0 0 0 0 1 0 0 0 0
8 96.8 127.6 0 0 0 0 0 0 0 1 0 0 0
9 114.1 128.4 0 0 0 0 0 0 0 0 1 0 0
10 110.3 131.4 0 0 0 0 0 0 0 0 0 1 0
11 103.9 135.1 0 0 0 0 0 0 0 0 0 0 1
12 101.6 134.0 0 0 0 0 0 0 0 0 0 0 0
13 94.6 144.5 1 0 0 0 0 0 0 0 0 0 0
14 95.9 147.3 0 1 0 0 0 0 0 0 0 0 0
15 104.7 150.9 0 0 1 0 0 0 0 0 0 0 0
16 102.8 148.7 0 0 0 1 0 0 0 0 0 0 0
17 98.1 141.4 0 0 0 0 1 0 0 0 0 0 0
18 113.9 138.9 0 0 0 0 0 1 0 0 0 0 0
19 80.9 139.8 0 0 0 0 0 0 1 0 0 0 0
20 95.7 145.6 0 0 0 0 0 0 0 1 0 0 0
21 113.2 147.9 0 0 0 0 0 0 0 0 1 0 0
22 105.9 148.5 0 0 0 0 0 0 0 0 0 1 0
23 108.8 151.1 0 0 0 0 0 0 0 0 0 0 1
24 102.3 157.5 0 0 0 0 0 0 0 0 0 0 0
25 99.0 167.5 1 0 0 0 0 0 0 0 0 0 0
26 100.7 172.3 0 1 0 0 0 0 0 0 0 0 0
27 115.5 173.5 0 0 1 0 0 0 0 0 0 0 0
28 100.7 187.5 0 0 0 1 0 0 0 0 0 0 0
29 109.9 205.5 0 0 0 0 1 0 0 0 0 0 0
30 114.6 195.1 0 0 0 0 0 1 0 0 0 0 0
31 85.4 204.5 0 0 0 0 0 0 1 0 0 0 0
32 100.5 204.5 0 0 0 0 0 0 0 1 0 0 0
33 114.8 201.7 0 0 0 0 0 0 0 0 1 0 0
34 116.5 207.0 0 0 0 0 0 0 0 0 0 1 0
35 112.9 206.6 0 0 0 0 0 0 0 0 0 0 1
36 102.0 210.6 0 0 0 0 0 0 0 0 0 0 0
37 106.0 211.1 1 0 0 0 0 0 0 0 0 0 0
38 105.3 215.0 0 1 0 0 0 0 0 0 0 0 0
39 118.8 223.9 0 0 1 0 0 0 0 0 0 0 0
40 106.1 238.2 0 0 0 1 0 0 0 0 0 0 0
41 109.3 238.9 0 0 0 0 1 0 0 0 0 0 0
42 117.2 229.6 0 0 0 0 0 1 0 0 0 0 0
43 92.5 232.2 0 0 0 0 0 0 1 0 0 0 0
44 104.2 222.1 0 0 0 0 0 0 0 1 0 0 0
45 112.5 221.6 0 0 0 0 0 0 0 0 1 0 0
46 122.4 227.3 0 0 0 0 0 0 0 0 0 1 0
47 113.3 221.0 0 0 0 0 0 0 0 0 0 0 1
48 100.0 213.6 0 0 0 0 0 0 0 0 0 0 0
49 110.7 243.4 1 0 0 0 0 0 0 0 0 0 0
50 112.8 253.8 0 1 0 0 0 0 0 0 0 0 0
51 109.8 265.3 0 0 1 0 0 0 0 0 0 0 0
52 117.3 268.2 0 0 0 1 0 0 0 0 0 0 0
53 109.1 268.5 0 0 0 0 1 0 0 0 0 0 0
54 115.9 266.9 0 0 0 0 0 1 0 0 0 0 0
55 96.0 268.4 0 0 0 0 0 0 1 0 0 0 0
56 99.8 250.8 0 0 0 0 0 0 0 1 0 0 0
57 116.8 231.2 0 0 0 0 0 0 0 0 1 0 0
58 115.7 192.0 0 0 0 0 0 0 0 0 0 1 0
59 99.4 171.4 0 0 0 0 0 0 0 0 0 0 1
60 94.3 160.0 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) Grondstofprijzen M1 M2
86.93429 0.07483 0.85143 1.69687
M3 M4 M5 M6
11.24531 4.49973 3.19197 13.38068
M7 M8 M9 M10
-13.04571 -1.76095 13.41537 13.66354
M11
7.47782
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-8.23197 -2.68490 -0.05327 2.57027 5.79660
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 86.93429 2.56575 33.883 < 2e-16 ***
Grondstofprijzen 0.07483 0.01084 6.901 1.15e-08 ***
M1 0.85143 2.44009 0.349 0.72870
M2 1.69687 2.44150 0.695 0.49047
M3 11.24531 2.44437 4.601 3.20e-05 ***
M4 4.49973 2.44860 1.838 0.07244 .
M5 3.19197 2.44997 1.303 0.19897
M6 13.38068 2.44592 5.471 1.69e-06 ***
M7 -13.04571 2.44892 -5.327 2.76e-06 ***
M8 -1.76095 2.44534 -0.720 0.47501
M9 13.41537 2.44286 5.492 1.57e-06 ***
M10 13.66354 2.44084 5.598 1.09e-06 ***
M11 7.47782 2.44003 3.065 0.00360 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.858 on 47 degrees of freedom
Multiple R-squared: 0.8536, Adjusted R-squared: 0.8162
F-statistic: 22.84 on 12 and 47 DF, p-value: 1.243e-15
> 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.26715075 0.53430150 0.7328492
[2,] 0.16927490 0.33854981 0.8307251
[3,] 0.14132952 0.28265904 0.8586705
[4,] 0.16679579 0.33359158 0.8332042
[5,] 0.09425094 0.18850188 0.9057491
[6,] 0.05547241 0.11094483 0.9445276
[7,] 0.04676238 0.09352476 0.9532376
[8,] 0.07714940 0.15429880 0.9228506
[9,] 0.06628444 0.13256887 0.9337156
[10,] 0.08912229 0.17824459 0.9108777
[11,] 0.08388705 0.16777410 0.9161130
[12,] 0.14351394 0.28702788 0.8564861
[13,] 0.14111508 0.28223017 0.8588849
[14,] 0.26593672 0.53187344 0.7340633
[15,] 0.22433168 0.44866337 0.7756683
[16,] 0.19574269 0.39148538 0.8042573
[17,] 0.13822574 0.27645148 0.8617743
[18,] 0.10416554 0.20833108 0.8958345
[19,] 0.09013010 0.18026020 0.9098699
[20,] 0.08331220 0.16662439 0.9166878
[21,] 0.06601871 0.13203742 0.9339813
[22,] 0.05929972 0.11859944 0.9407003
[23,] 0.04377030 0.08754060 0.9562297
[24,] 0.18516126 0.37032251 0.8148387
[25,] 0.24663620 0.49327239 0.7533638
[26,] 0.19430047 0.38860093 0.8056995
[27,] 0.21962444 0.43924887 0.7803756
[28,] 0.14310342 0.28620684 0.8568966
[29,] 0.46013886 0.92027773 0.5398611
> postscript(file="/var/www/html/rcomp/tmp/1teoe1260783910.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/2ch4m1260783910.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/3eorn1260783910.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/4x2cu1260783910.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/5o6ea1260783910.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
-1.80000202 -1.17945779 4.79999788 1.88775271 -1.96775770 1.80612003
7 8 9 10 11 12
3.97809282 2.07836509 4.14217478 -0.13047799 -0.62163417 4.63850192
13 14 15 16 17 18
-3.99864065 -3.75360674 -4.77142994 0.23877387 -2.60721284 3.19115458
19 20 21 22 23 24
-3.44979789 -0.36857304 1.78299182 -5.81006921 3.08108750 3.57999936
25 26 27 28 29 30
-1.31972826 -0.82435414 4.33741442 -4.76462609 4.39619084 -0.31428556
31 32 33 34 35 36
-3.79129215 0.02394610 -0.64285658 0.41238188 3.02802828 -0.69346811
37 38 39 40 41 42
2.41768828 0.58040931 3.86598767 -3.15850181 1.29687231 -0.29591697
43 44 45 46 47 48
1.23591973 2.40693993 -4.43197151 4.79333500 2.35047778 -2.91795779
49 50 51 52 53 54
4.70068265 5.17700935 -8.23197002 5.79660131 -1.11809260 -4.38707209
55 56 57 58 59 60
2.02707750 -4.14067808 -0.85033851 0.73483032 -7.83795939 -4.60707538
> postscript(file="/var/www/html/rcomp/tmp/60iwd1260783910.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 -1.80000202 NA
1 -1.17945779 -1.80000202
2 4.79999788 -1.17945779
3 1.88775271 4.79999788
4 -1.96775770 1.88775271
5 1.80612003 -1.96775770
6 3.97809282 1.80612003
7 2.07836509 3.97809282
8 4.14217478 2.07836509
9 -0.13047799 4.14217478
10 -0.62163417 -0.13047799
11 4.63850192 -0.62163417
12 -3.99864065 4.63850192
13 -3.75360674 -3.99864065
14 -4.77142994 -3.75360674
15 0.23877387 -4.77142994
16 -2.60721284 0.23877387
17 3.19115458 -2.60721284
18 -3.44979789 3.19115458
19 -0.36857304 -3.44979789
20 1.78299182 -0.36857304
21 -5.81006921 1.78299182
22 3.08108750 -5.81006921
23 3.57999936 3.08108750
24 -1.31972826 3.57999936
25 -0.82435414 -1.31972826
26 4.33741442 -0.82435414
27 -4.76462609 4.33741442
28 4.39619084 -4.76462609
29 -0.31428556 4.39619084
30 -3.79129215 -0.31428556
31 0.02394610 -3.79129215
32 -0.64285658 0.02394610
33 0.41238188 -0.64285658
34 3.02802828 0.41238188
35 -0.69346811 3.02802828
36 2.41768828 -0.69346811
37 0.58040931 2.41768828
38 3.86598767 0.58040931
39 -3.15850181 3.86598767
40 1.29687231 -3.15850181
41 -0.29591697 1.29687231
42 1.23591973 -0.29591697
43 2.40693993 1.23591973
44 -4.43197151 2.40693993
45 4.79333500 -4.43197151
46 2.35047778 4.79333500
47 -2.91795779 2.35047778
48 4.70068265 -2.91795779
49 5.17700935 4.70068265
50 -8.23197002 5.17700935
51 5.79660131 -8.23197002
52 -1.11809260 5.79660131
53 -4.38707209 -1.11809260
54 2.02707750 -4.38707209
55 -4.14067808 2.02707750
56 -0.85033851 -4.14067808
57 0.73483032 -0.85033851
58 -7.83795939 0.73483032
59 -4.60707538 -7.83795939
60 NA -4.60707538
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.17945779 -1.80000202
[2,] 4.79999788 -1.17945779
[3,] 1.88775271 4.79999788
[4,] -1.96775770 1.88775271
[5,] 1.80612003 -1.96775770
[6,] 3.97809282 1.80612003
[7,] 2.07836509 3.97809282
[8,] 4.14217478 2.07836509
[9,] -0.13047799 4.14217478
[10,] -0.62163417 -0.13047799
[11,] 4.63850192 -0.62163417
[12,] -3.99864065 4.63850192
[13,] -3.75360674 -3.99864065
[14,] -4.77142994 -3.75360674
[15,] 0.23877387 -4.77142994
[16,] -2.60721284 0.23877387
[17,] 3.19115458 -2.60721284
[18,] -3.44979789 3.19115458
[19,] -0.36857304 -3.44979789
[20,] 1.78299182 -0.36857304
[21,] -5.81006921 1.78299182
[22,] 3.08108750 -5.81006921
[23,] 3.57999936 3.08108750
[24,] -1.31972826 3.57999936
[25,] -0.82435414 -1.31972826
[26,] 4.33741442 -0.82435414
[27,] -4.76462609 4.33741442
[28,] 4.39619084 -4.76462609
[29,] -0.31428556 4.39619084
[30,] -3.79129215 -0.31428556
[31,] 0.02394610 -3.79129215
[32,] -0.64285658 0.02394610
[33,] 0.41238188 -0.64285658
[34,] 3.02802828 0.41238188
[35,] -0.69346811 3.02802828
[36,] 2.41768828 -0.69346811
[37,] 0.58040931 2.41768828
[38,] 3.86598767 0.58040931
[39,] -3.15850181 3.86598767
[40,] 1.29687231 -3.15850181
[41,] -0.29591697 1.29687231
[42,] 1.23591973 -0.29591697
[43,] 2.40693993 1.23591973
[44,] -4.43197151 2.40693993
[45,] 4.79333500 -4.43197151
[46,] 2.35047778 4.79333500
[47,] -2.91795779 2.35047778
[48,] 4.70068265 -2.91795779
[49,] 5.17700935 4.70068265
[50,] -8.23197002 5.17700935
[51,] 5.79660131 -8.23197002
[52,] -1.11809260 5.79660131
[53,] -4.38707209 -1.11809260
[54,] 2.02707750 -4.38707209
[55,] -4.14067808 2.02707750
[56,] -0.85033851 -4.14067808
[57,] 0.73483032 -0.85033851
[58,] -7.83795939 0.73483032
[59,] -4.60707538 -7.83795939
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.17945779 -1.80000202
2 4.79999788 -1.17945779
3 1.88775271 4.79999788
4 -1.96775770 1.88775271
5 1.80612003 -1.96775770
6 3.97809282 1.80612003
7 2.07836509 3.97809282
8 4.14217478 2.07836509
9 -0.13047799 4.14217478
10 -0.62163417 -0.13047799
11 4.63850192 -0.62163417
12 -3.99864065 4.63850192
13 -3.75360674 -3.99864065
14 -4.77142994 -3.75360674
15 0.23877387 -4.77142994
16 -2.60721284 0.23877387
17 3.19115458 -2.60721284
18 -3.44979789 3.19115458
19 -0.36857304 -3.44979789
20 1.78299182 -0.36857304
21 -5.81006921 1.78299182
22 3.08108750 -5.81006921
23 3.57999936 3.08108750
24 -1.31972826 3.57999936
25 -0.82435414 -1.31972826
26 4.33741442 -0.82435414
27 -4.76462609 4.33741442
28 4.39619084 -4.76462609
29 -0.31428556 4.39619084
30 -3.79129215 -0.31428556
31 0.02394610 -3.79129215
32 -0.64285658 0.02394610
33 0.41238188 -0.64285658
34 3.02802828 0.41238188
35 -0.69346811 3.02802828
36 2.41768828 -0.69346811
37 0.58040931 2.41768828
38 3.86598767 0.58040931
39 -3.15850181 3.86598767
40 1.29687231 -3.15850181
41 -0.29591697 1.29687231
42 1.23591973 -0.29591697
43 2.40693993 1.23591973
44 -4.43197151 2.40693993
45 4.79333500 -4.43197151
46 2.35047778 4.79333500
47 -2.91795779 2.35047778
48 4.70068265 -2.91795779
49 5.17700935 4.70068265
50 -8.23197002 5.17700935
51 5.79660131 -8.23197002
52 -1.11809260 5.79660131
53 -4.38707209 -1.11809260
54 2.02707750 -4.38707209
55 -4.14067808 2.02707750
56 -0.85033851 -4.14067808
57 0.73483032 -0.85033851
58 -7.83795939 0.73483032
59 -4.60707538 -7.83795939
> 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/7z6ea1260783910.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/8iiud1260783910.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/9es2r1260783910.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/10iv7c1260783910.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/11jedl1260783910.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/12n3iz1260783910.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/1341ao1260783910.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/14dv021260783910.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/15r31y1260783910.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/1600ge1260783910.tab")
+ }
>
> try(system("convert tmp/1teoe1260783910.ps tmp/1teoe1260783910.png",intern=TRUE))
character(0)
> try(system("convert tmp/2ch4m1260783910.ps tmp/2ch4m1260783910.png",intern=TRUE))
character(0)
> try(system("convert tmp/3eorn1260783910.ps tmp/3eorn1260783910.png",intern=TRUE))
character(0)
> try(system("convert tmp/4x2cu1260783910.ps tmp/4x2cu1260783910.png",intern=TRUE))
character(0)
> try(system("convert tmp/5o6ea1260783910.ps tmp/5o6ea1260783910.png",intern=TRUE))
character(0)
> try(system("convert tmp/60iwd1260783910.ps tmp/60iwd1260783910.png",intern=TRUE))
character(0)
> try(system("convert tmp/7z6ea1260783910.ps tmp/7z6ea1260783910.png",intern=TRUE))
character(0)
> try(system("convert tmp/8iiud1260783910.ps tmp/8iiud1260783910.png",intern=TRUE))
character(0)
> try(system("convert tmp/9es2r1260783910.ps tmp/9es2r1260783910.png",intern=TRUE))
character(0)
> try(system("convert tmp/10iv7c1260783910.ps tmp/10iv7c1260783910.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.430 1.561 3.137