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.30000000
+ ,0.30103000
+ ,0.65321251
+ ,0.00000000
+ ,0.81954394
+ ,1.62324929
+ ,3
+ ,1
+ ,3
+ ,2.10000000
+ ,0.25527251
+ ,1.83884909
+ ,3.40602894
+ ,3.66304097
+ ,2.79518459
+ ,3
+ ,5
+ ,4
+ ,9.10000000
+ ,-0.15490196
+ ,1.43136376
+ ,1.02325246
+ ,2.25406445
+ ,2.25527251
+ ,4
+ ,4
+ ,4
+ ,15.80000000
+ ,0.59106461
+ ,1.27875360
+ ,-1.63827216
+ ,-0.52287875
+ ,1.54406804
+ ,1
+ ,1
+ ,1
+ ,5.20000000
+ ,0.00000000
+ ,1.48287358
+ ,2.20411998
+ ,2.22788670
+ ,2.59328607
+ ,4
+ ,5
+ ,4
+ ,10.90000000
+ ,0.55630250
+ ,1.44715803
+ ,0.51851394
+ ,1.40823997
+ ,1.79934055
+ ,1
+ ,2
+ ,1
+ ,8.30000000
+ ,0.14612804
+ ,1.69897000
+ ,1.71733758
+ ,2.64345268
+ ,2.36172784
+ ,1
+ ,1
+ ,1
+ ,11.00000000
+ ,0.17609126
+ ,0.84509804
+ ,-0.37161107
+ ,0.80617997
+ ,2.04921802
+ ,5
+ ,4
+ ,4
+ ,3.20000000
+ ,-0.15490196
+ ,1.47712125
+ ,2.66745295
+ ,2.62634037
+ ,2.44870632
+ ,5
+ ,5
+ ,5
+ ,6.30000000
+ ,0.32221929
+ ,0.54406804
+ ,-1.12493874
+ ,0.07918125
+ ,1.62324929
+ ,1
+ ,1
+ ,1
+ ,6.60000000
+ ,0.61278386
+ ,0.77815125
+ ,-0.10513034
+ ,0.54406804
+ ,1.62324929
+ ,2
+ ,2
+ ,2
+ ,9.50000000
+ ,0.07918125
+ ,1.01703334
+ ,-0.69897000
+ ,0.69897000
+ ,2.07918125
+ ,2
+ ,2
+ ,2
+ ,3.30000000
+ ,-0.30103000
+ ,1.30103000
+ ,1.44185218
+ ,2.06069784
+ ,2.17026172
+ ,5
+ ,5
+ ,5
+ ,11.00000000
+ ,0.53147892
+ ,0.59106461
+ ,-0.92081875
+ ,0.00000000
+ ,1.20411998
+ ,3
+ ,1
+ ,2
+ ,4.70000000
+ ,0.17609126
+ ,1.61278386
+ ,1.92941893
+ ,2.51188336
+ ,2.49136169
+ ,1
+ ,3
+ ,1
+ ,10.40000000
+ ,0.53147892
+ ,0.95424251
+ ,-0.99567863
+ ,0.60205999
+ ,1.44715803
+ ,5
+ ,1
+ ,3
+ ,7.40000000
+ ,-0.09691001
+ ,0.88081359
+ ,0.01703334
+ ,0.74036269
+ ,1.83250891
+ ,5
+ ,3
+ ,4
+ ,2.10000000
+ ,-0.09691001
+ ,1.66275783
+ ,2.71683772
+ ,2.81624130
+ ,2.52633928
+ ,5
+ ,5
+ ,5
+ ,17.90000000
+ ,0.30103000
+ ,1.38021124
+ ,-2.00000000
+ ,-0.60205999
+ ,1.69897000
+ ,1
+ ,1
+ ,1
+ ,6.10000000
+ ,0.27875360
+ ,2.00000000
+ ,1.79239169
+ ,3.12057393
+ ,2.42651126
+ ,1
+ ,1
+ ,1
+ ,11.90000000
+ ,0.11394335
+ ,0.50514998
+ ,-1.63827216
+ ,-0.39794001
+ ,1.27875360
+ ,4
+ ,1
+ ,3
+ ,13.80000000
+ ,0.74818803
+ ,0.69897000
+ ,0.23044892
+ ,0.79934055
+ ,1.07918125
+ ,2
+ ,1
+ ,1
+ ,14.30000000
+ ,0.49136169
+ ,0.81291336
+ ,0.54406804
+ ,1.03342376
+ ,2.07918125
+ ,2
+ ,1
+ ,1
+ ,15.20000000
+ ,0.25527251
+ ,1.07918125
+ ,-0.31875876
+ ,1.19033170
+ ,2.14612804
+ ,2
+ ,2
+ ,2
+ ,10.00000000
+ ,-0.04575749
+ ,1.30535137
+ ,1.00000000
+ ,2.06069784
+ ,2.23044892
+ ,4
+ ,4
+ ,4
+ ,11.90000000
+ ,0.25527251
+ ,1.11394335
+ ,0.20951501
+ ,1.05690485
+ ,1.23044892
+ ,2
+ ,1
+ ,2
+ ,6.50000000
+ ,0.27875360
+ ,1.43136376
+ ,2.28330123
+ ,2.25527251
+ ,2.06069784
+ ,4
+ ,4
+ ,4
+ ,7.50000000
+ ,-0.04575749
+ ,1.25527251
+ ,0.39794001
+ ,1.08278537
+ ,1.49136169
+ ,5
+ ,5
+ ,5
+ ,10.60000000
+ ,0.41497335
+ ,0.67209786
+ ,-0.55284197
+ ,0.27875360
+ ,1.32221929
+ ,3
+ ,1
+ ,3
+ ,7.40000000
+ ,0.38021124
+ ,0.99122608
+ ,0.62685341
+ ,1.70243054
+ ,1.71600334
+ ,1
+ ,1
+ ,1
+ ,8.40000000
+ ,0.07918125
+ ,1.46239800
+ ,0.83250891
+ ,2.25285303
+ ,2.21484385
+ ,2
+ ,3
+ ,2
+ ,5.70000000
+ ,-0.04575749
+ ,0.84509804
+ ,-0.12493874
+ ,1.08990511
+ ,2.35218252
+ ,2
+ ,2
+ ,2
+ ,4.90000000
+ ,-0.30103000
+ ,0.77815125
+ ,0.55630250
+ ,1.32221929
+ ,2.35218252
+ ,3
+ ,2
+ ,3
+ ,3.20000000
+ ,-0.22184875
+ ,1.30103000
+ ,1.74429298
+ ,2.24303805
+ ,2.17897695
+ ,5
+ ,5
+ ,5
+ ,11.00000000
+ ,0.36172784
+ ,0.65321251
+ ,-0.04575749
+ ,0.41497335
+ ,1.77815125
+ ,2
+ ,1
+ ,2
+ ,4.90000000
+ ,-0.30103000
+ ,0.87506126
+ ,0.30103000
+ ,1.08990511
+ ,2.30103000
+ ,3
+ ,1
+ ,3
+ ,13.20000000
+ ,0.41497335
+ ,0.36172784
+ ,-0.98296666
+ ,0.39794001
+ ,1.66275783
+ ,3
+ ,2
+ ,2
+ ,9.70000000
+ ,-0.22184875
+ ,1.38021124
+ ,0.62221402
+ ,1.76342799
+ ,2.32221929
+ ,4
+ ,3
+ ,4
+ ,12.80000000
+ ,0.81954394
+ ,0.47712125
+ ,0.54406804
+ ,0.59106461
+ ,1.14612804
+ ,2
+ ,1
+ ,1)
+ ,dim=c(9
+ ,39)
+ ,dimnames=list(c('SWS'
+ ,'logPS'
+ ,'LogL'
+ ,'LogWb'
+ ,'LogWbr'
+ ,'LogTg'
+ ,'P'
+ ,'S'
+ ,'D')
+ ,1:39))
> y <- array(NA,dim=c(9,39),dimnames=list(c('SWS','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
> 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 logPS LogL LogWb LogWbr LogTg P S D
1 6.3 0.30103000 0.6532125 0.00000000 0.81954394 1.623249 3 1 3
2 2.1 0.25527251 1.8388491 3.40602894 3.66304097 2.795185 3 5 4
3 9.1 -0.15490196 1.4313638 1.02325246 2.25406445 2.255273 4 4 4
4 15.8 0.59106461 1.2787536 -1.63827216 -0.52287875 1.544068 1 1 1
5 5.2 0.00000000 1.4828736 2.20411998 2.22788670 2.593286 4 5 4
6 10.9 0.55630250 1.4471580 0.51851394 1.40823997 1.799341 1 2 1
7 8.3 0.14612804 1.6989700 1.71733758 2.64345268 2.361728 1 1 1
8 11.0 0.17609126 0.8450980 -0.37161107 0.80617997 2.049218 5 4 4
9 3.2 -0.15490196 1.4771212 2.66745295 2.62634037 2.448706 5 5 5
10 6.3 0.32221929 0.5440680 -1.12493874 0.07918125 1.623249 1 1 1
11 6.6 0.61278386 0.7781512 -0.10513034 0.54406804 1.623249 2 2 2
12 9.5 0.07918125 1.0170333 -0.69897000 0.69897000 2.079181 2 2 2
13 3.3 -0.30103000 1.3010300 1.44185218 2.06069784 2.170262 5 5 5
14 11.0 0.53147892 0.5910646 -0.92081875 0.00000000 1.204120 3 1 2
15 4.7 0.17609126 1.6127839 1.92941893 2.51188336 2.491362 1 3 1
16 10.4 0.53147892 0.9542425 -0.99567863 0.60205999 1.447158 5 1 3
17 7.4 -0.09691001 0.8808136 0.01703334 0.74036269 1.832509 5 3 4
18 2.1 -0.09691001 1.6627578 2.71683772 2.81624130 2.526339 5 5 5
19 17.9 0.30103000 1.3802112 -2.00000000 -0.60205999 1.698970 1 1 1
20 6.1 0.27875360 2.0000000 1.79239169 3.12057393 2.426511 1 1 1
21 11.9 0.11394335 0.5051500 -1.63827216 -0.39794001 1.278754 4 1 3
22 13.8 0.74818803 0.6989700 0.23044892 0.79934055 1.079181 2 1 1
23 14.3 0.49136169 0.8129134 0.54406804 1.03342376 2.079181 2 1 1
24 15.2 0.25527251 1.0791812 -0.31875876 1.19033170 2.146128 2 2 2
25 10.0 -0.04575749 1.3053514 1.00000000 2.06069784 2.230449 4 4 4
26 11.9 0.25527251 1.1139433 0.20951501 1.05690485 1.230449 2 1 2
27 6.5 0.27875360 1.4313638 2.28330123 2.25527251 2.060698 4 4 4
28 7.5 -0.04575749 1.2552725 0.39794001 1.08278537 1.491362 5 5 5
29 10.6 0.41497335 0.6720979 -0.55284197 0.27875360 1.322219 3 1 3
30 7.4 0.38021124 0.9912261 0.62685341 1.70243054 1.716003 1 1 1
31 8.4 0.07918125 1.4623980 0.83250891 2.25285303 2.214844 2 3 2
32 5.7 -0.04575749 0.8450980 -0.12493874 1.08990511 2.352183 2 2 2
33 4.9 -0.30103000 0.7781512 0.55630250 1.32221929 2.352183 3 2 3
34 3.2 -0.22184875 1.3010300 1.74429298 2.24303805 2.178977 5 5 5
35 11.0 0.36172784 0.6532125 -0.04575749 0.41497335 1.778151 2 1 2
36 4.9 -0.30103000 0.8750613 0.30103000 1.08990511 2.301030 3 1 3
37 13.2 0.41497335 0.3617278 -0.98296666 0.39794001 1.662758 3 2 2
38 9.7 -0.22184875 1.3802112 0.62221402 1.76342799 2.322219 4 3 4
39 12.8 0.81954394 0.4771212 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) logPS LogL LogWb LogWbr LogTg
7.1952 3.3668 3.4373 -1.6510 -0.8804 -0.3157
P S D
1.3373 0.3150 -1.8837
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-4.8939 -1.3258 -0.1221 1.8111 5.0979
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 7.1952 4.5167 1.593 0.1216
logPS 3.3668 2.7451 1.226 0.2296
LogL 3.4373 1.7820 1.929 0.0633 .
LogWb -1.6510 1.1573 -1.427 0.1640
LogWbr -0.8804 1.6203 -0.543 0.5909
LogTg -0.3157 1.9113 -0.165 0.8699
P 1.3373 0.9937 1.346 0.1885
S 0.3150 0.6261 0.503 0.6186
D -1.8837 1.3450 -1.401 0.1716
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.507 on 30 degrees of freedom
Multiple R-squared: 0.6848, Adjusted R-squared: 0.6008
F-statistic: 8.148 on 8 and 30 DF, p-value: 8.605e-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.02971583 0.05943166 0.97028417
[2,] 0.06056894 0.12113788 0.93943106
[3,] 0.02477398 0.04954796 0.97522602
[4,] 0.01517949 0.03035899 0.98482051
[5,] 0.45037672 0.90075344 0.54962328
[6,] 0.34206614 0.68413227 0.65793386
[7,] 0.32941961 0.65883923 0.67058039
[8,] 0.22927517 0.45855034 0.77072483
[9,] 0.46363193 0.92726386 0.53636807
[10,] 0.48958748 0.97917497 0.51041252
[11,] 0.62222927 0.75554146 0.37777073
[12,] 0.72703046 0.54593907 0.27296954
[13,] 0.84447016 0.31105967 0.15552984
[14,] 0.91620127 0.16759747 0.08379873
[15,] 0.88411070 0.23177860 0.11588930
[16,] 0.80626565 0.38746869 0.19373435
> postscript(file="/var/www/html/rcomp/tmp/1ehpb1292269919.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/2o8ov1292269919.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/3o8ov1292269919.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/4o8ov1292269919.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/5o8ov1292269919.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
-1.59580449 -0.59658015 2.81782874 -0.22694847 -0.06249293 -0.56212614
7 8 9 10 11 12
0.91255733 0.63857350 0.09533799 -4.89388738 -4.05236117 -0.87705817
13 14 15 16 17 18
-1.31674814 -1.71591033 -2.84681065 -3.87199064 -1.33478334 -1.56476365
19 20 21 22 23 24
1.88277405 -2.20425895 -0.07973812 2.00221837 4.01477384 5.09792509
25 26 27 28 29 30
3.56703198 2.45907033 0.77775821 -0.61768635 0.77177038 -1.17552836
31 32 33 34 35 36
0.11647180 -2.28733732 -0.12211161 -1.02072101 1.97058408 -0.78237659
37 38 39
1.74219126 3.06108107 1.88007594
> postscript(file="/var/www/html/rcomp/tmp/6zing1292269919.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 -1.59580449 NA
1 -0.59658015 -1.59580449
2 2.81782874 -0.59658015
3 -0.22694847 2.81782874
4 -0.06249293 -0.22694847
5 -0.56212614 -0.06249293
6 0.91255733 -0.56212614
7 0.63857350 0.91255733
8 0.09533799 0.63857350
9 -4.89388738 0.09533799
10 -4.05236117 -4.89388738
11 -0.87705817 -4.05236117
12 -1.31674814 -0.87705817
13 -1.71591033 -1.31674814
14 -2.84681065 -1.71591033
15 -3.87199064 -2.84681065
16 -1.33478334 -3.87199064
17 -1.56476365 -1.33478334
18 1.88277405 -1.56476365
19 -2.20425895 1.88277405
20 -0.07973812 -2.20425895
21 2.00221837 -0.07973812
22 4.01477384 2.00221837
23 5.09792509 4.01477384
24 3.56703198 5.09792509
25 2.45907033 3.56703198
26 0.77775821 2.45907033
27 -0.61768635 0.77775821
28 0.77177038 -0.61768635
29 -1.17552836 0.77177038
30 0.11647180 -1.17552836
31 -2.28733732 0.11647180
32 -0.12211161 -2.28733732
33 -1.02072101 -0.12211161
34 1.97058408 -1.02072101
35 -0.78237659 1.97058408
36 1.74219126 -0.78237659
37 3.06108107 1.74219126
38 1.88007594 3.06108107
39 NA 1.88007594
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.59658015 -1.59580449
[2,] 2.81782874 -0.59658015
[3,] -0.22694847 2.81782874
[4,] -0.06249293 -0.22694847
[5,] -0.56212614 -0.06249293
[6,] 0.91255733 -0.56212614
[7,] 0.63857350 0.91255733
[8,] 0.09533799 0.63857350
[9,] -4.89388738 0.09533799
[10,] -4.05236117 -4.89388738
[11,] -0.87705817 -4.05236117
[12,] -1.31674814 -0.87705817
[13,] -1.71591033 -1.31674814
[14,] -2.84681065 -1.71591033
[15,] -3.87199064 -2.84681065
[16,] -1.33478334 -3.87199064
[17,] -1.56476365 -1.33478334
[18,] 1.88277405 -1.56476365
[19,] -2.20425895 1.88277405
[20,] -0.07973812 -2.20425895
[21,] 2.00221837 -0.07973812
[22,] 4.01477384 2.00221837
[23,] 5.09792509 4.01477384
[24,] 3.56703198 5.09792509
[25,] 2.45907033 3.56703198
[26,] 0.77775821 2.45907033
[27,] -0.61768635 0.77775821
[28,] 0.77177038 -0.61768635
[29,] -1.17552836 0.77177038
[30,] 0.11647180 -1.17552836
[31,] -2.28733732 0.11647180
[32,] -0.12211161 -2.28733732
[33,] -1.02072101 -0.12211161
[34,] 1.97058408 -1.02072101
[35,] -0.78237659 1.97058408
[36,] 1.74219126 -0.78237659
[37,] 3.06108107 1.74219126
[38,] 1.88007594 3.06108107
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.59658015 -1.59580449
2 2.81782874 -0.59658015
3 -0.22694847 2.81782874
4 -0.06249293 -0.22694847
5 -0.56212614 -0.06249293
6 0.91255733 -0.56212614
7 0.63857350 0.91255733
8 0.09533799 0.63857350
9 -4.89388738 0.09533799
10 -4.05236117 -4.89388738
11 -0.87705817 -4.05236117
12 -1.31674814 -0.87705817
13 -1.71591033 -1.31674814
14 -2.84681065 -1.71591033
15 -3.87199064 -2.84681065
16 -1.33478334 -3.87199064
17 -1.56476365 -1.33478334
18 1.88277405 -1.56476365
19 -2.20425895 1.88277405
20 -0.07973812 -2.20425895
21 2.00221837 -0.07973812
22 4.01477384 2.00221837
23 5.09792509 4.01477384
24 3.56703198 5.09792509
25 2.45907033 3.56703198
26 0.77775821 2.45907033
27 -0.61768635 0.77775821
28 0.77177038 -0.61768635
29 -1.17552836 0.77177038
30 0.11647180 -1.17552836
31 -2.28733732 0.11647180
32 -0.12211161 -2.28733732
33 -1.02072101 -0.12211161
34 1.97058408 -1.02072101
35 -0.78237659 1.97058408
36 1.74219126 -0.78237659
37 3.06108107 1.74219126
38 1.88007594 3.06108107
> 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/7a95j1292269919.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/8a95j1292269919.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/9a95j1292269919.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/10li441292269919.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/11ojks1292269919.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/12r1jg1292269919.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/135tyo1292269919.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/149bfc1292269919.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/15ucei1292269919.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/16ycuo1292269919.tab")
+ }
>
> try(system("convert tmp/1ehpb1292269919.ps tmp/1ehpb1292269919.png",intern=TRUE))
character(0)
> try(system("convert tmp/2o8ov1292269919.ps tmp/2o8ov1292269919.png",intern=TRUE))
character(0)
> try(system("convert tmp/3o8ov1292269919.ps tmp/3o8ov1292269919.png",intern=TRUE))
character(0)
> try(system("convert tmp/4o8ov1292269919.ps tmp/4o8ov1292269919.png",intern=TRUE))
character(0)
> try(system("convert tmp/5o8ov1292269919.ps tmp/5o8ov1292269919.png",intern=TRUE))
character(0)
> try(system("convert tmp/6zing1292269919.ps tmp/6zing1292269919.png",intern=TRUE))
character(0)
> try(system("convert tmp/7a95j1292269919.ps tmp/7a95j1292269919.png",intern=TRUE))
character(0)
> try(system("convert tmp/8a95j1292269919.ps tmp/8a95j1292269919.png",intern=TRUE))
character(0)
> try(system("convert tmp/9a95j1292269919.ps tmp/9a95j1292269919.png",intern=TRUE))
character(0)
> try(system("convert tmp/10li441292269919.ps tmp/10li441292269919.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.273 1.646 5.741