R version 2.8.0 (2008-10-20)
Copyright (C) 2008 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(41,0,35,0,34,0,36,0,39,0,40,0,30,0,33,0,30,0,32,0,41,0,40,0,41,0,40,0,39,0,34,0,34,0,46,0,45,0,44,0,40,0,39,0,37,0,39,0,35,0,26,0,26,0,33,0,27,0,30,0,26,0,27,0,18,0,19,0,13,0,14,0,41,0,21,0,16,0,17,0,9,0,14,0,14,0,16,0,11,0,10,0,6,0,9,0,5,0,7,0,2,0,0,0,8,0,13,0,11,0,19,1,23,1,23,1,43,1,59,1),dim=c(2,60),dimnames=list(c('Y','D'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Y','D'),1:60))
> 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 D M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 41 0 1 0 0 0 0 0 0 0 0 0 0 1
2 35 0 0 1 0 0 0 0 0 0 0 0 0 2
3 34 0 0 0 1 0 0 0 0 0 0 0 0 3
4 36 0 0 0 0 1 0 0 0 0 0 0 0 4
5 39 0 0 0 0 0 1 0 0 0 0 0 0 5
6 40 0 0 0 0 0 0 1 0 0 0 0 0 6
7 30 0 0 0 0 0 0 0 1 0 0 0 0 7
8 33 0 0 0 0 0 0 0 0 1 0 0 0 8
9 30 0 0 0 0 0 0 0 0 0 1 0 0 9
10 32 0 0 0 0 0 0 0 0 0 0 1 0 10
11 41 0 0 0 0 0 0 0 0 0 0 0 1 11
12 40 0 0 0 0 0 0 0 0 0 0 0 0 12
13 41 0 1 0 0 0 0 0 0 0 0 0 0 13
14 40 0 0 1 0 0 0 0 0 0 0 0 0 14
15 39 0 0 0 1 0 0 0 0 0 0 0 0 15
16 34 0 0 0 0 1 0 0 0 0 0 0 0 16
17 34 0 0 0 0 0 1 0 0 0 0 0 0 17
18 46 0 0 0 0 0 0 1 0 0 0 0 0 18
19 45 0 0 0 0 0 0 0 1 0 0 0 0 19
20 44 0 0 0 0 0 0 0 0 1 0 0 0 20
21 40 0 0 0 0 0 0 0 0 0 1 0 0 21
22 39 0 0 0 0 0 0 0 0 0 0 1 0 22
23 37 0 0 0 0 0 0 0 0 0 0 0 1 23
24 39 0 0 0 0 0 0 0 0 0 0 0 0 24
25 35 0 1 0 0 0 0 0 0 0 0 0 0 25
26 26 0 0 1 0 0 0 0 0 0 0 0 0 26
27 26 0 0 0 1 0 0 0 0 0 0 0 0 27
28 33 0 0 0 0 1 0 0 0 0 0 0 0 28
29 27 0 0 0 0 0 1 0 0 0 0 0 0 29
30 30 0 0 0 0 0 0 1 0 0 0 0 0 30
31 26 0 0 0 0 0 0 0 1 0 0 0 0 31
32 27 0 0 0 0 0 0 0 0 1 0 0 0 32
33 18 0 0 0 0 0 0 0 0 0 1 0 0 33
34 19 0 0 0 0 0 0 0 0 0 0 1 0 34
35 13 0 0 0 0 0 0 0 0 0 0 0 1 35
36 14 0 0 0 0 0 0 0 0 0 0 0 0 36
37 41 0 1 0 0 0 0 0 0 0 0 0 0 37
38 21 0 0 1 0 0 0 0 0 0 0 0 0 38
39 16 0 0 0 1 0 0 0 0 0 0 0 0 39
40 17 0 0 0 0 1 0 0 0 0 0 0 0 40
41 9 0 0 0 0 0 1 0 0 0 0 0 0 41
42 14 0 0 0 0 0 0 1 0 0 0 0 0 42
43 14 0 0 0 0 0 0 0 1 0 0 0 0 43
44 16 0 0 0 0 0 0 0 0 1 0 0 0 44
45 11 0 0 0 0 0 0 0 0 0 1 0 0 45
46 10 0 0 0 0 0 0 0 0 0 0 1 0 46
47 6 0 0 0 0 0 0 0 0 0 0 0 1 47
48 9 0 0 0 0 0 0 0 0 0 0 0 0 48
49 5 0 1 0 0 0 0 0 0 0 0 0 0 49
50 7 0 0 1 0 0 0 0 0 0 0 0 0 50
51 2 0 0 0 1 0 0 0 0 0 0 0 0 51
52 0 0 0 0 0 1 0 0 0 0 0 0 0 52
53 8 0 0 0 0 0 1 0 0 0 0 0 0 53
54 13 0 0 0 0 0 0 1 0 0 0 0 0 54
55 11 0 0 0 0 0 0 0 1 0 0 0 0 55
56 19 1 0 0 0 0 0 0 0 1 0 0 0 56
57 23 1 0 0 0 0 0 0 0 0 1 0 0 57
58 23 1 0 0 0 0 0 0 0 0 0 1 0 58
59 43 1 0 0 0 0 0 0 0 0 0 0 1 59
60 59 1 0 0 0 0 0 0 0 0 0 0 0 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) D M1 M2 M3 M4
51.8842 28.6842 -1.6307 -7.7246 -9.4184 -8.1123
M5 M6 M7 M8 M9 M10
-8.0061 -2.1000 -4.7939 -7.2246 -9.9184 -9.0123
M11 t
-4.9061 -0.7061
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-14.800 -5.947 0.500 3.618 20.800
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 51.88421 4.42104 11.736 1.97e-15 ***
D 28.68421 4.73080 6.063 2.33e-07 ***
M1 -1.63070 5.40248 -0.302 0.7641
M2 -7.72456 5.39816 -1.431 0.1592
M3 -9.41842 5.39480 -1.746 0.0875 .
M4 -8.11228 5.39240 -1.504 0.1393
M5 -8.00614 5.39096 -1.485 0.1443
M6 -2.10000 5.39048 -0.390 0.6986
M7 -4.79386 5.39096 -0.889 0.3785
M8 -7.22456 5.33211 -1.355 0.1821
M9 -9.91842 5.32871 -1.861 0.0691 .
M10 -9.01228 5.32628 -1.692 0.0974 .
M11 -4.90614 5.32482 -0.921 0.3617
t -0.70614 0.07198 -9.811 7.45e-13 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 8.419 on 46 degrees of freedom
Multiple R-squared: 0.7002, Adjusted R-squared: 0.6154
F-statistic: 8.263 on 13 and 46 DF, p-value: 3.178e-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.09487217 0.18974435 0.9051278
[2,] 0.05167265 0.10334531 0.9483273
[3,] 0.12081306 0.24162611 0.8791869
[4,] 0.09504576 0.19009152 0.9049542
[5,] 0.06559165 0.13118330 0.9344084
[6,] 0.03767381 0.07534763 0.9623262
[7,] 0.03589491 0.07178982 0.9641051
[8,] 0.02162429 0.04324858 0.9783757
[9,] 0.03128632 0.06257263 0.9687137
[10,] 0.06008762 0.12017524 0.9399124
[11,] 0.06143164 0.12286328 0.9385684
[12,] 0.03896960 0.07793919 0.9610304
[13,] 0.03089137 0.06178275 0.9691086
[14,] 0.02941027 0.05882054 0.9705897
[15,] 0.02188586 0.04377172 0.9781141
[16,] 0.01976651 0.03953302 0.9802335
[17,] 0.02031325 0.04062650 0.9796867
[18,] 0.01841096 0.03682192 0.9815890
[19,] 0.03450021 0.06900043 0.9654998
[20,] 0.07675855 0.15351710 0.9232415
[21,] 0.17158217 0.34316434 0.8284178
[22,] 0.11820520 0.23641040 0.8817948
[23,] 0.08453883 0.16907767 0.9154612
[24,] 0.07348046 0.14696093 0.9265195
[25,] 0.05048725 0.10097449 0.9495128
[26,] 0.03056166 0.06112333 0.9694383
[27,] 0.01338843 0.02677686 0.9866116
> postscript(file="/var/www/html/rcomp/tmp/1hwb91229118839.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/2ayjz1229118840.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/3yblb1229118840.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/4s4lj1229118840.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/5ef191229118840.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 = 60
Frequency = 1
1 2 3 4 5 6
-8.54736842 -7.74736842 -6.34736842 -4.94736842 -1.34736842 -5.54736842
7 8 9 10 11 12
-12.14736842 -6.01052632 -5.61052632 -3.81052632 1.78947368 -3.41052632
13 14 15 16 17 18
-0.07368421 5.72631579 7.12631579 1.52631579 2.12631579 8.92631579
19 20 21 22 23 24
11.32631579 13.46315789 12.86315789 11.66315789 6.26315789 4.06315789
25 26 27 28 29 30
2.40000000 0.20000000 2.60000000 9.00000000 3.60000000 1.40000000
31 32 33 34 35 36
0.80000000 4.93684211 -0.66315789 0.13684211 -9.26315789 -12.46315789
37 38 39 40 41 42
16.87368421 3.67368421 1.07368421 1.47368421 -5.92631579 -6.12631579
43 44 45 46 47 48
-2.72631579 2.41052632 0.81052632 -0.38947368 -7.78947368 -8.98947368
49 50 51 52 53 54
-10.65263158 -1.85263158 -4.45263158 -7.05263158 1.54736842 1.34736842
55 56 57 58 59 60
2.74736842 -14.80000000 -7.40000000 -7.60000000 9.00000000 20.80000000
> postscript(file="/var/www/html/rcomp/tmp/6ne0z1229118840.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 = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 -8.54736842 NA
1 -7.74736842 -8.54736842
2 -6.34736842 -7.74736842
3 -4.94736842 -6.34736842
4 -1.34736842 -4.94736842
5 -5.54736842 -1.34736842
6 -12.14736842 -5.54736842
7 -6.01052632 -12.14736842
8 -5.61052632 -6.01052632
9 -3.81052632 -5.61052632
10 1.78947368 -3.81052632
11 -3.41052632 1.78947368
12 -0.07368421 -3.41052632
13 5.72631579 -0.07368421
14 7.12631579 5.72631579
15 1.52631579 7.12631579
16 2.12631579 1.52631579
17 8.92631579 2.12631579
18 11.32631579 8.92631579
19 13.46315789 11.32631579
20 12.86315789 13.46315789
21 11.66315789 12.86315789
22 6.26315789 11.66315789
23 4.06315789 6.26315789
24 2.40000000 4.06315789
25 0.20000000 2.40000000
26 2.60000000 0.20000000
27 9.00000000 2.60000000
28 3.60000000 9.00000000
29 1.40000000 3.60000000
30 0.80000000 1.40000000
31 4.93684211 0.80000000
32 -0.66315789 4.93684211
33 0.13684211 -0.66315789
34 -9.26315789 0.13684211
35 -12.46315789 -9.26315789
36 16.87368421 -12.46315789
37 3.67368421 16.87368421
38 1.07368421 3.67368421
39 1.47368421 1.07368421
40 -5.92631579 1.47368421
41 -6.12631579 -5.92631579
42 -2.72631579 -6.12631579
43 2.41052632 -2.72631579
44 0.81052632 2.41052632
45 -0.38947368 0.81052632
46 -7.78947368 -0.38947368
47 -8.98947368 -7.78947368
48 -10.65263158 -8.98947368
49 -1.85263158 -10.65263158
50 -4.45263158 -1.85263158
51 -7.05263158 -4.45263158
52 1.54736842 -7.05263158
53 1.34736842 1.54736842
54 2.74736842 1.34736842
55 -14.80000000 2.74736842
56 -7.40000000 -14.80000000
57 -7.60000000 -7.40000000
58 9.00000000 -7.60000000
59 20.80000000 9.00000000
60 NA 20.80000000
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -7.74736842 -8.54736842
[2,] -6.34736842 -7.74736842
[3,] -4.94736842 -6.34736842
[4,] -1.34736842 -4.94736842
[5,] -5.54736842 -1.34736842
[6,] -12.14736842 -5.54736842
[7,] -6.01052632 -12.14736842
[8,] -5.61052632 -6.01052632
[9,] -3.81052632 -5.61052632
[10,] 1.78947368 -3.81052632
[11,] -3.41052632 1.78947368
[12,] -0.07368421 -3.41052632
[13,] 5.72631579 -0.07368421
[14,] 7.12631579 5.72631579
[15,] 1.52631579 7.12631579
[16,] 2.12631579 1.52631579
[17,] 8.92631579 2.12631579
[18,] 11.32631579 8.92631579
[19,] 13.46315789 11.32631579
[20,] 12.86315789 13.46315789
[21,] 11.66315789 12.86315789
[22,] 6.26315789 11.66315789
[23,] 4.06315789 6.26315789
[24,] 2.40000000 4.06315789
[25,] 0.20000000 2.40000000
[26,] 2.60000000 0.20000000
[27,] 9.00000000 2.60000000
[28,] 3.60000000 9.00000000
[29,] 1.40000000 3.60000000
[30,] 0.80000000 1.40000000
[31,] 4.93684211 0.80000000
[32,] -0.66315789 4.93684211
[33,] 0.13684211 -0.66315789
[34,] -9.26315789 0.13684211
[35,] -12.46315789 -9.26315789
[36,] 16.87368421 -12.46315789
[37,] 3.67368421 16.87368421
[38,] 1.07368421 3.67368421
[39,] 1.47368421 1.07368421
[40,] -5.92631579 1.47368421
[41,] -6.12631579 -5.92631579
[42,] -2.72631579 -6.12631579
[43,] 2.41052632 -2.72631579
[44,] 0.81052632 2.41052632
[45,] -0.38947368 0.81052632
[46,] -7.78947368 -0.38947368
[47,] -8.98947368 -7.78947368
[48,] -10.65263158 -8.98947368
[49,] -1.85263158 -10.65263158
[50,] -4.45263158 -1.85263158
[51,] -7.05263158 -4.45263158
[52,] 1.54736842 -7.05263158
[53,] 1.34736842 1.54736842
[54,] 2.74736842 1.34736842
[55,] -14.80000000 2.74736842
[56,] -7.40000000 -14.80000000
[57,] -7.60000000 -7.40000000
[58,] 9.00000000 -7.60000000
[59,] 20.80000000 9.00000000
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -7.74736842 -8.54736842
2 -6.34736842 -7.74736842
3 -4.94736842 -6.34736842
4 -1.34736842 -4.94736842
5 -5.54736842 -1.34736842
6 -12.14736842 -5.54736842
7 -6.01052632 -12.14736842
8 -5.61052632 -6.01052632
9 -3.81052632 -5.61052632
10 1.78947368 -3.81052632
11 -3.41052632 1.78947368
12 -0.07368421 -3.41052632
13 5.72631579 -0.07368421
14 7.12631579 5.72631579
15 1.52631579 7.12631579
16 2.12631579 1.52631579
17 8.92631579 2.12631579
18 11.32631579 8.92631579
19 13.46315789 11.32631579
20 12.86315789 13.46315789
21 11.66315789 12.86315789
22 6.26315789 11.66315789
23 4.06315789 6.26315789
24 2.40000000 4.06315789
25 0.20000000 2.40000000
26 2.60000000 0.20000000
27 9.00000000 2.60000000
28 3.60000000 9.00000000
29 1.40000000 3.60000000
30 0.80000000 1.40000000
31 4.93684211 0.80000000
32 -0.66315789 4.93684211
33 0.13684211 -0.66315789
34 -9.26315789 0.13684211
35 -12.46315789 -9.26315789
36 16.87368421 -12.46315789
37 3.67368421 16.87368421
38 1.07368421 3.67368421
39 1.47368421 1.07368421
40 -5.92631579 1.47368421
41 -6.12631579 -5.92631579
42 -2.72631579 -6.12631579
43 2.41052632 -2.72631579
44 0.81052632 2.41052632
45 -0.38947368 0.81052632
46 -7.78947368 -0.38947368
47 -8.98947368 -7.78947368
48 -10.65263158 -8.98947368
49 -1.85263158 -10.65263158
50 -4.45263158 -1.85263158
51 -7.05263158 -4.45263158
52 1.54736842 -7.05263158
53 1.34736842 1.54736842
54 2.74736842 1.34736842
55 -14.80000000 2.74736842
56 -7.40000000 -14.80000000
57 -7.60000000 -7.40000000
58 9.00000000 -7.60000000
59 20.80000000 9.00000000
> 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/7218b1229118840.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/815na1229118840.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/9jqpf1229118840.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/10ikwh1229118840.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/11f8kq1229118840.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/12d9tx1229118840.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/13qmzw1229118840.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/14axnb1229118840.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/15hbnu1229118840.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/16rmfu1229118840.tab")
+ }
>
> system("convert tmp/1hwb91229118839.ps tmp/1hwb91229118839.png")
> system("convert tmp/2ayjz1229118840.ps tmp/2ayjz1229118840.png")
> system("convert tmp/3yblb1229118840.ps tmp/3yblb1229118840.png")
> system("convert tmp/4s4lj1229118840.ps tmp/4s4lj1229118840.png")
> system("convert tmp/5ef191229118840.ps tmp/5ef191229118840.png")
> system("convert tmp/6ne0z1229118840.ps tmp/6ne0z1229118840.png")
> system("convert tmp/7218b1229118840.ps tmp/7218b1229118840.png")
> system("convert tmp/815na1229118840.ps tmp/815na1229118840.png")
> system("convert tmp/9jqpf1229118840.ps tmp/9jqpf1229118840.png")
> system("convert tmp/10ikwh1229118840.ps tmp/10ikwh1229118840.png")
>
>
> proc.time()
user system elapsed
2.413 1.627 2.967