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.65321251377534
+ ,0
+ ,0.81954393554187
+ ,1.6232492903979
+ ,3
+ ,1
+ ,3
+ ,2.1
+ ,1.83884909073726
+ ,3.40602894496362
+ ,3.66304097489397
+ ,2.79518458968242
+ ,3
+ ,5
+ ,4
+ ,9.1
+ ,1.43136376415899
+ ,1.02325245963371
+ ,2.25406445291434
+ ,2.25527250510331
+ ,4
+ ,4
+ ,4
+ ,15.8
+ ,1.27875360095283
+ ,-1.69897000433602
+ ,-0.52287874528034
+ ,1.54406804435028
+ ,1
+ ,1
+ ,1
+ ,5.2
+ ,1.48287358360875
+ ,2.20411998265592
+ ,2.22788670461367
+ ,2.59328606702046
+ ,4
+ ,5
+ ,4
+ ,10.9
+ ,1.44715803134222
+ ,0.51851393987789
+ ,1.40823996531185
+ ,1.79934054945358
+ ,1
+ ,2
+ ,1
+ ,8.3
+ ,1.69897000433602
+ ,1.71733758272386
+ ,2.64345267648619
+ ,2.36172783601759
+ ,1
+ ,1
+ ,1
+ ,11
+ ,0.84509804001426
+ ,-0.36653154442041
+ ,0.80617997398389
+ ,2.04921802267018
+ ,5
+ ,4
+ ,4
+ ,3.2
+ ,1.47712125471966
+ ,2.66745295288995
+ ,2.62634036737504
+ ,2.44870631990508
+ ,5
+ ,5
+ ,5
+ ,6.3
+ ,0.54406804435028
+ ,-1.09691001300806
+ ,0.079181246047625
+ ,1.6232492903979
+ ,1
+ ,1
+ ,1
+ ,6.6
+ ,0.77815125038364
+ ,-0.10237290870956
+ ,0.54406804435028
+ ,1.6232492903979
+ ,2
+ ,2
+ ,2
+ ,9.5
+ ,1.01703333929878
+ ,-0.69897000433602
+ ,0.69897000433602
+ ,2.07918124604762
+ ,2
+ ,2
+ ,2
+ ,3.3
+ ,1.30102999566398
+ ,1.44185217577329
+ ,2.06069784035361
+ ,2.17026171539496
+ ,5
+ ,5
+ ,5
+ ,11
+ ,0.5910646070265
+ ,-0.92081875395238
+ ,0
+ ,1.20411998265592
+ ,3
+ ,1
+ ,2
+ ,4.7
+ ,1.61278385671974
+ ,1.92941892571429
+ ,2.51188336097887
+ ,2.49136169383427
+ ,1
+ ,3
+ ,1
+ ,10.4
+ ,0.95424250943932
+ ,-1
+ ,0.60205999132796
+ ,1.44715803134222
+ ,5
+ ,1
+ ,3
+ ,7.4
+ ,0.88081359228079
+ ,0.01703333929878
+ ,0.74036268949424
+ ,1.83250891270624
+ ,5
+ ,3
+ ,4
+ ,2.1
+ ,1.66275783168157
+ ,2.71683772329952
+ ,2.81624129999178
+ ,2.52633927738984
+ ,5
+ ,5
+ ,5
+ ,17.9
+ ,1.38021124171161
+ ,-2
+ ,-0.60205999132796
+ ,1.69897000433602
+ ,1
+ ,1
+ ,1
+ ,6.1
+ ,2
+ ,1.79239168949825
+ ,3.12057393120585
+ ,2.42651126136458
+ ,1
+ ,1
+ ,1
+ ,11.9
+ ,0.50514997831991
+ ,-1.69897000433602
+ ,-0.39794000867204
+ ,1.27875360095283
+ ,4
+ ,1
+ ,3
+ ,13.8
+ ,0.69897000433602
+ ,0.23044892137827
+ ,0.79934054945358
+ ,1.07918124604762
+ ,2
+ ,1
+ ,1
+ ,14.3
+ ,0.81291335664286
+ ,0.54406804435028
+ ,1.03342375548695
+ ,2.07918124604762
+ ,2
+ ,1
+ ,1
+ ,15.2
+ ,1.07918124604762
+ ,-0.31875876262441
+ ,1.19033169817029
+ ,2.14612803567824
+ ,2
+ ,2
+ ,2
+ ,10
+ ,1.30535136944662
+ ,1
+ ,2.06069784035361
+ ,2.23044892137827
+ ,4
+ ,4
+ ,4
+ ,11.9
+ ,1.11394335230684
+ ,0.20951501454263
+ ,1.05690485133647
+ ,1.23044892137827
+ ,2
+ ,1
+ ,2
+ ,6.5
+ ,1.43136376415899
+ ,2.28330122870355
+ ,2.25527250510331
+ ,2.06069784035361
+ ,4
+ ,4
+ ,4
+ ,7.5
+ ,1.25527250510331
+ ,0.39794000867204
+ ,1.08278537031645
+ ,1.49136169383427
+ ,5
+ ,5
+ ,5
+ ,10.6
+ ,0.67209785793572
+ ,-0.55284196865778
+ ,0.27875360095283
+ ,1.32221929473392
+ ,3
+ ,1
+ ,3
+ ,7.4
+ ,0.99122607569249
+ ,0.62736585659273
+ ,1.70243053644553
+ ,1.7160033436348
+ ,1
+ ,1
+ ,1
+ ,8.4
+ ,1.46239799789896
+ ,0.83250891270624
+ ,2.25285303097989
+ ,2.2148438480477
+ ,2
+ ,3
+ ,2
+ ,5.7
+ ,0.84509804001426
+ ,-0.1249387366083
+ ,1.0899051114394
+ ,2.35218251811136
+ ,2
+ ,2
+ ,2
+ ,4.9
+ ,0.77815125038364
+ ,0.55630250076729
+ ,1.32221929473392
+ ,2.35218251811136
+ ,3
+ ,2
+ ,3
+ ,3.2
+ ,1.30102999566398
+ ,1.74429298312268
+ ,2.24303804868629
+ ,2.17897694729317
+ ,5
+ ,5
+ ,5
+ ,11
+ ,0.65321251377534
+ ,-0.045757490560675
+ ,0.41497334797082
+ ,1.77815125038364
+ ,2
+ ,1
+ ,2
+ ,4.9
+ ,0.8750612633917
+ ,0.30102999566398
+ ,1.0899051114394
+ ,2.30102999566398
+ ,3
+ ,1
+ ,3
+ ,13.2
+ ,0.36172783601759
+ ,-1
+ ,0.39794000867204
+ ,1.66275783168157
+ ,3
+ ,2
+ ,2
+ ,9.7
+ ,1.38021124171161
+ ,0.6222140229663
+ ,1.76342799356294
+ ,2.32221929473392
+ ,4
+ ,3
+ ,4
+ ,12.8
+ ,0.47712125471966
+ ,0.54406804435028
+ ,0.5910646070265
+ ,1.14612803567824
+ ,2
+ ,1
+ ,1)
+ ,dim=c(8
+ ,39)
+ ,dimnames=list(c('SWS'
+ ,'logL'
+ ,'logWb'
+ ,'logWbr'
+ ,'logtg'
+ ,'P'
+ ,'S'
+ ,'D')
+ ,1:39))
> y <- array(NA,dim=c(8,39),dimnames=list(c('SWS','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
> 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
SWS logL logWb logWbr logtg P S D
1 6.3 0.6532125 0.00000000 0.81954394 1.623249 3 1 3
2 2.1 1.8388491 3.40602894 3.66304097 2.795185 3 5 4
3 9.1 1.4313638 1.02325246 2.25406445 2.255273 4 4 4
4 15.8 1.2787536 -1.69897000 -0.52287875 1.544068 1 1 1
5 5.2 1.4828736 2.20411998 2.22788670 2.593286 4 5 4
6 10.9 1.4471580 0.51851394 1.40823997 1.799341 1 2 1
7 8.3 1.6989700 1.71733758 2.64345268 2.361728 1 1 1
8 11.0 0.8450980 -0.36653154 0.80617997 2.049218 5 4 4
9 3.2 1.4771213 2.66745295 2.62634037 2.448706 5 5 5
10 6.3 0.5440680 -1.09691001 0.07918125 1.623249 1 1 1
11 6.6 0.7781513 -0.10237291 0.54406804 1.623249 2 2 2
12 9.5 1.0170333 -0.69897000 0.69897000 2.079181 2 2 2
13 3.3 1.3010300 1.44185218 2.06069784 2.170262 5 5 5
14 11.0 0.5910646 -0.92081875 0.00000000 1.204120 3 1 2
15 4.7 1.6127839 1.92941893 2.51188336 2.491362 1 3 1
16 10.4 0.9542425 -1.00000000 0.60205999 1.447158 5 1 3
17 7.4 0.8808136 0.01703334 0.74036269 1.832509 5 3 4
18 2.1 1.6627578 2.71683772 2.81624130 2.526339 5 5 5
19 17.9 1.3802112 -2.00000000 -0.60205999 1.698970 1 1 1
20 6.1 2.0000000 1.79239169 3.12057393 2.426511 1 1 1
21 11.9 0.5051500 -1.69897000 -0.39794001 1.278754 4 1 3
22 13.8 0.6989700 0.23044892 0.79934055 1.079181 2 1 1
23 14.3 0.8129134 0.54406804 1.03342376 2.079181 2 1 1
24 15.2 1.0791812 -0.31875876 1.19033170 2.146128 2 2 2
25 10.0 1.3053514 1.00000000 2.06069784 2.230449 4 4 4
26 11.9 1.1139434 0.20951501 1.05690485 1.230449 2 1 2
27 6.5 1.4313638 2.28330123 2.25527251 2.060698 4 4 4
28 7.5 1.2552725 0.39794001 1.08278537 1.491362 5 5 5
29 10.6 0.6720979 -0.55284197 0.27875360 1.322219 3 1 3
30 7.4 0.9912261 0.62736586 1.70243054 1.716003 1 1 1
31 8.4 1.4623980 0.83250891 2.25285303 2.214844 2 3 2
32 5.7 0.8450980 -0.12493874 1.08990511 2.352183 2 2 2
33 4.9 0.7781513 0.55630250 1.32221929 2.352183 3 2 3
34 3.2 1.3010300 1.74429298 2.24303805 2.178977 5 5 5
35 11.0 0.6532125 -0.04575749 0.41497335 1.778151 2 1 2
36 4.9 0.8750613 0.30103000 1.08990511 2.301030 3 1 3
37 13.2 0.3617278 -1.00000000 0.39794001 1.662758 3 2 2
38 9.7 1.3802112 0.62221402 1.76342799 2.322219 4 3 4
39 12.8 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
11.5070 3.6254 -1.2048 -1.2178 -1.6649 1.6430
S D
0.4987 -2.7673
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-5.0765 -1.4169 -0.2224 1.6964 5.6702
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 11.5070 2.8615 4.021 0.000344 ***
logL 3.6254 1.7915 2.024 0.051697 .
logWb -1.2048 1.0996 -1.096 0.281666
logWbr -1.2178 1.6112 -0.756 0.455460
logtg -1.6649 1.5810 -1.053 0.300453
P 1.6430 0.9677 1.698 0.099560 .
S 0.4987 0.6141 0.812 0.422965
D -2.7673 1.1414 -2.424 0.021357 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.525 on 31 degrees of freedom
Multiple R-squared: 0.6696, Adjusted R-squared: 0.595
F-statistic: 8.974 on 7 and 31 DF, p-value: 5.154e-06
> 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.05401264 0.10802529 0.9459874
[2,] 0.01583695 0.03167389 0.9841631
[3,] 0.10837470 0.21674939 0.8916253
[4,] 0.05636362 0.11272723 0.9436364
[5,] 0.06599113 0.13198227 0.9340089
[6,] 0.21328086 0.42656172 0.7867191
[7,] 0.16326821 0.32653642 0.8367318
[8,] 0.13881951 0.27763901 0.8611805
[9,] 0.09105070 0.18210139 0.9089493
[10,] 0.11924062 0.23848123 0.8807594
[11,] 0.14217485 0.28434969 0.8578252
[12,] 0.25943999 0.51887998 0.7405600
[13,] 0.41155989 0.82311979 0.5884401
[14,] 0.73538488 0.52923023 0.2646151
[15,] 0.88037300 0.23925400 0.1196270
[16,] 0.80312864 0.39374272 0.1968714
[17,] 0.70565747 0.58868505 0.2943425
[18,] 0.70498625 0.59002750 0.2950138
> postscript(file="/var/www/html/rcomp/tmp/1ugsh1272716101.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/2ugsh1272716101.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/3ugsh1272716101.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/4nprk1272716101.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/5nprk1272716101.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
-1.000673776 0.790980047 2.638433624 0.169544268 0.006597952 -0.391356944
7 8 9 10 11 12
0.479229791 1.240181001 -0.045595674 -5.076543563 -3.235300210 -0.972413389
13 14 15 16 17 18
-1.936184758 -1.647837422 -3.494500705 -3.040936795 -1.969482971 -1.398600502
19 20 21 22 23 24
1.700506500 -2.032817444 -0.610009407 1.789204528 4.203892518 5.670181106
25 26 27 28 29 30
3.690459571 1.692286101 1.234049906 -1.149160471 1.405056145 -1.389096612
31 32 33 34 35 36
-0.222431989 -2.526900231 -0.856321840 -1.435246439 2.285198992 -1.384631242
37 38 39
2.037740025 2.953334946 1.829165366
> postscript(file="/var/www/html/rcomp/tmp/6nprk1272716101.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 -1.000673776 NA
1 0.790980047 -1.000673776
2 2.638433624 0.790980047
3 0.169544268 2.638433624
4 0.006597952 0.169544268
5 -0.391356944 0.006597952
6 0.479229791 -0.391356944
7 1.240181001 0.479229791
8 -0.045595674 1.240181001
9 -5.076543563 -0.045595674
10 -3.235300210 -5.076543563
11 -0.972413389 -3.235300210
12 -1.936184758 -0.972413389
13 -1.647837422 -1.936184758
14 -3.494500705 -1.647837422
15 -3.040936795 -3.494500705
16 -1.969482971 -3.040936795
17 -1.398600502 -1.969482971
18 1.700506500 -1.398600502
19 -2.032817444 1.700506500
20 -0.610009407 -2.032817444
21 1.789204528 -0.610009407
22 4.203892518 1.789204528
23 5.670181106 4.203892518
24 3.690459571 5.670181106
25 1.692286101 3.690459571
26 1.234049906 1.692286101
27 -1.149160471 1.234049906
28 1.405056145 -1.149160471
29 -1.389096612 1.405056145
30 -0.222431989 -1.389096612
31 -2.526900231 -0.222431989
32 -0.856321840 -2.526900231
33 -1.435246439 -0.856321840
34 2.285198992 -1.435246439
35 -1.384631242 2.285198992
36 2.037740025 -1.384631242
37 2.953334946 2.037740025
38 1.829165366 2.953334946
39 NA 1.829165366
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.790980047 -1.000673776
[2,] 2.638433624 0.790980047
[3,] 0.169544268 2.638433624
[4,] 0.006597952 0.169544268
[5,] -0.391356944 0.006597952
[6,] 0.479229791 -0.391356944
[7,] 1.240181001 0.479229791
[8,] -0.045595674 1.240181001
[9,] -5.076543563 -0.045595674
[10,] -3.235300210 -5.076543563
[11,] -0.972413389 -3.235300210
[12,] -1.936184758 -0.972413389
[13,] -1.647837422 -1.936184758
[14,] -3.494500705 -1.647837422
[15,] -3.040936795 -3.494500705
[16,] -1.969482971 -3.040936795
[17,] -1.398600502 -1.969482971
[18,] 1.700506500 -1.398600502
[19,] -2.032817444 1.700506500
[20,] -0.610009407 -2.032817444
[21,] 1.789204528 -0.610009407
[22,] 4.203892518 1.789204528
[23,] 5.670181106 4.203892518
[24,] 3.690459571 5.670181106
[25,] 1.692286101 3.690459571
[26,] 1.234049906 1.692286101
[27,] -1.149160471 1.234049906
[28,] 1.405056145 -1.149160471
[29,] -1.389096612 1.405056145
[30,] -0.222431989 -1.389096612
[31,] -2.526900231 -0.222431989
[32,] -0.856321840 -2.526900231
[33,] -1.435246439 -0.856321840
[34,] 2.285198992 -1.435246439
[35,] -1.384631242 2.285198992
[36,] 2.037740025 -1.384631242
[37,] 2.953334946 2.037740025
[38,] 1.829165366 2.953334946
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.790980047 -1.000673776
2 2.638433624 0.790980047
3 0.169544268 2.638433624
4 0.006597952 0.169544268
5 -0.391356944 0.006597952
6 0.479229791 -0.391356944
7 1.240181001 0.479229791
8 -0.045595674 1.240181001
9 -5.076543563 -0.045595674
10 -3.235300210 -5.076543563
11 -0.972413389 -3.235300210
12 -1.936184758 -0.972413389
13 -1.647837422 -1.936184758
14 -3.494500705 -1.647837422
15 -3.040936795 -3.494500705
16 -1.969482971 -3.040936795
17 -1.398600502 -1.969482971
18 1.700506500 -1.398600502
19 -2.032817444 1.700506500
20 -0.610009407 -2.032817444
21 1.789204528 -0.610009407
22 4.203892518 1.789204528
23 5.670181106 4.203892518
24 3.690459571 5.670181106
25 1.692286101 3.690459571
26 1.234049906 1.692286101
27 -1.149160471 1.234049906
28 1.405056145 -1.149160471
29 -1.389096612 1.405056145
30 -0.222431989 -1.389096612
31 -2.526900231 -0.222431989
32 -0.856321840 -2.526900231
33 -1.435246439 -0.856321840
34 2.285198992 -1.435246439
35 -1.384631242 2.285198992
36 2.037740025 -1.384631242
37 2.953334946 2.037740025
38 1.829165366 2.953334946
> 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/7xyr51272716101.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/8xyr51272716101.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/98p881272716101.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/108p881272716101.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/11mzoh1272716101.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/12x85j1272716101.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/13mrkv1272716101.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/14paj11272716101.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/15tth71272716101.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/16p2fy1272716101.tab")
+ }
> try(system("convert tmp/1ugsh1272716101.ps tmp/1ugsh1272716101.png",intern=TRUE))
character(0)
> try(system("convert tmp/2ugsh1272716101.ps tmp/2ugsh1272716101.png",intern=TRUE))
character(0)
> try(system("convert tmp/3ugsh1272716101.ps tmp/3ugsh1272716101.png",intern=TRUE))
character(0)
> try(system("convert tmp/4nprk1272716101.ps tmp/4nprk1272716101.png",intern=TRUE))
character(0)
> try(system("convert tmp/5nprk1272716101.ps tmp/5nprk1272716101.png",intern=TRUE))
character(0)
> try(system("convert tmp/6nprk1272716101.ps tmp/6nprk1272716101.png",intern=TRUE))
character(0)
> try(system("convert tmp/7xyr51272716101.ps tmp/7xyr51272716101.png",intern=TRUE))
character(0)
> try(system("convert tmp/8xyr51272716101.ps tmp/8xyr51272716101.png",intern=TRUE))
character(0)
> try(system("convert tmp/98p881272716101.ps tmp/98p881272716101.png",intern=TRUE))
character(0)
> try(system("convert tmp/108p881272716101.ps tmp/108p881272716101.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.306 1.576 3.054