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(20366,0,22782,0,19169,0,13807,0,29743,0,25591,0,29096,0,26482,0,22405,0,27044,0,17970,0,18730,0,19684,0,19785,0,18479,0,10698,0,31956,0,29506,0,34506,0,27165,0,26736,0,23691,0,18157,0,17328,0,18205,0,20995,0,17382,0,9367,0,31124,0,26551,0,30651,0,25859,0,25100,0,25778,0,20418,0,18688,0,20424,0,24776,0,19814,0,12738,0,31566,0,30111,0,30019,0,31934,1,25826,1,26835,1,20205,1,17789,1,20520,1,22518,1,15572,1,11509,1,25447,1,24090,1,27786,1,26195,1,20516,1,22759,1,19028,1,16971,1),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 20366 0 1 0 0 0 0 0 0 0 0 0 0 1
2 22782 0 0 1 0 0 0 0 0 0 0 0 0 2
3 19169 0 0 0 1 0 0 0 0 0 0 0 0 3
4 13807 0 0 0 0 1 0 0 0 0 0 0 0 4
5 29743 0 0 0 0 0 1 0 0 0 0 0 0 5
6 25591 0 0 0 0 0 0 1 0 0 0 0 0 6
7 29096 0 0 0 0 0 0 0 1 0 0 0 0 7
8 26482 0 0 0 0 0 0 0 0 1 0 0 0 8
9 22405 0 0 0 0 0 0 0 0 0 1 0 0 9
10 27044 0 0 0 0 0 0 0 0 0 0 1 0 10
11 17970 0 0 0 0 0 0 0 0 0 0 0 1 11
12 18730 0 0 0 0 0 0 0 0 0 0 0 0 12
13 19684 0 1 0 0 0 0 0 0 0 0 0 0 13
14 19785 0 0 1 0 0 0 0 0 0 0 0 0 14
15 18479 0 0 0 1 0 0 0 0 0 0 0 0 15
16 10698 0 0 0 0 1 0 0 0 0 0 0 0 16
17 31956 0 0 0 0 0 1 0 0 0 0 0 0 17
18 29506 0 0 0 0 0 0 1 0 0 0 0 0 18
19 34506 0 0 0 0 0 0 0 1 0 0 0 0 19
20 27165 0 0 0 0 0 0 0 0 1 0 0 0 20
21 26736 0 0 0 0 0 0 0 0 0 1 0 0 21
22 23691 0 0 0 0 0 0 0 0 0 0 1 0 22
23 18157 0 0 0 0 0 0 0 0 0 0 0 1 23
24 17328 0 0 0 0 0 0 0 0 0 0 0 0 24
25 18205 0 1 0 0 0 0 0 0 0 0 0 0 25
26 20995 0 0 1 0 0 0 0 0 0 0 0 0 26
27 17382 0 0 0 1 0 0 0 0 0 0 0 0 27
28 9367 0 0 0 0 1 0 0 0 0 0 0 0 28
29 31124 0 0 0 0 0 1 0 0 0 0 0 0 29
30 26551 0 0 0 0 0 0 1 0 0 0 0 0 30
31 30651 0 0 0 0 0 0 0 1 0 0 0 0 31
32 25859 0 0 0 0 0 0 0 0 1 0 0 0 32
33 25100 0 0 0 0 0 0 0 0 0 1 0 0 33
34 25778 0 0 0 0 0 0 0 0 0 0 1 0 34
35 20418 0 0 0 0 0 0 0 0 0 0 0 1 35
36 18688 0 0 0 0 0 0 0 0 0 0 0 0 36
37 20424 0 1 0 0 0 0 0 0 0 0 0 0 37
38 24776 0 0 1 0 0 0 0 0 0 0 0 0 38
39 19814 0 0 0 1 0 0 0 0 0 0 0 0 39
40 12738 0 0 0 0 1 0 0 0 0 0 0 0 40
41 31566 0 0 0 0 0 1 0 0 0 0 0 0 41
42 30111 0 0 0 0 0 0 1 0 0 0 0 0 42
43 30019 0 0 0 0 0 0 0 1 0 0 0 0 43
44 31934 1 0 0 0 0 0 0 0 1 0 0 0 44
45 25826 1 0 0 0 0 0 0 0 0 1 0 0 45
46 26835 1 0 0 0 0 0 0 0 0 0 1 0 46
47 20205 1 0 0 0 0 0 0 0 0 0 0 1 47
48 17789 1 0 0 0 0 0 0 0 0 0 0 0 48
49 20520 1 1 0 0 0 0 0 0 0 0 0 0 49
50 22518 1 0 1 0 0 0 0 0 0 0 0 0 50
51 15572 1 0 0 1 0 0 0 0 0 0 0 0 51
52 11509 1 0 0 0 1 0 0 0 0 0 0 0 52
53 25447 1 0 0 0 0 1 0 0 0 0 0 0 53
54 24090 1 0 0 0 0 0 1 0 0 0 0 0 54
55 27786 1 0 0 0 0 0 0 1 0 0 0 0 55
56 26195 1 0 0 0 0 0 0 0 1 0 0 0 56
57 20516 1 0 0 0 0 0 0 0 0 1 0 0 57
58 22759 1 0 0 0 0 0 0 0 0 0 1 0 58
59 19028 1 0 0 0 0 0 0 0 0 0 0 1 59
60 16971 1 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
18182.668 -1149.485 1763.192 4089.638 -3.315 -6467.669
M5 M6 M7 M8 M9 M10
11870.778 9068.424 12305.271 9645.614 6230.261 7330.107
M11 t
1259.354 4.954
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-3719.5 -1411.2 161.1 1188.0 5037.2
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 18182.668 1091.675 16.656 < 2e-16 ***
X -1149.485 933.248 -1.232 0.22432
M1 1763.192 1275.953 1.382 0.17369
M2 4089.638 1273.890 3.210 0.00242 **
M3 -3.315 1272.282 -0.003 0.99793
M4 -6467.669 1271.133 -5.088 6.54e-06 ***
M5 11870.778 1270.443 9.344 3.37e-12 ***
M6 9068.424 1270.213 7.139 5.63e-09 ***
M7 12305.271 1270.443 9.686 1.11e-12 ***
M8 9645.614 1268.465 7.604 1.14e-09 ***
M9 6230.261 1266.851 4.918 1.16e-05 ***
M10 7330.107 1265.697 5.791 5.94e-07 ***
M11 1259.354 1265.004 0.996 0.32469
t 4.954 24.180 0.205 0.83858
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2000 on 46 degrees of freedom
Multiple R-squared: 0.9059, Adjusted R-squared: 0.8793
F-statistic: 34.07 on 13 and 46 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,] 0.4079737 0.8159473 0.5920263
[2,] 0.5718511 0.8562977 0.4281489
[3,] 0.7671093 0.4657813 0.2328907
[4,] 0.6581668 0.6836663 0.3418332
[5,] 0.6664532 0.6670936 0.3335468
[6,] 0.6927936 0.6144129 0.3072064
[7,] 0.6123632 0.7752736 0.3876368
[8,] 0.5371101 0.9257798 0.4628899
[9,] 0.5190619 0.9618762 0.4809381
[10,] 0.4926442 0.9852884 0.5073558
[11,] 0.4245198 0.8490396 0.5754802
[12,] 0.5162561 0.9674878 0.4837439
[13,] 0.4202714 0.8405428 0.5797286
[14,] 0.3828366 0.7656732 0.6171634
[15,] 0.2980443 0.5960886 0.7019557
[16,] 0.5095610 0.9808780 0.4904390
[17,] 0.4321898 0.8643797 0.5678102
[18,] 0.4038120 0.8076240 0.5961880
[19,] 0.4784505 0.9569010 0.5215495
[20,] 0.5328226 0.9343549 0.4671774
[21,] 0.6046225 0.7907550 0.3953775
[22,] 0.6106146 0.7787708 0.3893854
[23,] 0.4977846 0.9955692 0.5022154
[24,] 0.5376317 0.9247365 0.4623683
[25,] 0.4486857 0.8973714 0.5513143
[26,] 0.4770051 0.9540102 0.5229949
[27,] 0.3269124 0.6538248 0.6730876
> postscript(file="/var/www/html/rcomp/tmp/1ym8p1260972380.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/24nfi1260972380.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/3573o1260972380.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/4x9f61260972380.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/52dx81260972380.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
415.187296 499.787296 974.787296 2072.187296 -335.212704 -1689.812704
7 8 9 10 11 12
-1426.612704 -1385.909619 -2052.509619 1481.690381 -1526.509619 487.890381
13 14 15 16 17 18
-326.254809 -2556.654809 225.345191 -1096.254809 1818.345191 2165.745191
19 20 21 22 23 24
3923.945191 -762.351724 2219.048276 -1930.751724 -1398.951724 -973.551724
25 26 27 28 29 30
-1864.696915 -1406.096915 -931.096915 -2486.696915 926.903085 -848.696915
31 32 33 34 35 36
9.503085 -2127.793829 523.606171 96.806171 802.606171 327.006171
37 38 39 40 41 42
294.860980 2315.460980 1441.460980 824.860980 1309.460980 2651.860980
43 44 45 46 47 48
-681.939020 5037.248639 2339.648639 2243.848639 1679.648639 518.048639
49 50 51 52 53 54
1480.903448 1147.503448 -1710.496552 685.903448 -3719.496552 -2279.096552
55 56 57 58 59 60
-1824.896552 -761.193466 -3029.793466 -1891.593466 443.206534 -359.393466
> postscript(file="/var/www/html/rcomp/tmp/6g6241260972380.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 415.187296 NA
1 499.787296 415.187296
2 974.787296 499.787296
3 2072.187296 974.787296
4 -335.212704 2072.187296
5 -1689.812704 -335.212704
6 -1426.612704 -1689.812704
7 -1385.909619 -1426.612704
8 -2052.509619 -1385.909619
9 1481.690381 -2052.509619
10 -1526.509619 1481.690381
11 487.890381 -1526.509619
12 -326.254809 487.890381
13 -2556.654809 -326.254809
14 225.345191 -2556.654809
15 -1096.254809 225.345191
16 1818.345191 -1096.254809
17 2165.745191 1818.345191
18 3923.945191 2165.745191
19 -762.351724 3923.945191
20 2219.048276 -762.351724
21 -1930.751724 2219.048276
22 -1398.951724 -1930.751724
23 -973.551724 -1398.951724
24 -1864.696915 -973.551724
25 -1406.096915 -1864.696915
26 -931.096915 -1406.096915
27 -2486.696915 -931.096915
28 926.903085 -2486.696915
29 -848.696915 926.903085
30 9.503085 -848.696915
31 -2127.793829 9.503085
32 523.606171 -2127.793829
33 96.806171 523.606171
34 802.606171 96.806171
35 327.006171 802.606171
36 294.860980 327.006171
37 2315.460980 294.860980
38 1441.460980 2315.460980
39 824.860980 1441.460980
40 1309.460980 824.860980
41 2651.860980 1309.460980
42 -681.939020 2651.860980
43 5037.248639 -681.939020
44 2339.648639 5037.248639
45 2243.848639 2339.648639
46 1679.648639 2243.848639
47 518.048639 1679.648639
48 1480.903448 518.048639
49 1147.503448 1480.903448
50 -1710.496552 1147.503448
51 685.903448 -1710.496552
52 -3719.496552 685.903448
53 -2279.096552 -3719.496552
54 -1824.896552 -2279.096552
55 -761.193466 -1824.896552
56 -3029.793466 -761.193466
57 -1891.593466 -3029.793466
58 443.206534 -1891.593466
59 -359.393466 443.206534
60 NA -359.393466
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 499.787296 415.187296
[2,] 974.787296 499.787296
[3,] 2072.187296 974.787296
[4,] -335.212704 2072.187296
[5,] -1689.812704 -335.212704
[6,] -1426.612704 -1689.812704
[7,] -1385.909619 -1426.612704
[8,] -2052.509619 -1385.909619
[9,] 1481.690381 -2052.509619
[10,] -1526.509619 1481.690381
[11,] 487.890381 -1526.509619
[12,] -326.254809 487.890381
[13,] -2556.654809 -326.254809
[14,] 225.345191 -2556.654809
[15,] -1096.254809 225.345191
[16,] 1818.345191 -1096.254809
[17,] 2165.745191 1818.345191
[18,] 3923.945191 2165.745191
[19,] -762.351724 3923.945191
[20,] 2219.048276 -762.351724
[21,] -1930.751724 2219.048276
[22,] -1398.951724 -1930.751724
[23,] -973.551724 -1398.951724
[24,] -1864.696915 -973.551724
[25,] -1406.096915 -1864.696915
[26,] -931.096915 -1406.096915
[27,] -2486.696915 -931.096915
[28,] 926.903085 -2486.696915
[29,] -848.696915 926.903085
[30,] 9.503085 -848.696915
[31,] -2127.793829 9.503085
[32,] 523.606171 -2127.793829
[33,] 96.806171 523.606171
[34,] 802.606171 96.806171
[35,] 327.006171 802.606171
[36,] 294.860980 327.006171
[37,] 2315.460980 294.860980
[38,] 1441.460980 2315.460980
[39,] 824.860980 1441.460980
[40,] 1309.460980 824.860980
[41,] 2651.860980 1309.460980
[42,] -681.939020 2651.860980
[43,] 5037.248639 -681.939020
[44,] 2339.648639 5037.248639
[45,] 2243.848639 2339.648639
[46,] 1679.648639 2243.848639
[47,] 518.048639 1679.648639
[48,] 1480.903448 518.048639
[49,] 1147.503448 1480.903448
[50,] -1710.496552 1147.503448
[51,] 685.903448 -1710.496552
[52,] -3719.496552 685.903448
[53,] -2279.096552 -3719.496552
[54,] -1824.896552 -2279.096552
[55,] -761.193466 -1824.896552
[56,] -3029.793466 -761.193466
[57,] -1891.593466 -3029.793466
[58,] 443.206534 -1891.593466
[59,] -359.393466 443.206534
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 499.787296 415.187296
2 974.787296 499.787296
3 2072.187296 974.787296
4 -335.212704 2072.187296
5 -1689.812704 -335.212704
6 -1426.612704 -1689.812704
7 -1385.909619 -1426.612704
8 -2052.509619 -1385.909619
9 1481.690381 -2052.509619
10 -1526.509619 1481.690381
11 487.890381 -1526.509619
12 -326.254809 487.890381
13 -2556.654809 -326.254809
14 225.345191 -2556.654809
15 -1096.254809 225.345191
16 1818.345191 -1096.254809
17 2165.745191 1818.345191
18 3923.945191 2165.745191
19 -762.351724 3923.945191
20 2219.048276 -762.351724
21 -1930.751724 2219.048276
22 -1398.951724 -1930.751724
23 -973.551724 -1398.951724
24 -1864.696915 -973.551724
25 -1406.096915 -1864.696915
26 -931.096915 -1406.096915
27 -2486.696915 -931.096915
28 926.903085 -2486.696915
29 -848.696915 926.903085
30 9.503085 -848.696915
31 -2127.793829 9.503085
32 523.606171 -2127.793829
33 96.806171 523.606171
34 802.606171 96.806171
35 327.006171 802.606171
36 294.860980 327.006171
37 2315.460980 294.860980
38 1441.460980 2315.460980
39 824.860980 1441.460980
40 1309.460980 824.860980
41 2651.860980 1309.460980
42 -681.939020 2651.860980
43 5037.248639 -681.939020
44 2339.648639 5037.248639
45 2243.848639 2339.648639
46 1679.648639 2243.848639
47 518.048639 1679.648639
48 1480.903448 518.048639
49 1147.503448 1480.903448
50 -1710.496552 1147.503448
51 685.903448 -1710.496552
52 -3719.496552 685.903448
53 -2279.096552 -3719.496552
54 -1824.896552 -2279.096552
55 -761.193466 -1824.896552
56 -3029.793466 -761.193466
57 -1891.593466 -3029.793466
58 443.206534 -1891.593466
59 -359.393466 443.206534
> 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/7kwtc1260972380.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/85ssl1260972380.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/9gy5z1260972380.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/10bxc81260972380.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/11vlqy1260972380.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/12kugy1260972380.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/13ul7f1260972380.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/14r6xg1260972380.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/15g5os1260972380.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/16lo7a1260972380.tab")
+ }
>
> try(system("convert tmp/1ym8p1260972380.ps tmp/1ym8p1260972380.png",intern=TRUE))
character(0)
> try(system("convert tmp/24nfi1260972380.ps tmp/24nfi1260972380.png",intern=TRUE))
character(0)
> try(system("convert tmp/3573o1260972380.ps tmp/3573o1260972380.png",intern=TRUE))
character(0)
> try(system("convert tmp/4x9f61260972380.ps tmp/4x9f61260972380.png",intern=TRUE))
character(0)
> try(system("convert tmp/52dx81260972380.ps tmp/52dx81260972380.png",intern=TRUE))
character(0)
> try(system("convert tmp/6g6241260972380.ps tmp/6g6241260972380.png",intern=TRUE))
character(0)
> try(system("convert tmp/7kwtc1260972380.ps tmp/7kwtc1260972380.png",intern=TRUE))
character(0)
> try(system("convert tmp/85ssl1260972380.ps tmp/85ssl1260972380.png",intern=TRUE))
character(0)
> try(system("convert tmp/9gy5z1260972380.ps tmp/9gy5z1260972380.png",intern=TRUE))
character(0)
> try(system("convert tmp/10bxc81260972380.ps tmp/10bxc81260972380.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.418 1.557 3.569