R version 2.9.0 (2009-04-17)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> x <- array(list(8.4,1.8,8.4,1.6,8.4,1.9,8.6,1.7,8.9,1.6,8.8,1.3,8.3,1.1,7.5,1.9,7.2,2.6,7.4,2.3,8.8,2.4,9.3,2.2,9.3,2,8.7,2.9,8.2,2.6,8.3,2.3,8.5,2.3,8.6,2.6,8.5,3.1,8.2,2.8,8.1,2.5,7.9,2.9,8.6,3.1,8.7,3.1,8.7,3.2,8.5,2.5,8.4,2.6,8.5,2.9,8.7,2.6,8.7,2.4,8.6,1.7,8.5,2,8.3,2.2,8,1.9,8.2,1.6,8.1,1.6,8.1,1.2,8,1.2,7.9,1.5,7.9,1.6,8,1.7,8,1.8,7.9,1.8,8,1.8,7.7,1.3,7.2,1.3,7.5,1.4,7.3,1.1,7,1.5,7,2.2,7,2.9,7.2,3.1,7.3,3.5,7.1,3.6,6.8,4.4,6.4,4.2,6.1,5.2,6.5,5.8,7.7,5.9,7.9,5.4,7.5,5.5),dim=c(2,61),dimnames=list(c('Twk','Ncp'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('Twk','Ncp'),1:61))
> 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 = '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
Twk Ncp M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 8.4 1.8 1 0 0 0 0 0 0 0 0 0 0 1
2 8.4 1.6 0 1 0 0 0 0 0 0 0 0 0 2
3 8.4 1.9 0 0 1 0 0 0 0 0 0 0 0 3
4 8.6 1.7 0 0 0 1 0 0 0 0 0 0 0 4
5 8.9 1.6 0 0 0 0 1 0 0 0 0 0 0 5
6 8.8 1.3 0 0 0 0 0 1 0 0 0 0 0 6
7 8.3 1.1 0 0 0 0 0 0 1 0 0 0 0 7
8 7.5 1.9 0 0 0 0 0 0 0 1 0 0 0 8
9 7.2 2.6 0 0 0 0 0 0 0 0 1 0 0 9
10 7.4 2.3 0 0 0 0 0 0 0 0 0 1 0 10
11 8.8 2.4 0 0 0 0 0 0 0 0 0 0 1 11
12 9.3 2.2 0 0 0 0 0 0 0 0 0 0 0 12
13 9.3 2.0 1 0 0 0 0 0 0 0 0 0 0 13
14 8.7 2.9 0 1 0 0 0 0 0 0 0 0 0 14
15 8.2 2.6 0 0 1 0 0 0 0 0 0 0 0 15
16 8.3 2.3 0 0 0 1 0 0 0 0 0 0 0 16
17 8.5 2.3 0 0 0 0 1 0 0 0 0 0 0 17
18 8.6 2.6 0 0 0 0 0 1 0 0 0 0 0 18
19 8.5 3.1 0 0 0 0 0 0 1 0 0 0 0 19
20 8.2 2.8 0 0 0 0 0 0 0 1 0 0 0 20
21 8.1 2.5 0 0 0 0 0 0 0 0 1 0 0 21
22 7.9 2.9 0 0 0 0 0 0 0 0 0 1 0 22
23 8.6 3.1 0 0 0 0 0 0 0 0 0 0 1 23
24 8.7 3.1 0 0 0 0 0 0 0 0 0 0 0 24
25 8.7 3.2 1 0 0 0 0 0 0 0 0 0 0 25
26 8.5 2.5 0 1 0 0 0 0 0 0 0 0 0 26
27 8.4 2.6 0 0 1 0 0 0 0 0 0 0 0 27
28 8.5 2.9 0 0 0 1 0 0 0 0 0 0 0 28
29 8.7 2.6 0 0 0 0 1 0 0 0 0 0 0 29
30 8.7 2.4 0 0 0 0 0 1 0 0 0 0 0 30
31 8.6 1.7 0 0 0 0 0 0 1 0 0 0 0 31
32 8.5 2.0 0 0 0 0 0 0 0 1 0 0 0 32
33 8.3 2.2 0 0 0 0 0 0 0 0 1 0 0 33
34 8.0 1.9 0 0 0 0 0 0 0 0 0 1 0 34
35 8.2 1.6 0 0 0 0 0 0 0 0 0 0 1 35
36 8.1 1.6 0 0 0 0 0 0 0 0 0 0 0 36
37 8.1 1.2 1 0 0 0 0 0 0 0 0 0 0 37
38 8.0 1.2 0 1 0 0 0 0 0 0 0 0 0 38
39 7.9 1.5 0 0 1 0 0 0 0 0 0 0 0 39
40 7.9 1.6 0 0 0 1 0 0 0 0 0 0 0 40
41 8.0 1.7 0 0 0 0 1 0 0 0 0 0 0 41
42 8.0 1.8 0 0 0 0 0 1 0 0 0 0 0 42
43 7.9 1.8 0 0 0 0 0 0 1 0 0 0 0 43
44 8.0 1.8 0 0 0 0 0 0 0 1 0 0 0 44
45 7.7 1.3 0 0 0 0 0 0 0 0 1 0 0 45
46 7.2 1.3 0 0 0 0 0 0 0 0 0 1 0 46
47 7.5 1.4 0 0 0 0 0 0 0 0 0 0 1 47
48 7.3 1.1 0 0 0 0 0 0 0 0 0 0 0 48
49 7.0 1.5 1 0 0 0 0 0 0 0 0 0 0 49
50 7.0 2.2 0 1 0 0 0 0 0 0 0 0 0 50
51 7.0 2.9 0 0 1 0 0 0 0 0 0 0 0 51
52 7.2 3.1 0 0 0 1 0 0 0 0 0 0 0 52
53 7.3 3.5 0 0 0 0 1 0 0 0 0 0 0 53
54 7.1 3.6 0 0 0 0 0 1 0 0 0 0 0 54
55 6.8 4.4 0 0 0 0 0 0 1 0 0 0 0 55
56 6.4 4.2 0 0 0 0 0 0 0 1 0 0 0 56
57 6.1 5.2 0 0 0 0 0 0 0 0 1 0 0 57
58 6.5 5.8 0 0 0 0 0 0 0 0 0 1 0 58
59 7.7 5.9 0 0 0 0 0 0 0 0 0 0 1 59
60 7.9 5.4 0 0 0 0 0 0 0 0 0 0 0 60
61 7.5 5.5 1 0 0 0 0 0 0 0 0 0 0 61
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Ncp M1 M2 M3 M4
9.32102 -0.04345 -0.23090 -0.42845 -0.53266 -0.38555
M5 M6 M7 M8 M9 M10
-0.17844 -0.19220 -0.38249 -0.65104 -0.85524 -0.90553
M11 t
-0.11755 -0.02624
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.91668 -0.29988 0.04795 0.30093 0.79567
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.32102 0.26478 35.203 < 2e-16 ***
Ncp -0.04345 0.05925 -0.733 0.46704
M1 -0.23090 0.28776 -0.802 0.42637
M2 -0.42845 0.30258 -1.416 0.16337
M3 -0.53266 0.30173 -1.765 0.08400 .
M4 -0.38555 0.30140 -1.279 0.20710
M5 -0.17844 0.30111 -0.593 0.55628
M6 -0.19220 0.30089 -0.639 0.52607
M7 -0.38249 0.30059 -1.272 0.20946
M8 -0.65104 0.30033 -2.168 0.03528 *
M9 -0.85524 0.30035 -2.847 0.00652 **
M10 -0.90553 0.30036 -3.015 0.00414 **
M11 -0.11755 0.30033 -0.391 0.69727
t -0.02624 0.00391 -6.710 2.25e-08 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.4743 on 47 degrees of freedom
Multiple R-squared: 0.6425, Adjusted R-squared: 0.5436
F-statistic: 6.497 on 13 and 47 DF, p-value: 7.742e-07
> 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.66495602 0.67008796 0.3350440
[2,] 0.51022422 0.97955155 0.4897758
[3,] 0.43935700 0.87871401 0.5606430
[4,] 0.48009098 0.96018196 0.5199090
[5,] 0.46854177 0.93708354 0.5314582
[6,] 0.40349332 0.80698664 0.5965067
[7,] 0.39418736 0.78837472 0.6058126
[8,] 0.47936797 0.95873594 0.5206320
[9,] 0.42138081 0.84276161 0.5786192
[10,] 0.37828751 0.75657503 0.6217125
[11,] 0.29840081 0.59680163 0.7015992
[12,] 0.23154398 0.46308796 0.7684560
[13,] 0.17170793 0.34341586 0.8282921
[14,] 0.12027411 0.24054822 0.8797259
[15,] 0.07742329 0.15484658 0.9225767
[16,] 0.05887092 0.11774184 0.9411291
[17,] 0.04202665 0.08405330 0.9579734
[18,] 0.02462973 0.04925947 0.9753703
[19,] 0.05571142 0.11142284 0.9442886
[20,] 0.15946592 0.31893185 0.8405341
[21,] 0.18434854 0.36869707 0.8156515
[22,] 0.13527578 0.27055156 0.8647242
[23,] 0.09064636 0.18129272 0.9093536
[24,] 0.07152518 0.14305035 0.9284748
[25,] 0.06418069 0.12836137 0.9358193
[26,] 0.06496120 0.12992240 0.9350388
[27,] 0.03806695 0.07613390 0.9619331
[28,] 0.01710308 0.03420617 0.9828969
> postscript(file="/var/www/html/rcomp/tmp/19d991258626668.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/2ecwc1258626668.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/30n6y1258626668.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/44g0b1258626668.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/5059y1258626668.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 = 61
Frequency = 1
1 2 3 4 5 6
-0.585682526 -0.370578426 -0.227102730 -0.156660895 -0.041874439 -0.114908300
7 8 9 10 11 12
-0.407073237 -0.877529819 -0.916675641 -0.653185198 -0.010578426 0.389421574
13 14 15 16 17 18
0.637868838 0.300763763 -0.081828263 -0.115731048 -0.096599972 0.056433889
19 20 21 22 23 24
0.194681295 0.176433889 0.293841863 0.187744648 0.134696041 0.143385282
25 26 27 28 29 30
0.404866407 0.398247406 0.433033861 0.425198798 0.431296013 0.462606772
31 32 33 34 35 36
0.548718733 0.756539050 0.795670126 0.559160568 -0.015611141 -0.206921900
37 38 39 40 41 42
0.032836123 0.156629465 0.200105161 0.083580857 0.007056554 0.051401174
43 44 45 46 47 48
0.167925478 0.562711933 0.471430666 0.047954970 -0.409438258 -0.713782878
49 50 51 52 53 54
-0.739267891 -0.485062207 -0.324208029 -0.236387713 -0.299878155 -0.455533535
55 56 57 58 59 60
-0.504252268 -0.618155053 -0.644267014 -0.141674988 0.300931784 0.387897923
61
0.249379049
> postscript(file="/var/www/html/rcomp/tmp/6mrih1258626668.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 = 61
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.585682526 NA
1 -0.370578426 -0.585682526
2 -0.227102730 -0.370578426
3 -0.156660895 -0.227102730
4 -0.041874439 -0.156660895
5 -0.114908300 -0.041874439
6 -0.407073237 -0.114908300
7 -0.877529819 -0.407073237
8 -0.916675641 -0.877529819
9 -0.653185198 -0.916675641
10 -0.010578426 -0.653185198
11 0.389421574 -0.010578426
12 0.637868838 0.389421574
13 0.300763763 0.637868838
14 -0.081828263 0.300763763
15 -0.115731048 -0.081828263
16 -0.096599972 -0.115731048
17 0.056433889 -0.096599972
18 0.194681295 0.056433889
19 0.176433889 0.194681295
20 0.293841863 0.176433889
21 0.187744648 0.293841863
22 0.134696041 0.187744648
23 0.143385282 0.134696041
24 0.404866407 0.143385282
25 0.398247406 0.404866407
26 0.433033861 0.398247406
27 0.425198798 0.433033861
28 0.431296013 0.425198798
29 0.462606772 0.431296013
30 0.548718733 0.462606772
31 0.756539050 0.548718733
32 0.795670126 0.756539050
33 0.559160568 0.795670126
34 -0.015611141 0.559160568
35 -0.206921900 -0.015611141
36 0.032836123 -0.206921900
37 0.156629465 0.032836123
38 0.200105161 0.156629465
39 0.083580857 0.200105161
40 0.007056554 0.083580857
41 0.051401174 0.007056554
42 0.167925478 0.051401174
43 0.562711933 0.167925478
44 0.471430666 0.562711933
45 0.047954970 0.471430666
46 -0.409438258 0.047954970
47 -0.713782878 -0.409438258
48 -0.739267891 -0.713782878
49 -0.485062207 -0.739267891
50 -0.324208029 -0.485062207
51 -0.236387713 -0.324208029
52 -0.299878155 -0.236387713
53 -0.455533535 -0.299878155
54 -0.504252268 -0.455533535
55 -0.618155053 -0.504252268
56 -0.644267014 -0.618155053
57 -0.141674988 -0.644267014
58 0.300931784 -0.141674988
59 0.387897923 0.300931784
60 0.249379049 0.387897923
61 NA 0.249379049
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.370578426 -0.585682526
[2,] -0.227102730 -0.370578426
[3,] -0.156660895 -0.227102730
[4,] -0.041874439 -0.156660895
[5,] -0.114908300 -0.041874439
[6,] -0.407073237 -0.114908300
[7,] -0.877529819 -0.407073237
[8,] -0.916675641 -0.877529819
[9,] -0.653185198 -0.916675641
[10,] -0.010578426 -0.653185198
[11,] 0.389421574 -0.010578426
[12,] 0.637868838 0.389421574
[13,] 0.300763763 0.637868838
[14,] -0.081828263 0.300763763
[15,] -0.115731048 -0.081828263
[16,] -0.096599972 -0.115731048
[17,] 0.056433889 -0.096599972
[18,] 0.194681295 0.056433889
[19,] 0.176433889 0.194681295
[20,] 0.293841863 0.176433889
[21,] 0.187744648 0.293841863
[22,] 0.134696041 0.187744648
[23,] 0.143385282 0.134696041
[24,] 0.404866407 0.143385282
[25,] 0.398247406 0.404866407
[26,] 0.433033861 0.398247406
[27,] 0.425198798 0.433033861
[28,] 0.431296013 0.425198798
[29,] 0.462606772 0.431296013
[30,] 0.548718733 0.462606772
[31,] 0.756539050 0.548718733
[32,] 0.795670126 0.756539050
[33,] 0.559160568 0.795670126
[34,] -0.015611141 0.559160568
[35,] -0.206921900 -0.015611141
[36,] 0.032836123 -0.206921900
[37,] 0.156629465 0.032836123
[38,] 0.200105161 0.156629465
[39,] 0.083580857 0.200105161
[40,] 0.007056554 0.083580857
[41,] 0.051401174 0.007056554
[42,] 0.167925478 0.051401174
[43,] 0.562711933 0.167925478
[44,] 0.471430666 0.562711933
[45,] 0.047954970 0.471430666
[46,] -0.409438258 0.047954970
[47,] -0.713782878 -0.409438258
[48,] -0.739267891 -0.713782878
[49,] -0.485062207 -0.739267891
[50,] -0.324208029 -0.485062207
[51,] -0.236387713 -0.324208029
[52,] -0.299878155 -0.236387713
[53,] -0.455533535 -0.299878155
[54,] -0.504252268 -0.455533535
[55,] -0.618155053 -0.504252268
[56,] -0.644267014 -0.618155053
[57,] -0.141674988 -0.644267014
[58,] 0.300931784 -0.141674988
[59,] 0.387897923 0.300931784
[60,] 0.249379049 0.387897923
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.370578426 -0.585682526
2 -0.227102730 -0.370578426
3 -0.156660895 -0.227102730
4 -0.041874439 -0.156660895
5 -0.114908300 -0.041874439
6 -0.407073237 -0.114908300
7 -0.877529819 -0.407073237
8 -0.916675641 -0.877529819
9 -0.653185198 -0.916675641
10 -0.010578426 -0.653185198
11 0.389421574 -0.010578426
12 0.637868838 0.389421574
13 0.300763763 0.637868838
14 -0.081828263 0.300763763
15 -0.115731048 -0.081828263
16 -0.096599972 -0.115731048
17 0.056433889 -0.096599972
18 0.194681295 0.056433889
19 0.176433889 0.194681295
20 0.293841863 0.176433889
21 0.187744648 0.293841863
22 0.134696041 0.187744648
23 0.143385282 0.134696041
24 0.404866407 0.143385282
25 0.398247406 0.404866407
26 0.433033861 0.398247406
27 0.425198798 0.433033861
28 0.431296013 0.425198798
29 0.462606772 0.431296013
30 0.548718733 0.462606772
31 0.756539050 0.548718733
32 0.795670126 0.756539050
33 0.559160568 0.795670126
34 -0.015611141 0.559160568
35 -0.206921900 -0.015611141
36 0.032836123 -0.206921900
37 0.156629465 0.032836123
38 0.200105161 0.156629465
39 0.083580857 0.200105161
40 0.007056554 0.083580857
41 0.051401174 0.007056554
42 0.167925478 0.051401174
43 0.562711933 0.167925478
44 0.471430666 0.562711933
45 0.047954970 0.471430666
46 -0.409438258 0.047954970
47 -0.713782878 -0.409438258
48 -0.739267891 -0.713782878
49 -0.485062207 -0.739267891
50 -0.324208029 -0.485062207
51 -0.236387713 -0.324208029
52 -0.299878155 -0.236387713
53 -0.455533535 -0.299878155
54 -0.504252268 -0.455533535
55 -0.618155053 -0.504252268
56 -0.644267014 -0.618155053
57 -0.141674988 -0.644267014
58 0.300931784 -0.141674988
59 0.387897923 0.300931784
60 0.249379049 0.387897923
> 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/7r9c11258626668.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/8pn1u1258626668.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/9sgud1258626669.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/10bum61258626669.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/118s761258626669.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/12z9un1258626669.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/13u6sl1258626669.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/14gtqc1258626669.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/154xxm1258626669.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/16aglo1258626669.tab")
+ }
>
> system("convert tmp/19d991258626668.ps tmp/19d991258626668.png")
> system("convert tmp/2ecwc1258626668.ps tmp/2ecwc1258626668.png")
> system("convert tmp/30n6y1258626668.ps tmp/30n6y1258626668.png")
> system("convert tmp/44g0b1258626668.ps tmp/44g0b1258626668.png")
> system("convert tmp/5059y1258626668.ps tmp/5059y1258626668.png")
> system("convert tmp/6mrih1258626668.ps tmp/6mrih1258626668.png")
> system("convert tmp/7r9c11258626668.ps tmp/7r9c11258626668.png")
> system("convert tmp/8pn1u1258626668.ps tmp/8pn1u1258626668.png")
> system("convert tmp/9sgud1258626669.ps tmp/9sgud1258626669.png")
> system("convert tmp/10bum61258626669.ps tmp/10bum61258626669.png")
>
>
> proc.time()
user system elapsed
2.376 1.555 3.732