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(109.8,8.4,111.7,8.4,98.6,8.4,96.9,8.6,95.1,8.9,97,8.8,112.7,8.3,102.9,7.5,97.4,7.2,111.4,7.4,87.4,8.8,96.8,9.3,114.1,9.3,110.3,8.7,103.9,8.2,101.6,8.3,94.6,8.5,95.9,8.6,104.7,8.5,102.8,8.2,98.1,8.1,113.9,7.9,80.9,8.6,95.7,8.7,113.2,8.7,105.9,8.5,108.8,8.4,102.3,8.5,99,8.7,100.7,8.7,115.5,8.6,100.7,8.5,109.9,8.3,114.6,8,85.4,8.2,100.5,8.1,114.8,8.1,116.5,8,112.9,7.9,102,7.9,106,8,105.3,8,118.8,7.9,106.1,8,109.3,7.7,117.2,7.2,92.5,7.5,104.2,7.3,112.5,7,122.4,7,113.3,7,100,7.2,110.7,7.3,112.8,7.1,109.8,6.8,117.3,6.4,109.1,6.1,115.9,6.5,96,7.7,99.8,7.9,116.8,7.5,115.7,6.9),dim=c(2,62),dimnames=list(c('Y','X'),1:62))
> y <- array(NA,dim=c(2,62),dimnames=list(c('Y','X'),1:62))
> 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
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
X Y M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 8.4 109.8 1 0 0 0 0 0 0 0 0 0 0 1
2 8.4 111.7 0 1 0 0 0 0 0 0 0 0 0 2
3 8.4 98.6 0 0 1 0 0 0 0 0 0 0 0 3
4 8.6 96.9 0 0 0 1 0 0 0 0 0 0 0 4
5 8.9 95.1 0 0 0 0 1 0 0 0 0 0 0 5
6 8.8 97.0 0 0 0 0 0 1 0 0 0 0 0 6
7 8.3 112.7 0 0 0 0 0 0 1 0 0 0 0 7
8 7.5 102.9 0 0 0 0 0 0 0 1 0 0 0 8
9 7.2 97.4 0 0 0 0 0 0 0 0 1 0 0 9
10 7.4 111.4 0 0 0 0 0 0 0 0 0 1 0 10
11 8.8 87.4 0 0 0 0 0 0 0 0 0 0 1 11
12 9.3 96.8 0 0 0 0 0 0 0 0 0 0 0 12
13 9.3 114.1 1 0 0 0 0 0 0 0 0 0 0 13
14 8.7 110.3 0 1 0 0 0 0 0 0 0 0 0 14
15 8.2 103.9 0 0 1 0 0 0 0 0 0 0 0 15
16 8.3 101.6 0 0 0 1 0 0 0 0 0 0 0 16
17 8.5 94.6 0 0 0 0 1 0 0 0 0 0 0 17
18 8.6 95.9 0 0 0 0 0 1 0 0 0 0 0 18
19 8.5 104.7 0 0 0 0 0 0 1 0 0 0 0 19
20 8.2 102.8 0 0 0 0 0 0 0 1 0 0 0 20
21 8.1 98.1 0 0 0 0 0 0 0 0 1 0 0 21
22 7.9 113.9 0 0 0 0 0 0 0 0 0 1 0 22
23 8.6 80.9 0 0 0 0 0 0 0 0 0 0 1 23
24 8.7 95.7 0 0 0 0 0 0 0 0 0 0 0 24
25 8.7 113.2 1 0 0 0 0 0 0 0 0 0 0 25
26 8.5 105.9 0 1 0 0 0 0 0 0 0 0 0 26
27 8.4 108.8 0 0 1 0 0 0 0 0 0 0 0 27
28 8.5 102.3 0 0 0 1 0 0 0 0 0 0 0 28
29 8.7 99.0 0 0 0 0 1 0 0 0 0 0 0 29
30 8.7 100.7 0 0 0 0 0 1 0 0 0 0 0 30
31 8.6 115.5 0 0 0 0 0 0 1 0 0 0 0 31
32 8.5 100.7 0 0 0 0 0 0 0 1 0 0 0 32
33 8.3 109.9 0 0 0 0 0 0 0 0 1 0 0 33
34 8.0 114.6 0 0 0 0 0 0 0 0 0 1 0 34
35 8.2 85.4 0 0 0 0 0 0 0 0 0 0 1 35
36 8.1 100.5 0 0 0 0 0 0 0 0 0 0 0 36
37 8.1 114.8 1 0 0 0 0 0 0 0 0 0 0 37
38 8.0 116.5 0 1 0 0 0 0 0 0 0 0 0 38
39 7.9 112.9 0 0 1 0 0 0 0 0 0 0 0 39
40 7.9 102.0 0 0 0 1 0 0 0 0 0 0 0 40
41 8.0 106.0 0 0 0 0 1 0 0 0 0 0 0 41
42 8.0 105.3 0 0 0 0 0 1 0 0 0 0 0 42
43 7.9 118.8 0 0 0 0 0 0 1 0 0 0 0 43
44 8.0 106.1 0 0 0 0 0 0 0 1 0 0 0 44
45 7.7 109.3 0 0 0 0 0 0 0 0 1 0 0 45
46 7.2 117.2 0 0 0 0 0 0 0 0 0 1 0 46
47 7.5 92.5 0 0 0 0 0 0 0 0 0 0 1 47
48 7.3 104.2 0 0 0 0 0 0 0 0 0 0 0 48
49 7.0 112.5 1 0 0 0 0 0 0 0 0 0 0 49
50 7.0 122.4 0 1 0 0 0 0 0 0 0 0 0 50
51 7.0 113.3 0 0 1 0 0 0 0 0 0 0 0 51
52 7.2 100.0 0 0 0 1 0 0 0 0 0 0 0 52
53 7.3 110.7 0 0 0 0 1 0 0 0 0 0 0 53
54 7.1 112.8 0 0 0 0 0 1 0 0 0 0 0 54
55 6.8 109.8 0 0 0 0 0 0 1 0 0 0 0 55
56 6.4 117.3 0 0 0 0 0 0 0 1 0 0 0 56
57 6.1 109.1 0 0 0 0 0 0 0 0 1 0 0 57
58 6.5 115.9 0 0 0 0 0 0 0 0 0 1 0 58
59 7.7 96.0 0 0 0 0 0 0 0 0 0 0 1 59
60 7.9 99.8 0 0 0 0 0 0 0 0 0 0 0 60
61 7.5 116.8 1 0 0 0 0 0 0 0 0 0 0 61
62 6.9 115.7 0 1 0 0 0 0 0 0 0 0 0 62
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Y M1 M2 M3 M4
10.071578 -0.008734 -0.100932 -0.322833 -0.445119 -0.359524
M5 M6 M7 M8 M9 M10
-0.148776 -0.151564 -0.258370 -0.587535 -0.811808 -0.779662
M11 t
-0.221928 -0.026207
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.97325 -0.28400 0.06856 0.27922 0.86489
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 10.071578 1.651738 6.098 1.78e-07 ***
Y -0.008734 0.017653 -0.495 0.6230
M1 -0.100932 0.390912 -0.258 0.7974
M2 -0.322833 0.391096 -0.825 0.4132
M3 -0.445119 0.346364 -1.285 0.2049
M4 -0.359524 0.303319 -1.185 0.2417
M5 -0.148776 0.303999 -0.489 0.6268
M6 -0.151564 0.307623 -0.493 0.6245
M7 -0.258370 0.386147 -0.669 0.5066
M8 -0.587535 0.325445 -1.805 0.0773 .
M9 -0.811808 0.316373 -2.566 0.0135 *
M10 -0.779662 0.405862 -1.921 0.0607 .
M11 -0.221928 0.353809 -0.627 0.5335
t -0.026207 0.004770 -5.494 1.47e-06 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.4718 on 48 degrees of freedom
Multiple R-squared: 0.6527, Adjusted R-squared: 0.5587
F-statistic: 6.94 on 13 and 48 DF, p-value: 2.761e-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.71158901 0.57682198 0.2884110
[2,] 0.57962210 0.84075580 0.4203779
[3,] 0.46363831 0.92727661 0.5363617
[4,] 0.50439172 0.99121656 0.4956083
[5,] 0.58026014 0.83947973 0.4197399
[6,] 0.51488096 0.97023808 0.4851190
[7,] 0.47069192 0.94138384 0.5293081
[8,] 0.52953735 0.94092530 0.4704626
[9,] 0.45969118 0.91938236 0.5403088
[10,] 0.36546901 0.73093803 0.6345310
[11,] 0.27717845 0.55435691 0.7228215
[12,] 0.19935435 0.39870871 0.8006456
[13,] 0.13881423 0.27762846 0.8611858
[14,] 0.09229404 0.18458809 0.9077060
[15,] 0.06347129 0.12694257 0.9365287
[16,] 0.06644978 0.13289956 0.9335502
[17,] 0.06557129 0.13114257 0.9344287
[18,] 0.04523745 0.09047491 0.9547625
[19,] 0.05432101 0.10864201 0.9456790
[20,] 0.11074482 0.22148965 0.8892552
[21,] 0.11274867 0.22549733 0.8872513
[22,] 0.09133329 0.18266658 0.9086667
[23,] 0.06740810 0.13481619 0.9325919
[24,] 0.04757730 0.09515460 0.9524227
[25,] 0.03325208 0.06650416 0.9667479
[26,] 0.02128789 0.04257578 0.9787121
[27,] 0.02891612 0.05783225 0.9710839
[28,] 0.03397575 0.06795151 0.9660242
[29,] 0.31332146 0.62664292 0.6866785
> postscript(file="/var/www/html/rcomp/tmp/1be7z1258664460.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/2u70p1258664460.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/30bcm1258664460.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/40kto1258664460.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/5h2ao1258664460.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 = 62
Frequency = 1
1 2 3 4 5 6
-0.585480214 -0.320778498 -0.286696074 -0.160931524 -0.061193692 -0.115604128
7 8 9 10 11 12
-0.345472732 -0.875691309 -0.973246188 -0.656914026 0.001950751 0.388326190
13 14 15 16 17 18
0.666557769 0.281477437 -0.125924398 -0.105400064 -0.151077433 -0.010728086
19 20 21 22 23 24
0.099140831 0.137918426 0.247350502 0.179403311 0.059664852 0.093202232
25 26 27 28 29 30
0.373180550 0.357532293 0.431353801 0.415196625 0.401833919 0.445676744
31 32 33 34 35 36
0.607947817 0.734060776 0.864891181 0.600000000 0.013449574 -0.150392938
37 38 39 40 41 42
0.101637563 0.264592541 0.281645045 0.127059622 0.077452873 0.100334835
43 44 45 46 47 48
0.251252107 0.595705821 0.574134070 0.137190706 -0.310058103 -0.603595170
49 50 51 52 53 54
-0.703966826 -0.369395568 -0.300378373 -0.275924659 -0.267015667 -0.419679365
55 56 57 58 59 60
-0.612868023 -0.591993715 -0.713129565 -0.259679990 0.234992926 0.272459686
61 62
0.148071158 -0.213428205
> postscript(file="/var/www/html/rcomp/tmp/6skdh1258664460.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 = 62
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.585480214 NA
1 -0.320778498 -0.585480214
2 -0.286696074 -0.320778498
3 -0.160931524 -0.286696074
4 -0.061193692 -0.160931524
5 -0.115604128 -0.061193692
6 -0.345472732 -0.115604128
7 -0.875691309 -0.345472732
8 -0.973246188 -0.875691309
9 -0.656914026 -0.973246188
10 0.001950751 -0.656914026
11 0.388326190 0.001950751
12 0.666557769 0.388326190
13 0.281477437 0.666557769
14 -0.125924398 0.281477437
15 -0.105400064 -0.125924398
16 -0.151077433 -0.105400064
17 -0.010728086 -0.151077433
18 0.099140831 -0.010728086
19 0.137918426 0.099140831
20 0.247350502 0.137918426
21 0.179403311 0.247350502
22 0.059664852 0.179403311
23 0.093202232 0.059664852
24 0.373180550 0.093202232
25 0.357532293 0.373180550
26 0.431353801 0.357532293
27 0.415196625 0.431353801
28 0.401833919 0.415196625
29 0.445676744 0.401833919
30 0.607947817 0.445676744
31 0.734060776 0.607947817
32 0.864891181 0.734060776
33 0.600000000 0.864891181
34 0.013449574 0.600000000
35 -0.150392938 0.013449574
36 0.101637563 -0.150392938
37 0.264592541 0.101637563
38 0.281645045 0.264592541
39 0.127059622 0.281645045
40 0.077452873 0.127059622
41 0.100334835 0.077452873
42 0.251252107 0.100334835
43 0.595705821 0.251252107
44 0.574134070 0.595705821
45 0.137190706 0.574134070
46 -0.310058103 0.137190706
47 -0.603595170 -0.310058103
48 -0.703966826 -0.603595170
49 -0.369395568 -0.703966826
50 -0.300378373 -0.369395568
51 -0.275924659 -0.300378373
52 -0.267015667 -0.275924659
53 -0.419679365 -0.267015667
54 -0.612868023 -0.419679365
55 -0.591993715 -0.612868023
56 -0.713129565 -0.591993715
57 -0.259679990 -0.713129565
58 0.234992926 -0.259679990
59 0.272459686 0.234992926
60 0.148071158 0.272459686
61 -0.213428205 0.148071158
62 NA -0.213428205
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.320778498 -0.585480214
[2,] -0.286696074 -0.320778498
[3,] -0.160931524 -0.286696074
[4,] -0.061193692 -0.160931524
[5,] -0.115604128 -0.061193692
[6,] -0.345472732 -0.115604128
[7,] -0.875691309 -0.345472732
[8,] -0.973246188 -0.875691309
[9,] -0.656914026 -0.973246188
[10,] 0.001950751 -0.656914026
[11,] 0.388326190 0.001950751
[12,] 0.666557769 0.388326190
[13,] 0.281477437 0.666557769
[14,] -0.125924398 0.281477437
[15,] -0.105400064 -0.125924398
[16,] -0.151077433 -0.105400064
[17,] -0.010728086 -0.151077433
[18,] 0.099140831 -0.010728086
[19,] 0.137918426 0.099140831
[20,] 0.247350502 0.137918426
[21,] 0.179403311 0.247350502
[22,] 0.059664852 0.179403311
[23,] 0.093202232 0.059664852
[24,] 0.373180550 0.093202232
[25,] 0.357532293 0.373180550
[26,] 0.431353801 0.357532293
[27,] 0.415196625 0.431353801
[28,] 0.401833919 0.415196625
[29,] 0.445676744 0.401833919
[30,] 0.607947817 0.445676744
[31,] 0.734060776 0.607947817
[32,] 0.864891181 0.734060776
[33,] 0.600000000 0.864891181
[34,] 0.013449574 0.600000000
[35,] -0.150392938 0.013449574
[36,] 0.101637563 -0.150392938
[37,] 0.264592541 0.101637563
[38,] 0.281645045 0.264592541
[39,] 0.127059622 0.281645045
[40,] 0.077452873 0.127059622
[41,] 0.100334835 0.077452873
[42,] 0.251252107 0.100334835
[43,] 0.595705821 0.251252107
[44,] 0.574134070 0.595705821
[45,] 0.137190706 0.574134070
[46,] -0.310058103 0.137190706
[47,] -0.603595170 -0.310058103
[48,] -0.703966826 -0.603595170
[49,] -0.369395568 -0.703966826
[50,] -0.300378373 -0.369395568
[51,] -0.275924659 -0.300378373
[52,] -0.267015667 -0.275924659
[53,] -0.419679365 -0.267015667
[54,] -0.612868023 -0.419679365
[55,] -0.591993715 -0.612868023
[56,] -0.713129565 -0.591993715
[57,] -0.259679990 -0.713129565
[58,] 0.234992926 -0.259679990
[59,] 0.272459686 0.234992926
[60,] 0.148071158 0.272459686
[61,] -0.213428205 0.148071158
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.320778498 -0.585480214
2 -0.286696074 -0.320778498
3 -0.160931524 -0.286696074
4 -0.061193692 -0.160931524
5 -0.115604128 -0.061193692
6 -0.345472732 -0.115604128
7 -0.875691309 -0.345472732
8 -0.973246188 -0.875691309
9 -0.656914026 -0.973246188
10 0.001950751 -0.656914026
11 0.388326190 0.001950751
12 0.666557769 0.388326190
13 0.281477437 0.666557769
14 -0.125924398 0.281477437
15 -0.105400064 -0.125924398
16 -0.151077433 -0.105400064
17 -0.010728086 -0.151077433
18 0.099140831 -0.010728086
19 0.137918426 0.099140831
20 0.247350502 0.137918426
21 0.179403311 0.247350502
22 0.059664852 0.179403311
23 0.093202232 0.059664852
24 0.373180550 0.093202232
25 0.357532293 0.373180550
26 0.431353801 0.357532293
27 0.415196625 0.431353801
28 0.401833919 0.415196625
29 0.445676744 0.401833919
30 0.607947817 0.445676744
31 0.734060776 0.607947817
32 0.864891181 0.734060776
33 0.600000000 0.864891181
34 0.013449574 0.600000000
35 -0.150392938 0.013449574
36 0.101637563 -0.150392938
37 0.264592541 0.101637563
38 0.281645045 0.264592541
39 0.127059622 0.281645045
40 0.077452873 0.127059622
41 0.100334835 0.077452873
42 0.251252107 0.100334835
43 0.595705821 0.251252107
44 0.574134070 0.595705821
45 0.137190706 0.574134070
46 -0.310058103 0.137190706
47 -0.603595170 -0.310058103
48 -0.703966826 -0.603595170
49 -0.369395568 -0.703966826
50 -0.300378373 -0.369395568
51 -0.275924659 -0.300378373
52 -0.267015667 -0.275924659
53 -0.419679365 -0.267015667
54 -0.612868023 -0.419679365
55 -0.591993715 -0.612868023
56 -0.713129565 -0.591993715
57 -0.259679990 -0.713129565
58 0.234992926 -0.259679990
59 0.272459686 0.234992926
60 0.148071158 0.272459686
61 -0.213428205 0.148071158
> 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/7849a1258664460.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/86gkf1258664460.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/92igj1258664460.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/10y8eg1258664460.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/11t81k1258664460.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/12r6mm1258664460.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/13g8qf1258664460.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/14jx5n1258664460.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/15y7521258664460.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/16h91v1258664460.tab")
+ }
> system("convert tmp/1be7z1258664460.ps tmp/1be7z1258664460.png")
> system("convert tmp/2u70p1258664460.ps tmp/2u70p1258664460.png")
> system("convert tmp/30bcm1258664460.ps tmp/30bcm1258664460.png")
> system("convert tmp/40kto1258664460.ps tmp/40kto1258664460.png")
> system("convert tmp/5h2ao1258664460.ps tmp/5h2ao1258664460.png")
> system("convert tmp/6skdh1258664460.ps tmp/6skdh1258664460.png")
> system("convert tmp/7849a1258664460.ps tmp/7849a1258664460.png")
> system("convert tmp/86gkf1258664460.ps tmp/86gkf1258664460.png")
> system("convert tmp/92igj1258664460.ps tmp/92igj1258664460.png")
> system("convert tmp/10y8eg1258664460.ps tmp/10y8eg1258664460.png")
>
>
> proc.time()
user system elapsed
2.373 1.559 2.844