R version 2.12.0 (2010-10-15)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-pc-linux-gnu (32-bit)
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.0
+ ,6.3
+ ,4.5
+ ,1000
+ ,6600
+ ,42.0
+ ,3
+ ,1
+ ,3
+ ,1.8
+ ,2.1
+ ,69.0
+ ,2547000
+ ,4603000
+ ,624.0
+ ,3
+ ,5
+ ,4
+ ,.7
+ ,9.1
+ ,27.0
+ ,10550
+ ,179500
+ ,180.0
+ ,4
+ ,4
+ ,4
+ ,3.9
+ ,15.8
+ ,19.0
+ ,0.023
+ ,0.3
+ ,35.0
+ ,1
+ ,1
+ ,1
+ ,1.0
+ ,5.2
+ ,30.4
+ ,160000
+ ,169000
+ ,392.0
+ ,4
+ ,5
+ ,4
+ ,3.6
+ ,10.9
+ ,28.0
+ ,3300
+ ,25600
+ ,63.0
+ ,1
+ ,2
+ ,1
+ ,1.4
+ ,8.3
+ ,50.0
+ ,52160
+ ,440000
+ ,230.0
+ ,1
+ ,1
+ ,1
+ ,1.5
+ ,11.0
+ ,7.0
+ ,0.425
+ ,6400
+ ,112.0
+ ,5
+ ,4
+ ,4
+ ,.7
+ ,3.2
+ ,30.0
+ ,465000
+ ,423000
+ ,281.0
+ ,5
+ ,5
+ ,5
+ ,2.1
+ ,6.3
+ ,3.5
+ ,0.075
+ ,1200
+ ,42.0
+ ,1
+ ,1
+ ,1
+ ,4.1
+ ,6.6
+ ,6.0
+ ,0.785
+ ,3500
+ ,42.0
+ ,2
+ ,2
+ ,2
+ ,1.2
+ ,9.5
+ ,10.4
+ ,0.2
+ ,5000
+ ,120.0
+ ,2
+ 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' 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
> 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
PS SWS L Wb Wbr Tg P S D\r
1 2.0 6.3 4.5 1.000e+03 6.600e+03 42 3 1 3
2 1.8 2.1 69.0 2.547e+06 4.603e+06 624 3 5 4
3 0.7 9.1 27.0 1.055e+04 1.795e+05 180 4 4 4
4 3.9 15.8 19.0 2.300e-02 3.000e-01 35 1 1 1
5 1.0 5.2 30.4 1.600e+05 1.690e+05 392 4 5 4
6 3.6 10.9 28.0 3.300e+03 2.560e+04 63 1 2 1
7 1.4 8.3 50.0 5.216e+04 4.400e+05 230 1 1 1
8 1.5 11.0 7.0 4.250e-01 6.400e+03 112 5 4 4
9 0.7 3.2 30.0 4.650e+05 4.230e+05 281 5 5 5
10 2.1 6.3 3.5 7.500e-02 1.200e+03 42 1 1 1
11 4.1 6.6 6.0 7.850e-01 3.500e+03 42 2 2 2
12 1.2 9.5 10.4 2.000e-01 5.000e+03 120 2 2 2
13 0.5 3.3 20.0 2.766e+04 1.150e+05 148 5 5 5
14 3.4 11.0 3.9 1.200e-01 1.000e+03 16 3 1 2
15 1.5 4.7 41.0 8.500e+04 3.250e+05 310 1 3 1
16 3.4 10.4 9.0 1.010e-01 4.000e+03 28 5 1 3
17 0.8 7.4 7.6 1.040e+03 5.500e+03 68 5 3 4
18 0.8 2.1 46.0 5.210e+05 6.550e+05 336 5 5 5
19 2.0 17.9 24.0 1.000e-02 2.500e-01 50 1 1 1
20 1.9 6.1 100.0 6.200e+04 1.320e+06 267 1 1 1
21 1.3 11.9 3.2 2.300e-02 4.000e-01 19 4 1 3
22 5.6 13.8 5.0 1.700e+03 6.300e+03 12 2 1 1
23 3.1 14.3 6.5 3.500e+03 1.080e+04 120 2 1 1
24 1.8 15.2 12.0 4.800e-01 1.550e+04 140 2 2 2
25 0.9 10.0 20.2 1.000e+04 1.150e+05 170 4 4 4
26 1.8 11.9 13.0 1.620e+03 1.140e+04 17 2 1 2
27 1.9 6.5 27.0 1.920e+05 1.800e+05 115 4 4 4
28 0.9 7.5 18.0 2.500e+03 1.210e+04 31 5 5 5
29 2.6 10.6 4.7 2.800e-01 1.900e+03 21 3 1 3
30 2.4 7.4 9.8 4.235e+03 5.040e+04 52 1 1 1
31 1.2 8.4 29.0 6.800e+03 1.790e+05 164 2 3 2
32 0.9 5.7 7.0 7.500e-01 1.230e+04 225 2 2 2
33 0.5 4.9 6.0 3.600e+03 2.100e+04 225 3 2 3
34 0.6 3.2 20.0 5.550e+04 1.750e+05 151 5 5 5
35 2.3 11.0 4.5 9.000e-01 2.600e+03 60 2 1 2
36 0.5 4.9 7.5 2.000e+03 1.230e+04 200 3 1 3
37 2.6 13.2 2.3 1.040e-01 2.500e+03 46 3 2 2
38 0.6 9.7 24.0 4.190e+03 5.800e+04 210 4 3 4
39 6.6 12.8 3.0 3.500e+03 3.900e+03 14 2 1 1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) SWS L Wb Wbr Tg
3.987e+00 -1.396e-02 1.194e-02 3.637e-06 -1.022e-06 -7.506e-03
P S `D\r`
9.243e-01 2.631e-01 -1.714e+00
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.23547 -0.55815 0.03274 0.24759 2.45448
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.987e+00 8.122e-01 4.908 3.02e-05 ***
SWS -1.396e-02 5.360e-02 -0.260 0.796268
L 1.194e-02 1.604e-02 0.745 0.462186
Wb 3.637e-06 1.903e-06 1.911 0.065621 .
Wbr -1.022e-06 1.137e-06 -0.899 0.375825
Tg -7.506e-03 2.330e-03 -3.222 0.003062 **
P 9.243e-01 3.308e-01 2.794 0.008982 **
S 2.631e-01 2.049e-01 1.284 0.208885
`D\r` -1.714e+00 4.192e-01 -4.088 0.000300 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.8783 on 30 degrees of freedom
Multiple R-squared: 0.6918, Adjusted R-squared: 0.6096
F-statistic: 8.416 on 8 and 30 DF, p-value: 6.33e-06
> 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.8557194 0.2885613 0.1442806
[2,] 0.7512213 0.4975575 0.2487787
[3,] 0.6484310 0.7031380 0.3515690
[4,] 0.5061490 0.9877020 0.4938510
[5,] 0.3959754 0.7919509 0.6040246
[6,] 0.4181708 0.8363417 0.5818292
[7,] 0.3060699 0.6121398 0.6939301
[8,] 0.3223019 0.6446038 0.6776981
[9,] 0.2412377 0.4824754 0.7587623
[10,] 0.4073070 0.8146139 0.5926930
[11,] 0.5092643 0.9814715 0.4907357
[12,] 0.4401368 0.8802735 0.5598632
[13,] 0.3163271 0.6326541 0.6836729
[14,] 0.2203668 0.4407335 0.7796332
[15,] 0.1769803 0.3539606 0.8230197
[16,] 0.1661278 0.3322556 0.8338722
> postscript(file="/var/www/rcomp/tmp/1reyv1292176632.ps",horizontal=F,onefile=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/rcomp/tmp/2reyv1292176632.ps",horizontal=F,onefile=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/rcomp/tmp/32nfy1292176632.ps",horizontal=F,onefile=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/rcomp/tmp/42nfy1292176632.ps",horizontal=F,onefile=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/rcomp/tmp/52nfy1292176632.ps",horizontal=F,onefile=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 = 39
Frequency = 1
1 2 3 4 5 6
0.470821293 -0.090490674 0.119108383 0.695905946 1.098052048 0.181246231
7 8 9 10 11 12
-0.555461883 -0.388680680 -0.118541675 -0.997848953 1.505116787 -0.819927062
13 14 15 16 17 18
0.079690663 0.032738423 -0.560833047 -0.078309206 -1.218006784 0.221247533
19 20 21 22 23 24
-1.121897153 0.457765980 -1.235470681 1.438539921 -0.263676834 0.001403580
25 26 27 28 29 30
0.273924051 -0.726876161 0.135553311 -0.329643623 0.969677547 -0.647800850
31 32 33 34 35 36
-0.837179435 -0.336774990 0.049164945 0.160877579 0.181738355 0.103602647
37 38 39
-0.753793747 0.450560096 2.454478120
> postscript(file="/var/www/rcomp/tmp/6uxwj1292176632.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 39
Frequency = 1
lag(myerror, k = 1) myerror
0 0.470821293 NA
1 -0.090490674 0.470821293
2 0.119108383 -0.090490674
3 0.695905946 0.119108383
4 1.098052048 0.695905946
5 0.181246231 1.098052048
6 -0.555461883 0.181246231
7 -0.388680680 -0.555461883
8 -0.118541675 -0.388680680
9 -0.997848953 -0.118541675
10 1.505116787 -0.997848953
11 -0.819927062 1.505116787
12 0.079690663 -0.819927062
13 0.032738423 0.079690663
14 -0.560833047 0.032738423
15 -0.078309206 -0.560833047
16 -1.218006784 -0.078309206
17 0.221247533 -1.218006784
18 -1.121897153 0.221247533
19 0.457765980 -1.121897153
20 -1.235470681 0.457765980
21 1.438539921 -1.235470681
22 -0.263676834 1.438539921
23 0.001403580 -0.263676834
24 0.273924051 0.001403580
25 -0.726876161 0.273924051
26 0.135553311 -0.726876161
27 -0.329643623 0.135553311
28 0.969677547 -0.329643623
29 -0.647800850 0.969677547
30 -0.837179435 -0.647800850
31 -0.336774990 -0.837179435
32 0.049164945 -0.336774990
33 0.160877579 0.049164945
34 0.181738355 0.160877579
35 0.103602647 0.181738355
36 -0.753793747 0.103602647
37 0.450560096 -0.753793747
38 2.454478120 0.450560096
39 NA 2.454478120
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.090490674 0.470821293
[2,] 0.119108383 -0.090490674
[3,] 0.695905946 0.119108383
[4,] 1.098052048 0.695905946
[5,] 0.181246231 1.098052048
[6,] -0.555461883 0.181246231
[7,] -0.388680680 -0.555461883
[8,] -0.118541675 -0.388680680
[9,] -0.997848953 -0.118541675
[10,] 1.505116787 -0.997848953
[11,] -0.819927062 1.505116787
[12,] 0.079690663 -0.819927062
[13,] 0.032738423 0.079690663
[14,] -0.560833047 0.032738423
[15,] -0.078309206 -0.560833047
[16,] -1.218006784 -0.078309206
[17,] 0.221247533 -1.218006784
[18,] -1.121897153 0.221247533
[19,] 0.457765980 -1.121897153
[20,] -1.235470681 0.457765980
[21,] 1.438539921 -1.235470681
[22,] -0.263676834 1.438539921
[23,] 0.001403580 -0.263676834
[24,] 0.273924051 0.001403580
[25,] -0.726876161 0.273924051
[26,] 0.135553311 -0.726876161
[27,] -0.329643623 0.135553311
[28,] 0.969677547 -0.329643623
[29,] -0.647800850 0.969677547
[30,] -0.837179435 -0.647800850
[31,] -0.336774990 -0.837179435
[32,] 0.049164945 -0.336774990
[33,] 0.160877579 0.049164945
[34,] 0.181738355 0.160877579
[35,] 0.103602647 0.181738355
[36,] -0.753793747 0.103602647
[37,] 0.450560096 -0.753793747
[38,] 2.454478120 0.450560096
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.090490674 0.470821293
2 0.119108383 -0.090490674
3 0.695905946 0.119108383
4 1.098052048 0.695905946
5 0.181246231 1.098052048
6 -0.555461883 0.181246231
7 -0.388680680 -0.555461883
8 -0.118541675 -0.388680680
9 -0.997848953 -0.118541675
10 1.505116787 -0.997848953
11 -0.819927062 1.505116787
12 0.079690663 -0.819927062
13 0.032738423 0.079690663
14 -0.560833047 0.032738423
15 -0.078309206 -0.560833047
16 -1.218006784 -0.078309206
17 0.221247533 -1.218006784
18 -1.121897153 0.221247533
19 0.457765980 -1.121897153
20 -1.235470681 0.457765980
21 1.438539921 -1.235470681
22 -0.263676834 1.438539921
23 0.001403580 -0.263676834
24 0.273924051 0.001403580
25 -0.726876161 0.273924051
26 0.135553311 -0.726876161
27 -0.329643623 0.135553311
28 0.969677547 -0.329643623
29 -0.647800850 0.969677547
30 -0.837179435 -0.647800850
31 -0.336774990 -0.837179435
32 0.049164945 -0.336774990
33 0.160877579 0.049164945
34 0.181738355 0.160877579
35 0.103602647 0.181738355
36 -0.753793747 0.103602647
37 0.450560096 -0.753793747
38 2.454478120 0.450560096
> 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/rcomp/tmp/7noem1292176632.ps",horizontal=F,onefile=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/rcomp/tmp/8noem1292176632.ps",horizontal=F,onefile=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/rcomp/tmp/9noem1292176632.ps",horizontal=F,onefile=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')
Warning messages:
1: In sqrt(crit * p * (1 - hh)/hh) : NaNs produced
2: In sqrt(crit * p * (1 - hh)/hh) : NaNs produced
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/www/rcomp/tmp/10gfvp1292176632.ps",horizontal=F,onefile=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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/rcomp/tmp/111ycv1292176632.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/rcomp/tmp/12ngsi1292176632.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/rcomp/tmp/1318q91292176632.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/rcomp/tmp/144r6x1292176632.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/rcomp/tmp/15q9531292176632.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/rcomp/tmp/16l12u1292176632.tab")
+ }
>
> try(system("convert tmp/1reyv1292176632.ps tmp/1reyv1292176632.png",intern=TRUE))
character(0)
> try(system("convert tmp/2reyv1292176632.ps tmp/2reyv1292176632.png",intern=TRUE))
character(0)
> try(system("convert tmp/32nfy1292176632.ps tmp/32nfy1292176632.png",intern=TRUE))
character(0)
> try(system("convert tmp/42nfy1292176632.ps tmp/42nfy1292176632.png",intern=TRUE))
character(0)
> try(system("convert tmp/52nfy1292176632.ps tmp/52nfy1292176632.png",intern=TRUE))
character(0)
> try(system("convert tmp/6uxwj1292176632.ps tmp/6uxwj1292176632.png",intern=TRUE))
character(0)
> try(system("convert tmp/7noem1292176632.ps tmp/7noem1292176632.png",intern=TRUE))
character(0)
> try(system("convert tmp/8noem1292176632.ps tmp/8noem1292176632.png",intern=TRUE))
character(0)
> try(system("convert tmp/9noem1292176632.ps tmp/9noem1292176632.png",intern=TRUE))
character(0)
> try(system("convert tmp/10gfvp1292176632.ps tmp/10gfvp1292176632.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.010 1.540 4.548