R version 2.12.0 (2010-10-15)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-pc-linux-gnu (32-bit)
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(0.504208603
+ ,0.397232704
+ ,0.457969746
+ ,0.382767296
+ ,0.509923035
+ ,0.396037736
+ ,0.606622221
+ ,0.441761006
+ ,0.626210885
+ ,0.445220126
+ ,0.626631316
+ ,0.438490566
+ ,0.676731276
+ ,0.467484277
+ ,0.613117455
+ ,0.465786164
+ ,0.486215861
+ ,0.402075472
+ ,0.452529881
+ ,0.376163522
+ ,0.467150592
+ ,0.37591195
+ ,0.494624486
+ ,0.392955975
+ ,0.444567428
+ ,0.34490566
+ ,0.478862605
+ ,0.368553459
+ ,0.544458459
+ ,0.390880503
+ ,0.628201498
+ ,0.424842767
+ ,0.672578445
+ ,0.426855346
+ ,0.652706633
+ ,0.442327044
+ ,0.645430599
+ ,0.474842767
+ ,0.576334011
+ ,0.447610063
+ ,0.618334234
+ ,0.480754717
+ ,0.639896351
+ ,0.516037736
+ ,0.72850438
+ ,0.580628931
+ ,0.694655375
+ ,0.573522013
+ ,0.689773225
+ ,0.578867925
+ ,0.712244845
+ ,0.593584906
+ ,0.760337031
+ ,0.645974843
+ ,0.837816503
+ ,0.690503145
+ ,0.90688735
+ ,0.782201258
+ ,0.976018259
+ ,0.839056604
+ ,0.962066806
+ ,0.847484277
+ ,0.837593417
+ ,0.726855346
+ ,0.767638807
+ ,0.635534591
+ ,0.580006349
+ ,0.470943396
+ ,0.387740568
+ ,0.346163522
+ ,0.331274078
+ ,0.272327044
+ ,0.345251272
+ ,0.286792453
+ ,0.380172806
+ ,0.27672956
+ ,0.399838692
+ ,0.297421384
+ ,0.425742404
+ ,0.321698113
+ ,0.524183377
+ ,0.365597484
+ ,0.597115327
+ ,0.435220126
+ ,0.541489699
+ ,0.412893082
+ ,0.615039426
+ ,0.458679245
+ ,0.547924872
+ ,0.428427673
+ ,0.574540743
+ ,0.463522013
+ ,0.603438956
+ ,0.487169811
+ ,0.577492342
+ ,0.473584906
+ ,0.614198564
+ ,0.491886792
+ ,0.584776957
+ ,0.474842767
+ ,0.62752366
+ ,0.502327044
+ ,0.676859979
+ ,0.539371069
+ ,0.645996894
+ ,0.484402516
+ ,0.596059959
+ ,0.474654088
+ ,0.585961029
+ ,0.473522013
+ ,0.607617528
+ ,0.48754717
+ ,0.598462423
+ ,0.493333333
+ ,0.638703699
+ ,0.525157233
+ ,0.64923164
+ ,0.542704403)
+ ,dim=c(2
+ ,59)
+ ,dimnames=list(c('benzine'
+ ,'olie')
+ ,1:59))
> y <- array(NA,dim=c(2,59),dimnames=list(c('benzine','olie'),1:59))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = '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
> 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
olie benzine M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 0.3972327 0.5042086 1 0 0 0 0 0 0 0 0 0 0 1
2 0.3827673 0.4579697 0 1 0 0 0 0 0 0 0 0 0 2
3 0.3960377 0.5099230 0 0 1 0 0 0 0 0 0 0 0 3
4 0.4417610 0.6066222 0 0 0 1 0 0 0 0 0 0 0 4
5 0.4452201 0.6262109 0 0 0 0 1 0 0 0 0 0 0 5
6 0.4384906 0.6266313 0 0 0 0 0 1 0 0 0 0 0 6
7 0.4674843 0.6767313 0 0 0 0 0 0 1 0 0 0 0 7
8 0.4657862 0.6131175 0 0 0 0 0 0 0 1 0 0 0 8
9 0.4020755 0.4862159 0 0 0 0 0 0 0 0 1 0 0 9
10 0.3761635 0.4525299 0 0 0 0 0 0 0 0 0 1 0 10
11 0.3759119 0.4671506 0 0 0 0 0 0 0 0 0 0 1 11
12 0.3929560 0.4946245 0 0 0 0 0 0 0 0 0 0 0 12
13 0.3449057 0.4445674 1 0 0 0 0 0 0 0 0 0 0 13
14 0.3685535 0.4788626 0 1 0 0 0 0 0 0 0 0 0 14
15 0.3908805 0.5444585 0 0 1 0 0 0 0 0 0 0 0 15
16 0.4248428 0.6282015 0 0 0 1 0 0 0 0 0 0 0 16
17 0.4268553 0.6725784 0 0 0 0 1 0 0 0 0 0 0 17
18 0.4423270 0.6527066 0 0 0 0 0 1 0 0 0 0 0 18
19 0.4748428 0.6454306 0 0 0 0 0 0 1 0 0 0 0 19
20 0.4476101 0.5763340 0 0 0 0 0 0 0 1 0 0 0 20
21 0.4807547 0.6183342 0 0 0 0 0 0 0 0 1 0 0 21
22 0.5160377 0.6398964 0 0 0 0 0 0 0 0 0 1 0 22
23 0.5806289 0.7285044 0 0 0 0 0 0 0 0 0 0 1 23
24 0.5735220 0.6946554 0 0 0 0 0 0 0 0 0 0 0 24
25 0.5788679 0.6897732 1 0 0 0 0 0 0 0 0 0 0 25
26 0.5935849 0.7122448 0 1 0 0 0 0 0 0 0 0 0 26
27 0.6459748 0.7603370 0 0 1 0 0 0 0 0 0 0 0 27
28 0.6905031 0.8378165 0 0 0 1 0 0 0 0 0 0 0 28
29 0.7822013 0.9068873 0 0 0 0 1 0 0 0 0 0 0 29
30 0.8390566 0.9760183 0 0 0 0 0 1 0 0 0 0 0 30
31 0.8474843 0.9620668 0 0 0 0 0 0 1 0 0 0 0 31
32 0.7268553 0.8375934 0 0 0 0 0 0 0 1 0 0 0 32
33 0.6355346 0.7676388 0 0 0 0 0 0 0 0 1 0 0 33
34 0.4709434 0.5800063 0 0 0 0 0 0 0 0 0 1 0 34
35 0.3461635 0.3877406 0 0 0 0 0 0 0 0 0 0 1 35
36 0.2723270 0.3312741 0 0 0 0 0 0 0 0 0 0 0 36
37 0.2867925 0.3452513 1 0 0 0 0 0 0 0 0 0 0 37
38 0.2767296 0.3801728 0 1 0 0 0 0 0 0 0 0 0 38
39 0.2974214 0.3998387 0 0 1 0 0 0 0 0 0 0 0 39
40 0.3216981 0.4257424 0 0 0 1 0 0 0 0 0 0 0 40
41 0.3655975 0.5241834 0 0 0 0 1 0 0 0 0 0 0 41
42 0.4352201 0.5971153 0 0 0 0 0 1 0 0 0 0 0 42
43 0.4128931 0.5414897 0 0 0 0 0 0 1 0 0 0 0 43
44 0.4586792 0.6150394 0 0 0 0 0 0 0 1 0 0 0 44
45 0.4284277 0.5479249 0 0 0 0 0 0 0 0 1 0 0 45
46 0.4635220 0.5745407 0 0 0 0 0 0 0 0 0 1 0 46
47 0.4871698 0.6034390 0 0 0 0 0 0 0 0 0 0 1 47
48 0.4735849 0.5774923 0 0 0 0 0 0 0 0 0 0 0 48
49 0.4918868 0.6141986 1 0 0 0 0 0 0 0 0 0 0 49
50 0.4748428 0.5847770 0 1 0 0 0 0 0 0 0 0 0 50
51 0.5023270 0.6275237 0 0 1 0 0 0 0 0 0 0 0 51
52 0.5393711 0.6768600 0 0 0 1 0 0 0 0 0 0 0 52
53 0.4844025 0.6459969 0 0 0 0 1 0 0 0 0 0 0 53
54 0.4746541 0.5960600 0 0 0 0 0 1 0 0 0 0 0 54
55 0.4735220 0.5859610 0 0 0 0 0 0 1 0 0 0 0 55
56 0.4875472 0.6076175 0 0 0 0 0 0 0 1 0 0 0 56
57 0.4933333 0.5984624 0 0 0 0 0 0 0 0 1 0 0 57
58 0.5251572 0.6387037 0 0 0 0 0 0 0 0 0 1 0 58
59 0.5427044 0.6492316 0 0 0 0 0 0 0 0 0 0 1 59
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) benzine M1 M2 M3 M4
-0.0821809 0.9451069 -0.0010918 -0.0052482 -0.0216078 -0.0479609
M5 M6 M7 M8 M9 M10
-0.0691465 -0.0582745 -0.0424983 -0.0303161 -0.0163841 -0.0094090
M11 t
-0.0043659 0.0004853
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.065726 -0.013453 -0.001901 0.016026 0.062350
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.0821809 0.0225788 -3.640 0.000701 ***
benzine 0.9451069 0.0312065 30.286 < 2e-16 ***
M1 -0.0010918 0.0193387 -0.056 0.955229
M2 -0.0052482 0.0193268 -0.272 0.787210
M3 -0.0216078 0.0193685 -1.116 0.270508
M4 -0.0479609 0.0196206 -2.444 0.018490 *
M5 -0.0691465 0.0198741 -3.479 0.001128 **
M6 -0.0582745 0.0199825 -2.916 0.005507 **
M7 -0.0424983 0.0199231 -2.133 0.038403 *
M8 -0.0303161 0.0196998 -1.539 0.130831
M9 -0.0163841 0.0194712 -0.841 0.404544
M10 -0.0094090 0.0193929 -0.485 0.629904
M11 -0.0043659 0.0193808 -0.225 0.822791
t 0.0004853 0.0002239 2.168 0.035522 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.02878 on 45 degrees of freedom
Multiple R-squared: 0.9584, Adjusted R-squared: 0.9464
F-statistic: 79.77 on 13 and 45 DF, p-value: < 2.2e-16
> if (n > n25) {
+ kp3 <- k + 3
+ nmkm3 <- n - k - 3
+ gqarr <- array(NA, dim=c(nmkm3-kp3+1,3))
+ numgqtests <- 0
+ numsignificant1 <- 0
+ numsignificant5 <- 0
+ numsignificant10 <- 0
+ for (mypoint in kp3:nmkm3) {
+ j <- 0
+ numgqtests <- numgqtests + 1
+ for (myalt in c('greater', 'two.sided', 'less')) {
+ j <- j + 1
+ gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value
+ }
+ if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1
+ }
+ gqarr
+ }
[,1] [,2] [,3]
[1,] 0.01376115 2.752230e-02 9.862389e-01
[2,] 0.02357013 4.714026e-02 9.764299e-01
[3,] 0.13957924 2.791585e-01 8.604208e-01
[4,] 0.07276823 1.455365e-01 9.272318e-01
[5,] 0.16365830 3.273166e-01 8.363417e-01
[6,] 0.22338453 4.467691e-01 7.766155e-01
[7,] 0.32584962 6.516992e-01 6.741504e-01
[8,] 0.41392461 8.278492e-01 5.860754e-01
[9,] 0.56329702 8.734060e-01 4.367030e-01
[10,] 0.50729460 9.854108e-01 4.927054e-01
[11,] 0.65109808 6.978038e-01 3.489019e-01
[12,] 0.79132122 4.173576e-01 2.086788e-01
[13,] 0.96460022 7.079955e-02 3.539978e-02
[14,] 0.96585314 6.829372e-02 3.414686e-02
[15,] 0.97622338 4.755324e-02 2.377662e-02
[16,] 0.99559291 8.814175e-03 4.407088e-03
[17,] 0.99797232 4.055353e-03 2.027676e-03
[18,] 0.99826725 3.465505e-03 1.732752e-03
[19,] 0.99997992 4.016387e-05 2.008194e-05
[20,] 0.99992978 1.404354e-04 7.021772e-05
[21,] 0.99997426 5.148271e-05 2.574135e-05
[22,] 0.99996081 7.838595e-05 3.919298e-05
[23,] 0.99983016 3.396850e-04 1.698425e-04
[24,] 0.99958630 8.273952e-04 4.136976e-04
[25,] 0.99975788 4.842466e-04 2.421233e-04
[26,] 0.99824521 3.509580e-03 1.754790e-03
> postscript(file="/var/www/rcomp/tmp/1p5j31292833451.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/2p5j31292833451.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/3ixj61292833451.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/4ixj61292833451.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/5ixj61292833451.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 59
Frequency = 1
1 2 3 4 5
0.0034890117 0.0363953847 0.0164387748 -0.0033612513 0.0022847616
6 7 8 9 10
-0.0161994480 -0.0508169839 -0.0050607746 0.0367468577 0.0352113516
11 12 13 14 15
0.0156131833 0.0018402828 0.0017057177 -0.0033879727 -0.0271816608
16 17 18 19 20
-0.0464977490 -0.0657258542 -0.0428304671 -0.0196995438 0.0057038754
21 22 23 24 25
-0.0152634173 -0.0078193115 -0.0325006368 -0.0124677860 -0.0019012409
26 27 28 29 30
-0.0047512241 0.0180608180 0.0152305081 0.0623495619 0.0425115121
31 32 33 34 35
0.0478633700 0.0322075583 -0.0074158594 -0.0021347333 0.0492686454
36 37 38 39 40
0.0239478771 0.0258098233 -0.0135865334 0.0043932877 0.0300560109
41 42 43 44 45
0.0016184142 -0.0090447296 0.0049389612 -0.0314547678 -0.0126931590
46 47 48 49 50
-0.0102140698 -0.0194066337 -0.0133203740 -0.0291033118 -0.0146696546
51 52 53 54 55
-0.0117112197 0.0045724812 -0.0005268834 0.0255631326 0.0177141964
56 57 58 59
-0.0013958912 -0.0013744220 -0.0150432370 -0.0129745582
> postscript(file="/var/www/rcomp/tmp/6b6ir1292833451.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 59
Frequency = 1
lag(myerror, k = 1) myerror
0 0.0034890117 NA
1 0.0363953847 0.0034890117
2 0.0164387748 0.0363953847
3 -0.0033612513 0.0164387748
4 0.0022847616 -0.0033612513
5 -0.0161994480 0.0022847616
6 -0.0508169839 -0.0161994480
7 -0.0050607746 -0.0508169839
8 0.0367468577 -0.0050607746
9 0.0352113516 0.0367468577
10 0.0156131833 0.0352113516
11 0.0018402828 0.0156131833
12 0.0017057177 0.0018402828
13 -0.0033879727 0.0017057177
14 -0.0271816608 -0.0033879727
15 -0.0464977490 -0.0271816608
16 -0.0657258542 -0.0464977490
17 -0.0428304671 -0.0657258542
18 -0.0196995438 -0.0428304671
19 0.0057038754 -0.0196995438
20 -0.0152634173 0.0057038754
21 -0.0078193115 -0.0152634173
22 -0.0325006368 -0.0078193115
23 -0.0124677860 -0.0325006368
24 -0.0019012409 -0.0124677860
25 -0.0047512241 -0.0019012409
26 0.0180608180 -0.0047512241
27 0.0152305081 0.0180608180
28 0.0623495619 0.0152305081
29 0.0425115121 0.0623495619
30 0.0478633700 0.0425115121
31 0.0322075583 0.0478633700
32 -0.0074158594 0.0322075583
33 -0.0021347333 -0.0074158594
34 0.0492686454 -0.0021347333
35 0.0239478771 0.0492686454
36 0.0258098233 0.0239478771
37 -0.0135865334 0.0258098233
38 0.0043932877 -0.0135865334
39 0.0300560109 0.0043932877
40 0.0016184142 0.0300560109
41 -0.0090447296 0.0016184142
42 0.0049389612 -0.0090447296
43 -0.0314547678 0.0049389612
44 -0.0126931590 -0.0314547678
45 -0.0102140698 -0.0126931590
46 -0.0194066337 -0.0102140698
47 -0.0133203740 -0.0194066337
48 -0.0291033118 -0.0133203740
49 -0.0146696546 -0.0291033118
50 -0.0117112197 -0.0146696546
51 0.0045724812 -0.0117112197
52 -0.0005268834 0.0045724812
53 0.0255631326 -0.0005268834
54 0.0177141964 0.0255631326
55 -0.0013958912 0.0177141964
56 -0.0013744220 -0.0013958912
57 -0.0150432370 -0.0013744220
58 -0.0129745582 -0.0150432370
59 NA -0.0129745582
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.0363953847 0.0034890117
[2,] 0.0164387748 0.0363953847
[3,] -0.0033612513 0.0164387748
[4,] 0.0022847616 -0.0033612513
[5,] -0.0161994480 0.0022847616
[6,] -0.0508169839 -0.0161994480
[7,] -0.0050607746 -0.0508169839
[8,] 0.0367468577 -0.0050607746
[9,] 0.0352113516 0.0367468577
[10,] 0.0156131833 0.0352113516
[11,] 0.0018402828 0.0156131833
[12,] 0.0017057177 0.0018402828
[13,] -0.0033879727 0.0017057177
[14,] -0.0271816608 -0.0033879727
[15,] -0.0464977490 -0.0271816608
[16,] -0.0657258542 -0.0464977490
[17,] -0.0428304671 -0.0657258542
[18,] -0.0196995438 -0.0428304671
[19,] 0.0057038754 -0.0196995438
[20,] -0.0152634173 0.0057038754
[21,] -0.0078193115 -0.0152634173
[22,] -0.0325006368 -0.0078193115
[23,] -0.0124677860 -0.0325006368
[24,] -0.0019012409 -0.0124677860
[25,] -0.0047512241 -0.0019012409
[26,] 0.0180608180 -0.0047512241
[27,] 0.0152305081 0.0180608180
[28,] 0.0623495619 0.0152305081
[29,] 0.0425115121 0.0623495619
[30,] 0.0478633700 0.0425115121
[31,] 0.0322075583 0.0478633700
[32,] -0.0074158594 0.0322075583
[33,] -0.0021347333 -0.0074158594
[34,] 0.0492686454 -0.0021347333
[35,] 0.0239478771 0.0492686454
[36,] 0.0258098233 0.0239478771
[37,] -0.0135865334 0.0258098233
[38,] 0.0043932877 -0.0135865334
[39,] 0.0300560109 0.0043932877
[40,] 0.0016184142 0.0300560109
[41,] -0.0090447296 0.0016184142
[42,] 0.0049389612 -0.0090447296
[43,] -0.0314547678 0.0049389612
[44,] -0.0126931590 -0.0314547678
[45,] -0.0102140698 -0.0126931590
[46,] -0.0194066337 -0.0102140698
[47,] -0.0133203740 -0.0194066337
[48,] -0.0291033118 -0.0133203740
[49,] -0.0146696546 -0.0291033118
[50,] -0.0117112197 -0.0146696546
[51,] 0.0045724812 -0.0117112197
[52,] -0.0005268834 0.0045724812
[53,] 0.0255631326 -0.0005268834
[54,] 0.0177141964 0.0255631326
[55,] -0.0013958912 0.0177141964
[56,] -0.0013744220 -0.0013958912
[57,] -0.0150432370 -0.0013744220
[58,] -0.0129745582 -0.0150432370
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.0363953847 0.0034890117
2 0.0164387748 0.0363953847
3 -0.0033612513 0.0164387748
4 0.0022847616 -0.0033612513
5 -0.0161994480 0.0022847616
6 -0.0508169839 -0.0161994480
7 -0.0050607746 -0.0508169839
8 0.0367468577 -0.0050607746
9 0.0352113516 0.0367468577
10 0.0156131833 0.0352113516
11 0.0018402828 0.0156131833
12 0.0017057177 0.0018402828
13 -0.0033879727 0.0017057177
14 -0.0271816608 -0.0033879727
15 -0.0464977490 -0.0271816608
16 -0.0657258542 -0.0464977490
17 -0.0428304671 -0.0657258542
18 -0.0196995438 -0.0428304671
19 0.0057038754 -0.0196995438
20 -0.0152634173 0.0057038754
21 -0.0078193115 -0.0152634173
22 -0.0325006368 -0.0078193115
23 -0.0124677860 -0.0325006368
24 -0.0019012409 -0.0124677860
25 -0.0047512241 -0.0019012409
26 0.0180608180 -0.0047512241
27 0.0152305081 0.0180608180
28 0.0623495619 0.0152305081
29 0.0425115121 0.0623495619
30 0.0478633700 0.0425115121
31 0.0322075583 0.0478633700
32 -0.0074158594 0.0322075583
33 -0.0021347333 -0.0074158594
34 0.0492686454 -0.0021347333
35 0.0239478771 0.0492686454
36 0.0258098233 0.0239478771
37 -0.0135865334 0.0258098233
38 0.0043932877 -0.0135865334
39 0.0300560109 0.0043932877
40 0.0016184142 0.0300560109
41 -0.0090447296 0.0016184142
42 0.0049389612 -0.0090447296
43 -0.0314547678 0.0049389612
44 -0.0126931590 -0.0314547678
45 -0.0102140698 -0.0126931590
46 -0.0194066337 -0.0102140698
47 -0.0133203740 -0.0194066337
48 -0.0291033118 -0.0133203740
49 -0.0146696546 -0.0291033118
50 -0.0117112197 -0.0146696546
51 0.0045724812 -0.0117112197
52 -0.0005268834 0.0045724812
53 0.0255631326 -0.0005268834
54 0.0177141964 0.0255631326
55 -0.0013958912 0.0177141964
56 -0.0013744220 -0.0013958912
57 -0.0150432370 -0.0013744220
58 -0.0129745582 -0.0150432370
> 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/rcomp/tmp/7lxhc1292833451.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/8lxhc1292833451.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/9lxhc1292833451.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/www/rcomp/tmp/10w6yx1292833451.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/rcomp/tmp/11h7x31292833451.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/rcomp/tmp/12l7v91292833451.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/rcomp/tmp/13zhtz1292833451.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/rcomp/tmp/142irn1292833451.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/rcomp/tmp/15niqt1292833451.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/rcomp/tmp/1691oz1292833451.tab")
+ }
>
> try(system("convert tmp/1p5j31292833451.ps tmp/1p5j31292833451.png",intern=TRUE))
character(0)
> try(system("convert tmp/2p5j31292833451.ps tmp/2p5j31292833451.png",intern=TRUE))
character(0)
> try(system("convert tmp/3ixj61292833451.ps tmp/3ixj61292833451.png",intern=TRUE))
character(0)
> try(system("convert tmp/4ixj61292833451.ps tmp/4ixj61292833451.png",intern=TRUE))
character(0)
> try(system("convert tmp/5ixj61292833451.ps tmp/5ixj61292833451.png",intern=TRUE))
character(0)
> try(system("convert tmp/6b6ir1292833451.ps tmp/6b6ir1292833451.png",intern=TRUE))
character(0)
> try(system("convert tmp/7lxhc1292833451.ps tmp/7lxhc1292833451.png",intern=TRUE))
character(0)
> try(system("convert tmp/8lxhc1292833451.ps tmp/8lxhc1292833451.png",intern=TRUE))
character(0)
> try(system("convert tmp/9lxhc1292833451.ps tmp/9lxhc1292833451.png",intern=TRUE))
character(0)
> try(system("convert tmp/10w6yx1292833451.ps tmp/10w6yx1292833451.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.970 1.630 4.621