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(1
+ ,7
+ ,6.3
+ ,4.5
+ ,42
+ ,3
+ ,1
+ ,3
+ ,2.547
+ ,4.603
+ ,2.1
+ ,69
+ ,624
+ ,3
+ ,5
+ ,4
+ ,11
+ ,180
+ ,9.1
+ ,27
+ ,180
+ ,4
+ ,4
+ ,4
+ ,0.023
+ ,0.3
+ ,15.8
+ ,19
+ ,35
+ ,1
+ ,1
+ ,1
+ ,160
+ ,169
+ ,5.2
+ ,30.4
+ ,392
+ ,4
+ ,5
+ ,4
+ ,3
+ ,26
+ ,10.9
+ ,28
+ ,63
+ ,1
+ ,2
+ ,1
+ ,52
+ ,440
+ ,8.3
+ ,50
+ ,230
+ ,1
+ ,1
+ ,1
+ ,0.425
+ ,6
+ ,11
+ ,7
+ ,112
+ ,5
+ ,4
+ ,4
+ ,465
+ ,423
+ ,3.2
+ ,30
+ ,281
+ ,5
+ ,5
+ ,5
+ ,0.075
+ ,1
+ ,6.3
+ ,3.5
+ ,42
+ ,1
+ ,1
+ ,1
+ ,3
+ ,25
+ ,8.6
+ ,50
+ ,28
+ ,2
+ ,2
+ ,2
+ ,0.785
+ ,4
+ ,6.6
+ ,6
+ ,42
+ ,2
+ ,2
+ ,2
+ ,0.2
+ ,5
+ ,9.5
+ ,10.4
+ ,120
+ ,2
+ ,2
+ ,2
+ ,28
+ ,115
+ ,3.3
+ ,20
+ ,148
+ ,5
+ ,5
+ ,5
+ ,0.12
+ ,1
+ ,11
+ ,3.9
+ ,16
+ ,3
+ ,1
+ ,2
+ ,85
+ ,325
+ ,4.7
+ ,41
+ ,310
+ ,1
+ ,3
+ ,1
+ ,0.101
+ ,4
+ ,10.4
+ ,9
+ ,28
+ ,5
+ ,1
+ ,3
+ ,1
+ ,6
+ ,7.4
+ ,7.6
+ ,68
+ ,5
+ ,3
+ ,4
+ ,521
+ ,655
+ ,2.1
+ ,46
+ ,336
+ ,5
+ ,5
+ ,5
+ ,0.005
+ ,0.14
+ ,7.7
+ ,2.6
+ ,21.5
+ ,5
+ ,2
+ ,4
+ ,0.01
+ ,0.25
+ ,17.9
+ ,24
+ ,50
+ ,1
+ ,1
+ ,1
+ ,62
+ ,1.320
+ ,6.1
+ ,100
+ ,267
+ ,1
+ ,1
+ ,1
+ ,0.023
+ ,0.4
+ ,11.9
+ ,3.2
+ ,19
+ ,4
+ ,1
+ ,3
+ ,0.048
+ ,0.33
+ ,10.8
+ ,2
+ ,30
+ ,4
+ ,1
+ ,3
+ ,2
+ ,6
+ ,13.8
+ ,5
+ ,12
+ ,2
+ ,1
+ ,1
+ ,4
+ ,11
+ ,14.3
+ ,6.5
+ ,120
+ ,2
+ ,1
+ ,1
+ ,0.48
+ ,16
+ ,15.2
+ ,12
+ ,140
+ ,2
+ ,2
+ ,2
+ ,10
+ ,115
+ ,10
+ ,20.2
+ ,170
+ ,4
+ ,4
+ ,4
+ ,2
+ ,11
+ ,11.9
+ ,13
+ ,17
+ ,2
+ ,1
+ ,2
+ ,192
+ ,180
+ ,6.5
+ ,27
+ ,115
+ ,4
+ ,4
+ ,4
+ ,3
+ ,12
+ ,7.5
+ ,18
+ ,31
+ ,5
+ ,5
+ ,5
+ ,0.28
+ ,2
+ ,10.6
+ ,4.7
+ ,21
+ ,3
+ ,1
+ ,3
+ ,4
+ ,50
+ ,7.4
+ ,9.8
+ ,52
+ ,1
+ ,1
+ ,1
+ ,7
+ ,179
+ ,8.4
+ ,29
+ ,164
+ ,2
+ ,3
+ ,2
+ ,0.75
+ ,12
+ ,5.7
+ ,7
+ ,225
+ ,2
+ ,2
+ ,2
+ ,4
+ ,21
+ ,4.9
+ ,6
+ ,225
+ ,3
+ ,2
+ ,3
+ ,56
+ ,175
+ ,3.2
+ ,20
+ ,151
+ ,5
+ ,5
+ ,5
+ ,0.9
+ ,3
+ ,11
+ ,4.5
+ ,60
+ ,2
+ ,1
+ ,2
+ ,2
+ ,12
+ ,4.9
+ ,7.5
+ ,200
+ ,3
+ ,1
+ ,3
+ ,0.104
+ ,3
+ ,13.2
+ ,2.3
+ ,46
+ ,3
+ ,2
+ ,2
+ ,4
+ ,58
+ ,9.7
+ ,24
+ ,210
+ ,4
+ ,3
+ ,4
+ ,4
+ ,4
+ ,12.8
+ ,3
+ ,14
+ ,2
+ ,1
+ ,1)
+ ,dim=c(8
+ ,42)
+ ,dimnames=list(c('Wb'
+ ,'Wbr'
+ ,'SWS'
+ ,'L'
+ ,'Tg'
+ ,'P'
+ ,'S'
+ ,'D')
+ ,1:42))
> y <- array(NA,dim=c(8,42),dimnames=list(c('Wb','Wbr','SWS','L','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 = '3'
> #'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
SWS Wb Wbr L Tg P S D
1 6.3 1.000 7.000 4.5 42.0 3 1 3
2 2.1 2.547 4.603 69.0 624.0 3 5 4
3 9.1 11.000 180.000 27.0 180.0 4 4 4
4 15.8 0.023 0.300 19.0 35.0 1 1 1
5 5.2 160.000 169.000 30.4 392.0 4 5 4
6 10.9 3.000 26.000 28.0 63.0 1 2 1
7 8.3 52.000 440.000 50.0 230.0 1 1 1
8 11.0 0.425 6.000 7.0 112.0 5 4 4
9 3.2 465.000 423.000 30.0 281.0 5 5 5
10 6.3 0.075 1.000 3.5 42.0 1 1 1
11 8.6 3.000 25.000 50.0 28.0 2 2 2
12 6.6 0.785 4.000 6.0 42.0 2 2 2
13 9.5 0.200 5.000 10.4 120.0 2 2 2
14 3.3 28.000 115.000 20.0 148.0 5 5 5
15 11.0 0.120 1.000 3.9 16.0 3 1 2
16 4.7 85.000 325.000 41.0 310.0 1 3 1
17 10.4 0.101 4.000 9.0 28.0 5 1 3
18 7.4 1.000 6.000 7.6 68.0 5 3 4
19 2.1 521.000 655.000 46.0 336.0 5 5 5
20 7.7 0.005 0.140 2.6 21.5 5 2 4
21 17.9 0.010 0.250 24.0 50.0 1 1 1
22 6.1 62.000 1.320 100.0 267.0 1 1 1
23 11.9 0.023 0.400 3.2 19.0 4 1 3
24 10.8 0.048 0.330 2.0 30.0 4 1 3
25 13.8 2.000 6.000 5.0 12.0 2 1 1
26 14.3 4.000 11.000 6.5 120.0 2 1 1
27 15.2 0.480 16.000 12.0 140.0 2 2 2
28 10.0 10.000 115.000 20.2 170.0 4 4 4
29 11.9 2.000 11.000 13.0 17.0 2 1 2
30 6.5 192.000 180.000 27.0 115.0 4 4 4
31 7.5 3.000 12.000 18.0 31.0 5 5 5
32 10.6 0.280 2.000 4.7 21.0 3 1 3
33 7.4 4.000 50.000 9.8 52.0 1 1 1
34 8.4 7.000 179.000 29.0 164.0 2 3 2
35 5.7 0.750 12.000 7.0 225.0 2 2 2
36 4.9 4.000 21.000 6.0 225.0 3 2 3
37 3.2 56.000 175.000 20.0 151.0 5 5 5
38 11.0 0.900 3.000 4.5 60.0 2 1 2
39 4.9 2.000 12.000 7.5 200.0 3 1 3
40 13.2 0.104 3.000 2.3 46.0 3 2 2
41 9.7 4.000 58.000 24.0 210.0 4 3 4
42 12.8 4.000 4.000 3.0 14.0 2 1 1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Wb Wbr L Tg P
12.7894648 -0.0009204 -0.0040754 -0.0054513 -0.0102386 1.4372544
S D
0.4360708 -2.7978210
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-5.1117 -2.0608 -0.1672 1.4789 6.6788
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 12.7894648 1.2711188 10.062 9.97e-12 ***
Wb -0.0009204 0.0074895 -0.123 0.9029
Wbr -0.0040754 0.0058435 -0.697 0.4903
L -0.0054513 0.0309737 -0.176 0.8613
Tg -0.0102386 0.0055056 -1.860 0.0716 .
P 1.4372544 1.0157101 1.415 0.1662
S 0.4360708 0.6137109 0.711 0.4822
D -2.7978210 1.2602992 -2.220 0.0332 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.827 on 34 degrees of freedom
Multiple R-squared: 0.55, Adjusted R-squared: 0.4574
F-statistic: 5.937 on 7 and 34 DF, p-value: 0.0001463
> 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.8568686 0.2862628 0.14313142
[2,] 0.8456757 0.3086485 0.15432427
[3,] 0.7547511 0.4904978 0.24524890
[4,] 0.6944483 0.6111034 0.30555170
[5,] 0.6008451 0.7983099 0.39915495
[6,] 0.6156774 0.7686452 0.38432261
[7,] 0.5525573 0.8948854 0.44744268
[8,] 0.4611897 0.9223794 0.53881032
[9,] 0.3860778 0.7721556 0.61392220
[10,] 0.3097518 0.6195037 0.69024816
[11,] 0.6964416 0.6071167 0.30355837
[12,] 0.8335078 0.3329845 0.16649223
[13,] 0.7680322 0.4639355 0.23196776
[14,] 0.6769084 0.6461832 0.32309158
[15,] 0.5729110 0.8541781 0.42708905
[16,] 0.4721242 0.9442485 0.52787575
[17,] 0.8391994 0.3216011 0.16080057
[18,] 0.9166264 0.1667473 0.08337363
[19,] 0.8402489 0.3195023 0.15975115
[20,] 0.7381578 0.5236845 0.26184225
[21,] 0.9054811 0.1890379 0.09451894
> postscript(file="/var/www/rcomp/tmp/1c8iq1292084258.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/24hzb1292084258.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/34hzb1292084258.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/4frze1292084258.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/5frze1292084258.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
-2.3598361 0.7958224 2.7423509 4.3982000 0.6876986 -0.4946501 0.9035208
8 9 10 11 12 13 14
1.6809882 0.2254718 -5.1117244 -1.6765809 -3.8607207 -0.1345882 -2.7482043
15 16 17 18 19 20 21
-0.7523936 -3.2368988 -1.2662080 -1.9296388 0.7728559 -1.7217165 6.6788195
22 23 24 25 26 27 28
-2.4236946 1.5325383 0.5383589 0.6741894 2.3103515 5.8239930 3.2370726
29 30 31 32 33 34 35
1.6871909 -0.3565720 -0.1998003 1.7052041 -3.6716866 -0.4033830 -2.8490369
36 37 38 39 40 41 42
-2.2542516 -2.5471924 1.1474982 -2.1044881 1.3181072 3.5655799 -0.3225462
> postscript(file="/var/www/rcomp/tmp/6frze1292084258.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 -2.3598361 NA
1 0.7958224 -2.3598361
2 2.7423509 0.7958224
3 4.3982000 2.7423509
4 0.6876986 4.3982000
5 -0.4946501 0.6876986
6 0.9035208 -0.4946501
7 1.6809882 0.9035208
8 0.2254718 1.6809882
9 -5.1117244 0.2254718
10 -1.6765809 -5.1117244
11 -3.8607207 -1.6765809
12 -0.1345882 -3.8607207
13 -2.7482043 -0.1345882
14 -0.7523936 -2.7482043
15 -3.2368988 -0.7523936
16 -1.2662080 -3.2368988
17 -1.9296388 -1.2662080
18 0.7728559 -1.9296388
19 -1.7217165 0.7728559
20 6.6788195 -1.7217165
21 -2.4236946 6.6788195
22 1.5325383 -2.4236946
23 0.5383589 1.5325383
24 0.6741894 0.5383589
25 2.3103515 0.6741894
26 5.8239930 2.3103515
27 3.2370726 5.8239930
28 1.6871909 3.2370726
29 -0.3565720 1.6871909
30 -0.1998003 -0.3565720
31 1.7052041 -0.1998003
32 -3.6716866 1.7052041
33 -0.4033830 -3.6716866
34 -2.8490369 -0.4033830
35 -2.2542516 -2.8490369
36 -2.5471924 -2.2542516
37 1.1474982 -2.5471924
38 -2.1044881 1.1474982
39 1.3181072 -2.1044881
40 3.5655799 1.3181072
41 -0.3225462 3.5655799
42 NA -0.3225462
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.7958224 -2.3598361
[2,] 2.7423509 0.7958224
[3,] 4.3982000 2.7423509
[4,] 0.6876986 4.3982000
[5,] -0.4946501 0.6876986
[6,] 0.9035208 -0.4946501
[7,] 1.6809882 0.9035208
[8,] 0.2254718 1.6809882
[9,] -5.1117244 0.2254718
[10,] -1.6765809 -5.1117244
[11,] -3.8607207 -1.6765809
[12,] -0.1345882 -3.8607207
[13,] -2.7482043 -0.1345882
[14,] -0.7523936 -2.7482043
[15,] -3.2368988 -0.7523936
[16,] -1.2662080 -3.2368988
[17,] -1.9296388 -1.2662080
[18,] 0.7728559 -1.9296388
[19,] -1.7217165 0.7728559
[20,] 6.6788195 -1.7217165
[21,] -2.4236946 6.6788195
[22,] 1.5325383 -2.4236946
[23,] 0.5383589 1.5325383
[24,] 0.6741894 0.5383589
[25,] 2.3103515 0.6741894
[26,] 5.8239930 2.3103515
[27,] 3.2370726 5.8239930
[28,] 1.6871909 3.2370726
[29,] -0.3565720 1.6871909
[30,] -0.1998003 -0.3565720
[31,] 1.7052041 -0.1998003
[32,] -3.6716866 1.7052041
[33,] -0.4033830 -3.6716866
[34,] -2.8490369 -0.4033830
[35,] -2.2542516 -2.8490369
[36,] -2.5471924 -2.2542516
[37,] 1.1474982 -2.5471924
[38,] -2.1044881 1.1474982
[39,] 1.3181072 -2.1044881
[40,] 3.5655799 1.3181072
[41,] -0.3225462 3.5655799
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.7958224 -2.3598361
2 2.7423509 0.7958224
3 4.3982000 2.7423509
4 0.6876986 4.3982000
5 -0.4946501 0.6876986
6 0.9035208 -0.4946501
7 1.6809882 0.9035208
8 0.2254718 1.6809882
9 -5.1117244 0.2254718
10 -1.6765809 -5.1117244
11 -3.8607207 -1.6765809
12 -0.1345882 -3.8607207
13 -2.7482043 -0.1345882
14 -0.7523936 -2.7482043
15 -3.2368988 -0.7523936
16 -1.2662080 -3.2368988
17 -1.9296388 -1.2662080
18 0.7728559 -1.9296388
19 -1.7217165 0.7728559
20 6.6788195 -1.7217165
21 -2.4236946 6.6788195
22 1.5325383 -2.4236946
23 0.5383589 1.5325383
24 0.6741894 0.5383589
25 2.3103515 0.6741894
26 5.8239930 2.3103515
27 3.2370726 5.8239930
28 1.6871909 3.2370726
29 -0.3565720 1.6871909
30 -0.1998003 -0.3565720
31 1.7052041 -0.1998003
32 -3.6716866 1.7052041
33 -0.4033830 -3.6716866
34 -2.8490369 -0.4033830
35 -2.2542516 -2.8490369
36 -2.5471924 -2.2542516
37 1.1474982 -2.5471924
38 -2.1044881 1.1474982
39 1.3181072 -2.1044881
40 3.5655799 1.3181072
41 -0.3225462 3.5655799
> 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/7q0gz1292084258.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/8q0gz1292084258.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/9jrx21292084258.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/10b0e51292084258.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/11maeq1292084258.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/127suw1292084258.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/13wt9q1292084258.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/14zc8e1292084258.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/15sl7h1292084258.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/16ov5p1292084258.tab")
+ }
>
> try(system("convert tmp/1c8iq1292084258.ps tmp/1c8iq1292084258.png",intern=TRUE))
character(0)
> try(system("convert tmp/24hzb1292084258.ps tmp/24hzb1292084258.png",intern=TRUE))
character(0)
> try(system("convert tmp/34hzb1292084258.ps tmp/34hzb1292084258.png",intern=TRUE))
character(0)
> try(system("convert tmp/4frze1292084258.ps tmp/4frze1292084258.png",intern=TRUE))
character(0)
> try(system("convert tmp/5frze1292084258.ps tmp/5frze1292084258.png",intern=TRUE))
character(0)
> try(system("convert tmp/6frze1292084258.ps tmp/6frze1292084258.png",intern=TRUE))
character(0)
> try(system("convert tmp/7q0gz1292084258.ps tmp/7q0gz1292084258.png",intern=TRUE))
character(0)
> try(system("convert tmp/8q0gz1292084258.ps tmp/8q0gz1292084258.png",intern=TRUE))
character(0)
> try(system("convert tmp/9jrx21292084258.ps tmp/9jrx21292084258.png",intern=TRUE))
character(0)
> try(system("convert tmp/10b0e51292084258.ps tmp/10b0e51292084258.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.930 1.610 4.535