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(8.9,1.6,8.8,1.3,8.3,1.1,7.5,1.6,7.2,1.9,7.4,1.6,8.8,1.7,9.3,1.6,9.3,1.4,8.7,2.1,8.2,1.9,8.3,1.7,8.5,1.8,8.6,2,8.5,2.5,8.2,2.1,8.1,2.1,7.9,2.3,8.6,2.4,8.7,2.4,8.7,2.3,8.5,1.7,8.4,2,8.5,2.3,8.7,2,8.7,2,8.6,1.3,8.5,1.7,8.3,1.9,8,1.7,8.2,1.6,8.1,1.7,8.1,1.8,8,1.9,7.9,1.9,7.9,1.9,8,2,8,2.1,7.9,1.9,8,1.9,7.7,1.3,7.2,1.3,7.5,1.4,7.3,1.2,7,1.3,7,1.8,7,2.2,7.2,2.6,7.3,2.8,7.1,3.1,6.8,3.9,6.4,3.7,6.1,4.6,6.5,5.1,7.7,5.2,7.9,4.9,7.5,5.1,6.9,4.8,6.6,3.9,6.9,3.5),dim=c(2,60),dimnames=list(c('TWIB','GI'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('TWIB','GI'),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 = 'Include Monthly 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
TWIB GI M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 8.9 1.6 1 0 0 0 0 0 0 0 0 0 0
2 8.8 1.3 0 1 0 0 0 0 0 0 0 0 0
3 8.3 1.1 0 0 1 0 0 0 0 0 0 0 0
4 7.5 1.6 0 0 0 1 0 0 0 0 0 0 0
5 7.2 1.9 0 0 0 0 1 0 0 0 0 0 0
6 7.4 1.6 0 0 0 0 0 1 0 0 0 0 0
7 8.8 1.7 0 0 0 0 0 0 1 0 0 0 0
8 9.3 1.6 0 0 0 0 0 0 0 1 0 0 0
9 9.3 1.4 0 0 0 0 0 0 0 0 1 0 0
10 8.7 2.1 0 0 0 0 0 0 0 0 0 1 0
11 8.2 1.9 0 0 0 0 0 0 0 0 0 0 1
12 8.3 1.7 0 0 0 0 0 0 0 0 0 0 0
13 8.5 1.8 1 0 0 0 0 0 0 0 0 0 0
14 8.6 2.0 0 1 0 0 0 0 0 0 0 0 0
15 8.5 2.5 0 0 1 0 0 0 0 0 0 0 0
16 8.2 2.1 0 0 0 1 0 0 0 0 0 0 0
17 8.1 2.1 0 0 0 0 1 0 0 0 0 0 0
18 7.9 2.3 0 0 0 0 0 1 0 0 0 0 0
19 8.6 2.4 0 0 0 0 0 0 1 0 0 0 0
20 8.7 2.4 0 0 0 0 0 0 0 1 0 0 0
21 8.7 2.3 0 0 0 0 0 0 0 0 1 0 0
22 8.5 1.7 0 0 0 0 0 0 0 0 0 1 0
23 8.4 2.0 0 0 0 0 0 0 0 0 0 0 1
24 8.5 2.3 0 0 0 0 0 0 0 0 0 0 0
25 8.7 2.0 1 0 0 0 0 0 0 0 0 0 0
26 8.7 2.0 0 1 0 0 0 0 0 0 0 0 0
27 8.6 1.3 0 0 1 0 0 0 0 0 0 0 0
28 8.5 1.7 0 0 0 1 0 0 0 0 0 0 0
29 8.3 1.9 0 0 0 0 1 0 0 0 0 0 0
30 8.0 1.7 0 0 0 0 0 1 0 0 0 0 0
31 8.2 1.6 0 0 0 0 0 0 1 0 0 0 0
32 8.1 1.7 0 0 0 0 0 0 0 1 0 0 0
33 8.1 1.8 0 0 0 0 0 0 0 0 1 0 0
34 8.0 1.9 0 0 0 0 0 0 0 0 0 1 0
35 7.9 1.9 0 0 0 0 0 0 0 0 0 0 1
36 7.9 1.9 0 0 0 0 0 0 0 0 0 0 0
37 8.0 2.0 1 0 0 0 0 0 0 0 0 0 0
38 8.0 2.1 0 1 0 0 0 0 0 0 0 0 0
39 7.9 1.9 0 0 1 0 0 0 0 0 0 0 0
40 8.0 1.9 0 0 0 1 0 0 0 0 0 0 0
41 7.7 1.3 0 0 0 0 1 0 0 0 0 0 0
42 7.2 1.3 0 0 0 0 0 1 0 0 0 0 0
43 7.5 1.4 0 0 0 0 0 0 1 0 0 0 0
44 7.3 1.2 0 0 0 0 0 0 0 1 0 0 0
45 7.0 1.3 0 0 0 0 0 0 0 0 1 0 0
46 7.0 1.8 0 0 0 0 0 0 0 0 0 1 0
47 7.0 2.2 0 0 0 0 0 0 0 0 0 0 1
48 7.2 2.6 0 0 0 0 0 0 0 0 0 0 0
49 7.3 2.8 1 0 0 0 0 0 0 0 0 0 0
50 7.1 3.1 0 1 0 0 0 0 0 0 0 0 0
51 6.8 3.9 0 0 1 0 0 0 0 0 0 0 0
52 6.4 3.7 0 0 0 1 0 0 0 0 0 0 0
53 6.1 4.6 0 0 0 0 1 0 0 0 0 0 0
54 6.5 5.1 0 0 0 0 0 1 0 0 0 0 0
55 7.7 5.2 0 0 0 0 0 0 1 0 0 0 0
56 7.9 4.9 0 0 0 0 0 0 0 1 0 0 0
57 7.5 5.1 0 0 0 0 0 0 0 0 1 0 0
58 6.9 4.8 0 0 0 0 0 0 0 0 0 1 0
59 6.6 3.9 0 0 0 0 0 0 0 0 0 0 1
60 6.9 3.5 0 0 0 0 0 0 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) GI M1 M2 M3 M4
8.60764 -0.35318 0.39285 0.37405 0.16817 -0.11064
M5 M6 M7 M8 M9 M10
-0.29413 -0.36000 0.42119 0.48587 0.35294 0.08119
M11
-0.14706
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.5014 -0.4345 0.1229 0.4470 0.8339
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 8.60764 0.33787 25.476 < 2e-16 ***
GI -0.35318 0.07707 -4.583 3.39e-05 ***
M1 0.39285 0.40084 0.980 0.332
M2 0.37405 0.40054 0.934 0.355
M3 0.16817 0.40038 0.420 0.676
M4 -0.11064 0.40017 -0.276 0.783
M5 -0.29413 0.39989 -0.736 0.466
M6 -0.36000 0.39987 -0.900 0.373
M7 0.42119 0.39990 1.053 0.298
M8 0.48587 0.39989 1.215 0.230
M9 0.35294 0.39988 0.883 0.382
M10 0.08119 0.39990 0.203 0.840
M11 -0.14706 0.39988 -0.368 0.715
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.6323 on 47 degrees of freedom
Multiple R-squared: 0.4236, Adjusted R-squared: 0.2765
F-statistic: 2.879 on 12 and 47 DF, p-value: 0.004729
> 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.137131864 0.27426373 0.8628681
[2,] 0.183265914 0.36653183 0.8167341
[3,] 0.106944310 0.21388862 0.8930557
[4,] 0.065636318 0.13127264 0.9343637
[5,] 0.067872793 0.13574559 0.9321272
[6,] 0.063376721 0.12675344 0.9366233
[7,] 0.039984051 0.07996810 0.9600159
[8,] 0.027292043 0.05458409 0.9727080
[9,] 0.019594349 0.03918870 0.9804057
[10,] 0.012297128 0.02459426 0.9877029
[11,] 0.008140740 0.01628148 0.9918593
[12,] 0.005512913 0.01102583 0.9944871
[13,] 0.010362855 0.02072571 0.9896371
[14,] 0.021319892 0.04263978 0.9786801
[15,] 0.020105447 0.04021089 0.9798946
[16,] 0.017106550 0.03421310 0.9828935
[17,] 0.027598059 0.05519612 0.9724019
[18,] 0.043388197 0.08677639 0.9566118
[19,] 0.051120578 0.10224116 0.9488794
[20,] 0.059211810 0.11842362 0.9407882
[21,] 0.059143820 0.11828764 0.9408562
[22,] 0.062404376 0.12480875 0.9375956
[23,] 0.072144167 0.14428833 0.9278558
[24,] 0.082705821 0.16541164 0.9172942
[25,] 0.202769508 0.40553902 0.7972305
[26,] 0.667403000 0.66519400 0.3325970
[27,] 0.852162566 0.29567487 0.1478374
[28,] 0.781878130 0.43624374 0.2181219
[29,] 0.777428404 0.44514319 0.2225716
> postscript(file="/var/www/html/rcomp/tmp/11nxh1258756729.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/2ka9w1258756729.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/307gq1258756729.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/4wuql1258756729.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/5u2je1258756729.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 60
Frequency = 1
1 2 3 4 5 6
0.46459975 0.27745409 -0.08730968 -0.43190943 -0.44246390 -0.28254591
7 8 9 10 11 12
0.37158139 0.77158139 0.83388126 0.75285434 0.41047245 0.29277233
13 14 15 16 17 18
0.13523623 0.32468176 0.60714566 0.44468176 0.52817258 0.46468176
19 20 21 22 23 24
0.41880906 0.45412730 0.55174541 0.41158139 0.64579069 0.70468176
25 26 27 28 29 30
0.40587270 0.42468176 0.28332680 0.60340881 0.65753610 0.35277233
31 32 33 34 35 36
-0.26373685 -0.39310037 -0.22484578 -0.01778214 0.11047245 -0.03659119
37 38 39 40 41 42
-0.29412730 -0.24000000 -0.20476377 0.17404528 -0.15437333 -0.58850062
43 44 45 46 47 48
-1.03437333 -1.36969157 -1.50143698 -1.05310037 -0.68357283 -0.48936352
49 50 51 52 53 54
-0.71158139 -0.78681761 -0.59839900 -0.79022642 -0.58887146 0.05359244
55 56 57 58 59 60
0.50771974 0.53708326 0.34065609 -0.09355322 -0.48316277 -0.47149938
> postscript(file="/var/www/html/rcomp/tmp/6upn21258756729.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 0.46459975 NA
1 0.27745409 0.46459975
2 -0.08730968 0.27745409
3 -0.43190943 -0.08730968
4 -0.44246390 -0.43190943
5 -0.28254591 -0.44246390
6 0.37158139 -0.28254591
7 0.77158139 0.37158139
8 0.83388126 0.77158139
9 0.75285434 0.83388126
10 0.41047245 0.75285434
11 0.29277233 0.41047245
12 0.13523623 0.29277233
13 0.32468176 0.13523623
14 0.60714566 0.32468176
15 0.44468176 0.60714566
16 0.52817258 0.44468176
17 0.46468176 0.52817258
18 0.41880906 0.46468176
19 0.45412730 0.41880906
20 0.55174541 0.45412730
21 0.41158139 0.55174541
22 0.64579069 0.41158139
23 0.70468176 0.64579069
24 0.40587270 0.70468176
25 0.42468176 0.40587270
26 0.28332680 0.42468176
27 0.60340881 0.28332680
28 0.65753610 0.60340881
29 0.35277233 0.65753610
30 -0.26373685 0.35277233
31 -0.39310037 -0.26373685
32 -0.22484578 -0.39310037
33 -0.01778214 -0.22484578
34 0.11047245 -0.01778214
35 -0.03659119 0.11047245
36 -0.29412730 -0.03659119
37 -0.24000000 -0.29412730
38 -0.20476377 -0.24000000
39 0.17404528 -0.20476377
40 -0.15437333 0.17404528
41 -0.58850062 -0.15437333
42 -1.03437333 -0.58850062
43 -1.36969157 -1.03437333
44 -1.50143698 -1.36969157
45 -1.05310037 -1.50143698
46 -0.68357283 -1.05310037
47 -0.48936352 -0.68357283
48 -0.71158139 -0.48936352
49 -0.78681761 -0.71158139
50 -0.59839900 -0.78681761
51 -0.79022642 -0.59839900
52 -0.58887146 -0.79022642
53 0.05359244 -0.58887146
54 0.50771974 0.05359244
55 0.53708326 0.50771974
56 0.34065609 0.53708326
57 -0.09355322 0.34065609
58 -0.48316277 -0.09355322
59 -0.47149938 -0.48316277
60 NA -0.47149938
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.27745409 0.46459975
[2,] -0.08730968 0.27745409
[3,] -0.43190943 -0.08730968
[4,] -0.44246390 -0.43190943
[5,] -0.28254591 -0.44246390
[6,] 0.37158139 -0.28254591
[7,] 0.77158139 0.37158139
[8,] 0.83388126 0.77158139
[9,] 0.75285434 0.83388126
[10,] 0.41047245 0.75285434
[11,] 0.29277233 0.41047245
[12,] 0.13523623 0.29277233
[13,] 0.32468176 0.13523623
[14,] 0.60714566 0.32468176
[15,] 0.44468176 0.60714566
[16,] 0.52817258 0.44468176
[17,] 0.46468176 0.52817258
[18,] 0.41880906 0.46468176
[19,] 0.45412730 0.41880906
[20,] 0.55174541 0.45412730
[21,] 0.41158139 0.55174541
[22,] 0.64579069 0.41158139
[23,] 0.70468176 0.64579069
[24,] 0.40587270 0.70468176
[25,] 0.42468176 0.40587270
[26,] 0.28332680 0.42468176
[27,] 0.60340881 0.28332680
[28,] 0.65753610 0.60340881
[29,] 0.35277233 0.65753610
[30,] -0.26373685 0.35277233
[31,] -0.39310037 -0.26373685
[32,] -0.22484578 -0.39310037
[33,] -0.01778214 -0.22484578
[34,] 0.11047245 -0.01778214
[35,] -0.03659119 0.11047245
[36,] -0.29412730 -0.03659119
[37,] -0.24000000 -0.29412730
[38,] -0.20476377 -0.24000000
[39,] 0.17404528 -0.20476377
[40,] -0.15437333 0.17404528
[41,] -0.58850062 -0.15437333
[42,] -1.03437333 -0.58850062
[43,] -1.36969157 -1.03437333
[44,] -1.50143698 -1.36969157
[45,] -1.05310037 -1.50143698
[46,] -0.68357283 -1.05310037
[47,] -0.48936352 -0.68357283
[48,] -0.71158139 -0.48936352
[49,] -0.78681761 -0.71158139
[50,] -0.59839900 -0.78681761
[51,] -0.79022642 -0.59839900
[52,] -0.58887146 -0.79022642
[53,] 0.05359244 -0.58887146
[54,] 0.50771974 0.05359244
[55,] 0.53708326 0.50771974
[56,] 0.34065609 0.53708326
[57,] -0.09355322 0.34065609
[58,] -0.48316277 -0.09355322
[59,] -0.47149938 -0.48316277
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.27745409 0.46459975
2 -0.08730968 0.27745409
3 -0.43190943 -0.08730968
4 -0.44246390 -0.43190943
5 -0.28254591 -0.44246390
6 0.37158139 -0.28254591
7 0.77158139 0.37158139
8 0.83388126 0.77158139
9 0.75285434 0.83388126
10 0.41047245 0.75285434
11 0.29277233 0.41047245
12 0.13523623 0.29277233
13 0.32468176 0.13523623
14 0.60714566 0.32468176
15 0.44468176 0.60714566
16 0.52817258 0.44468176
17 0.46468176 0.52817258
18 0.41880906 0.46468176
19 0.45412730 0.41880906
20 0.55174541 0.45412730
21 0.41158139 0.55174541
22 0.64579069 0.41158139
23 0.70468176 0.64579069
24 0.40587270 0.70468176
25 0.42468176 0.40587270
26 0.28332680 0.42468176
27 0.60340881 0.28332680
28 0.65753610 0.60340881
29 0.35277233 0.65753610
30 -0.26373685 0.35277233
31 -0.39310037 -0.26373685
32 -0.22484578 -0.39310037
33 -0.01778214 -0.22484578
34 0.11047245 -0.01778214
35 -0.03659119 0.11047245
36 -0.29412730 -0.03659119
37 -0.24000000 -0.29412730
38 -0.20476377 -0.24000000
39 0.17404528 -0.20476377
40 -0.15437333 0.17404528
41 -0.58850062 -0.15437333
42 -1.03437333 -0.58850062
43 -1.36969157 -1.03437333
44 -1.50143698 -1.36969157
45 -1.05310037 -1.50143698
46 -0.68357283 -1.05310037
47 -0.48936352 -0.68357283
48 -0.71158139 -0.48936352
49 -0.78681761 -0.71158139
50 -0.59839900 -0.78681761
51 -0.79022642 -0.59839900
52 -0.58887146 -0.79022642
53 0.05359244 -0.58887146
54 0.50771974 0.05359244
55 0.53708326 0.50771974
56 0.34065609 0.53708326
57 -0.09355322 0.34065609
58 -0.48316277 -0.09355322
59 -0.47149938 -0.48316277
> 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/7ez4z1258756729.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/8dnei1258756729.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/9xs4c1258756729.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/www/html/rcomp/tmp/10u2fa1258756729.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/rcomp/createtable")
>
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE)
> a<-table.row.end(a)
> myeq <- colnames(x)[1]
> myeq <- paste(myeq, '[t] = ', sep='')
> for (i in 1:k){
+ if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '')
+ myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ')
+ if (rownames(mysum$coefficients)[i] != '(Intercept)') {
+ myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='')
+ if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='')
+ }
+ }
> myeq <- paste(myeq, ' + e[t]')
> a<-table.row.start(a)
> a<-table.element(a, myeq)
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/115qt31258756729.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/12153f1258756729.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/13axau1258756729.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/144rdj1258756729.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/158aj81258756729.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/160o521258756729.tab")
+ }
>
> system("convert tmp/11nxh1258756729.ps tmp/11nxh1258756729.png")
> system("convert tmp/2ka9w1258756729.ps tmp/2ka9w1258756729.png")
> system("convert tmp/307gq1258756729.ps tmp/307gq1258756729.png")
> system("convert tmp/4wuql1258756729.ps tmp/4wuql1258756729.png")
> system("convert tmp/5u2je1258756729.ps tmp/5u2je1258756729.png")
> system("convert tmp/6upn21258756729.ps tmp/6upn21258756729.png")
> system("convert tmp/7ez4z1258756729.ps tmp/7ez4z1258756729.png")
> system("convert tmp/8dnei1258756729.ps tmp/8dnei1258756729.png")
> system("convert tmp/9xs4c1258756729.ps tmp/9xs4c1258756729.png")
> system("convert tmp/10u2fa1258756729.ps tmp/10u2fa1258756729.png")
>
>
> proc.time()
user system elapsed
2.410 1.545 2.821