R version 2.10.1 (2009-12-14)
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(0.30102999566398
+ ,0.65321251377534
+ ,0
+ ,0.81954393554187
+ ,1.6232492903979
+ ,3
+ ,1
+ ,3
+ ,0.25527250510331
+ ,1.83884909073726
+ ,3.40602894496362
+ ,3.66304097489397
+ ,2.79518458968242
+ ,3
+ ,5
+ ,4
+ ,-0.15490195998574
+ ,1.43136376415899
+ ,1.02325245963371
+ ,2.25406445291434
+ ,2.25527250510331
+ ,4
+ ,4
+ ,4
+ ,0.5910646070265
+ ,1.27875360095283
+ ,-1.69897000433602
+ ,-0.52287874528034
+ ,1.54406804435028
+ ,1
+ ,1
+ ,1
+ ,0
+ ,1.48287358360875
+ ,2.20411998265592
+ ,2.22788670461367
+ ,2.59328606702046
+ ,4
+ ,5
+ ,4
+ ,0.55630250076729
+ ,1.44715803134222
+ ,0.51851393987789
+ ,1.40823996531185
+ ,1.79934054945358
+ ,1
+ ,2
+ ,1
+ ,0.14612803567824
+ ,1.69897000433602
+ ,1.71733758272386
+ ,2.64345267648619
+ ,2.36172783601759
+ ,1
+ ,1
+ ,1
+ ,0.17609125905568
+ ,0.84509804001426
+ ,-0.36653154442041
+ ,0.80617997398389
+ ,2.04921802267018
+ ,5
+ ,4
+ ,4
+ ,-0.15490195998574
+ ,1.47712125471966
+ ,2.66745295288995
+ ,2.62634036737504
+ ,2.44870631990508
+ ,5
+ ,5
+ ,5
+ ,0.32221929473392
+ ,0.54406804435028
+ ,-1.09691001300806
+ ,0.079181246047625
+ ,1.6232492903979
+ ,1
+ ,1
+ ,1
+ ,0.61278385671974
+ ,0.77815125038364
+ ,-0.10237290870956
+ ,0.54406804435028
+ ,1.6232492903979
+ ,2
+ ,2
+ ,2
+ ,0.079181246047625
+ ,1.01703333929878
+ ,-0.69897000433602
+ ,0.69897000433602
+ ,2.07918124604762
+ ,2
+ ,2
+ ,2
+ ,-0.30102999566398
+ ,1.30102999566398
+ ,1.44185217577329
+ ,2.06069784035361
+ ,2.17026171539496
+ ,5
+ ,5
+ ,5
+ ,0.53147891704226
+ ,0.5910646070265
+ ,-0.92081875395238
+ ,0
+ ,1.20411998265592
+ ,3
+ ,1
+ ,2
+ ,0.17609125905568
+ ,1.61278385671974
+ ,1.92941892571429
+ ,2.51188336097887
+ ,2.49136169383427
+ ,1
+ ,3
+ ,1
+ ,0.53147891704226
+ ,0.95424250943932
+ ,-1
+ ,0.60205999132796
+ ,1.44715803134222
+ ,5
+ ,1
+ ,3
+ ,-0.096910013008056
+ ,0.88081359228079
+ ,0.01703333929878
+ ,0.74036268949424
+ ,1.83250891270624
+ ,5
+ ,3
+ ,4
+ ,-0.096910013008056
+ ,1.66275783168157
+ ,2.71683772329952
+ ,2.81624129999178
+ ,2.52633927738984
+ ,5
+ ,5
+ ,5
+ ,0.30102999566398
+ ,1.38021124171161
+ ,-2
+ ,-0.60205999132796
+ ,1.69897000433602
+ ,1
+ ,1
+ ,1
+ ,0.27875360095283
+ ,2
+ ,1.79239168949825
+ ,3.12057393120585
+ ,2.42651126136458
+ ,1
+ ,1
+ ,1
+ ,0.11394335230684
+ ,0.50514997831991
+ ,-1.69897000433602
+ ,-0.39794000867204
+ ,1.27875360095283
+ ,4
+ ,1
+ ,3
+ ,0.7481880270062
+ ,0.69897000433602
+ ,0.23044892137827
+ ,0.79934054945358
+ ,1.07918124604762
+ ,2
+ ,1
+ ,1
+ ,0.49136169383427
+ ,0.81291335664286
+ ,0.54406804435028
+ ,1.03342375548695
+ ,2.07918124604762
+ ,2
+ ,1
+ ,1
+ ,0.25527250510331
+ ,1.07918124604762
+ ,-0.31875876262441
+ ,1.19033169817029
+ ,2.14612803567824
+ ,2
+ ,2
+ ,2
+ ,-0.045757490560675
+ ,1.30535136944662
+ ,1
+ ,2.06069784035361
+ ,2.23044892137827
+ ,4
+ ,4
+ ,4
+ ,0.25527250510331
+ ,1.11394335230684
+ ,0.20951501454263
+ ,1.05690485133647
+ ,1.23044892137827
+ ,2
+ ,1
+ ,2
+ ,0.27875360095283
+ ,1.43136376415899
+ ,2.28330122870355
+ ,2.25527250510331
+ ,2.06069784035361
+ ,4
+ ,4
+ ,4
+ ,-0.045757490560675
+ ,1.25527250510331
+ ,0.39794000867204
+ ,1.08278537031645
+ ,1.49136169383427
+ ,5
+ ,5
+ ,5
+ ,0.41497334797082
+ ,0.67209785793572
+ ,-0.55284196865778
+ ,0.27875360095283
+ ,1.32221929473392
+ ,3
+ ,1
+ ,3
+ ,0.38021124171161
+ ,0.99122607569249
+ ,0.62736585659273
+ ,1.70243053644553
+ ,1.7160033436348
+ ,1
+ ,1
+ ,1
+ ,0.079181246047625
+ ,1.46239799789896
+ ,0.83250891270624
+ ,2.25285303097989
+ ,2.2148438480477
+ ,2
+ ,3
+ ,2
+ ,-0.045757490560675
+ ,0.84509804001426
+ ,-0.1249387366083
+ ,1.0899051114394
+ ,2.35218251811136
+ ,2
+ ,2
+ ,2
+ ,-0.30102999566398
+ ,0.77815125038364
+ ,0.55630250076729
+ ,1.32221929473392
+ ,2.35218251811136
+ ,3
+ ,2
+ ,3
+ ,-0.22184874961636
+ ,1.30102999566398
+ ,1.74429298312268
+ ,2.24303804868629
+ ,2.17897694729317
+ ,5
+ ,5
+ ,5
+ ,0.36172783601759
+ ,0.65321251377534
+ ,-0.045757490560675
+ ,0.41497334797082
+ ,1.77815125038364
+ ,2
+ ,1
+ ,2
+ ,-0.30102999566398
+ ,0.8750612633917
+ ,0.30102999566398
+ ,1.0899051114394
+ ,2.30102999566398
+ ,3
+ ,1
+ ,3
+ ,0.41497334797082
+ ,0.36172783601759
+ ,-1
+ ,0.39794000867204
+ ,1.66275783168157
+ ,3
+ ,2
+ ,2
+ ,-0.22184874961636
+ ,1.38021124171161
+ ,0.6222140229663
+ ,1.76342799356294
+ ,2.32221929473392
+ ,4
+ ,3
+ ,4
+ ,0.81954393554187
+ ,0.47712125471966
+ ,0.54406804435028
+ ,0.5910646070265
+ ,1.14612803567824
+ ,2
+ ,1
+ ,1)
+ ,dim=c(8
+ ,39)
+ ,dimnames=list(c('logPS'
+ ,'logL'
+ ,'logWb'
+ ,'logWbr'
+ ,'logtg'
+ ,'P'
+ ,'S'
+ ,'D')
+ ,1:39))
> y <- array(NA,dim=c(8,39),dimnames=list(c('logPS','logL','logWb','logWbr','logtg','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 = '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
Warning messages:
1: package 'lmtest' was built under R version 2.8.1 and help may not work correctly
2: package 'zoo' was built under R version 2.8.1 and help may not work correctly
> 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
logPS logL logWb logWbr logtg P S D
1 0.30103000 0.6532125 0.00000000 0.81954394 1.623249 3 1 3
2 0.25527251 1.8388491 3.40602894 3.66304097 2.795185 3 5 4
3 -0.15490196 1.4313638 1.02325246 2.25406445 2.255273 4 4 4
4 0.59106461 1.2787536 -1.69897000 -0.52287875 1.544068 1 1 1
5 0.00000000 1.4828736 2.20411998 2.22788670 2.593286 4 5 4
6 0.55630250 1.4471580 0.51851394 1.40823997 1.799341 1 2 1
7 0.14612804 1.6989700 1.71733758 2.64345268 2.361728 1 1 1
8 0.17609126 0.8450980 -0.36653154 0.80617997 2.049218 5 4 4
9 -0.15490196 1.4771213 2.66745295 2.62634037 2.448706 5 5 5
10 0.32221929 0.5440680 -1.09691001 0.07918125 1.623249 1 1 1
11 0.61278386 0.7781513 -0.10237291 0.54406804 1.623249 2 2 2
12 0.07918125 1.0170333 -0.69897000 0.69897000 2.079181 2 2 2
13 -0.30103000 1.3010300 1.44185218 2.06069784 2.170262 5 5 5
14 0.53147892 0.5910646 -0.92081875 0.00000000 1.204120 3 1 2
15 0.17609126 1.6127839 1.92941893 2.51188336 2.491362 1 3 1
16 0.53147892 0.9542425 -1.00000000 0.60205999 1.447158 5 1 3
17 -0.09691001 0.8808136 0.01703334 0.74036269 1.832509 5 3 4
18 -0.09691001 1.6627578 2.71683772 2.81624130 2.526339 5 5 5
19 0.30103000 1.3802112 -2.00000000 -0.60205999 1.698970 1 1 1
20 0.27875360 2.0000000 1.79239169 3.12057393 2.426511 1 1 1
21 0.11394335 0.5051500 -1.69897000 -0.39794001 1.278754 4 1 3
22 0.74818803 0.6989700 0.23044892 0.79934055 1.079181 2 1 1
23 0.49136169 0.8129134 0.54406804 1.03342376 2.079181 2 1 1
24 0.25527251 1.0791812 -0.31875876 1.19033170 2.146128 2 2 2
25 -0.04575749 1.3053514 1.00000000 2.06069784 2.230449 4 4 4
26 0.25527251 1.1139434 0.20951501 1.05690485 1.230449 2 1 2
27 0.27875360 1.4313638 2.28330123 2.25527251 2.060698 4 4 4
28 -0.04575749 1.2552725 0.39794001 1.08278537 1.491362 5 5 5
29 0.41497335 0.6720979 -0.55284197 0.27875360 1.322219 3 1 3
30 0.38021124 0.9912261 0.62736586 1.70243054 1.716003 1 1 1
31 0.07918125 1.4623980 0.83250891 2.25285303 2.214844 2 3 2
32 -0.04575749 0.8450980 -0.12493874 1.08990511 2.352183 2 2 2
33 -0.30103000 0.7781513 0.55630250 1.32221929 2.352183 3 2 3
34 -0.22184875 1.3010300 1.74429298 2.24303805 2.178977 5 5 5
35 0.36172784 0.6532125 -0.04575749 0.41497335 1.778151 2 1 2
36 -0.30103000 0.8750613 0.30103000 1.08990511 2.301030 3 1 3
37 0.41497335 0.3617278 -1.00000000 0.39794001 1.662758 3 2 2
38 -0.22184875 1.3802112 0.62221402 1.76342799 2.322219 4 3 4
39 0.81954394 0.4771213 0.54406804 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) logL logWb logWbr logtg P
1.27731 0.06911 0.14055 -0.11512 -0.39749 0.09398
S D
0.05249 -0.26414
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.22987 -0.10757 -0.02791 0.09472 0.41710
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.27731 0.18596 6.869 1.07e-07 ***
logL 0.06911 0.11643 0.594 0.557105
logWb 0.14055 0.07146 1.967 0.058213 .
logWbr -0.11512 0.10471 -1.099 0.280033
logtg -0.39749 0.10275 -3.869 0.000525 ***
P 0.09398 0.06289 1.494 0.145224
S 0.05249 0.03991 1.315 0.198047
D -0.26414 0.07418 -3.561 0.001217 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.1641 on 31 degrees of freedom
Multiple R-squared: 0.7575, Adjusted R-squared: 0.7028
F-statistic: 13.83 on 7 and 31 DF, p-value: 5.648e-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.9352297 0.12954056 0.06477028
[2,] 0.8785266 0.24294689 0.12147344
[3,] 0.9322829 0.13543422 0.06771711
[4,] 0.8783762 0.24324765 0.12162383
[5,] 0.8548455 0.29030907 0.14515453
[6,] 0.9167322 0.16653564 0.08326782
[7,] 0.9220652 0.15586962 0.07793481
[8,] 0.8722234 0.25555316 0.12777658
[9,] 0.8224597 0.35508064 0.17754032
[10,] 0.7545507 0.49089868 0.24544934
[11,] 0.7201405 0.55971898 0.27985949
[12,] 0.6247025 0.75059501 0.37529750
[13,] 0.5183762 0.96324750 0.48162375
[14,] 0.5139578 0.97208432 0.48604216
[15,] 0.4229254 0.84585070 0.57707465
[16,] 0.5095360 0.98092791 0.49046395
[17,] 0.7009698 0.59806036 0.29903018
[18,] 0.9788886 0.04222275 0.02111137
> postscript(file="/var/www/rcomp/tmp/1028n1272718491.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/rcomp/tmp/2028n1272718491.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/rcomp/tmp/3sbqp1272718491.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/rcomp/tmp/4sbqp1272718491.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/rcomp/tmp/5sbqp1272718491.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 = 39
Frequency = 1
1 2 3 4 5 6
0.17614950 0.41710055 -0.04831766 0.13539826 0.01590667 0.04862855
7 8 9 10 11 12
-0.12920348 0.17595705 -0.04515328 -0.06650807 0.23928925 -0.02790999
13 14 15 16 17 18
-0.18265350 0.01522659 -0.19169416 0.24336107 -0.19464688 0.04578926
19 20 21 22 23 24
-0.06688229 0.05274877 -0.13298742 -0.06513145 0.05052716 0.17362644
25 26 27 28 29 30
0.04067505 -0.22986560 0.13103756 -0.15993528 0.18457466 -0.05801879
31 32 33 34 35 36
-0.09361320 -0.06812481 -0.21761074 -0.12152391 0.08811199 -0.18301553
37 38 39
0.10132312 -0.03274569 -0.01988977
> postscript(file="/var/www/rcomp/tmp/6l2ps1272718491.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 = 39
Frequency = 1
lag(myerror, k = 1) myerror
0 0.17614950 NA
1 0.41710055 0.17614950
2 -0.04831766 0.41710055
3 0.13539826 -0.04831766
4 0.01590667 0.13539826
5 0.04862855 0.01590667
6 -0.12920348 0.04862855
7 0.17595705 -0.12920348
8 -0.04515328 0.17595705
9 -0.06650807 -0.04515328
10 0.23928925 -0.06650807
11 -0.02790999 0.23928925
12 -0.18265350 -0.02790999
13 0.01522659 -0.18265350
14 -0.19169416 0.01522659
15 0.24336107 -0.19169416
16 -0.19464688 0.24336107
17 0.04578926 -0.19464688
18 -0.06688229 0.04578926
19 0.05274877 -0.06688229
20 -0.13298742 0.05274877
21 -0.06513145 -0.13298742
22 0.05052716 -0.06513145
23 0.17362644 0.05052716
24 0.04067505 0.17362644
25 -0.22986560 0.04067505
26 0.13103756 -0.22986560
27 -0.15993528 0.13103756
28 0.18457466 -0.15993528
29 -0.05801879 0.18457466
30 -0.09361320 -0.05801879
31 -0.06812481 -0.09361320
32 -0.21761074 -0.06812481
33 -0.12152391 -0.21761074
34 0.08811199 -0.12152391
35 -0.18301553 0.08811199
36 0.10132312 -0.18301553
37 -0.03274569 0.10132312
38 -0.01988977 -0.03274569
39 NA -0.01988977
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.41710055 0.17614950
[2,] -0.04831766 0.41710055
[3,] 0.13539826 -0.04831766
[4,] 0.01590667 0.13539826
[5,] 0.04862855 0.01590667
[6,] -0.12920348 0.04862855
[7,] 0.17595705 -0.12920348
[8,] -0.04515328 0.17595705
[9,] -0.06650807 -0.04515328
[10,] 0.23928925 -0.06650807
[11,] -0.02790999 0.23928925
[12,] -0.18265350 -0.02790999
[13,] 0.01522659 -0.18265350
[14,] -0.19169416 0.01522659
[15,] 0.24336107 -0.19169416
[16,] -0.19464688 0.24336107
[17,] 0.04578926 -0.19464688
[18,] -0.06688229 0.04578926
[19,] 0.05274877 -0.06688229
[20,] -0.13298742 0.05274877
[21,] -0.06513145 -0.13298742
[22,] 0.05052716 -0.06513145
[23,] 0.17362644 0.05052716
[24,] 0.04067505 0.17362644
[25,] -0.22986560 0.04067505
[26,] 0.13103756 -0.22986560
[27,] -0.15993528 0.13103756
[28,] 0.18457466 -0.15993528
[29,] -0.05801879 0.18457466
[30,] -0.09361320 -0.05801879
[31,] -0.06812481 -0.09361320
[32,] -0.21761074 -0.06812481
[33,] -0.12152391 -0.21761074
[34,] 0.08811199 -0.12152391
[35,] -0.18301553 0.08811199
[36,] 0.10132312 -0.18301553
[37,] -0.03274569 0.10132312
[38,] -0.01988977 -0.03274569
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.41710055 0.17614950
2 -0.04831766 0.41710055
3 0.13539826 -0.04831766
4 0.01590667 0.13539826
5 0.04862855 0.01590667
6 -0.12920348 0.04862855
7 0.17595705 -0.12920348
8 -0.04515328 0.17595705
9 -0.06650807 -0.04515328
10 0.23928925 -0.06650807
11 -0.02790999 0.23928925
12 -0.18265350 -0.02790999
13 0.01522659 -0.18265350
14 -0.19169416 0.01522659
15 0.24336107 -0.19169416
16 -0.19464688 0.24336107
17 0.04578926 -0.19464688
18 -0.06688229 0.04578926
19 0.05274877 -0.06688229
20 -0.13298742 0.05274877
21 -0.06513145 -0.13298742
22 0.05052716 -0.06513145
23 0.17362644 0.05052716
24 0.04067505 0.17362644
25 -0.22986560 0.04067505
26 0.13103756 -0.22986560
27 -0.15993528 0.13103756
28 0.18457466 -0.15993528
29 -0.05801879 0.18457466
30 -0.09361320 -0.05801879
31 -0.06812481 -0.09361320
32 -0.21761074 -0.06812481
33 -0.12152391 -0.21761074
34 0.08811199 -0.12152391
35 -0.18301553 0.08811199
36 0.10132312 -0.18301553
37 -0.03274569 0.10132312
38 -0.01988977 -0.03274569
> 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/rcomp/tmp/7ecov1272718491.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/rcomp/tmp/8ecov1272718491.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/rcomp/tmp/9ecov1272718491.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/rcomp/tmp/10635g1272718491.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/rcomp/tmp/11a3441272718491.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/rcomp/tmp/12vm2a1272718491.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/rcomp/tmp/13rwij1272718491.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/rcomp/tmp/14561k1272718492.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/rcomp/tmp/15gxi41272718492.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/rcomp/tmp/16u7yd1272718492.tab")
+ }
> try(system("convert tmp/1028n1272718491.ps tmp/1028n1272718491.png",intern=TRUE))
character(0)
> try(system("convert tmp/2028n1272718491.ps tmp/2028n1272718491.png",intern=TRUE))
character(0)
> try(system("convert tmp/3sbqp1272718491.ps tmp/3sbqp1272718491.png",intern=TRUE))
character(0)
> try(system("convert tmp/4sbqp1272718491.ps tmp/4sbqp1272718491.png",intern=TRUE))
character(0)
> try(system("convert tmp/5sbqp1272718491.ps tmp/5sbqp1272718491.png",intern=TRUE))
character(0)
> try(system("convert tmp/6l2ps1272718491.ps tmp/6l2ps1272718491.png",intern=TRUE))
character(0)
> try(system("convert tmp/7ecov1272718491.ps tmp/7ecov1272718491.png",intern=TRUE))
character(0)
> try(system("convert tmp/8ecov1272718491.ps tmp/8ecov1272718491.png",intern=TRUE))
character(0)
> try(system("convert tmp/9ecov1272718491.ps tmp/9ecov1272718491.png",intern=TRUE))
character(0)
> try(system("convert tmp/10635g1272718491.ps tmp/10635g1272718491.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.93 2.32 4.59