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(103.52,0,103.5,0,103.52,0,103.53,0,103.53,0,103.53,0,103.52,0,103.54,0,103.59,0,103.59,0,103.59,0,103.59,0,103.63,0,103.74,0,103.7,0,103.72,0,103.81,0,103.8,0,104.22,0,106.91,1,107.06,1,107.17,1,107.25,1,107.28,1,107.24,1,107.23,1,107.34,1,107.34,1,107.3,1,107.24,1,107.3,1,107.32,1,107.28,1,107.33,1,107.33,1,107.33,1,107.28,1,107.28,1,107.29,1,107.29,1,107.23,1,107.24,1,107.24,1,107.2,1,107.23,1,107.2,1,107.21,1,107.24,1,107.21,1,113.89,1,114.05,1,114.05,1,114.05,1,114.05,1,115.12,1,115.68,1,116.05,1,116.18,1,116.35,1,116.44,1,117,1,117.61,1,118.17,1,118.33,1,118.33,1,118.42,1,118.5,1,118.67,1,119.09,1,119.14,1,119.23,1,119.33,1),dim=c(2,72),dimnames=list(c('Y','X'),1:72))
> y <- array(NA,dim=c(2,72),dimnames=list(c('Y','X'),1:72))
> 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 = 'Do not include Seasonal 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
1 103.52 0
2 103.50 0
3 103.52 0
4 103.53 0
5 103.53 0
6 103.53 0
7 103.52 0
8 103.54 0
9 103.59 0
10 103.59 0
11 103.59 0
12 103.59 0
13 103.63 0
14 103.74 0
15 103.70 0
16 103.72 0
17 103.81 0
18 103.80 0
19 104.22 0
20 106.91 1
21 107.06 1
22 107.17 1
23 107.25 1
24 107.28 1
25 107.24 1
26 107.23 1
27 107.34 1
28 107.34 1
29 107.30 1
30 107.24 1
31 107.30 1
32 107.32 1
33 107.28 1
34 107.33 1
35 107.33 1
36 107.33 1
37 107.28 1
38 107.28 1
39 107.29 1
40 107.29 1
41 107.23 1
42 107.24 1
43 107.24 1
44 107.20 1
45 107.23 1
46 107.20 1
47 107.21 1
48 107.24 1
49 107.21 1
50 113.89 1
51 114.05 1
52 114.05 1
53 114.05 1
54 114.05 1
55 115.12 1
56 115.68 1
57 116.05 1
58 116.18 1
59 116.35 1
60 116.44 1
61 117.00 1
62 117.61 1
63 118.17 1
64 118.33 1
65 118.33 1
66 118.42 1
67 118.50 1
68 118.67 1
69 119.09 1
70 119.14 1
71 119.23 1
72 119.33 1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X
103.641 7.777
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-4.5074 -4.1374 -0.1105 2.9001 7.9126
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 103.6405 0.9836 105.369 < 2e-16 ***
X 7.7768 1.1464 6.784 3.09e-09 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 4.287 on 70 degrees of freedom
Multiple R-squared: 0.3966, Adjusted R-squared: 0.388
F-statistic: 46.02 on 1 and 70 DF, p-value: 3.091e-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,] 4.489418e-08 8.978836e-08 1.000000e+00
[2,] 1.489368e-10 2.978736e-10 1.000000e+00
[3,] 3.683709e-13 7.367417e-13 1.000000e+00
[4,] 2.467203e-15 4.934407e-15 1.000000e+00
[5,] 1.655705e-15 3.311410e-15 1.000000e+00
[6,] 6.148319e-17 1.229664e-16 1.000000e+00
[7,] 1.321688e-18 2.643376e-18 1.000000e+00
[8,] 2.217736e-20 4.435472e-20 1.000000e+00
[9,] 1.517345e-21 3.034691e-21 1.000000e+00
[10,] 4.795066e-21 9.590132e-21 1.000000e+00
[11,] 3.792851e-22 7.585701e-22 1.000000e+00
[12,] 3.129606e-23 6.259213e-23 1.000000e+00
[13,] 1.240354e-23 2.480709e-23 1.000000e+00
[14,] 1.672784e-24 3.345569e-24 1.000000e+00
[15,] 3.935522e-22 7.871045e-22 1.000000e+00
[16,] 1.511786e-23 3.023572e-23 1.000000e+00
[17,] 6.932860e-25 1.386572e-24 1.000000e+00
[18,] 3.903312e-26 7.806624e-26 1.000000e+00
[19,] 2.565027e-27 5.130054e-27 1.000000e+00
[20,] 1.584031e-28 3.168062e-28 1.000000e+00
[21,] 7.339094e-30 1.467819e-29 1.000000e+00
[22,] 3.192375e-31 6.384751e-31 1.000000e+00
[23,] 2.123014e-32 4.246028e-32 1.000000e+00
[24,] 1.292521e-33 2.585043e-33 1.000000e+00
[25,] 6.375025e-35 1.275005e-34 1.000000e+00
[26,] 2.783319e-36 5.566639e-36 1.000000e+00
[27,] 1.398373e-37 2.796745e-37 1.000000e+00
[28,] 7.625415e-39 1.525083e-38 1.000000e+00
[29,] 3.813285e-40 7.626570e-40 1.000000e+00
[30,] 2.291196e-41 4.582392e-41 1.000000e+00
[31,] 1.435502e-42 2.871004e-42 1.000000e+00
[32,] 9.529073e-44 1.905815e-43 1.000000e+00
[33,] 6.118171e-45 1.223634e-44 1.000000e+00
[34,] 4.375534e-46 8.751069e-46 1.000000e+00
[35,] 3.619844e-47 7.239688e-47 1.000000e+00
[36,] 3.534707e-48 7.069415e-48 1.000000e+00
[37,] 4.326252e-49 8.652504e-49 1.000000e+00
[38,] 6.882013e-50 1.376403e-49 1.000000e+00
[39,] 1.574118e-50 3.148236e-50 1.000000e+00
[40,] 6.511212e-51 1.302242e-50 1.000000e+00
[41,] 4.957910e-51 9.915820e-51 1.000000e+00
[42,] 1.161050e-50 2.322100e-50 1.000000e+00
[43,] 1.413011e-49 2.826022e-49 1.000000e+00
[44,] 3.672564e-47 7.345128e-47 1.000000e+00
[45,] 3.840858e-41 7.681715e-41 1.000000e+00
[46,] 3.243511e-05 6.487023e-05 9.999676e-01
[47,] 3.017198e-02 6.034396e-02 9.698280e-01
[48,] 2.804191e-01 5.608381e-01 7.195809e-01
[49,] 6.703843e-01 6.592315e-01 3.296157e-01
[50,] 9.228590e-01 1.542819e-01 7.714097e-02
[51,] 9.830976e-01 3.380471e-02 1.690235e-02
[52,] 9.956634e-01 8.673272e-03 4.336636e-03
[53,] 9.986120e-01 2.776012e-03 1.388006e-03
[54,] 9.995511e-01 8.978035e-04 4.489018e-04
[55,] 9.998665e-01 2.670515e-04 1.335258e-04
[56,] 9.999794e-01 4.129122e-05 2.064561e-05
[57,] 9.999961e-01 7.763649e-06 3.881825e-06
[58,] 9.999980e-01 4.029942e-06 2.014971e-06
[59,] 9.999952e-01 9.529149e-06 4.764575e-06
[60,] 9.999834e-01 3.327532e-05 1.663766e-05
[61,] 9.999457e-01 1.086562e-04 5.432810e-05
[62,] 9.998059e-01 3.881743e-04 1.940872e-04
[63,] 9.993904e-01 1.219262e-03 6.096309e-04
> postscript(file="/var/www/html/rcomp/tmp/1zkqd1259055402.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/2t4sx1259055402.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/36jhy1259055402.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/477am1259055402.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/5ij691259055402.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 = 72
Frequency = 1
1 2 3 4 5 6
-0.12052632 -0.14052632 -0.12052632 -0.11052632 -0.11052632 -0.11052632
7 8 9 10 11 12
-0.12052632 -0.10052632 -0.05052632 -0.05052632 -0.05052632 -0.05052632
13 14 15 16 17 18
-0.01052632 0.09947368 0.05947368 0.07947368 0.16947368 0.15947368
19 20 21 22 23 24
0.57947368 -4.50735849 -4.35735849 -4.24735849 -4.16735849 -4.13735849
25 26 27 28 29 30
-4.17735849 -4.18735849 -4.07735849 -4.07735849 -4.11735849 -4.17735849
31 32 33 34 35 36
-4.11735849 -4.09735849 -4.13735849 -4.08735849 -4.08735849 -4.08735849
37 38 39 40 41 42
-4.13735849 -4.13735849 -4.12735849 -4.12735849 -4.18735849 -4.17735849
43 44 45 46 47 48
-4.17735849 -4.21735849 -4.18735849 -4.21735849 -4.20735849 -4.17735849
49 50 51 52 53 54
-4.20735849 2.47264151 2.63264151 2.63264151 2.63264151 2.63264151
55 56 57 58 59 60
3.70264151 4.26264151 4.63264151 4.76264151 4.93264151 5.02264151
61 62 63 64 65 66
5.58264151 6.19264151 6.75264151 6.91264151 6.91264151 7.00264151
67 68 69 70 71 72
7.08264151 7.25264151 7.67264151 7.72264151 7.81264151 7.91264151
> postscript(file="/var/www/html/rcomp/tmp/6vfd21259055402.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 = 72
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.12052632 NA
1 -0.14052632 -0.12052632
2 -0.12052632 -0.14052632
3 -0.11052632 -0.12052632
4 -0.11052632 -0.11052632
5 -0.11052632 -0.11052632
6 -0.12052632 -0.11052632
7 -0.10052632 -0.12052632
8 -0.05052632 -0.10052632
9 -0.05052632 -0.05052632
10 -0.05052632 -0.05052632
11 -0.05052632 -0.05052632
12 -0.01052632 -0.05052632
13 0.09947368 -0.01052632
14 0.05947368 0.09947368
15 0.07947368 0.05947368
16 0.16947368 0.07947368
17 0.15947368 0.16947368
18 0.57947368 0.15947368
19 -4.50735849 0.57947368
20 -4.35735849 -4.50735849
21 -4.24735849 -4.35735849
22 -4.16735849 -4.24735849
23 -4.13735849 -4.16735849
24 -4.17735849 -4.13735849
25 -4.18735849 -4.17735849
26 -4.07735849 -4.18735849
27 -4.07735849 -4.07735849
28 -4.11735849 -4.07735849
29 -4.17735849 -4.11735849
30 -4.11735849 -4.17735849
31 -4.09735849 -4.11735849
32 -4.13735849 -4.09735849
33 -4.08735849 -4.13735849
34 -4.08735849 -4.08735849
35 -4.08735849 -4.08735849
36 -4.13735849 -4.08735849
37 -4.13735849 -4.13735849
38 -4.12735849 -4.13735849
39 -4.12735849 -4.12735849
40 -4.18735849 -4.12735849
41 -4.17735849 -4.18735849
42 -4.17735849 -4.17735849
43 -4.21735849 -4.17735849
44 -4.18735849 -4.21735849
45 -4.21735849 -4.18735849
46 -4.20735849 -4.21735849
47 -4.17735849 -4.20735849
48 -4.20735849 -4.17735849
49 2.47264151 -4.20735849
50 2.63264151 2.47264151
51 2.63264151 2.63264151
52 2.63264151 2.63264151
53 2.63264151 2.63264151
54 3.70264151 2.63264151
55 4.26264151 3.70264151
56 4.63264151 4.26264151
57 4.76264151 4.63264151
58 4.93264151 4.76264151
59 5.02264151 4.93264151
60 5.58264151 5.02264151
61 6.19264151 5.58264151
62 6.75264151 6.19264151
63 6.91264151 6.75264151
64 6.91264151 6.91264151
65 7.00264151 6.91264151
66 7.08264151 7.00264151
67 7.25264151 7.08264151
68 7.67264151 7.25264151
69 7.72264151 7.67264151
70 7.81264151 7.72264151
71 7.91264151 7.81264151
72 NA 7.91264151
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.14052632 -0.12052632
[2,] -0.12052632 -0.14052632
[3,] -0.11052632 -0.12052632
[4,] -0.11052632 -0.11052632
[5,] -0.11052632 -0.11052632
[6,] -0.12052632 -0.11052632
[7,] -0.10052632 -0.12052632
[8,] -0.05052632 -0.10052632
[9,] -0.05052632 -0.05052632
[10,] -0.05052632 -0.05052632
[11,] -0.05052632 -0.05052632
[12,] -0.01052632 -0.05052632
[13,] 0.09947368 -0.01052632
[14,] 0.05947368 0.09947368
[15,] 0.07947368 0.05947368
[16,] 0.16947368 0.07947368
[17,] 0.15947368 0.16947368
[18,] 0.57947368 0.15947368
[19,] -4.50735849 0.57947368
[20,] -4.35735849 -4.50735849
[21,] -4.24735849 -4.35735849
[22,] -4.16735849 -4.24735849
[23,] -4.13735849 -4.16735849
[24,] -4.17735849 -4.13735849
[25,] -4.18735849 -4.17735849
[26,] -4.07735849 -4.18735849
[27,] -4.07735849 -4.07735849
[28,] -4.11735849 -4.07735849
[29,] -4.17735849 -4.11735849
[30,] -4.11735849 -4.17735849
[31,] -4.09735849 -4.11735849
[32,] -4.13735849 -4.09735849
[33,] -4.08735849 -4.13735849
[34,] -4.08735849 -4.08735849
[35,] -4.08735849 -4.08735849
[36,] -4.13735849 -4.08735849
[37,] -4.13735849 -4.13735849
[38,] -4.12735849 -4.13735849
[39,] -4.12735849 -4.12735849
[40,] -4.18735849 -4.12735849
[41,] -4.17735849 -4.18735849
[42,] -4.17735849 -4.17735849
[43,] -4.21735849 -4.17735849
[44,] -4.18735849 -4.21735849
[45,] -4.21735849 -4.18735849
[46,] -4.20735849 -4.21735849
[47,] -4.17735849 -4.20735849
[48,] -4.20735849 -4.17735849
[49,] 2.47264151 -4.20735849
[50,] 2.63264151 2.47264151
[51,] 2.63264151 2.63264151
[52,] 2.63264151 2.63264151
[53,] 2.63264151 2.63264151
[54,] 3.70264151 2.63264151
[55,] 4.26264151 3.70264151
[56,] 4.63264151 4.26264151
[57,] 4.76264151 4.63264151
[58,] 4.93264151 4.76264151
[59,] 5.02264151 4.93264151
[60,] 5.58264151 5.02264151
[61,] 6.19264151 5.58264151
[62,] 6.75264151 6.19264151
[63,] 6.91264151 6.75264151
[64,] 6.91264151 6.91264151
[65,] 7.00264151 6.91264151
[66,] 7.08264151 7.00264151
[67,] 7.25264151 7.08264151
[68,] 7.67264151 7.25264151
[69,] 7.72264151 7.67264151
[70,] 7.81264151 7.72264151
[71,] 7.91264151 7.81264151
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.14052632 -0.12052632
2 -0.12052632 -0.14052632
3 -0.11052632 -0.12052632
4 -0.11052632 -0.11052632
5 -0.11052632 -0.11052632
6 -0.12052632 -0.11052632
7 -0.10052632 -0.12052632
8 -0.05052632 -0.10052632
9 -0.05052632 -0.05052632
10 -0.05052632 -0.05052632
11 -0.05052632 -0.05052632
12 -0.01052632 -0.05052632
13 0.09947368 -0.01052632
14 0.05947368 0.09947368
15 0.07947368 0.05947368
16 0.16947368 0.07947368
17 0.15947368 0.16947368
18 0.57947368 0.15947368
19 -4.50735849 0.57947368
20 -4.35735849 -4.50735849
21 -4.24735849 -4.35735849
22 -4.16735849 -4.24735849
23 -4.13735849 -4.16735849
24 -4.17735849 -4.13735849
25 -4.18735849 -4.17735849
26 -4.07735849 -4.18735849
27 -4.07735849 -4.07735849
28 -4.11735849 -4.07735849
29 -4.17735849 -4.11735849
30 -4.11735849 -4.17735849
31 -4.09735849 -4.11735849
32 -4.13735849 -4.09735849
33 -4.08735849 -4.13735849
34 -4.08735849 -4.08735849
35 -4.08735849 -4.08735849
36 -4.13735849 -4.08735849
37 -4.13735849 -4.13735849
38 -4.12735849 -4.13735849
39 -4.12735849 -4.12735849
40 -4.18735849 -4.12735849
41 -4.17735849 -4.18735849
42 -4.17735849 -4.17735849
43 -4.21735849 -4.17735849
44 -4.18735849 -4.21735849
45 -4.21735849 -4.18735849
46 -4.20735849 -4.21735849
47 -4.17735849 -4.20735849
48 -4.20735849 -4.17735849
49 2.47264151 -4.20735849
50 2.63264151 2.47264151
51 2.63264151 2.63264151
52 2.63264151 2.63264151
53 2.63264151 2.63264151
54 3.70264151 2.63264151
55 4.26264151 3.70264151
56 4.63264151 4.26264151
57 4.76264151 4.63264151
58 4.93264151 4.76264151
59 5.02264151 4.93264151
60 5.58264151 5.02264151
61 6.19264151 5.58264151
62 6.75264151 6.19264151
63 6.91264151 6.75264151
64 6.91264151 6.91264151
65 7.00264151 6.91264151
66 7.08264151 7.00264151
67 7.25264151 7.08264151
68 7.67264151 7.25264151
69 7.72264151 7.67264151
70 7.81264151 7.72264151
71 7.91264151 7.81264151
> 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/7vswx1259055402.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/8kj0k1259055402.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/988jg1259055402.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/10blz81259055402.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/111pn91259055402.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/124czp1259055402.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/1324qp1259055402.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/14k2sk1259055402.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/15d4h31259055402.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/16gi241259055402.tab")
+ }
>
> system("convert tmp/1zkqd1259055402.ps tmp/1zkqd1259055402.png")
> system("convert tmp/2t4sx1259055402.ps tmp/2t4sx1259055402.png")
> system("convert tmp/36jhy1259055402.ps tmp/36jhy1259055402.png")
> system("convert tmp/477am1259055402.ps tmp/477am1259055402.png")
> system("convert tmp/5ij691259055402.ps tmp/5ij691259055402.png")
> system("convert tmp/6vfd21259055402.ps tmp/6vfd21259055402.png")
> system("convert tmp/7vswx1259055402.ps tmp/7vswx1259055402.png")
> system("convert tmp/8kj0k1259055402.ps tmp/8kj0k1259055402.png")
> system("convert tmp/988jg1259055402.ps tmp/988jg1259055402.png")
> system("convert tmp/10blz81259055402.ps tmp/10blz81259055402.png")
>
>
> proc.time()
user system elapsed
2.561 1.548 3.484