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(94.7,0,101.8,0,102.5,0,105.3,0,110.3,0,109.8,0,117.3,0,118.8,0,131.3,0,125.9,0,133.1,0,147,0,145.8,0,164.4,0,149.8,0,137.7,0,151.7,0,156.8,0,180,0,180.4,0,170.4,0,191.6,0,199.5,0,218.2,1,217.5,1,205,1,194,0,199.3,0,219.3,1,211.1,1,215.2,1,240.2,1,242.2,1,240.7,1,255.4,1,253,1,218.2,1,203.7,1,205.6,1,215.6,1,188.5,1,202.9,1,214,1,230.3,1,230,1,241,1,259.6,1,247.8,1,270.3,1,289.7,1,322.7,1,315,1,320.2,1,329.5,1,360.6,1,382.2,1,435.4,1,464,1,468.8,1,403,1,351.6,1),dim=c(2,61),dimnames=list(c('Y','D'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('Y','D'),1:61))
> 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 D
1 94.7 0
2 101.8 0
3 102.5 0
4 105.3 0
5 110.3 0
6 109.8 0
7 117.3 0
8 118.8 0
9 131.3 0
10 125.9 0
11 133.1 0
12 147.0 0
13 145.8 0
14 164.4 0
15 149.8 0
16 137.7 0
17 151.7 0
18 156.8 0
19 180.0 0
20 180.4 0
21 170.4 0
22 191.6 0
23 199.5 0
24 218.2 1
25 217.5 1
26 205.0 1
27 194.0 0
28 199.3 0
29 219.3 1
30 211.1 1
31 215.2 1
32 240.2 1
33 242.2 1
34 240.7 1
35 255.4 1
36 253.0 1
37 218.2 1
38 203.7 1
39 205.6 1
40 215.6 1
41 188.5 1
42 202.9 1
43 214.0 1
44 230.3 1
45 230.0 1
46 241.0 1
47 259.6 1
48 247.8 1
49 270.3 1
50 289.7 1
51 322.7 1
52 315.0 1
53 320.2 1
54 329.5 1
55 360.6 1
56 382.2 1
57 435.4 1
58 464.0 1
59 468.8 1
60 403.0 1
61 351.6 1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) D
144.8 129.9
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-86.17 -44.37 -18.87 35.63 194.13
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 144.77 12.80 11.312 < 2e-16 ***
D 129.90 16.66 7.798 1.20e-10 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 63.99 on 59 degrees of freedom
Multiple R-squared: 0.5075, Adjusted R-squared: 0.4992
F-statistic: 60.81 on 1 and 59 DF, p-value: 1.203e-10
> if (n > n25) {
+ kp3 <- k + 3
+ nmkm3 <- n - k - 3
+ gqarr <- array(NA, dim=c(nmkm3-kp3+1,3))
+ numgqtests <- 0
+ numsignificant1 <- 0
+ numsignificant5 <- 0
+ numsignificant10 <- 0
+ for (mypoint in kp3:nmkm3) {
+ j <- 0
+ numgqtests <- numgqtests + 1
+ for (myalt in c('greater', 'two.sided', 'less')) {
+ j <- j + 1
+ gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value
+ }
+ if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1
+ }
+ gqarr
+ }
[,1] [,2] [,3]
[1,] 1.405293e-03 2.810585e-03 0.9985947
[2,] 1.958690e-04 3.917380e-04 0.9998041
[3,] 8.020754e-05 1.604151e-04 0.9999198
[4,] 2.589135e-05 5.178270e-05 0.9999741
[5,] 3.789257e-05 7.578513e-05 0.9999621
[6,] 1.362016e-05 2.724032e-05 0.9999864
[7,] 8.360221e-06 1.672044e-05 0.9999916
[8,] 1.583382e-05 3.166765e-05 0.9999842
[9,] 1.367722e-05 2.735445e-05 0.9999863
[10,] 3.860814e-05 7.721628e-05 0.9999614
[11,] 2.297717e-05 4.595433e-05 0.9999770
[12,] 8.197074e-06 1.639415e-05 0.9999918
[13,] 4.700984e-06 9.401967e-06 0.9999953
[14,] 3.168118e-06 6.336236e-06 0.9999968
[15,] 7.539754e-06 1.507951e-05 0.9999925
[16,] 1.142838e-05 2.285676e-05 0.9999886
[17,] 8.566429e-06 1.713286e-05 0.9999914
[18,] 1.481896e-05 2.963793e-05 0.9999852
[19,] 2.737640e-05 5.475281e-05 0.9999726
[20,] 1.191123e-05 2.382246e-05 0.9999881
[21,] 5.149016e-06 1.029803e-05 0.9999949
[22,] 2.522998e-06 5.045996e-06 0.9999975
[23,] 3.068091e-06 6.136182e-06 0.9999969
[24,] 3.864422e-06 7.728845e-06 0.9999961
[25,] 1.771956e-06 3.543912e-06 0.9999982
[26,] 8.626027e-07 1.725205e-06 0.9999991
[27,] 4.108248e-07 8.216496e-07 0.9999996
[28,] 2.101977e-07 4.203954e-07 0.9999998
[29,] 1.035399e-07 2.070798e-07 0.9999999
[30,] 4.791310e-08 9.582621e-08 1.0000000
[31,] 2.623085e-08 5.246170e-08 1.0000000
[32,] 1.274341e-08 2.548681e-08 1.0000000
[33,] 6.769093e-09 1.353819e-08 1.0000000
[34,] 5.813883e-09 1.162777e-08 1.0000000
[35,] 5.134230e-09 1.026846e-08 1.0000000
[36,] 3.777533e-09 7.555067e-09 1.0000000
[37,] 1.043013e-08 2.086025e-08 1.0000000
[38,] 1.909512e-08 3.819025e-08 1.0000000
[39,] 3.224582e-08 6.449163e-08 1.0000000
[40,] 4.904654e-08 9.809307e-08 1.0000000
[41,] 1.105391e-07 2.210782e-07 0.9999999
[42,] 3.047370e-07 6.094740e-07 0.9999997
[43,] 9.535429e-07 1.907086e-06 0.9999990
[44,] 6.432804e-06 1.286561e-05 0.9999936
[45,] 4.626527e-05 9.253054e-05 0.9999537
[46,] 3.343275e-04 6.686550e-04 0.9996657
[47,] 1.711325e-03 3.422649e-03 0.9982887
[48,] 7.047255e-03 1.409451e-02 0.9929527
[49,] 2.680327e-02 5.360653e-02 0.9731967
[50,] 8.990457e-02 1.798091e-01 0.9100954
[51,] 1.579033e-01 3.158065e-01 0.8420967
[52,] 1.849219e-01 3.698439e-01 0.8150781
> postscript(file="/var/www/html/freestat/rcomp/tmp/1ddls1229456741.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/freestat/rcomp/tmp/26hui1229456741.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/freestat/rcomp/tmp/3pd981229456741.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/freestat/rcomp/tmp/4dw3j1229456741.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/freestat/rcomp/tmp/5zil01229456741.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 = 61
Frequency = 1
1 2 3 4 5 6 7
-50.068000 -42.968000 -42.268000 -39.468000 -34.468000 -34.968000 -27.468000
8 9 10 11 12 13 14
-25.968000 -13.468000 -18.868000 -11.668000 2.232000 1.032000 19.632000
15 16 17 18 19 20 21
5.032000 -7.068000 6.932000 12.032000 35.232000 35.632000 25.632000
22 23 24 25 26 27 28
46.832000 54.732000 -56.466667 -57.166667 -69.666667 49.232000 54.532000
29 30 31 32 33 34 35
-55.366667 -63.566667 -59.466667 -34.466667 -32.466667 -33.966667 -19.266667
36 37 38 39 40 41 42
-21.666667 -56.466667 -70.966667 -69.066667 -59.066667 -86.166667 -71.766667
43 44 45 46 47 48 49
-60.666667 -44.366667 -44.666667 -33.666667 -15.066667 -26.866667 -4.366667
50 51 52 53 54 55 56
15.033333 48.033333 40.333333 45.533333 54.833333 85.933333 107.533333
57 58 59 60 61
160.733333 189.333333 194.133333 128.333333 76.933333
> postscript(file="/var/www/html/freestat/rcomp/tmp/6yrkv1229456741.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 = 61
Frequency = 1
lag(myerror, k = 1) myerror
0 -50.068000 NA
1 -42.968000 -50.068000
2 -42.268000 -42.968000
3 -39.468000 -42.268000
4 -34.468000 -39.468000
5 -34.968000 -34.468000
6 -27.468000 -34.968000
7 -25.968000 -27.468000
8 -13.468000 -25.968000
9 -18.868000 -13.468000
10 -11.668000 -18.868000
11 2.232000 -11.668000
12 1.032000 2.232000
13 19.632000 1.032000
14 5.032000 19.632000
15 -7.068000 5.032000
16 6.932000 -7.068000
17 12.032000 6.932000
18 35.232000 12.032000
19 35.632000 35.232000
20 25.632000 35.632000
21 46.832000 25.632000
22 54.732000 46.832000
23 -56.466667 54.732000
24 -57.166667 -56.466667
25 -69.666667 -57.166667
26 49.232000 -69.666667
27 54.532000 49.232000
28 -55.366667 54.532000
29 -63.566667 -55.366667
30 -59.466667 -63.566667
31 -34.466667 -59.466667
32 -32.466667 -34.466667
33 -33.966667 -32.466667
34 -19.266667 -33.966667
35 -21.666667 -19.266667
36 -56.466667 -21.666667
37 -70.966667 -56.466667
38 -69.066667 -70.966667
39 -59.066667 -69.066667
40 -86.166667 -59.066667
41 -71.766667 -86.166667
42 -60.666667 -71.766667
43 -44.366667 -60.666667
44 -44.666667 -44.366667
45 -33.666667 -44.666667
46 -15.066667 -33.666667
47 -26.866667 -15.066667
48 -4.366667 -26.866667
49 15.033333 -4.366667
50 48.033333 15.033333
51 40.333333 48.033333
52 45.533333 40.333333
53 54.833333 45.533333
54 85.933333 54.833333
55 107.533333 85.933333
56 160.733333 107.533333
57 189.333333 160.733333
58 194.133333 189.333333
59 128.333333 194.133333
60 76.933333 128.333333
61 NA 76.933333
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -42.968000 -50.068000
[2,] -42.268000 -42.968000
[3,] -39.468000 -42.268000
[4,] -34.468000 -39.468000
[5,] -34.968000 -34.468000
[6,] -27.468000 -34.968000
[7,] -25.968000 -27.468000
[8,] -13.468000 -25.968000
[9,] -18.868000 -13.468000
[10,] -11.668000 -18.868000
[11,] 2.232000 -11.668000
[12,] 1.032000 2.232000
[13,] 19.632000 1.032000
[14,] 5.032000 19.632000
[15,] -7.068000 5.032000
[16,] 6.932000 -7.068000
[17,] 12.032000 6.932000
[18,] 35.232000 12.032000
[19,] 35.632000 35.232000
[20,] 25.632000 35.632000
[21,] 46.832000 25.632000
[22,] 54.732000 46.832000
[23,] -56.466667 54.732000
[24,] -57.166667 -56.466667
[25,] -69.666667 -57.166667
[26,] 49.232000 -69.666667
[27,] 54.532000 49.232000
[28,] -55.366667 54.532000
[29,] -63.566667 -55.366667
[30,] -59.466667 -63.566667
[31,] -34.466667 -59.466667
[32,] -32.466667 -34.466667
[33,] -33.966667 -32.466667
[34,] -19.266667 -33.966667
[35,] -21.666667 -19.266667
[36,] -56.466667 -21.666667
[37,] -70.966667 -56.466667
[38,] -69.066667 -70.966667
[39,] -59.066667 -69.066667
[40,] -86.166667 -59.066667
[41,] -71.766667 -86.166667
[42,] -60.666667 -71.766667
[43,] -44.366667 -60.666667
[44,] -44.666667 -44.366667
[45,] -33.666667 -44.666667
[46,] -15.066667 -33.666667
[47,] -26.866667 -15.066667
[48,] -4.366667 -26.866667
[49,] 15.033333 -4.366667
[50,] 48.033333 15.033333
[51,] 40.333333 48.033333
[52,] 45.533333 40.333333
[53,] 54.833333 45.533333
[54,] 85.933333 54.833333
[55,] 107.533333 85.933333
[56,] 160.733333 107.533333
[57,] 189.333333 160.733333
[58,] 194.133333 189.333333
[59,] 128.333333 194.133333
[60,] 76.933333 128.333333
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -42.968000 -50.068000
2 -42.268000 -42.968000
3 -39.468000 -42.268000
4 -34.468000 -39.468000
5 -34.968000 -34.468000
6 -27.468000 -34.968000
7 -25.968000 -27.468000
8 -13.468000 -25.968000
9 -18.868000 -13.468000
10 -11.668000 -18.868000
11 2.232000 -11.668000
12 1.032000 2.232000
13 19.632000 1.032000
14 5.032000 19.632000
15 -7.068000 5.032000
16 6.932000 -7.068000
17 12.032000 6.932000
18 35.232000 12.032000
19 35.632000 35.232000
20 25.632000 35.632000
21 46.832000 25.632000
22 54.732000 46.832000
23 -56.466667 54.732000
24 -57.166667 -56.466667
25 -69.666667 -57.166667
26 49.232000 -69.666667
27 54.532000 49.232000
28 -55.366667 54.532000
29 -63.566667 -55.366667
30 -59.466667 -63.566667
31 -34.466667 -59.466667
32 -32.466667 -34.466667
33 -33.966667 -32.466667
34 -19.266667 -33.966667
35 -21.666667 -19.266667
36 -56.466667 -21.666667
37 -70.966667 -56.466667
38 -69.066667 -70.966667
39 -59.066667 -69.066667
40 -86.166667 -59.066667
41 -71.766667 -86.166667
42 -60.666667 -71.766667
43 -44.366667 -60.666667
44 -44.666667 -44.366667
45 -33.666667 -44.666667
46 -15.066667 -33.666667
47 -26.866667 -15.066667
48 -4.366667 -26.866667
49 15.033333 -4.366667
50 48.033333 15.033333
51 40.333333 48.033333
52 45.533333 40.333333
53 54.833333 45.533333
54 85.933333 54.833333
55 107.533333 85.933333
56 160.733333 107.533333
57 189.333333 160.733333
58 194.133333 189.333333
59 128.333333 194.133333
60 76.933333 128.333333
> 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/freestat/rcomp/tmp/7wadg1229456741.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/freestat/rcomp/tmp/81vsu1229456741.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/freestat/rcomp/tmp/915451229456741.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/freestat/rcomp/tmp/10iqx01229456741.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/11ow3b1229456741.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/freestat/rcomp/tmp/1225v61229456741.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/freestat/rcomp/tmp/13kz6l1229456741.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/freestat/rcomp/tmp/14n3l11229456741.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/freestat/rcomp/tmp/15kp481229456741.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/freestat/rcomp/tmp/16e7jp1229456741.tab")
+ }
>
> system("convert tmp/1ddls1229456741.ps tmp/1ddls1229456741.png")
> system("convert tmp/26hui1229456741.ps tmp/26hui1229456741.png")
> system("convert tmp/3pd981229456741.ps tmp/3pd981229456741.png")
> system("convert tmp/4dw3j1229456741.ps tmp/4dw3j1229456741.png")
> system("convert tmp/5zil01229456741.ps tmp/5zil01229456741.png")
> system("convert tmp/6yrkv1229456741.ps tmp/6yrkv1229456741.png")
> system("convert tmp/7wadg1229456741.ps tmp/7wadg1229456741.png")
> system("convert tmp/81vsu1229456741.ps tmp/81vsu1229456741.png")
> system("convert tmp/915451229456741.ps tmp/915451229456741.png")
> system("convert tmp/10iqx01229456741.ps tmp/10iqx01229456741.png")
>
>
> proc.time()
user system elapsed
3.665 2.484 4.177