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.7,0,8.2,0,8.3,0,8.5,0,8.6,0,8.5,0,8.2,0,8.1,0,7.9,0,8.6,0,8.7,0,8.7,0,8.5,0,8.4,0,8.5,0,8.7,0,8.7,0,8.6,0,8.5,0,8.3,0,8,0,8.2,0,8.1,0,8.1,0,8,0,7.9,0,7.9,0,8,0,8,0,7.9,0,8,0,7.7,0,7.2,0,7.5,0,7.3,0,7,0,7,0,7,0,7.2,0,7.3,0,7.1,0,6.8,0,6.4,0,6.1,0,6.5,0,7.7,0,7.9,0,7.5,0,6.9,1,6.6,1,6.9,1,7.7,1,8,1,8,1,7.7,1,7.3,1,7.4,1,8.1,1,8.3,1,8.2,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 8.7 0 1 0 0 0 0 0 0 0 0 0 0 1
2 8.2 0 0 1 0 0 0 0 0 0 0 0 0 2
3 8.3 0 0 0 1 0 0 0 0 0 0 0 0 3
4 8.5 0 0 0 0 1 0 0 0 0 0 0 0 4
5 8.6 0 0 0 0 0 1 0 0 0 0 0 0 5
6 8.5 0 0 0 0 0 0 1 0 0 0 0 0 6
7 8.2 0 0 0 0 0 0 0 1 0 0 0 0 7
8 8.1 0 0 0 0 0 0 0 0 1 0 0 0 8
9 7.9 0 0 0 0 0 0 0 0 0 1 0 0 9
10 8.6 0 0 0 0 0 0 0 0 0 0 1 0 10
11 8.7 0 0 0 0 0 0 0 0 0 0 0 1 11
12 8.7 0 0 0 0 0 0 0 0 0 0 0 0 12
13 8.5 0 1 0 0 0 0 0 0 0 0 0 0 13
14 8.4 0 0 1 0 0 0 0 0 0 0 0 0 14
15 8.5 0 0 0 1 0 0 0 0 0 0 0 0 15
16 8.7 0 0 0 0 1 0 0 0 0 0 0 0 16
17 8.7 0 0 0 0 0 1 0 0 0 0 0 0 17
18 8.6 0 0 0 0 0 0 1 0 0 0 0 0 18
19 8.5 0 0 0 0 0 0 0 1 0 0 0 0 19
20 8.3 0 0 0 0 0 0 0 0 1 0 0 0 20
21 8.0 0 0 0 0 0 0 0 0 0 1 0 0 21
22 8.2 0 0 0 0 0 0 0 0 0 0 1 0 22
23 8.1 0 0 0 0 0 0 0 0 0 0 0 1 23
24 8.1 0 0 0 0 0 0 0 0 0 0 0 0 24
25 8.0 0 1 0 0 0 0 0 0 0 0 0 0 25
26 7.9 0 0 1 0 0 0 0 0 0 0 0 0 26
27 7.9 0 0 0 1 0 0 0 0 0 0 0 0 27
28 8.0 0 0 0 0 1 0 0 0 0 0 0 0 28
29 8.0 0 0 0 0 0 1 0 0 0 0 0 0 29
30 7.9 0 0 0 0 0 0 1 0 0 0 0 0 30
31 8.0 0 0 0 0 0 0 0 1 0 0 0 0 31
32 7.7 0 0 0 0 0 0 0 0 1 0 0 0 32
33 7.2 0 0 0 0 0 0 0 0 0 1 0 0 33
34 7.5 0 0 0 0 0 0 0 0 0 0 1 0 34
35 7.3 0 0 0 0 0 0 0 0 0 0 0 1 35
36 7.0 0 0 0 0 0 0 0 0 0 0 0 0 36
37 7.0 0 1 0 0 0 0 0 0 0 0 0 0 37
38 7.0 0 0 1 0 0 0 0 0 0 0 0 0 38
39 7.2 0 0 0 1 0 0 0 0 0 0 0 0 39
40 7.3 0 0 0 0 1 0 0 0 0 0 0 0 40
41 7.1 0 0 0 0 0 1 0 0 0 0 0 0 41
42 6.8 0 0 0 0 0 0 1 0 0 0 0 0 42
43 6.4 0 0 0 0 0 0 0 1 0 0 0 0 43
44 6.1 0 0 0 0 0 0 0 0 1 0 0 0 44
45 6.5 0 0 0 0 0 0 0 0 0 1 0 0 45
46 7.7 0 0 0 0 0 0 0 0 0 0 1 0 46
47 7.9 0 0 0 0 0 0 0 0 0 0 0 1 47
48 7.5 0 0 0 0 0 0 0 0 0 0 0 0 48
49 6.9 1 1 0 0 0 0 0 0 0 0 0 0 49
50 6.6 1 0 1 0 0 0 0 0 0 0 0 0 50
51 6.9 1 0 0 1 0 0 0 0 0 0 0 0 51
52 7.7 1 0 0 0 1 0 0 0 0 0 0 0 52
53 8.0 1 0 0 0 0 1 0 0 0 0 0 0 53
54 8.0 1 0 0 0 0 0 1 0 0 0 0 0 54
55 7.7 1 0 0 0 0 0 0 1 0 0 0 0 55
56 7.3 1 0 0 0 0 0 0 0 1 0 0 0 56
57 7.4 1 0 0 0 0 0 0 0 0 1 0 0 57
58 8.1 1 0 0 0 0 0 0 0 0 0 1 0 58
59 8.3 1 0 0 0 0 0 0 0 0 0 0 1 59
60 8.2 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
9.16083 0.90833 -0.52076 -0.68069 -0.50062 -0.18056
M5 M6 M7 M8 M9 M10
-0.10049 -0.18042 -0.34035 -0.56028 -0.62021 0.03986
M11 t
0.11993 -0.04007
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.78500 -0.24479 0.03875 0.32646 0.53500
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.160833 0.233750 39.191 < 2e-16 ***
X 0.908333 0.192142 4.727 2.18e-05 ***
M1 -0.520764 0.270860 -1.923 0.0607 .
M2 -0.680694 0.270064 -2.520 0.0153 *
M3 -0.500625 0.269341 -1.859 0.0695 .
M4 -0.180556 0.268693 -0.672 0.5050
M5 -0.100486 0.268120 -0.375 0.7095
M6 -0.180417 0.267622 -0.674 0.5036
M7 -0.340347 0.267200 -1.274 0.2091
M8 -0.560278 0.266855 -2.100 0.0413 *
M9 -0.620208 0.266586 -2.326 0.0245 *
M10 0.039861 0.266393 0.150 0.8817
M11 0.119931 0.266278 0.450 0.6545
t -0.040069 0.004529 -8.848 1.72e-11 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.421 on 46 degrees of freedom
Multiple R-squared: 0.6825, Adjusted R-squared: 0.5928
F-statistic: 7.608 on 13 and 46 DF, p-value: 1.038e-07
> 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.0367275995 0.0734551991 0.9632724
[2,] 0.0088739674 0.0177479348 0.9911260
[3,] 0.0035596276 0.0071192553 0.9964404
[4,] 0.0009352031 0.0018704062 0.9990648
[5,] 0.0002056395 0.0004112791 0.9997944
[6,] 0.0014310510 0.0028621021 0.9985689
[7,] 0.0069324524 0.0138649047 0.9930675
[8,] 0.0111216174 0.0222432348 0.9888784
[9,] 0.0159672051 0.0319344102 0.9840328
[10,] 0.0127719264 0.0255438528 0.9872281
[11,] 0.0101942480 0.0203884960 0.9898058
[12,] 0.0076572559 0.0153145117 0.9923427
[13,] 0.0057486635 0.0114973270 0.9942513
[14,] 0.0042040357 0.0084080714 0.9957960
[15,] 0.0049269350 0.0098538699 0.9950731
[16,] 0.0175612699 0.0351225398 0.9824387
[17,] 0.0338015802 0.0676031604 0.9661984
[18,] 0.0392056576 0.0784113152 0.9607943
[19,] 0.0497419797 0.0994839594 0.9502580
[20,] 0.0882935889 0.1765871777 0.9117064
[21,] 0.1328334379 0.2656668759 0.8671666
[22,] 0.2826468927 0.5652937854 0.7173531
[23,] 0.6294996458 0.7410007083 0.3705004
[24,] 0.6280646008 0.7438707983 0.3719354
[25,] 0.5190125613 0.9619748774 0.4809874
[26,] 0.4945515115 0.9891030230 0.5054485
[27,] 0.5981495113 0.8037009774 0.4018505
> postscript(file="/var/www/html/rcomp/tmp/1c7ci1260889287.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/2he931260889287.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/32ea81260889287.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/4b03b1260889287.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/55mvz1260889287.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.10000000 -0.20000000 -0.24000000 -0.32000000 -0.26000000 -0.24000000
7 8 9 10 11 12
-0.34000000 -0.18000000 -0.28000000 -0.20000000 -0.14000000 0.02000000
13 14 15 16 17 18
0.38083333 0.48083333 0.44083333 0.36083333 0.32083333 0.34083333
19 20 21 22 23 24
0.44083333 0.50083333 0.30083333 -0.11916667 -0.25916667 -0.09916667
25 26 27 28 29 30
0.36166667 0.46166667 0.32166667 0.14166667 0.10166667 0.12166667
31 32 33 34 35 36
0.42166667 0.38166667 -0.01833333 -0.33833333 -0.57833333 -0.71833333
37 38 39 40 41 42
-0.15750000 0.04250000 0.10250000 -0.07750000 -0.31750000 -0.49750000
43 44 45 46 47 48
-0.69750000 -0.73750000 -0.23750000 0.34250000 0.50250000 0.26250000
49 50 51 52 53 54
-0.68500000 -0.78500000 -0.62500000 -0.10500000 0.15500000 0.27500000
55 56 57 58 59 60
0.17500000 0.03500000 0.23500000 0.31500000 0.47500000 0.53500000
> postscript(file="/var/www/html/rcomp/tmp/6xub71260889287.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.10000000 NA
1 -0.20000000 0.10000000
2 -0.24000000 -0.20000000
3 -0.32000000 -0.24000000
4 -0.26000000 -0.32000000
5 -0.24000000 -0.26000000
6 -0.34000000 -0.24000000
7 -0.18000000 -0.34000000
8 -0.28000000 -0.18000000
9 -0.20000000 -0.28000000
10 -0.14000000 -0.20000000
11 0.02000000 -0.14000000
12 0.38083333 0.02000000
13 0.48083333 0.38083333
14 0.44083333 0.48083333
15 0.36083333 0.44083333
16 0.32083333 0.36083333
17 0.34083333 0.32083333
18 0.44083333 0.34083333
19 0.50083333 0.44083333
20 0.30083333 0.50083333
21 -0.11916667 0.30083333
22 -0.25916667 -0.11916667
23 -0.09916667 -0.25916667
24 0.36166667 -0.09916667
25 0.46166667 0.36166667
26 0.32166667 0.46166667
27 0.14166667 0.32166667
28 0.10166667 0.14166667
29 0.12166667 0.10166667
30 0.42166667 0.12166667
31 0.38166667 0.42166667
32 -0.01833333 0.38166667
33 -0.33833333 -0.01833333
34 -0.57833333 -0.33833333
35 -0.71833333 -0.57833333
36 -0.15750000 -0.71833333
37 0.04250000 -0.15750000
38 0.10250000 0.04250000
39 -0.07750000 0.10250000
40 -0.31750000 -0.07750000
41 -0.49750000 -0.31750000
42 -0.69750000 -0.49750000
43 -0.73750000 -0.69750000
44 -0.23750000 -0.73750000
45 0.34250000 -0.23750000
46 0.50250000 0.34250000
47 0.26250000 0.50250000
48 -0.68500000 0.26250000
49 -0.78500000 -0.68500000
50 -0.62500000 -0.78500000
51 -0.10500000 -0.62500000
52 0.15500000 -0.10500000
53 0.27500000 0.15500000
54 0.17500000 0.27500000
55 0.03500000 0.17500000
56 0.23500000 0.03500000
57 0.31500000 0.23500000
58 0.47500000 0.31500000
59 0.53500000 0.47500000
60 NA 0.53500000
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.20000000 0.10000000
[2,] -0.24000000 -0.20000000
[3,] -0.32000000 -0.24000000
[4,] -0.26000000 -0.32000000
[5,] -0.24000000 -0.26000000
[6,] -0.34000000 -0.24000000
[7,] -0.18000000 -0.34000000
[8,] -0.28000000 -0.18000000
[9,] -0.20000000 -0.28000000
[10,] -0.14000000 -0.20000000
[11,] 0.02000000 -0.14000000
[12,] 0.38083333 0.02000000
[13,] 0.48083333 0.38083333
[14,] 0.44083333 0.48083333
[15,] 0.36083333 0.44083333
[16,] 0.32083333 0.36083333
[17,] 0.34083333 0.32083333
[18,] 0.44083333 0.34083333
[19,] 0.50083333 0.44083333
[20,] 0.30083333 0.50083333
[21,] -0.11916667 0.30083333
[22,] -0.25916667 -0.11916667
[23,] -0.09916667 -0.25916667
[24,] 0.36166667 -0.09916667
[25,] 0.46166667 0.36166667
[26,] 0.32166667 0.46166667
[27,] 0.14166667 0.32166667
[28,] 0.10166667 0.14166667
[29,] 0.12166667 0.10166667
[30,] 0.42166667 0.12166667
[31,] 0.38166667 0.42166667
[32,] -0.01833333 0.38166667
[33,] -0.33833333 -0.01833333
[34,] -0.57833333 -0.33833333
[35,] -0.71833333 -0.57833333
[36,] -0.15750000 -0.71833333
[37,] 0.04250000 -0.15750000
[38,] 0.10250000 0.04250000
[39,] -0.07750000 0.10250000
[40,] -0.31750000 -0.07750000
[41,] -0.49750000 -0.31750000
[42,] -0.69750000 -0.49750000
[43,] -0.73750000 -0.69750000
[44,] -0.23750000 -0.73750000
[45,] 0.34250000 -0.23750000
[46,] 0.50250000 0.34250000
[47,] 0.26250000 0.50250000
[48,] -0.68500000 0.26250000
[49,] -0.78500000 -0.68500000
[50,] -0.62500000 -0.78500000
[51,] -0.10500000 -0.62500000
[52,] 0.15500000 -0.10500000
[53,] 0.27500000 0.15500000
[54,] 0.17500000 0.27500000
[55,] 0.03500000 0.17500000
[56,] 0.23500000 0.03500000
[57,] 0.31500000 0.23500000
[58,] 0.47500000 0.31500000
[59,] 0.53500000 0.47500000
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.20000000 0.10000000
2 -0.24000000 -0.20000000
3 -0.32000000 -0.24000000
4 -0.26000000 -0.32000000
5 -0.24000000 -0.26000000
6 -0.34000000 -0.24000000
7 -0.18000000 -0.34000000
8 -0.28000000 -0.18000000
9 -0.20000000 -0.28000000
10 -0.14000000 -0.20000000
11 0.02000000 -0.14000000
12 0.38083333 0.02000000
13 0.48083333 0.38083333
14 0.44083333 0.48083333
15 0.36083333 0.44083333
16 0.32083333 0.36083333
17 0.34083333 0.32083333
18 0.44083333 0.34083333
19 0.50083333 0.44083333
20 0.30083333 0.50083333
21 -0.11916667 0.30083333
22 -0.25916667 -0.11916667
23 -0.09916667 -0.25916667
24 0.36166667 -0.09916667
25 0.46166667 0.36166667
26 0.32166667 0.46166667
27 0.14166667 0.32166667
28 0.10166667 0.14166667
29 0.12166667 0.10166667
30 0.42166667 0.12166667
31 0.38166667 0.42166667
32 -0.01833333 0.38166667
33 -0.33833333 -0.01833333
34 -0.57833333 -0.33833333
35 -0.71833333 -0.57833333
36 -0.15750000 -0.71833333
37 0.04250000 -0.15750000
38 0.10250000 0.04250000
39 -0.07750000 0.10250000
40 -0.31750000 -0.07750000
41 -0.49750000 -0.31750000
42 -0.69750000 -0.49750000
43 -0.73750000 -0.69750000
44 -0.23750000 -0.73750000
45 0.34250000 -0.23750000
46 0.50250000 0.34250000
47 0.26250000 0.50250000
48 -0.68500000 0.26250000
49 -0.78500000 -0.68500000
50 -0.62500000 -0.78500000
51 -0.10500000 -0.62500000
52 0.15500000 -0.10500000
53 0.27500000 0.15500000
54 0.17500000 0.27500000
55 0.03500000 0.17500000
56 0.23500000 0.03500000
57 0.31500000 0.23500000
58 0.47500000 0.31500000
59 0.53500000 0.47500000
> 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/77rwv1260889287.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/89p5v1260889287.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/95y1t1260889287.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/10aas71260889287.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/11grjg1260889287.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/12t52t1260889288.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/13ognf1260889288.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/145ca31260889288.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/15b7dz1260889288.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/16j2mn1260889288.tab")
+ }
>
> try(system("convert tmp/1c7ci1260889287.ps tmp/1c7ci1260889287.png",intern=TRUE))
character(0)
> try(system("convert tmp/2he931260889287.ps tmp/2he931260889287.png",intern=TRUE))
character(0)
> try(system("convert tmp/32ea81260889287.ps tmp/32ea81260889287.png",intern=TRUE))
character(0)
> try(system("convert tmp/4b03b1260889287.ps tmp/4b03b1260889287.png",intern=TRUE))
character(0)
> try(system("convert tmp/55mvz1260889287.ps tmp/55mvz1260889287.png",intern=TRUE))
character(0)
> try(system("convert tmp/6xub71260889287.ps tmp/6xub71260889287.png",intern=TRUE))
character(0)
> try(system("convert tmp/77rwv1260889287.ps tmp/77rwv1260889287.png",intern=TRUE))
character(0)
> try(system("convert tmp/89p5v1260889287.ps tmp/89p5v1260889287.png",intern=TRUE))
character(0)
> try(system("convert tmp/95y1t1260889287.ps tmp/95y1t1260889287.png",intern=TRUE))
character(0)
> try(system("convert tmp/10aas71260889287.ps tmp/10aas71260889287.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.406 1.591 3.669