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(105.7
+ ,0
+ ,105.7
+ ,105.7
+ ,111.1
+ ,0
+ ,111.1
+ ,105.7
+ ,82.4
+ ,0
+ ,82.4
+ ,111.1
+ ,60
+ ,0
+ ,60
+ ,82.4
+ ,107.3
+ ,0
+ ,107.3
+ ,60
+ ,99.3
+ ,0
+ ,99.3
+ ,107.3
+ ,113.5
+ ,0
+ ,113.5
+ ,99.3
+ ,108.9
+ ,0
+ ,108.9
+ ,113.5
+ ,100.2
+ ,0
+ ,100.2
+ ,108.9
+ ,103.9
+ ,0
+ ,103.9
+ ,100.2
+ ,138.7
+ ,0
+ ,138.7
+ ,103.9
+ ,120.2
+ ,0
+ ,120.2
+ ,138.7
+ ,100.2
+ ,0
+ ,100.2
+ ,120.2
+ ,143.2
+ ,0
+ ,143.2
+ ,100.2
+ ,70.9
+ ,0
+ ,70.9
+ ,143.2
+ ,85.2
+ ,0
+ ,85.2
+ ,70.9
+ ,133
+ ,0
+ ,133
+ ,85.2
+ ,136.6
+ ,0
+ ,136.6
+ ,133
+ ,117.9
+ ,0
+ ,117.9
+ ,136.6
+ ,106.3
+ ,0
+ ,106.3
+ ,117.9
+ ,122.3
+ ,0
+ ,122.3
+ ,106.3
+ ,125.5
+ ,0
+ ,125.5
+ ,122.3
+ ,148.4
+ ,0
+ ,148.4
+ ,125.5
+ ,126.3
+ ,0
+ ,126.3
+ ,148.4
+ ,99.6
+ ,0
+ ,99.6
+ ,126.3
+ ,140.4
+ ,0
+ ,140.4
+ ,99.6
+ ,80.3
+ ,0
+ ,80.3
+ ,140.4
+ ,92.6
+ ,0
+ ,92.6
+ ,80.3
+ ,138.5
+ ,0
+ ,138.5
+ ,92.6
+ ,110.9
+ ,0
+ ,110.9
+ ,138.5
+ ,119.6
+ ,0
+ ,119.6
+ ,110.9
+ ,105
+ ,0
+ ,105
+ ,119.6
+ ,109
+ ,0
+ ,109
+ ,105
+ ,129.4
+ ,0
+ ,129.4
+ ,109
+ ,148.6
+ ,0
+ ,148.6
+ ,129.4
+ ,101.4
+ ,0
+ ,101.4
+ ,148.6
+ ,134.8
+ ,0
+ ,134.8
+ ,101.4
+ ,143.7
+ ,0
+ ,143.7
+ ,134.8
+ ,81.6
+ ,0
+ ,81.6
+ ,143.7
+ ,90.3
+ ,0
+ ,90.3
+ ,81.6
+ ,141.5
+ ,0
+ ,141.5
+ ,90.3
+ ,140.7
+ ,0
+ ,140.7
+ ,141.5
+ ,140.2
+ ,0
+ ,140.2
+ ,140.7
+ ,100.2
+ ,0
+ ,100.2
+ ,140.2
+ ,125.7
+ ,0
+ ,125.7
+ ,100.2
+ ,119.6
+ ,0
+ ,119.6
+ ,125.7
+ ,134.7
+ ,0
+ ,134.7
+ ,119.6
+ ,109
+ ,0
+ ,109
+ ,134.7
+ ,116.3
+ ,0
+ ,116.3
+ ,109
+ ,146.9
+ ,0
+ ,146.9
+ ,116.3
+ ,97.4
+ ,0
+ ,97.4
+ ,146.9
+ ,89.4
+ ,0
+ ,89.4
+ ,97.4
+ ,132.1
+ ,0
+ ,132.1
+ ,89.4
+ ,139.8
+ ,0
+ ,139.8
+ ,132.1
+ ,129
+ ,0
+ ,129
+ ,139.8
+ ,112.5
+ ,0
+ ,112.5
+ ,129
+ ,121.9
+ ,1
+ ,121.9
+ ,112.5
+ ,121.7
+ ,1
+ ,121.7
+ ,121.9
+ ,123.1
+ ,1
+ ,123.1
+ ,121.7
+ ,131.6
+ ,1
+ ,131.6
+ ,123.1
+ ,119.3
+ ,1
+ ,119.3
+ ,131.6
+ ,132.5
+ ,1
+ ,132.5
+ ,119.3
+ ,98.3
+ ,1
+ ,98.3
+ ,132.5
+ ,85.1
+ ,1
+ ,85.1
+ ,98.3
+ ,131.7
+ ,1
+ ,131.7
+ ,85.1
+ ,129.3
+ ,1
+ ,129.3
+ ,131.7
+ ,90.7
+ ,1
+ ,90.7
+ ,129.3
+ ,78.6
+ ,1
+ ,78.6
+ ,90.7
+ ,68.9
+ ,1
+ ,68.9
+ ,78.6
+ ,79.1
+ ,1
+ ,79.1
+ ,68.9
+ ,83.5
+ ,1
+ ,83.5
+ ,79.1
+ ,74.1
+ ,1
+ ,74.1
+ ,83.5
+ ,59.7
+ ,1
+ ,59.7
+ ,74.1
+ ,93.3
+ ,1
+ ,93.3
+ ,59.7
+ ,61.3
+ ,1
+ ,61.3
+ ,93.3
+ ,56.6
+ ,1
+ ,56.6
+ ,61.3)
+ ,dim=c(4
+ ,76)
+ ,dimnames=list(c('Y'
+ ,'X'
+ ,'Y1'
+ ,'Y2')
+ ,1:76))
> y <- array(NA,dim=c(4,76),dimnames=list(c('Y','X','Y1','Y2'),1:76))
> 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 Y1 Y2 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 105.7 0 105.7 105.7 1 0 0 0 0 0 0 0 0 0 0 1
2 111.1 0 111.1 105.7 0 1 0 0 0 0 0 0 0 0 0 2
3 82.4 0 82.4 111.1 0 0 1 0 0 0 0 0 0 0 0 3
4 60.0 0 60.0 82.4 0 0 0 1 0 0 0 0 0 0 0 4
5 107.3 0 107.3 60.0 0 0 0 0 1 0 0 0 0 0 0 5
6 99.3 0 99.3 107.3 0 0 0 0 0 1 0 0 0 0 0 6
7 113.5 0 113.5 99.3 0 0 0 0 0 0 1 0 0 0 0 7
8 108.9 0 108.9 113.5 0 0 0 0 0 0 0 1 0 0 0 8
9 100.2 0 100.2 108.9 0 0 0 0 0 0 0 0 1 0 0 9
10 103.9 0 103.9 100.2 0 0 0 0 0 0 0 0 0 1 0 10
11 138.7 0 138.7 103.9 0 0 0 0 0 0 0 0 0 0 1 11
12 120.2 0 120.2 138.7 0 0 0 0 0 0 0 0 0 0 0 12
13 100.2 0 100.2 120.2 1 0 0 0 0 0 0 0 0 0 0 13
14 143.2 0 143.2 100.2 0 1 0 0 0 0 0 0 0 0 0 14
15 70.9 0 70.9 143.2 0 0 1 0 0 0 0 0 0 0 0 15
16 85.2 0 85.2 70.9 0 0 0 1 0 0 0 0 0 0 0 16
17 133.0 0 133.0 85.2 0 0 0 0 1 0 0 0 0 0 0 17
18 136.6 0 136.6 133.0 0 0 0 0 0 1 0 0 0 0 0 18
19 117.9 0 117.9 136.6 0 0 0 0 0 0 1 0 0 0 0 19
20 106.3 0 106.3 117.9 0 0 0 0 0 0 0 1 0 0 0 20
21 122.3 0 122.3 106.3 0 0 0 0 0 0 0 0 1 0 0 21
22 125.5 0 125.5 122.3 0 0 0 0 0 0 0 0 0 1 0 22
23 148.4 0 148.4 125.5 0 0 0 0 0 0 0 0 0 0 1 23
24 126.3 0 126.3 148.4 0 0 0 0 0 0 0 0 0 0 0 24
25 99.6 0 99.6 126.3 1 0 0 0 0 0 0 0 0 0 0 25
26 140.4 0 140.4 99.6 0 1 0 0 0 0 0 0 0 0 0 26
27 80.3 0 80.3 140.4 0 0 1 0 0 0 0 0 0 0 0 27
28 92.6 0 92.6 80.3 0 0 0 1 0 0 0 0 0 0 0 28
29 138.5 0 138.5 92.6 0 0 0 0 1 0 0 0 0 0 0 29
30 110.9 0 110.9 138.5 0 0 0 0 0 1 0 0 0 0 0 30
31 119.6 0 119.6 110.9 0 0 0 0 0 0 1 0 0 0 0 31
32 105.0 0 105.0 119.6 0 0 0 0 0 0 0 1 0 0 0 32
33 109.0 0 109.0 105.0 0 0 0 0 0 0 0 0 1 0 0 33
34 129.4 0 129.4 109.0 0 0 0 0 0 0 0 0 0 1 0 34
35 148.6 0 148.6 129.4 0 0 0 0 0 0 0 0 0 0 1 35
36 101.4 0 101.4 148.6 0 0 0 0 0 0 0 0 0 0 0 36
37 134.8 0 134.8 101.4 1 0 0 0 0 0 0 0 0 0 0 37
38 143.7 0 143.7 134.8 0 1 0 0 0 0 0 0 0 0 0 38
39 81.6 0 81.6 143.7 0 0 1 0 0 0 0 0 0 0 0 39
40 90.3 0 90.3 81.6 0 0 0 1 0 0 0 0 0 0 0 40
41 141.5 0 141.5 90.3 0 0 0 0 1 0 0 0 0 0 0 41
42 140.7 0 140.7 141.5 0 0 0 0 0 1 0 0 0 0 0 42
43 140.2 0 140.2 140.7 0 0 0 0 0 0 1 0 0 0 0 43
44 100.2 0 100.2 140.2 0 0 0 0 0 0 0 1 0 0 0 44
45 125.7 0 125.7 100.2 0 0 0 0 0 0 0 0 1 0 0 45
46 119.6 0 119.6 125.7 0 0 0 0 0 0 0 0 0 1 0 46
47 134.7 0 134.7 119.6 0 0 0 0 0 0 0 0 0 0 1 47
48 109.0 0 109.0 134.7 0 0 0 0 0 0 0 0 0 0 0 48
49 116.3 0 116.3 109.0 1 0 0 0 0 0 0 0 0 0 0 49
50 146.9 0 146.9 116.3 0 1 0 0 0 0 0 0 0 0 0 50
51 97.4 0 97.4 146.9 0 0 1 0 0 0 0 0 0 0 0 51
52 89.4 0 89.4 97.4 0 0 0 1 0 0 0 0 0 0 0 52
53 132.1 0 132.1 89.4 0 0 0 0 1 0 0 0 0 0 0 53
54 139.8 0 139.8 132.1 0 0 0 0 0 1 0 0 0 0 0 54
55 129.0 0 129.0 139.8 0 0 0 0 0 0 1 0 0 0 0 55
56 112.5 0 112.5 129.0 0 0 0 0 0 0 0 1 0 0 0 56
57 121.9 1 121.9 112.5 0 0 0 0 0 0 0 0 1 0 0 57
58 121.7 1 121.7 121.9 0 0 0 0 0 0 0 0 0 1 0 58
59 123.1 1 123.1 121.7 0 0 0 0 0 0 0 0 0 0 1 59
60 131.6 1 131.6 123.1 0 0 0 0 0 0 0 0 0 0 0 60
61 119.3 1 119.3 131.6 1 0 0 0 0 0 0 0 0 0 0 61
62 132.5 1 132.5 119.3 0 1 0 0 0 0 0 0 0 0 0 62
63 98.3 1 98.3 132.5 0 0 1 0 0 0 0 0 0 0 0 63
64 85.1 1 85.1 98.3 0 0 0 1 0 0 0 0 0 0 0 64
65 131.7 1 131.7 85.1 0 0 0 0 1 0 0 0 0 0 0 65
66 129.3 1 129.3 131.7 0 0 0 0 0 1 0 0 0 0 0 66
67 90.7 1 90.7 129.3 0 0 0 0 0 0 1 0 0 0 0 67
68 78.6 1 78.6 90.7 0 0 0 0 0 0 0 1 0 0 0 68
69 68.9 1 68.9 78.6 0 0 0 0 0 0 0 0 1 0 0 69
70 79.1 1 79.1 68.9 0 0 0 0 0 0 0 0 0 1 0 70
71 83.5 1 83.5 79.1 0 0 0 0 0 0 0 0 0 0 1 71
72 74.1 1 74.1 83.5 0 0 0 0 0 0 0 0 0 0 0 72
73 59.7 1 59.7 74.1 1 0 0 0 0 0 0 0 0 0 0 73
74 93.3 1 93.3 59.7 0 1 0 0 0 0 0 0 0 0 0 74
75 61.3 1 61.3 93.3 0 0 1 0 0 0 0 0 0 0 0 75
76 56.6 1 56.6 61.3 0 0 0 1 0 0 0 0 0 0 0 76
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X Y1 Y2 M1 M2
1.063e-13 -7.404e-15 1.000e+00 -2.495e-16 -7.763e-15 -1.125e-14
M3 M4 M5 M6 M7 M8
2.536e-14 -6.824e-15 -1.558e-14 -4.016e-15 -3.485e-15 -2.228e-15
M9 M10 M11 t
-7.773e-15 -7.183e-15 -9.968e-15 -1.862e-16
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-2.349e-14 -4.144e-15 -4.758e-16 3.645e-15 1.101e-13
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.063e-13 1.867e-14 5.692e+00 3.99e-07 ***
X -7.404e-15 7.540e-15 -9.820e-01 0.3301
Y1 1.000e+00 1.553e-16 6.439e+15 < 2e-16 ***
Y2 -2.495e-16 1.533e-16 -1.628e+00 0.1088
M1 -7.763e-15 9.442e-15 -8.220e-01 0.4142
M2 -1.125e-14 1.090e-14 -1.033e+00 0.3058
M3 2.536e-14 1.014e-14 2.500e+00 0.0152 *
M4 -6.824e-15 1.090e-14 -6.260e-01 0.5337
M5 -1.558e-14 1.319e-14 -1.181e+00 0.2421
M6 -4.016e-15 9.658e-15 -4.160e-01 0.6790
M7 -3.485e-15 9.549e-15 -3.650e-01 0.7164
M8 -2.228e-15 9.613e-15 -2.320e-01 0.8175
M9 -7.773e-15 1.021e-14 -7.610e-01 0.4495
M10 -7.183e-15 1.005e-14 -7.150e-01 0.4774
M11 -9.968e-15 1.058e-14 -9.420e-01 0.3500
t -1.862e-16 1.361e-16 -1.368e+00 0.1764
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.628e-14 on 60 degrees of freedom
Multiple R-squared: 1, Adjusted R-squared: 1
F-statistic: 1.108e+31 on 15 and 60 DF, p-value: < 2.2e-16
> 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,] 9.324997e-03 1.864999e-02 9.906750e-01
[2,] 1.572409e-02 3.144818e-02 9.842759e-01
[3,] 9.060778e-01 1.878444e-01 9.392219e-02
[4,] 9.622950e-01 7.541007e-02 3.770504e-02
[5,] 7.878055e-01 4.243889e-01 2.121945e-01
[6,] 1.000000e+00 1.144729e-11 5.723643e-12
[7,] 3.895995e-01 7.791989e-01 6.104005e-01
[8,] 9.552514e-01 8.949714e-02 4.474857e-02
[9,] 2.193911e-05 4.387821e-05 9.999781e-01
[10,] 9.999981e-01 3.861923e-06 1.930961e-06
[11,] 5.791348e-03 1.158270e-02 9.942087e-01
[12,] 9.996448e-01 7.104741e-04 3.552371e-04
[13,] 4.210949e-02 8.421897e-02 9.578905e-01
[14,] 9.844197e-01 3.116052e-02 1.558026e-02
[15,] 1.000000e+00 4.189078e-10 2.094539e-10
[16,] 5.404045e-01 9.191910e-01 4.595955e-01
[17,] 7.039109e-05 1.407822e-04 9.999296e-01
[18,] 9.975832e-01 4.833536e-03 2.416768e-03
[19,] 1.000000e+00 3.457167e-10 1.728583e-10
[20,] 2.624889e-07 5.249779e-07 9.999997e-01
[21,] 9.999998e-01 4.032879e-07 2.016439e-07
[22,] 9.999999e-01 1.784350e-07 8.921748e-08
[23,] 9.319199e-01 1.361602e-01 6.808008e-02
[24,] 1.000000e+00 7.527765e-13 3.763882e-13
[25,] 1.501062e-12 3.002124e-12 1.000000e+00
[26,] 7.145344e-16 1.429069e-15 1.000000e+00
[27,] 1.314728e-01 2.629456e-01 8.685272e-01
[28,] 2.683894e-12 5.367787e-12 1.000000e+00
[29,] 1.188053e-04 2.376105e-04 9.998812e-01
[30,] 5.460942e-01 9.078116e-01 4.539058e-01
[31,] 9.338007e-01 1.323987e-01 6.619933e-02
[32,] 1.000000e+00 0.000000e+00 0.000000e+00
[33,] 9.958957e-01 8.208511e-03 4.104255e-03
[34,] 3.299155e-02 6.598311e-02 9.670084e-01
[35,] 2.120169e-02 4.240339e-02 9.787983e-01
[36,] 9.840567e-01 3.188666e-02 1.594333e-02
[37,] 9.999525e-01 9.508382e-05 4.754191e-05
[38,] 2.114456e-02 4.228912e-02 9.788554e-01
[39,] 6.753245e-01 6.493510e-01 3.246755e-01
> postscript(file="/var/www/html/rcomp/tmp/1t0xt1258742129.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/2biur1258742129.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/3p5961258742129.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/4k2dw1258742129.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/526gz1258742129.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 = 76
Frequency = 1
1 2 3 4 5
-1.875012e-14 -7.881863e-15 1.101002e-13 1.262888e-15 -6.750433e-15
6 7 8 9 10
-5.364582e-15 -1.034757e-14 -6.744674e-15 -1.457890e-15 -3.799914e-15
11 12 13 14 15
-6.271586e-15 -4.088973e-15 2.096485e-15 -5.835708e-15 -2.348720e-14
16 17 18 19 20
-7.778927e-15 -6.196480e-15 -5.327296e-15 1.919561e-17 -2.855378e-15
21 22 23 24 25
-3.720518e-15 -1.227682e-15 -3.801606e-15 -4.686525e-16 6.391209e-15
26 27 28 29 30
-1.238008e-15 -1.617742e-14 -2.735710e-15 5.306387e-17 4.470405e-15
31 32 33 34 35
-4.351981e-15 -8.065020e-16 1.244842e-15 -4.829266e-16 -7.737900e-16
36 37 38 39 40
4.624181e-15 -4.310980e-15 6.816556e-15 -1.428659e-14 -1.665456e-15
41 42 43 44 45
2.573653e-15 4.687538e-15 1.038871e-15 7.322778e-15 -2.049064e-15
46 47 48 49 50
5.831926e-15 4.385765e-15 3.674728e-15 3.545225e-15 1.563155e-15
51 52 53 54 55
-1.477678e-14 5.318600e-15 5.914791e-15 1.831683e-15 5.995568e-15
56 57 58 59 60
5.048998e-15 3.634726e-15 2.203455e-15 3.867349e-15 -2.535626e-15
61 62 63 64 65
7.916008e-15 7.335086e-15 -2.219327e-14 3.277878e-15 4.405405e-15
66 67 68 69 70
-2.977482e-16 7.645920e-15 -1.965223e-15 2.347904e-15 -2.524859e-15
71 72 73 74 75
2.593868e-15 -1.205657e-15 3.112176e-15 -7.592177e-16 -1.917890e-14
76
2.320727e-15
> postscript(file="/var/www/html/rcomp/tmp/60j8w1258742129.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 = 76
Frequency = 1
lag(myerror, k = 1) myerror
0 -1.875012e-14 NA
1 -7.881863e-15 -1.875012e-14
2 1.101002e-13 -7.881863e-15
3 1.262888e-15 1.101002e-13
4 -6.750433e-15 1.262888e-15
5 -5.364582e-15 -6.750433e-15
6 -1.034757e-14 -5.364582e-15
7 -6.744674e-15 -1.034757e-14
8 -1.457890e-15 -6.744674e-15
9 -3.799914e-15 -1.457890e-15
10 -6.271586e-15 -3.799914e-15
11 -4.088973e-15 -6.271586e-15
12 2.096485e-15 -4.088973e-15
13 -5.835708e-15 2.096485e-15
14 -2.348720e-14 -5.835708e-15
15 -7.778927e-15 -2.348720e-14
16 -6.196480e-15 -7.778927e-15
17 -5.327296e-15 -6.196480e-15
18 1.919561e-17 -5.327296e-15
19 -2.855378e-15 1.919561e-17
20 -3.720518e-15 -2.855378e-15
21 -1.227682e-15 -3.720518e-15
22 -3.801606e-15 -1.227682e-15
23 -4.686525e-16 -3.801606e-15
24 6.391209e-15 -4.686525e-16
25 -1.238008e-15 6.391209e-15
26 -1.617742e-14 -1.238008e-15
27 -2.735710e-15 -1.617742e-14
28 5.306387e-17 -2.735710e-15
29 4.470405e-15 5.306387e-17
30 -4.351981e-15 4.470405e-15
31 -8.065020e-16 -4.351981e-15
32 1.244842e-15 -8.065020e-16
33 -4.829266e-16 1.244842e-15
34 -7.737900e-16 -4.829266e-16
35 4.624181e-15 -7.737900e-16
36 -4.310980e-15 4.624181e-15
37 6.816556e-15 -4.310980e-15
38 -1.428659e-14 6.816556e-15
39 -1.665456e-15 -1.428659e-14
40 2.573653e-15 -1.665456e-15
41 4.687538e-15 2.573653e-15
42 1.038871e-15 4.687538e-15
43 7.322778e-15 1.038871e-15
44 -2.049064e-15 7.322778e-15
45 5.831926e-15 -2.049064e-15
46 4.385765e-15 5.831926e-15
47 3.674728e-15 4.385765e-15
48 3.545225e-15 3.674728e-15
49 1.563155e-15 3.545225e-15
50 -1.477678e-14 1.563155e-15
51 5.318600e-15 -1.477678e-14
52 5.914791e-15 5.318600e-15
53 1.831683e-15 5.914791e-15
54 5.995568e-15 1.831683e-15
55 5.048998e-15 5.995568e-15
56 3.634726e-15 5.048998e-15
57 2.203455e-15 3.634726e-15
58 3.867349e-15 2.203455e-15
59 -2.535626e-15 3.867349e-15
60 7.916008e-15 -2.535626e-15
61 7.335086e-15 7.916008e-15
62 -2.219327e-14 7.335086e-15
63 3.277878e-15 -2.219327e-14
64 4.405405e-15 3.277878e-15
65 -2.977482e-16 4.405405e-15
66 7.645920e-15 -2.977482e-16
67 -1.965223e-15 7.645920e-15
68 2.347904e-15 -1.965223e-15
69 -2.524859e-15 2.347904e-15
70 2.593868e-15 -2.524859e-15
71 -1.205657e-15 2.593868e-15
72 3.112176e-15 -1.205657e-15
73 -7.592177e-16 3.112176e-15
74 -1.917890e-14 -7.592177e-16
75 2.320727e-15 -1.917890e-14
76 NA 2.320727e-15
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -7.881863e-15 -1.875012e-14
[2,] 1.101002e-13 -7.881863e-15
[3,] 1.262888e-15 1.101002e-13
[4,] -6.750433e-15 1.262888e-15
[5,] -5.364582e-15 -6.750433e-15
[6,] -1.034757e-14 -5.364582e-15
[7,] -6.744674e-15 -1.034757e-14
[8,] -1.457890e-15 -6.744674e-15
[9,] -3.799914e-15 -1.457890e-15
[10,] -6.271586e-15 -3.799914e-15
[11,] -4.088973e-15 -6.271586e-15
[12,] 2.096485e-15 -4.088973e-15
[13,] -5.835708e-15 2.096485e-15
[14,] -2.348720e-14 -5.835708e-15
[15,] -7.778927e-15 -2.348720e-14
[16,] -6.196480e-15 -7.778927e-15
[17,] -5.327296e-15 -6.196480e-15
[18,] 1.919561e-17 -5.327296e-15
[19,] -2.855378e-15 1.919561e-17
[20,] -3.720518e-15 -2.855378e-15
[21,] -1.227682e-15 -3.720518e-15
[22,] -3.801606e-15 -1.227682e-15
[23,] -4.686525e-16 -3.801606e-15
[24,] 6.391209e-15 -4.686525e-16
[25,] -1.238008e-15 6.391209e-15
[26,] -1.617742e-14 -1.238008e-15
[27,] -2.735710e-15 -1.617742e-14
[28,] 5.306387e-17 -2.735710e-15
[29,] 4.470405e-15 5.306387e-17
[30,] -4.351981e-15 4.470405e-15
[31,] -8.065020e-16 -4.351981e-15
[32,] 1.244842e-15 -8.065020e-16
[33,] -4.829266e-16 1.244842e-15
[34,] -7.737900e-16 -4.829266e-16
[35,] 4.624181e-15 -7.737900e-16
[36,] -4.310980e-15 4.624181e-15
[37,] 6.816556e-15 -4.310980e-15
[38,] -1.428659e-14 6.816556e-15
[39,] -1.665456e-15 -1.428659e-14
[40,] 2.573653e-15 -1.665456e-15
[41,] 4.687538e-15 2.573653e-15
[42,] 1.038871e-15 4.687538e-15
[43,] 7.322778e-15 1.038871e-15
[44,] -2.049064e-15 7.322778e-15
[45,] 5.831926e-15 -2.049064e-15
[46,] 4.385765e-15 5.831926e-15
[47,] 3.674728e-15 4.385765e-15
[48,] 3.545225e-15 3.674728e-15
[49,] 1.563155e-15 3.545225e-15
[50,] -1.477678e-14 1.563155e-15
[51,] 5.318600e-15 -1.477678e-14
[52,] 5.914791e-15 5.318600e-15
[53,] 1.831683e-15 5.914791e-15
[54,] 5.995568e-15 1.831683e-15
[55,] 5.048998e-15 5.995568e-15
[56,] 3.634726e-15 5.048998e-15
[57,] 2.203455e-15 3.634726e-15
[58,] 3.867349e-15 2.203455e-15
[59,] -2.535626e-15 3.867349e-15
[60,] 7.916008e-15 -2.535626e-15
[61,] 7.335086e-15 7.916008e-15
[62,] -2.219327e-14 7.335086e-15
[63,] 3.277878e-15 -2.219327e-14
[64,] 4.405405e-15 3.277878e-15
[65,] -2.977482e-16 4.405405e-15
[66,] 7.645920e-15 -2.977482e-16
[67,] -1.965223e-15 7.645920e-15
[68,] 2.347904e-15 -1.965223e-15
[69,] -2.524859e-15 2.347904e-15
[70,] 2.593868e-15 -2.524859e-15
[71,] -1.205657e-15 2.593868e-15
[72,] 3.112176e-15 -1.205657e-15
[73,] -7.592177e-16 3.112176e-15
[74,] -1.917890e-14 -7.592177e-16
[75,] 2.320727e-15 -1.917890e-14
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -7.881863e-15 -1.875012e-14
2 1.101002e-13 -7.881863e-15
3 1.262888e-15 1.101002e-13
4 -6.750433e-15 1.262888e-15
5 -5.364582e-15 -6.750433e-15
6 -1.034757e-14 -5.364582e-15
7 -6.744674e-15 -1.034757e-14
8 -1.457890e-15 -6.744674e-15
9 -3.799914e-15 -1.457890e-15
10 -6.271586e-15 -3.799914e-15
11 -4.088973e-15 -6.271586e-15
12 2.096485e-15 -4.088973e-15
13 -5.835708e-15 2.096485e-15
14 -2.348720e-14 -5.835708e-15
15 -7.778927e-15 -2.348720e-14
16 -6.196480e-15 -7.778927e-15
17 -5.327296e-15 -6.196480e-15
18 1.919561e-17 -5.327296e-15
19 -2.855378e-15 1.919561e-17
20 -3.720518e-15 -2.855378e-15
21 -1.227682e-15 -3.720518e-15
22 -3.801606e-15 -1.227682e-15
23 -4.686525e-16 -3.801606e-15
24 6.391209e-15 -4.686525e-16
25 -1.238008e-15 6.391209e-15
26 -1.617742e-14 -1.238008e-15
27 -2.735710e-15 -1.617742e-14
28 5.306387e-17 -2.735710e-15
29 4.470405e-15 5.306387e-17
30 -4.351981e-15 4.470405e-15
31 -8.065020e-16 -4.351981e-15
32 1.244842e-15 -8.065020e-16
33 -4.829266e-16 1.244842e-15
34 -7.737900e-16 -4.829266e-16
35 4.624181e-15 -7.737900e-16
36 -4.310980e-15 4.624181e-15
37 6.816556e-15 -4.310980e-15
38 -1.428659e-14 6.816556e-15
39 -1.665456e-15 -1.428659e-14
40 2.573653e-15 -1.665456e-15
41 4.687538e-15 2.573653e-15
42 1.038871e-15 4.687538e-15
43 7.322778e-15 1.038871e-15
44 -2.049064e-15 7.322778e-15
45 5.831926e-15 -2.049064e-15
46 4.385765e-15 5.831926e-15
47 3.674728e-15 4.385765e-15
48 3.545225e-15 3.674728e-15
49 1.563155e-15 3.545225e-15
50 -1.477678e-14 1.563155e-15
51 5.318600e-15 -1.477678e-14
52 5.914791e-15 5.318600e-15
53 1.831683e-15 5.914791e-15
54 5.995568e-15 1.831683e-15
55 5.048998e-15 5.995568e-15
56 3.634726e-15 5.048998e-15
57 2.203455e-15 3.634726e-15
58 3.867349e-15 2.203455e-15
59 -2.535626e-15 3.867349e-15
60 7.916008e-15 -2.535626e-15
61 7.335086e-15 7.916008e-15
62 -2.219327e-14 7.335086e-15
63 3.277878e-15 -2.219327e-14
64 4.405405e-15 3.277878e-15
65 -2.977482e-16 4.405405e-15
66 7.645920e-15 -2.977482e-16
67 -1.965223e-15 7.645920e-15
68 2.347904e-15 -1.965223e-15
69 -2.524859e-15 2.347904e-15
70 2.593868e-15 -2.524859e-15
71 -1.205657e-15 2.593868e-15
72 3.112176e-15 -1.205657e-15
73 -7.592177e-16 3.112176e-15
74 -1.917890e-14 -7.592177e-16
75 2.320727e-15 -1.917890e-14
> 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/7p5yl1258742129.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/8ljn01258742129.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/9p8x31258742129.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/10k7dj1258742129.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/11qglo1258742129.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/126ttd1258742129.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/13dug51258742129.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/14uiku1258742129.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/15h19o1258742129.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/16z09t1258742129.tab")
+ }
>
> system("convert tmp/1t0xt1258742129.ps tmp/1t0xt1258742129.png")
> system("convert tmp/2biur1258742129.ps tmp/2biur1258742129.png")
> system("convert tmp/3p5961258742129.ps tmp/3p5961258742129.png")
> system("convert tmp/4k2dw1258742129.ps tmp/4k2dw1258742129.png")
> system("convert tmp/526gz1258742129.ps tmp/526gz1258742129.png")
> system("convert tmp/60j8w1258742129.ps tmp/60j8w1258742129.png")
> system("convert tmp/7p5yl1258742129.ps tmp/7p5yl1258742129.png")
> system("convert tmp/8ljn01258742129.ps tmp/8ljn01258742129.png")
> system("convert tmp/9p8x31258742129.ps tmp/9p8x31258742129.png")
> system("convert tmp/10k7dj1258742129.ps tmp/10k7dj1258742129.png")
>
>
> proc.time()
user system elapsed
2.600 1.573 3.029