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(126.51,0,131.02,0,136.51,0,138.04,0,132.92,0,129.61,0,122.96,0,124.04,0,121.29,0,124.56,0,118.53,0,113.14,0,114.15,0,122.17,0,129.23,0,131.19,0,129.12,0,128.28,0,126.83,0,138.13,0,140.52,0,146.83,0,135.14,0,131.84,0,125.7,0,128.98,0,133.25,0,136.76,0,133.24,0,128.54,0,121.08,0,120.23,0,119.08,0,125.75,0,126.89,0,126.6,0,121.89,0,123.44,0,126.46,0,129.49,0,127.78,0,125.29,0,119.02,0,119.96,0,122.86,0,131.89,0,132.73,0,135.01,0,136.71,1,142.73,1,144.43,1,144.93,1,138.75,1,130.22,1,122.19,1,128.4,1,140.43,1,153.5,1,149.33,1,142.97,1),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 = '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 t
1 126.51 0 1 0 0 0 0 0 0 0 0 0 0 1
2 131.02 0 0 1 0 0 0 0 0 0 0 0 0 2
3 136.51 0 0 0 1 0 0 0 0 0 0 0 0 3
4 138.04 0 0 0 0 1 0 0 0 0 0 0 0 4
5 132.92 0 0 0 0 0 1 0 0 0 0 0 0 5
6 129.61 0 0 0 0 0 0 1 0 0 0 0 0 6
7 122.96 0 0 0 0 0 0 0 1 0 0 0 0 7
8 124.04 0 0 0 0 0 0 0 0 1 0 0 0 8
9 121.29 0 0 0 0 0 0 0 0 0 1 0 0 9
10 124.56 0 0 0 0 0 0 0 0 0 0 1 0 10
11 118.53 0 0 0 0 0 0 0 0 0 0 0 1 11
12 113.14 0 0 0 0 0 0 0 0 0 0 0 0 12
13 114.15 0 1 0 0 0 0 0 0 0 0 0 0 13
14 122.17 0 0 1 0 0 0 0 0 0 0 0 0 14
15 129.23 0 0 0 1 0 0 0 0 0 0 0 0 15
16 131.19 0 0 0 0 1 0 0 0 0 0 0 0 16
17 129.12 0 0 0 0 0 1 0 0 0 0 0 0 17
18 128.28 0 0 0 0 0 0 1 0 0 0 0 0 18
19 126.83 0 0 0 0 0 0 0 1 0 0 0 0 19
20 138.13 0 0 0 0 0 0 0 0 1 0 0 0 20
21 140.52 0 0 0 0 0 0 0 0 0 1 0 0 21
22 146.83 0 0 0 0 0 0 0 0 0 0 1 0 22
23 135.14 0 0 0 0 0 0 0 0 0 0 0 1 23
24 131.84 0 0 0 0 0 0 0 0 0 0 0 0 24
25 125.70 0 1 0 0 0 0 0 0 0 0 0 0 25
26 128.98 0 0 1 0 0 0 0 0 0 0 0 0 26
27 133.25 0 0 0 1 0 0 0 0 0 0 0 0 27
28 136.76 0 0 0 0 1 0 0 0 0 0 0 0 28
29 133.24 0 0 0 0 0 1 0 0 0 0 0 0 29
30 128.54 0 0 0 0 0 0 1 0 0 0 0 0 30
31 121.08 0 0 0 0 0 0 0 1 0 0 0 0 31
32 120.23 0 0 0 0 0 0 0 0 1 0 0 0 32
33 119.08 0 0 0 0 0 0 0 0 0 1 0 0 33
34 125.75 0 0 0 0 0 0 0 0 0 0 1 0 34
35 126.89 0 0 0 0 0 0 0 0 0 0 0 1 35
36 126.60 0 0 0 0 0 0 0 0 0 0 0 0 36
37 121.89 0 1 0 0 0 0 0 0 0 0 0 0 37
38 123.44 0 0 1 0 0 0 0 0 0 0 0 0 38
39 126.46 0 0 0 1 0 0 0 0 0 0 0 0 39
40 129.49 0 0 0 0 1 0 0 0 0 0 0 0 40
41 127.78 0 0 0 0 0 1 0 0 0 0 0 0 41
42 125.29 0 0 0 0 0 0 1 0 0 0 0 0 42
43 119.02 0 0 0 0 0 0 0 1 0 0 0 0 43
44 119.96 0 0 0 0 0 0 0 0 1 0 0 0 44
45 122.86 0 0 0 0 0 0 0 0 0 1 0 0 45
46 131.89 0 0 0 0 0 0 0 0 0 0 1 0 46
47 132.73 0 0 0 0 0 0 0 0 0 0 0 1 47
48 135.01 0 0 0 0 0 0 0 0 0 0 0 0 48
49 136.71 1 1 0 0 0 0 0 0 0 0 0 0 49
50 142.73 1 0 1 0 0 0 0 0 0 0 0 0 50
51 144.43 1 0 0 1 0 0 0 0 0 0 0 0 51
52 144.93 1 0 0 0 1 0 0 0 0 0 0 0 52
53 138.75 1 0 0 0 0 1 0 0 0 0 0 0 53
54 130.22 1 0 0 0 0 0 1 0 0 0 0 0 54
55 122.19 1 0 0 0 0 0 0 1 0 0 0 0 55
56 128.40 1 0 0 0 0 0 0 0 1 0 0 0 56
57 140.43 1 0 0 0 0 0 0 0 0 1 0 0 57
58 153.50 1 0 0 0 0 0 0 0 0 0 1 0 58
59 149.33 1 0 0 0 0 0 0 0 0 0 0 1 59
60 142.97 1 0 0 0 0 0 0 0 0 0 0 0 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X M1 M2 M3 M4
128.75542 12.94042 -5.35740 -0.64164 3.70612 5.85189
M5 M6 M7 M8 M9 M10
2.17165 -1.76258 -7.69482 -3.91906 -1.19529 6.51447
M11 t
2.57224 -0.03976
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-15.1382 -3.1358 0.5116 3.2775 14.0889
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 128.75542 3.69111 34.883 < 2e-16 ***
X 12.94042 3.03408 4.265 9.84e-05 ***
M1 -5.35740 4.27710 -1.253 0.2167
M2 -0.64164 4.26453 -0.150 0.8811
M3 3.70612 4.25312 0.871 0.3881
M4 5.85189 4.24289 1.379 0.1745
M5 2.17165 4.23384 0.513 0.6105
M6 -1.76258 4.22598 -0.417 0.6786
M7 -7.69482 4.21932 -1.824 0.0747 .
M8 -3.91906 4.21386 -0.930 0.3572
M9 -1.19529 4.20961 -0.284 0.7777
M10 6.51447 4.20657 1.549 0.1283
M11 2.57224 4.20475 0.612 0.5437
t -0.03976 0.07151 -0.556 0.5809
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 6.647 on 46 degrees of freedom
Multiple R-squared: 0.5394, Adjusted R-squared: 0.4092
F-statistic: 4.143 on 13 and 46 DF, p-value: 0.0001638
> 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.1169483 0.233896533 0.883051734
[2,] 0.1259617 0.251923385 0.874038308
[3,] 0.2562804 0.512560753 0.743719624
[4,] 0.7809259 0.438148160 0.219074080
[5,] 0.9720913 0.055817325 0.027908662
[6,] 0.9969663 0.006067315 0.003033658
[7,] 0.9969023 0.006195424 0.003097712
[8,] 0.9967561 0.006487796 0.003243898
[9,] 0.9933324 0.013335149 0.006667575
[10,] 0.9875845 0.024830916 0.012415458
[11,] 0.9805965 0.038806982 0.019403491
[12,] 0.9734588 0.053082390 0.026541195
[13,] 0.9688041 0.062391746 0.031195873
[14,] 0.9747863 0.050427495 0.025213747
[15,] 0.9887386 0.022522874 0.011261437
[16,] 0.9954599 0.009080130 0.004540065
[17,] 0.9939812 0.012037636 0.006018818
[18,] 0.9910161 0.017967822 0.008983911
[19,] 0.9813354 0.037329272 0.018664636
[20,] 0.9636170 0.072765919 0.036382959
[21,] 0.9329383 0.134123448 0.067061724
[22,] 0.9132491 0.173501743 0.086750872
[23,] 0.8844992 0.231001589 0.115500794
[24,] 0.8224779 0.355044246 0.177522123
[25,] 0.7108151 0.578369823 0.289184911
[26,] 0.6444834 0.711033205 0.355516603
[27,] 0.6855097 0.628980584 0.314490292
> postscript(file="/var/www/html/rcomp/tmp/1utke1259359413.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/2kcw81259359413.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/3sy1s1259359413.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/4ye611259359413.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/5ka511259359413.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
3.1517500 2.9857500 4.1677500 3.5917500 2.1917500 2.8557500
7 8 9 10 11 12
2.1777500 -0.4782500 -5.9122500 -10.3122500 -12.3602500 -15.1382500
13 14 15 16 17 18
-8.7310833 -5.3870833 -2.6350833 -2.7810833 -1.1310833 2.0029167
19 20 21 22 23 24
6.5249167 14.0889167 13.7949167 12.4349167 4.7269167 4.0389167
25 26 27 28 29 30
3.2960833 1.9000833 1.8620833 3.2660833 3.4660833 2.7400833
31 32 33 34 35 36
1.2520833 -3.3339167 -7.1679167 -8.1679167 -3.0459167 -0.7239167
37 38 39 40 41 42
-0.0367500 -3.1627500 -4.4507500 -3.5267500 -1.5167500 -0.0327500
43 44 45 46 47 48
-0.3307500 -3.1267500 -2.9107500 -1.5507500 3.2712500 8.1632500
49 50 51 52 53 54
2.3200000 3.6640000 1.0560000 -0.5500000 -3.0100000 -7.5660000
55 56 57 58 59 60
-9.6240000 -7.1500000 2.1960000 7.5960000 7.4080000 3.6600000
> postscript(file="/var/www/html/rcomp/tmp/66fzc1259359413.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 3.1517500 NA
1 2.9857500 3.1517500
2 4.1677500 2.9857500
3 3.5917500 4.1677500
4 2.1917500 3.5917500
5 2.8557500 2.1917500
6 2.1777500 2.8557500
7 -0.4782500 2.1777500
8 -5.9122500 -0.4782500
9 -10.3122500 -5.9122500
10 -12.3602500 -10.3122500
11 -15.1382500 -12.3602500
12 -8.7310833 -15.1382500
13 -5.3870833 -8.7310833
14 -2.6350833 -5.3870833
15 -2.7810833 -2.6350833
16 -1.1310833 -2.7810833
17 2.0029167 -1.1310833
18 6.5249167 2.0029167
19 14.0889167 6.5249167
20 13.7949167 14.0889167
21 12.4349167 13.7949167
22 4.7269167 12.4349167
23 4.0389167 4.7269167
24 3.2960833 4.0389167
25 1.9000833 3.2960833
26 1.8620833 1.9000833
27 3.2660833 1.8620833
28 3.4660833 3.2660833
29 2.7400833 3.4660833
30 1.2520833 2.7400833
31 -3.3339167 1.2520833
32 -7.1679167 -3.3339167
33 -8.1679167 -7.1679167
34 -3.0459167 -8.1679167
35 -0.7239167 -3.0459167
36 -0.0367500 -0.7239167
37 -3.1627500 -0.0367500
38 -4.4507500 -3.1627500
39 -3.5267500 -4.4507500
40 -1.5167500 -3.5267500
41 -0.0327500 -1.5167500
42 -0.3307500 -0.0327500
43 -3.1267500 -0.3307500
44 -2.9107500 -3.1267500
45 -1.5507500 -2.9107500
46 3.2712500 -1.5507500
47 8.1632500 3.2712500
48 2.3200000 8.1632500
49 3.6640000 2.3200000
50 1.0560000 3.6640000
51 -0.5500000 1.0560000
52 -3.0100000 -0.5500000
53 -7.5660000 -3.0100000
54 -9.6240000 -7.5660000
55 -7.1500000 -9.6240000
56 2.1960000 -7.1500000
57 7.5960000 2.1960000
58 7.4080000 7.5960000
59 3.6600000 7.4080000
60 NA 3.6600000
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.9857500 3.1517500
[2,] 4.1677500 2.9857500
[3,] 3.5917500 4.1677500
[4,] 2.1917500 3.5917500
[5,] 2.8557500 2.1917500
[6,] 2.1777500 2.8557500
[7,] -0.4782500 2.1777500
[8,] -5.9122500 -0.4782500
[9,] -10.3122500 -5.9122500
[10,] -12.3602500 -10.3122500
[11,] -15.1382500 -12.3602500
[12,] -8.7310833 -15.1382500
[13,] -5.3870833 -8.7310833
[14,] -2.6350833 -5.3870833
[15,] -2.7810833 -2.6350833
[16,] -1.1310833 -2.7810833
[17,] 2.0029167 -1.1310833
[18,] 6.5249167 2.0029167
[19,] 14.0889167 6.5249167
[20,] 13.7949167 14.0889167
[21,] 12.4349167 13.7949167
[22,] 4.7269167 12.4349167
[23,] 4.0389167 4.7269167
[24,] 3.2960833 4.0389167
[25,] 1.9000833 3.2960833
[26,] 1.8620833 1.9000833
[27,] 3.2660833 1.8620833
[28,] 3.4660833 3.2660833
[29,] 2.7400833 3.4660833
[30,] 1.2520833 2.7400833
[31,] -3.3339167 1.2520833
[32,] -7.1679167 -3.3339167
[33,] -8.1679167 -7.1679167
[34,] -3.0459167 -8.1679167
[35,] -0.7239167 -3.0459167
[36,] -0.0367500 -0.7239167
[37,] -3.1627500 -0.0367500
[38,] -4.4507500 -3.1627500
[39,] -3.5267500 -4.4507500
[40,] -1.5167500 -3.5267500
[41,] -0.0327500 -1.5167500
[42,] -0.3307500 -0.0327500
[43,] -3.1267500 -0.3307500
[44,] -2.9107500 -3.1267500
[45,] -1.5507500 -2.9107500
[46,] 3.2712500 -1.5507500
[47,] 8.1632500 3.2712500
[48,] 2.3200000 8.1632500
[49,] 3.6640000 2.3200000
[50,] 1.0560000 3.6640000
[51,] -0.5500000 1.0560000
[52,] -3.0100000 -0.5500000
[53,] -7.5660000 -3.0100000
[54,] -9.6240000 -7.5660000
[55,] -7.1500000 -9.6240000
[56,] 2.1960000 -7.1500000
[57,] 7.5960000 2.1960000
[58,] 7.4080000 7.5960000
[59,] 3.6600000 7.4080000
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.9857500 3.1517500
2 4.1677500 2.9857500
3 3.5917500 4.1677500
4 2.1917500 3.5917500
5 2.8557500 2.1917500
6 2.1777500 2.8557500
7 -0.4782500 2.1777500
8 -5.9122500 -0.4782500
9 -10.3122500 -5.9122500
10 -12.3602500 -10.3122500
11 -15.1382500 -12.3602500
12 -8.7310833 -15.1382500
13 -5.3870833 -8.7310833
14 -2.6350833 -5.3870833
15 -2.7810833 -2.6350833
16 -1.1310833 -2.7810833
17 2.0029167 -1.1310833
18 6.5249167 2.0029167
19 14.0889167 6.5249167
20 13.7949167 14.0889167
21 12.4349167 13.7949167
22 4.7269167 12.4349167
23 4.0389167 4.7269167
24 3.2960833 4.0389167
25 1.9000833 3.2960833
26 1.8620833 1.9000833
27 3.2660833 1.8620833
28 3.4660833 3.2660833
29 2.7400833 3.4660833
30 1.2520833 2.7400833
31 -3.3339167 1.2520833
32 -7.1679167 -3.3339167
33 -8.1679167 -7.1679167
34 -3.0459167 -8.1679167
35 -0.7239167 -3.0459167
36 -0.0367500 -0.7239167
37 -3.1627500 -0.0367500
38 -4.4507500 -3.1627500
39 -3.5267500 -4.4507500
40 -1.5167500 -3.5267500
41 -0.0327500 -1.5167500
42 -0.3307500 -0.0327500
43 -3.1267500 -0.3307500
44 -2.9107500 -3.1267500
45 -1.5507500 -2.9107500
46 3.2712500 -1.5507500
47 8.1632500 3.2712500
48 2.3200000 8.1632500
49 3.6640000 2.3200000
50 1.0560000 3.6640000
51 -0.5500000 1.0560000
52 -3.0100000 -0.5500000
53 -7.5660000 -3.0100000
54 -9.6240000 -7.5660000
55 -7.1500000 -9.6240000
56 2.1960000 -7.1500000
57 7.5960000 2.1960000
58 7.4080000 7.5960000
59 3.6600000 7.4080000
> 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/7pfn11259359413.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/8agon1259359413.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/9qvil1259359413.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/10hjhu1259359413.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/11pkyw1259359413.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/12a7ng1259359413.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/13laru1259359413.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/145f211259359413.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/153zaf1259359413.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/16vc8z1259359413.tab")
+ }
>
> system("convert tmp/1utke1259359413.ps tmp/1utke1259359413.png")
> system("convert tmp/2kcw81259359413.ps tmp/2kcw81259359413.png")
> system("convert tmp/3sy1s1259359413.ps tmp/3sy1s1259359413.png")
> system("convert tmp/4ye611259359413.ps tmp/4ye611259359413.png")
> system("convert tmp/5ka511259359413.ps tmp/5ka511259359413.png")
> system("convert tmp/66fzc1259359413.ps tmp/66fzc1259359413.png")
> system("convert tmp/7pfn11259359413.ps tmp/7pfn11259359413.png")
> system("convert tmp/8agon1259359413.ps tmp/8agon1259359413.png")
> system("convert tmp/9qvil1259359413.ps tmp/9qvil1259359413.png")
> system("convert tmp/10hjhu1259359413.ps tmp/10hjhu1259359413.png")
>
>
> proc.time()
user system elapsed
2.418 1.586 13.490