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(4831
+ ,0
+ ,3695
+ ,2462
+ ,2146
+ ,1579
+ ,5134
+ ,0
+ ,4831
+ ,3695
+ ,2462
+ ,2146
+ ,6250
+ ,0
+ ,5134
+ ,4831
+ ,3695
+ ,2462
+ ,5760
+ ,0
+ ,6250
+ ,5134
+ ,4831
+ ,3695
+ ,6249
+ ,0
+ ,5760
+ ,6250
+ ,5134
+ ,4831
+ ,2917
+ ,0
+ ,6249
+ ,5760
+ ,6250
+ ,5134
+ ,1741
+ ,0
+ ,2917
+ ,6249
+ ,5760
+ ,6250
+ ,2359
+ ,0
+ ,1741
+ ,2917
+ ,6249
+ ,5760
+ ,1511
+ ,1
+ ,2359
+ ,1741
+ ,2917
+ ,6249
+ ,2059
+ ,0
+ ,1511
+ ,2359
+ ,1741
+ ,2917
+ ,2635
+ ,0
+ ,2059
+ ,1511
+ ,2359
+ ,1741
+ ,2867
+ ,0
+ ,2635
+ ,2059
+ ,1511
+ ,2359
+ ,4403
+ ,0
+ ,2867
+ ,2635
+ ,2059
+ ,1511
+ ,5720
+ ,0
+ ,4403
+ ,2867
+ ,2635
+ ,2059
+ ,4502
+ ,0
+ ,5720
+ ,4403
+ ,2867
+ ,2635
+ ,5749
+ ,0
+ ,4502
+ ,5720
+ ,4403
+ ,2867
+ ,5627
+ ,0
+ ,5749
+ ,4502
+ ,5720
+ ,4403
+ ,2846
+ ,0
+ ,5627
+ ,5749
+ ,4502
+ ,5720
+ ,1762
+ ,0
+ ,2846
+ ,5627
+ ,5749
+ ,4502
+ ,2429
+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
+ ,0
+ ,2202
+ ,1376
+ ,2422
+ ,1997
+ ,3303
+ ,0
+ ,2683
+ ,2202
+ ,1376
+ ,2422
+ ,5202
+ ,0
+ ,3303
+ ,2683
+ ,2202
+ ,1376
+ ,5231
+ ,0
+ ,5202
+ ,3303
+ ,2683
+ ,2202
+ ,4880
+ ,0
+ ,5231
+ ,5202
+ ,3303
+ ,2683
+ ,7998
+ ,1
+ ,4880
+ ,5231
+ ,5202
+ ,3303
+ ,4977
+ ,0
+ ,7998
+ ,4880
+ ,5231
+ ,5202
+ ,3531
+ ,0
+ ,4977
+ ,7998
+ ,4880
+ ,5231
+ ,2025
+ ,0
+ ,3531
+ ,4977
+ ,7998
+ ,4880
+ ,2205
+ ,0
+ ,2025
+ ,3531
+ ,4977
+ ,7998
+ ,1442
+ ,0
+ ,2205
+ ,2025
+ ,3531
+ ,4977
+ ,2238
+ ,0
+ ,1442
+ ,2205
+ ,2025
+ ,3531
+ ,2179
+ ,0
+ ,2238
+ ,1442
+ ,2205
+ ,2025
+ ,3218
+ ,0
+ ,2179
+ ,2238
+ ,1442
+ ,2205
+ ,5139
+ ,0
+ ,3218
+ ,2179
+ ,2238
+ ,1442
+ ,4990
+ ,0
+ ,5139
+ ,3218
+ ,2179
+ ,2238
+ ,4914
+ ,0
+ ,4990
+ ,5139
+ ,3218
+ ,2179
+ ,6084
+ ,0
+ ,4914
+ ,4990
+ ,5139
+ ,3218
+ ,5672
+ ,1
+ ,6084
+ ,4914
+ ,4990
+ ,5139
+ ,3548
+ ,0
+ ,5672
+ ,6084
+ ,4914
+ ,4990
+ ,1793
+ ,0
+ ,3548
+ ,5672
+ ,6084
+ ,4914
+ ,2086
+ ,0
+ ,1793
+ ,3548
+ ,5672
+ ,6084)
+ ,dim=c(6
+ ,116)
+ ,dimnames=list(c('Y'
+ ,'X'
+ ,'Y1'
+ ,'Y2'
+ ,'Y3'
+ ,'Y4')
+ ,1:116))
> y <- array(NA,dim=c(6,116),dimnames=list(c('Y','X','Y1','Y2','Y3','Y4'),1:116))
> 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 Y3 Y4 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 4831 0 3695 2462 2146 1579 1 0 0 0 0 0 0 0 0 0 0 1
2 5134 0 4831 3695 2462 2146 0 1 0 0 0 0 0 0 0 0 0 2
3 6250 0 5134 4831 3695 2462 0 0 1 0 0 0 0 0 0 0 0 3
4 5760 0 6250 5134 4831 3695 0 0 0 1 0 0 0 0 0 0 0 4
5 6249 0 5760 6250 5134 4831 0 0 0 0 1 0 0 0 0 0 0 5
6 2917 0 6249 5760 6250 5134 0 0 0 0 0 1 0 0 0 0 0 6
7 1741 0 2917 6249 5760 6250 0 0 0 0 0 0 1 0 0 0 0 7
8 2359 0 1741 2917 6249 5760 0 0 0 0 0 0 0 1 0 0 0 8
9 1511 1 2359 1741 2917 6249 0 0 0 0 0 0 0 0 1 0 0 9
10 2059 0 1511 2359 1741 2917 0 0 0 0 0 0 0 0 0 1 0 10
11 2635 0 2059 1511 2359 1741 0 0 0 0 0 0 0 0 0 0 1 11
12 2867 0 2635 2059 1511 2359 0 0 0 0 0 0 0 0 0 0 0 12
13 4403 0 2867 2635 2059 1511 1 0 0 0 0 0 0 0 0 0 0 13
14 5720 0 4403 2867 2635 2059 0 1 0 0 0 0 0 0 0 0 0 14
15 4502 0 5720 4403 2867 2635 0 0 1 0 0 0 0 0 0 0 0 15
16 5749 0 4502 5720 4403 2867 0 0 0 1 0 0 0 0 0 0 0 16
17 5627 0 5749 4502 5720 4403 0 0 0 0 1 0 0 0 0 0 0 17
18 2846 0 5627 5749 4502 5720 0 0 0 0 0 1 0 0 0 0 0 18
19 1762 0 2846 5627 5749 4502 0 0 0 0 0 0 1 0 0 0 0 19
20 2429 0 1762 2846 5627 5749 0 0 0 0 0 0 0 1 0 0 0 20
21 1169 0 2429 1762 2846 5627 0 0 0 0 0 0 0 0 1 0 0 21
22 2154 1 1169 2429 1762 2846 0 0 0 0 0 0 0 0 0 1 0 22
23 2249 0 2154 1169 2429 1762 0 0 0 0 0 0 0 0 0 0 1 23
24 2687 0 2249 2154 1169 2429 0 0 0 0 0 0 0 0 0 0 0 24
25 4359 0 2687 2249 2154 1169 1 0 0 0 0 0 0 0 0 0 0 25
26 5382 0 4359 2687 2249 2154 0 1 0 0 0 0 0 0 0 0 0 26
27 4459 0 5382 4359 2687 2249 0 0 1 0 0 0 0 0 0 0 0 27
28 6398 0 4459 5382 4359 2687 0 0 0 1 0 0 0 0 0 0 0 28
29 4596 0 6398 4459 5382 4359 0 0 0 0 1 0 0 0 0 0 0 29
30 3024 0 4596 6398 4459 5382 0 0 0 0 0 1 0 0 0 0 0 30
31 1887 0 3024 4596 6398 4459 0 0 0 0 0 0 1 0 0 0 0 31
32 2070 0 1887 3024 4596 6398 0 0 0 0 0 0 0 1 0 0 0 32
33 1351 0 2070 1887 3024 4596 0 0 0 0 0 0 0 0 1 0 0 33
34 2218 0 1351 2070 1887 3024 0 0 0 0 0 0 0 0 0 1 0 34
35 2461 1 2218 1351 2070 1887 0 0 0 0 0 0 0 0 0 0 1 35
36 3028 0 2461 2218 1351 2070 0 0 0 0 0 0 0 0 0 0 0 36
37 4784 0 3028 2461 2218 1351 1 0 0 0 0 0 0 0 0 0 0 37
38 4975 0 4784 3028 2461 2218 0 1 0 0 0 0 0 0 0 0 0 38
39 4607 0 4975 4784 3028 2461 0 0 1 0 0 0 0 0 0 0 0 39
40 6249 0 4607 4975 4784 3028 0 0 0 1 0 0 0 0 0 0 0 40
41 4809 0 6249 4607 4975 4784 0 0 0 0 1 0 0 0 0 0 0 41
42 3157 0 4809 6249 4607 4975 0 0 0 0 0 1 0 0 0 0 0 42
43 1910 0 3157 4809 6249 4607 0 0 0 0 0 0 1 0 0 0 0 43
44 2228 0 1910 3157 4809 6249 0 0 0 0 0 0 0 1 0 0 0 44
45 1594 0 2228 1910 3157 4809 0 0 0 0 0 0 0 0 1 0 0 45
46 2467 0 1594 2228 1910 3157 0 0 0 0 0 0 0 0 0 1 0 46
47 2222 0 2467 1594 2228 1910 0 0 0 0 0 0 0 0 0 0 1 47
48 3607 1 2222 2467 1594 2228 0 0 0 0 0 0 0 0 0 0 0 48
49 4685 0 3607 2222 2467 1594 1 0 0 0 0 0 0 0 0 0 0 49
50 4962 0 4685 3607 2222 2467 0 1 0 0 0 0 0 0 0 0 0 50
51 5770 0 4962 4685 3607 2222 0 0 1 0 0 0 0 0 0 0 0 51
52 5480 0 5770 4962 4685 3607 0 0 0 1 0 0 0 0 0 0 0 52
53 5000 0 5480 5770 4962 4685 0 0 0 0 1 0 0 0 0 0 0 53
54 3228 0 5000 5480 5770 4962 0 0 0 0 0 1 0 0 0 0 0 54
55 1993 0 3228 5000 5480 5770 0 0 0 0 0 0 1 0 0 0 0 55
56 2288 0 1993 3228 5000 5480 0 0 0 0 0 0 0 1 0 0 0 56
57 1580 0 2288 1993 3228 5000 0 0 0 0 0 0 0 0 1 0 0 57
58 2111 0 1580 2288 1993 3228 0 0 0 0 0 0 0 0 0 1 0 58
59 2192 0 2111 1580 2288 1993 0 0 0 0 0 0 0 0 0 0 1 59
60 3601 0 2192 2111 1580 2288 0 0 0 0 0 0 0 0 0 0 0 60
61 4665 1 3601 2192 2111 1580 1 0 0 0 0 0 0 0 0 0 0 61
62 4876 0 4665 3601 2192 2111 0 1 0 0 0 0 0 0 0 0 0 62
63 5813 0 4876 4665 3601 2192 0 0 1 0 0 0 0 0 0 0 0 63
64 5589 0 5813 4876 4665 3601 0 0 0 1 0 0 0 0 0 0 0 64
65 5331 0 5589 5813 4876 4665 0 0 0 0 1 0 0 0 0 0 0 65
66 3075 0 5331 5589 5813 4876 0 0 0 0 0 1 0 0 0 0 0 66
67 2002 0 3075 5331 5589 5813 0 0 0 0 0 0 1 0 0 0 0 67
68 2306 0 2002 3075 5331 5589 0 0 0 0 0 0 0 1 0 0 0 68
69 1507 0 2306 2002 3075 5331 0 0 0 0 0 0 0 0 1 0 0 69
70 1992 0 1507 2306 2002 3075 0 0 0 0 0 0 0 0 0 1 0 70
71 2487 0 1992 1507 2306 2002 0 0 0 0 0 0 0 0 0 0 1 71
72 3490 0 2487 1992 1507 2306 0 0 0 0 0 0 0 0 0 0 0 72
73 4647 0 3490 2487 1992 1507 1 0 0 0 0 0 0 0 0 0 0 73
74 5594 1 4647 3490 2487 1992 0 1 0 0 0 0 0 0 0 0 0 74
75 5611 0 5594 4647 3490 2487 0 0 1 0 0 0 0 0 0 0 0 75
76 5788 0 5611 5594 4647 3490 0 0 0 1 0 0 0 0 0 0 0 76
77 6204 0 5788 5611 5594 4647 0 0 0 0 1 0 0 0 0 0 0 77
78 3013 0 6204 5788 5611 5594 0 0 0 0 0 1 0 0 0 0 0 78
79 1931 0 3013 6204 5788 5611 0 0 0 0 0 0 1 0 0 0 0 79
80 2549 0 1931 3013 6204 5788 0 0 0 0 0 0 0 1 0 0 0 80
81 1504 0 2549 1931 3013 6204 0 0 0 0 0 0 0 0 1 0 0 81
82 2090 0 1504 2549 1931 3013 0 0 0 0 0 0 0 0 0 1 0 82
83 2702 0 2090 1504 2549 1931 0 0 0 0 0 0 0 0 0 0 1 83
84 2939 0 2702 2090 1504 2549 0 0 0 0 0 0 0 0 0 0 0 84
85 4500 0 2939 2702 2090 1504 1 0 0 0 0 0 0 0 0 0 0 85
86 6208 0 4500 2939 2702 2090 0 1 0 0 0 0 0 0 0 0 0 86
87 6415 1 6208 4500 2939 2702 0 0 1 0 0 0 0 0 0 0 0 87
88 5657 0 6415 6208 4500 2939 0 0 0 1 0 0 0 0 0 0 0 88
89 5964 0 5657 6415 6208 4500 0 0 0 0 1 0 0 0 0 0 0 89
90 3163 0 5964 5657 6415 6208 0 0 0 0 0 1 0 0 0 0 0 90
91 1997 0 3163 5964 5657 6415 0 0 0 0 0 0 1 0 0 0 0 91
92 2422 0 1997 3163 5964 5657 0 0 0 0 0 0 0 1 0 0 0 92
93 1376 0 2422 1997 3163 5964 0 0 0 0 0 0 0 0 1 0 0 93
94 2202 0 1376 2422 1997 3163 0 0 0 0 0 0 0 0 0 1 0 94
95 2683 0 2202 1376 2422 1997 0 0 0 0 0 0 0 0 0 0 1 95
96 3303 0 2683 2202 1376 2422 0 0 0 0 0 0 0 0 0 0 0 96
97 5202 0 3303 2683 2202 1376 1 0 0 0 0 0 0 0 0 0 0 97
98 5231 0 5202 3303 2683 2202 0 1 0 0 0 0 0 0 0 0 0 98
99 4880 0 5231 5202 3303 2683 0 0 1 0 0 0 0 0 0 0 0 99
100 7998 1 4880 5231 5202 3303 0 0 0 1 0 0 0 0 0 0 0 100
101 4977 0 7998 4880 5231 5202 0 0 0 0 1 0 0 0 0 0 0 101
102 3531 0 4977 7998 4880 5231 0 0 0 0 0 1 0 0 0 0 0 102
103 2025 0 3531 4977 7998 4880 0 0 0 0 0 0 1 0 0 0 0 103
104 2205 0 2025 3531 4977 7998 0 0 0 0 0 0 0 1 0 0 0 104
105 1442 0 2205 2025 3531 4977 0 0 0 0 0 0 0 0 1 0 0 105
106 2238 0 1442 2205 2025 3531 0 0 0 0 0 0 0 0 0 1 0 106
107 2179 0 2238 1442 2205 2025 0 0 0 0 0 0 0 0 0 0 1 107
108 3218 0 2179 2238 1442 2205 0 0 0 0 0 0 0 0 0 0 0 108
109 5139 0 3218 2179 2238 1442 1 0 0 0 0 0 0 0 0 0 0 109
110 4990 0 5139 3218 2179 2238 0 1 0 0 0 0 0 0 0 0 0 110
111 4914 0 4990 5139 3218 2179 0 0 1 0 0 0 0 0 0 0 0 111
112 6084 0 4914 4990 5139 3218 0 0 0 1 0 0 0 0 0 0 0 112
113 5672 1 6084 4914 4990 5139 0 0 0 0 1 0 0 0 0 0 0 113
114 3548 0 5672 6084 4914 4990 0 0 0 0 0 1 0 0 0 0 0 114
115 1793 0 3548 5672 6084 4914 0 0 0 0 0 0 1 0 0 0 0 115
116 2086 0 1793 3548 5672 6084 0 0 0 0 0 0 0 1 0 0 0 116
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X Y1 Y2 Y3 Y4
2.965e+03 5.283e+02 -2.984e-01 1.048e-01 3.438e-01 2.545e-02
M1 M2 M3 M4 M5 M6
1.535e+03 2.367e+03 2.113e+03 2.279e+03 1.629e+03 -9.006e+02
M7 M8 M9 M10 M11 t
-3.026e+03 -2.571e+03 -2.394e+03 -1.507e+03 -1.057e+03 1.802e+00
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-662.3 -214.2 -22.8 161.1 1081.0
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.965e+03 3.976e+02 7.458 3.57e-11 ***
X 5.283e+02 1.233e+02 4.287 4.25e-05 ***
Y1 -2.984e-01 9.227e-02 -3.234 0.001665 **
Y2 1.048e-01 9.134e-02 1.148 0.253905
Y3 3.438e-01 9.124e-02 3.768 0.000281 ***
Y4 2.545e-02 9.271e-02 0.275 0.784259
M1 1.535e+03 2.115e+02 7.258 9.35e-11 ***
M2 2.367e+03 3.203e+02 7.392 4.91e-11 ***
M3 2.113e+03 4.705e+02 4.491 1.93e-05 ***
M4 2.279e+03 5.807e+02 3.924 0.000162 ***
M5 1.629e+03 6.742e+02 2.416 0.017555 *
M6 -9.006e+02 7.129e+02 -1.263 0.209487
M7 -3.026e+03 6.867e+02 -4.406 2.69e-05 ***
M8 -2.571e+03 6.161e+02 -4.172 6.53e-05 ***
M9 -2.394e+03 3.994e+02 -5.992 3.44e-08 ***
M10 -1.507e+03 2.199e+02 -6.853 6.44e-10 ***
M11 -1.057e+03 1.883e+02 -5.611 1.87e-07 ***
t 1.802e+00 1.044e+00 1.726 0.087583 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 347 on 98 degrees of freedom
Multiple R-squared: 0.9614, Adjusted R-squared: 0.9547
F-statistic: 143.5 on 17 and 98 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,] 0.97799669 0.04400662 0.02200331
[2,] 0.96716327 0.06567346 0.03283673
[3,] 0.93629836 0.12740328 0.06370164
[4,] 0.89481445 0.21037110 0.10518555
[5,] 0.84163711 0.31672578 0.15836289
[6,] 0.81842368 0.36315264 0.18157632
[7,] 0.79596752 0.40806496 0.20403248
[8,] 0.85273788 0.29452423 0.14726212
[9,] 0.84766192 0.30467616 0.15233808
[10,] 0.79047869 0.41904262 0.20952131
[11,] 0.79276269 0.41447461 0.20723731
[12,] 0.81056222 0.37887556 0.18943778
[13,] 0.76257715 0.47484570 0.23742285
[14,] 0.74042003 0.51915994 0.25957997
[15,] 0.72884097 0.54231805 0.27115903
[16,] 0.70212667 0.59574667 0.29787333
[17,] 0.65569581 0.68860837 0.34430419
[18,] 0.60621350 0.78757301 0.39378650
[19,] 0.68969805 0.62060390 0.31030195
[20,] 0.64064696 0.71870609 0.35935304
[21,] 0.60118890 0.79762221 0.39881110
[22,] 0.55137957 0.89724086 0.44862043
[23,] 0.53109823 0.93780354 0.46890177
[24,] 0.49715961 0.99431922 0.50284039
[25,] 0.44782300 0.89564600 0.55217700
[26,] 0.46237861 0.92475721 0.53762139
[27,] 0.40030770 0.80061541 0.59969230
[28,] 0.38879644 0.77759288 0.61120356
[29,] 0.33431504 0.66863007 0.66568496
[30,] 0.31543500 0.63086999 0.68456500
[31,] 0.29896445 0.59792889 0.70103555
[32,] 0.27903548 0.55807096 0.72096452
[33,] 0.34509312 0.69018625 0.65490688
[34,] 0.30554532 0.61109063 0.69445468
[35,] 0.32876357 0.65752715 0.67123643
[36,] 0.28975824 0.57951648 0.71024176
[37,] 0.24070565 0.48141130 0.75929435
[38,] 0.19636581 0.39273162 0.80363419
[39,] 0.17185744 0.34371489 0.82814256
[40,] 0.16880289 0.33760578 0.83119711
[41,] 0.23031414 0.46062828 0.76968586
[42,] 0.22525901 0.45051803 0.77474099
[43,] 0.20939811 0.41879621 0.79060189
[44,] 0.19530497 0.39060993 0.80469503
[45,] 0.16778287 0.33556574 0.83221713
[46,] 0.17580816 0.35161631 0.82419184
[47,] 0.14395609 0.28791218 0.85604391
[48,] 0.11169693 0.22339386 0.88830307
[49,] 0.08400442 0.16800884 0.91599558
[50,] 0.07108334 0.14216667 0.92891666
[51,] 0.05375431 0.10750863 0.94624569
[52,] 0.04727812 0.09455625 0.95272188
[53,] 0.03798868 0.07597735 0.96201132
[54,] 0.13344687 0.26689374 0.86655313
[55,] 0.13491316 0.26982632 0.86508684
[56,] 0.13048801 0.26097603 0.86951199
[57,] 0.19282723 0.38565447 0.80717277
[58,] 0.18104880 0.36209759 0.81895120
[59,] 0.15065376 0.30130751 0.84934624
[60,] 0.11870412 0.23740824 0.88129588
[61,] 0.08651975 0.17303949 0.91348025
[62,] 0.07117435 0.14234871 0.92882565
[63,] 0.04898635 0.09797269 0.95101365
[64,] 0.04760656 0.09521311 0.95239344
[65,] 0.21450498 0.42900995 0.78549502
[66,] 0.30429260 0.60858520 0.69570740
[67,] 0.47871092 0.95742183 0.52128908
[68,] 0.75282922 0.49434156 0.24717078
[69,] 0.95141759 0.09716482 0.04858241
[70,] 0.98502987 0.02994025 0.01497013
[71,] 0.97846095 0.04307810 0.02153905
[72,] 0.95214281 0.09571437 0.04785719
[73,] 0.91412638 0.17174724 0.08587362
[74,] 0.84987890 0.30024220 0.15012110
[75,] 0.95031446 0.09937107 0.04968554
> postscript(file="/var/www/html/rcomp/tmp/1nmiv1290869068.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/285ka1290869069.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/385ka1290869069.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/485ka1290869069.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/585ka1290869069.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 = 116
Frequency = 1
1 2 3 4 5 6
395.1795484 -49.1253413 858.7856354 80.8349256 821.6756645 -176.9003539
7 8 9 10 11 12
-135.1374693 -131.2033845 -245.7326198 113.5782798 307.2755906 -128.9675954
13 14 15 16 17 18
-288.0023953 417.0837492 -410.8781982 -366.5839948 167.4554151 132.0342355
19 20 21 22 23 24
-43.4704059 144.9880207 -22.0872974 -456.1882179 -60.7488869 -339.9378805
25 26 27 28 29 30
-390.8247874 193.4784623 -500.0396591 303.1013668 -569.6955378 -63.8725993
31 32 33 34 35 36
-0.9164763 120.9130836 -16.8851111 158.9702828 -278.4679126 -17.4434073
37 38 39 40 41 42
65.4417142 -218.5890069 -662.2810545 64.5210989 -309.1954011 86.1591122
43 44 45 46 47 48
65.2705398 180.7779717 198.0809257 430.9979479 -16.8250613 -173.3872314
49 50 51 52 53 54
50.8512915 -267.6258634 292.6325551 -358.4244061 -484.2050099 -126.3363309
55 56 57 58 59 60
362.5692126 190.3886996 142.3894801 12.5662622 -195.9448936 358.9873912
61 62 63 64 65 66
-395.0239514 -361.2146123 293.2701883 -242.1746106 -116.7397287 -226.2157018
67 68 69 70 71 72
231.0278411 88.9258533 96.3651986 -150.9266500 43.1589312 351.4981793
73 74 75 76 77 78
72.4183650 -285.3027991 316.4221623 -191.3273148 568.8192185 -19.0455443
79 80 81 82 83 84
-34.8825167 -9.5627484 150.7850625 -74.9339274 184.3610101 -172.4007050
85 86 87 88 89 90
-316.7667621 772.9117967 953.0165939 -103.8588143 -23.5118467 -240.5699062
91 92 93 94 95 96
103.9806029 -68.3785735 -89.1100052 -35.9445661 232.5532299 199.8001174
97 98 99 100 101 102
438.9674619 -50.7249045 -565.0233126 1080.9803385 145.2914263 118.4520814
103 104 105 106 107 108
-442.0741172 -57.5055972 -213.8056334 1.8805888 -215.3620075 -78.1488682
109 110 111 112 113 114
367.7595153 -150.8914809 -575.9049106 -267.0685893 -199.8942002 516.2950072
115 116
-106.3672109 -459.3433253
> postscript(file="/var/www/html/rcomp/tmp/6jxjd1290869069.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 = 116
Frequency = 1
lag(myerror, k = 1) myerror
0 395.1795484 NA
1 -49.1253413 395.1795484
2 858.7856354 -49.1253413
3 80.8349256 858.7856354
4 821.6756645 80.8349256
5 -176.9003539 821.6756645
6 -135.1374693 -176.9003539
7 -131.2033845 -135.1374693
8 -245.7326198 -131.2033845
9 113.5782798 -245.7326198
10 307.2755906 113.5782798
11 -128.9675954 307.2755906
12 -288.0023953 -128.9675954
13 417.0837492 -288.0023953
14 -410.8781982 417.0837492
15 -366.5839948 -410.8781982
16 167.4554151 -366.5839948
17 132.0342355 167.4554151
18 -43.4704059 132.0342355
19 144.9880207 -43.4704059
20 -22.0872974 144.9880207
21 -456.1882179 -22.0872974
22 -60.7488869 -456.1882179
23 -339.9378805 -60.7488869
24 -390.8247874 -339.9378805
25 193.4784623 -390.8247874
26 -500.0396591 193.4784623
27 303.1013668 -500.0396591
28 -569.6955378 303.1013668
29 -63.8725993 -569.6955378
30 -0.9164763 -63.8725993
31 120.9130836 -0.9164763
32 -16.8851111 120.9130836
33 158.9702828 -16.8851111
34 -278.4679126 158.9702828
35 -17.4434073 -278.4679126
36 65.4417142 -17.4434073
37 -218.5890069 65.4417142
38 -662.2810545 -218.5890069
39 64.5210989 -662.2810545
40 -309.1954011 64.5210989
41 86.1591122 -309.1954011
42 65.2705398 86.1591122
43 180.7779717 65.2705398
44 198.0809257 180.7779717
45 430.9979479 198.0809257
46 -16.8250613 430.9979479
47 -173.3872314 -16.8250613
48 50.8512915 -173.3872314
49 -267.6258634 50.8512915
50 292.6325551 -267.6258634
51 -358.4244061 292.6325551
52 -484.2050099 -358.4244061
53 -126.3363309 -484.2050099
54 362.5692126 -126.3363309
55 190.3886996 362.5692126
56 142.3894801 190.3886996
57 12.5662622 142.3894801
58 -195.9448936 12.5662622
59 358.9873912 -195.9448936
60 -395.0239514 358.9873912
61 -361.2146123 -395.0239514
62 293.2701883 -361.2146123
63 -242.1746106 293.2701883
64 -116.7397287 -242.1746106
65 -226.2157018 -116.7397287
66 231.0278411 -226.2157018
67 88.9258533 231.0278411
68 96.3651986 88.9258533
69 -150.9266500 96.3651986
70 43.1589312 -150.9266500
71 351.4981793 43.1589312
72 72.4183650 351.4981793
73 -285.3027991 72.4183650
74 316.4221623 -285.3027991
75 -191.3273148 316.4221623
76 568.8192185 -191.3273148
77 -19.0455443 568.8192185
78 -34.8825167 -19.0455443
79 -9.5627484 -34.8825167
80 150.7850625 -9.5627484
81 -74.9339274 150.7850625
82 184.3610101 -74.9339274
83 -172.4007050 184.3610101
84 -316.7667621 -172.4007050
85 772.9117967 -316.7667621
86 953.0165939 772.9117967
87 -103.8588143 953.0165939
88 -23.5118467 -103.8588143
89 -240.5699062 -23.5118467
90 103.9806029 -240.5699062
91 -68.3785735 103.9806029
92 -89.1100052 -68.3785735
93 -35.9445661 -89.1100052
94 232.5532299 -35.9445661
95 199.8001174 232.5532299
96 438.9674619 199.8001174
97 -50.7249045 438.9674619
98 -565.0233126 -50.7249045
99 1080.9803385 -565.0233126
100 145.2914263 1080.9803385
101 118.4520814 145.2914263
102 -442.0741172 118.4520814
103 -57.5055972 -442.0741172
104 -213.8056334 -57.5055972
105 1.8805888 -213.8056334
106 -215.3620075 1.8805888
107 -78.1488682 -215.3620075
108 367.7595153 -78.1488682
109 -150.8914809 367.7595153
110 -575.9049106 -150.8914809
111 -267.0685893 -575.9049106
112 -199.8942002 -267.0685893
113 516.2950072 -199.8942002
114 -106.3672109 516.2950072
115 -459.3433253 -106.3672109
116 NA -459.3433253
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -49.1253413 395.1795484
[2,] 858.7856354 -49.1253413
[3,] 80.8349256 858.7856354
[4,] 821.6756645 80.8349256
[5,] -176.9003539 821.6756645
[6,] -135.1374693 -176.9003539
[7,] -131.2033845 -135.1374693
[8,] -245.7326198 -131.2033845
[9,] 113.5782798 -245.7326198
[10,] 307.2755906 113.5782798
[11,] -128.9675954 307.2755906
[12,] -288.0023953 -128.9675954
[13,] 417.0837492 -288.0023953
[14,] -410.8781982 417.0837492
[15,] -366.5839948 -410.8781982
[16,] 167.4554151 -366.5839948
[17,] 132.0342355 167.4554151
[18,] -43.4704059 132.0342355
[19,] 144.9880207 -43.4704059
[20,] -22.0872974 144.9880207
[21,] -456.1882179 -22.0872974
[22,] -60.7488869 -456.1882179
[23,] -339.9378805 -60.7488869
[24,] -390.8247874 -339.9378805
[25,] 193.4784623 -390.8247874
[26,] -500.0396591 193.4784623
[27,] 303.1013668 -500.0396591
[28,] -569.6955378 303.1013668
[29,] -63.8725993 -569.6955378
[30,] -0.9164763 -63.8725993
[31,] 120.9130836 -0.9164763
[32,] -16.8851111 120.9130836
[33,] 158.9702828 -16.8851111
[34,] -278.4679126 158.9702828
[35,] -17.4434073 -278.4679126
[36,] 65.4417142 -17.4434073
[37,] -218.5890069 65.4417142
[38,] -662.2810545 -218.5890069
[39,] 64.5210989 -662.2810545
[40,] -309.1954011 64.5210989
[41,] 86.1591122 -309.1954011
[42,] 65.2705398 86.1591122
[43,] 180.7779717 65.2705398
[44,] 198.0809257 180.7779717
[45,] 430.9979479 198.0809257
[46,] -16.8250613 430.9979479
[47,] -173.3872314 -16.8250613
[48,] 50.8512915 -173.3872314
[49,] -267.6258634 50.8512915
[50,] 292.6325551 -267.6258634
[51,] -358.4244061 292.6325551
[52,] -484.2050099 -358.4244061
[53,] -126.3363309 -484.2050099
[54,] 362.5692126 -126.3363309
[55,] 190.3886996 362.5692126
[56,] 142.3894801 190.3886996
[57,] 12.5662622 142.3894801
[58,] -195.9448936 12.5662622
[59,] 358.9873912 -195.9448936
[60,] -395.0239514 358.9873912
[61,] -361.2146123 -395.0239514
[62,] 293.2701883 -361.2146123
[63,] -242.1746106 293.2701883
[64,] -116.7397287 -242.1746106
[65,] -226.2157018 -116.7397287
[66,] 231.0278411 -226.2157018
[67,] 88.9258533 231.0278411
[68,] 96.3651986 88.9258533
[69,] -150.9266500 96.3651986
[70,] 43.1589312 -150.9266500
[71,] 351.4981793 43.1589312
[72,] 72.4183650 351.4981793
[73,] -285.3027991 72.4183650
[74,] 316.4221623 -285.3027991
[75,] -191.3273148 316.4221623
[76,] 568.8192185 -191.3273148
[77,] -19.0455443 568.8192185
[78,] -34.8825167 -19.0455443
[79,] -9.5627484 -34.8825167
[80,] 150.7850625 -9.5627484
[81,] -74.9339274 150.7850625
[82,] 184.3610101 -74.9339274
[83,] -172.4007050 184.3610101
[84,] -316.7667621 -172.4007050
[85,] 772.9117967 -316.7667621
[86,] 953.0165939 772.9117967
[87,] -103.8588143 953.0165939
[88,] -23.5118467 -103.8588143
[89,] -240.5699062 -23.5118467
[90,] 103.9806029 -240.5699062
[91,] -68.3785735 103.9806029
[92,] -89.1100052 -68.3785735
[93,] -35.9445661 -89.1100052
[94,] 232.5532299 -35.9445661
[95,] 199.8001174 232.5532299
[96,] 438.9674619 199.8001174
[97,] -50.7249045 438.9674619
[98,] -565.0233126 -50.7249045
[99,] 1080.9803385 -565.0233126
[100,] 145.2914263 1080.9803385
[101,] 118.4520814 145.2914263
[102,] -442.0741172 118.4520814
[103,] -57.5055972 -442.0741172
[104,] -213.8056334 -57.5055972
[105,] 1.8805888 -213.8056334
[106,] -215.3620075 1.8805888
[107,] -78.1488682 -215.3620075
[108,] 367.7595153 -78.1488682
[109,] -150.8914809 367.7595153
[110,] -575.9049106 -150.8914809
[111,] -267.0685893 -575.9049106
[112,] -199.8942002 -267.0685893
[113,] 516.2950072 -199.8942002
[114,] -106.3672109 516.2950072
[115,] -459.3433253 -106.3672109
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -49.1253413 395.1795484
2 858.7856354 -49.1253413
3 80.8349256 858.7856354
4 821.6756645 80.8349256
5 -176.9003539 821.6756645
6 -135.1374693 -176.9003539
7 -131.2033845 -135.1374693
8 -245.7326198 -131.2033845
9 113.5782798 -245.7326198
10 307.2755906 113.5782798
11 -128.9675954 307.2755906
12 -288.0023953 -128.9675954
13 417.0837492 -288.0023953
14 -410.8781982 417.0837492
15 -366.5839948 -410.8781982
16 167.4554151 -366.5839948
17 132.0342355 167.4554151
18 -43.4704059 132.0342355
19 144.9880207 -43.4704059
20 -22.0872974 144.9880207
21 -456.1882179 -22.0872974
22 -60.7488869 -456.1882179
23 -339.9378805 -60.7488869
24 -390.8247874 -339.9378805
25 193.4784623 -390.8247874
26 -500.0396591 193.4784623
27 303.1013668 -500.0396591
28 -569.6955378 303.1013668
29 -63.8725993 -569.6955378
30 -0.9164763 -63.8725993
31 120.9130836 -0.9164763
32 -16.8851111 120.9130836
33 158.9702828 -16.8851111
34 -278.4679126 158.9702828
35 -17.4434073 -278.4679126
36 65.4417142 -17.4434073
37 -218.5890069 65.4417142
38 -662.2810545 -218.5890069
39 64.5210989 -662.2810545
40 -309.1954011 64.5210989
41 86.1591122 -309.1954011
42 65.2705398 86.1591122
43 180.7779717 65.2705398
44 198.0809257 180.7779717
45 430.9979479 198.0809257
46 -16.8250613 430.9979479
47 -173.3872314 -16.8250613
48 50.8512915 -173.3872314
49 -267.6258634 50.8512915
50 292.6325551 -267.6258634
51 -358.4244061 292.6325551
52 -484.2050099 -358.4244061
53 -126.3363309 -484.2050099
54 362.5692126 -126.3363309
55 190.3886996 362.5692126
56 142.3894801 190.3886996
57 12.5662622 142.3894801
58 -195.9448936 12.5662622
59 358.9873912 -195.9448936
60 -395.0239514 358.9873912
61 -361.2146123 -395.0239514
62 293.2701883 -361.2146123
63 -242.1746106 293.2701883
64 -116.7397287 -242.1746106
65 -226.2157018 -116.7397287
66 231.0278411 -226.2157018
67 88.9258533 231.0278411
68 96.3651986 88.9258533
69 -150.9266500 96.3651986
70 43.1589312 -150.9266500
71 351.4981793 43.1589312
72 72.4183650 351.4981793
73 -285.3027991 72.4183650
74 316.4221623 -285.3027991
75 -191.3273148 316.4221623
76 568.8192185 -191.3273148
77 -19.0455443 568.8192185
78 -34.8825167 -19.0455443
79 -9.5627484 -34.8825167
80 150.7850625 -9.5627484
81 -74.9339274 150.7850625
82 184.3610101 -74.9339274
83 -172.4007050 184.3610101
84 -316.7667621 -172.4007050
85 772.9117967 -316.7667621
86 953.0165939 772.9117967
87 -103.8588143 953.0165939
88 -23.5118467 -103.8588143
89 -240.5699062 -23.5118467
90 103.9806029 -240.5699062
91 -68.3785735 103.9806029
92 -89.1100052 -68.3785735
93 -35.9445661 -89.1100052
94 232.5532299 -35.9445661
95 199.8001174 232.5532299
96 438.9674619 199.8001174
97 -50.7249045 438.9674619
98 -565.0233126 -50.7249045
99 1080.9803385 -565.0233126
100 145.2914263 1080.9803385
101 118.4520814 145.2914263
102 -442.0741172 118.4520814
103 -57.5055972 -442.0741172
104 -213.8056334 -57.5055972
105 1.8805888 -213.8056334
106 -215.3620075 1.8805888
107 -78.1488682 -215.3620075
108 367.7595153 -78.1488682
109 -150.8914809 367.7595153
110 -575.9049106 -150.8914809
111 -267.0685893 -575.9049106
112 -199.8942002 -267.0685893
113 516.2950072 -199.8942002
114 -106.3672109 516.2950072
115 -459.3433253 -106.3672109
> 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/7bo0g1290869069.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/8bo0g1290869069.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/9bo0g1290869069.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/104fhj1290869069.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/117yy71290869069.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/12tywv1290869069.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/1378c41290869069.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/14sqta1290869069.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/15liad1290869069.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/16za8l1290869069.tab")
+ }
>
> try(system("convert tmp/1nmiv1290869068.ps tmp/1nmiv1290869068.png",intern=TRUE))
character(0)
> try(system("convert tmp/285ka1290869069.ps tmp/285ka1290869069.png",intern=TRUE))
character(0)
> try(system("convert tmp/385ka1290869069.ps tmp/385ka1290869069.png",intern=TRUE))
character(0)
> try(system("convert tmp/485ka1290869069.ps tmp/485ka1290869069.png",intern=TRUE))
character(0)
> try(system("convert tmp/585ka1290869069.ps tmp/585ka1290869069.png",intern=TRUE))
character(0)
> try(system("convert tmp/6jxjd1290869069.ps tmp/6jxjd1290869069.png",intern=TRUE))
character(0)
> try(system("convert tmp/7bo0g1290869069.ps tmp/7bo0g1290869069.png",intern=TRUE))
character(0)
> try(system("convert tmp/8bo0g1290869069.ps tmp/8bo0g1290869069.png",intern=TRUE))
character(0)
> try(system("convert tmp/9bo0g1290869069.ps tmp/9bo0g1290869069.png",intern=TRUE))
character(0)
> try(system("convert tmp/104fhj1290869069.ps tmp/104fhj1290869069.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.318 1.705 8.098