R version 2.8.0 (2008-10-20)
Copyright (C) 2008 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.
Natural language support but running in an English locale
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(627,0,696,0,825,0,677,0,656,0,785,0,412,0,352,0,839,0,729,0,696,0,641,0,695,0,638,0,762,0,635,0,721,0,854,0,418,0,367,0,824,0,687,0,601,0,676,0,740,0,691,0,683,0,594,0,729,0,731,0,386,0,331,0,707,0,715,0,657,0,653,0,642,0,643,0,718,0,654,0,632,0,731,0,392,1,344,1,792,1,852,1,649,1,629,1,685,1,617,1,715,1,715,1,629,1,916,1,531,1,357,1,917,1,828,1,708,1,858,1,775,1,785,1,1006,1,789,1,734,1,906,1,532,1,387,1,991,1,841,1),dim=c(2,70),dimnames=list(c('Y','X'),1:70))
> y <- array(NA,dim=c(2,70),dimnames=list(c('Y','X'),1:70))
> 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 627 0
2 696 0
3 825 0
4 677 0
5 656 0
6 785 0
7 412 0
8 352 0
9 839 0
10 729 0
11 696 0
12 641 0
13 695 0
14 638 0
15 762 0
16 635 0
17 721 0
18 854 0
19 418 0
20 367 0
21 824 0
22 687 0
23 601 0
24 676 0
25 740 0
26 691 0
27 683 0
28 594 0
29 729 0
30 731 0
31 386 0
32 331 0
33 707 0
34 715 0
35 657 0
36 653 0
37 642 0
38 643 0
39 718 0
40 654 0
41 632 0
42 731 0
43 392 1
44 344 1
45 792 1
46 852 1
47 649 1
48 629 1
49 685 1
50 617 1
51 715 1
52 715 1
53 629 1
54 916 1
55 531 1
56 357 1
57 917 1
58 828 1
59 708 1
60 858 1
61 775 1
62 785 1
63 1006 1
64 789 1
65 734 1
66 906 1
67 532 1
68 387 1
69 991 1
70 841 1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X
653.57 56.43
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-366.00 -46.07 23.71 78.61 296.00
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 653.57 23.89 27.360 <2e-16 ***
X 56.43 37.77 1.494 0.140
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 154.8 on 68 degrees of freedom
Multiple R-squared: 0.03178, Adjusted R-squared: 0.01754
F-statistic: 2.232 on 1 and 68 DF, p-value: 0.1398
> 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.180055514 0.36011103 0.8199445
[2,] 0.119383772 0.23876754 0.8806162
[3,] 0.483171775 0.96634355 0.5168282
[4,] 0.753579752 0.49284050 0.2464202
[5,] 0.781011149 0.43797770 0.2189889
[6,] 0.709655017 0.58068997 0.2903450
[7,] 0.618433341 0.76313332 0.3815667
[8,] 0.520138027 0.95972395 0.4798620
[9,] 0.426759888 0.85351978 0.5732401
[10,] 0.337433617 0.67486723 0.6625664
[11,] 0.289909058 0.57981812 0.7100909
[12,] 0.219856116 0.43971223 0.7801439
[13,] 0.167781576 0.33556315 0.8322184
[14,] 0.200540819 0.40108164 0.7994592
[15,] 0.313554814 0.62710963 0.6864452
[16,] 0.501524023 0.99695195 0.4984760
[17,] 0.512600896 0.97479821 0.4873991
[18,] 0.438311360 0.87662272 0.5616886
[19,] 0.372965154 0.74593031 0.6270348
[20,] 0.304673301 0.60934660 0.6953267
[21,] 0.259911928 0.51982386 0.7400881
[22,] 0.206039796 0.41207959 0.7939602
[23,] 0.158912698 0.31782540 0.8410873
[24,] 0.124437243 0.24887449 0.8755628
[25,] 0.098360597 0.19672119 0.9016394
[26,] 0.077352750 0.15470550 0.9226472
[27,] 0.144966687 0.28993337 0.8550333
[28,] 0.318479018 0.63695804 0.6815210
[29,] 0.263926414 0.52785283 0.7360736
[30,] 0.216464545 0.43292909 0.7835355
[31,] 0.168393778 0.33678756 0.8316062
[32,] 0.127890412 0.25578082 0.8721096
[33,] 0.095119487 0.19023897 0.9048805
[34,] 0.069135517 0.13827103 0.9308645
[35,] 0.050951424 0.10190285 0.9490486
[36,] 0.035065628 0.07013126 0.9649344
[37,] 0.024313707 0.04862741 0.9756863
[38,] 0.016835148 0.03367030 0.9831649
[39,] 0.024621574 0.04924315 0.9753784
[40,] 0.056239968 0.11247994 0.9437600
[41,] 0.096312059 0.19262412 0.9036879
[42,] 0.127758537 0.25551707 0.8722415
[43,] 0.099158312 0.19831662 0.9008417
[44,] 0.077262437 0.15452487 0.9227376
[45,] 0.056547381 0.11309476 0.9434526
[46,] 0.043978155 0.08795631 0.9560218
[47,] 0.030764869 0.06152974 0.9692351
[48,] 0.020677182 0.04135436 0.9793228
[49,] 0.015002208 0.03000442 0.9849978
[50,] 0.019999989 0.03999998 0.9800000
[51,] 0.023379557 0.04675911 0.9766204
[52,] 0.149885587 0.29977117 0.8501144
[53,] 0.161663548 0.32332710 0.8383365
[54,] 0.125886339 0.25177268 0.8741137
[55,] 0.088655228 0.17731046 0.9113448
[56,] 0.067912759 0.13582552 0.9320872
[57,] 0.041483364 0.08296673 0.9585166
[58,] 0.023538115 0.04707623 0.9764619
[59,] 0.043532703 0.08706541 0.9564673
[60,] 0.022856283 0.04571257 0.9771437
[61,] 0.009569852 0.01913970 0.9904301
> postscript(file="/var/www/html/freestat/rcomp/tmp/1g9ql1292956692.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/2g9ql1292956692.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/39ipo1292956692.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/49ipo1292956692.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/59ipo1292956692.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 = 70
Frequency = 1
1 2 3 4 5 6
-26.5714286 42.4285714 171.4285714 23.4285714 2.4285714 131.4285714
7 8 9 10 11 12
-241.5714286 -301.5714286 185.4285714 75.4285714 42.4285714 -12.5714286
13 14 15 16 17 18
41.4285714 -15.5714286 108.4285714 -18.5714286 67.4285714 200.4285714
19 20 21 22 23 24
-235.5714286 -286.5714286 170.4285714 33.4285714 -52.5714286 22.4285714
25 26 27 28 29 30
86.4285714 37.4285714 29.4285714 -59.5714286 75.4285714 77.4285714
31 32 33 34 35 36
-267.5714286 -322.5714286 53.4285714 61.4285714 3.4285714 -0.5714286
37 38 39 40 41 42
-11.5714286 -10.5714286 64.4285714 0.4285714 -21.5714286 77.4285714
43 44 45 46 47 48
-318.0000000 -366.0000000 82.0000000 142.0000000 -61.0000000 -81.0000000
49 50 51 52 53 54
-25.0000000 -93.0000000 5.0000000 5.0000000 -81.0000000 206.0000000
55 56 57 58 59 60
-179.0000000 -353.0000000 207.0000000 118.0000000 -2.0000000 148.0000000
61 62 63 64 65 66
65.0000000 75.0000000 296.0000000 79.0000000 24.0000000 196.0000000
67 68 69 70
-178.0000000 -323.0000000 281.0000000 131.0000000
> postscript(file="/var/www/html/freestat/rcomp/tmp/629or1292956692.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 = 70
Frequency = 1
lag(myerror, k = 1) myerror
0 -26.5714286 NA
1 42.4285714 -26.5714286
2 171.4285714 42.4285714
3 23.4285714 171.4285714
4 2.4285714 23.4285714
5 131.4285714 2.4285714
6 -241.5714286 131.4285714
7 -301.5714286 -241.5714286
8 185.4285714 -301.5714286
9 75.4285714 185.4285714
10 42.4285714 75.4285714
11 -12.5714286 42.4285714
12 41.4285714 -12.5714286
13 -15.5714286 41.4285714
14 108.4285714 -15.5714286
15 -18.5714286 108.4285714
16 67.4285714 -18.5714286
17 200.4285714 67.4285714
18 -235.5714286 200.4285714
19 -286.5714286 -235.5714286
20 170.4285714 -286.5714286
21 33.4285714 170.4285714
22 -52.5714286 33.4285714
23 22.4285714 -52.5714286
24 86.4285714 22.4285714
25 37.4285714 86.4285714
26 29.4285714 37.4285714
27 -59.5714286 29.4285714
28 75.4285714 -59.5714286
29 77.4285714 75.4285714
30 -267.5714286 77.4285714
31 -322.5714286 -267.5714286
32 53.4285714 -322.5714286
33 61.4285714 53.4285714
34 3.4285714 61.4285714
35 -0.5714286 3.4285714
36 -11.5714286 -0.5714286
37 -10.5714286 -11.5714286
38 64.4285714 -10.5714286
39 0.4285714 64.4285714
40 -21.5714286 0.4285714
41 77.4285714 -21.5714286
42 -318.0000000 77.4285714
43 -366.0000000 -318.0000000
44 82.0000000 -366.0000000
45 142.0000000 82.0000000
46 -61.0000000 142.0000000
47 -81.0000000 -61.0000000
48 -25.0000000 -81.0000000
49 -93.0000000 -25.0000000
50 5.0000000 -93.0000000
51 5.0000000 5.0000000
52 -81.0000000 5.0000000
53 206.0000000 -81.0000000
54 -179.0000000 206.0000000
55 -353.0000000 -179.0000000
56 207.0000000 -353.0000000
57 118.0000000 207.0000000
58 -2.0000000 118.0000000
59 148.0000000 -2.0000000
60 65.0000000 148.0000000
61 75.0000000 65.0000000
62 296.0000000 75.0000000
63 79.0000000 296.0000000
64 24.0000000 79.0000000
65 196.0000000 24.0000000
66 -178.0000000 196.0000000
67 -323.0000000 -178.0000000
68 281.0000000 -323.0000000
69 131.0000000 281.0000000
70 NA 131.0000000
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 42.4285714 -26.5714286
[2,] 171.4285714 42.4285714
[3,] 23.4285714 171.4285714
[4,] 2.4285714 23.4285714
[5,] 131.4285714 2.4285714
[6,] -241.5714286 131.4285714
[7,] -301.5714286 -241.5714286
[8,] 185.4285714 -301.5714286
[9,] 75.4285714 185.4285714
[10,] 42.4285714 75.4285714
[11,] -12.5714286 42.4285714
[12,] 41.4285714 -12.5714286
[13,] -15.5714286 41.4285714
[14,] 108.4285714 -15.5714286
[15,] -18.5714286 108.4285714
[16,] 67.4285714 -18.5714286
[17,] 200.4285714 67.4285714
[18,] -235.5714286 200.4285714
[19,] -286.5714286 -235.5714286
[20,] 170.4285714 -286.5714286
[21,] 33.4285714 170.4285714
[22,] -52.5714286 33.4285714
[23,] 22.4285714 -52.5714286
[24,] 86.4285714 22.4285714
[25,] 37.4285714 86.4285714
[26,] 29.4285714 37.4285714
[27,] -59.5714286 29.4285714
[28,] 75.4285714 -59.5714286
[29,] 77.4285714 75.4285714
[30,] -267.5714286 77.4285714
[31,] -322.5714286 -267.5714286
[32,] 53.4285714 -322.5714286
[33,] 61.4285714 53.4285714
[34,] 3.4285714 61.4285714
[35,] -0.5714286 3.4285714
[36,] -11.5714286 -0.5714286
[37,] -10.5714286 -11.5714286
[38,] 64.4285714 -10.5714286
[39,] 0.4285714 64.4285714
[40,] -21.5714286 0.4285714
[41,] 77.4285714 -21.5714286
[42,] -318.0000000 77.4285714
[43,] -366.0000000 -318.0000000
[44,] 82.0000000 -366.0000000
[45,] 142.0000000 82.0000000
[46,] -61.0000000 142.0000000
[47,] -81.0000000 -61.0000000
[48,] -25.0000000 -81.0000000
[49,] -93.0000000 -25.0000000
[50,] 5.0000000 -93.0000000
[51,] 5.0000000 5.0000000
[52,] -81.0000000 5.0000000
[53,] 206.0000000 -81.0000000
[54,] -179.0000000 206.0000000
[55,] -353.0000000 -179.0000000
[56,] 207.0000000 -353.0000000
[57,] 118.0000000 207.0000000
[58,] -2.0000000 118.0000000
[59,] 148.0000000 -2.0000000
[60,] 65.0000000 148.0000000
[61,] 75.0000000 65.0000000
[62,] 296.0000000 75.0000000
[63,] 79.0000000 296.0000000
[64,] 24.0000000 79.0000000
[65,] 196.0000000 24.0000000
[66,] -178.0000000 196.0000000
[67,] -323.0000000 -178.0000000
[68,] 281.0000000 -323.0000000
[69,] 131.0000000 281.0000000
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 42.4285714 -26.5714286
2 171.4285714 42.4285714
3 23.4285714 171.4285714
4 2.4285714 23.4285714
5 131.4285714 2.4285714
6 -241.5714286 131.4285714
7 -301.5714286 -241.5714286
8 185.4285714 -301.5714286
9 75.4285714 185.4285714
10 42.4285714 75.4285714
11 -12.5714286 42.4285714
12 41.4285714 -12.5714286
13 -15.5714286 41.4285714
14 108.4285714 -15.5714286
15 -18.5714286 108.4285714
16 67.4285714 -18.5714286
17 200.4285714 67.4285714
18 -235.5714286 200.4285714
19 -286.5714286 -235.5714286
20 170.4285714 -286.5714286
21 33.4285714 170.4285714
22 -52.5714286 33.4285714
23 22.4285714 -52.5714286
24 86.4285714 22.4285714
25 37.4285714 86.4285714
26 29.4285714 37.4285714
27 -59.5714286 29.4285714
28 75.4285714 -59.5714286
29 77.4285714 75.4285714
30 -267.5714286 77.4285714
31 -322.5714286 -267.5714286
32 53.4285714 -322.5714286
33 61.4285714 53.4285714
34 3.4285714 61.4285714
35 -0.5714286 3.4285714
36 -11.5714286 -0.5714286
37 -10.5714286 -11.5714286
38 64.4285714 -10.5714286
39 0.4285714 64.4285714
40 -21.5714286 0.4285714
41 77.4285714 -21.5714286
42 -318.0000000 77.4285714
43 -366.0000000 -318.0000000
44 82.0000000 -366.0000000
45 142.0000000 82.0000000
46 -61.0000000 142.0000000
47 -81.0000000 -61.0000000
48 -25.0000000 -81.0000000
49 -93.0000000 -25.0000000
50 5.0000000 -93.0000000
51 5.0000000 5.0000000
52 -81.0000000 5.0000000
53 206.0000000 -81.0000000
54 -179.0000000 206.0000000
55 -353.0000000 -179.0000000
56 207.0000000 -353.0000000
57 118.0000000 207.0000000
58 -2.0000000 118.0000000
59 148.0000000 -2.0000000
60 65.0000000 148.0000000
61 75.0000000 65.0000000
62 296.0000000 75.0000000
63 79.0000000 296.0000000
64 24.0000000 79.0000000
65 196.0000000 24.0000000
66 -178.0000000 196.0000000
67 -323.0000000 -178.0000000
68 281.0000000 -323.0000000
69 131.0000000 281.0000000
> 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/freestat/rcomp/tmp/7u05u1292956692.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/8u05u1292956692.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/9u05u1292956692.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/www/html/freestat/rcomp/tmp/105a5f1292956692.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/11qsl31292956692.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/freestat/rcomp/tmp/12ct281292956692.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/freestat/rcomp/tmp/1383zh1292956692.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/freestat/rcomp/tmp/14tlg51292956692.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/freestat/rcomp/tmp/15fmet1292956692.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/freestat/rcomp/tmp/16i4vh1292956692.tab")
+ }
>
> try(system("convert tmp/1g9ql1292956692.ps tmp/1g9ql1292956692.png",intern=TRUE))
character(0)
> try(system("convert tmp/2g9ql1292956692.ps tmp/2g9ql1292956692.png",intern=TRUE))
character(0)
> try(system("convert tmp/39ipo1292956692.ps tmp/39ipo1292956692.png",intern=TRUE))
character(0)
> try(system("convert tmp/49ipo1292956692.ps tmp/49ipo1292956692.png",intern=TRUE))
character(0)
> try(system("convert tmp/59ipo1292956692.ps tmp/59ipo1292956692.png",intern=TRUE))
character(0)
> try(system("convert tmp/629or1292956692.ps tmp/629or1292956692.png",intern=TRUE))
character(0)
> try(system("convert tmp/7u05u1292956692.ps tmp/7u05u1292956692.png",intern=TRUE))
character(0)
> try(system("convert tmp/8u05u1292956692.ps tmp/8u05u1292956692.png",intern=TRUE))
character(0)
> try(system("convert tmp/9u05u1292956692.ps tmp/9u05u1292956692.png",intern=TRUE))
character(0)
> try(system("convert tmp/105a5f1292956692.ps tmp/105a5f1292956692.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.004 2.547 4.346