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(99.9,98.8,98.6,100.5,107.2,110.4,95.7,96.4,93.7,101.9,106.7,106.2,86.7,81,95.3,94.7,99.3,101,101.8,109.4,96,102.3,91.7,90.7,95.3,96.2,96.6,96.1,107.2,106,108,103.1,98.4,102,103.1,104.7,81.1,86,96.6,92.1,103.7,106.9,106.6,112.6,97.6,101.7,87.6,92,99.4,97.4,98.5,97,105.2,105.4,104.6,102.7,97.5,98.1,108.9,104.5,86.8,87.4,88.9,89.9,110.3,109.8,114.8,111.7,94.6,98.6,92,96.9,93.8,95.1,93.8,97,107.6,112.7,101,102.9,95.4,97.4,96.5,111.4,89.2,87.4,87.1,96.8,110.5,114.1,110.8,110.3,104.2,103.9,88.9,101.6,89.8,94.6,90,95.9,93.9,104.7,91.3,102.8,87.8,98.1,99.7,113.9,73.5,80.9,79.2,95.7,96.9,113.2,95.2,105.9,95.6,108.8,89.7,102.3),dim=c(2,60),dimnames=list(c('ProdMetal','IndProd'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('ProdMetal','IndProd'),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 = '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
IndProd ProdMetal M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 98.8 99.9 1 0 0 0 0 0 0 0 0 0 0
2 100.5 98.6 0 1 0 0 0 0 0 0 0 0 0
3 110.4 107.2 0 0 1 0 0 0 0 0 0 0 0
4 96.4 95.7 0 0 0 1 0 0 0 0 0 0 0
5 101.9 93.7 0 0 0 0 1 0 0 0 0 0 0
6 106.2 106.7 0 0 0 0 0 1 0 0 0 0 0
7 81.0 86.7 0 0 0 0 0 0 1 0 0 0 0
8 94.7 95.3 0 0 0 0 0 0 0 1 0 0 0
9 101.0 99.3 0 0 0 0 0 0 0 0 1 0 0
10 109.4 101.8 0 0 0 0 0 0 0 0 0 1 0
11 102.3 96.0 0 0 0 0 0 0 0 0 0 0 1
12 90.7 91.7 0 0 0 0 0 0 0 0 0 0 0
13 96.2 95.3 1 0 0 0 0 0 0 0 0 0 0
14 96.1 96.6 0 1 0 0 0 0 0 0 0 0 0
15 106.0 107.2 0 0 1 0 0 0 0 0 0 0 0
16 103.1 108.0 0 0 0 1 0 0 0 0 0 0 0
17 102.0 98.4 0 0 0 0 1 0 0 0 0 0 0
18 104.7 103.1 0 0 0 0 0 1 0 0 0 0 0
19 86.0 81.1 0 0 0 0 0 0 1 0 0 0 0
20 92.1 96.6 0 0 0 0 0 0 0 1 0 0 0
21 106.9 103.7 0 0 0 0 0 0 0 0 1 0 0
22 112.6 106.6 0 0 0 0 0 0 0 0 0 1 0
23 101.7 97.6 0 0 0 0 0 0 0 0 0 0 1
24 92.0 87.6 0 0 0 0 0 0 0 0 0 0 0
25 97.4 99.4 1 0 0 0 0 0 0 0 0 0 0
26 97.0 98.5 0 1 0 0 0 0 0 0 0 0 0
27 105.4 105.2 0 0 1 0 0 0 0 0 0 0 0
28 102.7 104.6 0 0 0 1 0 0 0 0 0 0 0
29 98.1 97.5 0 0 0 0 1 0 0 0 0 0 0
30 104.5 108.9 0 0 0 0 0 1 0 0 0 0 0
31 87.4 86.8 0 0 0 0 0 0 1 0 0 0 0
32 89.9 88.9 0 0 0 0 0 0 0 1 0 0 0
33 109.8 110.3 0 0 0 0 0 0 0 0 1 0 0
34 111.7 114.8 0 0 0 0 0 0 0 0 0 1 0
35 98.6 94.6 0 0 0 0 0 0 0 0 0 0 1
36 96.9 92.0 0 0 0 0 0 0 0 0 0 0 0
37 95.1 93.8 1 0 0 0 0 0 0 0 0 0 0
38 97.0 93.8 0 1 0 0 0 0 0 0 0 0 0
39 112.7 107.6 0 0 1 0 0 0 0 0 0 0 0
40 102.9 101.0 0 0 0 1 0 0 0 0 0 0 0
41 97.4 95.4 0 0 0 0 1 0 0 0 0 0 0
42 111.4 96.5 0 0 0 0 0 1 0 0 0 0 0
43 87.4 89.2 0 0 0 0 0 0 1 0 0 0 0
44 96.8 87.1 0 0 0 0 0 0 0 1 0 0 0
45 114.1 110.5 0 0 0 0 0 0 0 0 1 0 0
46 110.3 110.8 0 0 0 0 0 0 0 0 0 1 0
47 103.9 104.2 0 0 0 0 0 0 0 0 0 0 1
48 101.6 88.9 0 0 0 0 0 0 0 0 0 0 0
49 94.6 89.8 1 0 0 0 0 0 0 0 0 0 0
50 95.9 90.0 0 1 0 0 0 0 0 0 0 0 0
51 104.7 93.9 0 0 1 0 0 0 0 0 0 0 0
52 102.8 91.3 0 0 0 1 0 0 0 0 0 0 0
53 98.1 87.8 0 0 0 0 1 0 0 0 0 0 0
54 113.9 99.7 0 0 0 0 0 1 0 0 0 0 0
55 80.9 73.5 0 0 0 0 0 0 1 0 0 0 0
56 95.7 79.2 0 0 0 0 0 0 0 1 0 0 0
57 113.2 96.9 0 0 0 0 0 0 0 0 1 0 0
58 105.9 95.2 0 0 0 0 0 0 0 0 0 1 0
59 108.8 95.6 0 0 0 0 0 0 0 0 0 0 1
60 102.3 89.7 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) ProdMetal M1 M2 M3 M4
84.4853 0.1357 -1.0483 -0.1493 9.2069 3.5035
M5 M6 M7 M8 M9 M10
2.1783 9.6753 -11.2749 -2.7840 10.3778 11.1270
M11
5.3256
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-7.34298 -2.22165 -0.07172 2.21825 6.20526
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 84.48534 8.35748 10.109 2.25e-13 ***
ProdMetal 0.13575 0.09128 1.487 0.143663
M1 -1.04834 2.24351 -0.467 0.642462
M2 -0.14933 2.24060 -0.067 0.947144
M3 9.20694 2.54088 3.624 0.000712 ***
M4 3.50351 2.37132 1.477 0.146225
M5 2.17827 2.22288 0.980 0.332137
M6 9.67527 2.48488 3.894 0.000311 ***
M7 -11.27492 2.26288 -4.983 8.92e-06 ***
M8 -2.78398 2.18381 -1.275 0.208636
M9 10.37780 2.53715 4.090 0.000167 ***
M10 11.12703 2.61962 4.248 0.000101 ***
M11 5.32560 2.29134 2.324 0.024486 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.452 on 47 degrees of freedom
Multiple R-squared: 0.8487, Adjusted R-squared: 0.8101
F-statistic: 21.98 on 12 and 47 DF, p-value: 2.618e-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.27111723 0.5422345 0.7288828
[2,] 0.18811764 0.3762353 0.8118824
[3,] 0.10648626 0.2129725 0.8935137
[4,] 0.31238041 0.6247608 0.6876196
[5,] 0.25678951 0.5135790 0.7432105
[6,] 0.27251666 0.5450333 0.7274833
[7,] 0.20023129 0.4004626 0.7997687
[8,] 0.13670791 0.2734158 0.8632921
[9,] 0.17129775 0.3425955 0.8287022
[10,] 0.11586852 0.2317370 0.8841315
[11,] 0.07817600 0.1563520 0.9218240
[12,] 0.06273873 0.1254775 0.9372613
[13,] 0.04232050 0.0846410 0.9576795
[14,] 0.04747690 0.0949538 0.9525231
[15,] 0.11790362 0.2358072 0.8820964
[16,] 0.10157346 0.2031469 0.8984265
[17,] 0.16907656 0.3381531 0.8309234
[18,] 0.21914748 0.4382950 0.7808525
[19,] 0.19458582 0.3891716 0.8054142
[20,] 0.35983163 0.7196633 0.6401684
[21,] 0.61479661 0.7704068 0.3852034
[22,] 0.51063693 0.9787261 0.4893631
[23,] 0.40310632 0.8062126 0.5968937
[24,] 0.61493466 0.7701307 0.3850653
[25,] 0.54079403 0.9184119 0.4592060
[26,] 0.47595856 0.9519171 0.5240414
[27,] 0.56574181 0.8685164 0.4342582
[28,] 0.59745967 0.8050807 0.4025403
[29,] 0.47261074 0.9452215 0.5273893
> postscript(file="/var/www/html/rcomp/tmp/123ln1260636856.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/299tu1260636856.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/3pbij1260636856.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/4z36u1260636856.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/5uh6i1260636856.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.80171075 2.77917918 2.15546902 -4.57999097 2.51674384 -2.44498498
7 8 9 10 11 12
-3.97982563 0.06179794 -7.34297653 -0.03157545 -0.54280216 -6.23348768
13 14 15 16 17 18
-0.17384546 -1.34932352 -2.24453098 0.45030063 1.97872518 -3.45628984
19 20 21 22 23 24
1.78036681 -2.71467531 -2.04027059 2.51683103 -1.36000000 -4.37691821
25 26 27 28 29 30
0.46958507 -0.70724595 -2.57303368 0.51184605 -1.79910103 -4.44363201
31 32 33 34 35 36
2.40659951 -3.86941070 -0.03621169 0.50369209 -4.05275405 -0.07421227
37 38 39 40 41 42
-1.07022248 -0.06922729 4.40116956 1.20054119 -2.21402887 4.13965125
43 44 45 46 47 48
2.08080275 3.27493687 4.23663858 -0.35331331 -0.05594109 5.04660854
49 50 51 52 53 54
-1.02722788 -0.65338242 -1.73907393 2.41730310 -0.48233912 6.20525557
55 56 57 58 59 60
-2.28794344 3.24735121 5.18282023 -2.63563436 6.01149730 5.63800962
> postscript(file="/var/www/html/rcomp/tmp/6kfe81260636856.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.80171075 NA
1 2.77917918 1.80171075
2 2.15546902 2.77917918
3 -4.57999097 2.15546902
4 2.51674384 -4.57999097
5 -2.44498498 2.51674384
6 -3.97982563 -2.44498498
7 0.06179794 -3.97982563
8 -7.34297653 0.06179794
9 -0.03157545 -7.34297653
10 -0.54280216 -0.03157545
11 -6.23348768 -0.54280216
12 -0.17384546 -6.23348768
13 -1.34932352 -0.17384546
14 -2.24453098 -1.34932352
15 0.45030063 -2.24453098
16 1.97872518 0.45030063
17 -3.45628984 1.97872518
18 1.78036681 -3.45628984
19 -2.71467531 1.78036681
20 -2.04027059 -2.71467531
21 2.51683103 -2.04027059
22 -1.36000000 2.51683103
23 -4.37691821 -1.36000000
24 0.46958507 -4.37691821
25 -0.70724595 0.46958507
26 -2.57303368 -0.70724595
27 0.51184605 -2.57303368
28 -1.79910103 0.51184605
29 -4.44363201 -1.79910103
30 2.40659951 -4.44363201
31 -3.86941070 2.40659951
32 -0.03621169 -3.86941070
33 0.50369209 -0.03621169
34 -4.05275405 0.50369209
35 -0.07421227 -4.05275405
36 -1.07022248 -0.07421227
37 -0.06922729 -1.07022248
38 4.40116956 -0.06922729
39 1.20054119 4.40116956
40 -2.21402887 1.20054119
41 4.13965125 -2.21402887
42 2.08080275 4.13965125
43 3.27493687 2.08080275
44 4.23663858 3.27493687
45 -0.35331331 4.23663858
46 -0.05594109 -0.35331331
47 5.04660854 -0.05594109
48 -1.02722788 5.04660854
49 -0.65338242 -1.02722788
50 -1.73907393 -0.65338242
51 2.41730310 -1.73907393
52 -0.48233912 2.41730310
53 6.20525557 -0.48233912
54 -2.28794344 6.20525557
55 3.24735121 -2.28794344
56 5.18282023 3.24735121
57 -2.63563436 5.18282023
58 6.01149730 -2.63563436
59 5.63800962 6.01149730
60 NA 5.63800962
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.77917918 1.80171075
[2,] 2.15546902 2.77917918
[3,] -4.57999097 2.15546902
[4,] 2.51674384 -4.57999097
[5,] -2.44498498 2.51674384
[6,] -3.97982563 -2.44498498
[7,] 0.06179794 -3.97982563
[8,] -7.34297653 0.06179794
[9,] -0.03157545 -7.34297653
[10,] -0.54280216 -0.03157545
[11,] -6.23348768 -0.54280216
[12,] -0.17384546 -6.23348768
[13,] -1.34932352 -0.17384546
[14,] -2.24453098 -1.34932352
[15,] 0.45030063 -2.24453098
[16,] 1.97872518 0.45030063
[17,] -3.45628984 1.97872518
[18,] 1.78036681 -3.45628984
[19,] -2.71467531 1.78036681
[20,] -2.04027059 -2.71467531
[21,] 2.51683103 -2.04027059
[22,] -1.36000000 2.51683103
[23,] -4.37691821 -1.36000000
[24,] 0.46958507 -4.37691821
[25,] -0.70724595 0.46958507
[26,] -2.57303368 -0.70724595
[27,] 0.51184605 -2.57303368
[28,] -1.79910103 0.51184605
[29,] -4.44363201 -1.79910103
[30,] 2.40659951 -4.44363201
[31,] -3.86941070 2.40659951
[32,] -0.03621169 -3.86941070
[33,] 0.50369209 -0.03621169
[34,] -4.05275405 0.50369209
[35,] -0.07421227 -4.05275405
[36,] -1.07022248 -0.07421227
[37,] -0.06922729 -1.07022248
[38,] 4.40116956 -0.06922729
[39,] 1.20054119 4.40116956
[40,] -2.21402887 1.20054119
[41,] 4.13965125 -2.21402887
[42,] 2.08080275 4.13965125
[43,] 3.27493687 2.08080275
[44,] 4.23663858 3.27493687
[45,] -0.35331331 4.23663858
[46,] -0.05594109 -0.35331331
[47,] 5.04660854 -0.05594109
[48,] -1.02722788 5.04660854
[49,] -0.65338242 -1.02722788
[50,] -1.73907393 -0.65338242
[51,] 2.41730310 -1.73907393
[52,] -0.48233912 2.41730310
[53,] 6.20525557 -0.48233912
[54,] -2.28794344 6.20525557
[55,] 3.24735121 -2.28794344
[56,] 5.18282023 3.24735121
[57,] -2.63563436 5.18282023
[58,] 6.01149730 -2.63563436
[59,] 5.63800962 6.01149730
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.77917918 1.80171075
2 2.15546902 2.77917918
3 -4.57999097 2.15546902
4 2.51674384 -4.57999097
5 -2.44498498 2.51674384
6 -3.97982563 -2.44498498
7 0.06179794 -3.97982563
8 -7.34297653 0.06179794
9 -0.03157545 -7.34297653
10 -0.54280216 -0.03157545
11 -6.23348768 -0.54280216
12 -0.17384546 -6.23348768
13 -1.34932352 -0.17384546
14 -2.24453098 -1.34932352
15 0.45030063 -2.24453098
16 1.97872518 0.45030063
17 -3.45628984 1.97872518
18 1.78036681 -3.45628984
19 -2.71467531 1.78036681
20 -2.04027059 -2.71467531
21 2.51683103 -2.04027059
22 -1.36000000 2.51683103
23 -4.37691821 -1.36000000
24 0.46958507 -4.37691821
25 -0.70724595 0.46958507
26 -2.57303368 -0.70724595
27 0.51184605 -2.57303368
28 -1.79910103 0.51184605
29 -4.44363201 -1.79910103
30 2.40659951 -4.44363201
31 -3.86941070 2.40659951
32 -0.03621169 -3.86941070
33 0.50369209 -0.03621169
34 -4.05275405 0.50369209
35 -0.07421227 -4.05275405
36 -1.07022248 -0.07421227
37 -0.06922729 -1.07022248
38 4.40116956 -0.06922729
39 1.20054119 4.40116956
40 -2.21402887 1.20054119
41 4.13965125 -2.21402887
42 2.08080275 4.13965125
43 3.27493687 2.08080275
44 4.23663858 3.27493687
45 -0.35331331 4.23663858
46 -0.05594109 -0.35331331
47 5.04660854 -0.05594109
48 -1.02722788 5.04660854
49 -0.65338242 -1.02722788
50 -1.73907393 -0.65338242
51 2.41730310 -1.73907393
52 -0.48233912 2.41730310
53 6.20525557 -0.48233912
54 -2.28794344 6.20525557
55 3.24735121 -2.28794344
56 5.18282023 3.24735121
57 -2.63563436 5.18282023
58 6.01149730 -2.63563436
59 5.63800962 6.01149730
> 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/7eody1260636856.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/8zzg01260636856.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/9zvgx1260636856.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/10c5p71260636856.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/111l7j1260636856.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/125awm1260636856.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/13uike1260636856.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/14mcd21260636856.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/15e5iw1260636856.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/16wys61260636856.tab")
+ }
> try(system("convert tmp/123ln1260636856.ps tmp/123ln1260636856.png",intern=TRUE))
character(0)
> try(system("convert tmp/299tu1260636856.ps tmp/299tu1260636856.png",intern=TRUE))
character(0)
> try(system("convert tmp/3pbij1260636856.ps tmp/3pbij1260636856.png",intern=TRUE))
character(0)
> try(system("convert tmp/4z36u1260636856.ps tmp/4z36u1260636856.png",intern=TRUE))
character(0)
> try(system("convert tmp/5uh6i1260636856.ps tmp/5uh6i1260636856.png",intern=TRUE))
character(0)
> try(system("convert tmp/6kfe81260636856.ps tmp/6kfe81260636856.png",intern=TRUE))
character(0)
> try(system("convert tmp/7eody1260636856.ps tmp/7eody1260636856.png",intern=TRUE))
character(0)
> try(system("convert tmp/8zzg01260636856.ps tmp/8zzg01260636856.png",intern=TRUE))
character(0)
> try(system("convert tmp/9zvgx1260636856.ps tmp/9zvgx1260636856.png",intern=TRUE))
character(0)
> try(system("convert tmp/10c5p71260636856.ps tmp/10c5p71260636856.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.394 1.547 3.956