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(6.3
+ ,0.301029996
+ ,0.653212514
+ ,0.00
+ ,0.819543936
+ ,1.62324929
+ ,3
+ ,1
+ ,3
+ ,2.1
+ ,0.255272505
+ ,1.838849091
+ ,3.41
+ ,3.663040975
+ ,2.79518459
+ ,3
+ ,5
+ ,4
+ ,9.1
+ ,-0.15490196
+ ,1.431363764
+ ,1.02
+ ,2.254064453
+ ,2.255272505
+ ,4
+ ,4
+ ,4
+ ,15.8
+ ,0.591064607
+ ,1.278753601
+ ,-1.64
+ ,-0.522878745
+ ,1.544068044
+ ,1
+ ,1
+ ,1
+ ,5.2
+ ,0
+ ,1.482873584
+ ,2.20
+ ,2.227886705
+ ,2.593286067
+ ,4
+ ,5
+ ,4
+ ,10.9
+ ,0.556302501
+ ,1.447158031
+ ,0.52
+ ,1.408239965
+ ,1.799340549
+ ,1
+ ,2
+ ,1
+ ,8.3
+ ,0.146128036
+ ,1.698970004
+ ,1.72
+ ,2.643452676
+ ,2.361727836
+ ,1
+ ,1
+ ,1
+ ,11
+ ,0.176091259
+ ,0.84509804
+ ,-0.37
+ ,0.806179974
+ ,2.049218023
+ ,5
+ ,4
+ ,4
+ ,3.2
+ ,-0.15490196
+ ,1.477121255
+ ,2.67
+ ,2.626340367
+ ,2.44870632
+ ,5
+ ,5
+ ,5
+ ,6.3
+ ,0.322219295
+ ,0.544068044
+ ,-1.12
+ ,0.079181246
+ ,1.62324929
+ ,1
+ ,1
+ ,1
+ ,6.6
+ ,0.612783857
+ ,0.77815125
+ ,-0.11
+ ,0.544068044
+ ,1.62324929
+ ,2
+ ,2
+ ,2
+ ,9.5
+ ,0.079181246
+ ,1.017033339
+ ,-0.70
+ ,0.698970004
+ ,2.079181246
+ ,2
+ ,2
+ ,2
+ ,3.3
+ ,-0.301029996
+ ,1.301029996
+ ,1.44
+ ,2.06069784
+ ,2.170261715
+ ,5
+ ,5
+ ,5
+ ,11
+ ,0.531478917
+ ,0.591064607
+ ,-0.92
+ ,0
+ ,1.204119983
+ ,3
+ ,1
+ ,2
+ ,4.7
+ ,0.176091259
+ ,1.612783857
+ ,1.93
+ ,2.511883361
+ ,2.491361694
+ ,1
+ ,3
+ ,1
+ ,10.4
+ ,0.531478917
+ ,0.954242509
+ ,-1.00
+ ,0.602059991
+ ,1.447158031
+ ,5
+ ,1
+ ,3
+ ,7.4
+ ,-0.096910013
+ ,0.880813592
+ ,0.02
+ ,0.740362689
+ ,1.832508913
+ ,5
+ ,3
+ ,4
+ ,2.1
+ ,-0.096910013
+ ,1.653212514
+ ,2.72
+ ,2.8162413
+ ,2.526339277
+ ,5
+ ,5
+ ,5
+ ,17.9
+ ,0.301029996
+ ,1.380211242
+ ,-1.00
+ ,-0.602059991
+ ,1.698970004
+ ,1
+ ,1
+ ,1
+ ,6.1
+ ,0.278753601
+ ,2
+ ,1.79
+ ,3.120573931
+ ,2.426511261
+ ,1
+ ,1
+ ,1
+ ,11.9
+ ,0.113943352
+ ,0.505149978
+ ,-1.64
+ ,-0.397940009
+ ,1.278753601
+ ,4
+ ,1
+ ,3
+ ,13.8
+ ,0.748188027
+ ,0.698970004
+ ,0.23
+ ,0.799340549
+ ,1.079181246
+ ,2
+ ,1
+ ,1
+ ,14.3
+ ,0.491361694
+ ,0.812913357
+ ,0.54
+ ,1.033423755
+ ,2.079181246
+ ,2
+ ,1
+ ,1
+ ,15.2
+ ,0.255272505
+ ,1.079181246
+ ,-0.32
+ ,1.190331698
+ ,2.146128036
+ ,2
+ ,2
+ ,2
+ ,10
+ ,-0.045757491
+ ,1.305351369
+ ,1.00
+ ,2.06069784
+ ,2.230448921
+ ,4
+ ,4
+ ,4
+ ,11.9
+ ,0.255272505
+ ,1.113943352
+ ,0.21
+ ,1.056904851
+ ,1.230448921
+ ,2
+ ,1
+ ,2
+ ,6.5
+ ,0.278753601
+ ,1.431363764
+ ,2.28
+ ,2.255272505
+ ,2.06069784
+ ,4
+ ,4
+ ,4
+ ,7.5
+ ,-0.045757491
+ ,1.255272505
+ ,0.40
+ ,1.08278537
+ ,1.491361694
+ ,5
+ ,5
+ ,5
+ ,10.6
+ ,0.414973348
+ ,0.672097858
+ ,-0.55
+ ,0.278753601
+ ,1.322219295
+ ,3
+ ,1
+ ,3
+ ,7.4
+ ,0.380211242
+ ,0.991226076
+ ,0.63
+ ,1.702430536
+ ,1.716003344
+ ,1
+ ,1
+ ,1
+ ,8.4
+ ,0.079181246
+ ,1.462397998
+ ,0.83
+ ,2.252853031
+ ,2.214843848
+ ,2
+ ,3
+ ,2
+ ,5.7
+ ,-0.045757491
+ ,0.84509804
+ ,-0.12
+ ,1.089905111
+ ,2.352182518
+ ,2
+ ,2
+ ,2
+ ,4.9
+ ,-0.301029996
+ ,0.77815125
+ ,0.56
+ ,1.322219295
+ ,2.352182518
+ ,3
+ ,2
+ ,3
+ ,3.2
+ ,-0.22184875
+ ,1.301029996
+ ,1.74
+ ,2.243038049
+ ,2.178976947
+ ,5
+ ,5
+ ,5
+ ,11
+ ,0.361727836
+ ,0.653212514
+ ,-0.05
+ ,0.414973348
+ ,1.77815125
+ ,2
+ ,1
+ ,2
+ ,4.9
+ ,-0.301029996
+ ,0.875061263
+ ,0.30
+ ,1.089905111
+ ,2.301029996
+ ,3
+ ,1
+ ,3
+ ,13.2
+ ,0.414973348
+ ,0.361727836
+ ,-0.98
+ ,0.397940009
+ ,1.662757832
+ ,3
+ ,2
+ ,2
+ ,9.7
+ ,-0.22184875
+ ,1.380211242
+ ,0.62
+ ,1.763427994
+ ,2.322219295
+ ,4
+ ,3
+ ,4
+ ,12.8
+ ,0.819543936
+ ,0.477121255
+ ,0.54
+ ,0.591064607
+ ,1.146128036
+ ,2
+ ,1
+ ,1)
+ ,dim=c(9
+ ,39)
+ ,dimnames=list(c('SWS'
+ ,'PS'
+ ,'L'
+ ,'Wb'
+ ,'Wbr'
+ ,'Tg'
+ ,'P'
+ ,'S'
+ ,'D')
+ ,1:39))
> y <- array(NA,dim=c(9,39),dimnames=list(c('SWS','PS','L','Wb','Wbr','Tg','P','S','D'),1:39))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal 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
PS SWS L Wb Wbr Tg P S D
1 0.30103000 6.3 0.6532125 0.00 0.81954394 1.623249 3 1 3
2 0.25527250 2.1 1.8388491 3.41 3.66304097 2.795185 3 5 4
3 -0.15490196 9.1 1.4313638 1.02 2.25406445 2.255273 4 4 4
4 0.59106461 15.8 1.2787536 -1.64 -0.52287874 1.544068 1 1 1
5 0.00000000 5.2 1.4828736 2.20 2.22788670 2.593286 4 5 4
6 0.55630250 10.9 1.4471580 0.52 1.40823996 1.799341 1 2 1
7 0.14612804 8.3 1.6989700 1.72 2.64345268 2.361728 1 1 1
8 0.17609126 11.0 0.8450980 -0.37 0.80617997 2.049218 5 4 4
9 -0.15490196 3.2 1.4771213 2.67 2.62634037 2.448706 5 5 5
10 0.32221930 6.3 0.5440680 -1.12 0.07918125 1.623249 1 1 1
11 0.61278386 6.6 0.7781512 -0.11 0.54406804 1.623249 2 2 2
12 0.07918125 9.5 1.0170333 -0.70 0.69897000 2.079181 2 2 2
13 -0.30103000 3.3 1.3010300 1.44 2.06069784 2.170262 5 5 5
14 0.53147892 11.0 0.5910646 -0.92 0.00000000 1.204120 3 1 2
15 0.17609126 4.7 1.6127839 1.93 2.51188336 2.491362 1 3 1
16 0.53147892 10.4 0.9542425 -1.00 0.60205999 1.447158 5 1 3
17 -0.09691001 7.4 0.8808136 0.02 0.74036269 1.832509 5 3 4
18 -0.09691001 2.1 1.6532125 2.72 2.81624130 2.526339 5 5 5
19 0.30103000 17.9 1.3802112 -1.00 -0.60205999 1.698970 1 1 1
20 0.27875360 6.1 2.0000000 1.79 3.12057393 2.426511 1 1 1
21 0.11394335 11.9 0.5051500 -1.64 -0.39794001 1.278754 4 1 3
22 0.74818803 13.8 0.6989700 0.23 0.79934055 1.079181 2 1 1
23 0.49136169 14.3 0.8129134 0.54 1.03342376 2.079181 2 1 1
24 0.25527250 15.2 1.0791812 -0.32 1.19033170 2.146128 2 2 2
25 -0.04575749 10.0 1.3053514 1.00 2.06069784 2.230449 4 4 4
26 0.25527250 11.9 1.1139434 0.21 1.05690485 1.230449 2 1 2
27 0.27875360 6.5 1.4313638 2.28 2.25527251 2.060698 4 4 4
28 -0.04575749 7.5 1.2552725 0.40 1.08278537 1.491362 5 5 5
29 0.41497335 10.6 0.6720979 -0.55 0.27875360 1.322219 3 1 3
30 0.38021124 7.4 0.9912261 0.63 1.70243054 1.716003 1 1 1
31 0.07918125 8.4 1.4623980 0.83 2.25285303 2.214844 2 3 2
32 -0.04575749 5.7 0.8450980 -0.12 1.08990511 2.352183 2 2 2
33 -0.30103000 4.9 0.7781512 0.56 1.32221930 2.352183 3 2 3
34 -0.22184875 3.2 1.3010300 1.74 2.24303805 2.178977 5 5 5
35 0.36172784 11.0 0.6532125 -0.05 0.41497335 1.778151 2 1 2
36 -0.30103000 4.9 0.8750613 0.30 1.08990511 2.301030 3 1 3
37 0.41497335 13.2 0.3617278 -0.98 0.39794001 1.662758 3 2 2
38 -0.22184875 9.7 1.3802112 0.62 1.76342799 2.322219 4 3 4
39 0.81954394 12.8 0.4771213 0.54 0.59106461 1.146128 2 1 1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) SWS L Wb Wbr Tg
1.15646 0.01229 -0.03001 0.12358 -0.03714 -0.39786
P S D
0.07031 0.05001 -0.22635
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.24901 -0.12112 -0.02137 0.07756 0.39941
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.15646 0.23237 4.977 2.49e-05 ***
SWS 0.01229 0.01171 1.049 0.30256
L -0.03001 0.12322 -0.244 0.80921
Wb 0.12358 0.06791 1.820 0.07880 .
Wbr -0.03714 0.09297 -0.400 0.69233
Tg -0.39786 0.10391 -3.829 0.00061 ***
P 0.07031 0.06678 1.053 0.30082
S 0.05001 0.04070 1.229 0.22880
D -0.22635 0.08204 -2.759 0.00979 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.1663 on 30 degrees of freedom
Multiple R-squared: 0.7591, Adjusted R-squared: 0.6949
F-statistic: 11.82 on 8 and 30 DF, p-value: 2.018e-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.7948148 0.41037048 0.20518524
[2,] 0.7311305 0.53773905 0.26886952
[3,] 0.6069164 0.78616719 0.39308359
[4,] 0.4687235 0.93744700 0.53127650
[5,] 0.9729951 0.05400989 0.02700495
[6,] 0.9663299 0.06734019 0.03367009
[7,] 0.9459170 0.10816607 0.05408303
[8,] 0.9303907 0.13921855 0.06960927
[9,] 0.9546287 0.09074256 0.04537128
[10,] 0.9350880 0.12982395 0.06491198
[11,] 0.8838769 0.23224619 0.11612310
[12,] 0.8152274 0.36954510 0.18477255
[13,] 0.7048316 0.59033675 0.29516838
[14,] 0.5962131 0.80757382 0.40378691
[15,] 0.7104667 0.57906667 0.28953333
[16,] 0.8104665 0.37906709 0.18953354
> postscript(file="/var/www/html/rcomp/tmp/18rlr1291997727.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/28rlr1291997727.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/38rlr1291997727.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/411ku1291997727.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/511ku1291997727.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 39
Frequency = 1
1 2 3 4 5 6
0.181174644 0.399409978 -0.101083846 0.182490523 0.040958922 0.069336482
7 8 9 10 11 12
-0.129994066 0.154680072 -0.034307561 -0.002086479 0.290306373 -0.011689191
13 14 15 16 17 18
-0.166738126 0.042163403 -0.137661635 0.275118410 -0.159877518 0.074246091
19 20 21 22 23 24
-0.150702207 0.073542105 -0.129073928 -0.090467979 0.018232222 0.094164529
25 26 27 28 29 30
-0.021366023 -0.249014442 0.131432784 -0.142349109 0.170969093 -0.063257070
31 32 33 34 35 36
-0.112198918 -0.043640941 -0.210457629 -0.113162308 0.080868201 -0.154393517
37 38 39
0.046412463 -0.069088225 -0.032895577
> postscript(file="/var/www/html/rcomp/tmp/611ku1291997727.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 39
Frequency = 1
lag(myerror, k = 1) myerror
0 0.181174644 NA
1 0.399409978 0.181174644
2 -0.101083846 0.399409978
3 0.182490523 -0.101083846
4 0.040958922 0.182490523
5 0.069336482 0.040958922
6 -0.129994066 0.069336482
7 0.154680072 -0.129994066
8 -0.034307561 0.154680072
9 -0.002086479 -0.034307561
10 0.290306373 -0.002086479
11 -0.011689191 0.290306373
12 -0.166738126 -0.011689191
13 0.042163403 -0.166738126
14 -0.137661635 0.042163403
15 0.275118410 -0.137661635
16 -0.159877518 0.275118410
17 0.074246091 -0.159877518
18 -0.150702207 0.074246091
19 0.073542105 -0.150702207
20 -0.129073928 0.073542105
21 -0.090467979 -0.129073928
22 0.018232222 -0.090467979
23 0.094164529 0.018232222
24 -0.021366023 0.094164529
25 -0.249014442 -0.021366023
26 0.131432784 -0.249014442
27 -0.142349109 0.131432784
28 0.170969093 -0.142349109
29 -0.063257070 0.170969093
30 -0.112198918 -0.063257070
31 -0.043640941 -0.112198918
32 -0.210457629 -0.043640941
33 -0.113162308 -0.210457629
34 0.080868201 -0.113162308
35 -0.154393517 0.080868201
36 0.046412463 -0.154393517
37 -0.069088225 0.046412463
38 -0.032895577 -0.069088225
39 NA -0.032895577
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.399409978 0.181174644
[2,] -0.101083846 0.399409978
[3,] 0.182490523 -0.101083846
[4,] 0.040958922 0.182490523
[5,] 0.069336482 0.040958922
[6,] -0.129994066 0.069336482
[7,] 0.154680072 -0.129994066
[8,] -0.034307561 0.154680072
[9,] -0.002086479 -0.034307561
[10,] 0.290306373 -0.002086479
[11,] -0.011689191 0.290306373
[12,] -0.166738126 -0.011689191
[13,] 0.042163403 -0.166738126
[14,] -0.137661635 0.042163403
[15,] 0.275118410 -0.137661635
[16,] -0.159877518 0.275118410
[17,] 0.074246091 -0.159877518
[18,] -0.150702207 0.074246091
[19,] 0.073542105 -0.150702207
[20,] -0.129073928 0.073542105
[21,] -0.090467979 -0.129073928
[22,] 0.018232222 -0.090467979
[23,] 0.094164529 0.018232222
[24,] -0.021366023 0.094164529
[25,] -0.249014442 -0.021366023
[26,] 0.131432784 -0.249014442
[27,] -0.142349109 0.131432784
[28,] 0.170969093 -0.142349109
[29,] -0.063257070 0.170969093
[30,] -0.112198918 -0.063257070
[31,] -0.043640941 -0.112198918
[32,] -0.210457629 -0.043640941
[33,] -0.113162308 -0.210457629
[34,] 0.080868201 -0.113162308
[35,] -0.154393517 0.080868201
[36,] 0.046412463 -0.154393517
[37,] -0.069088225 0.046412463
[38,] -0.032895577 -0.069088225
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.399409978 0.181174644
2 -0.101083846 0.399409978
3 0.182490523 -0.101083846
4 0.040958922 0.182490523
5 0.069336482 0.040958922
6 -0.129994066 0.069336482
7 0.154680072 -0.129994066
8 -0.034307561 0.154680072
9 -0.002086479 -0.034307561
10 0.290306373 -0.002086479
11 -0.011689191 0.290306373
12 -0.166738126 -0.011689191
13 0.042163403 -0.166738126
14 -0.137661635 0.042163403
15 0.275118410 -0.137661635
16 -0.159877518 0.275118410
17 0.074246091 -0.159877518
18 -0.150702207 0.074246091
19 0.073542105 -0.150702207
20 -0.129073928 0.073542105
21 -0.090467979 -0.129073928
22 0.018232222 -0.090467979
23 0.094164529 0.018232222
24 -0.021366023 0.094164529
25 -0.249014442 -0.021366023
26 0.131432784 -0.249014442
27 -0.142349109 0.131432784
28 0.170969093 -0.142349109
29 -0.063257070 0.170969093
30 -0.112198918 -0.063257070
31 -0.043640941 -0.112198918
32 -0.210457629 -0.043640941
33 -0.113162308 -0.210457629
34 0.080868201 -0.113162308
35 -0.154393517 0.080868201
36 0.046412463 -0.154393517
37 -0.069088225 0.046412463
38 -0.032895577 -0.069088225
> 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/7bajw1291997727.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/84j1i1291997727.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/94j1i1291997727.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/www/html/rcomp/tmp/10xa021291997727.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/www/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/110ty81291997727.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/124cfw1291997727.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/13ilv51291997727.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/14lmtb1291997727.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/15p4az1291997727.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/16s5qn1291997727.tab")
+ }
>
> try(system("convert tmp/18rlr1291997727.ps tmp/18rlr1291997727.png",intern=TRUE))
character(0)
> try(system("convert tmp/28rlr1291997727.ps tmp/28rlr1291997727.png",intern=TRUE))
character(0)
> try(system("convert tmp/38rlr1291997727.ps tmp/38rlr1291997727.png",intern=TRUE))
character(0)
> try(system("convert tmp/411ku1291997727.ps tmp/411ku1291997727.png",intern=TRUE))
character(0)
> try(system("convert tmp/511ku1291997727.ps tmp/511ku1291997727.png",intern=TRUE))
character(0)
> try(system("convert tmp/611ku1291997727.ps tmp/611ku1291997727.png",intern=TRUE))
character(0)
> try(system("convert tmp/7bajw1291997727.ps tmp/7bajw1291997727.png",intern=TRUE))
character(0)
> try(system("convert tmp/84j1i1291997727.ps tmp/84j1i1291997727.png",intern=TRUE))
character(0)
> try(system("convert tmp/94j1i1291997727.ps tmp/94j1i1291997727.png",intern=TRUE))
character(0)
> try(system("convert tmp/10xa021291997727.ps tmp/10xa021291997727.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.363 1.667 6.342