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(117.1,95.1,118.7,97,126.5,112.7,127.5,102.9,134.6,97.4,131.8,111.4,135.9,87.4,142.7,96.8,141.7,114.1,153.4,110.3,145,103.9,137.7,101.6,148.3,94.6,152.2,95.9,169.4,104.7,168.6,102.8,161.1,98.1,174.1,113.9,179,80.9,190.6,95.7,190,113.2,181.6,105.9,174.8,108.8,180.5,102.3,196.8,99,193.8,100.7,197,115.5,216.3,100.7,221.4,109.9,217.9,114.6,229.7,85.4,227.4,100.5,204.2,114.8,196.6,116.5,198.8,112.9,207.5,102,190.7,106,201.6,105.3,210.5,118.8,223.5,106.1,223.8,109.3,231.2,117.2,244,92.5,234.7,104.2,250.2,112.5,265.7,122.4,287.6,113.3,283.3,100,295.4,110.7,312.3,112.8,333.8,109.8,347.7,117.3,383.2,109.1,407.1,115.9,413.6,96,362.7,99.8,321.9,116.8,239.4,115.7,191,99.4,159.7,94.3,163.4,91),dim=c(2,61),dimnames=list(c('x','y'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('x','y'),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
x y
1 117.1 95.1
2 118.7 97.0
3 126.5 112.7
4 127.5 102.9
5 134.6 97.4
6 131.8 111.4
7 135.9 87.4
8 142.7 96.8
9 141.7 114.1
10 153.4 110.3
11 145.0 103.9
12 137.7 101.6
13 148.3 94.6
14 152.2 95.9
15 169.4 104.7
16 168.6 102.8
17 161.1 98.1
18 174.1 113.9
19 179.0 80.9
20 190.6 95.7
21 190.0 113.2
22 181.6 105.9
23 174.8 108.8
24 180.5 102.3
25 196.8 99.0
26 193.8 100.7
27 197.0 115.5
28 216.3 100.7
29 221.4 109.9
30 217.9 114.6
31 229.7 85.4
32 227.4 100.5
33 204.2 114.8
34 196.6 116.5
35 198.8 112.9
36 207.5 102.0
37 190.7 106.0
38 201.6 105.3
39 210.5 118.8
40 223.5 106.1
41 223.8 109.3
42 231.2 117.2
43 244.0 92.5
44 234.7 104.2
45 250.2 112.5
46 265.7 122.4
47 287.6 113.3
48 283.3 100.0
49 295.4 110.7
50 312.3 112.8
51 333.8 109.8
52 347.7 117.3
53 383.2 109.1
54 407.1 115.9
55 413.6 96.0
56 362.7 99.8
57 321.9 116.8
58 239.4 115.7
59 191.0 99.4
60 159.7 94.3
61 163.4 91.0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) y
-40.010 2.402
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-104.15 -41.85 -15.13 24.46 223.06
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -40.0103 103.8868 -0.385 0.7015
y 2.4016 0.9841 2.440 0.0177 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 69.47 on 59 degrees of freedom
Multiple R-squared: 0.09169, Adjusted R-squared: 0.0763
F-statistic: 5.956 on 1 and 59 DF, p-value: 0.01769
> 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,] 2.128007e-03 4.256015e-03 0.9978720
[2,] 2.349349e-04 4.698698e-04 0.9997651
[3,] 7.536228e-05 1.507246e-04 0.9999246
[4,] 3.307185e-05 6.614369e-05 0.9999669
[5,] 1.004205e-05 2.008411e-05 0.9999900
[6,] 8.785078e-06 1.757016e-05 0.9999912
[7,] 2.499821e-06 4.999641e-06 0.9999975
[8,] 4.884379e-07 9.768758e-07 0.9999995
[9,] 2.248717e-07 4.497434e-07 0.9999998
[10,] 1.194119e-07 2.388239e-07 0.9999999
[11,] 3.784163e-07 7.568327e-07 0.9999996
[12,] 5.100267e-07 1.020053e-06 0.9999995
[13,] 2.957831e-07 5.915662e-07 0.9999997
[14,] 3.135650e-07 6.271299e-07 0.9999997
[15,] 6.136081e-07 1.227216e-06 0.9999994
[16,] 1.441688e-06 2.883376e-06 0.9999986
[17,] 2.836993e-06 5.673986e-06 0.9999972
[18,] 2.413018e-06 4.826036e-06 0.9999976
[19,] 1.567358e-06 3.134717e-06 0.9999984
[20,] 1.168276e-06 2.336553e-06 0.9999988
[21,] 1.694717e-06 3.389435e-06 0.9999983
[22,] 1.802117e-06 3.604233e-06 0.9999982
[23,] 1.938060e-06 3.876121e-06 0.9999981
[24,] 4.728804e-06 9.457608e-06 0.9999953
[25,] 9.083643e-06 1.816729e-05 0.9999909
[26,] 1.062531e-05 2.125063e-05 0.9999894
[27,] 3.147476e-05 6.294952e-05 0.9999685
[28,] 4.358712e-05 8.717424e-05 0.9999564
[29,] 3.577680e-05 7.155361e-05 0.9999642
[30,] 3.029353e-05 6.058707e-05 0.9999697
[31,] 2.585781e-05 5.171562e-05 0.9999741
[32,] 2.064927e-05 4.129854e-05 0.9999794
[33,] 1.692092e-05 3.384185e-05 0.9999831
[34,] 1.440390e-05 2.880781e-05 0.9999856
[35,] 1.826720e-05 3.653441e-05 0.9999817
[36,] 2.011880e-05 4.023761e-05 0.9999799
[37,] 2.312503e-05 4.625006e-05 0.9999769
[38,] 3.561083e-05 7.122165e-05 0.9999644
[39,] 5.666571e-05 1.133314e-04 0.9999433
[40,] 6.098737e-05 1.219747e-04 0.9999390
[41,] 8.643100e-05 1.728620e-04 0.9999136
[42,] 1.966323e-04 3.932646e-04 0.9998034
[43,] 3.744975e-04 7.489951e-04 0.9996255
[44,] 6.273698e-04 1.254740e-03 0.9993726
[45,] 8.376355e-04 1.675271e-03 0.9991624
[46,] 1.128254e-03 2.256508e-03 0.9988717
[47,] 1.827267e-03 3.654534e-03 0.9981727
[48,] 2.128206e-03 4.256411e-03 0.9978718
[49,] 6.285560e-03 1.257112e-02 0.9937144
[50,] 1.576701e-02 3.153401e-02 0.9842330
[51,] 2.578226e-01 5.156451e-01 0.7421774
[52,] 8.909714e-01 2.180572e-01 0.1090286
> postscript(file="/var/www/html/rcomp/tmp/1p4t71258573843.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/2b1zb1258573843.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/3r14o1258573843.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/4fol81258573843.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/5c17k1258573843.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
-71.2807129 -74.2437297 -104.1486587 -79.6130979 -59.3043649 -95.7265945
7 8 9 10 11 12
-33.9884866 -49.7634122 -92.3108816 -71.4848479 -64.5146858 -66.2910338
13 14 15 16 17 18
-38.8799190 -38.1019831 -42.0359560 -38.2729392 -34.4854764 -59.4305641
19 20 21 22 23 24
24.7218343 0.7783344 -41.8494526 -32.7178614 -46.4824661 -25.1721452
25 26 27 28 29 30
-0.9469054 -8.0296047 -40.3731046 14.4703953 -2.5242127 -17.3116755
31 32 33 34 35 36
64.6146891 26.0507129 -31.4919931 -43.1746924 -32.3289762 2.5483311
37 38 39 40 41 42
-23.8580202 -11.2769087 -34.7983444 8.7018210 1.3167400 -10.2558039
43 44 45 46 47 48
61.8634155 24.4648379 20.0316589 11.7559394 55.5103886 83.1515068
49 50 51 52 53 54
69.5545170 81.4111826 110.1159460 106.0040373 161.1970575 168.7662603
55 56 57 58 59 60
223.0578581 163.0318243 81.4048312 1.5465778 -7.7075405 -26.7594426
61
-15.1342028
> postscript(file="/var/www/html/rcomp/tmp/639201258573843.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 -71.2807129 NA
1 -74.2437297 -71.2807129
2 -104.1486587 -74.2437297
3 -79.6130979 -104.1486587
4 -59.3043649 -79.6130979
5 -95.7265945 -59.3043649
6 -33.9884866 -95.7265945
7 -49.7634122 -33.9884866
8 -92.3108816 -49.7634122
9 -71.4848479 -92.3108816
10 -64.5146858 -71.4848479
11 -66.2910338 -64.5146858
12 -38.8799190 -66.2910338
13 -38.1019831 -38.8799190
14 -42.0359560 -38.1019831
15 -38.2729392 -42.0359560
16 -34.4854764 -38.2729392
17 -59.4305641 -34.4854764
18 24.7218343 -59.4305641
19 0.7783344 24.7218343
20 -41.8494526 0.7783344
21 -32.7178614 -41.8494526
22 -46.4824661 -32.7178614
23 -25.1721452 -46.4824661
24 -0.9469054 -25.1721452
25 -8.0296047 -0.9469054
26 -40.3731046 -8.0296047
27 14.4703953 -40.3731046
28 -2.5242127 14.4703953
29 -17.3116755 -2.5242127
30 64.6146891 -17.3116755
31 26.0507129 64.6146891
32 -31.4919931 26.0507129
33 -43.1746924 -31.4919931
34 -32.3289762 -43.1746924
35 2.5483311 -32.3289762
36 -23.8580202 2.5483311
37 -11.2769087 -23.8580202
38 -34.7983444 -11.2769087
39 8.7018210 -34.7983444
40 1.3167400 8.7018210
41 -10.2558039 1.3167400
42 61.8634155 -10.2558039
43 24.4648379 61.8634155
44 20.0316589 24.4648379
45 11.7559394 20.0316589
46 55.5103886 11.7559394
47 83.1515068 55.5103886
48 69.5545170 83.1515068
49 81.4111826 69.5545170
50 110.1159460 81.4111826
51 106.0040373 110.1159460
52 161.1970575 106.0040373
53 168.7662603 161.1970575
54 223.0578581 168.7662603
55 163.0318243 223.0578581
56 81.4048312 163.0318243
57 1.5465778 81.4048312
58 -7.7075405 1.5465778
59 -26.7594426 -7.7075405
60 -15.1342028 -26.7594426
61 NA -15.1342028
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -74.2437297 -71.2807129
[2,] -104.1486587 -74.2437297
[3,] -79.6130979 -104.1486587
[4,] -59.3043649 -79.6130979
[5,] -95.7265945 -59.3043649
[6,] -33.9884866 -95.7265945
[7,] -49.7634122 -33.9884866
[8,] -92.3108816 -49.7634122
[9,] -71.4848479 -92.3108816
[10,] -64.5146858 -71.4848479
[11,] -66.2910338 -64.5146858
[12,] -38.8799190 -66.2910338
[13,] -38.1019831 -38.8799190
[14,] -42.0359560 -38.1019831
[15,] -38.2729392 -42.0359560
[16,] -34.4854764 -38.2729392
[17,] -59.4305641 -34.4854764
[18,] 24.7218343 -59.4305641
[19,] 0.7783344 24.7218343
[20,] -41.8494526 0.7783344
[21,] -32.7178614 -41.8494526
[22,] -46.4824661 -32.7178614
[23,] -25.1721452 -46.4824661
[24,] -0.9469054 -25.1721452
[25,] -8.0296047 -0.9469054
[26,] -40.3731046 -8.0296047
[27,] 14.4703953 -40.3731046
[28,] -2.5242127 14.4703953
[29,] -17.3116755 -2.5242127
[30,] 64.6146891 -17.3116755
[31,] 26.0507129 64.6146891
[32,] -31.4919931 26.0507129
[33,] -43.1746924 -31.4919931
[34,] -32.3289762 -43.1746924
[35,] 2.5483311 -32.3289762
[36,] -23.8580202 2.5483311
[37,] -11.2769087 -23.8580202
[38,] -34.7983444 -11.2769087
[39,] 8.7018210 -34.7983444
[40,] 1.3167400 8.7018210
[41,] -10.2558039 1.3167400
[42,] 61.8634155 -10.2558039
[43,] 24.4648379 61.8634155
[44,] 20.0316589 24.4648379
[45,] 11.7559394 20.0316589
[46,] 55.5103886 11.7559394
[47,] 83.1515068 55.5103886
[48,] 69.5545170 83.1515068
[49,] 81.4111826 69.5545170
[50,] 110.1159460 81.4111826
[51,] 106.0040373 110.1159460
[52,] 161.1970575 106.0040373
[53,] 168.7662603 161.1970575
[54,] 223.0578581 168.7662603
[55,] 163.0318243 223.0578581
[56,] 81.4048312 163.0318243
[57,] 1.5465778 81.4048312
[58,] -7.7075405 1.5465778
[59,] -26.7594426 -7.7075405
[60,] -15.1342028 -26.7594426
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -74.2437297 -71.2807129
2 -104.1486587 -74.2437297
3 -79.6130979 -104.1486587
4 -59.3043649 -79.6130979
5 -95.7265945 -59.3043649
6 -33.9884866 -95.7265945
7 -49.7634122 -33.9884866
8 -92.3108816 -49.7634122
9 -71.4848479 -92.3108816
10 -64.5146858 -71.4848479
11 -66.2910338 -64.5146858
12 -38.8799190 -66.2910338
13 -38.1019831 -38.8799190
14 -42.0359560 -38.1019831
15 -38.2729392 -42.0359560
16 -34.4854764 -38.2729392
17 -59.4305641 -34.4854764
18 24.7218343 -59.4305641
19 0.7783344 24.7218343
20 -41.8494526 0.7783344
21 -32.7178614 -41.8494526
22 -46.4824661 -32.7178614
23 -25.1721452 -46.4824661
24 -0.9469054 -25.1721452
25 -8.0296047 -0.9469054
26 -40.3731046 -8.0296047
27 14.4703953 -40.3731046
28 -2.5242127 14.4703953
29 -17.3116755 -2.5242127
30 64.6146891 -17.3116755
31 26.0507129 64.6146891
32 -31.4919931 26.0507129
33 -43.1746924 -31.4919931
34 -32.3289762 -43.1746924
35 2.5483311 -32.3289762
36 -23.8580202 2.5483311
37 -11.2769087 -23.8580202
38 -34.7983444 -11.2769087
39 8.7018210 -34.7983444
40 1.3167400 8.7018210
41 -10.2558039 1.3167400
42 61.8634155 -10.2558039
43 24.4648379 61.8634155
44 20.0316589 24.4648379
45 11.7559394 20.0316589
46 55.5103886 11.7559394
47 83.1515068 55.5103886
48 69.5545170 83.1515068
49 81.4111826 69.5545170
50 110.1159460 81.4111826
51 106.0040373 110.1159460
52 161.1970575 106.0040373
53 168.7662603 161.1970575
54 223.0578581 168.7662603
55 163.0318243 223.0578581
56 81.4048312 163.0318243
57 1.5465778 81.4048312
58 -7.7075405 1.5465778
59 -26.7594426 -7.7075405
60 -15.1342028 -26.7594426
> 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/7ds2k1258573843.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/8p1tk1258573843.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/9wyo51258573843.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/107j9j1258573843.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/11c5j61258573843.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/12bsn11258573843.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/136dan1258573843.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/14zhut1258573843.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/15yyst1258573843.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/168vks1258573843.tab")
+ }
>
> system("convert tmp/1p4t71258573843.ps tmp/1p4t71258573843.png")
> system("convert tmp/2b1zb1258573843.ps tmp/2b1zb1258573843.png")
> system("convert tmp/3r14o1258573843.ps tmp/3r14o1258573843.png")
> system("convert tmp/4fol81258573843.ps tmp/4fol81258573843.png")
> system("convert tmp/5c17k1258573843.ps tmp/5c17k1258573843.png")
> system("convert tmp/639201258573843.ps tmp/639201258573843.png")
> system("convert tmp/7ds2k1258573843.ps tmp/7ds2k1258573843.png")
> system("convert tmp/8p1tk1258573843.ps tmp/8p1tk1258573843.png")
> system("convert tmp/9wyo51258573843.ps tmp/9wyo51258573843.png")
> system("convert tmp/107j9j1258573843.ps tmp/107j9j1258573843.png")
>
>
> proc.time()
user system elapsed
2.458 1.575 3.610