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,0,111.1,0,82.4,0,60,0,107.3,0,99.3,0,113.5,0,108.9,0,100.2,0,103.9,0,138.7,0,120.2,0,100.2,0,143.2,0,70.9,0,85.2,0,133,0,136.6,0,117.9,0,106.3,0,122.3,0,125.5,0,148.4,0,126.3,0,99.6,0,140.4,0,80.3,0,92.6,0,138.5,0,110.9,0,119.6,0,105,0,109,0,129.4,0,148.6,0,101.4,0,134.8,0,143.7,0,81.6,0,90.3,0,141.5,0,140.7,0,140.2,0,100.2,0,125.7,0,119.6,0,134.7,0,109,0,116.3,0,146.9,0,97.4,0,89.4,0,132.1,0,139.8,0,129,0,112.5,0,121.9,0,121.7,0,123.1,0,131.6,0,119.3,0,132.5,0,98.3,0,85.1,0,131.7,0,129.3,0,90.7,1,78.6,1,68.9,1,79.1,1,83.5,1,74.1,1,59.7,1,93.3,1,61.3,1,56.6,1),dim=c(2,77),dimnames=list(c('Y','X'),1:77))
> y <- array(NA,dim=c(2,77),dimnames=list(c('Y','X'),1:77))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
Y X
1 105.7 0
2 105.7 0
3 111.1 0
4 82.4 0
5 60.0 0
6 107.3 0
7 99.3 0
8 113.5 0
9 108.9 0
10 100.2 0
11 103.9 0
12 138.7 0
13 120.2 0
14 100.2 0
15 143.2 0
16 70.9 0
17 85.2 0
18 133.0 0
19 136.6 0
20 117.9 0
21 106.3 0
22 122.3 0
23 125.5 0
24 148.4 0
25 126.3 0
26 99.6 0
27 140.4 0
28 80.3 0
29 92.6 0
30 138.5 0
31 110.9 0
32 119.6 0
33 105.0 0
34 109.0 0
35 129.4 0
36 148.6 0
37 101.4 0
38 134.8 0
39 143.7 0
40 81.6 0
41 90.3 0
42 141.5 0
43 140.7 0
44 140.2 0
45 100.2 0
46 125.7 0
47 119.6 0
48 134.7 0
49 109.0 0
50 116.3 0
51 146.9 0
52 97.4 0
53 89.4 0
54 132.1 0
55 139.8 0
56 129.0 0
57 112.5 0
58 121.9 0
59 121.7 0
60 123.1 0
61 131.6 0
62 119.3 0
63 132.5 0
64 98.3 0
65 85.1 0
66 131.7 0
67 129.3 0
68 90.7 1
69 78.6 1
70 68.9 1
71 79.1 1
72 83.5 1
73 74.1 1
74 59.7 1
75 93.3 1
76 61.3 1
77 56.6 1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X
115.94 -41.36
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-55.939 -14.539 3.361 16.120 32.661
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 115.939 2.409 48.125 < 2e-16 ***
X -41.359 6.685 -6.187 2.97e-08 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 19.72 on 75 degrees of freedom
Multiple R-squared: 0.3379, Adjusted R-squared: 0.3291
F-statistic: 38.28 on 1 and 75 DF, p-value: 2.969e-08
> 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.8383762 0.32324757 0.16162378
[2,] 0.7675080 0.46498403 0.23249201
[3,] 0.6589407 0.68211867 0.34105933
[4,] 0.6130537 0.77389266 0.38694633
[5,] 0.5258915 0.94821701 0.47410851
[6,] 0.4219317 0.84386338 0.57806831
[7,] 0.3295334 0.65906677 0.67046661
[8,] 0.5848783 0.83024344 0.41512172
[9,] 0.5469466 0.90610674 0.45305337
[10,] 0.4703940 0.94078799 0.52960600
[11,] 0.6704309 0.65913829 0.32956914
[12,] 0.8372541 0.32549181 0.16274590
[13,] 0.8578929 0.28421411 0.14210706
[14,] 0.8827679 0.23446423 0.11723212
[15,] 0.9103542 0.17929156 0.08964578
[16,] 0.8830551 0.23388986 0.11694493
[17,] 0.8487458 0.30250834 0.15125417
[18,] 0.8195195 0.36096095 0.18048048
[19,] 0.7952580 0.40948405 0.20474203
[20,] 0.8857268 0.22854647 0.11427323
[21,] 0.8642039 0.27159221 0.13579610
[22,] 0.8464422 0.30711564 0.15355782
[23,] 0.8731728 0.25365448 0.12682724
[24,] 0.9310119 0.13797613 0.06898807
[25,] 0.9383947 0.12321066 0.06160533
[26,] 0.9467506 0.10649873 0.05324936
[27,] 0.9284232 0.14315350 0.07157675
[28,] 0.9050743 0.18985147 0.09492574
[29,] 0.8859277 0.22814463 0.11407232
[30,] 0.8579013 0.28419749 0.14209874
[31,] 0.8384350 0.32313005 0.16156503
[32,] 0.8982457 0.20350857 0.10175428
[33,] 0.8879538 0.22409239 0.11204619
[34,] 0.8833102 0.23337960 0.11668980
[35,] 0.9093179 0.18136419 0.09068209
[36,] 0.9601981 0.07960389 0.03980195
[37,] 0.9754122 0.04917556 0.02458778
[38,] 0.9800884 0.03982316 0.01991158
[39,] 0.9834217 0.03315663 0.01657832
[40,] 0.9861364 0.02772718 0.01386359
[41,] 0.9860675 0.02786492 0.01393246
[42,] 0.9799106 0.04017887 0.02008943
[43,] 0.9698091 0.06038180 0.03019090
[44,] 0.9670033 0.06599335 0.03299667
[45,] 0.9560457 0.08790861 0.04395431
[46,] 0.9370065 0.12598702 0.06299351
[47,] 0.9628639 0.07427228 0.03713614
[48,] 0.9674612 0.06507765 0.03253883
[49,] 0.9868064 0.02638725 0.01319363
[50,] 0.9827454 0.03450914 0.01725457
[51,] 0.9855726 0.02885478 0.01442739
[52,] 0.9799993 0.04000134 0.02000067
[53,] 0.9694049 0.06119024 0.03059512
[54,] 0.9523205 0.09535903 0.04767951
[55,] 0.9278137 0.14437260 0.07218630
[56,] 0.8955960 0.20880801 0.10440401
[57,] 0.8801957 0.23960856 0.11980428
[58,] 0.8299540 0.34009196 0.17004598
[59,] 0.8324790 0.33504199 0.16752100
[60,] 0.8115107 0.37697857 0.18848928
[61,] 0.9654830 0.06903395 0.03451697
[62,] 0.9392919 0.12141615 0.06070807
[63,] 0.8961535 0.20769297 0.10384648
[64,] 0.8954838 0.20903250 0.10451625
[65,] 0.8325502 0.33489963 0.16744981
[66,] 0.7331215 0.53375709 0.26687855
[67,] 0.6121633 0.77567338 0.38783669
[68,] 0.5174327 0.96513464 0.48256732
> postscript(file="/var/www/html/rcomp/tmp/150vy1258660754.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/2tr8i1258660754.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/3jg7g1258660754.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/4d7711258660754.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/5jtd31258660754.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 = 77
Frequency = 1
1 2 3 4 5 6 7
-10.238806 -10.238806 -4.838806 -33.538806 -55.938806 -8.638806 -16.638806
8 9 10 11 12 13 14
-2.438806 -7.038806 -15.738806 -12.038806 22.761194 4.261194 -15.738806
15 16 17 18 19 20 21
27.261194 -45.038806 -30.738806 17.061194 20.661194 1.961194 -9.638806
22 23 24 25 26 27 28
6.361194 9.561194 32.461194 10.361194 -16.338806 24.461194 -35.638806
29 30 31 32 33 34 35
-23.338806 22.561194 -5.038806 3.661194 -10.938806 -6.938806 13.461194
36 37 38 39 40 41 42
32.661194 -14.538806 18.861194 27.761194 -34.338806 -25.638806 25.561194
43 44 45 46 47 48 49
24.761194 24.261194 -15.738806 9.761194 3.661194 18.761194 -6.938806
50 51 52 53 54 55 56
0.361194 30.961194 -18.538806 -26.538806 16.161194 23.861194 13.061194
57 58 59 60 61 62 63
-3.438806 5.961194 5.761194 7.161194 15.661194 3.361194 16.561194
64 65 66 67 68 69 70
-17.638806 -30.838806 15.761194 13.361194 16.120000 4.020000 -5.680000
71 72 73 74 75 76 77
4.520000 8.920000 -0.480000 -14.880000 18.720000 -13.280000 -17.980000
> postscript(file="/var/www/html/rcomp/tmp/61woj1258660754.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 = 77
Frequency = 1
lag(myerror, k = 1) myerror
0 -10.238806 NA
1 -10.238806 -10.238806
2 -4.838806 -10.238806
3 -33.538806 -4.838806
4 -55.938806 -33.538806
5 -8.638806 -55.938806
6 -16.638806 -8.638806
7 -2.438806 -16.638806
8 -7.038806 -2.438806
9 -15.738806 -7.038806
10 -12.038806 -15.738806
11 22.761194 -12.038806
12 4.261194 22.761194
13 -15.738806 4.261194
14 27.261194 -15.738806
15 -45.038806 27.261194
16 -30.738806 -45.038806
17 17.061194 -30.738806
18 20.661194 17.061194
19 1.961194 20.661194
20 -9.638806 1.961194
21 6.361194 -9.638806
22 9.561194 6.361194
23 32.461194 9.561194
24 10.361194 32.461194
25 -16.338806 10.361194
26 24.461194 -16.338806
27 -35.638806 24.461194
28 -23.338806 -35.638806
29 22.561194 -23.338806
30 -5.038806 22.561194
31 3.661194 -5.038806
32 -10.938806 3.661194
33 -6.938806 -10.938806
34 13.461194 -6.938806
35 32.661194 13.461194
36 -14.538806 32.661194
37 18.861194 -14.538806
38 27.761194 18.861194
39 -34.338806 27.761194
40 -25.638806 -34.338806
41 25.561194 -25.638806
42 24.761194 25.561194
43 24.261194 24.761194
44 -15.738806 24.261194
45 9.761194 -15.738806
46 3.661194 9.761194
47 18.761194 3.661194
48 -6.938806 18.761194
49 0.361194 -6.938806
50 30.961194 0.361194
51 -18.538806 30.961194
52 -26.538806 -18.538806
53 16.161194 -26.538806
54 23.861194 16.161194
55 13.061194 23.861194
56 -3.438806 13.061194
57 5.961194 -3.438806
58 5.761194 5.961194
59 7.161194 5.761194
60 15.661194 7.161194
61 3.361194 15.661194
62 16.561194 3.361194
63 -17.638806 16.561194
64 -30.838806 -17.638806
65 15.761194 -30.838806
66 13.361194 15.761194
67 16.120000 13.361194
68 4.020000 16.120000
69 -5.680000 4.020000
70 4.520000 -5.680000
71 8.920000 4.520000
72 -0.480000 8.920000
73 -14.880000 -0.480000
74 18.720000 -14.880000
75 -13.280000 18.720000
76 -17.980000 -13.280000
77 NA -17.980000
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -10.238806 -10.238806
[2,] -4.838806 -10.238806
[3,] -33.538806 -4.838806
[4,] -55.938806 -33.538806
[5,] -8.638806 -55.938806
[6,] -16.638806 -8.638806
[7,] -2.438806 -16.638806
[8,] -7.038806 -2.438806
[9,] -15.738806 -7.038806
[10,] -12.038806 -15.738806
[11,] 22.761194 -12.038806
[12,] 4.261194 22.761194
[13,] -15.738806 4.261194
[14,] 27.261194 -15.738806
[15,] -45.038806 27.261194
[16,] -30.738806 -45.038806
[17,] 17.061194 -30.738806
[18,] 20.661194 17.061194
[19,] 1.961194 20.661194
[20,] -9.638806 1.961194
[21,] 6.361194 -9.638806
[22,] 9.561194 6.361194
[23,] 32.461194 9.561194
[24,] 10.361194 32.461194
[25,] -16.338806 10.361194
[26,] 24.461194 -16.338806
[27,] -35.638806 24.461194
[28,] -23.338806 -35.638806
[29,] 22.561194 -23.338806
[30,] -5.038806 22.561194
[31,] 3.661194 -5.038806
[32,] -10.938806 3.661194
[33,] -6.938806 -10.938806
[34,] 13.461194 -6.938806
[35,] 32.661194 13.461194
[36,] -14.538806 32.661194
[37,] 18.861194 -14.538806
[38,] 27.761194 18.861194
[39,] -34.338806 27.761194
[40,] -25.638806 -34.338806
[41,] 25.561194 -25.638806
[42,] 24.761194 25.561194
[43,] 24.261194 24.761194
[44,] -15.738806 24.261194
[45,] 9.761194 -15.738806
[46,] 3.661194 9.761194
[47,] 18.761194 3.661194
[48,] -6.938806 18.761194
[49,] 0.361194 -6.938806
[50,] 30.961194 0.361194
[51,] -18.538806 30.961194
[52,] -26.538806 -18.538806
[53,] 16.161194 -26.538806
[54,] 23.861194 16.161194
[55,] 13.061194 23.861194
[56,] -3.438806 13.061194
[57,] 5.961194 -3.438806
[58,] 5.761194 5.961194
[59,] 7.161194 5.761194
[60,] 15.661194 7.161194
[61,] 3.361194 15.661194
[62,] 16.561194 3.361194
[63,] -17.638806 16.561194
[64,] -30.838806 -17.638806
[65,] 15.761194 -30.838806
[66,] 13.361194 15.761194
[67,] 16.120000 13.361194
[68,] 4.020000 16.120000
[69,] -5.680000 4.020000
[70,] 4.520000 -5.680000
[71,] 8.920000 4.520000
[72,] -0.480000 8.920000
[73,] -14.880000 -0.480000
[74,] 18.720000 -14.880000
[75,] -13.280000 18.720000
[76,] -17.980000 -13.280000
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -10.238806 -10.238806
2 -4.838806 -10.238806
3 -33.538806 -4.838806
4 -55.938806 -33.538806
5 -8.638806 -55.938806
6 -16.638806 -8.638806
7 -2.438806 -16.638806
8 -7.038806 -2.438806
9 -15.738806 -7.038806
10 -12.038806 -15.738806
11 22.761194 -12.038806
12 4.261194 22.761194
13 -15.738806 4.261194
14 27.261194 -15.738806
15 -45.038806 27.261194
16 -30.738806 -45.038806
17 17.061194 -30.738806
18 20.661194 17.061194
19 1.961194 20.661194
20 -9.638806 1.961194
21 6.361194 -9.638806
22 9.561194 6.361194
23 32.461194 9.561194
24 10.361194 32.461194
25 -16.338806 10.361194
26 24.461194 -16.338806
27 -35.638806 24.461194
28 -23.338806 -35.638806
29 22.561194 -23.338806
30 -5.038806 22.561194
31 3.661194 -5.038806
32 -10.938806 3.661194
33 -6.938806 -10.938806
34 13.461194 -6.938806
35 32.661194 13.461194
36 -14.538806 32.661194
37 18.861194 -14.538806
38 27.761194 18.861194
39 -34.338806 27.761194
40 -25.638806 -34.338806
41 25.561194 -25.638806
42 24.761194 25.561194
43 24.261194 24.761194
44 -15.738806 24.261194
45 9.761194 -15.738806
46 3.661194 9.761194
47 18.761194 3.661194
48 -6.938806 18.761194
49 0.361194 -6.938806
50 30.961194 0.361194
51 -18.538806 30.961194
52 -26.538806 -18.538806
53 16.161194 -26.538806
54 23.861194 16.161194
55 13.061194 23.861194
56 -3.438806 13.061194
57 5.961194 -3.438806
58 5.761194 5.961194
59 7.161194 5.761194
60 15.661194 7.161194
61 3.361194 15.661194
62 16.561194 3.361194
63 -17.638806 16.561194
64 -30.838806 -17.638806
65 15.761194 -30.838806
66 13.361194 15.761194
67 16.120000 13.361194
68 4.020000 16.120000
69 -5.680000 4.020000
70 4.520000 -5.680000
71 8.920000 4.520000
72 -0.480000 8.920000
73 -14.880000 -0.480000
74 18.720000 -14.880000
75 -13.280000 18.720000
76 -17.980000 -13.280000
> 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/7opuk1258660754.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/8sije1258660754.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/9hi7w1258660754.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/10nz6d1258660754.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/11vx741258660754.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/126osz1258660754.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/13sk8j1258660755.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/14dmc81258660755.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/152wz61258660755.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/169jma1258660755.tab")
+ }
>
> system("convert tmp/150vy1258660754.ps tmp/150vy1258660754.png")
> system("convert tmp/2tr8i1258660754.ps tmp/2tr8i1258660754.png")
> system("convert tmp/3jg7g1258660754.ps tmp/3jg7g1258660754.png")
> system("convert tmp/4d7711258660754.ps tmp/4d7711258660754.png")
> system("convert tmp/5jtd31258660754.ps tmp/5jtd31258660754.png")
> system("convert tmp/61woj1258660754.ps tmp/61woj1258660754.png")
> system("convert tmp/7opuk1258660754.ps tmp/7opuk1258660754.png")
> system("convert tmp/8sije1258660754.ps tmp/8sije1258660754.png")
> system("convert tmp/9hi7w1258660754.ps tmp/9hi7w1258660754.png")
> system("convert tmp/10nz6d1258660754.ps tmp/10nz6d1258660754.png")
>
>
> proc.time()
user system elapsed
2.637 1.576 3.291