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(9487,1169,8700,2154,9627,2249,8947,2687,9283,4359,8829,5382,9947,4459,9628,6398,9318,4596,9605,3024,8640,1887,9214,2070,9567,1351,8547,2218,9185,2461,9470,3028,9123,4784,9278,4975,10170,4607,9434,6249,9655,4809,9429,3157,8739,1910,9552,2228,9687,1594,9019,2467,9672,2222,9206,3607,9069,4685,9788,4962,10312,5770,10105,5480,9863,5000,9656,3228,9295,1993,9946,2288,9701,1580,9049,2111,10190,2192,9706,3601,9765,4665,9893,4876,9994,5813,10433,5589,10073,5331,10112,3075,9266,2002,9820,2306,10097,1507,9115,1992,10411,2487,9678,3490,10408,4647,10153,5594,10368,5611,10581,5788,10597,6204,10680,3013,9738,1931,9556,2549),dim=c(2,60),dimnames=list(c('Y','X'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Y','X'),1:60))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'Linear Trend'
> par2 = 'Include Monthly 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 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 9487 1169 1 0 0 0 0 0 0 0 0 0 0 1
2 8700 2154 0 1 0 0 0 0 0 0 0 0 0 2
3 9627 2249 0 0 1 0 0 0 0 0 0 0 0 3
4 8947 2687 0 0 0 1 0 0 0 0 0 0 0 4
5 9283 4359 0 0 0 0 1 0 0 0 0 0 0 5
6 8829 5382 0 0 0 0 0 1 0 0 0 0 0 6
7 9947 4459 0 0 0 0 0 0 1 0 0 0 0 7
8 9628 6398 0 0 0 0 0 0 0 1 0 0 0 8
9 9318 4596 0 0 0 0 0 0 0 0 1 0 0 9
10 9605 3024 0 0 0 0 0 0 0 0 0 1 0 10
11 8640 1887 0 0 0 0 0 0 0 0 0 0 1 11
12 9214 2070 0 0 0 0 0 0 0 0 0 0 0 12
13 9567 1351 1 0 0 0 0 0 0 0 0 0 0 13
14 8547 2218 0 1 0 0 0 0 0 0 0 0 0 14
15 9185 2461 0 0 1 0 0 0 0 0 0 0 0 15
16 9470 3028 0 0 0 1 0 0 0 0 0 0 0 16
17 9123 4784 0 0 0 0 1 0 0 0 0 0 0 17
18 9278 4975 0 0 0 0 0 1 0 0 0 0 0 18
19 10170 4607 0 0 0 0 0 0 1 0 0 0 0 19
20 9434 6249 0 0 0 0 0 0 0 1 0 0 0 20
21 9655 4809 0 0 0 0 0 0 0 0 1 0 0 21
22 9429 3157 0 0 0 0 0 0 0 0 0 1 0 22
23 8739 1910 0 0 0 0 0 0 0 0 0 0 1 23
24 9552 2228 0 0 0 0 0 0 0 0 0 0 0 24
25 9687 1594 1 0 0 0 0 0 0 0 0 0 0 25
26 9019 2467 0 1 0 0 0 0 0 0 0 0 0 26
27 9672 2222 0 0 1 0 0 0 0 0 0 0 0 27
28 9206 3607 0 0 0 1 0 0 0 0 0 0 0 28
29 9069 4685 0 0 0 0 1 0 0 0 0 0 0 29
30 9788 4962 0 0 0 0 0 1 0 0 0 0 0 30
31 10312 5770 0 0 0 0 0 0 1 0 0 0 0 31
32 10105 5480 0 0 0 0 0 0 0 1 0 0 0 32
33 9863 5000 0 0 0 0 0 0 0 0 1 0 0 33
34 9656 3228 0 0 0 0 0 0 0 0 0 1 0 34
35 9295 1993 0 0 0 0 0 0 0 0 0 0 1 35
36 9946 2288 0 0 0 0 0 0 0 0 0 0 0 36
37 9701 1580 1 0 0 0 0 0 0 0 0 0 0 37
38 9049 2111 0 1 0 0 0 0 0 0 0 0 0 38
39 10190 2192 0 0 1 0 0 0 0 0 0 0 0 39
40 9706 3601 0 0 0 1 0 0 0 0 0 0 0 40
41 9765 4665 0 0 0 0 1 0 0 0 0 0 0 41
42 9893 4876 0 0 0 0 0 1 0 0 0 0 0 42
43 9994 5813 0 0 0 0 0 0 1 0 0 0 0 43
44 10433 5589 0 0 0 0 0 0 0 1 0 0 0 44
45 10073 5331 0 0 0 0 0 0 0 0 1 0 0 45
46 10112 3075 0 0 0 0 0 0 0 0 0 1 0 46
47 9266 2002 0 0 0 0 0 0 0 0 0 0 1 47
48 9820 2306 0 0 0 0 0 0 0 0 0 0 0 48
49 10097 1507 1 0 0 0 0 0 0 0 0 0 0 49
50 9115 1992 0 1 0 0 0 0 0 0 0 0 0 50
51 10411 2487 0 0 1 0 0 0 0 0 0 0 0 51
52 9678 3490 0 0 0 1 0 0 0 0 0 0 0 52
53 10408 4647 0 0 0 0 1 0 0 0 0 0 0 53
54 10153 5594 0 0 0 0 0 1 0 0 0 0 0 54
55 10368 5611 0 0 0 0 0 0 1 0 0 0 0 55
56 10581 5788 0 0 0 0 0 0 0 1 0 0 0 56
57 10597 6204 0 0 0 0 0 0 0 0 1 0 0 57
58 10680 3013 0 0 0 0 0 0 0 0 0 1 0 58
59 9738 1931 0 0 0 0 0 0 0 0 0 0 1 59
60 9556 2549 0 0 0 0 0 0 0 0 0 0 0 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X M1 M2 M3 M4
9387.4474 -0.2083 129.5162 -556.0328 383.2083 148.0711
M5 M6 M7 M8 M9 M10
536.9484 686.2959 1256.2863 1249.8274 946.6799 487.0852
M11 t
-533.9528 19.6361
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-478.528 -141.712 -5.699 160.293 436.218
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9387.4474 248.8290 37.727 < 2e-16 ***
X -0.2083 0.1065 -1.957 0.056456 .
M1 129.5162 169.9289 0.762 0.449844
M2 -556.0328 148.6142 -3.741 0.000506 ***
M3 383.2083 148.7405 2.576 0.013260 *
M4 148.0711 185.6792 0.797 0.429283
M5 536.9484 294.3099 1.824 0.074586 .
M6 686.2959 343.5004 1.998 0.051655 .
M7 1256.2863 351.8509 3.571 0.000848 ***
M8 1249.8274 414.8230 3.013 0.004197 **
M9 946.6799 344.2529 2.750 0.008492 **
M10 487.0852 171.7409 2.836 0.006766 **
M11 -533.9528 151.8184 -3.517 0.000994 ***
t 19.6361 1.9257 10.197 2.18e-13 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 233.2 on 46 degrees of freedom
Multiple R-squared: 0.8423, Adjusted R-squared: 0.7977
F-statistic: 18.9 on 13 and 46 DF, p-value: 3.165e-14
> 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.7211978 0.5576044 0.2788022
[2,] 0.6975736 0.6048528 0.3024264
[3,] 0.6051924 0.7896151 0.3948076
[4,] 0.6152440 0.7695119 0.3847560
[5,] 0.5600848 0.8798305 0.4399152
[6,] 0.4976619 0.9953239 0.5023381
[7,] 0.4004431 0.8008862 0.5995569
[8,] 0.3681101 0.7362202 0.6318899
[9,] 0.2782217 0.5564433 0.7217783
[10,] 0.2681226 0.5362452 0.7318774
[11,] 0.2050059 0.4100118 0.7949941
[12,] 0.1436533 0.2873066 0.8563467
[13,] 0.2850611 0.5701221 0.7149389
[14,] 0.3414064 0.6828127 0.6585936
[15,] 0.4295430 0.8590860 0.5704570
[16,] 0.3471166 0.6942332 0.6528834
[17,] 0.2831826 0.5663652 0.7168174
[18,] 0.3175024 0.6350049 0.6824976
[19,] 0.2862400 0.5724800 0.7137600
[20,] 0.5660730 0.8678540 0.4339270
[21,] 0.4964659 0.9929318 0.5035341
[22,] 0.4295705 0.8591409 0.5704295
[23,] 0.3524870 0.7049741 0.6475130
[24,] 0.3719433 0.7438866 0.6280567
[25,] 0.3537782 0.7075564 0.6462218
[26,] 0.2309583 0.4619166 0.7690417
[27,] 0.1536308 0.3072616 0.8463692
> postscript(file="/var/www/html/rcomp/tmp/12ohf1258907365.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/2zloj1258907365.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/320rn1258907365.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/4wn4w1258907365.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/5abv11258907365.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 = 60
Frequency = 1
1 2 3 4 5 6 7
193.96085 278.09800 266.01404 -107.22771 168.61922 -241.22284 94.84411
8 9 10 11 12 13 14
166.65656 -235.27765 164.15567 -36.33571 22.20337 76.24784 -97.20025
15 16 17 18 19 20 21
-367.44849 251.18684 -138.46488 -112.65367 113.04722 -294.02011 -89.53183
22 23 24 25 26 27 28
-219.76646 -168.17628 157.48997 11.24414 191.04616 -165.87661 -127.81144
29 30 31 32 33 34 35
-448.72408 159.00518 261.72501 -18.87345 -77.36970 -213.60626 169.48411
36 37 38 39 40 41 42
328.35833 -213.30536 -88.75886 110.24029 135.30585 7.47632 10.45452
43 44 45 46 47 48 49
-282.94857 96.20403 -34.03864 -25.11634 -93.27335 -29.52399 -68.14747
50 51 52 53 54 55 56
-283.18505 157.07077 -151.45354 411.09342 184.41681 -186.66777 50.03296
57 58 59 60
436.21782 294.33339 128.30123 -478.52768
> postscript(file="/var/www/html/rcomp/tmp/6de8v1258907365.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 = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 193.96085 NA
1 278.09800 193.96085
2 266.01404 278.09800
3 -107.22771 266.01404
4 168.61922 -107.22771
5 -241.22284 168.61922
6 94.84411 -241.22284
7 166.65656 94.84411
8 -235.27765 166.65656
9 164.15567 -235.27765
10 -36.33571 164.15567
11 22.20337 -36.33571
12 76.24784 22.20337
13 -97.20025 76.24784
14 -367.44849 -97.20025
15 251.18684 -367.44849
16 -138.46488 251.18684
17 -112.65367 -138.46488
18 113.04722 -112.65367
19 -294.02011 113.04722
20 -89.53183 -294.02011
21 -219.76646 -89.53183
22 -168.17628 -219.76646
23 157.48997 -168.17628
24 11.24414 157.48997
25 191.04616 11.24414
26 -165.87661 191.04616
27 -127.81144 -165.87661
28 -448.72408 -127.81144
29 159.00518 -448.72408
30 261.72501 159.00518
31 -18.87345 261.72501
32 -77.36970 -18.87345
33 -213.60626 -77.36970
34 169.48411 -213.60626
35 328.35833 169.48411
36 -213.30536 328.35833
37 -88.75886 -213.30536
38 110.24029 -88.75886
39 135.30585 110.24029
40 7.47632 135.30585
41 10.45452 7.47632
42 -282.94857 10.45452
43 96.20403 -282.94857
44 -34.03864 96.20403
45 -25.11634 -34.03864
46 -93.27335 -25.11634
47 -29.52399 -93.27335
48 -68.14747 -29.52399
49 -283.18505 -68.14747
50 157.07077 -283.18505
51 -151.45354 157.07077
52 411.09342 -151.45354
53 184.41681 411.09342
54 -186.66777 184.41681
55 50.03296 -186.66777
56 436.21782 50.03296
57 294.33339 436.21782
58 128.30123 294.33339
59 -478.52768 128.30123
60 NA -478.52768
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 278.09800 193.96085
[2,] 266.01404 278.09800
[3,] -107.22771 266.01404
[4,] 168.61922 -107.22771
[5,] -241.22284 168.61922
[6,] 94.84411 -241.22284
[7,] 166.65656 94.84411
[8,] -235.27765 166.65656
[9,] 164.15567 -235.27765
[10,] -36.33571 164.15567
[11,] 22.20337 -36.33571
[12,] 76.24784 22.20337
[13,] -97.20025 76.24784
[14,] -367.44849 -97.20025
[15,] 251.18684 -367.44849
[16,] -138.46488 251.18684
[17,] -112.65367 -138.46488
[18,] 113.04722 -112.65367
[19,] -294.02011 113.04722
[20,] -89.53183 -294.02011
[21,] -219.76646 -89.53183
[22,] -168.17628 -219.76646
[23,] 157.48997 -168.17628
[24,] 11.24414 157.48997
[25,] 191.04616 11.24414
[26,] -165.87661 191.04616
[27,] -127.81144 -165.87661
[28,] -448.72408 -127.81144
[29,] 159.00518 -448.72408
[30,] 261.72501 159.00518
[31,] -18.87345 261.72501
[32,] -77.36970 -18.87345
[33,] -213.60626 -77.36970
[34,] 169.48411 -213.60626
[35,] 328.35833 169.48411
[36,] -213.30536 328.35833
[37,] -88.75886 -213.30536
[38,] 110.24029 -88.75886
[39,] 135.30585 110.24029
[40,] 7.47632 135.30585
[41,] 10.45452 7.47632
[42,] -282.94857 10.45452
[43,] 96.20403 -282.94857
[44,] -34.03864 96.20403
[45,] -25.11634 -34.03864
[46,] -93.27335 -25.11634
[47,] -29.52399 -93.27335
[48,] -68.14747 -29.52399
[49,] -283.18505 -68.14747
[50,] 157.07077 -283.18505
[51,] -151.45354 157.07077
[52,] 411.09342 -151.45354
[53,] 184.41681 411.09342
[54,] -186.66777 184.41681
[55,] 50.03296 -186.66777
[56,] 436.21782 50.03296
[57,] 294.33339 436.21782
[58,] 128.30123 294.33339
[59,] -478.52768 128.30123
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 278.09800 193.96085
2 266.01404 278.09800
3 -107.22771 266.01404
4 168.61922 -107.22771
5 -241.22284 168.61922
6 94.84411 -241.22284
7 166.65656 94.84411
8 -235.27765 166.65656
9 164.15567 -235.27765
10 -36.33571 164.15567
11 22.20337 -36.33571
12 76.24784 22.20337
13 -97.20025 76.24784
14 -367.44849 -97.20025
15 251.18684 -367.44849
16 -138.46488 251.18684
17 -112.65367 -138.46488
18 113.04722 -112.65367
19 -294.02011 113.04722
20 -89.53183 -294.02011
21 -219.76646 -89.53183
22 -168.17628 -219.76646
23 157.48997 -168.17628
24 11.24414 157.48997
25 191.04616 11.24414
26 -165.87661 191.04616
27 -127.81144 -165.87661
28 -448.72408 -127.81144
29 159.00518 -448.72408
30 261.72501 159.00518
31 -18.87345 261.72501
32 -77.36970 -18.87345
33 -213.60626 -77.36970
34 169.48411 -213.60626
35 328.35833 169.48411
36 -213.30536 328.35833
37 -88.75886 -213.30536
38 110.24029 -88.75886
39 135.30585 110.24029
40 7.47632 135.30585
41 10.45452 7.47632
42 -282.94857 10.45452
43 96.20403 -282.94857
44 -34.03864 96.20403
45 -25.11634 -34.03864
46 -93.27335 -25.11634
47 -29.52399 -93.27335
48 -68.14747 -29.52399
49 -283.18505 -68.14747
50 157.07077 -283.18505
51 -151.45354 157.07077
52 411.09342 -151.45354
53 184.41681 411.09342
54 -186.66777 184.41681
55 50.03296 -186.66777
56 436.21782 50.03296
57 294.33339 436.21782
58 128.30123 294.33339
59 -478.52768 128.30123
> 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/7l82l1258907366.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/8ojrx1258907366.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/9q9gb1258907366.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/10e9xs1258907366.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/11zex81258907366.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/12jvkm1258907366.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/13bq351258907366.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/14e4io1258907366.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/159jkp1258907366.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/16dept1258907366.tab")
+ }
>
> system("convert tmp/12ohf1258907365.ps tmp/12ohf1258907365.png")
> system("convert tmp/2zloj1258907365.ps tmp/2zloj1258907365.png")
> system("convert tmp/320rn1258907365.ps tmp/320rn1258907365.png")
> system("convert tmp/4wn4w1258907365.ps tmp/4wn4w1258907365.png")
> system("convert tmp/5abv11258907365.ps tmp/5abv11258907365.png")
> system("convert tmp/6de8v1258907365.ps tmp/6de8v1258907365.png")
> system("convert tmp/7l82l1258907366.ps tmp/7l82l1258907366.png")
> system("convert tmp/8ojrx1258907366.ps tmp/8ojrx1258907366.png")
> system("convert tmp/9q9gb1258907366.ps tmp/9q9gb1258907366.png")
> system("convert tmp/10e9xs1258907366.ps tmp/10e9xs1258907366.png")
>
>
> proc.time()
user system elapsed
2.400 1.574 2.973