R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-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(25
+ ,2
+ ,10
+ ,1.5
+ ,0
+ ,6
+ ,5.70
+ ,11.40
+ ,24
+ ,2
+ ,10
+ ,1.5
+ ,0
+ ,10
+ ,17.56
+ ,35.12
+ ,30
+ ,2
+ ,10
+ ,1.5
+ ,2
+ ,6
+ ,11.28
+ ,22.56
+ ,2
+ ,2
+ ,10
+ ,1.5
+ ,2
+ ,10
+ ,8.39
+ ,16.78
+ ,40
+ ,2
+ ,10
+ ,2.5
+ ,0
+ ,6
+ ,16.67
+ ,33.34
+ ,37
+ ,2
+ ,10
+ ,2.5
+ ,0
+ ,10
+ ,12.04
+ ,24.08
+ ,16
+ ,2
+ ,10
+ ,2.5
+ ,2
+ ,6
+ ,9.22
+ ,18.44
+ ,22
+ ,2
+ ,10
+ ,2.5
+ ,2
+ ,10
+ ,3.94
+ ,7.88
+ ,33
+ ,2
+ ,30
+ ,1.5
+ ,0
+ ,6
+ ,27.02
+ ,18.01
+ ,17
+ ,2
+ ,30
+ ,1.5
+ ,0
+ ,10
+ ,19.46
+ ,12.97
+ ,28
+ ,2
+ ,30
+ ,1.5
+ ,2
+ ,6
+ ,18.54
+ ,12.36
+ ,27
+ ,2
+ ,30
+ ,1.5
+ ,2
+ ,10
+ ,25.70
+ ,17.13
+ ,14
+ ,2
+ ,30
+ ,2.5
+ ,0
+ ,6
+ ,19.02
+ ,12.68
+ ,13
+ ,2
+ ,30
+ ,2.5
+ ,0
+ ,10
+ ,22.39
+ ,14.93
+ ,4
+ ,2
+ ,30
+ ,2.5
+ ,2
+ ,6
+ ,23.85
+ ,15.90
+ ,21
+ ,2
+ ,30
+ ,2.5
+ ,2
+ ,10
+ ,30.12
+ ,20.08
+ ,23
+ ,6
+ ,10
+ ,1.5
+ ,0
+ ,6
+ ,13.42
+ ,26.84
+ ,35
+ ,6
+ ,10
+ ,1.5
+ ,0
+ ,10
+ ,34.26
+ ,68.52
+ ,19
+ ,6
+ ,10
+ ,1.5
+ ,2
+ ,6
+ ,39.74
+ ,79.48
+ ,34
+ ,6
+ ,10
+ ,1.5
+ ,2
+ ,10
+ ,10.60
+ ,21.20
+ ,31
+ ,6
+ ,10
+ ,2.5
+ ,0
+ ,6
+ ,28.89
+ ,57.78
+ ,9
+ ,6
+ ,10
+ ,2.5
+ ,0
+ ,10
+ ,35.61
+ ,71.22
+ ,38
+ ,6
+ ,10
+ ,2.5
+ ,2
+ ,6
+ ,17.20
+ ,34.40
+ ,15
+ ,6
+ ,10
+ ,2.5
+ ,2
+ ,10
+ ,6.00
+ ,12.00
+ ,39
+ ,6
+ ,30
+ ,1.5
+ ,0
+ ,6
+ ,129.45
+ ,86.30
+ ,8
+ ,6
+ ,30
+ ,1.5
+ ,0
+ ,10
+ ,107.38
+ ,71.59
+ ,26
+ ,6
+ ,30
+ ,1.5
+ ,2
+ ,6
+ ,111.66
+ ,74.44
+ ,11
+ ,6
+ ,30
+ ,1.5
+ ,2
+ ,10
+ ,109.10
+ ,72.73
+ ,6
+ ,6
+ ,30
+ ,2.5
+ ,0
+ ,6
+ ,100.43
+ ,66.95
+ ,20
+ ,6
+ ,30
+ ,2.5
+ ,0
+ ,10
+ ,109.28
+ ,72.85
+ ,10
+ ,6
+ ,30
+ ,2.5
+ ,2
+ ,6
+ ,106.46
+ ,70.97
+ ,32
+ ,6
+ ,30
+ ,2.5
+ ,2
+ ,10
+ ,134.01
+ ,89.34
+ ,1
+ ,4
+ ,20
+ ,2.0
+ ,1
+ ,8
+ ,10.78
+ ,10.78
+ ,3
+ ,4
+ ,20
+ ,2.0
+ ,1
+ ,8
+ ,9.39
+ ,9.39
+ ,5
+ ,4
+ ,20
+ ,2.0
+ ,1
+ ,8
+ ,9.84
+ ,9.84
+ ,7
+ ,4
+ ,20
+ ,2.0
+ ,1
+ ,8
+ ,13.94
+ ,13.94
+ ,12
+ ,4
+ ,20
+ ,2.0
+ ,1
+ ,8
+ ,12.33
+ ,12.33
+ ,18
+ ,4
+ ,20
+ ,2.0
+ ,1
+ ,8
+ ,7.32
+ ,7.32
+ ,29
+ ,4
+ ,20
+ ,2.0
+ ,1
+ ,8
+ ,7.91
+ ,7.91
+ ,36
+ ,4
+ ,20
+ ,2.0
+ ,1
+ ,8
+ ,15.58
+ ,15.58)
+ ,dim=c(8
+ ,40)
+ ,dimnames=list(c('RUN'
+ ,'SPEED1'
+ ,'TOTAL'
+ ,'SPEED2'
+ ,'NUMBER2'
+ ,'SENS'
+ ,'TIME'
+ ,'T20BOLT')
+ ,1:40))
> y <- array(NA,dim=c(8,40),dimnames=list(c('RUN','SPEED1','TOTAL','SPEED2','NUMBER2','SENS','TIME','T20BOLT'),1:40))
> 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'
> 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, 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
RUN SPEED1 TOTAL SPEED2 NUMBER2 SENS TIME T20BOLT
1 25 2 10 1.5 0 6 5.70 11.40
2 24 2 10 1.5 0 10 17.56 35.12
3 30 2 10 1.5 2 6 11.28 22.56
4 2 2 10 1.5 2 10 8.39 16.78
5 40 2 10 2.5 0 6 16.67 33.34
6 37 2 10 2.5 0 10 12.04 24.08
7 16 2 10 2.5 2 6 9.22 18.44
8 22 2 10 2.5 2 10 3.94 7.88
9 33 2 30 1.5 0 6 27.02 18.01
10 17 2 30 1.5 0 10 19.46 12.97
11 28 2 30 1.5 2 6 18.54 12.36
12 27 2 30 1.5 2 10 25.70 17.13
13 14 2 30 2.5 0 6 19.02 12.68
14 13 2 30 2.5 0 10 22.39 14.93
15 4 2 30 2.5 2 6 23.85 15.90
16 21 2 30 2.5 2 10 30.12 20.08
17 23 6 10 1.5 0 6 13.42 26.84
18 35 6 10 1.5 0 10 34.26 68.52
19 19 6 10 1.5 2 6 39.74 79.48
20 34 6 10 1.5 2 10 10.60 21.20
21 31 6 10 2.5 0 6 28.89 57.78
22 9 6 10 2.5 0 10 35.61 71.22
23 38 6 10 2.5 2 6 17.20 34.40
24 15 6 10 2.5 2 10 6.00 12.00
25 39 6 30 1.5 0 6 129.45 86.30
26 8 6 30 1.5 0 10 107.38 71.59
27 26 6 30 1.5 2 6 111.66 74.44
28 11 6 30 1.5 2 10 109.10 72.73
29 6 6 30 2.5 0 6 100.43 66.95
30 20 6 30 2.5 0 10 109.28 72.85
31 10 6 30 2.5 2 6 106.46 70.97
32 32 6 30 2.5 2 10 134.01 89.34
33 1 4 20 2.0 1 8 10.78 10.78
34 3 4 20 2.0 1 8 9.39 9.39
35 5 4 20 2.0 1 8 9.84 9.84
36 7 4 20 2.0 1 8 13.94 13.94
37 12 4 20 2.0 1 8 12.33 12.33
38 18 4 20 2.0 1 8 7.32 7.32
39 29 4 20 2.0 1 8 7.91 7.91
40 36 4 20 2.0 1 8 15.58 15.58
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) SPEED1 TOTAL SPEED2 NUMBER2 SENS
45.13651 -1.61042 -0.46811 -3.12178 -0.87250 -0.84495
TIME T20BOLT
0.04955 0.09562
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-22.3777 -9.1212 0.4082 9.9165 18.2811
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 45.13651 16.17355 2.791 0.00879 **
SPEED1 -1.61042 1.53462 -1.049 0.30186
TOTAL -0.46811 0.39475 -1.186 0.24442
SPEED2 -3.12178 4.21166 -0.741 0.46396
NUMBER2 -0.87250 2.16544 -0.403 0.68969
SENS -0.84495 1.05347 -0.802 0.42843
TIME 0.04955 0.17054 0.291 0.77326
T20BOLT 0.09562 0.21405 0.447 0.65807
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 11.9 on 32 degrees of freedom
Multiple R-squared: 0.1502, Adjusted R-squared: -0.03574
F-statistic: 0.8077 on 7 and 32 DF, p-value: 0.5873
> 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.72763776 0.5447245 0.2723622
[2,] 0.65190205 0.6961959 0.3480980
[3,] 0.72828455 0.5434309 0.2717155
[4,] 0.67419815 0.6516037 0.3258019
[5,] 0.74058495 0.5188301 0.2594150
[6,] 0.65305901 0.6938820 0.3469410
[7,] 0.59139865 0.8172027 0.4086014
[8,] 0.54455806 0.9108839 0.4554419
[9,] 0.50059296 0.9988141 0.4994070
[10,] 0.53187622 0.9362476 0.4681238
[11,] 0.42340487 0.8468097 0.5765951
[12,] 0.50358212 0.9928358 0.4964179
[13,] 0.45580551 0.9116110 0.5441945
[14,] 0.35375492 0.7075098 0.6462451
[15,] 0.26656030 0.5331206 0.7334397
[16,] 0.26576005 0.5315201 0.7342400
[17,] 0.19012686 0.3802537 0.8098731
[18,] 0.11098259 0.2219652 0.8890174
[19,] 0.06772105 0.1354421 0.9322789
> postscript(file="/var/fisher/rcomp/tmp/1bu4p1355511826.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/fisher/rcomp/tmp/25r2q1355511826.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/fisher/rcomp/tmp/3da5f1355511826.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/fisher/rcomp/tmp/4uge31355511826.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/fisher/rcomp/tmp/5x3fm1355511826.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 = 40
Frequency = 1
1 2 3 4 5 6
-3.85477564 -4.33083352 1.54656785 -22.37771095 11.62544227 13.12015300
7 8 9 10 11 12
-8.83560872 1.81562109 11.81882901 0.05519666 9.52430096 11.09319900
13 14 15 16 17 18
-3.15330467 -1.15563394 -11.95554815 7.71386889 -1.27206003 9.08951082
19 20 21 22 23 24
-9.86487914 15.53180485 6.12456425 -14.11378892 17.68449925 0.76125667
25 26 27 28 29 30
12.65478600 -12.46516993 3.41540750 -7.91441031 -13.93512656 2.44197432
31 32 33 34 35 36
-8.87333105 13.38472540 -16.02201591 -13.82022228 -11.88555115 -10.48076978
37 38 39 40
-5.24703759 1.48029054 12.39463713 18.28114277
> postscript(file="/var/fisher/rcomp/tmp/6lv961355511826.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 = 40
Frequency = 1
lag(myerror, k = 1) myerror
0 -3.85477564 NA
1 -4.33083352 -3.85477564
2 1.54656785 -4.33083352
3 -22.37771095 1.54656785
4 11.62544227 -22.37771095
5 13.12015300 11.62544227
6 -8.83560872 13.12015300
7 1.81562109 -8.83560872
8 11.81882901 1.81562109
9 0.05519666 11.81882901
10 9.52430096 0.05519666
11 11.09319900 9.52430096
12 -3.15330467 11.09319900
13 -1.15563394 -3.15330467
14 -11.95554815 -1.15563394
15 7.71386889 -11.95554815
16 -1.27206003 7.71386889
17 9.08951082 -1.27206003
18 -9.86487914 9.08951082
19 15.53180485 -9.86487914
20 6.12456425 15.53180485
21 -14.11378892 6.12456425
22 17.68449925 -14.11378892
23 0.76125667 17.68449925
24 12.65478600 0.76125667
25 -12.46516993 12.65478600
26 3.41540750 -12.46516993
27 -7.91441031 3.41540750
28 -13.93512656 -7.91441031
29 2.44197432 -13.93512656
30 -8.87333105 2.44197432
31 13.38472540 -8.87333105
32 -16.02201591 13.38472540
33 -13.82022228 -16.02201591
34 -11.88555115 -13.82022228
35 -10.48076978 -11.88555115
36 -5.24703759 -10.48076978
37 1.48029054 -5.24703759
38 12.39463713 1.48029054
39 18.28114277 12.39463713
40 NA 18.28114277
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -4.33083352 -3.85477564
[2,] 1.54656785 -4.33083352
[3,] -22.37771095 1.54656785
[4,] 11.62544227 -22.37771095
[5,] 13.12015300 11.62544227
[6,] -8.83560872 13.12015300
[7,] 1.81562109 -8.83560872
[8,] 11.81882901 1.81562109
[9,] 0.05519666 11.81882901
[10,] 9.52430096 0.05519666
[11,] 11.09319900 9.52430096
[12,] -3.15330467 11.09319900
[13,] -1.15563394 -3.15330467
[14,] -11.95554815 -1.15563394
[15,] 7.71386889 -11.95554815
[16,] -1.27206003 7.71386889
[17,] 9.08951082 -1.27206003
[18,] -9.86487914 9.08951082
[19,] 15.53180485 -9.86487914
[20,] 6.12456425 15.53180485
[21,] -14.11378892 6.12456425
[22,] 17.68449925 -14.11378892
[23,] 0.76125667 17.68449925
[24,] 12.65478600 0.76125667
[25,] -12.46516993 12.65478600
[26,] 3.41540750 -12.46516993
[27,] -7.91441031 3.41540750
[28,] -13.93512656 -7.91441031
[29,] 2.44197432 -13.93512656
[30,] -8.87333105 2.44197432
[31,] 13.38472540 -8.87333105
[32,] -16.02201591 13.38472540
[33,] -13.82022228 -16.02201591
[34,] -11.88555115 -13.82022228
[35,] -10.48076978 -11.88555115
[36,] -5.24703759 -10.48076978
[37,] 1.48029054 -5.24703759
[38,] 12.39463713 1.48029054
[39,] 18.28114277 12.39463713
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -4.33083352 -3.85477564
2 1.54656785 -4.33083352
3 -22.37771095 1.54656785
4 11.62544227 -22.37771095
5 13.12015300 11.62544227
6 -8.83560872 13.12015300
7 1.81562109 -8.83560872
8 11.81882901 1.81562109
9 0.05519666 11.81882901
10 9.52430096 0.05519666
11 11.09319900 9.52430096
12 -3.15330467 11.09319900
13 -1.15563394 -3.15330467
14 -11.95554815 -1.15563394
15 7.71386889 -11.95554815
16 -1.27206003 7.71386889
17 9.08951082 -1.27206003
18 -9.86487914 9.08951082
19 15.53180485 -9.86487914
20 6.12456425 15.53180485
21 -14.11378892 6.12456425
22 17.68449925 -14.11378892
23 0.76125667 17.68449925
24 12.65478600 0.76125667
25 -12.46516993 12.65478600
26 3.41540750 -12.46516993
27 -7.91441031 3.41540750
28 -13.93512656 -7.91441031
29 2.44197432 -13.93512656
30 -8.87333105 2.44197432
31 13.38472540 -8.87333105
32 -16.02201591 13.38472540
33 -13.82022228 -16.02201591
34 -11.88555115 -13.82022228
35 -10.48076978 -11.88555115
36 -5.24703759 -10.48076978
37 1.48029054 -5.24703759
38 12.39463713 1.48029054
39 18.28114277 12.39463713
> 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/fisher/rcomp/tmp/7ih0b1355511826.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/fisher/rcomp/tmp/85ws21355511826.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/fisher/rcomp/tmp/92wuo1355511826.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')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/fisher/rcomp/tmp/102p571355511826.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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/fisher/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/fisher/rcomp/tmp/110uyb1355511826.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/fisher/rcomp/tmp/12vkva1355511826.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/fisher/rcomp/tmp/13qtm11355511826.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/fisher/rcomp/tmp/148rs91355511826.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/fisher/rcomp/tmp/15ocv91355511826.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/fisher/rcomp/tmp/164ev71355511826.tab")
+ }
>
> try(system("convert tmp/1bu4p1355511826.ps tmp/1bu4p1355511826.png",intern=TRUE))
character(0)
> try(system("convert tmp/25r2q1355511826.ps tmp/25r2q1355511826.png",intern=TRUE))
character(0)
> try(system("convert tmp/3da5f1355511826.ps tmp/3da5f1355511826.png",intern=TRUE))
character(0)
> try(system("convert tmp/4uge31355511826.ps tmp/4uge31355511826.png",intern=TRUE))
character(0)
> try(system("convert tmp/5x3fm1355511826.ps tmp/5x3fm1355511826.png",intern=TRUE))
character(0)
> try(system("convert tmp/6lv961355511826.ps tmp/6lv961355511826.png",intern=TRUE))
character(0)
> try(system("convert tmp/7ih0b1355511826.ps tmp/7ih0b1355511826.png",intern=TRUE))
character(0)
> try(system("convert tmp/85ws21355511826.ps tmp/85ws21355511826.png",intern=TRUE))
character(0)
> try(system("convert tmp/92wuo1355511826.ps tmp/92wuo1355511826.png",intern=TRUE))
character(0)
> try(system("convert tmp/102p571355511826.ps tmp/102p571355511826.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
5.754 1.559 7.339