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(104.08,99.2,103.86,93.6,107.47,104.2,111.1,95.3,117.33,102.7,119.04,103.1,123.68,100,125.9,107.2,124.54,107,119.39,119,118.8,110.4,114.81,101.7,117.9,102.4,120.53,98.8,125.15,105.6,126.49,104.4,131.85,106.3,127.4,107.2,131.08,108.5,122.37,106.9,124.34,114.2,119.61,125.9,119.97,110.6,116.46,110.5,117.03,106.7,120.96,104.7,124.71,107.4,127.08,109.8,131.91,103.4,137.69,114.8,142.46,114.3,144.32,109.6,138.06,118.3,124.45,127.3,126.71,112.3,121.83,114.9,122.51,108.2,125.48,105.4,127.77,122.1,128.03,113.5,132.84,110,133.41,125.3,139.99,114.3,138.53,115.6,136.12,127.1,124.75,123,122.88,122.2,121.46,126.4,118.4,112.7,122.45,105.8,128.94,120.9,133.25,116.3,137.94,115.7,140.04,127.9,130.74,108.3,131.55,121.1,129.47,128.6,125.45,123.1,127.87,127.7,124.68,126.6),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 104.08 99.2 1 0 0 0 0 0 0 0 0 0 0
2 103.86 93.6 0 1 0 0 0 0 0 0 0 0 0
3 107.47 104.2 0 0 1 0 0 0 0 0 0 0 0
4 111.10 95.3 0 0 0 1 0 0 0 0 0 0 0
5 117.33 102.7 0 0 0 0 1 0 0 0 0 0 0
6 119.04 103.1 0 0 0 0 0 1 0 0 0 0 0
7 123.68 100.0 0 0 0 0 0 0 1 0 0 0 0
8 125.90 107.2 0 0 0 0 0 0 0 1 0 0 0
9 124.54 107.0 0 0 0 0 0 0 0 0 1 0 0
10 119.39 119.0 0 0 0 0 0 0 0 0 0 1 0
11 118.80 110.4 0 0 0 0 0 0 0 0 0 0 1
12 114.81 101.7 0 0 0 0 0 0 0 0 0 0 0
13 117.90 102.4 1 0 0 0 0 0 0 0 0 0 0
14 120.53 98.8 0 1 0 0 0 0 0 0 0 0 0
15 125.15 105.6 0 0 1 0 0 0 0 0 0 0 0
16 126.49 104.4 0 0 0 1 0 0 0 0 0 0 0
17 131.85 106.3 0 0 0 0 1 0 0 0 0 0 0
18 127.40 107.2 0 0 0 0 0 1 0 0 0 0 0
19 131.08 108.5 0 0 0 0 0 0 1 0 0 0 0
20 122.37 106.9 0 0 0 0 0 0 0 1 0 0 0
21 124.34 114.2 0 0 0 0 0 0 0 0 1 0 0
22 119.61 125.9 0 0 0 0 0 0 0 0 0 1 0
23 119.97 110.6 0 0 0 0 0 0 0 0 0 0 1
24 116.46 110.5 0 0 0 0 0 0 0 0 0 0 0
25 117.03 106.7 1 0 0 0 0 0 0 0 0 0 0
26 120.96 104.7 0 1 0 0 0 0 0 0 0 0 0
27 124.71 107.4 0 0 1 0 0 0 0 0 0 0 0
28 127.08 109.8 0 0 0 1 0 0 0 0 0 0 0
29 131.91 103.4 0 0 0 0 1 0 0 0 0 0 0
30 137.69 114.8 0 0 0 0 0 1 0 0 0 0 0
31 142.46 114.3 0 0 0 0 0 0 1 0 0 0 0
32 144.32 109.6 0 0 0 0 0 0 0 1 0 0 0
33 138.06 118.3 0 0 0 0 0 0 0 0 1 0 0
34 124.45 127.3 0 0 0 0 0 0 0 0 0 1 0
35 126.71 112.3 0 0 0 0 0 0 0 0 0 0 1
36 121.83 114.9 0 0 0 0 0 0 0 0 0 0 0
37 122.51 108.2 1 0 0 0 0 0 0 0 0 0 0
38 125.48 105.4 0 1 0 0 0 0 0 0 0 0 0
39 127.77 122.1 0 0 1 0 0 0 0 0 0 0 0
40 128.03 113.5 0 0 0 1 0 0 0 0 0 0 0
41 132.84 110.0 0 0 0 0 1 0 0 0 0 0 0
42 133.41 125.3 0 0 0 0 0 1 0 0 0 0 0
43 139.99 114.3 0 0 0 0 0 0 1 0 0 0 0
44 138.53 115.6 0 0 0 0 0 0 0 1 0 0 0
45 136.12 127.1 0 0 0 0 0 0 0 0 1 0 0
46 124.75 123.0 0 0 0 0 0 0 0 0 0 1 0
47 122.88 122.2 0 0 0 0 0 0 0 0 0 0 1
48 121.46 126.4 0 0 0 0 0 0 0 0 0 0 0
49 118.40 112.7 1 0 0 0 0 0 0 0 0 0 0
50 122.45 105.8 0 1 0 0 0 0 0 0 0 0 0
51 128.94 120.9 0 0 1 0 0 0 0 0 0 0 0
52 133.25 116.3 0 0 0 1 0 0 0 0 0 0 0
53 137.94 115.7 0 0 0 0 1 0 0 0 0 0 0
54 140.04 127.9 0 0 0 0 0 1 0 0 0 0 0
55 130.74 108.3 0 0 0 0 0 0 1 0 0 0 0
56 131.55 121.1 0 0 0 0 0 0 0 1 0 0 0
57 129.47 128.6 0 0 0 0 0 0 0 0 1 0 0
58 125.45 123.1 0 0 0 0 0 0 0 0 0 1 0
59 127.87 127.7 0 0 0 0 0 0 0 0 0 0 1
60 124.68 126.6 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
44.6238 0.6484 2.7364 8.1186 5.5405 10.6327
M5 M6 M7 M8 M9 M10
15.9723 11.9014 18.2417 15.2406 8.6999 -2.0716
M11
2.9960
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-10.2548 -3.1384 0.4383 3.1982 13.3940
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 44.6238 11.9671 3.729 0.000517 ***
X 0.6484 0.1011 6.413 6.36e-08 ***
M1 2.7364 3.5073 0.780 0.439174
M2 8.1186 3.6537 2.222 0.031132 *
M3 5.5405 3.3769 1.641 0.107534
M4 10.6327 3.4529 3.079 0.003459 **
M5 15.9723 3.4587 4.618 3.02e-05 ***
M6 11.9014 3.3530 3.549 0.000889 ***
M7 18.2417 3.4255 5.325 2.78e-06 ***
M8 15.2406 3.3764 4.514 4.26e-05 ***
M9 8.6999 3.3667 2.584 0.012931 *
M10 -2.0716 3.4407 -0.602 0.550013
M11 2.9960 3.3534 0.893 0.376187
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.301 on 47 degrees of freedom
Multiple R-squared: 0.7014, Adjusted R-squared: 0.6251
F-statistic: 9.199 on 12 and 47 DF, p-value: 9.288e-09
> 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.9269419 0.14611619 0.07305810
[2,] 0.8870677 0.22586463 0.11293232
[3,] 0.8202851 0.35942977 0.17971488
[4,] 0.8874109 0.22517827 0.11258914
[5,] 0.9261917 0.14761669 0.07380834
[6,] 0.9772430 0.04551405 0.02275703
[7,] 0.9837022 0.03259555 0.01629777
[8,] 0.9753326 0.04933486 0.02466743
[9,] 0.9802563 0.03948735 0.01974368
[10,] 0.9679695 0.06406109 0.03203055
[11,] 0.9495028 0.10099441 0.05049720
[12,] 0.9385734 0.12285315 0.06142657
[13,] 0.9164459 0.16710819 0.08355409
[14,] 0.9219159 0.15616829 0.07808414
[15,] 0.8861767 0.22764667 0.11382333
[16,] 0.8971970 0.20560602 0.10280301
[17,] 0.9803436 0.03931279 0.01965640
[18,] 0.9796642 0.04067166 0.02033583
[19,] 0.9633328 0.07333435 0.03666717
[20,] 0.9512363 0.09752736 0.04876368
[21,] 0.9290582 0.14188354 0.07094177
[22,] 0.9247363 0.15052738 0.07526369
[23,] 0.8874020 0.22519603 0.11259802
[24,] 0.8615321 0.27693576 0.13846788
[25,] 0.8055832 0.38883361 0.19441681
[26,] 0.7064966 0.58700685 0.29350343
[27,] 0.6924895 0.61502092 0.30751046
[28,] 0.7517858 0.49642837 0.24821419
[29,] 0.7709297 0.45814065 0.22907032
> postscript(file="/var/www/html/rcomp/tmp/1pxsk1258762653.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/2sx6e1258762653.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/35qwv1258762653.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/4y5xt1258762653.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/51k601258762653.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
-7.5988058 -9.5701167 -10.2547587 -5.9464399 -9.8540067 -4.3324399
7 8 9 10 11 12
-4.0227766 -3.4699416 1.8404063 -0.3185836 -0.4001549 4.2466959
13 14 15 16 17 18
4.1464018 3.7283457 6.5175197 3.5433693 2.3318519 1.3692324
19 20 21 22 23 24
-2.1339439 -6.8054298 -3.0278765 -4.5723547 0.6401706 0.1910169
25 26 27 28 29 30
0.4883995 0.3329472 4.9104490 0.6321571 4.2721325 6.7316005
31 32 33 34 35 36
5.4854949 13.3939641 8.0337957 -0.6400763 6.2779372 2.7081773
37 38 39 40 41 42
4.9958406 4.3990864 -1.5606285 -0.8168216 0.9228732 -4.3563120
43 44 45 46 47 48
3.0154949 3.7137284 0.3881167 2.4479259 -3.9709518 -5.1181078
49 50 51 52 53 54
-2.0318362 1.1097374 0.3874186 2.5877351 2.3271492 0.5879191
55 56 57 58 59 60
-2.3442694 -6.8323210 -7.2344422 3.0830887 -2.5470012 -2.0277823
> postscript(file="/var/www/html/rcomp/tmp/612qs1258762653.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 -7.5988058 NA
1 -9.5701167 -7.5988058
2 -10.2547587 -9.5701167
3 -5.9464399 -10.2547587
4 -9.8540067 -5.9464399
5 -4.3324399 -9.8540067
6 -4.0227766 -4.3324399
7 -3.4699416 -4.0227766
8 1.8404063 -3.4699416
9 -0.3185836 1.8404063
10 -0.4001549 -0.3185836
11 4.2466959 -0.4001549
12 4.1464018 4.2466959
13 3.7283457 4.1464018
14 6.5175197 3.7283457
15 3.5433693 6.5175197
16 2.3318519 3.5433693
17 1.3692324 2.3318519
18 -2.1339439 1.3692324
19 -6.8054298 -2.1339439
20 -3.0278765 -6.8054298
21 -4.5723547 -3.0278765
22 0.6401706 -4.5723547
23 0.1910169 0.6401706
24 0.4883995 0.1910169
25 0.3329472 0.4883995
26 4.9104490 0.3329472
27 0.6321571 4.9104490
28 4.2721325 0.6321571
29 6.7316005 4.2721325
30 5.4854949 6.7316005
31 13.3939641 5.4854949
32 8.0337957 13.3939641
33 -0.6400763 8.0337957
34 6.2779372 -0.6400763
35 2.7081773 6.2779372
36 4.9958406 2.7081773
37 4.3990864 4.9958406
38 -1.5606285 4.3990864
39 -0.8168216 -1.5606285
40 0.9228732 -0.8168216
41 -4.3563120 0.9228732
42 3.0154949 -4.3563120
43 3.7137284 3.0154949
44 0.3881167 3.7137284
45 2.4479259 0.3881167
46 -3.9709518 2.4479259
47 -5.1181078 -3.9709518
48 -2.0318362 -5.1181078
49 1.1097374 -2.0318362
50 0.3874186 1.1097374
51 2.5877351 0.3874186
52 2.3271492 2.5877351
53 0.5879191 2.3271492
54 -2.3442694 0.5879191
55 -6.8323210 -2.3442694
56 -7.2344422 -6.8323210
57 3.0830887 -7.2344422
58 -2.5470012 3.0830887
59 -2.0277823 -2.5470012
60 NA -2.0277823
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -9.5701167 -7.5988058
[2,] -10.2547587 -9.5701167
[3,] -5.9464399 -10.2547587
[4,] -9.8540067 -5.9464399
[5,] -4.3324399 -9.8540067
[6,] -4.0227766 -4.3324399
[7,] -3.4699416 -4.0227766
[8,] 1.8404063 -3.4699416
[9,] -0.3185836 1.8404063
[10,] -0.4001549 -0.3185836
[11,] 4.2466959 -0.4001549
[12,] 4.1464018 4.2466959
[13,] 3.7283457 4.1464018
[14,] 6.5175197 3.7283457
[15,] 3.5433693 6.5175197
[16,] 2.3318519 3.5433693
[17,] 1.3692324 2.3318519
[18,] -2.1339439 1.3692324
[19,] -6.8054298 -2.1339439
[20,] -3.0278765 -6.8054298
[21,] -4.5723547 -3.0278765
[22,] 0.6401706 -4.5723547
[23,] 0.1910169 0.6401706
[24,] 0.4883995 0.1910169
[25,] 0.3329472 0.4883995
[26,] 4.9104490 0.3329472
[27,] 0.6321571 4.9104490
[28,] 4.2721325 0.6321571
[29,] 6.7316005 4.2721325
[30,] 5.4854949 6.7316005
[31,] 13.3939641 5.4854949
[32,] 8.0337957 13.3939641
[33,] -0.6400763 8.0337957
[34,] 6.2779372 -0.6400763
[35,] 2.7081773 6.2779372
[36,] 4.9958406 2.7081773
[37,] 4.3990864 4.9958406
[38,] -1.5606285 4.3990864
[39,] -0.8168216 -1.5606285
[40,] 0.9228732 -0.8168216
[41,] -4.3563120 0.9228732
[42,] 3.0154949 -4.3563120
[43,] 3.7137284 3.0154949
[44,] 0.3881167 3.7137284
[45,] 2.4479259 0.3881167
[46,] -3.9709518 2.4479259
[47,] -5.1181078 -3.9709518
[48,] -2.0318362 -5.1181078
[49,] 1.1097374 -2.0318362
[50,] 0.3874186 1.1097374
[51,] 2.5877351 0.3874186
[52,] 2.3271492 2.5877351
[53,] 0.5879191 2.3271492
[54,] -2.3442694 0.5879191
[55,] -6.8323210 -2.3442694
[56,] -7.2344422 -6.8323210
[57,] 3.0830887 -7.2344422
[58,] -2.5470012 3.0830887
[59,] -2.0277823 -2.5470012
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -9.5701167 -7.5988058
2 -10.2547587 -9.5701167
3 -5.9464399 -10.2547587
4 -9.8540067 -5.9464399
5 -4.3324399 -9.8540067
6 -4.0227766 -4.3324399
7 -3.4699416 -4.0227766
8 1.8404063 -3.4699416
9 -0.3185836 1.8404063
10 -0.4001549 -0.3185836
11 4.2466959 -0.4001549
12 4.1464018 4.2466959
13 3.7283457 4.1464018
14 6.5175197 3.7283457
15 3.5433693 6.5175197
16 2.3318519 3.5433693
17 1.3692324 2.3318519
18 -2.1339439 1.3692324
19 -6.8054298 -2.1339439
20 -3.0278765 -6.8054298
21 -4.5723547 -3.0278765
22 0.6401706 -4.5723547
23 0.1910169 0.6401706
24 0.4883995 0.1910169
25 0.3329472 0.4883995
26 4.9104490 0.3329472
27 0.6321571 4.9104490
28 4.2721325 0.6321571
29 6.7316005 4.2721325
30 5.4854949 6.7316005
31 13.3939641 5.4854949
32 8.0337957 13.3939641
33 -0.6400763 8.0337957
34 6.2779372 -0.6400763
35 2.7081773 6.2779372
36 4.9958406 2.7081773
37 4.3990864 4.9958406
38 -1.5606285 4.3990864
39 -0.8168216 -1.5606285
40 0.9228732 -0.8168216
41 -4.3563120 0.9228732
42 3.0154949 -4.3563120
43 3.7137284 3.0154949
44 0.3881167 3.7137284
45 2.4479259 0.3881167
46 -3.9709518 2.4479259
47 -5.1181078 -3.9709518
48 -2.0318362 -5.1181078
49 1.1097374 -2.0318362
50 0.3874186 1.1097374
51 2.5877351 0.3874186
52 2.3271492 2.5877351
53 0.5879191 2.3271492
54 -2.3442694 0.5879191
55 -6.8323210 -2.3442694
56 -7.2344422 -6.8323210
57 3.0830887 -7.2344422
58 -2.5470012 3.0830887
59 -2.0277823 -2.5470012
> 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/71rsf1258762653.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/8ongq1258762653.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/90ouf1258762653.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/10cedt1258762653.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/118qzs1258762653.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/12kb4j1258762653.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/13hw2t1258762653.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/14zxk91258762653.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/15i8ni1258762653.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/16uk2a1258762653.tab")
+ }
>
> system("convert tmp/1pxsk1258762653.ps tmp/1pxsk1258762653.png")
> system("convert tmp/2sx6e1258762653.ps tmp/2sx6e1258762653.png")
> system("convert tmp/35qwv1258762653.ps tmp/35qwv1258762653.png")
> system("convert tmp/4y5xt1258762653.ps tmp/4y5xt1258762653.png")
> system("convert tmp/51k601258762653.ps tmp/51k601258762653.png")
> system("convert tmp/612qs1258762653.ps tmp/612qs1258762653.png")
> system("convert tmp/71rsf1258762653.ps tmp/71rsf1258762653.png")
> system("convert tmp/8ongq1258762653.ps tmp/8ongq1258762653.png")
> system("convert tmp/90ouf1258762653.ps tmp/90ouf1258762653.png")
> system("convert tmp/10cedt1258762653.ps tmp/10cedt1258762653.png")
>
>
> proc.time()
user system elapsed
2.402 1.543 2.833