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(2
+ ,4.5
+ ,1
+ ,7
+ ,42
+ ,3
+ ,1
+ ,3
+ ,1.8
+ ,69
+ ,2.547
+ ,4.603
+ ,624
+ ,3
+ ,5
+ ,4
+ ,0.7
+ ,27
+ ,11
+ ,180
+ ,180
+ ,4
+ ,4
+ ,4
+ ,3.9
+ ,19
+ ,0.023
+ ,0.3
+ ,35
+ ,1
+ ,1
+ ,1
+ ,1
+ ,30.4
+ ,160
+ ,169
+ ,392
+ ,4
+ ,5
+ ,4
+ ,3.6
+ ,28
+ ,3
+ ,26
+ ,63
+ ,1
+ ,2
+ ,1
+ ,1.4
+ ,50
+ ,52
+ ,440
+ ,230
+ ,1
+ ,1
+ ,1
+ ,1.5
+ ,7
+ ,0.425
+ ,6
+ ,112
+ ,5
+ ,4
+ ,4
+ ,0.7
+ ,30
+ ,465
+ ,423
+ ,281
+ ,5
+ ,5
+ ,5
+ ,2.1
+ ,3.5
+ ,0.075
+ ,1
+ ,42
+ ,1
+ ,1
+ ,1
+ ,0
+ ,50
+ ,3
+ ,25
+ ,28
+ ,2
+ ,2
+ ,2
+ ,4.1
+ ,6
+ ,0.785
+ ,4
+ ,42
+ ,2
+ ,2
+ ,2
+ ,1.2
+ ,10.4
+ ,0.2
+ ,5
+ ,120
+ ,2
+ ,2
+ ,2
+ ,0.5
+ ,20
+ ,28
+ ,115
+ ,148
+ ,5
+ ,5
+ ,5
+ ,3.4
+ ,3.9
+ ,0.12
+ ,1
+ ,16
+ ,3
+ ,1
+ ,2
+ ,1.5
+ ,41
+ ,85
+ ,325
+ ,310
+ ,1
+ ,3
+ ,1
+ ,3.4
+ ,9
+ ,0.101
+ ,4
+ ,28
+ ,5
+ ,1
+ ,3
+ ,0.8
+ ,7.6
+ ,1
+ ,6
+ ,68
+ ,5
+ ,3
+ ,4
+ ,0.8
+ ,46
+ ,521
+ ,655
+ ,336
+ ,5
+ ,5
+ ,5
+ ,1.4
+ ,2.6
+ ,0.005
+ ,0.14
+ ,21.5
+ ,5
+ ,2
+ ,4
+ ,2
+ ,24
+ ,0.01
+ ,0.25
+ ,50
+ ,1
+ ,1
+ ,1
+ ,1.9
+ ,100
+ ,62
+ ,1.320
+ ,267
+ ,1
+ ,1
+ ,1
+ ,1.3
+ ,3.2
+ ,0.023
+ ,0.4
+ ,19
+ ,4
+ ,1
+ ,3
+ ,2
+ ,2
+ ,0.048
+ ,0.33
+ ,30
+ ,4
+ ,1
+ ,3
+ ,5.6
+ ,5
+ ,2
+ ,6
+ ,12
+ ,2
+ ,1
+ ,1
+ ,3.1
+ ,6.5
+ ,4
+ ,11
+ ,120
+ ,2
+ ,1
+ ,1
+ ,1.8
+ ,12
+ ,0.48
+ ,16
+ ,140
+ ,2
+ ,2
+ ,2
+ ,0.9
+ ,20.2
+ ,10
+ ,115
+ ,170
+ ,4
+ ,4
+ ,4
+ ,1.8
+ ,13
+ ,2
+ ,11
+ ,17
+ ,2
+ ,1
+ ,2
+ ,1.9
+ ,27
+ ,192
+ ,180
+ ,115
+ ,4
+ ,4
+ ,4
+ ,0.9
+ ,18
+ ,3
+ ,12
+ ,31
+ ,5
+ ,5
+ ,5
+ ,2.6
+ ,4.7
+ ,0.28
+ ,2
+ ,21
+ ,3
+ ,1
+ ,3
+ ,2.4
+ ,9.8
+ ,4
+ ,50
+ ,52
+ ,1
+ ,1
+ ,1
+ ,1.2
+ ,29
+ ,7
+ ,179
+ ,164
+ ,2
+ ,3
+ ,2
+ ,0.9
+ ,7
+ ,0.75
+ ,12
+ ,225
+ ,2
+ ,2
+ ,2
+ ,0.5
+ ,6
+ ,4
+ ,21
+ ,225
+ ,3
+ ,2
+ ,3
+ ,0.6
+ ,20
+ ,56
+ ,175
+ ,151
+ ,5
+ ,5
+ ,5
+ ,2.3
+ ,4.5
+ ,0.9
+ ,3
+ ,60
+ ,2
+ ,1
+ ,2
+ ,0.5
+ ,7.5
+ ,2
+ ,12
+ ,200
+ ,3
+ ,1
+ ,3
+ ,2.6
+ ,2.3
+ ,0.104
+ ,3
+ ,46
+ ,3
+ ,2
+ ,2
+ ,0.6
+ ,24
+ ,4
+ ,58
+ ,210
+ ,4
+ ,3
+ ,4
+ ,6.6
+ ,3
+ ,4
+ ,4
+ ,14
+ ,2
+ ,1
+ ,1)
+ ,dim=c(8
+ ,42)
+ ,dimnames=list(c('PS'
+ ,'L'
+ ,'Wb'
+ ,'Wbr'
+ ,'Tg'
+ ,'P'
+ ,'S'
+ ,'D')
+ ,1:42))
> y <- array(NA,dim=c(8,42),dimnames=list(c('PS','L','Wb','Wbr','Tg','P','S','D'),1:42))
> 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
PS L Wb Wbr Tg P S D
1 2.0 4.5 1.000 7.000 42.0 3 1 3
2 1.8 69.0 2.547 4.603 624.0 3 5 4
3 0.7 27.0 11.000 180.000 180.0 4 4 4
4 3.9 19.0 0.023 0.300 35.0 1 1 1
5 1.0 30.4 160.000 169.000 392.0 4 5 4
6 3.6 28.0 3.000 26.000 63.0 1 2 1
7 1.4 50.0 52.000 440.000 230.0 1 1 1
8 1.5 7.0 0.425 6.000 112.0 5 4 4
9 0.7 30.0 465.000 423.000 281.0 5 5 5
10 2.1 3.5 0.075 1.000 42.0 1 1 1
11 0.0 50.0 3.000 25.000 28.0 2 2 2
12 4.1 6.0 0.785 4.000 42.0 2 2 2
13 1.2 10.4 0.200 5.000 120.0 2 2 2
14 0.5 20.0 28.000 115.000 148.0 5 5 5
15 3.4 3.9 0.120 1.000 16.0 3 1 2
16 1.5 41.0 85.000 325.000 310.0 1 3 1
17 3.4 9.0 0.101 4.000 28.0 5 1 3
18 0.8 7.6 1.000 6.000 68.0 5 3 4
19 0.8 46.0 521.000 655.000 336.0 5 5 5
20 1.4 2.6 0.005 0.140 21.5 5 2 4
21 2.0 24.0 0.010 0.250 50.0 1 1 1
22 1.9 100.0 62.000 1.320 267.0 1 1 1
23 1.3 3.2 0.023 0.400 19.0 4 1 3
24 2.0 2.0 0.048 0.330 30.0 4 1 3
25 5.6 5.0 2.000 6.000 12.0 2 1 1
26 3.1 6.5 4.000 11.000 120.0 2 1 1
27 1.8 12.0 0.480 16.000 140.0 2 2 2
28 0.9 20.2 10.000 115.000 170.0 4 4 4
29 1.8 13.0 2.000 11.000 17.0 2 1 2
30 1.9 27.0 192.000 180.000 115.0 4 4 4
31 0.9 18.0 3.000 12.000 31.0 5 5 5
32 2.6 4.7 0.280 2.000 21.0 3 1 3
33 2.4 9.8 4.000 50.000 52.0 1 1 1
34 1.2 29.0 7.000 179.000 164.0 2 3 2
35 0.9 7.0 0.750 12.000 225.0 2 2 2
36 0.5 6.0 4.000 21.000 225.0 3 2 3
37 0.6 20.0 56.000 175.000 151.0 5 5 5
38 2.3 4.5 0.900 3.000 60.0 2 1 2
39 0.5 7.5 2.000 12.000 200.0 3 1 3
40 2.6 2.3 0.104 3.000 46.0 3 2 2
41 0.6 24.0 4.000 58.000 210.0 4 3 4
42 6.6 3.0 4.000 4.000 14.0 2 1 1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) L Wb Wbr Tg P
3.5873715 -0.0094560 0.0050888 -0.0039084 -0.0007866 0.8104062
S D
0.3272614 -1.6602624
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.9649 -0.6244 -0.1714 0.4414 2.7595
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.5873715 0.4678050 7.669 6.48e-09 ***
L -0.0094560 0.0113991 -0.830 0.41259
Wb 0.0050888 0.0027563 1.846 0.07358 .
Wbr -0.0039084 0.0021505 -1.817 0.07798 .
Tg -0.0007866 0.0020262 -0.388 0.70029
P 0.8104062 0.3738079 2.168 0.03725 *
S 0.3272614 0.2258617 1.449 0.15651
D -1.6602624 0.4638231 -3.580 0.00106 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.04 on 34 degrees of freedom
Multiple R-squared: 0.5347, Adjusted R-squared: 0.4389
F-statistic: 5.581 on 7 and 34 DF, p-value: 0.0002428
> 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.8894152 0.2211696 0.11058481
[2,] 0.9083101 0.1833797 0.09168985
[3,] 0.9446635 0.1106731 0.05533653
[4,] 0.9006215 0.1987571 0.09937853
[5,] 0.8720159 0.2559682 0.12798409
[6,] 0.8166091 0.3667819 0.18339093
[7,] 0.7494670 0.5010660 0.25053302
[8,] 0.7446486 0.5107029 0.25535144
[9,] 0.6793542 0.6412916 0.32064580
[10,] 0.5970034 0.8059933 0.40299663
[11,] 0.5693730 0.8612540 0.43062701
[12,] 0.4568583 0.9137167 0.54314166
[13,] 0.5281853 0.9436294 0.47181469
[14,] 0.5828188 0.8343624 0.41718119
[15,] 0.6804879 0.6390242 0.31951210
[16,] 0.6492435 0.7015131 0.35075654
[17,] 0.5523998 0.8952004 0.44760022
[18,] 0.4348843 0.8697687 0.56511566
[19,] 0.3769636 0.7539273 0.62303636
[20,] 0.4245850 0.8491700 0.57541498
[21,] 0.2909074 0.5818149 0.70909257
> postscript(file="/var/www/html/rcomp/tmp/1faff1292084805.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/2pjxi1292084805.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/3pjxi1292084805.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/4pjxi1292084805.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/50tel1292084805.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 = 42
Frequency = 1
1 2 3 4 5 6 7
0.7327938 1.9344701 0.2474344 1.0434733 -0.3821522 0.6086359 0.4440026
8 9 10 11 12 13 14
-0.6318223 -0.4827577 -0.8951178 -1.9649139 1.6592291 -1.1309261 0.1381118
15 16 17 18 19 20 21
0.4274347 -0.7500935 0.5363713 -1.0364227 0.4335684 -0.2108569 -0.7975773
22 23 24 25 26 27 28
-0.3195082 -0.8288199 -0.1319156 1.7948087 -0.5966929 -0.4584977 0.1263121
29 30 31 32 33 34 35
-0.2458060 0.4752264 0.1518287 1.3022890 -0.3561423 -0.6022428 -1.3559263
36 37 38 39 40 41 42
-0.8968895 0.3324866 0.1819713 -0.6001061 -0.6834609 0.0287250 2.7594754
> postscript(file="/var/www/html/rcomp/tmp/60tel1292084805.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 = 42
Frequency = 1
lag(myerror, k = 1) myerror
0 0.7327938 NA
1 1.9344701 0.7327938
2 0.2474344 1.9344701
3 1.0434733 0.2474344
4 -0.3821522 1.0434733
5 0.6086359 -0.3821522
6 0.4440026 0.6086359
7 -0.6318223 0.4440026
8 -0.4827577 -0.6318223
9 -0.8951178 -0.4827577
10 -1.9649139 -0.8951178
11 1.6592291 -1.9649139
12 -1.1309261 1.6592291
13 0.1381118 -1.1309261
14 0.4274347 0.1381118
15 -0.7500935 0.4274347
16 0.5363713 -0.7500935
17 -1.0364227 0.5363713
18 0.4335684 -1.0364227
19 -0.2108569 0.4335684
20 -0.7975773 -0.2108569
21 -0.3195082 -0.7975773
22 -0.8288199 -0.3195082
23 -0.1319156 -0.8288199
24 1.7948087 -0.1319156
25 -0.5966929 1.7948087
26 -0.4584977 -0.5966929
27 0.1263121 -0.4584977
28 -0.2458060 0.1263121
29 0.4752264 -0.2458060
30 0.1518287 0.4752264
31 1.3022890 0.1518287
32 -0.3561423 1.3022890
33 -0.6022428 -0.3561423
34 -1.3559263 -0.6022428
35 -0.8968895 -1.3559263
36 0.3324866 -0.8968895
37 0.1819713 0.3324866
38 -0.6001061 0.1819713
39 -0.6834609 -0.6001061
40 0.0287250 -0.6834609
41 2.7594754 0.0287250
42 NA 2.7594754
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 1.9344701 0.7327938
[2,] 0.2474344 1.9344701
[3,] 1.0434733 0.2474344
[4,] -0.3821522 1.0434733
[5,] 0.6086359 -0.3821522
[6,] 0.4440026 0.6086359
[7,] -0.6318223 0.4440026
[8,] -0.4827577 -0.6318223
[9,] -0.8951178 -0.4827577
[10,] -1.9649139 -0.8951178
[11,] 1.6592291 -1.9649139
[12,] -1.1309261 1.6592291
[13,] 0.1381118 -1.1309261
[14,] 0.4274347 0.1381118
[15,] -0.7500935 0.4274347
[16,] 0.5363713 -0.7500935
[17,] -1.0364227 0.5363713
[18,] 0.4335684 -1.0364227
[19,] -0.2108569 0.4335684
[20,] -0.7975773 -0.2108569
[21,] -0.3195082 -0.7975773
[22,] -0.8288199 -0.3195082
[23,] -0.1319156 -0.8288199
[24,] 1.7948087 -0.1319156
[25,] -0.5966929 1.7948087
[26,] -0.4584977 -0.5966929
[27,] 0.1263121 -0.4584977
[28,] -0.2458060 0.1263121
[29,] 0.4752264 -0.2458060
[30,] 0.1518287 0.4752264
[31,] 1.3022890 0.1518287
[32,] -0.3561423 1.3022890
[33,] -0.6022428 -0.3561423
[34,] -1.3559263 -0.6022428
[35,] -0.8968895 -1.3559263
[36,] 0.3324866 -0.8968895
[37,] 0.1819713 0.3324866
[38,] -0.6001061 0.1819713
[39,] -0.6834609 -0.6001061
[40,] 0.0287250 -0.6834609
[41,] 2.7594754 0.0287250
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 1.9344701 0.7327938
2 0.2474344 1.9344701
3 1.0434733 0.2474344
4 -0.3821522 1.0434733
5 0.6086359 -0.3821522
6 0.4440026 0.6086359
7 -0.6318223 0.4440026
8 -0.4827577 -0.6318223
9 -0.8951178 -0.4827577
10 -1.9649139 -0.8951178
11 1.6592291 -1.9649139
12 -1.1309261 1.6592291
13 0.1381118 -1.1309261
14 0.4274347 0.1381118
15 -0.7500935 0.4274347
16 0.5363713 -0.7500935
17 -1.0364227 0.5363713
18 0.4335684 -1.0364227
19 -0.2108569 0.4335684
20 -0.7975773 -0.2108569
21 -0.3195082 -0.7975773
22 -0.8288199 -0.3195082
23 -0.1319156 -0.8288199
24 1.7948087 -0.1319156
25 -0.5966929 1.7948087
26 -0.4584977 -0.5966929
27 0.1263121 -0.4584977
28 -0.2458060 0.1263121
29 0.4752264 -0.2458060
30 0.1518287 0.4752264
31 1.3022890 0.1518287
32 -0.3561423 1.3022890
33 -0.6022428 -0.3561423
34 -1.3559263 -0.6022428
35 -0.8968895 -1.3559263
36 0.3324866 -0.8968895
37 0.1819713 0.3324866
38 -0.6001061 0.1819713
39 -0.6834609 -0.6001061
40 0.0287250 -0.6834609
41 2.7594754 0.0287250
> 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/7t2d61292084805.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/8t2d61292084805.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/9mtcr1292084805.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/10mtcr1292084805.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/117ctx1292084805.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/12au9l1292084805.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/13rnrr1292084806.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/14kw8c1292084806.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/15nf7i1292084806.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/1617m91292084806.tab")
+ }
>
> try(system("convert tmp/1faff1292084805.ps tmp/1faff1292084805.png",intern=TRUE))
character(0)
> try(system("convert tmp/2pjxi1292084805.ps tmp/2pjxi1292084805.png",intern=TRUE))
character(0)
> try(system("convert tmp/3pjxi1292084805.ps tmp/3pjxi1292084805.png",intern=TRUE))
character(0)
> try(system("convert tmp/4pjxi1292084805.ps tmp/4pjxi1292084805.png",intern=TRUE))
character(0)
> try(system("convert tmp/50tel1292084805.ps tmp/50tel1292084805.png",intern=TRUE))
character(0)
> try(system("convert tmp/60tel1292084805.ps tmp/60tel1292084805.png",intern=TRUE))
character(0)
> try(system("convert tmp/7t2d61292084805.ps tmp/7t2d61292084805.png",intern=TRUE))
character(0)
> try(system("convert tmp/8t2d61292084805.ps tmp/8t2d61292084805.png",intern=TRUE))
character(0)
> try(system("convert tmp/9mtcr1292084805.ps tmp/9mtcr1292084805.png",intern=TRUE))
character(0)
> try(system("convert tmp/10mtcr1292084805.ps tmp/10mtcr1292084805.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.341 1.660 12.564