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(100.03,2,100.25,1.8,99.6,2.7,100.16,2.3,100.49,1.9,99.72,2,100.14,2.3,98.48,2.8,100.38,2.4,101.45,2.3,98.42,2.7,98.6,2.7,100.06,2.9,98.62,3,100.84,2.2,100.02,2.3,97.95,2.8,98.32,2.8,98.27,2.8,97.22,2.2,99.28,2.6,100.38,2.8,99.02,2.5,100.32,2.4,99.81,2.3,100.6,1.9,101.19,1.7,100.47,2,101.77,2.1,102.32,1.7,102.39,1.8,101.16,1.8,100.63,1.8,101.48,1.3,101.44,1.3,100.09,1.3,100.7,1.2,100.78,1.4,99.81,2.2,98.45,2.9,98.49,3.1,97.48,3.5,97.91,3.6,96.94,4.4,98.53,4.1,96.82,5.1,95.76,5.8,95.27,5.9,97.32,5.4,96.68,5.5,97.87,4.8,97.42,3.2,97.94,2.7,99.52,2.1,100.99,1.9,99.92,0.6,101.97,0.7,101.58,-0.2,99.54,-1,100.83,-1.7),dim=c(2,60),dimnames=list(c('Y','X'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Y','X'),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 = '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
Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 100.03 2.0 1 0 0 0 0 0 0 0 0 0 0 1
2 100.25 1.8 0 1 0 0 0 0 0 0 0 0 0 2
3 99.60 2.7 0 0 1 0 0 0 0 0 0 0 0 3
4 100.16 2.3 0 0 0 1 0 0 0 0 0 0 0 4
5 100.49 1.9 0 0 0 0 1 0 0 0 0 0 0 5
6 99.72 2.0 0 0 0 0 0 1 0 0 0 0 0 6
7 100.14 2.3 0 0 0 0 0 0 1 0 0 0 0 7
8 98.48 2.8 0 0 0 0 0 0 0 1 0 0 0 8
9 100.38 2.4 0 0 0 0 0 0 0 0 1 0 0 9
10 101.45 2.3 0 0 0 0 0 0 0 0 0 1 0 10
11 98.42 2.7 0 0 0 0 0 0 0 0 0 0 1 11
12 98.60 2.7 0 0 0 0 0 0 0 0 0 0 0 12
13 100.06 2.9 1 0 0 0 0 0 0 0 0 0 0 13
14 98.62 3.0 0 1 0 0 0 0 0 0 0 0 0 14
15 100.84 2.2 0 0 1 0 0 0 0 0 0 0 0 15
16 100.02 2.3 0 0 0 1 0 0 0 0 0 0 0 16
17 97.95 2.8 0 0 0 0 1 0 0 0 0 0 0 17
18 98.32 2.8 0 0 0 0 0 1 0 0 0 0 0 18
19 98.27 2.8 0 0 0 0 0 0 1 0 0 0 0 19
20 97.22 2.2 0 0 0 0 0 0 0 1 0 0 0 20
21 99.28 2.6 0 0 0 0 0 0 0 0 1 0 0 21
22 100.38 2.8 0 0 0 0 0 0 0 0 0 1 0 22
23 99.02 2.5 0 0 0 0 0 0 0 0 0 0 1 23
24 100.32 2.4 0 0 0 0 0 0 0 0 0 0 0 24
25 99.81 2.3 1 0 0 0 0 0 0 0 0 0 0 25
26 100.60 1.9 0 1 0 0 0 0 0 0 0 0 0 26
27 101.19 1.7 0 0 1 0 0 0 0 0 0 0 0 27
28 100.47 2.0 0 0 0 1 0 0 0 0 0 0 0 28
29 101.77 2.1 0 0 0 0 1 0 0 0 0 0 0 29
30 102.32 1.7 0 0 0 0 0 1 0 0 0 0 0 30
31 102.39 1.8 0 0 0 0 0 0 1 0 0 0 0 31
32 101.16 1.8 0 0 0 0 0 0 0 1 0 0 0 32
33 100.63 1.8 0 0 0 0 0 0 0 0 1 0 0 33
34 101.48 1.3 0 0 0 0 0 0 0 0 0 1 0 34
35 101.44 1.3 0 0 0 0 0 0 0 0 0 0 1 35
36 100.09 1.3 0 0 0 0 0 0 0 0 0 0 0 36
37 100.70 1.2 1 0 0 0 0 0 0 0 0 0 0 37
38 100.78 1.4 0 1 0 0 0 0 0 0 0 0 0 38
39 99.81 2.2 0 0 1 0 0 0 0 0 0 0 0 39
40 98.45 2.9 0 0 0 1 0 0 0 0 0 0 0 40
41 98.49 3.1 0 0 0 0 1 0 0 0 0 0 0 41
42 97.48 3.5 0 0 0 0 0 1 0 0 0 0 0 42
43 97.91 3.6 0 0 0 0 0 0 1 0 0 0 0 43
44 96.94 4.4 0 0 0 0 0 0 0 1 0 0 0 44
45 98.53 4.1 0 0 0 0 0 0 0 0 1 0 0 45
46 96.82 5.1 0 0 0 0 0 0 0 0 0 1 0 46
47 95.76 5.8 0 0 0 0 0 0 0 0 0 0 1 47
48 95.27 5.9 0 0 0 0 0 0 0 0 0 0 0 48
49 97.32 5.4 1 0 0 0 0 0 0 0 0 0 0 49
50 96.68 5.5 0 1 0 0 0 0 0 0 0 0 0 50
51 97.87 4.8 0 0 1 0 0 0 0 0 0 0 0 51
52 97.42 3.2 0 0 0 1 0 0 0 0 0 0 0 52
53 97.94 2.7 0 0 0 0 1 0 0 0 0 0 0 53
54 99.52 2.1 0 0 0 0 0 1 0 0 0 0 0 54
55 100.99 1.9 0 0 0 0 0 0 1 0 0 0 0 55
56 99.92 0.6 0 0 0 0 0 0 0 1 0 0 0 56
57 101.97 0.7 0 0 0 0 0 0 0 0 1 0 0 57
58 101.58 -0.2 0 0 0 0 0 0 0 0 0 1 0 58
59 99.54 -1.0 0 0 0 0 0 0 0 0 0 0 1 59
60 100.83 -1.7 0 0 0 0 0 0 0 0 0 0 0 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X M1 M2 M3 M4
101.47330 -0.89730 0.96851 0.74987 1.24112 0.53686
M5 M6 M7 M8 M9 M10
0.55816 0.62768 1.16477 -0.12365 1.26971 1.41512
M11 t
-0.07563 -0.01525
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.85517 -0.60231 -0.01591 0.35279 2.20195
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 101.473297 0.556211 182.437 < 2e-16 ***
X -0.897297 0.092424 -9.708 1.03e-12 ***
M1 0.968512 0.640517 1.512 0.1374
M2 0.749871 0.639196 1.173 0.2468
M3 1.241121 0.638313 1.944 0.0580 .
M4 0.536859 0.636233 0.844 0.4031
M5 0.558164 0.635419 0.878 0.3843
M6 0.627685 0.634317 0.990 0.3276
M7 1.164773 0.634082 1.837 0.0727 .
M8 -0.123652 0.633154 -0.195 0.8460
M9 1.269707 0.632701 2.007 0.0507 .
M10 1.415120 0.632323 2.238 0.0301 *
M11 -0.075629 0.632180 -0.120 0.9053
t -0.015251 0.007606 -2.005 0.0509 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.9993 on 46 degrees of freedom
Multiple R-squared: 0.712, Adjusted R-squared: 0.6307
F-statistic: 8.749 on 13 and 46 DF, p-value: 1.370e-08
> 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.2712214 0.5424429 0.72877857
[2,] 0.1561142 0.3122284 0.84388580
[3,] 0.1771687 0.3543375 0.82283125
[4,] 0.3903480 0.7806960 0.60965198
[5,] 0.3678953 0.7357905 0.63210473
[6,] 0.2602014 0.5204027 0.73979865
[7,] 0.2428861 0.4857721 0.75711393
[8,] 0.3156383 0.6312766 0.68436168
[9,] 0.2625370 0.5250739 0.73746305
[10,] 0.2269514 0.4539028 0.77304862
[11,] 0.1618238 0.3236476 0.83817621
[12,] 0.1062786 0.2125571 0.89372143
[13,] 0.3126859 0.6253717 0.68731413
[14,] 0.5012396 0.9975208 0.49876040
[15,] 0.5385658 0.9228684 0.46143420
[16,] 0.5909827 0.8180347 0.40901733
[17,] 0.5825372 0.8349256 0.41746278
[18,] 0.6267387 0.7465226 0.37326129
[19,] 0.8125938 0.3748124 0.18740620
[20,] 0.8593979 0.2812042 0.14060209
[21,] 0.8157324 0.3685352 0.18426758
[22,] 0.7875990 0.4248021 0.21240105
[23,] 0.7050194 0.5899612 0.29498060
[24,] 0.7243297 0.5513406 0.27567030
[25,] 0.9295998 0.1408004 0.07040021
[26,] 0.8771884 0.2456231 0.12281156
[27,] 0.7684366 0.4631269 0.23156343
> postscript(file="/var/www/html/rcomp/tmp/1rdwl1258703072.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/20rtc1258703072.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/33ovf1258703072.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/4i7id1258703072.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/5slat1258703072.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
-0.60196383 -0.32753136 -0.64596397 0.27463067 0.23965777 -0.49488281
7 8 9 10 11 12
-0.32753151 -0.23520731 -0.07223426 0.77787385 -0.38720731 -0.26758572
13 14 15 16 17 18
0.41861258 -0.69776583 0.32839649 0.31763968 -1.30976583 -0.99403612
19 20 21 22 23 24
-1.56587394 -1.85057655 -0.80976583 0.33953142 0.21634229 1.36623417
25 26 27 28 29 30
-0.18675666 0.47821638 0.41275696 0.68145957 2.06513522 2.20194609
31 32 33 34 35 36
1.83983797 1.91351363 0.00540551 0.27659479 1.74259479 0.33221638
37 38 39 40 41 42
-0.10077446 0.39257685 -0.33558547 -0.34796403 -0.13455867 -0.83991012
43 44 45 46 47 48
-0.84201824 0.20949509 0.15219785 -0.79066723 0.28344074 -0.17720796
49 50 51 52 53 54
0.47088237 0.15450396 0.24039599 -0.92576588 -0.86046849 0.12688296
55 56 57 58 59 60
0.89558572 -0.03722486 0.72439673 -0.60333283 -1.85517050 -1.25365688
> postscript(file="/var/www/html/rcomp/tmp/6ca4f1258703072.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 -0.60196383 NA
1 -0.32753136 -0.60196383
2 -0.64596397 -0.32753136
3 0.27463067 -0.64596397
4 0.23965777 0.27463067
5 -0.49488281 0.23965777
6 -0.32753151 -0.49488281
7 -0.23520731 -0.32753151
8 -0.07223426 -0.23520731
9 0.77787385 -0.07223426
10 -0.38720731 0.77787385
11 -0.26758572 -0.38720731
12 0.41861258 -0.26758572
13 -0.69776583 0.41861258
14 0.32839649 -0.69776583
15 0.31763968 0.32839649
16 -1.30976583 0.31763968
17 -0.99403612 -1.30976583
18 -1.56587394 -0.99403612
19 -1.85057655 -1.56587394
20 -0.80976583 -1.85057655
21 0.33953142 -0.80976583
22 0.21634229 0.33953142
23 1.36623417 0.21634229
24 -0.18675666 1.36623417
25 0.47821638 -0.18675666
26 0.41275696 0.47821638
27 0.68145957 0.41275696
28 2.06513522 0.68145957
29 2.20194609 2.06513522
30 1.83983797 2.20194609
31 1.91351363 1.83983797
32 0.00540551 1.91351363
33 0.27659479 0.00540551
34 1.74259479 0.27659479
35 0.33221638 1.74259479
36 -0.10077446 0.33221638
37 0.39257685 -0.10077446
38 -0.33558547 0.39257685
39 -0.34796403 -0.33558547
40 -0.13455867 -0.34796403
41 -0.83991012 -0.13455867
42 -0.84201824 -0.83991012
43 0.20949509 -0.84201824
44 0.15219785 0.20949509
45 -0.79066723 0.15219785
46 0.28344074 -0.79066723
47 -0.17720796 0.28344074
48 0.47088237 -0.17720796
49 0.15450396 0.47088237
50 0.24039599 0.15450396
51 -0.92576588 0.24039599
52 -0.86046849 -0.92576588
53 0.12688296 -0.86046849
54 0.89558572 0.12688296
55 -0.03722486 0.89558572
56 0.72439673 -0.03722486
57 -0.60333283 0.72439673
58 -1.85517050 -0.60333283
59 -1.25365688 -1.85517050
60 NA -1.25365688
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.32753136 -0.60196383
[2,] -0.64596397 -0.32753136
[3,] 0.27463067 -0.64596397
[4,] 0.23965777 0.27463067
[5,] -0.49488281 0.23965777
[6,] -0.32753151 -0.49488281
[7,] -0.23520731 -0.32753151
[8,] -0.07223426 -0.23520731
[9,] 0.77787385 -0.07223426
[10,] -0.38720731 0.77787385
[11,] -0.26758572 -0.38720731
[12,] 0.41861258 -0.26758572
[13,] -0.69776583 0.41861258
[14,] 0.32839649 -0.69776583
[15,] 0.31763968 0.32839649
[16,] -1.30976583 0.31763968
[17,] -0.99403612 -1.30976583
[18,] -1.56587394 -0.99403612
[19,] -1.85057655 -1.56587394
[20,] -0.80976583 -1.85057655
[21,] 0.33953142 -0.80976583
[22,] 0.21634229 0.33953142
[23,] 1.36623417 0.21634229
[24,] -0.18675666 1.36623417
[25,] 0.47821638 -0.18675666
[26,] 0.41275696 0.47821638
[27,] 0.68145957 0.41275696
[28,] 2.06513522 0.68145957
[29,] 2.20194609 2.06513522
[30,] 1.83983797 2.20194609
[31,] 1.91351363 1.83983797
[32,] 0.00540551 1.91351363
[33,] 0.27659479 0.00540551
[34,] 1.74259479 0.27659479
[35,] 0.33221638 1.74259479
[36,] -0.10077446 0.33221638
[37,] 0.39257685 -0.10077446
[38,] -0.33558547 0.39257685
[39,] -0.34796403 -0.33558547
[40,] -0.13455867 -0.34796403
[41,] -0.83991012 -0.13455867
[42,] -0.84201824 -0.83991012
[43,] 0.20949509 -0.84201824
[44,] 0.15219785 0.20949509
[45,] -0.79066723 0.15219785
[46,] 0.28344074 -0.79066723
[47,] -0.17720796 0.28344074
[48,] 0.47088237 -0.17720796
[49,] 0.15450396 0.47088237
[50,] 0.24039599 0.15450396
[51,] -0.92576588 0.24039599
[52,] -0.86046849 -0.92576588
[53,] 0.12688296 -0.86046849
[54,] 0.89558572 0.12688296
[55,] -0.03722486 0.89558572
[56,] 0.72439673 -0.03722486
[57,] -0.60333283 0.72439673
[58,] -1.85517050 -0.60333283
[59,] -1.25365688 -1.85517050
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.32753136 -0.60196383
2 -0.64596397 -0.32753136
3 0.27463067 -0.64596397
4 0.23965777 0.27463067
5 -0.49488281 0.23965777
6 -0.32753151 -0.49488281
7 -0.23520731 -0.32753151
8 -0.07223426 -0.23520731
9 0.77787385 -0.07223426
10 -0.38720731 0.77787385
11 -0.26758572 -0.38720731
12 0.41861258 -0.26758572
13 -0.69776583 0.41861258
14 0.32839649 -0.69776583
15 0.31763968 0.32839649
16 -1.30976583 0.31763968
17 -0.99403612 -1.30976583
18 -1.56587394 -0.99403612
19 -1.85057655 -1.56587394
20 -0.80976583 -1.85057655
21 0.33953142 -0.80976583
22 0.21634229 0.33953142
23 1.36623417 0.21634229
24 -0.18675666 1.36623417
25 0.47821638 -0.18675666
26 0.41275696 0.47821638
27 0.68145957 0.41275696
28 2.06513522 0.68145957
29 2.20194609 2.06513522
30 1.83983797 2.20194609
31 1.91351363 1.83983797
32 0.00540551 1.91351363
33 0.27659479 0.00540551
34 1.74259479 0.27659479
35 0.33221638 1.74259479
36 -0.10077446 0.33221638
37 0.39257685 -0.10077446
38 -0.33558547 0.39257685
39 -0.34796403 -0.33558547
40 -0.13455867 -0.34796403
41 -0.83991012 -0.13455867
42 -0.84201824 -0.83991012
43 0.20949509 -0.84201824
44 0.15219785 0.20949509
45 -0.79066723 0.15219785
46 0.28344074 -0.79066723
47 -0.17720796 0.28344074
48 0.47088237 -0.17720796
49 0.15450396 0.47088237
50 0.24039599 0.15450396
51 -0.92576588 0.24039599
52 -0.86046849 -0.92576588
53 0.12688296 -0.86046849
54 0.89558572 0.12688296
55 -0.03722486 0.89558572
56 0.72439673 -0.03722486
57 -0.60333283 0.72439673
58 -1.85517050 -0.60333283
59 -1.25365688 -1.85517050
> 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/7tzon1258703072.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/838am1258703072.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/9e94k1258703072.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/10xvnv1258703072.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/11i09s1258703072.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/12l7vi1258703072.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/13vipb1258703072.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/144xaz1258703072.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/15fiiz1258703072.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/16093b1258703072.tab")
+ }
>
> system("convert tmp/1rdwl1258703072.ps tmp/1rdwl1258703072.png")
> system("convert tmp/20rtc1258703072.ps tmp/20rtc1258703072.png")
> system("convert tmp/33ovf1258703072.ps tmp/33ovf1258703072.png")
> system("convert tmp/4i7id1258703072.ps tmp/4i7id1258703072.png")
> system("convert tmp/5slat1258703072.ps tmp/5slat1258703072.png")
> system("convert tmp/6ca4f1258703072.ps tmp/6ca4f1258703072.png")
> system("convert tmp/7tzon1258703072.ps tmp/7tzon1258703072.png")
> system("convert tmp/838am1258703072.ps tmp/838am1258703072.png")
> system("convert tmp/9e94k1258703072.ps tmp/9e94k1258703072.png")
> system("convert tmp/10xvnv1258703072.ps tmp/10xvnv1258703072.png")
>
>
> proc.time()
user system elapsed
2.369 1.538 3.055