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(100.03,2,100.25,1.8,99.6,2.7,100.16,2.3,100.49,1.9,99.72,2,100.14,2.3,98.48,2.8,100.38,2.4,101.45,2.3,98.42,2.7,98.6,2.7,100.06,2.9,98.62,3,100.84,2.2,100.02,2.3,97.95,2.8,98.32,2.8,98.27,2.8,97.22,2.2,99.28,2.6,100.38,2.8,99.02,2.5,100.32,2.4,99.81,2.3,100.6,1.9,101.19,1.7,100.47,2,101.77,2.1,102.32,1.7,102.39,1.8,101.16,1.8,100.63,1.8,101.48,1.3,101.44,1.3,100.09,1.3,100.7,1.2,100.78,1.4,99.81,2.2,98.45,2.9,98.49,3.1,97.48,3.5,97.91,3.6,96.94,4.4,98.53,4.1,96.82,5.1,95.76,5.8,95.27,5.9,97.32,5.4,96.68,5.5,97.87,4.8,97.42,3.2,97.94,2.7,99.52,2.1,100.99,1.9,99.92,0.6,101.97,0.7,101.58,-0.2,99.54,-1,100.83,-1.7),dim=c(2,60),dimnames=list(c('Y','X'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Y','X'),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
Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 100.03 2.0 1 0 0 0 0 0 0 0 0 0 0
2 100.25 1.8 0 1 0 0 0 0 0 0 0 0 0
3 99.60 2.7 0 0 1 0 0 0 0 0 0 0 0
4 100.16 2.3 0 0 0 1 0 0 0 0 0 0 0
5 100.49 1.9 0 0 0 0 1 0 0 0 0 0 0
6 99.72 2.0 0 0 0 0 0 1 0 0 0 0 0
7 100.14 2.3 0 0 0 0 0 0 1 0 0 0 0
8 98.48 2.8 0 0 0 0 0 0 0 1 0 0 0
9 100.38 2.4 0 0 0 0 0 0 0 0 1 0 0
10 101.45 2.3 0 0 0 0 0 0 0 0 0 1 0
11 98.42 2.7 0 0 0 0 0 0 0 0 0 0 1
12 98.60 2.7 0 0 0 0 0 0 0 0 0 0 0
13 100.06 2.9 1 0 0 0 0 0 0 0 0 0 0
14 98.62 3.0 0 1 0 0 0 0 0 0 0 0 0
15 100.84 2.2 0 0 1 0 0 0 0 0 0 0 0
16 100.02 2.3 0 0 0 1 0 0 0 0 0 0 0
17 97.95 2.8 0 0 0 0 1 0 0 0 0 0 0
18 98.32 2.8 0 0 0 0 0 1 0 0 0 0 0
19 98.27 2.8 0 0 0 0 0 0 1 0 0 0 0
20 97.22 2.2 0 0 0 0 0 0 0 1 0 0 0
21 99.28 2.6 0 0 0 0 0 0 0 0 1 0 0
22 100.38 2.8 0 0 0 0 0 0 0 0 0 1 0
23 99.02 2.5 0 0 0 0 0 0 0 0 0 0 1
24 100.32 2.4 0 0 0 0 0 0 0 0 0 0 0
25 99.81 2.3 1 0 0 0 0 0 0 0 0 0 0
26 100.60 1.9 0 1 0 0 0 0 0 0 0 0 0
27 101.19 1.7 0 0 1 0 0 0 0 0 0 0 0
28 100.47 2.0 0 0 0 1 0 0 0 0 0 0 0
29 101.77 2.1 0 0 0 0 1 0 0 0 0 0 0
30 102.32 1.7 0 0 0 0 0 1 0 0 0 0 0
31 102.39 1.8 0 0 0 0 0 0 1 0 0 0 0
32 101.16 1.8 0 0 0 0 0 0 0 1 0 0 0
33 100.63 1.8 0 0 0 0 0 0 0 0 1 0 0
34 101.48 1.3 0 0 0 0 0 0 0 0 0 1 0
35 101.44 1.3 0 0 0 0 0 0 0 0 0 0 1
36 100.09 1.3 0 0 0 0 0 0 0 0 0 0 0
37 100.70 1.2 1 0 0 0 0 0 0 0 0 0 0
38 100.78 1.4 0 1 0 0 0 0 0 0 0 0 0
39 99.81 2.2 0 0 1 0 0 0 0 0 0 0 0
40 98.45 2.9 0 0 0 1 0 0 0 0 0 0 0
41 98.49 3.1 0 0 0 0 1 0 0 0 0 0 0
42 97.48 3.5 0 0 0 0 0 1 0 0 0 0 0
43 97.91 3.6 0 0 0 0 0 0 1 0 0 0 0
44 96.94 4.4 0 0 0 0 0 0 0 1 0 0 0
45 98.53 4.1 0 0 0 0 0 0 0 0 1 0 0
46 96.82 5.1 0 0 0 0 0 0 0 0 0 1 0
47 95.76 5.8 0 0 0 0 0 0 0 0 0 0 1
48 95.27 5.9 0 0 0 0 0 0 0 0 0 0 0
49 97.32 5.4 1 0 0 0 0 0 0 0 0 0 0
50 96.68 5.5 0 1 0 0 0 0 0 0 0 0 0
51 97.87 4.8 0 0 1 0 0 0 0 0 0 0 0
52 97.42 3.2 0 0 0 1 0 0 0 0 0 0 0
53 97.94 2.7 0 0 0 0 1 0 0 0 0 0 0
54 99.52 2.1 0 0 0 0 0 1 0 0 0 0 0
55 100.99 1.9 0 0 0 0 0 0 1 0 0 0 0
56 99.92 0.6 0 0 0 0 0 0 0 1 0 0 0
57 101.97 0.7 0 0 0 0 0 0 0 0 1 0 0
58 101.58 -0.2 0 0 0 0 0 0 0 0 0 1 0
59 99.54 -1.0 0 0 0 0 0 0 0 0 0 0 1
60 100.83 -1.7 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) X M1 M2 M3 M4
100.93786 -0.90371 1.14037 0.90622 1.38222 0.66156
M5 M6 M7 M8 M9 M10
0.66748 0.72111 1.24333 -0.06111 1.31674 1.44652
M11
-0.05948
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-2.24209 -0.51520 0.01733 0.47950 2.19733
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 100.93786 0.50334 200.536 < 2e-16 ***
X -0.90371 0.09529 -9.484 1.72e-12 ***
M1 1.14037 0.65483 1.741 0.0881 .
M2 0.90622 0.65449 1.385 0.1727
M3 1.38222 0.65449 2.112 0.0400 *
M4 0.66156 0.65321 1.013 0.3164
M5 0.66748 0.65310 1.022 0.3120
M6 0.72111 0.65261 1.105 0.2748
M7 1.24333 0.65289 1.904 0.0630 .
M8 -0.06111 0.65239 -0.094 0.9258
M9 1.31674 0.65226 2.019 0.0492 *
M10 1.44652 0.65212 2.218 0.0314 *
M11 -0.05948 0.65212 -0.091 0.9277
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.031 on 47 degrees of freedom
Multiple R-squared: 0.6869, Adjusted R-squared: 0.6069
F-statistic: 8.591 on 12 and 47 DF, p-value: 2.566e-08
> 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.093377256 0.18675451 0.9066227
[2,] 0.128343192 0.25668638 0.8716568
[3,] 0.060980634 0.12196127 0.9390194
[4,] 0.056675941 0.11335188 0.9433241
[5,] 0.167555224 0.33511045 0.8324448
[6,] 0.119938375 0.23987675 0.8800616
[7,] 0.075775732 0.15155146 0.9242243
[8,] 0.043251280 0.08650256 0.9567487
[9,] 0.052761823 0.10552365 0.9472382
[10,] 0.031289822 0.06257964 0.9687102
[11,] 0.017818311 0.03563662 0.9821817
[12,] 0.009452186 0.01890437 0.9905478
[13,] 0.005915398 0.01183080 0.9940846
[14,] 0.047196639 0.09439328 0.9528034
[15,] 0.181854679 0.36370936 0.8181453
[16,] 0.301158268 0.60231654 0.6988417
[17,] 0.473421266 0.94684253 0.5265787
[18,] 0.396521078 0.79304216 0.6034789
[19,] 0.493648510 0.98729702 0.5063515
[20,] 0.831659114 0.33668177 0.1683409
[21,] 0.899017117 0.20196577 0.1009829
[22,] 0.861632026 0.27673595 0.1383680
[23,] 0.830357880 0.33928424 0.1696421
[24,] 0.751528171 0.49694366 0.2484718
[25,] 0.691369985 0.61726003 0.3086300
[26,] 0.620353883 0.75929223 0.3796461
[27,] 0.559848203 0.88030359 0.4401518
[28,] 0.732549256 0.53490149 0.2674507
[29,] 0.591623035 0.81675393 0.4083770
> postscript(file="/var/www/html/rcomp/tmp/19tbj1258702879.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/2e3am1258702879.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/3e37h1258702879.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/4oox71258702879.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/5f3jk1258702879.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.240818278 0.032588400 -0.280074165 0.639110017 0.601700878 -0.131557469
7 8 9 10 11 12
0.037332513 0.133631635 0.294296661 1.144148330 -0.018368365 0.102150791
13 14 15 16 17 18
0.602519156 -0.512961687 0.508071704 0.499110017 -1.124961687 -0.808590861
19 20 21 22 23 24
-1.380813357 -1.668593322 -0.624961687 0.526002461 0.400889983 1.551038313
25 26 27 28 29 30
-0.189705800 0.472959226 0.406217574 0.677997539 2.062442531 2.197330052
31 32 33 34 35 36
1.835478383 1.909923374 0.002071704 0.270440070 1.736440070 0.326959226
37 38 39 40 41 42
-0.293784887 0.201105096 -0.521928296 -0.528665026 -0.313849209 -1.015995078
43 44 45 46 47 48
-1.017846748 0.039564852 -0.019399296 -0.955468540 0.123127243 -0.335982775
49 50 51 52 53 54
0.121789808 -0.193691035 -0.112286818 -1.287552548 -1.225332513 -0.241186643
55 56 57 58 59 60
0.525849209 -0.414526539 0.347992618 -0.985122321 -2.242088930 -1.644165556
> postscript(file="/var/www/html/rcomp/tmp/6xg061258702879.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.240818278 NA
1 0.032588400 -0.240818278
2 -0.280074165 0.032588400
3 0.639110017 -0.280074165
4 0.601700878 0.639110017
5 -0.131557469 0.601700878
6 0.037332513 -0.131557469
7 0.133631635 0.037332513
8 0.294296661 0.133631635
9 1.144148330 0.294296661
10 -0.018368365 1.144148330
11 0.102150791 -0.018368365
12 0.602519156 0.102150791
13 -0.512961687 0.602519156
14 0.508071704 -0.512961687
15 0.499110017 0.508071704
16 -1.124961687 0.499110017
17 -0.808590861 -1.124961687
18 -1.380813357 -0.808590861
19 -1.668593322 -1.380813357
20 -0.624961687 -1.668593322
21 0.526002461 -0.624961687
22 0.400889983 0.526002461
23 1.551038313 0.400889983
24 -0.189705800 1.551038313
25 0.472959226 -0.189705800
26 0.406217574 0.472959226
27 0.677997539 0.406217574
28 2.062442531 0.677997539
29 2.197330052 2.062442531
30 1.835478383 2.197330052
31 1.909923374 1.835478383
32 0.002071704 1.909923374
33 0.270440070 0.002071704
34 1.736440070 0.270440070
35 0.326959226 1.736440070
36 -0.293784887 0.326959226
37 0.201105096 -0.293784887
38 -0.521928296 0.201105096
39 -0.528665026 -0.521928296
40 -0.313849209 -0.528665026
41 -1.015995078 -0.313849209
42 -1.017846748 -1.015995078
43 0.039564852 -1.017846748
44 -0.019399296 0.039564852
45 -0.955468540 -0.019399296
46 0.123127243 -0.955468540
47 -0.335982775 0.123127243
48 0.121789808 -0.335982775
49 -0.193691035 0.121789808
50 -0.112286818 -0.193691035
51 -1.287552548 -0.112286818
52 -1.225332513 -1.287552548
53 -0.241186643 -1.225332513
54 0.525849209 -0.241186643
55 -0.414526539 0.525849209
56 0.347992618 -0.414526539
57 -0.985122321 0.347992618
58 -2.242088930 -0.985122321
59 -1.644165556 -2.242088930
60 NA -1.644165556
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.032588400 -0.240818278
[2,] -0.280074165 0.032588400
[3,] 0.639110017 -0.280074165
[4,] 0.601700878 0.639110017
[5,] -0.131557469 0.601700878
[6,] 0.037332513 -0.131557469
[7,] 0.133631635 0.037332513
[8,] 0.294296661 0.133631635
[9,] 1.144148330 0.294296661
[10,] -0.018368365 1.144148330
[11,] 0.102150791 -0.018368365
[12,] 0.602519156 0.102150791
[13,] -0.512961687 0.602519156
[14,] 0.508071704 -0.512961687
[15,] 0.499110017 0.508071704
[16,] -1.124961687 0.499110017
[17,] -0.808590861 -1.124961687
[18,] -1.380813357 -0.808590861
[19,] -1.668593322 -1.380813357
[20,] -0.624961687 -1.668593322
[21,] 0.526002461 -0.624961687
[22,] 0.400889983 0.526002461
[23,] 1.551038313 0.400889983
[24,] -0.189705800 1.551038313
[25,] 0.472959226 -0.189705800
[26,] 0.406217574 0.472959226
[27,] 0.677997539 0.406217574
[28,] 2.062442531 0.677997539
[29,] 2.197330052 2.062442531
[30,] 1.835478383 2.197330052
[31,] 1.909923374 1.835478383
[32,] 0.002071704 1.909923374
[33,] 0.270440070 0.002071704
[34,] 1.736440070 0.270440070
[35,] 0.326959226 1.736440070
[36,] -0.293784887 0.326959226
[37,] 0.201105096 -0.293784887
[38,] -0.521928296 0.201105096
[39,] -0.528665026 -0.521928296
[40,] -0.313849209 -0.528665026
[41,] -1.015995078 -0.313849209
[42,] -1.017846748 -1.015995078
[43,] 0.039564852 -1.017846748
[44,] -0.019399296 0.039564852
[45,] -0.955468540 -0.019399296
[46,] 0.123127243 -0.955468540
[47,] -0.335982775 0.123127243
[48,] 0.121789808 -0.335982775
[49,] -0.193691035 0.121789808
[50,] -0.112286818 -0.193691035
[51,] -1.287552548 -0.112286818
[52,] -1.225332513 -1.287552548
[53,] -0.241186643 -1.225332513
[54,] 0.525849209 -0.241186643
[55,] -0.414526539 0.525849209
[56,] 0.347992618 -0.414526539
[57,] -0.985122321 0.347992618
[58,] -2.242088930 -0.985122321
[59,] -1.644165556 -2.242088930
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.032588400 -0.240818278
2 -0.280074165 0.032588400
3 0.639110017 -0.280074165
4 0.601700878 0.639110017
5 -0.131557469 0.601700878
6 0.037332513 -0.131557469
7 0.133631635 0.037332513
8 0.294296661 0.133631635
9 1.144148330 0.294296661
10 -0.018368365 1.144148330
11 0.102150791 -0.018368365
12 0.602519156 0.102150791
13 -0.512961687 0.602519156
14 0.508071704 -0.512961687
15 0.499110017 0.508071704
16 -1.124961687 0.499110017
17 -0.808590861 -1.124961687
18 -1.380813357 -0.808590861
19 -1.668593322 -1.380813357
20 -0.624961687 -1.668593322
21 0.526002461 -0.624961687
22 0.400889983 0.526002461
23 1.551038313 0.400889983
24 -0.189705800 1.551038313
25 0.472959226 -0.189705800
26 0.406217574 0.472959226
27 0.677997539 0.406217574
28 2.062442531 0.677997539
29 2.197330052 2.062442531
30 1.835478383 2.197330052
31 1.909923374 1.835478383
32 0.002071704 1.909923374
33 0.270440070 0.002071704
34 1.736440070 0.270440070
35 0.326959226 1.736440070
36 -0.293784887 0.326959226
37 0.201105096 -0.293784887
38 -0.521928296 0.201105096
39 -0.528665026 -0.521928296
40 -0.313849209 -0.528665026
41 -1.015995078 -0.313849209
42 -1.017846748 -1.015995078
43 0.039564852 -1.017846748
44 -0.019399296 0.039564852
45 -0.955468540 -0.019399296
46 0.123127243 -0.955468540
47 -0.335982775 0.123127243
48 0.121789808 -0.335982775
49 -0.193691035 0.121789808
50 -0.112286818 -0.193691035
51 -1.287552548 -0.112286818
52 -1.225332513 -1.287552548
53 -0.241186643 -1.225332513
54 0.525849209 -0.241186643
55 -0.414526539 0.525849209
56 0.347992618 -0.414526539
57 -0.985122321 0.347992618
58 -2.242088930 -0.985122321
59 -1.644165556 -2.242088930
> 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/70ovh1258702879.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/8yerv1258702879.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/9hpn31258702879.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/10rqku1258702879.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/11fstt1258702879.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/12kq6g1258702879.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/13pl0m1258702879.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/14sxr21258702879.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/15edy81258702879.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/16b6l21258702879.tab")
+ }
>
> system("convert tmp/19tbj1258702879.ps tmp/19tbj1258702879.png")
> system("convert tmp/2e3am1258702879.ps tmp/2e3am1258702879.png")
> system("convert tmp/3e37h1258702879.ps tmp/3e37h1258702879.png")
> system("convert tmp/4oox71258702879.ps tmp/4oox71258702879.png")
> system("convert tmp/5f3jk1258702879.ps tmp/5f3jk1258702879.png")
> system("convert tmp/6xg061258702879.ps tmp/6xg061258702879.png")
> system("convert tmp/70ovh1258702879.ps tmp/70ovh1258702879.png")
> system("convert tmp/8yerv1258702879.ps tmp/8yerv1258702879.png")
> system("convert tmp/9hpn31258702879.ps tmp/9hpn31258702879.png")
> system("convert tmp/10rqku1258702879.ps tmp/10rqku1258702879.png")
>
>
> proc.time()
user system elapsed
2.340 1.510 3.768