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(6.3
+ ,2
+ ,4.5
+ ,1
+ ,6.6
+ ,42
+ ,3
+ ,1
+ ,3
+ ,2.1
+ ,1.8
+ ,69
+ ,2547
+ ,4603
+ ,624
+ ,3
+ ,5
+ ,4
+ ,9.1
+ ,0.7
+ ,27
+ ,10.55
+ ,179.5
+ ,180
+ ,4
+ ,4
+ ,4
+ ,15.8
+ ,3.9
+ ,19
+ ,0.023
+ ,0.3
+ ,35
+ ,1
+ ,1
+ ,1
+ ,5.2
+ ,1
+ ,30.4
+ ,160
+ ,169
+ ,392
+ ,4
+ ,5
+ ,4
+ ,10.9
+ ,3.6
+ ,28
+ ,3.3
+ ,25.6
+ ,63
+ ,1
+ ,2
+ ,1
+ ,8.3
+ ,1.4
+ ,50
+ ,52.16
+ ,440
+ ,230
+ ,1
+ ,1
+ ,1
+ ,11
+ ,1.5
+ ,7
+ ,0.425
+ ,6.4
+ ,112
+ ,5
+ ,4
+ ,4
+ ,3.2
+ ,0.7
+ ,30
+ ,465
+ ,423
+ ,281
+ ,5
+ ,5
+ ,5
+ ,6.3
+ ,2.1
+ ,3.5
+ ,0.075
+ ,1.2
+ ,42
+ ,1
+ ,1
+ ,1
+ ,8.6
+ ,0
+ ,50
+ ,3
+ ,25
+ ,28
+ ,2
+ ,2
+ ,2
+ ,6.6
+ ,4.1
+ ,6
+ ,0.785
+ ,3.5
+ ,42
+ ,2
+ ,2
+ ,2
+ ,9.5
+ ,1.2
+ ,10.4
+ ,0.2
+ ,5
+ ,120
+ ,2
+ ,2
+ ,2
+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> par6 = '0'
> par5 = '0'
> par4 = '0'
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '2'
> par6 <- '0'
> par5 <- '0'
> par4 <- '0'
> par3 <- 'No Linear Trend'
> par2 <- 'Do not include Seasonal Dummies'
> par1 <- '2'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Dr. Ian E. Holliday
> #To cite this work: Ian E. Holliday, 2009, 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:
> #Technical description:
> 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
PS SWS LifeSpan BodyW BrainW GT PI SEI ODI
1 2.0 6.3 4.5 1.000 6.60 42.0 3 1 3
2 1.8 2.1 69.0 2547.000 4603.00 624.0 3 5 4
3 0.7 9.1 27.0 10.550 179.50 180.0 4 4 4
4 3.9 15.8 19.0 0.023 0.30 35.0 1 1 1
5 1.0 5.2 30.4 160.000 169.00 392.0 4 5 4
6 3.6 10.9 28.0 3.300 25.60 63.0 1 2 1
7 1.4 8.3 50.0 52.160 440.00 230.0 1 1 1
8 1.5 11.0 7.0 0.425 6.40 112.0 5 4 4
9 0.7 3.2 30.0 465.000 423.00 281.0 5 5 5
10 2.1 6.3 3.5 0.075 1.20 42.0 1 1 1
11 0.0 8.6 50.0 3.000 25.00 28.0 2 2 2
12 4.1 6.6 6.0 0.785 3.50 42.0 2 2 2
13 1.2 9.5 10.4 0.200 5.00 120.0 2 2 2
14 0.5 3.3 20.0 27.660 115.00 148.0 5 5 5
15 3.4 11.0 3.9 0.120 1.00 16.0 3 1 2
16 1.5 4.7 41.0 85.000 325.00 310.0 1 3 1
17 3.4 10.4 9.0 0.101 4.00 28.0 5 1 3
18 0.8 7.4 7.6 1.040 5.50 68.0 5 3 4
19 0.8 2.1 46.0 521.000 655.00 336.0 5 5 5
20 1.4 7.7 2.6 0.005 0.14 21.5 5 2 4
21 2.0 17.9 24.0 0.010 0.25 50.0 1 1 1
22 1.9 6.1 100.0 62.000 1320.00 267.0 1 1 1
23 1.3 11.9 3.2 0.023 0.40 19.0 4 1 3
24 2.0 10.8 2.0 0.048 0.33 30.0 4 1 3
25 5.6 13.8 5.0 1.700 6.30 12.0 2 1 1
26 3.1 14.3 6.5 3.500 10.80 120.0 2 1 1
27 1.8 15.2 12.0 0.480 15.50 140.0 2 2 2
28 0.9 10.0 20.2 10.000 115.00 170.0 4 4 4
29 1.8 11.9 13.0 1.620 11.40 17.0 2 1 2
30 1.9 6.5 27.0 192.000 180.00 115.0 4 4 4
31 0.9 7.5 18.0 2.500 12.10 31.0 5 5 5
32 2.6 10.6 4.7 0.280 1.90 21.0 3 1 3
33 2.4 7.4 9.8 4.235 50.40 52.0 1 1 1
34 1.2 8.4 29.0 6.800 179.00 164.0 2 3 2
35 0.9 5.7 7.0 0.750 12.30 225.0 2 2 2
36 0.5 4.9 6.0 3.600 21.00 225.0 3 2 3
37 0.6 3.2 20.0 55.500 175.00 151.0 5 5 5
38 2.3 11.0 4.5 0.900 2.60 60.0 2 1 2
39 0.5 4.9 7.5 2.000 12.30 200.0 3 1 3
40 2.6 13.2 2.3 0.104 2.50 46.0 3 2 2
41 0.6 9.7 24.0 4.190 58.00 210.0 4 3 4
42 6.6 12.8 3.0 3.500 3.90 14.0 2 1 1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) SWS LifeSpan BodyW BrainW GT
3.6238868 0.0115329 -0.0133813 0.0013319 0.0003110 -0.0048478
PI SEI ODI
0.8840450 0.3574331 -1.7061759
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-2.00064 -0.56435 -0.05542 0.56806 2.51128
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.623887 0.870444 4.163 0.000211 ***
SWS 0.011533 0.057221 0.202 0.841505
LifeSpan -0.013381 0.014517 -0.922 0.363343
BodyW 0.001332 0.001867 0.713 0.480724
BrainW 0.000311 0.001117 0.278 0.782462
GT -0.004848 0.002328 -2.083 0.045111 *
PI 0.884045 0.352207 2.510 0.017156 *
SEI 0.357433 0.215137 1.661 0.106101
ODI -1.706176 0.454756 -3.752 0.000677 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.9532 on 33 degrees of freedom
Multiple R-squared: 0.6209, Adjusted R-squared: 0.5289
F-statistic: 6.755 on 8 and 33 DF, p-value: 3.143e-05
> 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.8471980 0.3056040 0.15280202
[2,] 0.9185188 0.1629624 0.08148119
[3,] 0.8519287 0.2961427 0.14807133
[4,] 0.7923077 0.4153847 0.20769234
[5,] 0.6889339 0.6221323 0.31106613
[6,] 0.6377610 0.7244779 0.36223896
[7,] 0.6158017 0.7683967 0.38419834
[8,] 0.5521405 0.8957190 0.44785951
[9,] 0.4555683 0.9111366 0.54443168
[10,] 0.4266134 0.8532267 0.57338663
[11,] 0.4337156 0.8674312 0.56628440
[12,] 0.4942376 0.9884752 0.50576241
[13,] 0.5330649 0.9338703 0.46693513
[14,] 0.5975598 0.8048805 0.40244024
[15,] 0.5436023 0.9127955 0.45639774
[16,] 0.4157332 0.8314664 0.58426682
[17,] 0.3057902 0.6115803 0.69420984
[18,] 0.2444414 0.4888828 0.75555859
[19,] 0.2422293 0.4844585 0.75777075
> postscript(file="/var/www/html/rcomp/tmp/1r1n81292321498.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/2js4b1292321498.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/3js4b1292321498.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/4u1mw1292321498.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/5u1mw1292321498.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 = 42
Frequency = 1
1 2 3 4 5 6
0.672855092 -0.338410559 -0.006025765 0.982386537 0.858969649 0.625401503
7 8 9 10 11 12
-0.277178266 -0.641934289 0.375475068 -0.881876324 -2.000639950 1.611153843
13 14 15 16 17 18
-0.884971088 0.074037076 0.181316418 -0.591101283 0.251832813 -1.148797193
19 20 21 22 23 24
0.822144332 -0.484108545 -0.802175644 0.809803169 -1.101439979 -0.351496921
25 26 27 28 29 30
1.518468746 -0.447458243 -0.235980918 0.064918395 -0.423632807 0.667025558
31 32 33 34 35 36
-0.102841679 1.126556612 -0.482626006 -0.830433669 -0.680624784 -0.269150939
37 38 39 40 41 42
0.133991331 0.185157801 -0.008004155 -0.877909886 0.396041244 2.511283707
> postscript(file="/var/www/html/rcomp/tmp/6u1mw1292321498.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 = 42
Frequency = 1
lag(myerror, k = 1) myerror
0 0.672855092 NA
1 -0.338410559 0.672855092
2 -0.006025765 -0.338410559
3 0.982386537 -0.006025765
4 0.858969649 0.982386537
5 0.625401503 0.858969649
6 -0.277178266 0.625401503
7 -0.641934289 -0.277178266
8 0.375475068 -0.641934289
9 -0.881876324 0.375475068
10 -2.000639950 -0.881876324
11 1.611153843 -2.000639950
12 -0.884971088 1.611153843
13 0.074037076 -0.884971088
14 0.181316418 0.074037076
15 -0.591101283 0.181316418
16 0.251832813 -0.591101283
17 -1.148797193 0.251832813
18 0.822144332 -1.148797193
19 -0.484108545 0.822144332
20 -0.802175644 -0.484108545
21 0.809803169 -0.802175644
22 -1.101439979 0.809803169
23 -0.351496921 -1.101439979
24 1.518468746 -0.351496921
25 -0.447458243 1.518468746
26 -0.235980918 -0.447458243
27 0.064918395 -0.235980918
28 -0.423632807 0.064918395
29 0.667025558 -0.423632807
30 -0.102841679 0.667025558
31 1.126556612 -0.102841679
32 -0.482626006 1.126556612
33 -0.830433669 -0.482626006
34 -0.680624784 -0.830433669
35 -0.269150939 -0.680624784
36 0.133991331 -0.269150939
37 0.185157801 0.133991331
38 -0.008004155 0.185157801
39 -0.877909886 -0.008004155
40 0.396041244 -0.877909886
41 2.511283707 0.396041244
42 NA 2.511283707
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.338410559 0.672855092
[2,] -0.006025765 -0.338410559
[3,] 0.982386537 -0.006025765
[4,] 0.858969649 0.982386537
[5,] 0.625401503 0.858969649
[6,] -0.277178266 0.625401503
[7,] -0.641934289 -0.277178266
[8,] 0.375475068 -0.641934289
[9,] -0.881876324 0.375475068
[10,] -2.000639950 -0.881876324
[11,] 1.611153843 -2.000639950
[12,] -0.884971088 1.611153843
[13,] 0.074037076 -0.884971088
[14,] 0.181316418 0.074037076
[15,] -0.591101283 0.181316418
[16,] 0.251832813 -0.591101283
[17,] -1.148797193 0.251832813
[18,] 0.822144332 -1.148797193
[19,] -0.484108545 0.822144332
[20,] -0.802175644 -0.484108545
[21,] 0.809803169 -0.802175644
[22,] -1.101439979 0.809803169
[23,] -0.351496921 -1.101439979
[24,] 1.518468746 -0.351496921
[25,] -0.447458243 1.518468746
[26,] -0.235980918 -0.447458243
[27,] 0.064918395 -0.235980918
[28,] -0.423632807 0.064918395
[29,] 0.667025558 -0.423632807
[30,] -0.102841679 0.667025558
[31,] 1.126556612 -0.102841679
[32,] -0.482626006 1.126556612
[33,] -0.830433669 -0.482626006
[34,] -0.680624784 -0.830433669
[35,] -0.269150939 -0.680624784
[36,] 0.133991331 -0.269150939
[37,] 0.185157801 0.133991331
[38,] -0.008004155 0.185157801
[39,] -0.877909886 -0.008004155
[40,] 0.396041244 -0.877909886
[41,] 2.511283707 0.396041244
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.338410559 0.672855092
2 -0.006025765 -0.338410559
3 0.982386537 -0.006025765
4 0.858969649 0.982386537
5 0.625401503 0.858969649
6 -0.277178266 0.625401503
7 -0.641934289 -0.277178266
8 0.375475068 -0.641934289
9 -0.881876324 0.375475068
10 -2.000639950 -0.881876324
11 1.611153843 -2.000639950
12 -0.884971088 1.611153843
13 0.074037076 -0.884971088
14 0.181316418 0.074037076
15 -0.591101283 0.181316418
16 0.251832813 -0.591101283
17 -1.148797193 0.251832813
18 0.822144332 -1.148797193
19 -0.484108545 0.822144332
20 -0.802175644 -0.484108545
21 0.809803169 -0.802175644
22 -1.101439979 0.809803169
23 -0.351496921 -1.101439979
24 1.518468746 -0.351496921
25 -0.447458243 1.518468746
26 -0.235980918 -0.447458243
27 0.064918395 -0.235980918
28 -0.423632807 0.064918395
29 0.667025558 -0.423632807
30 -0.102841679 0.667025558
31 1.126556612 -0.102841679
32 -0.482626006 1.126556612
33 -0.830433669 -0.482626006
34 -0.680624784 -0.830433669
35 -0.269150939 -0.680624784
36 0.133991331 -0.269150939
37 0.185157801 0.133991331
38 -0.008004155 0.185157801
39 -0.877909886 -0.008004155
40 0.396041244 -0.877909886
41 2.511283707 0.396041244
> 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/7nb3z1292321498.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/8x2kk1292321498.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/9x2kk1292321498.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')
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/html/rcomp/tmp/10x2kk1292321498.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/11ttib1292321498.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/1243hd1292321498.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/13t4wp1292321498.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/14mdda1292321498.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/15pwcg1292321498.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/1635sp1292321498.tab")
+ }
>
> try(system("convert tmp/1r1n81292321498.ps tmp/1r1n81292321498.png",intern=TRUE))
character(0)
> try(system("convert tmp/2js4b1292321498.ps tmp/2js4b1292321498.png",intern=TRUE))
character(0)
> try(system("convert tmp/3js4b1292321498.ps tmp/3js4b1292321498.png",intern=TRUE))
character(0)
> try(system("convert tmp/4u1mw1292321498.ps tmp/4u1mw1292321498.png",intern=TRUE))
character(0)
> try(system("convert tmp/5u1mw1292321498.ps tmp/5u1mw1292321498.png",intern=TRUE))
character(0)
> try(system("convert tmp/6u1mw1292321498.ps tmp/6u1mw1292321498.png",intern=TRUE))
character(0)
> try(system("convert tmp/7nb3z1292321498.ps tmp/7nb3z1292321498.png",intern=TRUE))
character(0)
> try(system("convert tmp/8x2kk1292321498.ps tmp/8x2kk1292321498.png",intern=TRUE))
character(0)
> try(system("convert tmp/9x2kk1292321498.ps tmp/9x2kk1292321498.png",intern=TRUE))
character(0)
> try(system("convert tmp/10x2kk1292321498.ps tmp/10x2kk1292321498.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.276 1.609 6.655