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(1.4,1.9,1,1.6,-0.8,0,-2.9,-1.3,-0.7,-0.4,-0.7,-0.3,1.5,1.4,3,2.6,3.2,2.8,3.1,2.6,3.9,3.4,1,1.7,1.3,1.2,0.8,0,1.2,0,2.9,1.6,3.9,2.5,4.5,3.2,4.5,3.4,3.3,2.3,2,1.9,1.5,1.7,1,1.9,2.1,3.3,3,3.8,4,4.4,5.1,4.5,4.5,3.5,4.2,3,3.3,2.8,2.7,2.9,1.8,2.6,1.4,2.1,0.5,1.5,-0.4,1.1,0.8,1.5,0.7,1.7,1.9,2.3,2,2.3,1.1,1.9,0.9,2,0.4,1.6,0.7,1.2,2.1,1.9,2.8,2.1,3.9,2.4,3.5,2.9,2,2.5,2,2.3,1.5,2.5,2.5,2.6,3.1,2.4,2.7,2.5,2.8,2.1,2.5,2.2,3,2.7,3.2,3,2.8,3.2,2.4,3,2,2.7,1.8,2.5,1.1,1.6,-1.5,0.1,-3.7,-1.9),dim=c(2,64),dimnames=list(c('bbp','dnst'),1:64))
> y <- array(NA,dim=c(2,64),dimnames=list(c('bbp','dnst'),1:64))
> 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
bbp dnst M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 1.4 1.9 1 0 0 0 0 0 0 0 0 0 0 1
2 1.0 1.6 0 1 0 0 0 0 0 0 0 0 0 2
3 -0.8 0.0 0 0 1 0 0 0 0 0 0 0 0 3
4 -2.9 -1.3 0 0 0 1 0 0 0 0 0 0 0 4
5 -0.7 -0.4 0 0 0 0 1 0 0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
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) dnst M1 M2 M3 M4
-1.10071 1.31713 0.20475 0.45208 0.79985 0.95209
M5 M6 M7 M8 M9 M10
1.09515 1.01898 0.90231 0.91003 0.85387 0.83673
M11 t
0.33079 -0.01115
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.27157 -0.46832 -0.05608 0.36635 1.66810
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.100707 0.410339 -2.682 0.00988 **
dnst 1.317135 0.082683 15.930 < 2e-16 ***
M1 0.204746 0.447859 0.457 0.64953
M2 0.452085 0.447994 1.009 0.31777
M3 0.799850 0.451394 1.772 0.08250 .
M4 0.952090 0.459715 2.071 0.04354 *
M5 1.095149 0.469221 2.334 0.02366 *
M6 1.018984 0.469145 2.172 0.03462 *
M7 0.902308 0.467722 1.929 0.05940 .
M8 0.910030 0.467551 1.946 0.05724 .
M9 0.853866 0.467292 1.827 0.07363 .
M10 0.836729 0.467132 1.791 0.07931 .
M11 0.330794 0.467163 0.708 0.48218
t -0.011150 0.005094 -2.189 0.03333 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.7384 on 50 degrees of freedom
Multiple R-squared: 0.8506, Adjusted R-squared: 0.8118
F-statistic: 21.9 on 13 and 50 DF, p-value: 3.202e-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.3617786 0.7235572 0.63822140
[2,] 0.2857275 0.5714551 0.71427246
[3,] 0.2733811 0.5467622 0.72661888
[4,] 0.2639305 0.5278611 0.73606946
[5,] 0.3599693 0.7199385 0.64003075
[6,] 0.4573774 0.9147548 0.54262262
[7,] 0.5628628 0.8742744 0.43713718
[8,] 0.7020022 0.5959956 0.29799781
[9,] 0.8568507 0.2862987 0.14314933
[10,] 0.9083192 0.1833616 0.09168078
[11,] 0.8719970 0.2560060 0.12800301
[12,] 0.8224192 0.3551617 0.17758084
[13,] 0.8320023 0.3359954 0.16799771
[14,] 0.7831605 0.4336791 0.21683954
[15,] 0.7575151 0.4849697 0.24248487
[16,] 0.8039435 0.3921130 0.19605648
[17,] 0.7781353 0.4437294 0.22186469
[18,] 0.7580078 0.4839844 0.24199219
[19,] 0.7158891 0.5682217 0.28411085
[20,] 0.6615673 0.6768654 0.33843269
[21,] 0.5714962 0.8570077 0.42850384
[22,] 0.4719606 0.9439213 0.52803936
[23,] 0.3785797 0.7571595 0.62142025
[24,] 0.3915430 0.7830860 0.60845698
[25,] 0.4568395 0.9136790 0.54316052
[26,] 0.7128483 0.5743033 0.28715165
[27,] 0.7099198 0.5801604 0.29008019
[28,] 0.6418198 0.7163603 0.35818016
[29,] 0.5480910 0.9038181 0.45190903
[30,] 0.7793433 0.4413134 0.22065670
[31,] 0.8119637 0.3760725 0.18803627
> postscript(file="/var/www/html/rcomp/tmp/18z7n1258644411.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/2i8bf1258644411.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/3m0yx1258644411.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/4emn41258644411.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/59w4v1258644411.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 = 64
Frequency = 1
1 2 3 4 5 6
-0.195445460 -0.436494153 -0.465693624 -0.994509189 -0.111839574 -0.156238446
7 8 9 10 11 12
-0.067541777 -0.144676579 -0.140788932 0.050924548 0.314300971 -0.004626042
13 14 15 16 17 18
0.760345059 1.604717688 1.668102534 1.119596043 0.802265657 0.567585904
19 20 21 22 23 24
0.431984776 0.684260019 -0.021571452 -0.229857972 -0.476200668 -0.878245568
25 26 27 28 29 30
-0.830409269 -0.856879284 -0.225207918 0.350836076 0.577494414 0.028235982
31 32 33 34 35 36
-0.575651665 -1.077084264 -0.751202255 -0.832634854 -0.688696669 0.326393234
37 38 39 40 41 42
-0.230630027 -0.057100042 -0.293715196 -0.807952083 -1.271574627 -1.157406098
43 44 45 46 47 48
-0.202726344 0.278706255 0.782593902 1.515739981 0.974256845 0.343054589
49 50 51 52 53 54
0.412885249 -0.586730845 -0.055059479 0.667276673 0.003654130 0.717822658
55 56 57 58 59 60
0.413935011 0.258794570 0.130968738 -0.504171703 -0.123660478 0.213423786
61 62 63 64
0.083254446 0.332486635 -0.628426316 -0.335247520
> postscript(file="/var/www/html/rcomp/tmp/6nzd71258644411.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 = 64
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.195445460 NA
1 -0.436494153 -0.195445460
2 -0.465693624 -0.436494153
3 -0.994509189 -0.465693624
4 -0.111839574 -0.994509189
5 -0.156238446 -0.111839574
6 -0.067541777 -0.156238446
7 -0.144676579 -0.067541777
8 -0.140788932 -0.144676579
9 0.050924548 -0.140788932
10 0.314300971 0.050924548
11 -0.004626042 0.314300971
12 0.760345059 -0.004626042
13 1.604717688 0.760345059
14 1.668102534 1.604717688
15 1.119596043 1.668102534
16 0.802265657 1.119596043
17 0.567585904 0.802265657
18 0.431984776 0.567585904
19 0.684260019 0.431984776
20 -0.021571452 0.684260019
21 -0.229857972 -0.021571452
22 -0.476200668 -0.229857972
23 -0.878245568 -0.476200668
24 -0.830409269 -0.878245568
25 -0.856879284 -0.830409269
26 -0.225207918 -0.856879284
27 0.350836076 -0.225207918
28 0.577494414 0.350836076
29 0.028235982 0.577494414
30 -0.575651665 0.028235982
31 -1.077084264 -0.575651665
32 -0.751202255 -1.077084264
33 -0.832634854 -0.751202255
34 -0.688696669 -0.832634854
35 0.326393234 -0.688696669
36 -0.230630027 0.326393234
37 -0.057100042 -0.230630027
38 -0.293715196 -0.057100042
39 -0.807952083 -0.293715196
40 -1.271574627 -0.807952083
41 -1.157406098 -1.271574627
42 -0.202726344 -1.157406098
43 0.278706255 -0.202726344
44 0.782593902 0.278706255
45 1.515739981 0.782593902
46 0.974256845 1.515739981
47 0.343054589 0.974256845
48 0.412885249 0.343054589
49 -0.586730845 0.412885249
50 -0.055059479 -0.586730845
51 0.667276673 -0.055059479
52 0.003654130 0.667276673
53 0.717822658 0.003654130
54 0.413935011 0.717822658
55 0.258794570 0.413935011
56 0.130968738 0.258794570
57 -0.504171703 0.130968738
58 -0.123660478 -0.504171703
59 0.213423786 -0.123660478
60 0.083254446 0.213423786
61 0.332486635 0.083254446
62 -0.628426316 0.332486635
63 -0.335247520 -0.628426316
64 NA -0.335247520
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.436494153 -0.195445460
[2,] -0.465693624 -0.436494153
[3,] -0.994509189 -0.465693624
[4,] -0.111839574 -0.994509189
[5,] -0.156238446 -0.111839574
[6,] -0.067541777 -0.156238446
[7,] -0.144676579 -0.067541777
[8,] -0.140788932 -0.144676579
[9,] 0.050924548 -0.140788932
[10,] 0.314300971 0.050924548
[11,] -0.004626042 0.314300971
[12,] 0.760345059 -0.004626042
[13,] 1.604717688 0.760345059
[14,] 1.668102534 1.604717688
[15,] 1.119596043 1.668102534
[16,] 0.802265657 1.119596043
[17,] 0.567585904 0.802265657
[18,] 0.431984776 0.567585904
[19,] 0.684260019 0.431984776
[20,] -0.021571452 0.684260019
[21,] -0.229857972 -0.021571452
[22,] -0.476200668 -0.229857972
[23,] -0.878245568 -0.476200668
[24,] -0.830409269 -0.878245568
[25,] -0.856879284 -0.830409269
[26,] -0.225207918 -0.856879284
[27,] 0.350836076 -0.225207918
[28,] 0.577494414 0.350836076
[29,] 0.028235982 0.577494414
[30,] -0.575651665 0.028235982
[31,] -1.077084264 -0.575651665
[32,] -0.751202255 -1.077084264
[33,] -0.832634854 -0.751202255
[34,] -0.688696669 -0.832634854
[35,] 0.326393234 -0.688696669
[36,] -0.230630027 0.326393234
[37,] -0.057100042 -0.230630027
[38,] -0.293715196 -0.057100042
[39,] -0.807952083 -0.293715196
[40,] -1.271574627 -0.807952083
[41,] -1.157406098 -1.271574627
[42,] -0.202726344 -1.157406098
[43,] 0.278706255 -0.202726344
[44,] 0.782593902 0.278706255
[45,] 1.515739981 0.782593902
[46,] 0.974256845 1.515739981
[47,] 0.343054589 0.974256845
[48,] 0.412885249 0.343054589
[49,] -0.586730845 0.412885249
[50,] -0.055059479 -0.586730845
[51,] 0.667276673 -0.055059479
[52,] 0.003654130 0.667276673
[53,] 0.717822658 0.003654130
[54,] 0.413935011 0.717822658
[55,] 0.258794570 0.413935011
[56,] 0.130968738 0.258794570
[57,] -0.504171703 0.130968738
[58,] -0.123660478 -0.504171703
[59,] 0.213423786 -0.123660478
[60,] 0.083254446 0.213423786
[61,] 0.332486635 0.083254446
[62,] -0.628426316 0.332486635
[63,] -0.335247520 -0.628426316
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.436494153 -0.195445460
2 -0.465693624 -0.436494153
3 -0.994509189 -0.465693624
4 -0.111839574 -0.994509189
5 -0.156238446 -0.111839574
6 -0.067541777 -0.156238446
7 -0.144676579 -0.067541777
8 -0.140788932 -0.144676579
9 0.050924548 -0.140788932
10 0.314300971 0.050924548
11 -0.004626042 0.314300971
12 0.760345059 -0.004626042
13 1.604717688 0.760345059
14 1.668102534 1.604717688
15 1.119596043 1.668102534
16 0.802265657 1.119596043
17 0.567585904 0.802265657
18 0.431984776 0.567585904
19 0.684260019 0.431984776
20 -0.021571452 0.684260019
21 -0.229857972 -0.021571452
22 -0.476200668 -0.229857972
23 -0.878245568 -0.476200668
24 -0.830409269 -0.878245568
25 -0.856879284 -0.830409269
26 -0.225207918 -0.856879284
27 0.350836076 -0.225207918
28 0.577494414 0.350836076
29 0.028235982 0.577494414
30 -0.575651665 0.028235982
31 -1.077084264 -0.575651665
32 -0.751202255 -1.077084264
33 -0.832634854 -0.751202255
34 -0.688696669 -0.832634854
35 0.326393234 -0.688696669
36 -0.230630027 0.326393234
37 -0.057100042 -0.230630027
38 -0.293715196 -0.057100042
39 -0.807952083 -0.293715196
40 -1.271574627 -0.807952083
41 -1.157406098 -1.271574627
42 -0.202726344 -1.157406098
43 0.278706255 -0.202726344
44 0.782593902 0.278706255
45 1.515739981 0.782593902
46 0.974256845 1.515739981
47 0.343054589 0.974256845
48 0.412885249 0.343054589
49 -0.586730845 0.412885249
50 -0.055059479 -0.586730845
51 0.667276673 -0.055059479
52 0.003654130 0.667276673
53 0.717822658 0.003654130
54 0.413935011 0.717822658
55 0.258794570 0.413935011
56 0.130968738 0.258794570
57 -0.504171703 0.130968738
58 -0.123660478 -0.504171703
59 0.213423786 -0.123660478
60 0.083254446 0.213423786
61 0.332486635 0.083254446
62 -0.628426316 0.332486635
63 -0.335247520 -0.628426316
> 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/7ydqf1258644411.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/8u05u1258644411.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/9xc641258644411.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/109j5n1258644411.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/1196oy1258644411.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/129je31258644411.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/133a1b1258644411.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/14a6ig1258644411.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/15m6w41258644411.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/161h251258644411.tab")
+ }
>
> system("convert tmp/18z7n1258644411.ps tmp/18z7n1258644411.png")
> system("convert tmp/2i8bf1258644411.ps tmp/2i8bf1258644411.png")
> system("convert tmp/3m0yx1258644411.ps tmp/3m0yx1258644411.png")
> system("convert tmp/4emn41258644411.ps tmp/4emn41258644411.png")
> system("convert tmp/59w4v1258644411.ps tmp/59w4v1258644411.png")
> system("convert tmp/6nzd71258644411.ps tmp/6nzd71258644411.png")
> system("convert tmp/7ydqf1258644411.ps tmp/7ydqf1258644411.png")
> system("convert tmp/8u05u1258644411.ps tmp/8u05u1258644411.png")
> system("convert tmp/9xc641258644411.ps tmp/9xc641258644411.png")
> system("convert tmp/109j5n1258644411.ps tmp/109j5n1258644411.png")
>
>
> proc.time()
user system elapsed
2.469 1.605 2.857