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(108.5,98.71,112.3,98.54,116.6,98.2,115.5,96.92,120.1,99.06,132.9,99.65,128.1,99.82,129.3,99.99,132.5,100.33,131,99.31,124.9,101.1,120.8,101.1,122,100.93,122.1,100.85,127.4,100.93,135.2,99.6,137.3,101.88,135,101.81,136,102.38,138.4,102.74,134.7,102.82,138.4,101.72,133.9,103.47,133.6,102.98,141.2,102.68,151.8,102.9,155.4,103.03,156.6,101.29,161.6,103.69,160.7,103.68,156,104.2,159.5,104.08,168.7,104.16,169.9,103.05,169.9,104.66,185.9,104.46,190.8,104.95,195.8,105.85,211.9,106.23,227.1,104.86,251.3,107.44,256.7,108.23,251.9,108.45,251.2,109.39,270.3,110.15,267.2,109.13,243,110.28,229.9,110.17,187.2,109.99,178.2,109.26,175.2,109.11,192.4,107.06,187,109.53,184,108.92,194.1,109.24,212.7,109.12,217.5,109,200.5,107.23,205.9,109.49,196.5,109.04,206.3,109.02),dim=c(2,61),dimnames=list(c('Y','X'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('Y','X'),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 X
1 108.5 98.71
2 112.3 98.54
3 116.6 98.20
4 115.5 96.92
5 120.1 99.06
6 132.9 99.65
7 128.1 99.82
8 129.3 99.99
9 132.5 100.33
10 131.0 99.31
11 124.9 101.10
12 120.8 101.10
13 122.0 100.93
14 122.1 100.85
15 127.4 100.93
16 135.2 99.60
17 137.3 101.88
18 135.0 101.81
19 136.0 102.38
20 138.4 102.74
21 134.7 102.82
22 138.4 101.72
23 133.9 103.47
24 133.6 102.98
25 141.2 102.68
26 151.8 102.90
27 155.4 103.03
28 156.6 101.29
29 161.6 103.69
30 160.7 103.68
31 156.0 104.20
32 159.5 104.08
33 168.7 104.16
34 169.9 103.05
35 169.9 104.66
36 185.9 104.46
37 190.8 104.95
38 195.8 105.85
39 211.9 106.23
40 227.1 104.86
41 251.3 107.44
42 256.7 108.23
43 251.9 108.45
44 251.2 109.39
45 270.3 110.15
46 267.2 109.13
47 243.0 110.28
48 229.9 110.17
49 187.2 109.99
50 178.2 109.26
51 175.2 109.11
52 192.4 107.06
53 187.0 109.53
54 184.0 108.92
55 194.1 109.24
56 212.7 109.12
57 217.5 109.00
58 200.5 107.23
59 205.9 109.49
60 196.5 109.04
61 206.3 109.02
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X
-873.7 10.0
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-42.291 -12.787 -2.488 11.514 52.111
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -873.663 77.617 -11.26 2.54e-16 ***
X 10.001 0.743 13.46 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 22.26 on 59 degrees of freedom
Multiple R-squared: 0.7543, Adjusted R-squared: 0.7502
F-statistic: 181.2 on 1 and 59 DF, p-value: < 2.2e-16
> 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.436473e-02 2.872946e-02 0.98563527
[2,] 2.522112e-02 5.044225e-02 0.97477888
[3,] 8.008440e-03 1.601688e-02 0.99199156
[4,] 2.290057e-03 4.580113e-03 0.99770994
[5,] 6.261412e-04 1.252282e-03 0.99937386
[6,] 2.787725e-04 5.575450e-04 0.99972123
[7,] 1.788586e-04 3.577173e-04 0.99982114
[8,] 1.241321e-04 2.482642e-04 0.99987587
[9,] 4.780185e-05 9.560370e-05 0.99995220
[10,] 1.595316e-05 3.190631e-05 0.99998405
[11,] 4.159159e-06 8.318318e-06 0.99999584
[12,] 4.717776e-06 9.435552e-06 0.99999528
[13,] 1.782670e-06 3.565339e-06 0.99999822
[14,] 5.150821e-07 1.030164e-06 0.99999948
[15,] 1.392162e-07 2.784324e-07 0.99999986
[16,] 3.809020e-08 7.618041e-08 0.99999996
[17,] 1.089025e-08 2.178051e-08 0.99999999
[18,] 3.842084e-09 7.684168e-09 1.00000000
[19,] 1.735082e-09 3.470165e-09 1.00000000
[20,] 6.119155e-10 1.223831e-09 1.00000000
[21,] 2.389115e-10 4.778231e-10 1.00000000
[22,] 5.601309e-10 1.120262e-09 1.00000000
[23,] 1.449310e-09 2.898620e-09 1.00000000
[24,] 2.116920e-08 4.233840e-08 0.99999998
[25,] 2.732027e-08 5.464054e-08 0.99999997
[26,] 2.297342e-08 4.594685e-08 0.99999998
[27,] 1.107075e-08 2.214150e-08 0.99999999
[28,] 6.535277e-09 1.307055e-08 0.99999999
[29,] 8.054630e-09 1.610926e-08 0.99999999
[30,] 2.650859e-08 5.301718e-08 0.99999997
[31,] 2.156937e-08 4.313874e-08 0.99999998
[32,] 9.502036e-08 1.900407e-07 0.99999990
[33,] 2.513505e-07 5.027010e-07 0.99999975
[34,] 3.208499e-07 6.416999e-07 0.99999968
[35,] 8.943507e-07 1.788701e-06 0.99999911
[36,] 4.203798e-05 8.407596e-05 0.99995796
[37,] 4.441522e-04 8.883044e-04 0.99955585
[38,] 2.233575e-03 4.467150e-03 0.99776642
[39,] 6.006666e-03 1.201333e-02 0.99399333
[40,] 8.508830e-03 1.701766e-02 0.99149117
[41,] 3.514536e-02 7.029072e-02 0.96485464
[42,] 3.530500e-01 7.061000e-01 0.64695002
[43,] 6.064095e-01 7.871810e-01 0.39359052
[44,] 8.326604e-01 3.346791e-01 0.16733956
[45,] 8.775765e-01 2.448470e-01 0.12242349
[46,] 9.270947e-01 1.458106e-01 0.07290529
[47,] 9.737569e-01 5.248610e-02 0.02624305
[48,] 9.523952e-01 9.520950e-02 0.04760475
[49,] 9.533085e-01 9.338300e-02 0.04669150
[50,] 9.767466e-01 4.650688e-02 0.02325344
[51,] 9.742341e-01 5.153178e-02 0.02576589
[52,] 9.330699e-01 1.338601e-01 0.06693005
> postscript(file="/var/www/html/rcomp/tmp/10y7s1258720366.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/2npz11258720366.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/32xrw1258720366.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/47ebl1258720366.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/5vs5w1258720366.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
-4.9857040 0.5143804 8.2145492 19.9151847 3.1141222 10.0138293
7 8 9 10 11 12
3.5137449 3.0136605 2.8134917 11.5139981 -12.4868906 -16.5868906
13 14 15 16 17 18
-13.6868062 -12.7867665 -8.2868062 12.8138541 -7.8872778 -9.4872431
19 20 21 22 23 24
-14.1875261 -15.3877048 -19.8877445 -5.1871984 -27.1880673 -22.5878240
25 26 27 28 29 30
-11.9876750 -3.5877843 -1.2878488 17.3130151 -1.6881765 -2.4881715
31 32 33 34 35 36
-12.3884297 -7.6883701 0.7115902 13.0121413 -3.0886581 14.9114412
37 38 39 40 41 42
14.9111979 10.9107511 23.2105624 52.1112426 50.5099617 48.0095695
43 44 45 46 47 48
41.0094603 30.9089936 42.4086162 49.5091226 13.8085517 1.8086063
49 50 51 52 53 54
-39.0913043 -40.7909419 -42.2908674 -4.5898496 -34.6910759 -31.5907731
55 56 57 58 59 60
-24.6909320 -4.8908724 1.1091872 1.8100660 -15.3910561 -20.2908327
61
-10.2908227
> postscript(file="/var/www/html/rcomp/tmp/6wky61258720366.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 -4.9857040 NA
1 0.5143804 -4.9857040
2 8.2145492 0.5143804
3 19.9151847 8.2145492
4 3.1141222 19.9151847
5 10.0138293 3.1141222
6 3.5137449 10.0138293
7 3.0136605 3.5137449
8 2.8134917 3.0136605
9 11.5139981 2.8134917
10 -12.4868906 11.5139981
11 -16.5868906 -12.4868906
12 -13.6868062 -16.5868906
13 -12.7867665 -13.6868062
14 -8.2868062 -12.7867665
15 12.8138541 -8.2868062
16 -7.8872778 12.8138541
17 -9.4872431 -7.8872778
18 -14.1875261 -9.4872431
19 -15.3877048 -14.1875261
20 -19.8877445 -15.3877048
21 -5.1871984 -19.8877445
22 -27.1880673 -5.1871984
23 -22.5878240 -27.1880673
24 -11.9876750 -22.5878240
25 -3.5877843 -11.9876750
26 -1.2878488 -3.5877843
27 17.3130151 -1.2878488
28 -1.6881765 17.3130151
29 -2.4881715 -1.6881765
30 -12.3884297 -2.4881715
31 -7.6883701 -12.3884297
32 0.7115902 -7.6883701
33 13.0121413 0.7115902
34 -3.0886581 13.0121413
35 14.9114412 -3.0886581
36 14.9111979 14.9114412
37 10.9107511 14.9111979
38 23.2105624 10.9107511
39 52.1112426 23.2105624
40 50.5099617 52.1112426
41 48.0095695 50.5099617
42 41.0094603 48.0095695
43 30.9089936 41.0094603
44 42.4086162 30.9089936
45 49.5091226 42.4086162
46 13.8085517 49.5091226
47 1.8086063 13.8085517
48 -39.0913043 1.8086063
49 -40.7909419 -39.0913043
50 -42.2908674 -40.7909419
51 -4.5898496 -42.2908674
52 -34.6910759 -4.5898496
53 -31.5907731 -34.6910759
54 -24.6909320 -31.5907731
55 -4.8908724 -24.6909320
56 1.1091872 -4.8908724
57 1.8100660 1.1091872
58 -15.3910561 1.8100660
59 -20.2908327 -15.3910561
60 -10.2908227 -20.2908327
61 NA -10.2908227
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.5143804 -4.9857040
[2,] 8.2145492 0.5143804
[3,] 19.9151847 8.2145492
[4,] 3.1141222 19.9151847
[5,] 10.0138293 3.1141222
[6,] 3.5137449 10.0138293
[7,] 3.0136605 3.5137449
[8,] 2.8134917 3.0136605
[9,] 11.5139981 2.8134917
[10,] -12.4868906 11.5139981
[11,] -16.5868906 -12.4868906
[12,] -13.6868062 -16.5868906
[13,] -12.7867665 -13.6868062
[14,] -8.2868062 -12.7867665
[15,] 12.8138541 -8.2868062
[16,] -7.8872778 12.8138541
[17,] -9.4872431 -7.8872778
[18,] -14.1875261 -9.4872431
[19,] -15.3877048 -14.1875261
[20,] -19.8877445 -15.3877048
[21,] -5.1871984 -19.8877445
[22,] -27.1880673 -5.1871984
[23,] -22.5878240 -27.1880673
[24,] -11.9876750 -22.5878240
[25,] -3.5877843 -11.9876750
[26,] -1.2878488 -3.5877843
[27,] 17.3130151 -1.2878488
[28,] -1.6881765 17.3130151
[29,] -2.4881715 -1.6881765
[30,] -12.3884297 -2.4881715
[31,] -7.6883701 -12.3884297
[32,] 0.7115902 -7.6883701
[33,] 13.0121413 0.7115902
[34,] -3.0886581 13.0121413
[35,] 14.9114412 -3.0886581
[36,] 14.9111979 14.9114412
[37,] 10.9107511 14.9111979
[38,] 23.2105624 10.9107511
[39,] 52.1112426 23.2105624
[40,] 50.5099617 52.1112426
[41,] 48.0095695 50.5099617
[42,] 41.0094603 48.0095695
[43,] 30.9089936 41.0094603
[44,] 42.4086162 30.9089936
[45,] 49.5091226 42.4086162
[46,] 13.8085517 49.5091226
[47,] 1.8086063 13.8085517
[48,] -39.0913043 1.8086063
[49,] -40.7909419 -39.0913043
[50,] -42.2908674 -40.7909419
[51,] -4.5898496 -42.2908674
[52,] -34.6910759 -4.5898496
[53,] -31.5907731 -34.6910759
[54,] -24.6909320 -31.5907731
[55,] -4.8908724 -24.6909320
[56,] 1.1091872 -4.8908724
[57,] 1.8100660 1.1091872
[58,] -15.3910561 1.8100660
[59,] -20.2908327 -15.3910561
[60,] -10.2908227 -20.2908327
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.5143804 -4.9857040
2 8.2145492 0.5143804
3 19.9151847 8.2145492
4 3.1141222 19.9151847
5 10.0138293 3.1141222
6 3.5137449 10.0138293
7 3.0136605 3.5137449
8 2.8134917 3.0136605
9 11.5139981 2.8134917
10 -12.4868906 11.5139981
11 -16.5868906 -12.4868906
12 -13.6868062 -16.5868906
13 -12.7867665 -13.6868062
14 -8.2868062 -12.7867665
15 12.8138541 -8.2868062
16 -7.8872778 12.8138541
17 -9.4872431 -7.8872778
18 -14.1875261 -9.4872431
19 -15.3877048 -14.1875261
20 -19.8877445 -15.3877048
21 -5.1871984 -19.8877445
22 -27.1880673 -5.1871984
23 -22.5878240 -27.1880673
24 -11.9876750 -22.5878240
25 -3.5877843 -11.9876750
26 -1.2878488 -3.5877843
27 17.3130151 -1.2878488
28 -1.6881765 17.3130151
29 -2.4881715 -1.6881765
30 -12.3884297 -2.4881715
31 -7.6883701 -12.3884297
32 0.7115902 -7.6883701
33 13.0121413 0.7115902
34 -3.0886581 13.0121413
35 14.9114412 -3.0886581
36 14.9111979 14.9114412
37 10.9107511 14.9111979
38 23.2105624 10.9107511
39 52.1112426 23.2105624
40 50.5099617 52.1112426
41 48.0095695 50.5099617
42 41.0094603 48.0095695
43 30.9089936 41.0094603
44 42.4086162 30.9089936
45 49.5091226 42.4086162
46 13.8085517 49.5091226
47 1.8086063 13.8085517
48 -39.0913043 1.8086063
49 -40.7909419 -39.0913043
50 -42.2908674 -40.7909419
51 -4.5898496 -42.2908674
52 -34.6910759 -4.5898496
53 -31.5907731 -34.6910759
54 -24.6909320 -31.5907731
55 -4.8908724 -24.6909320
56 1.1091872 -4.8908724
57 1.8100660 1.1091872
58 -15.3910561 1.8100660
59 -20.2908327 -15.3910561
60 -10.2908227 -20.2908327
> 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/7ggpn1258720366.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/80cgl1258720366.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/9navi1258720366.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/10x3u31258720366.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/116zmc1258720366.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/125d8s1258720366.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/13t5ig1258720366.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/148vqg1258720366.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/15d3791258720366.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/16edzj1258720366.tab")
+ }
>
> system("convert tmp/10y7s1258720366.ps tmp/10y7s1258720366.png")
> system("convert tmp/2npz11258720366.ps tmp/2npz11258720366.png")
> system("convert tmp/32xrw1258720366.ps tmp/32xrw1258720366.png")
> system("convert tmp/47ebl1258720366.ps tmp/47ebl1258720366.png")
> system("convert tmp/5vs5w1258720366.ps tmp/5vs5w1258720366.png")
> system("convert tmp/6wky61258720366.ps tmp/6wky61258720366.png")
> system("convert tmp/7ggpn1258720366.ps tmp/7ggpn1258720366.png")
> system("convert tmp/80cgl1258720366.ps tmp/80cgl1258720366.png")
> system("convert tmp/9navi1258720366.ps tmp/9navi1258720366.png")
> system("convert tmp/10x3u31258720366.ps tmp/10x3u31258720366.png")
>
>
> proc.time()
user system elapsed
2.374 1.580 2.886