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.6,71.7,104.3,77.5,120.4,89.8,107.5,80.3,102.9,78.7,125.6,93.8,107.5,57.6,108.8,60.6,128.4,91,121.1,85.3,119.5,77.4,128.7,77.3,108.7,68.3,105.5,69.9,119.8,81.7,111.3,75.1,110.6,69.9,120.1,84,97.5,54.3,107.7,60,127.3,89.9,117.2,77,119.8,85.3,116.2,77.6,111,69.2,112.4,75.5,130.6,85.7,109.1,72.2,118.8,79.9,123.9,85.3,101.6,52.2,112.8,61.2,128,82.4,129.6,85.4,125.8,78.2,119.5,70.2,115.7,70.2,113.6,69.3,129.7,77.5,112,66.1,116.8,69,127,79.2,112.1,56.2,114.2,63.3,121.1,77.8,131.6,92,125,78.1,120.4,65.1,117.7,71.1,117.5,70.9,120.6,72,127.5,81.9,112.3,70.6,124.5,72.5,115.2,65.1,104.7,54.9,130.9,80,129.2,77.4,113.5,59.6,125.6,57.4,107.6,50.8),dim=c(2,61),dimnames=list(c('Y','X'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('Y','X'),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
Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 100.6 71.7 1 0 0 0 0 0 0 0 0 0 0 1
2 104.3 77.5 0 1 0 0 0 0 0 0 0 0 0 2
3 120.4 89.8 0 0 1 0 0 0 0 0 0 0 0 3
4 107.5 80.3 0 0 0 1 0 0 0 0 0 0 0 4
5 102.9 78.7 0 0 0 0 1 0 0 0 0 0 0 5
6 125.6 93.8 0 0 0 0 0 1 0 0 0 0 0 6
7 107.5 57.6 0 0 0 0 0 0 1 0 0 0 0 7
8 108.8 60.6 0 0 0 0 0 0 0 1 0 0 0 8
9 128.4 91.0 0 0 0 0 0 0 0 0 1 0 0 9
10 121.1 85.3 0 0 0 0 0 0 0 0 0 1 0 10
11 119.5 77.4 0 0 0 0 0 0 0 0 0 0 1 11
12 128.7 77.3 0 0 0 0 0 0 0 0 0 0 0 12
13 108.7 68.3 1 0 0 0 0 0 0 0 0 0 0 13
14 105.5 69.9 0 1 0 0 0 0 0 0 0 0 0 14
15 119.8 81.7 0 0 1 0 0 0 0 0 0 0 0 15
16 111.3 75.1 0 0 0 1 0 0 0 0 0 0 0 16
17 110.6 69.9 0 0 0 0 1 0 0 0 0 0 0 17
18 120.1 84.0 0 0 0 0 0 1 0 0 0 0 0 18
19 97.5 54.3 0 0 0 0 0 0 1 0 0 0 0 19
20 107.7 60.0 0 0 0 0 0 0 0 1 0 0 0 20
21 127.3 89.9 0 0 0 0 0 0 0 0 1 0 0 21
22 117.2 77.0 0 0 0 0 0 0 0 0 0 1 0 22
23 119.8 85.3 0 0 0 0 0 0 0 0 0 0 1 23
24 116.2 77.6 0 0 0 0 0 0 0 0 0 0 0 24
25 111.0 69.2 1 0 0 0 0 0 0 0 0 0 0 25
26 112.4 75.5 0 1 0 0 0 0 0 0 0 0 0 26
27 130.6 85.7 0 0 1 0 0 0 0 0 0 0 0 27
28 109.1 72.2 0 0 0 1 0 0 0 0 0 0 0 28
29 118.8 79.9 0 0 0 0 1 0 0 0 0 0 0 29
30 123.9 85.3 0 0 0 0 0 1 0 0 0 0 0 30
31 101.6 52.2 0 0 0 0 0 0 1 0 0 0 0 31
32 112.8 61.2 0 0 0 0 0 0 0 1 0 0 0 32
33 128.0 82.4 0 0 0 0 0 0 0 0 1 0 0 33
34 129.6 85.4 0 0 0 0 0 0 0 0 0 1 0 34
35 125.8 78.2 0 0 0 0 0 0 0 0 0 0 1 35
36 119.5 70.2 0 0 0 0 0 0 0 0 0 0 0 36
37 115.7 70.2 1 0 0 0 0 0 0 0 0 0 0 37
38 113.6 69.3 0 1 0 0 0 0 0 0 0 0 0 38
39 129.7 77.5 0 0 1 0 0 0 0 0 0 0 0 39
40 112.0 66.1 0 0 0 1 0 0 0 0 0 0 0 40
41 116.8 69.0 0 0 0 0 1 0 0 0 0 0 0 41
42 127.0 79.2 0 0 0 0 0 1 0 0 0 0 0 42
43 112.1 56.2 0 0 0 0 0 0 1 0 0 0 0 43
44 114.2 63.3 0 0 0 0 0 0 0 1 0 0 0 44
45 121.1 77.8 0 0 0 0 0 0 0 0 1 0 0 45
46 131.6 92.0 0 0 0 0 0 0 0 0 0 1 0 46
47 125.0 78.1 0 0 0 0 0 0 0 0 0 0 1 47
48 120.4 65.1 0 0 0 0 0 0 0 0 0 0 0 48
49 117.7 71.1 1 0 0 0 0 0 0 0 0 0 0 49
50 117.5 70.9 0 1 0 0 0 0 0 0 0 0 0 50
51 120.6 72.0 0 0 1 0 0 0 0 0 0 0 0 51
52 127.5 81.9 0 0 0 1 0 0 0 0 0 0 0 52
53 112.3 70.6 0 0 0 0 1 0 0 0 0 0 0 53
54 124.5 72.5 0 0 0 0 0 1 0 0 0 0 0 54
55 115.2 65.1 0 0 0 0 0 0 1 0 0 0 0 55
56 104.7 54.9 0 0 0 0 0 0 0 1 0 0 0 56
57 130.9 80.0 0 0 0 0 0 0 0 0 1 0 0 57
58 129.2 77.4 0 0 0 0 0 0 0 0 0 1 0 58
59 113.5 59.6 0 0 0 0 0 0 0 0 0 0 1 59
60 125.6 57.4 0 0 0 0 0 0 0 0 0 0 0 60
61 107.6 50.8 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) X M1 M2 M3 M4
71.5670 0.6003 -9.0611 -10.8422 -2.7608 -10.0107
M5 M6 M7 M8 M9 M10
-10.5541 -4.4649 -6.6128 -5.7496 -3.0329 -4.1965
M11 t
-4.8380 0.2439
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-7.8040 -2.2505 0.4403 2.4396 7.8026
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 71.5670 7.8708 9.093 6.29e-12 ***
X 0.6003 0.0996 6.027 2.45e-07 ***
M1 -9.0611 2.3719 -3.820 0.000390 ***
M2 -10.8422 2.4639 -4.400 6.17e-05 ***
M3 -2.7608 2.6557 -1.040 0.303868
M4 -10.0107 2.4883 -4.023 0.000207 ***
M5 -10.5541 2.4680 -4.276 9.23e-05 ***
M6 -4.4649 2.7393 -1.630 0.109794
M7 -6.6128 2.7885 -2.371 0.021869 *
M8 -5.7496 2.6529 -2.167 0.035312 *
M9 -3.0329 2.8217 -1.075 0.287933
M10 -4.1965 2.7913 -1.503 0.139412
M11 -4.8380 2.5168 -1.922 0.060643 .
t 0.2439 0.0343 7.110 5.57e-09 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.865 on 47 degrees of freedom
Multiple R-squared: 0.8476, Adjusted R-squared: 0.8055
F-statistic: 20.11 on 13 and 47 DF, p-value: 6.416e-15
> 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.4145626 0.8291251 0.58543744
[2,] 0.4542691 0.9085383 0.54573087
[3,] 0.9015321 0.1969359 0.09846793
[4,] 0.8423868 0.3152263 0.15761316
[5,] 0.7576347 0.4847307 0.24236533
[6,] 0.7028490 0.5943019 0.29715097
[7,] 0.6228752 0.7542495 0.37712476
[8,] 0.8656586 0.2686828 0.13434142
[9,] 0.8822526 0.2354948 0.11774740
[10,] 0.8838384 0.2323232 0.11616159
[11,] 0.8917175 0.2165649 0.10828246
[12,] 0.8862723 0.2274554 0.11372768
[13,] 0.8686892 0.2626217 0.13131083
[14,] 0.8468176 0.3063649 0.15318243
[15,] 0.8264315 0.3471370 0.17356850
[16,] 0.7870897 0.4258206 0.21291029
[17,] 0.7181316 0.5637369 0.28186844
[18,] 0.6551923 0.6896153 0.34480766
[19,] 0.6111960 0.7776080 0.38880399
[20,] 0.6239161 0.7521678 0.37608390
[21,] 0.5254860 0.9490281 0.47451405
[22,] 0.4264634 0.8529269 0.57353657
[23,] 0.4687112 0.9374224 0.53128880
[24,] 0.4124086 0.8248172 0.58759139
[25,] 0.4469200 0.8938401 0.55307996
[26,] 0.3213497 0.6426994 0.67865030
[27,] 0.3825020 0.7650040 0.61749798
[28,] 0.8091814 0.3816371 0.19081855
> postscript(file="/var/www/html/rcomp/tmp/1ov8s1258729829.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/213w51258729829.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/32gfi1258729829.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/4cgcu1258729829.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/52jea1258729829.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
-5.19187269 -3.43648140 -3.04558530 -3.23657390 -6.57654307 0.72568082
7 8 9 10 11 12
6.26086302 4.65283835 3.04293273 0.08444366 3.62450533 7.80262438
13 14 15 16 17 18
2.02266402 -0.60064960 -1.70959933 0.75851785 3.47965875 -1.81780901
19 20 21 22 23 24
-4.68463110 0.98651168 -0.32323976 -1.75950870 -3.74444233 -7.80397981
25 26 27 28 29 30
0.85587482 0.01111195 3.76265558 -2.62709961 2.75006355 -1.72472154
31 32 33 34 35 36
-2.25049524 2.43962998 1.95256120 2.67138946 3.59123529 -2.98820968
37 38 39 40 41 42
2.02905479 2.00651205 4.85867239 1.00826966 4.36691291 2.11064772
43 44 45 46 47 48
2.92175967 -0.34752924 -5.11253206 -2.21715734 -0.07524556 -1.95314876
49 50 51 52 53 54
0.56226559 2.01950700 -3.86614335 4.09688601 -4.02009214 0.70620200
55 56 57 58 59 60
-2.24749635 -7.73145076 0.44027789 1.22083292 -3.39605272 4.94271387
61
-0.27798654
> postscript(file="/var/www/html/rcomp/tmp/68cnl1258729829.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 -5.19187269 NA
1 -3.43648140 -5.19187269
2 -3.04558530 -3.43648140
3 -3.23657390 -3.04558530
4 -6.57654307 -3.23657390
5 0.72568082 -6.57654307
6 6.26086302 0.72568082
7 4.65283835 6.26086302
8 3.04293273 4.65283835
9 0.08444366 3.04293273
10 3.62450533 0.08444366
11 7.80262438 3.62450533
12 2.02266402 7.80262438
13 -0.60064960 2.02266402
14 -1.70959933 -0.60064960
15 0.75851785 -1.70959933
16 3.47965875 0.75851785
17 -1.81780901 3.47965875
18 -4.68463110 -1.81780901
19 0.98651168 -4.68463110
20 -0.32323976 0.98651168
21 -1.75950870 -0.32323976
22 -3.74444233 -1.75950870
23 -7.80397981 -3.74444233
24 0.85587482 -7.80397981
25 0.01111195 0.85587482
26 3.76265558 0.01111195
27 -2.62709961 3.76265558
28 2.75006355 -2.62709961
29 -1.72472154 2.75006355
30 -2.25049524 -1.72472154
31 2.43962998 -2.25049524
32 1.95256120 2.43962998
33 2.67138946 1.95256120
34 3.59123529 2.67138946
35 -2.98820968 3.59123529
36 2.02905479 -2.98820968
37 2.00651205 2.02905479
38 4.85867239 2.00651205
39 1.00826966 4.85867239
40 4.36691291 1.00826966
41 2.11064772 4.36691291
42 2.92175967 2.11064772
43 -0.34752924 2.92175967
44 -5.11253206 -0.34752924
45 -2.21715734 -5.11253206
46 -0.07524556 -2.21715734
47 -1.95314876 -0.07524556
48 0.56226559 -1.95314876
49 2.01950700 0.56226559
50 -3.86614335 2.01950700
51 4.09688601 -3.86614335
52 -4.02009214 4.09688601
53 0.70620200 -4.02009214
54 -2.24749635 0.70620200
55 -7.73145076 -2.24749635
56 0.44027789 -7.73145076
57 1.22083292 0.44027789
58 -3.39605272 1.22083292
59 4.94271387 -3.39605272
60 -0.27798654 4.94271387
61 NA -0.27798654
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -3.43648140 -5.19187269
[2,] -3.04558530 -3.43648140
[3,] -3.23657390 -3.04558530
[4,] -6.57654307 -3.23657390
[5,] 0.72568082 -6.57654307
[6,] 6.26086302 0.72568082
[7,] 4.65283835 6.26086302
[8,] 3.04293273 4.65283835
[9,] 0.08444366 3.04293273
[10,] 3.62450533 0.08444366
[11,] 7.80262438 3.62450533
[12,] 2.02266402 7.80262438
[13,] -0.60064960 2.02266402
[14,] -1.70959933 -0.60064960
[15,] 0.75851785 -1.70959933
[16,] 3.47965875 0.75851785
[17,] -1.81780901 3.47965875
[18,] -4.68463110 -1.81780901
[19,] 0.98651168 -4.68463110
[20,] -0.32323976 0.98651168
[21,] -1.75950870 -0.32323976
[22,] -3.74444233 -1.75950870
[23,] -7.80397981 -3.74444233
[24,] 0.85587482 -7.80397981
[25,] 0.01111195 0.85587482
[26,] 3.76265558 0.01111195
[27,] -2.62709961 3.76265558
[28,] 2.75006355 -2.62709961
[29,] -1.72472154 2.75006355
[30,] -2.25049524 -1.72472154
[31,] 2.43962998 -2.25049524
[32,] 1.95256120 2.43962998
[33,] 2.67138946 1.95256120
[34,] 3.59123529 2.67138946
[35,] -2.98820968 3.59123529
[36,] 2.02905479 -2.98820968
[37,] 2.00651205 2.02905479
[38,] 4.85867239 2.00651205
[39,] 1.00826966 4.85867239
[40,] 4.36691291 1.00826966
[41,] 2.11064772 4.36691291
[42,] 2.92175967 2.11064772
[43,] -0.34752924 2.92175967
[44,] -5.11253206 -0.34752924
[45,] -2.21715734 -5.11253206
[46,] -0.07524556 -2.21715734
[47,] -1.95314876 -0.07524556
[48,] 0.56226559 -1.95314876
[49,] 2.01950700 0.56226559
[50,] -3.86614335 2.01950700
[51,] 4.09688601 -3.86614335
[52,] -4.02009214 4.09688601
[53,] 0.70620200 -4.02009214
[54,] -2.24749635 0.70620200
[55,] -7.73145076 -2.24749635
[56,] 0.44027789 -7.73145076
[57,] 1.22083292 0.44027789
[58,] -3.39605272 1.22083292
[59,] 4.94271387 -3.39605272
[60,] -0.27798654 4.94271387
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -3.43648140 -5.19187269
2 -3.04558530 -3.43648140
3 -3.23657390 -3.04558530
4 -6.57654307 -3.23657390
5 0.72568082 -6.57654307
6 6.26086302 0.72568082
7 4.65283835 6.26086302
8 3.04293273 4.65283835
9 0.08444366 3.04293273
10 3.62450533 0.08444366
11 7.80262438 3.62450533
12 2.02266402 7.80262438
13 -0.60064960 2.02266402
14 -1.70959933 -0.60064960
15 0.75851785 -1.70959933
16 3.47965875 0.75851785
17 -1.81780901 3.47965875
18 -4.68463110 -1.81780901
19 0.98651168 -4.68463110
20 -0.32323976 0.98651168
21 -1.75950870 -0.32323976
22 -3.74444233 -1.75950870
23 -7.80397981 -3.74444233
24 0.85587482 -7.80397981
25 0.01111195 0.85587482
26 3.76265558 0.01111195
27 -2.62709961 3.76265558
28 2.75006355 -2.62709961
29 -1.72472154 2.75006355
30 -2.25049524 -1.72472154
31 2.43962998 -2.25049524
32 1.95256120 2.43962998
33 2.67138946 1.95256120
34 3.59123529 2.67138946
35 -2.98820968 3.59123529
36 2.02905479 -2.98820968
37 2.00651205 2.02905479
38 4.85867239 2.00651205
39 1.00826966 4.85867239
40 4.36691291 1.00826966
41 2.11064772 4.36691291
42 2.92175967 2.11064772
43 -0.34752924 2.92175967
44 -5.11253206 -0.34752924
45 -2.21715734 -5.11253206
46 -0.07524556 -2.21715734
47 -1.95314876 -0.07524556
48 0.56226559 -1.95314876
49 2.01950700 0.56226559
50 -3.86614335 2.01950700
51 4.09688601 -3.86614335
52 -4.02009214 4.09688601
53 0.70620200 -4.02009214
54 -2.24749635 0.70620200
55 -7.73145076 -2.24749635
56 0.44027789 -7.73145076
57 1.22083292 0.44027789
58 -3.39605272 1.22083292
59 4.94271387 -3.39605272
60 -0.27798654 4.94271387
> 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/7a30w1258729829.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/8nsu31258729829.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/9f3x41258729829.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/10ecek1258729829.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/11qfqg1258729829.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/12zpte1258729829.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/13ovn31258729829.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/14yw9e1258729829.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/159rs61258729829.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/16lz621258729829.tab")
+ }
> system("convert tmp/1ov8s1258729829.ps tmp/1ov8s1258729829.png")
> system("convert tmp/213w51258729829.ps tmp/213w51258729829.png")
> system("convert tmp/32gfi1258729829.ps tmp/32gfi1258729829.png")
> system("convert tmp/4cgcu1258729829.ps tmp/4cgcu1258729829.png")
> system("convert tmp/52jea1258729829.ps tmp/52jea1258729829.png")
> system("convert tmp/68cnl1258729829.ps tmp/68cnl1258729829.png")
> system("convert tmp/7a30w1258729829.ps tmp/7a30w1258729829.png")
> system("convert tmp/8nsu31258729829.ps tmp/8nsu31258729829.png")
> system("convert tmp/9f3x41258729829.ps tmp/9f3x41258729829.png")
> system("convert tmp/10ecek1258729829.ps tmp/10ecek1258729829.png")
>
>
> proc.time()
user system elapsed
2.434 1.589 5.009