R version 2.12.0 (2010-10-15)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-pc-linux-gnu (32-bit)
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
+ ,3
+ ,1.6232492903979
+ ,0.25527250510331
+ ,4
+ ,2.79518458968242
+ ,-0.15490195998574
+ ,4
+ ,2.25527250510331
+ ,0.5910646070265
+ ,1
+ ,1.54406804435028
+ ,0
+ ,4
+ ,2.59328606702046
+ ,0.55630250076729
+ ,1
+ ,1.79934054945358
+ ,0.14612803567824
+ ,1
+ ,2.36172783601759
+ ,0.17609125905568
+ ,4
+ ,2.04921802267018
+ ,-0.15490195998574
+ ,5
+ ,2.44870631990508
+ ,0.32221929473392
+ ,1
+ ,1.6232492903979
+ ,0.61278385671974
+ ,2
+ ,1.6232492903979
+ ,0.07918124604762
+ ,2
+ ,2.07918124604762
+ ,-0.52287874528034
+ ,5
+ ,2.60205999132796
+ ,-0.30102999566398
+ ,5
+ ,2.17026171539496
+ ,0.53147891704226
+ ,2
+ ,1.20411998265592
+ ,0.17609125905568
+ ,1
+ ,2.49136169383427
+ ,0.53147891704226
+ ,3
+ ,1.44715803134222
+ ,-0.09691001300806
+ ,4
+ ,1.83250891270624
+ ,-0.09691001300806
+ ,5
+ ,2.52633927738984
+ ,0.14612803567824
+ ,4
+ ,1.33243845991561
+ ,0.30102999566398
+ ,1
+ ,1.69897000433602
+ ,0.27875360095283
+ ,1
+ ,2.42651126136457
+ ,0.38021124171161
+ ,1
+ ,1.47712125471966
+ ,0.44715803134222
+ ,3
+ ,1.65321251377534
+ ,0.11394335230684
+ ,3
+ ,1.27875360095283
+ ,0.30102999566398
+ ,3
+ ,1.47712125471966
+ ,0.7481880270062
+ ,1
+ ,1.07918124604762
+ ,0.49136169383427
+ ,1
+ ,2.07918124604762
+ ,0
+ ,5
+ ,2.64345267648619
+ ,0.25527250510331
+ ,2
+ ,2.14612803567824
+ ,-0.04575749056068
+ ,4
+ ,2.23044892137827
+ ,0.25527250510331
+ ,2
+ ,1.23044892137827
+ ,0.27875360095283
+ ,4
+ ,2.06069784035361
+ ,-0.04575749056068
+ ,5
+ ,1.49136169383427
+ ,0.41497334797082
+ ,3
+ ,1.32221929473392
+ ,0.38021124171161
+ ,1
+ ,1.7160033436348
+ ,0.07918124604762
+ ,2
+ ,2.2148438480477
+ ,-0.04575749056068
+ ,2
+ ,2.35218251811136
+ ,-0.30102999566398
+ ,3
+ ,2.35218251811136
+ ,-0.22184874961636
+ ,5
+ ,2.17897694729317
+ ,0.36172783601759
+ ,2
+ ,1.77815125038364
+ ,-0.30102999566398
+ ,3
+ ,2.30102999566398
+ ,0.41497334797082
+ ,2
+ ,1.66275783168157
+ ,-0.22184874961636
+ ,4
+ ,2.32221929473392
+ ,0.81954393554187
+ ,1
+ ,1.14612803567824)
+ ,dim=c(3
+ ,60)
+ ,dimnames=list(c('log(ps)'
+ ,'D'
+ ,'log(tg)')
+ ,1:60))
> y <- array(NA,dim=c(3,60),dimnames=list(c('log(ps)','D','log(tg)'),1:60))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = '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
> 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
log(ps) D log(tg)
1 0.30103000 3 1.623249
2 0.25527251 4 2.795185
3 -0.15490196 4 2.255273
4 0.59106461 1 1.544068
5 0.00000000 4 2.593286
6 0.55630250 1 1.799341
7 0.14612804 1 2.361728
8 0.17609126 4 2.049218
9 -0.15490196 5 2.448706
10 0.32221929 1 1.623249
11 0.61278386 2 1.623249
12 0.07918125 2 2.079181
13 -0.52287875 5 2.602060
14 -0.30103000 5 2.170262
15 0.53147892 2 1.204120
16 0.17609126 1 2.491362
17 0.53147892 3 1.447158
18 -0.09691001 4 1.832509
19 -0.09691001 5 2.526339
20 0.14612804 4 1.332438
21 0.30103000 1 1.698970
22 0.27875360 1 2.426511
23 0.38021124 1 1.477121
24 0.44715803 3 1.653213
25 0.11394335 3 1.278754
26 0.30103000 3 1.477121
27 0.74818803 1 1.079181
28 0.49136169 1 2.079181
29 0.00000000 5 2.643453
30 0.25527251 2 2.146128
31 -0.04575749 4 2.230449
32 0.25527251 2 1.230449
33 0.27875360 4 2.060698
34 -0.04575749 5 1.491362
35 0.41497335 3 1.322219
36 0.38021124 1 1.716003
37 0.07918125 2 2.214844
38 -0.04575749 2 2.352183
39 -0.30103000 3 2.352183
40 -0.22184875 5 2.178977
41 0.36172784 2 1.778151
42 -0.30103000 3 2.301030
43 0.41497335 2 1.662758
44 -0.22184875 4 2.322219
45 0.81954394 1 1.146128
46 0.30103000 3 1.623249
47 0.25527251 4 2.795185
48 -0.15490196 4 2.255273
49 0.59106461 1 1.544068
50 0.00000000 4 2.593286
51 0.55630250 1 1.799341
52 0.14612804 1 2.361728
53 0.17609126 4 2.049218
54 -0.15490196 5 2.448706
55 0.32221929 1 1.623249
56 0.61278386 2 1.623249
57 0.07918125 2 2.079181
58 -0.52287875 5 2.602060
59 -0.30103000 5 2.170262
60 0.53147892 2 1.204120
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) D `log(tg)`
1.0556 -0.1111 -0.2884
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.35970 -0.15369 0.03741 0.13093 0.45024
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.05564 0.10260 10.289 1.31e-14 ***
D -0.11113 0.01832 -6.067 1.12e-07 ***
`log(tg)` -0.28839 0.05729 -5.034 5.13e-06 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.1837 on 57 degrees of freedom
Multiple R-squared: 0.6661, Adjusted R-squared: 0.6544
F-statistic: 56.86 on 2 and 57 DF, p-value: 2.648e-14
> 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.5499533 0.9000933 0.4500467
[2,] 0.7732935 0.4534129 0.2267065
[3,] 0.6676202 0.6647597 0.3323798
[4,] 0.5806279 0.8387442 0.4193721
[5,] 0.5366955 0.9266091 0.4633045
[6,] 0.5959995 0.8080009 0.4040005
[7,] 0.6063425 0.7873151 0.3936575
[8,] 0.8015824 0.3968353 0.1984176
[9,] 0.7969667 0.4060667 0.2030333
[10,] 0.7282905 0.5434191 0.2717095
[11,] 0.6600062 0.6799876 0.3399938
[12,] 0.6648856 0.6702289 0.3351144
[13,] 0.6718216 0.6563569 0.3281784
[14,] 0.6259491 0.7481018 0.3740509
[15,] 0.5635452 0.8729097 0.4364548
[16,] 0.5395888 0.9208223 0.4604112
[17,] 0.4593463 0.9186927 0.5406537
[18,] 0.4194076 0.8388152 0.5805924
[19,] 0.4284199 0.8568398 0.5715801
[20,] 0.4726714 0.9453427 0.5273286
[21,] 0.3952935 0.7905870 0.6047065
[22,] 0.3526198 0.7052395 0.6473802
[23,] 0.3229418 0.6458836 0.6770582
[24,] 0.3861629 0.7723258 0.6138371
[25,] 0.3191677 0.6383355 0.6808323
[26,] 0.2559413 0.5118827 0.7440587
[27,] 0.2912071 0.5824143 0.7087929
[28,] 0.3624482 0.7248965 0.6375518
[29,] 0.3298122 0.6596243 0.6701878
[30,] 0.2709592 0.5419185 0.7290408
[31,] 0.2178205 0.4356411 0.7821795
[32,] 0.1817884 0.3635768 0.8182116
[33,] 0.1814038 0.3628077 0.8185962
[34,] 0.3148586 0.6297172 0.6851414
[35,] 0.2597819 0.5195638 0.7402181
[36,] 0.1986494 0.3972989 0.8013506
[37,] 0.3771279 0.7542558 0.6228721
[38,] 0.3016355 0.6032710 0.6983645
[39,] 0.2838819 0.5677638 0.7161181
[40,] 0.2717095 0.5434191 0.7282905
[41,] 0.2027713 0.4055426 0.7972287
[42,] 0.6728306 0.6543388 0.3271694
[43,] 0.5975922 0.8048155 0.4024078
[44,] 0.4981182 0.9962365 0.5018818
[45,] 0.5560202 0.8879596 0.4439798
[46,] 0.5123495 0.9753010 0.4876505
[47,] 0.4091815 0.8183629 0.5908185
[48,] 0.4008395 0.8016790 0.5991605
[49,] 0.4449982 0.8899963 0.5550018
> postscript(file="/var/www/rcomp/tmp/1ti411293050274.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/rcomp/tmp/2ti411293050274.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/rcomp/tmp/3l9l31293050274.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/rcomp/tmp/4l9l31293050274.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/rcomp/tmp/5l9l31293050274.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 = 60
Frequency = 1
1 2 3 4 5 6
0.046900013 0.450243219 -0.115634421 0.091838304 0.136745974 0.130693256
7 8 9 10 11 12
-0.117296498 0.155935537 0.051279987 -0.154172233 0.247523102 -0.154595042
13 14 15 16 17 18
-0.272471721 -0.175147619 0.045347069 -0.049948663 0.226566652 -0.179561644
19 20 21 22 23 24
0.131660205 -0.080736994 -0.153524726 0.034011711 -0.138321589 0.201669028
25 26 27 28 29 30
-0.239534421 0.004758709 0.114894804 0.146454634 0.262344102 0.040802745
31 32 33 34 35 36
-0.013648729 -0.223266441 0.261908499 -0.115660487 0.074030480 -0.069431300
37 38 39 40 41 42
-0.115471825 -0.200803989 -0.344945722 -0.093453021 0.041138663 -0.359697401
43 44 45 46 47 48
0.061106309 -0.163274682 0.205557240 0.046900013 0.450243219 -0.115634421
49 50 51 52 53 54
0.091838304 0.136745974 0.130693256 -0.117296498 0.155935537 0.051279987
55 56 57 58 59 60
-0.154172233 0.247523102 -0.154595042 -0.272471721 -0.175147619 0.045347069
> postscript(file="/var/www/rcomp/tmp/6e0261293050274.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 = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 0.046900013 NA
1 0.450243219 0.046900013
2 -0.115634421 0.450243219
3 0.091838304 -0.115634421
4 0.136745974 0.091838304
5 0.130693256 0.136745974
6 -0.117296498 0.130693256
7 0.155935537 -0.117296498
8 0.051279987 0.155935537
9 -0.154172233 0.051279987
10 0.247523102 -0.154172233
11 -0.154595042 0.247523102
12 -0.272471721 -0.154595042
13 -0.175147619 -0.272471721
14 0.045347069 -0.175147619
15 -0.049948663 0.045347069
16 0.226566652 -0.049948663
17 -0.179561644 0.226566652
18 0.131660205 -0.179561644
19 -0.080736994 0.131660205
20 -0.153524726 -0.080736994
21 0.034011711 -0.153524726
22 -0.138321589 0.034011711
23 0.201669028 -0.138321589
24 -0.239534421 0.201669028
25 0.004758709 -0.239534421
26 0.114894804 0.004758709
27 0.146454634 0.114894804
28 0.262344102 0.146454634
29 0.040802745 0.262344102
30 -0.013648729 0.040802745
31 -0.223266441 -0.013648729
32 0.261908499 -0.223266441
33 -0.115660487 0.261908499
34 0.074030480 -0.115660487
35 -0.069431300 0.074030480
36 -0.115471825 -0.069431300
37 -0.200803989 -0.115471825
38 -0.344945722 -0.200803989
39 -0.093453021 -0.344945722
40 0.041138663 -0.093453021
41 -0.359697401 0.041138663
42 0.061106309 -0.359697401
43 -0.163274682 0.061106309
44 0.205557240 -0.163274682
45 0.046900013 0.205557240
46 0.450243219 0.046900013
47 -0.115634421 0.450243219
48 0.091838304 -0.115634421
49 0.136745974 0.091838304
50 0.130693256 0.136745974
51 -0.117296498 0.130693256
52 0.155935537 -0.117296498
53 0.051279987 0.155935537
54 -0.154172233 0.051279987
55 0.247523102 -0.154172233
56 -0.154595042 0.247523102
57 -0.272471721 -0.154595042
58 -0.175147619 -0.272471721
59 0.045347069 -0.175147619
60 NA 0.045347069
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.450243219 0.046900013
[2,] -0.115634421 0.450243219
[3,] 0.091838304 -0.115634421
[4,] 0.136745974 0.091838304
[5,] 0.130693256 0.136745974
[6,] -0.117296498 0.130693256
[7,] 0.155935537 -0.117296498
[8,] 0.051279987 0.155935537
[9,] -0.154172233 0.051279987
[10,] 0.247523102 -0.154172233
[11,] -0.154595042 0.247523102
[12,] -0.272471721 -0.154595042
[13,] -0.175147619 -0.272471721
[14,] 0.045347069 -0.175147619
[15,] -0.049948663 0.045347069
[16,] 0.226566652 -0.049948663
[17,] -0.179561644 0.226566652
[18,] 0.131660205 -0.179561644
[19,] -0.080736994 0.131660205
[20,] -0.153524726 -0.080736994
[21,] 0.034011711 -0.153524726
[22,] -0.138321589 0.034011711
[23,] 0.201669028 -0.138321589
[24,] -0.239534421 0.201669028
[25,] 0.004758709 -0.239534421
[26,] 0.114894804 0.004758709
[27,] 0.146454634 0.114894804
[28,] 0.262344102 0.146454634
[29,] 0.040802745 0.262344102
[30,] -0.013648729 0.040802745
[31,] -0.223266441 -0.013648729
[32,] 0.261908499 -0.223266441
[33,] -0.115660487 0.261908499
[34,] 0.074030480 -0.115660487
[35,] -0.069431300 0.074030480
[36,] -0.115471825 -0.069431300
[37,] -0.200803989 -0.115471825
[38,] -0.344945722 -0.200803989
[39,] -0.093453021 -0.344945722
[40,] 0.041138663 -0.093453021
[41,] -0.359697401 0.041138663
[42,] 0.061106309 -0.359697401
[43,] -0.163274682 0.061106309
[44,] 0.205557240 -0.163274682
[45,] 0.046900013 0.205557240
[46,] 0.450243219 0.046900013
[47,] -0.115634421 0.450243219
[48,] 0.091838304 -0.115634421
[49,] 0.136745974 0.091838304
[50,] 0.130693256 0.136745974
[51,] -0.117296498 0.130693256
[52,] 0.155935537 -0.117296498
[53,] 0.051279987 0.155935537
[54,] -0.154172233 0.051279987
[55,] 0.247523102 -0.154172233
[56,] -0.154595042 0.247523102
[57,] -0.272471721 -0.154595042
[58,] -0.175147619 -0.272471721
[59,] 0.045347069 -0.175147619
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.450243219 0.046900013
2 -0.115634421 0.450243219
3 0.091838304 -0.115634421
4 0.136745974 0.091838304
5 0.130693256 0.136745974
6 -0.117296498 0.130693256
7 0.155935537 -0.117296498
8 0.051279987 0.155935537
9 -0.154172233 0.051279987
10 0.247523102 -0.154172233
11 -0.154595042 0.247523102
12 -0.272471721 -0.154595042
13 -0.175147619 -0.272471721
14 0.045347069 -0.175147619
15 -0.049948663 0.045347069
16 0.226566652 -0.049948663
17 -0.179561644 0.226566652
18 0.131660205 -0.179561644
19 -0.080736994 0.131660205
20 -0.153524726 -0.080736994
21 0.034011711 -0.153524726
22 -0.138321589 0.034011711
23 0.201669028 -0.138321589
24 -0.239534421 0.201669028
25 0.004758709 -0.239534421
26 0.114894804 0.004758709
27 0.146454634 0.114894804
28 0.262344102 0.146454634
29 0.040802745 0.262344102
30 -0.013648729 0.040802745
31 -0.223266441 -0.013648729
32 0.261908499 -0.223266441
33 -0.115660487 0.261908499
34 0.074030480 -0.115660487
35 -0.069431300 0.074030480
36 -0.115471825 -0.069431300
37 -0.200803989 -0.115471825
38 -0.344945722 -0.200803989
39 -0.093453021 -0.344945722
40 0.041138663 -0.093453021
41 -0.359697401 0.041138663
42 0.061106309 -0.359697401
43 -0.163274682 0.061106309
44 0.205557240 -0.163274682
45 0.046900013 0.205557240
46 0.450243219 0.046900013
47 -0.115634421 0.450243219
48 0.091838304 -0.115634421
49 0.136745974 0.091838304
50 0.130693256 0.136745974
51 -0.117296498 0.130693256
52 0.155935537 -0.117296498
53 0.051279987 0.155935537
54 -0.154172233 0.051279987
55 0.247523102 -0.154172233
56 -0.154595042 0.247523102
57 -0.272471721 -0.154595042
58 -0.175147619 -0.272471721
59 0.045347069 -0.175147619
> 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/7prj91293050274.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/rcomp/tmp/8prj91293050274.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/rcomp/tmp/9prj91293050274.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/rcomp/tmp/10zi0c1293050274.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/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/11ljhi1293050274.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/12okyo1293050274.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/13kbdx1293050274.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/14v3vi1293050274.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/15y3tn1293050274.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/16cvrw1293050274.tab")
+ }
>
> try(system("convert tmp/1ti411293050274.ps tmp/1ti411293050274.png",intern=TRUE))
character(0)
> try(system("convert tmp/2ti411293050274.ps tmp/2ti411293050274.png",intern=TRUE))
character(0)
> try(system("convert tmp/3l9l31293050274.ps tmp/3l9l31293050274.png",intern=TRUE))
character(0)
> try(system("convert tmp/4l9l31293050274.ps tmp/4l9l31293050274.png",intern=TRUE))
character(0)
> try(system("convert tmp/5l9l31293050274.ps tmp/5l9l31293050274.png",intern=TRUE))
character(0)
> try(system("convert tmp/6e0261293050274.ps tmp/6e0261293050274.png",intern=TRUE))
character(0)
> try(system("convert tmp/7prj91293050274.ps tmp/7prj91293050274.png",intern=TRUE))
character(0)
> try(system("convert tmp/8prj91293050274.ps tmp/8prj91293050274.png",intern=TRUE))
character(0)
> try(system("convert tmp/9prj91293050274.ps tmp/9prj91293050274.png",intern=TRUE))
character(0)
> try(system("convert tmp/10zi0c1293050274.ps tmp/10zi0c1293050274.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.100 1.300 4.407