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(96.96,89.1,93.11,83.3,95.62,97.7,98.30,100.9,96.38,108.3,100.82,113.2,99.06,105,94.03,104,102.07,109.8,99.31,98.6,98.64,93.5,101.82,98.2,99.14,88,97.63,85.3,100.06,96.8,101.32,98.8,101.49,110.3,105.43,111.6,105.09,111.2,99.48,106.9,108.53,117.6,104.34,97,106.10,97.3,107.35,98.4,103.00,87.6,104.50,87.4,105.17,94.7,104.84,101.5,106.18,110.4,108.86,108.4,107.77,109.7,102.74,105.2,112.63,111.1,106.26,96.2,108.86,97.3,111.38,98.9,106.85,91.7,107.86,90.9,107.94,98.8,111.38,111.5,111.29,119,113.72,115.3,111.88,116.3,109.87,113.6,113.72,115.1,111.71,109.7,114.81,97.6,112.05,100.8,111.54,94,110.87,87.2,110.87,102.9,115.48,111.3,111.63,106.6,116.24,108.9,113.56,108.3,106.01,100.5,110.45,104,107.77,89.9,108.61,86.8,108.19,91.2),dim=c(2,60),dimnames=list(c('BESTC','INDUSTR'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('BESTC','INDUSTR'),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
BESTC INDUSTR M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 96.96 89.1 1 0 0 0 0 0 0 0 0 0 0
2 93.11 83.3 0 1 0 0 0 0 0 0 0 0 0
3 95.62 97.7 0 0 1 0 0 0 0 0 0 0 0
4 98.30 100.9 0 0 0 1 0 0 0 0 0 0 0
5 96.38 108.3 0 0 0 0 1 0 0 0 0 0 0
6 100.82 113.2 0 0 0 0 0 1 0 0 0 0 0
7 99.06 105.0 0 0 0 0 0 0 1 0 0 0 0
8 94.03 104.0 0 0 0 0 0 0 0 1 0 0 0
9 102.07 109.8 0 0 0 0 0 0 0 0 1 0 0
10 99.31 98.6 0 0 0 0 0 0 0 0 0 1 0
11 98.64 93.5 0 0 0 0 0 0 0 0 0 0 1
12 101.82 98.2 0 0 0 0 0 0 0 0 0 0 0
13 99.14 88.0 1 0 0 0 0 0 0 0 0 0 0
14 97.63 85.3 0 1 0 0 0 0 0 0 0 0 0
15 100.06 96.8 0 0 1 0 0 0 0 0 0 0 0
16 101.32 98.8 0 0 0 1 0 0 0 0 0 0 0
17 101.49 110.3 0 0 0 0 1 0 0 0 0 0 0
18 105.43 111.6 0 0 0 0 0 1 0 0 0 0 0
19 105.09 111.2 0 0 0 0 0 0 1 0 0 0 0
20 99.48 106.9 0 0 0 0 0 0 0 1 0 0 0
21 108.53 117.6 0 0 0 0 0 0 0 0 1 0 0
22 104.34 97.0 0 0 0 0 0 0 0 0 0 1 0
23 106.10 97.3 0 0 0 0 0 0 0 0 0 0 1
24 107.35 98.4 0 0 0 0 0 0 0 0 0 0 0
25 103.00 87.6 1 0 0 0 0 0 0 0 0 0 0
26 104.50 87.4 0 1 0 0 0 0 0 0 0 0 0
27 105.17 94.7 0 0 1 0 0 0 0 0 0 0 0
28 104.84 101.5 0 0 0 1 0 0 0 0 0 0 0
29 106.18 110.4 0 0 0 0 1 0 0 0 0 0 0
30 108.86 108.4 0 0 0 0 0 1 0 0 0 0 0
31 107.77 109.7 0 0 0 0 0 0 1 0 0 0 0
32 102.74 105.2 0 0 0 0 0 0 0 1 0 0 0
33 112.63 111.1 0 0 0 0 0 0 0 0 1 0 0
34 106.26 96.2 0 0 0 0 0 0 0 0 0 1 0
35 108.86 97.3 0 0 0 0 0 0 0 0 0 0 1
36 111.38 98.9 0 0 0 0 0 0 0 0 0 0 0
37 106.85 91.7 1 0 0 0 0 0 0 0 0 0 0
38 107.86 90.9 0 1 0 0 0 0 0 0 0 0 0
39 107.94 98.8 0 0 1 0 0 0 0 0 0 0 0
40 111.38 111.5 0 0 0 1 0 0 0 0 0 0 0
41 111.29 119.0 0 0 0 0 1 0 0 0 0 0 0
42 113.72 115.3 0 0 0 0 0 1 0 0 0 0 0
43 111.88 116.3 0 0 0 0 0 0 1 0 0 0 0
44 109.87 113.6 0 0 0 0 0 0 0 1 0 0 0
45 113.72 115.1 0 0 0 0 0 0 0 0 1 0 0
46 111.71 109.7 0 0 0 0 0 0 0 0 0 1 0
47 114.81 97.6 0 0 0 0 0 0 0 0 0 0 1
48 112.05 100.8 0 0 0 0 0 0 0 0 0 0 0
49 111.54 94.0 1 0 0 0 0 0 0 0 0 0 0
50 110.87 87.2 0 1 0 0 0 0 0 0 0 0 0
51 110.87 102.9 0 0 1 0 0 0 0 0 0 0 0
52 115.48 111.3 0 0 0 1 0 0 0 0 0 0 0
53 111.63 106.6 0 0 0 0 1 0 0 0 0 0 0
54 116.24 108.9 0 0 0 0 0 1 0 0 0 0 0
55 113.56 108.3 0 0 0 0 0 0 1 0 0 0 0
56 106.01 100.5 0 0 0 0 0 0 0 1 0 0 0
57 110.45 104.0 0 0 0 0 0 0 0 0 1 0 0
58 107.77 89.9 0 0 0 0 0 0 0 0 0 1 0
59 108.61 86.8 0 0 0 0 0 0 0 0 0 0 1
60 108.19 91.2 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) INDUSTR M1 M2 M3 M4
53.3119 0.5625 -0.4861 0.6438 -4.6085 -6.0004
M5 M6 M7 M8 M9 M10
-10.3131 -7.0081 -7.7738 -10.5360 -6.5646 -2.7188
M11
0.9336
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-9.1615 -3.5793 0.9087 3.2433 8.6773
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 53.3119 16.8750 3.159 0.00277 **
INDUSTR 0.5625 0.1713 3.284 0.00194 **
M1 -0.4861 3.6392 -0.134 0.89432
M2 0.6438 3.8698 0.166 0.86859
M3 -4.6085 3.4120 -1.351 0.18327
M4 -6.0004 3.6321 -1.652 0.10519
M5 -10.3131 4.1126 -2.508 0.01566 *
M6 -7.0081 4.1669 -1.682 0.09923 .
M7 -7.7738 4.0357 -1.926 0.06013 .
M8 -10.5360 3.7106 -2.839 0.00666 **
M9 -6.5646 4.1709 -1.574 0.12222
M10 -2.7188 3.4127 -0.797 0.42965
M11 0.9336 3.4485 0.271 0.78780
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.392 on 47 degrees of freedom
Multiple R-squared: 0.3168, Adjusted R-squared: 0.1424
F-statistic: 1.816 on 12 and 47 DF, p-value: 0.07281
> 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.4221664 0.84433287 0.577833563
[2,] 0.4640814 0.92816275 0.535918627
[3,] 0.5204879 0.95902411 0.479512055
[4,] 0.4972876 0.99457523 0.502712386
[5,] 0.5048374 0.99032515 0.495162575
[6,] 0.4569838 0.91396752 0.543016240
[7,] 0.5640244 0.87195116 0.435975580
[8,] 0.6230257 0.75394852 0.376974260
[9,] 0.6651209 0.66975827 0.334879133
[10,] 0.7528165 0.49436708 0.247183542
[11,] 0.8310577 0.33788461 0.168942307
[12,] 0.9239745 0.15205092 0.076025462
[13,] 0.9432788 0.11344244 0.056721220
[14,] 0.9630755 0.07384898 0.036924491
[15,] 0.9870458 0.02590845 0.012954223
[16,] 0.9897690 0.02046191 0.010230954
[17,] 0.9946306 0.01073889 0.005369444
[18,] 0.9942889 0.01142211 0.005711057
[19,] 0.9930020 0.01399599 0.006997993
[20,] 0.9940606 0.01187879 0.005939396
[21,] 0.9900095 0.01998094 0.009990470
[22,] 0.9904142 0.01917153 0.009585764
[23,] 0.9895961 0.02080789 0.010403946
[24,] 0.9825816 0.03483685 0.017418424
[25,] 0.9812858 0.03742833 0.018714165
[26,] 0.9719349 0.05613030 0.028065149
[27,] 0.9761334 0.04773312 0.023866561
[28,] 0.9832181 0.03356376 0.016781878
[29,] 0.9416745 0.11665104 0.058325518
> postscript(file="/var/www/html/rcomp/tmp/1wny31258650109.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/25w2u1258650109.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/3de8u1258650109.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/4gvai1258650109.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/5svmn1258650109.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 7
-5.9867261 -7.7039140 -8.0419883 -5.7701547 -7.5401860 -9.1615420 -5.5431254
8 9 10 11 12 13 14
-7.2484502 -6.4424580 -6.7480078 -8.2014756 -6.7317671 -3.1879492 -4.3089629
15 16 17 18 19 20 21
-3.0957163 -1.5688534 -3.5552349 -3.6515029 -3.0007769 -3.4297710 -4.3701485
22 23 24 25 26 27 28
-0.8179687 -2.8790684 -1.3142720 0.8970606 1.3797358 3.1955850 0.4323306
29 30 31 32 33 34 35
1.0785127 1.5785752 0.5230098 0.7865205 3.3862603 1.5520508 -0.1190684
36 37 38 39 40 41 42
2.4344658 2.4407104 2.7709003 3.6592349 1.3470863 1.3508026 2.5571567
43 44 45 46 47 48 49
0.9203485 3.1913153 2.2261625 -0.5920290 5.6621743 2.0356694 5.8369042
50 51 52 53 54 55 56
7.8622407 4.2828847 5.5595912 8.6661055 8.6773130 7.1005440 6.7003853
57 58 59 60
5.2001837 6.6059547 5.5374381 3.5759039
> postscript(file="/var/www/html/rcomp/tmp/6a3i81258650109.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 -5.9867261 NA
1 -7.7039140 -5.9867261
2 -8.0419883 -7.7039140
3 -5.7701547 -8.0419883
4 -7.5401860 -5.7701547
5 -9.1615420 -7.5401860
6 -5.5431254 -9.1615420
7 -7.2484502 -5.5431254
8 -6.4424580 -7.2484502
9 -6.7480078 -6.4424580
10 -8.2014756 -6.7480078
11 -6.7317671 -8.2014756
12 -3.1879492 -6.7317671
13 -4.3089629 -3.1879492
14 -3.0957163 -4.3089629
15 -1.5688534 -3.0957163
16 -3.5552349 -1.5688534
17 -3.6515029 -3.5552349
18 -3.0007769 -3.6515029
19 -3.4297710 -3.0007769
20 -4.3701485 -3.4297710
21 -0.8179687 -4.3701485
22 -2.8790684 -0.8179687
23 -1.3142720 -2.8790684
24 0.8970606 -1.3142720
25 1.3797358 0.8970606
26 3.1955850 1.3797358
27 0.4323306 3.1955850
28 1.0785127 0.4323306
29 1.5785752 1.0785127
30 0.5230098 1.5785752
31 0.7865205 0.5230098
32 3.3862603 0.7865205
33 1.5520508 3.3862603
34 -0.1190684 1.5520508
35 2.4344658 -0.1190684
36 2.4407104 2.4344658
37 2.7709003 2.4407104
38 3.6592349 2.7709003
39 1.3470863 3.6592349
40 1.3508026 1.3470863
41 2.5571567 1.3508026
42 0.9203485 2.5571567
43 3.1913153 0.9203485
44 2.2261625 3.1913153
45 -0.5920290 2.2261625
46 5.6621743 -0.5920290
47 2.0356694 5.6621743
48 5.8369042 2.0356694
49 7.8622407 5.8369042
50 4.2828847 7.8622407
51 5.5595912 4.2828847
52 8.6661055 5.5595912
53 8.6773130 8.6661055
54 7.1005440 8.6773130
55 6.7003853 7.1005440
56 5.2001837 6.7003853
57 6.6059547 5.2001837
58 5.5374381 6.6059547
59 3.5759039 5.5374381
60 NA 3.5759039
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -7.7039140 -5.9867261
[2,] -8.0419883 -7.7039140
[3,] -5.7701547 -8.0419883
[4,] -7.5401860 -5.7701547
[5,] -9.1615420 -7.5401860
[6,] -5.5431254 -9.1615420
[7,] -7.2484502 -5.5431254
[8,] -6.4424580 -7.2484502
[9,] -6.7480078 -6.4424580
[10,] -8.2014756 -6.7480078
[11,] -6.7317671 -8.2014756
[12,] -3.1879492 -6.7317671
[13,] -4.3089629 -3.1879492
[14,] -3.0957163 -4.3089629
[15,] -1.5688534 -3.0957163
[16,] -3.5552349 -1.5688534
[17,] -3.6515029 -3.5552349
[18,] -3.0007769 -3.6515029
[19,] -3.4297710 -3.0007769
[20,] -4.3701485 -3.4297710
[21,] -0.8179687 -4.3701485
[22,] -2.8790684 -0.8179687
[23,] -1.3142720 -2.8790684
[24,] 0.8970606 -1.3142720
[25,] 1.3797358 0.8970606
[26,] 3.1955850 1.3797358
[27,] 0.4323306 3.1955850
[28,] 1.0785127 0.4323306
[29,] 1.5785752 1.0785127
[30,] 0.5230098 1.5785752
[31,] 0.7865205 0.5230098
[32,] 3.3862603 0.7865205
[33,] 1.5520508 3.3862603
[34,] -0.1190684 1.5520508
[35,] 2.4344658 -0.1190684
[36,] 2.4407104 2.4344658
[37,] 2.7709003 2.4407104
[38,] 3.6592349 2.7709003
[39,] 1.3470863 3.6592349
[40,] 1.3508026 1.3470863
[41,] 2.5571567 1.3508026
[42,] 0.9203485 2.5571567
[43,] 3.1913153 0.9203485
[44,] 2.2261625 3.1913153
[45,] -0.5920290 2.2261625
[46,] 5.6621743 -0.5920290
[47,] 2.0356694 5.6621743
[48,] 5.8369042 2.0356694
[49,] 7.8622407 5.8369042
[50,] 4.2828847 7.8622407
[51,] 5.5595912 4.2828847
[52,] 8.6661055 5.5595912
[53,] 8.6773130 8.6661055
[54,] 7.1005440 8.6773130
[55,] 6.7003853 7.1005440
[56,] 5.2001837 6.7003853
[57,] 6.6059547 5.2001837
[58,] 5.5374381 6.6059547
[59,] 3.5759039 5.5374381
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -7.7039140 -5.9867261
2 -8.0419883 -7.7039140
3 -5.7701547 -8.0419883
4 -7.5401860 -5.7701547
5 -9.1615420 -7.5401860
6 -5.5431254 -9.1615420
7 -7.2484502 -5.5431254
8 -6.4424580 -7.2484502
9 -6.7480078 -6.4424580
10 -8.2014756 -6.7480078
11 -6.7317671 -8.2014756
12 -3.1879492 -6.7317671
13 -4.3089629 -3.1879492
14 -3.0957163 -4.3089629
15 -1.5688534 -3.0957163
16 -3.5552349 -1.5688534
17 -3.6515029 -3.5552349
18 -3.0007769 -3.6515029
19 -3.4297710 -3.0007769
20 -4.3701485 -3.4297710
21 -0.8179687 -4.3701485
22 -2.8790684 -0.8179687
23 -1.3142720 -2.8790684
24 0.8970606 -1.3142720
25 1.3797358 0.8970606
26 3.1955850 1.3797358
27 0.4323306 3.1955850
28 1.0785127 0.4323306
29 1.5785752 1.0785127
30 0.5230098 1.5785752
31 0.7865205 0.5230098
32 3.3862603 0.7865205
33 1.5520508 3.3862603
34 -0.1190684 1.5520508
35 2.4344658 -0.1190684
36 2.4407104 2.4344658
37 2.7709003 2.4407104
38 3.6592349 2.7709003
39 1.3470863 3.6592349
40 1.3508026 1.3470863
41 2.5571567 1.3508026
42 0.9203485 2.5571567
43 3.1913153 0.9203485
44 2.2261625 3.1913153
45 -0.5920290 2.2261625
46 5.6621743 -0.5920290
47 2.0356694 5.6621743
48 5.8369042 2.0356694
49 7.8622407 5.8369042
50 4.2828847 7.8622407
51 5.5595912 4.2828847
52 8.6661055 5.5595912
53 8.6773130 8.6661055
54 7.1005440 8.6773130
55 6.7003853 7.1005440
56 5.2001837 6.7003853
57 6.6059547 5.2001837
58 5.5374381 6.6059547
59 3.5759039 5.5374381
> 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/7uv431258650109.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/8vi7w1258650109.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/9ehl01258650109.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/1069gw1258650109.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/11lcad1258650109.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/12hhvn1258650109.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/13ceah1258650109.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/14in3g1258650109.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/15b70c1258650109.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/1686en1258650109.tab")
+ }
> system("convert tmp/1wny31258650109.ps tmp/1wny31258650109.png")
> system("convert tmp/25w2u1258650109.ps tmp/25w2u1258650109.png")
> system("convert tmp/3de8u1258650109.ps tmp/3de8u1258650109.png")
> system("convert tmp/4gvai1258650109.ps tmp/4gvai1258650109.png")
> system("convert tmp/5svmn1258650109.ps tmp/5svmn1258650109.png")
> system("convert tmp/6a3i81258650109.ps tmp/6a3i81258650109.png")
> system("convert tmp/7uv431258650109.ps tmp/7uv431258650109.png")
> system("convert tmp/8vi7w1258650109.ps tmp/8vi7w1258650109.png")
> system("convert tmp/9ehl01258650109.ps tmp/9ehl01258650109.png")
> system("convert tmp/1069gw1258650109.ps tmp/1069gw1258650109.png")
>
>
> proc.time()
user system elapsed
2.405 1.572 4.942