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(2360,2,2214,2,2825,2,2355,2,2333,2,3016,2,2155,2,2172,2,2150,2,2533,2,2058,2,2160,2,2260,2,2498,2,2695,2,2799,2,2947,2,2930,2,2318,2,2540,2,2570,2,2669,2,2450,2,2842,2,3440,2,2678,2,2981,2,2260,2.21,2844,2.25,2546,2.25,2456,2.45,2295,2.5,2379,2.5,2479,2.64,2057,2.75,2280,2.93,2351,3,2276,3.17,2548,3.25,2311,3.39,2201,3.5,2725,3.5,2408,3.65,2139,3.75,1898,3.75,2537,3.9,2069,4,2063,4,2524,4,2437,4,2189,4,2793,4,2074,4,2622,4,2278,4,2144,4,2427,4,2139,4,1828,4.18,2072,4.25,1800,4.25),dim=c(2,61),dimnames=list(c('Y','X'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('Y','X'),1:61))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'Linear Trend'
> par2 = 'Include Monthly Dummies'
> par1 = '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 2360 2.00 1 0 0 0 0 0 0 0 0 0 0 1
2 2214 2.00 0 1 0 0 0 0 0 0 0 0 0 2
3 2825 2.00 0 0 1 0 0 0 0 0 0 0 0 3
4 2355 2.00 0 0 0 1 0 0 0 0 0 0 0 4
5 2333 2.00 0 0 0 0 1 0 0 0 0 0 0 5
6 3016 2.00 0 0 0 0 0 1 0 0 0 0 0 6
7 2155 2.00 0 0 0 0 0 0 1 0 0 0 0 7
8 2172 2.00 0 0 0 0 0 0 0 1 0 0 0 8
9 2150 2.00 0 0 0 0 0 0 0 0 1 0 0 9
10 2533 2.00 0 0 0 0 0 0 0 0 0 1 0 10
11 2058 2.00 0 0 0 0 0 0 0 0 0 0 1 11
12 2160 2.00 0 0 0 0 0 0 0 0 0 0 0 12
13 2260 2.00 1 0 0 0 0 0 0 0 0 0 0 13
14 2498 2.00 0 1 0 0 0 0 0 0 0 0 0 14
15 2695 2.00 0 0 1 0 0 0 0 0 0 0 0 15
16 2799 2.00 0 0 0 1 0 0 0 0 0 0 0 16
17 2947 2.00 0 0 0 0 1 0 0 0 0 0 0 17
18 2930 2.00 0 0 0 0 0 1 0 0 0 0 0 18
19 2318 2.00 0 0 0 0 0 0 1 0 0 0 0 19
20 2540 2.00 0 0 0 0 0 0 0 1 0 0 0 20
21 2570 2.00 0 0 0 0 0 0 0 0 1 0 0 21
22 2669 2.00 0 0 0 0 0 0 0 0 0 1 0 22
23 2450 2.00 0 0 0 0 0 0 0 0 0 0 1 23
24 2842 2.00 0 0 0 0 0 0 0 0 0 0 0 24
25 3440 2.00 1 0 0 0 0 0 0 0 0 0 0 25
26 2678 2.00 0 1 0 0 0 0 0 0 0 0 0 26
27 2981 2.00 0 0 1 0 0 0 0 0 0 0 0 27
28 2260 2.21 0 0 0 1 0 0 0 0 0 0 0 28
29 2844 2.25 0 0 0 0 1 0 0 0 0 0 0 29
30 2546 2.25 0 0 0 0 0 1 0 0 0 0 0 30
31 2456 2.45 0 0 0 0 0 0 1 0 0 0 0 31
32 2295 2.50 0 0 0 0 0 0 0 1 0 0 0 32
33 2379 2.50 0 0 0 0 0 0 0 0 1 0 0 33
34 2479 2.64 0 0 0 0 0 0 0 0 0 1 0 34
35 2057 2.75 0 0 0 0 0 0 0 0 0 0 1 35
36 2280 2.93 0 0 0 0 0 0 0 0 0 0 0 36
37 2351 3.00 1 0 0 0 0 0 0 0 0 0 0 37
38 2276 3.17 0 1 0 0 0 0 0 0 0 0 0 38
39 2548 3.25 0 0 1 0 0 0 0 0 0 0 0 39
40 2311 3.39 0 0 0 1 0 0 0 0 0 0 0 40
41 2201 3.50 0 0 0 0 1 0 0 0 0 0 0 41
42 2725 3.50 0 0 0 0 0 1 0 0 0 0 0 42
43 2408 3.65 0 0 0 0 0 0 1 0 0 0 0 43
44 2139 3.75 0 0 0 0 0 0 0 1 0 0 0 44
45 1898 3.75 0 0 0 0 0 0 0 0 1 0 0 45
46 2537 3.90 0 0 0 0 0 0 0 0 0 1 0 46
47 2069 4.00 0 0 0 0 0 0 0 0 0 0 1 47
48 2063 4.00 0 0 0 0 0 0 0 0 0 0 0 48
49 2524 4.00 1 0 0 0 0 0 0 0 0 0 0 49
50 2437 4.00 0 1 0 0 0 0 0 0 0 0 0 50
51 2189 4.00 0 0 1 0 0 0 0 0 0 0 0 51
52 2793 4.00 0 0 0 1 0 0 0 0 0 0 0 52
53 2074 4.00 0 0 0 0 1 0 0 0 0 0 0 53
54 2622 4.00 0 0 0 0 0 1 0 0 0 0 0 54
55 2278 4.00 0 0 0 0 0 0 1 0 0 0 0 55
56 2144 4.00 0 0 0 0 0 0 0 1 0 0 0 56
57 2427 4.00 0 0 0 0 0 0 0 0 1 0 0 57
58 2139 4.00 0 0 0 0 0 0 0 0 0 1 0 58
59 1828 4.18 0 0 0 0 0 0 0 0 0 0 1 59
60 2072 4.25 0 0 0 0 0 0 0 0 0 0 0 60
61 1800 4.25 1 0 0 0 0 0 0 0 0 0 0 61
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X M1 M2 M3 M4
2996.22 -397.43 177.03 114.60 334.24 204.34
M5 M6 M7 M8 M9 M10
178.75 453.03 22.34 -44.46 -31.37 164.56
M11 t
-197.16 13.72
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-520.85 -129.19 -25.74 111.98 718.71
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2996.219 185.869 16.120 < 2e-16 ***
X -397.434 100.092 -3.971 0.000244 ***
M1 177.029 149.576 1.184 0.242550
M2 114.596 156.951 0.730 0.468929
M3 334.238 156.647 2.134 0.038116 *
M4 204.342 156.539 1.305 0.198119
M5 178.749 156.325 1.143 0.258646
M6 453.032 156.130 2.902 0.005633 **
M7 22.336 156.024 0.143 0.886776
M8 -44.457 155.918 -0.285 0.776796
M9 -31.373 155.909 -0.201 0.841388
M10 164.561 155.828 1.056 0.296346
M11 -197.155 155.759 -1.266 0.211833
t 13.716 5.039 2.722 0.009075 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 246.3 on 47 degrees of freedom
Multiple R-squared: 0.5321, Adjusted R-squared: 0.4027
F-statistic: 4.112 on 13 and 47 DF, p-value: 0.0001655
> 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.61350274 0.7729945 0.3864973
[2,] 0.52147671 0.9570466 0.4785233
[3,] 0.39509878 0.7901976 0.6049012
[4,] 0.29378576 0.5875715 0.7062142
[5,] 0.22001875 0.4400375 0.7799813
[6,] 0.14040922 0.2808184 0.8595908
[7,] 0.09426555 0.1885311 0.9057345
[8,] 0.12971782 0.2594356 0.8702822
[9,] 0.60587506 0.7882499 0.3941249
[10,] 0.53858371 0.9228326 0.4614163
[11,] 0.58205713 0.8358857 0.4179429
[12,] 0.57565176 0.8486965 0.4243482
[13,] 0.77912647 0.4417471 0.2208735
[14,] 0.76545671 0.4690866 0.2345433
[15,] 0.83074671 0.3385066 0.1692533
[16,] 0.76686467 0.4662707 0.2331353
[17,] 0.69903836 0.6019233 0.3009616
[18,] 0.61026398 0.7794720 0.3897360
[19,] 0.51181586 0.9763683 0.4881841
[20,] 0.43481104 0.8696221 0.5651890
[21,] 0.36102947 0.7220589 0.6389705
[22,] 0.28371262 0.5674252 0.7162874
[23,] 0.33481560 0.6696312 0.6651844
[24,] 0.33405974 0.6681195 0.6659403
[25,] 0.23520934 0.4704187 0.7647907
[26,] 0.18186411 0.3637282 0.8181359
[27,] 0.15925296 0.3185059 0.8407470
[28,] 0.08607578 0.1721516 0.9139242
> postscript(file="/var/www/html/rcomp/tmp/14i0o1258654644.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/29kvw1258654644.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/3qb1c1258654644.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/4qrf01258654644.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/5xrpu1258654644.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 = 61
Frequency = 1
1 2 3 4 5 6
-32.094783 -129.378485 248.262564 -105.557849 -115.680883 279.319117
7 8 9 10 11 12
-164.701295 -94.624329 -143.424329 29.924472 -97.075416 -205.947139
13 14 15 16 17 18
-296.692265 -9.975967 -46.334919 173.844669 333.721635 28.721635
19 20 21 22 23 24
-166.298777 108.778189 111.978189 1.326990 130.327102 311.455379
25 26 27 28 29 30
718.710253 5.426551 75.067599 -446.291576 165.482769 -420.517231
31 32 33 34 35 36
-14.050751 -102.102062 -44.902062 -98.912436 -129.194533 -45.528053
37 38 39 40 41 42
-137.452767 -96.172610 -25.736805 -90.916392 -145.321635 90.678365
43 44 45 46 47 48
250.273122 74.093534 -193.706466 295.257505 215.001063 -1.870660
49 50 51 52 53 54
268.384214 230.100512 -251.258440 468.921148 -238.201886 21.798114
55 56 57 58 59 60
94.777702 13.854668 270.054668 -227.596531 -119.058216 -58.109527
61
-520.854652
> postscript(file="/var/www/html/rcomp/tmp/6zt8p1258654644.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 = 61
Frequency = 1
lag(myerror, k = 1) myerror
0 -32.094783 NA
1 -129.378485 -32.094783
2 248.262564 -129.378485
3 -105.557849 248.262564
4 -115.680883 -105.557849
5 279.319117 -115.680883
6 -164.701295 279.319117
7 -94.624329 -164.701295
8 -143.424329 -94.624329
9 29.924472 -143.424329
10 -97.075416 29.924472
11 -205.947139 -97.075416
12 -296.692265 -205.947139
13 -9.975967 -296.692265
14 -46.334919 -9.975967
15 173.844669 -46.334919
16 333.721635 173.844669
17 28.721635 333.721635
18 -166.298777 28.721635
19 108.778189 -166.298777
20 111.978189 108.778189
21 1.326990 111.978189
22 130.327102 1.326990
23 311.455379 130.327102
24 718.710253 311.455379
25 5.426551 718.710253
26 75.067599 5.426551
27 -446.291576 75.067599
28 165.482769 -446.291576
29 -420.517231 165.482769
30 -14.050751 -420.517231
31 -102.102062 -14.050751
32 -44.902062 -102.102062
33 -98.912436 -44.902062
34 -129.194533 -98.912436
35 -45.528053 -129.194533
36 -137.452767 -45.528053
37 -96.172610 -137.452767
38 -25.736805 -96.172610
39 -90.916392 -25.736805
40 -145.321635 -90.916392
41 90.678365 -145.321635
42 250.273122 90.678365
43 74.093534 250.273122
44 -193.706466 74.093534
45 295.257505 -193.706466
46 215.001063 295.257505
47 -1.870660 215.001063
48 268.384214 -1.870660
49 230.100512 268.384214
50 -251.258440 230.100512
51 468.921148 -251.258440
52 -238.201886 468.921148
53 21.798114 -238.201886
54 94.777702 21.798114
55 13.854668 94.777702
56 270.054668 13.854668
57 -227.596531 270.054668
58 -119.058216 -227.596531
59 -58.109527 -119.058216
60 -520.854652 -58.109527
61 NA -520.854652
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -129.378485 -32.094783
[2,] 248.262564 -129.378485
[3,] -105.557849 248.262564
[4,] -115.680883 -105.557849
[5,] 279.319117 -115.680883
[6,] -164.701295 279.319117
[7,] -94.624329 -164.701295
[8,] -143.424329 -94.624329
[9,] 29.924472 -143.424329
[10,] -97.075416 29.924472
[11,] -205.947139 -97.075416
[12,] -296.692265 -205.947139
[13,] -9.975967 -296.692265
[14,] -46.334919 -9.975967
[15,] 173.844669 -46.334919
[16,] 333.721635 173.844669
[17,] 28.721635 333.721635
[18,] -166.298777 28.721635
[19,] 108.778189 -166.298777
[20,] 111.978189 108.778189
[21,] 1.326990 111.978189
[22,] 130.327102 1.326990
[23,] 311.455379 130.327102
[24,] 718.710253 311.455379
[25,] 5.426551 718.710253
[26,] 75.067599 5.426551
[27,] -446.291576 75.067599
[28,] 165.482769 -446.291576
[29,] -420.517231 165.482769
[30,] -14.050751 -420.517231
[31,] -102.102062 -14.050751
[32,] -44.902062 -102.102062
[33,] -98.912436 -44.902062
[34,] -129.194533 -98.912436
[35,] -45.528053 -129.194533
[36,] -137.452767 -45.528053
[37,] -96.172610 -137.452767
[38,] -25.736805 -96.172610
[39,] -90.916392 -25.736805
[40,] -145.321635 -90.916392
[41,] 90.678365 -145.321635
[42,] 250.273122 90.678365
[43,] 74.093534 250.273122
[44,] -193.706466 74.093534
[45,] 295.257505 -193.706466
[46,] 215.001063 295.257505
[47,] -1.870660 215.001063
[48,] 268.384214 -1.870660
[49,] 230.100512 268.384214
[50,] -251.258440 230.100512
[51,] 468.921148 -251.258440
[52,] -238.201886 468.921148
[53,] 21.798114 -238.201886
[54,] 94.777702 21.798114
[55,] 13.854668 94.777702
[56,] 270.054668 13.854668
[57,] -227.596531 270.054668
[58,] -119.058216 -227.596531
[59,] -58.109527 -119.058216
[60,] -520.854652 -58.109527
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -129.378485 -32.094783
2 248.262564 -129.378485
3 -105.557849 248.262564
4 -115.680883 -105.557849
5 279.319117 -115.680883
6 -164.701295 279.319117
7 -94.624329 -164.701295
8 -143.424329 -94.624329
9 29.924472 -143.424329
10 -97.075416 29.924472
11 -205.947139 -97.075416
12 -296.692265 -205.947139
13 -9.975967 -296.692265
14 -46.334919 -9.975967
15 173.844669 -46.334919
16 333.721635 173.844669
17 28.721635 333.721635
18 -166.298777 28.721635
19 108.778189 -166.298777
20 111.978189 108.778189
21 1.326990 111.978189
22 130.327102 1.326990
23 311.455379 130.327102
24 718.710253 311.455379
25 5.426551 718.710253
26 75.067599 5.426551
27 -446.291576 75.067599
28 165.482769 -446.291576
29 -420.517231 165.482769
30 -14.050751 -420.517231
31 -102.102062 -14.050751
32 -44.902062 -102.102062
33 -98.912436 -44.902062
34 -129.194533 -98.912436
35 -45.528053 -129.194533
36 -137.452767 -45.528053
37 -96.172610 -137.452767
38 -25.736805 -96.172610
39 -90.916392 -25.736805
40 -145.321635 -90.916392
41 90.678365 -145.321635
42 250.273122 90.678365
43 74.093534 250.273122
44 -193.706466 74.093534
45 295.257505 -193.706466
46 215.001063 295.257505
47 -1.870660 215.001063
48 268.384214 -1.870660
49 230.100512 268.384214
50 -251.258440 230.100512
51 468.921148 -251.258440
52 -238.201886 468.921148
53 21.798114 -238.201886
54 94.777702 21.798114
55 13.854668 94.777702
56 270.054668 13.854668
57 -227.596531 270.054668
58 -119.058216 -227.596531
59 -58.109527 -119.058216
60 -520.854652 -58.109527
> 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/7froz1258654644.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/8iua51258654644.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/9akzf1258654644.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/10a6uw1258654644.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/11oic61258654644.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/125nu01258654644.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/13me051258654644.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/14g2ia1258654644.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/158wsl1258654644.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/16uhma1258654644.tab")
+ }
> system("convert tmp/14i0o1258654644.ps tmp/14i0o1258654644.png")
> system("convert tmp/29kvw1258654644.ps tmp/29kvw1258654644.png")
> system("convert tmp/3qb1c1258654644.ps tmp/3qb1c1258654644.png")
> system("convert tmp/4qrf01258654644.ps tmp/4qrf01258654644.png")
> system("convert tmp/5xrpu1258654644.ps tmp/5xrpu1258654644.png")
> system("convert tmp/6zt8p1258654644.ps tmp/6zt8p1258654644.png")
> system("convert tmp/7froz1258654644.ps tmp/7froz1258654644.png")
> system("convert tmp/8iua51258654644.ps tmp/8iua51258654644.png")
> system("convert tmp/9akzf1258654644.ps tmp/9akzf1258654644.png")
> system("convert tmp/10a6uw1258654644.ps tmp/10a6uw1258654644.png")
>
>
> proc.time()
user system elapsed
2.380 1.594 2.841