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(2.1,0,2.0,2.4,2.0,0,2.1,2.0,1.8,0,2.0,2.1,2.7,0,1.8,2.0,2.3,0,2.7,1.8,1.9,0,2.3,2.7,2.0,0,1.9,2.3,2.3,0,2.0,1.9,2.8,0,2.3,2.0,2.4,0,2.8,2.3,2.3,0,2.4,2.8,2.7,0,2.3,2.4,2.7,0,2.7,2.3,2.9,0,2.7,2.7,3.0,0,2.9,2.7,2.2,0,3.0,2.9,2.3,0,2.2,3.0,2.8,0,2.3,2.2,2.8,0,2.8,2.3,2.8,0,2.8,2.8,2.2,0,2.8,2.8,2.6,0,2.2,2.8,2.8,0,2.6,2.2,2.5,0,2.8,2.6,2.4,0,2.5,2.8,2.3,0,2.4,2.5,1.9,0,2.3,2.4,1.7,0,1.9,2.3,2.0,0,1.7,1.9,2.1,0,2.0,1.7,1.7,0,2.1,2.0,1.8,0,1.7,2.1,1.8,0,1.8,1.7,1.8,0,1.8,1.8,1.3,0,1.8,1.8,1.3,0,1.3,1.8,1.3,0,1.3,1.3,1.2,0,1.3,1.3,1.4,0,1.2,1.3,2.2,1,1.4,1.2,2.9,1,2.2,1.4,3.1,1,2.9,2.2,3.5,1,3.1,2.9,3.6,1,3.5,3.1,4.4,1,3.6,3.5,4.1,1,4.4,3.6,5.1,1,4.1,4.4,5.8,1,5.1,4.1,5.9,1,5.8,5.1,5.4,1,5.9,5.8,5.5,1,5.4,5.9,4.8,1,5.5,5.4,3.2,1,4.8,5.5,2.7,1,3.2,4.8,2.1,1,2.7,3.2,1.9,1,2.1,2.7,0.6,1,1.9,2.1),dim=c(4,57),dimnames=list(c('Y','X','Y1','Y2'),1:57))
> y <- array(NA,dim=c(4,57),dimnames=list(c('Y','X','Y1','Y2'),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 = '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){
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8 1 5.1 4.1 0 0 0 0 0 0 0 0 0 0 0 48
49 5.9 1 5.8 5.1 1 0 0 0 0 0 0 0 0 0 0 49
50 5.4 1 5.9 5.8 0 1 0 0 0 0 0 0 0 0 0 50
51 5.5 1 5.4 5.9 0 0 1 0 0 0 0 0 0 0 0 51
52 4.8 1 5.5 5.4 0 0 0 1 0 0 0 0 0 0 0 52
53 3.2 1 4.8 5.5 0 0 0 0 1 0 0 0 0 0 0 53
54 2.7 1 3.2 4.8 0 0 0 0 0 1 0 0 0 0 0 54
55 2.1 1 2.7 3.2 0 0 0 0 0 0 1 0 0 0 0 55
56 1.9 1 2.1 2.7 0 0 0 0 0 0 0 1 0 0 0 56
57 0.6 1 1.9 2.1 0 0 0 0 0 0 0 0 1 0 0 57
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X Y1 Y2 M1 M2
0.91838 0.65470 1.08058 -0.25582 -0.20142 -0.30868
M3 M4 M5 M6 M7 M8
-0.20001 -0.30454 -0.48088 -0.29249 -0.40304 -0.22621
M9 M10 M11 t
-0.42274 -0.32231 -0.03261 -0.01389
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.27466 -0.31010 0.04383 0.25787 0.90746
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.918381 0.377680 2.432 0.0195 *
X 0.654697 0.305291 2.145 0.0380 *
Y1 1.080578 0.164152 6.583 6.42e-08 ***
Y2 -0.255819 0.155223 -1.648 0.1070
M1 -0.201422 0.336739 -0.598 0.5530
M2 -0.308681 0.336817 -0.916 0.3648
M3 -0.200008 0.338412 -0.591 0.5578
M4 -0.304535 0.343353 -0.887 0.3803
M5 -0.480881 0.341655 -1.408 0.1668
M6 -0.292490 0.345638 -0.846 0.4023
M7 -0.403039 0.342130 -1.178 0.2456
M8 -0.226210 0.343730 -0.658 0.5141
M9 -0.422740 0.340734 -1.241 0.2218
M10 -0.322313 0.353886 -0.911 0.3677
M11 -0.032614 0.355510 -0.092 0.9274
t -0.013887 0.007196 -1.930 0.0606 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.4999 on 41 degrees of freedom
Multiple R-squared: 0.8681, Adjusted R-squared: 0.8199
F-statistic: 18 on 15 and 41 DF, p-value: 2.010e-13
> 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.5451952 0.9096095 0.4548048
[2,] 0.3761823 0.7523646 0.6238177
[3,] 0.4475943 0.8951886 0.5524057
[4,] 0.3191086 0.6382172 0.6808914
[5,] 0.2473620 0.4947241 0.7526380
[6,] 0.2818904 0.5637808 0.7181096
[7,] 0.2562306 0.5124612 0.7437694
[8,] 0.2415977 0.4831954 0.7584023
[9,] 0.4997362 0.9994725 0.5002638
[10,] 0.5074936 0.9850127 0.4925064
[11,] 0.4350172 0.8700345 0.5649828
[12,] 0.3484813 0.6969625 0.6515187
[13,] 0.3035939 0.6071879 0.6964061
[14,] 0.2188570 0.4377140 0.7811430
[15,] 0.1521773 0.3043545 0.8478227
[16,] 0.1347806 0.2695611 0.8652194
[17,] 0.1940347 0.3880695 0.8059653
[18,] 0.1863839 0.3727679 0.8136161
[19,] 0.1268159 0.2536317 0.8731841
[20,] 0.0632611 0.1265222 0.9367389
> postscript(file="/var/www/html/rcomp/tmp/16sor1258644969.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/2937s1258644969.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/3f1l41258644969.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/40xhz1258644969.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/5f8yq1258644969.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 6
-0.15026341 -0.33950251 -0.50064858 0.70829967 -0.52515124 -0.43718747
7 8 9 10 11 12
0.11715198 0.04382540 0.45565046 -0.49443320 -0.31010442 0.07689899
13 14 15 16 17 18
-0.16560533 0.25786815 0.04696691 -0.69151260 0.48876416 0.50154759
19 20 21 22 23 24
0.11127637 0.07624422 -0.31333926 0.64846701 -0.01306675 -0.44558184
25 26 27 28 29 30
0.04506379 0.09752208 -0.31478769 0.01027610 0.61429697 0.16445597
31 32 33 34 35 36
-0.14242047 0.25245107 0.25248240 0.19152390 -0.58428766 -0.06272576
37 38 39 40 41 42
0.02467359 0.04581967 0.25909174 0.28111168 0.35804595 -0.16820762
43 44 45 46 47 48
0.31918558 -0.12482320 0.87986295 -0.34555772 0.90745884 0.43140862
49 50 51 52 53 54
0.24613135 -0.06170738 0.50937763 -0.30817484 -0.93595585 -0.06060846
55 56 57
-0.40519346 -0.24769749 -1.27465654
> postscript(file="/var/www/html/rcomp/tmp/60cw31258644969.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.15026341 NA
1 -0.33950251 -0.15026341
2 -0.50064858 -0.33950251
3 0.70829967 -0.50064858
4 -0.52515124 0.70829967
5 -0.43718747 -0.52515124
6 0.11715198 -0.43718747
7 0.04382540 0.11715198
8 0.45565046 0.04382540
9 -0.49443320 0.45565046
10 -0.31010442 -0.49443320
11 0.07689899 -0.31010442
12 -0.16560533 0.07689899
13 0.25786815 -0.16560533
14 0.04696691 0.25786815
15 -0.69151260 0.04696691
16 0.48876416 -0.69151260
17 0.50154759 0.48876416
18 0.11127637 0.50154759
19 0.07624422 0.11127637
20 -0.31333926 0.07624422
21 0.64846701 -0.31333926
22 -0.01306675 0.64846701
23 -0.44558184 -0.01306675
24 0.04506379 -0.44558184
25 0.09752208 0.04506379
26 -0.31478769 0.09752208
27 0.01027610 -0.31478769
28 0.61429697 0.01027610
29 0.16445597 0.61429697
30 -0.14242047 0.16445597
31 0.25245107 -0.14242047
32 0.25248240 0.25245107
33 0.19152390 0.25248240
34 -0.58428766 0.19152390
35 -0.06272576 -0.58428766
36 0.02467359 -0.06272576
37 0.04581967 0.02467359
38 0.25909174 0.04581967
39 0.28111168 0.25909174
40 0.35804595 0.28111168
41 -0.16820762 0.35804595
42 0.31918558 -0.16820762
43 -0.12482320 0.31918558
44 0.87986295 -0.12482320
45 -0.34555772 0.87986295
46 0.90745884 -0.34555772
47 0.43140862 0.90745884
48 0.24613135 0.43140862
49 -0.06170738 0.24613135
50 0.50937763 -0.06170738
51 -0.30817484 0.50937763
52 -0.93595585 -0.30817484
53 -0.06060846 -0.93595585
54 -0.40519346 -0.06060846
55 -0.24769749 -0.40519346
56 -1.27465654 -0.24769749
57 NA -1.27465654
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.33950251 -0.15026341
[2,] -0.50064858 -0.33950251
[3,] 0.70829967 -0.50064858
[4,] -0.52515124 0.70829967
[5,] -0.43718747 -0.52515124
[6,] 0.11715198 -0.43718747
[7,] 0.04382540 0.11715198
[8,] 0.45565046 0.04382540
[9,] -0.49443320 0.45565046
[10,] -0.31010442 -0.49443320
[11,] 0.07689899 -0.31010442
[12,] -0.16560533 0.07689899
[13,] 0.25786815 -0.16560533
[14,] 0.04696691 0.25786815
[15,] -0.69151260 0.04696691
[16,] 0.48876416 -0.69151260
[17,] 0.50154759 0.48876416
[18,] 0.11127637 0.50154759
[19,] 0.07624422 0.11127637
[20,] -0.31333926 0.07624422
[21,] 0.64846701 -0.31333926
[22,] -0.01306675 0.64846701
[23,] -0.44558184 -0.01306675
[24,] 0.04506379 -0.44558184
[25,] 0.09752208 0.04506379
[26,] -0.31478769 0.09752208
[27,] 0.01027610 -0.31478769
[28,] 0.61429697 0.01027610
[29,] 0.16445597 0.61429697
[30,] -0.14242047 0.16445597
[31,] 0.25245107 -0.14242047
[32,] 0.25248240 0.25245107
[33,] 0.19152390 0.25248240
[34,] -0.58428766 0.19152390
[35,] -0.06272576 -0.58428766
[36,] 0.02467359 -0.06272576
[37,] 0.04581967 0.02467359
[38,] 0.25909174 0.04581967
[39,] 0.28111168 0.25909174
[40,] 0.35804595 0.28111168
[41,] -0.16820762 0.35804595
[42,] 0.31918558 -0.16820762
[43,] -0.12482320 0.31918558
[44,] 0.87986295 -0.12482320
[45,] -0.34555772 0.87986295
[46,] 0.90745884 -0.34555772
[47,] 0.43140862 0.90745884
[48,] 0.24613135 0.43140862
[49,] -0.06170738 0.24613135
[50,] 0.50937763 -0.06170738
[51,] -0.30817484 0.50937763
[52,] -0.93595585 -0.30817484
[53,] -0.06060846 -0.93595585
[54,] -0.40519346 -0.06060846
[55,] -0.24769749 -0.40519346
[56,] -1.27465654 -0.24769749
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.33950251 -0.15026341
2 -0.50064858 -0.33950251
3 0.70829967 -0.50064858
4 -0.52515124 0.70829967
5 -0.43718747 -0.52515124
6 0.11715198 -0.43718747
7 0.04382540 0.11715198
8 0.45565046 0.04382540
9 -0.49443320 0.45565046
10 -0.31010442 -0.49443320
11 0.07689899 -0.31010442
12 -0.16560533 0.07689899
13 0.25786815 -0.16560533
14 0.04696691 0.25786815
15 -0.69151260 0.04696691
16 0.48876416 -0.69151260
17 0.50154759 0.48876416
18 0.11127637 0.50154759
19 0.07624422 0.11127637
20 -0.31333926 0.07624422
21 0.64846701 -0.31333926
22 -0.01306675 0.64846701
23 -0.44558184 -0.01306675
24 0.04506379 -0.44558184
25 0.09752208 0.04506379
26 -0.31478769 0.09752208
27 0.01027610 -0.31478769
28 0.61429697 0.01027610
29 0.16445597 0.61429697
30 -0.14242047 0.16445597
31 0.25245107 -0.14242047
32 0.25248240 0.25245107
33 0.19152390 0.25248240
34 -0.58428766 0.19152390
35 -0.06272576 -0.58428766
36 0.02467359 -0.06272576
37 0.04581967 0.02467359
38 0.25909174 0.04581967
39 0.28111168 0.25909174
40 0.35804595 0.28111168
41 -0.16820762 0.35804595
42 0.31918558 -0.16820762
43 -0.12482320 0.31918558
44 0.87986295 -0.12482320
45 -0.34555772 0.87986295
46 0.90745884 -0.34555772
47 0.43140862 0.90745884
48 0.24613135 0.43140862
49 -0.06170738 0.24613135
50 0.50937763 -0.06170738
51 -0.30817484 0.50937763
52 -0.93595585 -0.30817484
53 -0.06060846 -0.93595585
54 -0.40519346 -0.06060846
55 -0.24769749 -0.40519346
56 -1.27465654 -0.24769749
> 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/7igwe1258644969.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/8j30p1258644969.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/9px971258644969.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/10hrei1258644969.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/113gu31258644969.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/12rj4d1258644969.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/13mcqm1258644970.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/14p0tj1258644970.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/15gguu1258644970.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/16ee9j1258644970.tab")
+ }
>
> system("convert tmp/16sor1258644969.ps tmp/16sor1258644969.png")
> system("convert tmp/2937s1258644969.ps tmp/2937s1258644969.png")
> system("convert tmp/3f1l41258644969.ps tmp/3f1l41258644969.png")
> system("convert tmp/40xhz1258644969.ps tmp/40xhz1258644969.png")
> system("convert tmp/5f8yq1258644969.ps tmp/5f8yq1258644969.png")
> system("convert tmp/60cw31258644969.ps tmp/60cw31258644969.png")
> system("convert tmp/7igwe1258644969.ps tmp/7igwe1258644969.png")
> system("convert tmp/8j30p1258644969.ps tmp/8j30p1258644969.png")
> system("convert tmp/9px971258644969.ps tmp/9px971258644969.png")
> system("convert tmp/10hrei1258644969.ps tmp/10hrei1258644969.png")
>
>
> proc.time()
user system elapsed
2.299 1.517 2.716