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(11,8.3,8,8.2,6,8,10,7.9,11,7.6,10,7.6,9,8.3,8,8.4,11,8.4,10,8.4,12,8.4,13,8.6,13,8.9,13,8.8,13,8.3,13,7.5,12,7.2,13,7.4,12,8.8,13,9.3,12,9.3,14,8.7,11,8.2,12,8.3,13,8.5,13,8.6,12,8.5,10,8.2,9,8.1,10,7.9,10,8.6,9,8.7,7,8.7,11,8.5,11,8.4,12,8.5,13,8.7,13,8.7,12,8.6,12,8.5,10,8.3,12,8,12,8.2,12,8.1,10,8.1,13,8,13,7.9,11,7.9,13,8,12,8,11,7.9,12,8,12,7.7,11,7.2,10,7.5,9,7.3,10,7,9,7,6,7,7,7.2,5,7.3,8,7.1,5,6.8,5,6.4,5,6.1,1,6.5,3,7.7,5,7.9,7,7.5,2,6.9,3,6.6,2,6.9),dim=c(2,72),dimnames=list(c('Y','X'),1:72))
> y <- array(NA,dim=c(2,72),dimnames=list(c('Y','X'),1:72))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
Y X
1 11 8.3
2 8 8.2
3 6 8.0
4 10 7.9
5 11 7.6
6 10 7.6
7 9 8.3
8 8 8.4
9 11 8.4
10 10 8.4
11 12 8.4
12 13 8.6
13 13 8.9
14 13 8.8
15 13 8.3
16 13 7.5
17 12 7.2
18 13 7.4
19 12 8.8
20 13 9.3
21 12 9.3
22 14 8.7
23 11 8.2
24 12 8.3
25 13 8.5
26 13 8.6
27 12 8.5
28 10 8.2
29 9 8.1
30 10 7.9
31 10 8.6
32 9 8.7
33 7 8.7
34 11 8.5
35 11 8.4
36 12 8.5
37 13 8.7
38 13 8.7
39 12 8.6
40 12 8.5
41 10 8.3
42 12 8.0
43 12 8.2
44 12 8.1
45 10 8.1
46 13 8.0
47 13 7.9
48 11 7.9
49 13 8.0
50 12 8.0
51 11 7.9
52 12 8.0
53 12 7.7
54 11 7.2
55 10 7.5
56 9 7.3
57 10 7.0
58 9 7.0
59 6 7.0
60 7 7.2
61 5 7.3
62 8 7.1
63 5 6.8
64 5 6.4
65 5 6.1
66 1 6.5
67 3 7.7
68 5 7.9
69 7 7.5
70 2 6.9
71 3 6.6
72 2 6.9
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X
-14.104 3.019
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-6.1438 -1.2808 0.3938 1.4457 4.7619
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -14.1035 3.2639 -4.321 5.03e-05 ***
X 3.0191 0.4089 7.383 2.49e-10 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.402 on 70 degrees of freedom
Multiple R-squared: 0.4378, Adjusted R-squared: 0.4298
F-statistic: 54.51 on 1 and 70 DF, p-value: 2.490e-10
> 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.617893138 0.764213724 0.3821069
[2,] 0.450570539 0.901141078 0.5494295
[3,] 0.310967187 0.621934375 0.6890328
[4,] 0.215235882 0.430471764 0.7847641
[5,] 0.221019535 0.442039070 0.7789805
[6,] 0.153897824 0.307795648 0.8461022
[7,] 0.178055047 0.356110095 0.8219450
[8,] 0.221735709 0.443471417 0.7782643
[9,] 0.187172834 0.374345668 0.8128272
[10,] 0.147813374 0.295626748 0.8521866
[11,] 0.157698469 0.315396938 0.8423015
[12,] 0.288837349 0.577674698 0.7111627
[13,] 0.320140497 0.640280994 0.6798595
[14,] 0.385966057 0.771932115 0.6140339
[15,] 0.320763465 0.641526931 0.6792365
[16,] 0.279995886 0.559991772 0.7200041
[17,] 0.234909267 0.469818534 0.7650907
[18,] 0.240279255 0.480558510 0.7597207
[19,] 0.184539996 0.369079993 0.8154600
[20,] 0.143403529 0.286807059 0.8565965
[21,] 0.121054542 0.242109084 0.8789455
[22,] 0.098026283 0.196052565 0.9019737
[23,] 0.070422685 0.140845370 0.9295773
[24,] 0.054032735 0.108065469 0.9459673
[25,] 0.049679209 0.099358418 0.9503208
[26,] 0.035272951 0.070545903 0.9647270
[27,] 0.029932790 0.059865580 0.9700672
[28,] 0.039849851 0.079699701 0.9601501
[29,] 0.150255138 0.300510277 0.8497449
[30,] 0.119053890 0.238107781 0.8809461
[31,] 0.090875195 0.181750390 0.9091248
[32,] 0.068601937 0.137203874 0.9313981
[33,] 0.055747617 0.111495234 0.9442524
[34,] 0.044412209 0.088824419 0.9555878
[35,] 0.032818656 0.065637312 0.9671813
[36,] 0.023410726 0.046821452 0.9765893
[37,] 0.019803460 0.039606921 0.9801965
[38,] 0.014229244 0.028458488 0.9857708
[39,] 0.009470574 0.018941149 0.9905294
[40,] 0.006276703 0.012553405 0.9937233
[41,] 0.004404515 0.008809030 0.9955955
[42,] 0.004037971 0.008075943 0.9959620
[43,] 0.004251314 0.008502629 0.9957487
[44,] 0.002575267 0.005150534 0.9974247
[45,] 0.002618376 0.005236752 0.9973816
[46,] 0.001920573 0.003841145 0.9980794
[47,] 0.001243954 0.002487907 0.9987560
[48,] 0.001103989 0.002207977 0.9988960
[49,] 0.001951550 0.003903101 0.9980484
[50,] 0.005051471 0.010102943 0.9949485
[51,] 0.007699910 0.015399819 0.9923001
[52,] 0.011536255 0.023072510 0.9884637
[53,] 0.044805775 0.089611550 0.9551942
[54,] 0.124852669 0.249705339 0.8751473
[55,] 0.149011581 0.298023161 0.8509884
[56,] 0.187854296 0.375708593 0.8121457
[57,] 0.195763070 0.391526141 0.8042369
[58,] 0.387662613 0.775325226 0.6123374
[59,] 0.369437667 0.738875334 0.6305623
[60,] 0.370461876 0.740923752 0.6295381
[61,] 0.607095074 0.785809851 0.3929049
[62,] 0.557847989 0.884304022 0.4421520
[63,] 0.617965525 0.764068950 0.3820345
> postscript(file="/var/www/html/rcomp/tmp/1eqyh1260365582.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/2wymf1260365582.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/3fbak1260365582.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/4m3q51260365582.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/54nu61260365582.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 72
Frequency = 1
1 2 3 4 5 6
0.04471838 -2.65336817 -4.04954126 0.25237219 2.15811255 1.15811255
7 8 9 10 11 12
-1.95528162 -3.25719508 -0.25719508 -1.25719508 0.74280492 1.13897802
13 14 15 16 17 18
0.23323765 0.53515111 2.04471838 4.46002601 4.36576637 4.76193946
19 20 21 22 23 24
-0.46484889 -0.97441616 -1.97441616 1.83706456 0.34663183 1.04471838
25 26 27 28 29 30
1.44089147 1.13897802 0.44089147 -0.65336817 -1.35145472 0.25237219
31 32 33 34 35 36
-1.86102198 -3.16293544 -5.16293544 -0.55910853 -0.25719508 0.44089147
37 38 39 40 41 42
0.83706456 0.83706456 0.13897802 0.44089147 -0.95528162 1.95045874
43 44 45 46 47 48
1.34663183 1.64854528 -0.35145472 2.95045874 3.25237219 1.25237219
49 50 51 52 53 54
2.95045874 1.95045874 1.25237219 1.95045874 2.85619910 3.36576637
55 56 57 58 59 60
1.46002601 1.06385291 2.96959328 1.96959328 -1.03040672 -0.63423363
61 62 63 64 65 66
-2.93614709 0.66767982 -1.42657982 -0.21892600 0.68681436 -4.52083946
67 68 69 70 71 72
-6.14380090 -4.74762781 -1.53997399 -4.72849327 -2.82275291 -4.72849327
> postscript(file="/var/www/html/rcomp/tmp/6ndu11260365582.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 72
Frequency = 1
lag(myerror, k = 1) myerror
0 0.04471838 NA
1 -2.65336817 0.04471838
2 -4.04954126 -2.65336817
3 0.25237219 -4.04954126
4 2.15811255 0.25237219
5 1.15811255 2.15811255
6 -1.95528162 1.15811255
7 -3.25719508 -1.95528162
8 -0.25719508 -3.25719508
9 -1.25719508 -0.25719508
10 0.74280492 -1.25719508
11 1.13897802 0.74280492
12 0.23323765 1.13897802
13 0.53515111 0.23323765
14 2.04471838 0.53515111
15 4.46002601 2.04471838
16 4.36576637 4.46002601
17 4.76193946 4.36576637
18 -0.46484889 4.76193946
19 -0.97441616 -0.46484889
20 -1.97441616 -0.97441616
21 1.83706456 -1.97441616
22 0.34663183 1.83706456
23 1.04471838 0.34663183
24 1.44089147 1.04471838
25 1.13897802 1.44089147
26 0.44089147 1.13897802
27 -0.65336817 0.44089147
28 -1.35145472 -0.65336817
29 0.25237219 -1.35145472
30 -1.86102198 0.25237219
31 -3.16293544 -1.86102198
32 -5.16293544 -3.16293544
33 -0.55910853 -5.16293544
34 -0.25719508 -0.55910853
35 0.44089147 -0.25719508
36 0.83706456 0.44089147
37 0.83706456 0.83706456
38 0.13897802 0.83706456
39 0.44089147 0.13897802
40 -0.95528162 0.44089147
41 1.95045874 -0.95528162
42 1.34663183 1.95045874
43 1.64854528 1.34663183
44 -0.35145472 1.64854528
45 2.95045874 -0.35145472
46 3.25237219 2.95045874
47 1.25237219 3.25237219
48 2.95045874 1.25237219
49 1.95045874 2.95045874
50 1.25237219 1.95045874
51 1.95045874 1.25237219
52 2.85619910 1.95045874
53 3.36576637 2.85619910
54 1.46002601 3.36576637
55 1.06385291 1.46002601
56 2.96959328 1.06385291
57 1.96959328 2.96959328
58 -1.03040672 1.96959328
59 -0.63423363 -1.03040672
60 -2.93614709 -0.63423363
61 0.66767982 -2.93614709
62 -1.42657982 0.66767982
63 -0.21892600 -1.42657982
64 0.68681436 -0.21892600
65 -4.52083946 0.68681436
66 -6.14380090 -4.52083946
67 -4.74762781 -6.14380090
68 -1.53997399 -4.74762781
69 -4.72849327 -1.53997399
70 -2.82275291 -4.72849327
71 -4.72849327 -2.82275291
72 NA -4.72849327
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -2.6533682 0.04471838
[2,] -4.0495413 -2.65336817
[3,] 0.2523722 -4.04954126
[4,] 2.1581126 0.25237219
[5,] 1.1581126 2.15811255
[6,] -1.9552816 1.15811255
[7,] -3.2571951 -1.95528162
[8,] -0.2571951 -3.25719508
[9,] -1.2571951 -0.25719508
[10,] 0.7428049 -1.25719508
[11,] 1.1389780 0.74280492
[12,] 0.2332377 1.13897802
[13,] 0.5351511 0.23323765
[14,] 2.0447184 0.53515111
[15,] 4.4600260 2.04471838
[16,] 4.3657664 4.46002601
[17,] 4.7619395 4.36576637
[18,] -0.4648489 4.76193946
[19,] -0.9744162 -0.46484889
[20,] -1.9744162 -0.97441616
[21,] 1.8370646 -1.97441616
[22,] 0.3466318 1.83706456
[23,] 1.0447184 0.34663183
[24,] 1.4408915 1.04471838
[25,] 1.1389780 1.44089147
[26,] 0.4408915 1.13897802
[27,] -0.6533682 0.44089147
[28,] -1.3514547 -0.65336817
[29,] 0.2523722 -1.35145472
[30,] -1.8610220 0.25237219
[31,] -3.1629354 -1.86102198
[32,] -5.1629354 -3.16293544
[33,] -0.5591085 -5.16293544
[34,] -0.2571951 -0.55910853
[35,] 0.4408915 -0.25719508
[36,] 0.8370646 0.44089147
[37,] 0.8370646 0.83706456
[38,] 0.1389780 0.83706456
[39,] 0.4408915 0.13897802
[40,] -0.9552816 0.44089147
[41,] 1.9504587 -0.95528162
[42,] 1.3466318 1.95045874
[43,] 1.6485453 1.34663183
[44,] -0.3514547 1.64854528
[45,] 2.9504587 -0.35145472
[46,] 3.2523722 2.95045874
[47,] 1.2523722 3.25237219
[48,] 2.9504587 1.25237219
[49,] 1.9504587 2.95045874
[50,] 1.2523722 1.95045874
[51,] 1.9504587 1.25237219
[52,] 2.8561991 1.95045874
[53,] 3.3657664 2.85619910
[54,] 1.4600260 3.36576637
[55,] 1.0638529 1.46002601
[56,] 2.9695933 1.06385291
[57,] 1.9695933 2.96959328
[58,] -1.0304067 1.96959328
[59,] -0.6342336 -1.03040672
[60,] -2.9361471 -0.63423363
[61,] 0.6676798 -2.93614709
[62,] -1.4265798 0.66767982
[63,] -0.2189260 -1.42657982
[64,] 0.6868144 -0.21892600
[65,] -4.5208395 0.68681436
[66,] -6.1438009 -4.52083946
[67,] -4.7476278 -6.14380090
[68,] -1.5399740 -4.74762781
[69,] -4.7284933 -1.53997399
[70,] -2.8227529 -4.72849327
[71,] -4.7284933 -2.82275291
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -2.6533682 0.04471838
2 -4.0495413 -2.65336817
3 0.2523722 -4.04954126
4 2.1581126 0.25237219
5 1.1581126 2.15811255
6 -1.9552816 1.15811255
7 -3.2571951 -1.95528162
8 -0.2571951 -3.25719508
9 -1.2571951 -0.25719508
10 0.7428049 -1.25719508
11 1.1389780 0.74280492
12 0.2332377 1.13897802
13 0.5351511 0.23323765
14 2.0447184 0.53515111
15 4.4600260 2.04471838
16 4.3657664 4.46002601
17 4.7619395 4.36576637
18 -0.4648489 4.76193946
19 -0.9744162 -0.46484889
20 -1.9744162 -0.97441616
21 1.8370646 -1.97441616
22 0.3466318 1.83706456
23 1.0447184 0.34663183
24 1.4408915 1.04471838
25 1.1389780 1.44089147
26 0.4408915 1.13897802
27 -0.6533682 0.44089147
28 -1.3514547 -0.65336817
29 0.2523722 -1.35145472
30 -1.8610220 0.25237219
31 -3.1629354 -1.86102198
32 -5.1629354 -3.16293544
33 -0.5591085 -5.16293544
34 -0.2571951 -0.55910853
35 0.4408915 -0.25719508
36 0.8370646 0.44089147
37 0.8370646 0.83706456
38 0.1389780 0.83706456
39 0.4408915 0.13897802
40 -0.9552816 0.44089147
41 1.9504587 -0.95528162
42 1.3466318 1.95045874
43 1.6485453 1.34663183
44 -0.3514547 1.64854528
45 2.9504587 -0.35145472
46 3.2523722 2.95045874
47 1.2523722 3.25237219
48 2.9504587 1.25237219
49 1.9504587 2.95045874
50 1.2523722 1.95045874
51 1.9504587 1.25237219
52 2.8561991 1.95045874
53 3.3657664 2.85619910
54 1.4600260 3.36576637
55 1.0638529 1.46002601
56 2.9695933 1.06385291
57 1.9695933 2.96959328
58 -1.0304067 1.96959328
59 -0.6342336 -1.03040672
60 -2.9361471 -0.63423363
61 0.6676798 -2.93614709
62 -1.4265798 0.66767982
63 -0.2189260 -1.42657982
64 0.6868144 -0.21892600
65 -4.5208395 0.68681436
66 -6.1438009 -4.52083946
67 -4.7476278 -6.14380090
68 -1.5399740 -4.74762781
69 -4.7284933 -1.53997399
70 -2.8227529 -4.72849327
71 -4.7284933 -2.82275291
> 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/78cfs1260365582.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/8t7cr1260365582.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/96cth1260365582.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/10kwhy1260365582.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/11le4t1260365582.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/12uhfs1260365582.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/13ndry1260365582.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/14c1xz1260365582.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/15e7cg1260365582.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/16q0kq1260365582.tab")
+ }
> system("convert tmp/1eqyh1260365582.ps tmp/1eqyh1260365582.png")
> system("convert tmp/2wymf1260365582.ps tmp/2wymf1260365582.png")
> system("convert tmp/3fbak1260365582.ps tmp/3fbak1260365582.png")
> system("convert tmp/4m3q51260365582.ps tmp/4m3q51260365582.png")
> system("convert tmp/54nu61260365582.ps tmp/54nu61260365582.png")
> system("convert tmp/6ndu11260365582.ps tmp/6ndu11260365582.png")
> system("convert tmp/78cfs1260365582.ps tmp/78cfs1260365582.png")
> system("convert tmp/8t7cr1260365582.ps tmp/8t7cr1260365582.png")
> system("convert tmp/96cth1260365582.ps tmp/96cth1260365582.png")
> system("convert tmp/10kwhy1260365582.ps tmp/10kwhy1260365582.png")
>
>
> proc.time()
user system elapsed
2.599 1.569 3.637