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(19,24.4,19,23,22,22.5,19,19,23,19.4,22,18,20,18.1,23,19,14,18.1,20,19,14,20.7,14,22,14,19.1,14,23,15,18.3,14,20,11,16.9,15,14,17,17.9,11,14,16,20.2,17,14,20,21.2,16,15,24,23.8,20,11,23,24,24,17,20,26.6,23,16,21,25.3,20,20,19,27.6,21,24,23,24.7,19,23,23,26.6,23,20,23,24.4,23,21,23,24.6,23,19,27,26,23,23,26,24.8,27,23,17,24,26,23,24,22.7,17,23,26,23,24,27,24,24.1,26,26,27,24,24,17,27,22.7,27,24,26,22.6,27,26,24,23.1,26,24,23,24.4,24,27,23,23,23,27,24,22,23,26,17,21.3,24,24,21,21.5,17,23,19,21.3,21,23,22,23.2,19,24,22,21.8,22,17,18,23.3,22,21,16,21,18,19,14,22.4,16,22,12,20.4,14,22,14,19.9,12,18,16,21.3,14,16,8,18.9,16,14,3,15.6,8,12,0,12.5,3,14,5,7.8,0,16,1,5.5,5,8,1,4,1,3,3,3.3,1,0,6,3.7,3,5,7,3.1,6,1,8,5,7,1,14,6.3,8,3,14,20,14,6),dim=c(4,57),dimnames=list(c('Y','X','Y(t-1)','Y(t-4)'),1:57))
> y <- array(NA,dim=c(4,57),dimnames=list(c('Y','X','Y(t-1)','Y(t-4)'),1:57))
> 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 Y(t-1) Y(t-4)
1 19 24.4 19 23
2 22 22.5 19 19
3 23 19.4 22 18
4 20 18.1 23 19
5 14 18.1 20 19
6 14 20.7 14 22
7 14 19.1 14 23
8 15 18.3 14 20
9 11 16.9 15 14
10 17 17.9 11 14
11 16 20.2 17 14
12 20 21.2 16 15
13 24 23.8 20 11
14 23 24.0 24 17
15 20 26.6 23 16
16 21 25.3 20 20
17 19 27.6 21 24
18 23 24.7 19 23
19 23 26.6 23 20
20 23 24.4 23 21
21 23 24.6 23 19
22 27 26.0 23 23
23 26 24.8 27 23
24 17 24.0 26 23
25 24 22.7 17 23
26 26 23.0 24 27
27 24 24.1 26 26
28 27 24.0 24 17
29 27 22.7 27 24
30 26 22.6 27 26
31 24 23.1 26 24
32 23 24.4 24 27
33 23 23.0 23 27
34 24 22.0 23 26
35 17 21.3 24 24
36 21 21.5 17 23
37 19 21.3 21 23
38 22 23.2 19 24
39 22 21.8 22 17
40 18 23.3 22 21
41 16 21.0 18 19
42 14 22.4 16 22
43 12 20.4 14 22
44 14 19.9 12 18
45 16 21.3 14 16
46 8 18.9 16 14
47 3 15.6 8 12
48 0 12.5 3 14
49 5 7.8 0 16
50 1 5.5 5 8
51 1 4.0 1 3
52 3 3.3 1 0
53 6 3.7 3 5
54 7 3.1 6 1
55 8 5.0 7 1
56 14 6.3 8 3
57 14 20.0 14 6
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X `Y(t-1)` `Y(t-4)`
0.63371 0.20859 0.75975 -0.03543
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-8.2360 -1.2670 0.4949 2.2429 6.5304
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.63371 1.40533 0.451 0.654
X 0.20859 0.15401 1.354 0.181
`Y(t-1)` 0.75975 0.12317 6.168 9.76e-08 ***
`Y(t-4)` -0.03543 0.10921 -0.324 0.747
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.34 on 53 degrees of freedom
Multiple R-squared: 0.8074, Adjusted R-squared: 0.7965
F-statistic: 74.08 on 3 and 53 DF, p-value: < 2.2e-16
> if (n > n25) {
+ kp3 <- k + 3
+ nmkm3 <- n - k - 3
+ gqarr <- array(NA, dim=c(nmkm3-kp3+1,3))
+ numgqtests <- 0
+ numsignificant1 <- 0
+ numsignificant5 <- 0
+ numsignificant10 <- 0
+ for (mypoint in kp3:nmkm3) {
+ j <- 0
+ numgqtests <- numgqtests + 1
+ for (myalt in c('greater', 'two.sided', 'less')) {
+ j <- j + 1
+ gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value
+ }
+ if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1
+ }
+ gqarr
+ }
[,1] [,2] [,3]
[1,] 0.41872293 0.8374459 0.5812771
[2,] 0.25830814 0.5166163 0.7416919
[3,] 0.32712086 0.6542417 0.6728791
[4,] 0.42917754 0.8583551 0.5708225
[5,] 0.39181580 0.7836316 0.6081842
[6,] 0.31463137 0.6292627 0.6853686
[7,] 0.24174825 0.4834965 0.7582517
[8,] 0.17701365 0.3540273 0.8229864
[9,] 0.25455473 0.5091095 0.7454453
[10,] 0.18175844 0.3635169 0.8182416
[11,] 0.14559743 0.2911949 0.8544026
[12,] 0.17580797 0.3516159 0.8241920
[13,] 0.12231537 0.2446307 0.8776846
[14,] 0.08732418 0.1746484 0.9126758
[15,] 0.05807943 0.1161589 0.9419206
[16,] 0.09237634 0.1847527 0.9076237
[17,] 0.06572121 0.1314424 0.9342788
[18,] 0.20604183 0.4120837 0.7939582
[19,] 0.41217255 0.8243451 0.5878275
[20,] 0.44756218 0.8951244 0.5524378
[21,] 0.37029967 0.7405993 0.6297003
[22,] 0.42709855 0.8541971 0.5729014
[23,] 0.39453381 0.7890676 0.6054662
[24,] 0.33052778 0.6610556 0.6694722
[25,] 0.25986103 0.5197221 0.7401390
[26,] 0.19905128 0.3981026 0.8009487
[27,] 0.15207388 0.3041478 0.8479261
[28,] 0.13166297 0.2633259 0.8683370
[29,] 0.21071652 0.4214330 0.7892835
[30,] 0.24371653 0.4874331 0.7562835
[31,] 0.18812158 0.3762432 0.8118784
[32,] 0.21502577 0.4300515 0.7849742
[33,] 0.18088939 0.3617788 0.8191106
[34,] 0.15526292 0.3105258 0.8447371
[35,] 0.11692100 0.2338420 0.8830790
[36,] 0.09679292 0.1935858 0.9032071
[37,] 0.07370674 0.1474135 0.9262933
[38,] 0.07310114 0.1462023 0.9268989
[39,] 0.13513560 0.2702712 0.8648644
[40,] 0.21092653 0.4218531 0.7890735
[41,] 0.25598298 0.5119660 0.7440170
[42,] 0.27197179 0.5439436 0.7280282
[43,] 0.45631130 0.9126226 0.5436887
[44,] 0.62586156 0.7482769 0.3741384
> postscript(file="/var/www/html/rcomp/tmp/1hfr41258659309.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/24ebx1258659309.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/30fsb1258659309.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/404gy1258659309.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/5i33z1258659309.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 = 57
Frequency = 1
1 2 3 4 5
-0.3436662778 2.9109340291 2.2428649977 -1.2102970271 -4.9310386344
6 7 8 9 10
-0.8085610924 -0.4393944014 0.6211893325 -4.0591132761 4.7713115200
11 12 13 14 15
-1.2669539717 3.3196408922 3.5965912356 -0.2715664707 -3.0895667582
16 17 18 19 20
0.6025677886 -2.4952198736 3.5937578039 0.0521470836 0.5464656111
21 22 23 24 25
0.4338914113 4.2835843014 0.4948767841 -7.5785013030 6.5304361872
26 27 28 29 30
3.2913045280 -0.4930745611 3.7284335293 1.9683366722 1.0600522325
31 32 33 34 35
-0.3553450879 -0.0007164237 1.0510573255 2.2242152592 -5.4603839834
36 37 38 39 40
3.7807398601 -1.2165540513 2.9420658555 0.7068291914 -3.4643365579
41 42 43 44 45
-2.0164335822 -2.6826635575 -2.7459851742 0.7360997761 0.8537163084
46 47 48 49 50
-8.2360388618 -6.5405383019 -5.0242995715 3.3061717942 -4.2962711707
51 52 53 54 55
-1.1215226917 0.9182024028 2.4924045523 1.1965841543 1.0405172080
56 57
6.0804590191 -1.2294059839
> postscript(file="/var/www/html/rcomp/tmp/655pu1258659309.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 = 57
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.3436662778 NA
1 2.9109340291 -0.3436662778
2 2.2428649977 2.9109340291
3 -1.2102970271 2.2428649977
4 -4.9310386344 -1.2102970271
5 -0.8085610924 -4.9310386344
6 -0.4393944014 -0.8085610924
7 0.6211893325 -0.4393944014
8 -4.0591132761 0.6211893325
9 4.7713115200 -4.0591132761
10 -1.2669539717 4.7713115200
11 3.3196408922 -1.2669539717
12 3.5965912356 3.3196408922
13 -0.2715664707 3.5965912356
14 -3.0895667582 -0.2715664707
15 0.6025677886 -3.0895667582
16 -2.4952198736 0.6025677886
17 3.5937578039 -2.4952198736
18 0.0521470836 3.5937578039
19 0.5464656111 0.0521470836
20 0.4338914113 0.5464656111
21 4.2835843014 0.4338914113
22 0.4948767841 4.2835843014
23 -7.5785013030 0.4948767841
24 6.5304361872 -7.5785013030
25 3.2913045280 6.5304361872
26 -0.4930745611 3.2913045280
27 3.7284335293 -0.4930745611
28 1.9683366722 3.7284335293
29 1.0600522325 1.9683366722
30 -0.3553450879 1.0600522325
31 -0.0007164237 -0.3553450879
32 1.0510573255 -0.0007164237
33 2.2242152592 1.0510573255
34 -5.4603839834 2.2242152592
35 3.7807398601 -5.4603839834
36 -1.2165540513 3.7807398601
37 2.9420658555 -1.2165540513
38 0.7068291914 2.9420658555
39 -3.4643365579 0.7068291914
40 -2.0164335822 -3.4643365579
41 -2.6826635575 -2.0164335822
42 -2.7459851742 -2.6826635575
43 0.7360997761 -2.7459851742
44 0.8537163084 0.7360997761
45 -8.2360388618 0.8537163084
46 -6.5405383019 -8.2360388618
47 -5.0242995715 -6.5405383019
48 3.3061717942 -5.0242995715
49 -4.2962711707 3.3061717942
50 -1.1215226917 -4.2962711707
51 0.9182024028 -1.1215226917
52 2.4924045523 0.9182024028
53 1.1965841543 2.4924045523
54 1.0405172080 1.1965841543
55 6.0804590191 1.0405172080
56 -1.2294059839 6.0804590191
57 NA -1.2294059839
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.9109340291 -0.3436662778
[2,] 2.2428649977 2.9109340291
[3,] -1.2102970271 2.2428649977
[4,] -4.9310386344 -1.2102970271
[5,] -0.8085610924 -4.9310386344
[6,] -0.4393944014 -0.8085610924
[7,] 0.6211893325 -0.4393944014
[8,] -4.0591132761 0.6211893325
[9,] 4.7713115200 -4.0591132761
[10,] -1.2669539717 4.7713115200
[11,] 3.3196408922 -1.2669539717
[12,] 3.5965912356 3.3196408922
[13,] -0.2715664707 3.5965912356
[14,] -3.0895667582 -0.2715664707
[15,] 0.6025677886 -3.0895667582
[16,] -2.4952198736 0.6025677886
[17,] 3.5937578039 -2.4952198736
[18,] 0.0521470836 3.5937578039
[19,] 0.5464656111 0.0521470836
[20,] 0.4338914113 0.5464656111
[21,] 4.2835843014 0.4338914113
[22,] 0.4948767841 4.2835843014
[23,] -7.5785013030 0.4948767841
[24,] 6.5304361872 -7.5785013030
[25,] 3.2913045280 6.5304361872
[26,] -0.4930745611 3.2913045280
[27,] 3.7284335293 -0.4930745611
[28,] 1.9683366722 3.7284335293
[29,] 1.0600522325 1.9683366722
[30,] -0.3553450879 1.0600522325
[31,] -0.0007164237 -0.3553450879
[32,] 1.0510573255 -0.0007164237
[33,] 2.2242152592 1.0510573255
[34,] -5.4603839834 2.2242152592
[35,] 3.7807398601 -5.4603839834
[36,] -1.2165540513 3.7807398601
[37,] 2.9420658555 -1.2165540513
[38,] 0.7068291914 2.9420658555
[39,] -3.4643365579 0.7068291914
[40,] -2.0164335822 -3.4643365579
[41,] -2.6826635575 -2.0164335822
[42,] -2.7459851742 -2.6826635575
[43,] 0.7360997761 -2.7459851742
[44,] 0.8537163084 0.7360997761
[45,] -8.2360388618 0.8537163084
[46,] -6.5405383019 -8.2360388618
[47,] -5.0242995715 -6.5405383019
[48,] 3.3061717942 -5.0242995715
[49,] -4.2962711707 3.3061717942
[50,] -1.1215226917 -4.2962711707
[51,] 0.9182024028 -1.1215226917
[52,] 2.4924045523 0.9182024028
[53,] 1.1965841543 2.4924045523
[54,] 1.0405172080 1.1965841543
[55,] 6.0804590191 1.0405172080
[56,] -1.2294059839 6.0804590191
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.9109340291 -0.3436662778
2 2.2428649977 2.9109340291
3 -1.2102970271 2.2428649977
4 -4.9310386344 -1.2102970271
5 -0.8085610924 -4.9310386344
6 -0.4393944014 -0.8085610924
7 0.6211893325 -0.4393944014
8 -4.0591132761 0.6211893325
9 4.7713115200 -4.0591132761
10 -1.2669539717 4.7713115200
11 3.3196408922 -1.2669539717
12 3.5965912356 3.3196408922
13 -0.2715664707 3.5965912356
14 -3.0895667582 -0.2715664707
15 0.6025677886 -3.0895667582
16 -2.4952198736 0.6025677886
17 3.5937578039 -2.4952198736
18 0.0521470836 3.5937578039
19 0.5464656111 0.0521470836
20 0.4338914113 0.5464656111
21 4.2835843014 0.4338914113
22 0.4948767841 4.2835843014
23 -7.5785013030 0.4948767841
24 6.5304361872 -7.5785013030
25 3.2913045280 6.5304361872
26 -0.4930745611 3.2913045280
27 3.7284335293 -0.4930745611
28 1.9683366722 3.7284335293
29 1.0600522325 1.9683366722
30 -0.3553450879 1.0600522325
31 -0.0007164237 -0.3553450879
32 1.0510573255 -0.0007164237
33 2.2242152592 1.0510573255
34 -5.4603839834 2.2242152592
35 3.7807398601 -5.4603839834
36 -1.2165540513 3.7807398601
37 2.9420658555 -1.2165540513
38 0.7068291914 2.9420658555
39 -3.4643365579 0.7068291914
40 -2.0164335822 -3.4643365579
41 -2.6826635575 -2.0164335822
42 -2.7459851742 -2.6826635575
43 0.7360997761 -2.7459851742
44 0.8537163084 0.7360997761
45 -8.2360388618 0.8537163084
46 -6.5405383019 -8.2360388618
47 -5.0242995715 -6.5405383019
48 3.3061717942 -5.0242995715
49 -4.2962711707 3.3061717942
50 -1.1215226917 -4.2962711707
51 0.9182024028 -1.1215226917
52 2.4924045523 0.9182024028
53 1.1965841543 2.4924045523
54 1.0405172080 1.1965841543
55 6.0804590191 1.0405172080
56 -1.2294059839 6.0804590191
> 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/76j1f1258659309.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/8stqo1258659309.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/9oikg1258659309.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/10gw901258659309.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/116ppd1258659309.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/1275ca1258659309.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/13g6i71258659309.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/14318c1258659309.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/15427f1258659309.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/160tpn1258659310.tab")
+ }
>
> system("convert tmp/1hfr41258659309.ps tmp/1hfr41258659309.png")
> system("convert tmp/24ebx1258659309.ps tmp/24ebx1258659309.png")
> system("convert tmp/30fsb1258659309.ps tmp/30fsb1258659309.png")
> system("convert tmp/404gy1258659309.ps tmp/404gy1258659309.png")
> system("convert tmp/5i33z1258659309.ps tmp/5i33z1258659309.png")
> system("convert tmp/655pu1258659309.ps tmp/655pu1258659309.png")
> system("convert tmp/76j1f1258659309.ps tmp/76j1f1258659309.png")
> system("convert tmp/8stqo1258659309.ps tmp/8stqo1258659309.png")
> system("convert tmp/9oikg1258659309.ps tmp/9oikg1258659309.png")
> system("convert tmp/10gw901258659309.ps tmp/10gw901258659309.png")
>
>
> proc.time()
user system elapsed
2.405 1.536 2.800