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(2360,2,2214,2,2825,2,2355,2,2333,2,3016,2,2155,2,2172,2,2150,2,2533,2,2058,2,2160,2,2260,2,2498,2,2695,2,2799,2,2947,2,2930,2,2318,2,2540,2,2570,2,2669,2,2450,2,2842,2,3440,2,2678,2,2981,2,2260,2.21,2844,2.25,2546,2.25,2456,2.45,2295,2.5,2379,2.5,2479,2.64,2057,2.75,2280,2.93,2351,3,2276,3.17,2548,3.25,2311,3.39,2201,3.5,2725,3.5,2408,3.65,2139,3.75,1898,3.75,2537,3.9,2069,4,2063,4,2524,4,2437,4,2189,4,2793,4,2074,4,2622,4,2278,4,2144,4,2427,4,2139,4,1828,4.18,2072,4.25,1800,4.25),dim=c(2,61),dimnames=list(c('Y','X'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('Y','X'),1:61))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = '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
1 2360 2.00 1 0 0 0 0 0 0 0 0 0 0
2 2214 2.00 0 1 0 0 0 0 0 0 0 0 0
3 2825 2.00 0 0 1 0 0 0 0 0 0 0 0
4 2355 2.00 0 0 0 1 0 0 0 0 0 0 0
5 2333 2.00 0 0 0 0 1 0 0 0 0 0 0
6 3016 2.00 0 0 0 0 0 1 0 0 0 0 0
7 2155 2.00 0 0 0 0 0 0 1 0 0 0 0
8 2172 2.00 0 0 0 0 0 0 0 1 0 0 0
9 2150 2.00 0 0 0 0 0 0 0 0 1 0 0
10 2533 2.00 0 0 0 0 0 0 0 0 0 1 0
11 2058 2.00 0 0 0 0 0 0 0 0 0 0 1
12 2160 2.00 0 0 0 0 0 0 0 0 0 0 0
13 2260 2.00 1 0 0 0 0 0 0 0 0 0 0
14 2498 2.00 0 1 0 0 0 0 0 0 0 0 0
15 2695 2.00 0 0 1 0 0 0 0 0 0 0 0
16 2799 2.00 0 0 0 1 0 0 0 0 0 0 0
17 2947 2.00 0 0 0 0 1 0 0 0 0 0 0
18 2930 2.00 0 0 0 0 0 1 0 0 0 0 0
19 2318 2.00 0 0 0 0 0 0 1 0 0 0 0
20 2540 2.00 0 0 0 0 0 0 0 1 0 0 0
21 2570 2.00 0 0 0 0 0 0 0 0 1 0 0
22 2669 2.00 0 0 0 0 0 0 0 0 0 1 0
23 2450 2.00 0 0 0 0 0 0 0 0 0 0 1
24 2842 2.00 0 0 0 0 0 0 0 0 0 0 0
25 3440 2.00 1 0 0 0 0 0 0 0 0 0 0
26 2678 2.00 0 1 0 0 0 0 0 0 0 0 0
27 2981 2.00 0 0 1 0 0 0 0 0 0 0 0
28 2260 2.21 0 0 0 1 0 0 0 0 0 0 0
29 2844 2.25 0 0 0 0 1 0 0 0 0 0 0
30 2546 2.25 0 0 0 0 0 1 0 0 0 0 0
31 2456 2.45 0 0 0 0 0 0 1 0 0 0 0
32 2295 2.50 0 0 0 0 0 0 0 1 0 0 0
33 2379 2.50 0 0 0 0 0 0 0 0 1 0 0
34 2479 2.64 0 0 0 0 0 0 0 0 0 1 0
35 2057 2.75 0 0 0 0 0 0 0 0 0 0 1
36 2280 2.93 0 0 0 0 0 0 0 0 0 0 0
37 2351 3.00 1 0 0 0 0 0 0 0 0 0 0
38 2276 3.17 0 1 0 0 0 0 0 0 0 0 0
39 2548 3.25 0 0 1 0 0 0 0 0 0 0 0
40 2311 3.39 0 0 0 1 0 0 0 0 0 0 0
41 2201 3.50 0 0 0 0 1 0 0 0 0 0 0
42 2725 3.50 0 0 0 0 0 1 0 0 0 0 0
43 2408 3.65 0 0 0 0 0 0 1 0 0 0 0
44 2139 3.75 0 0 0 0 0 0 0 1 0 0 0
45 1898 3.75 0 0 0 0 0 0 0 0 1 0 0
46 2537 3.90 0 0 0 0 0 0 0 0 0 1 0
47 2069 4.00 0 0 0 0 0 0 0 0 0 0 1
48 2063 4.00 0 0 0 0 0 0 0 0 0 0 0
49 2524 4.00 1 0 0 0 0 0 0 0 0 0 0
50 2437 4.00 0 1 0 0 0 0 0 0 0 0 0
51 2189 4.00 0 0 1 0 0 0 0 0 0 0 0
52 2793 4.00 0 0 0 1 0 0 0 0 0 0 0
53 2074 4.00 0 0 0 0 1 0 0 0 0 0 0
54 2622 4.00 0 0 0 0 0 1 0 0 0 0 0
55 2278 4.00 0 0 0 0 0 0 1 0 0 0 0
56 2144 4.00 0 0 0 0 0 0 0 1 0 0 0
57 2427 4.00 0 0 0 0 0 0 0 0 1 0 0
58 2139 4.00 0 0 0 0 0 0 0 0 0 1 0
59 1828 4.18 0 0 0 0 0 0 0 0 0 0 1
60 2072 4.25 0 0 0 0 0 0 0 0 0 0 0
61 1800 4.25 1 0 0 0 0 0 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X M1 M2 M3 M4
2718.537 -143.326 149.358 79.583 308.876 174.909
M5 M6 M7 M8 M9 M10
155.409 443.409 8.642 -52.059 -25.259 169.654
M11
-198.166
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-458.76 -175.89 -13.60 160.17 858.76
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2718.537 165.418 16.434 < 2e-16 ***
X -143.326 38.433 -3.729 0.000507 ***
M1 149.358 158.881 0.940 0.351894
M2 79.583 166.538 0.478 0.634915
M3 308.876 166.482 1.855 0.069699 .
M4 174.909 166.264 1.052 0.298070
M5 155.409 166.184 0.935 0.354386
M6 443.409 166.184 2.668 0.010370 *
M7 8.642 166.028 0.052 0.958705
M8 -52.059 165.974 -0.314 0.755142
M9 -25.259 165.974 -0.152 0.879680
M10 169.654 165.893 1.023 0.311589
M11 -198.166 165.831 -1.195 0.237963
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 262.2 on 48 degrees of freedom
Multiple R-squared: 0.4584, Adjusted R-squared: 0.323
F-statistic: 3.385 on 12 and 48 DF, p-value: 0.001255
> 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.4730085 0.94601690 0.52699155
[2,] 0.6966472 0.60670553 0.30335277
[3,] 0.5614869 0.87702614 0.43851307
[4,] 0.4732864 0.94657284 0.52671358
[5,] 0.4502560 0.90051199 0.54974400
[6,] 0.4509111 0.90182221 0.54908889
[7,] 0.3502025 0.70040497 0.64979751
[8,] 0.3362427 0.67248546 0.66375727
[9,] 0.4963161 0.99263217 0.50368391
[10,] 0.9748357 0.05032862 0.02516431
[11,] 0.9643673 0.07126536 0.03563268
[12,] 0.9644167 0.07116665 0.03558332
[13,] 0.9666048 0.06679047 0.03339524
[14,] 0.9835554 0.03288911 0.01644456
[15,] 0.9813320 0.03733600 0.01866800
[16,] 0.9728523 0.05429549 0.02714775
[17,] 0.9529035 0.09419309 0.04709655
[18,] 0.9233720 0.15325599 0.07662800
[19,] 0.8801643 0.23967135 0.11983567
[20,] 0.8231954 0.35360925 0.17680463
[21,] 0.7513491 0.49730185 0.24865092
[22,] 0.6705344 0.65893120 0.32946560
[23,] 0.5965322 0.80693561 0.40346781
[24,] 0.5342106 0.93157880 0.46578940
[25,] 0.6144907 0.77101853 0.38550927
[26,] 0.5046029 0.99079429 0.49539714
[27,] 0.3908429 0.78168574 0.60915713
[28,] 0.2927953 0.58559065 0.70720467
[29,] 0.1890240 0.37804792 0.81097604
[30,] 0.5154443 0.96911149 0.48455574
> postscript(file="/var/www/html/rcomp/tmp/14yv91258654376.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/2mv281258654376.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/3flqy1258654376.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/43rpi1258654376.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/5yfs31258654376.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
-221.243352 -297.468517 84.238272 -251.794530 -254.294302 140.705698
7 8 9 10 11 12
-285.527103 -207.826875 -256.626875 -68.539768 -175.719176 -271.885462
13 14 15 16 17 18
-321.243352 -13.468517 -45.761728 192.205470 359.705698 54.705698
19 20 21 22 23 24
-122.527103 160.173125 163.373125 67.460232 216.280824 410.114538
25 26 27 28 29 30
858.756648 166.531483 240.238272 -316.696125 292.537132 -293.462868
31 32 33 34 35 36
79.969478 -13.164008 44.035992 -30.811297 -69.224874 -18.592528
37 38 39 40 41 42
-86.917616 -67.777406 -13.604559 -96.571757 -171.305698 64.694302
43 44 45 46 47 48
203.960361 9.993162 -257.806838 207.779130 121.932296 -82.233991
49 50 51 52 53 54
229.408119 212.182955 -265.110257 472.856942 -226.642830 33.357170
55 56 57 58 59 60
124.124368 50.824596 307.024596 -175.888296 -93.269071 -37.402557
61
-458.760447
> postscript(file="/var/www/html/rcomp/tmp/69x8c1258654376.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 -221.243352 NA
1 -297.468517 -221.243352
2 84.238272 -297.468517
3 -251.794530 84.238272
4 -254.294302 -251.794530
5 140.705698 -254.294302
6 -285.527103 140.705698
7 -207.826875 -285.527103
8 -256.626875 -207.826875
9 -68.539768 -256.626875
10 -175.719176 -68.539768
11 -271.885462 -175.719176
12 -321.243352 -271.885462
13 -13.468517 -321.243352
14 -45.761728 -13.468517
15 192.205470 -45.761728
16 359.705698 192.205470
17 54.705698 359.705698
18 -122.527103 54.705698
19 160.173125 -122.527103
20 163.373125 160.173125
21 67.460232 163.373125
22 216.280824 67.460232
23 410.114538 216.280824
24 858.756648 410.114538
25 166.531483 858.756648
26 240.238272 166.531483
27 -316.696125 240.238272
28 292.537132 -316.696125
29 -293.462868 292.537132
30 79.969478 -293.462868
31 -13.164008 79.969478
32 44.035992 -13.164008
33 -30.811297 44.035992
34 -69.224874 -30.811297
35 -18.592528 -69.224874
36 -86.917616 -18.592528
37 -67.777406 -86.917616
38 -13.604559 -67.777406
39 -96.571757 -13.604559
40 -171.305698 -96.571757
41 64.694302 -171.305698
42 203.960361 64.694302
43 9.993162 203.960361
44 -257.806838 9.993162
45 207.779130 -257.806838
46 121.932296 207.779130
47 -82.233991 121.932296
48 229.408119 -82.233991
49 212.182955 229.408119
50 -265.110257 212.182955
51 472.856942 -265.110257
52 -226.642830 472.856942
53 33.357170 -226.642830
54 124.124368 33.357170
55 50.824596 124.124368
56 307.024596 50.824596
57 -175.888296 307.024596
58 -93.269071 -175.888296
59 -37.402557 -93.269071
60 -458.760447 -37.402557
61 NA -458.760447
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -297.468517 -221.243352
[2,] 84.238272 -297.468517
[3,] -251.794530 84.238272
[4,] -254.294302 -251.794530
[5,] 140.705698 -254.294302
[6,] -285.527103 140.705698
[7,] -207.826875 -285.527103
[8,] -256.626875 -207.826875
[9,] -68.539768 -256.626875
[10,] -175.719176 -68.539768
[11,] -271.885462 -175.719176
[12,] -321.243352 -271.885462
[13,] -13.468517 -321.243352
[14,] -45.761728 -13.468517
[15,] 192.205470 -45.761728
[16,] 359.705698 192.205470
[17,] 54.705698 359.705698
[18,] -122.527103 54.705698
[19,] 160.173125 -122.527103
[20,] 163.373125 160.173125
[21,] 67.460232 163.373125
[22,] 216.280824 67.460232
[23,] 410.114538 216.280824
[24,] 858.756648 410.114538
[25,] 166.531483 858.756648
[26,] 240.238272 166.531483
[27,] -316.696125 240.238272
[28,] 292.537132 -316.696125
[29,] -293.462868 292.537132
[30,] 79.969478 -293.462868
[31,] -13.164008 79.969478
[32,] 44.035992 -13.164008
[33,] -30.811297 44.035992
[34,] -69.224874 -30.811297
[35,] -18.592528 -69.224874
[36,] -86.917616 -18.592528
[37,] -67.777406 -86.917616
[38,] -13.604559 -67.777406
[39,] -96.571757 -13.604559
[40,] -171.305698 -96.571757
[41,] 64.694302 -171.305698
[42,] 203.960361 64.694302
[43,] 9.993162 203.960361
[44,] -257.806838 9.993162
[45,] 207.779130 -257.806838
[46,] 121.932296 207.779130
[47,] -82.233991 121.932296
[48,] 229.408119 -82.233991
[49,] 212.182955 229.408119
[50,] -265.110257 212.182955
[51,] 472.856942 -265.110257
[52,] -226.642830 472.856942
[53,] 33.357170 -226.642830
[54,] 124.124368 33.357170
[55,] 50.824596 124.124368
[56,] 307.024596 50.824596
[57,] -175.888296 307.024596
[58,] -93.269071 -175.888296
[59,] -37.402557 -93.269071
[60,] -458.760447 -37.402557
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -297.468517 -221.243352
2 84.238272 -297.468517
3 -251.794530 84.238272
4 -254.294302 -251.794530
5 140.705698 -254.294302
6 -285.527103 140.705698
7 -207.826875 -285.527103
8 -256.626875 -207.826875
9 -68.539768 -256.626875
10 -175.719176 -68.539768
11 -271.885462 -175.719176
12 -321.243352 -271.885462
13 -13.468517 -321.243352
14 -45.761728 -13.468517
15 192.205470 -45.761728
16 359.705698 192.205470
17 54.705698 359.705698
18 -122.527103 54.705698
19 160.173125 -122.527103
20 163.373125 160.173125
21 67.460232 163.373125
22 216.280824 67.460232
23 410.114538 216.280824
24 858.756648 410.114538
25 166.531483 858.756648
26 240.238272 166.531483
27 -316.696125 240.238272
28 292.537132 -316.696125
29 -293.462868 292.537132
30 79.969478 -293.462868
31 -13.164008 79.969478
32 44.035992 -13.164008
33 -30.811297 44.035992
34 -69.224874 -30.811297
35 -18.592528 -69.224874
36 -86.917616 -18.592528
37 -67.777406 -86.917616
38 -13.604559 -67.777406
39 -96.571757 -13.604559
40 -171.305698 -96.571757
41 64.694302 -171.305698
42 203.960361 64.694302
43 9.993162 203.960361
44 -257.806838 9.993162
45 207.779130 -257.806838
46 121.932296 207.779130
47 -82.233991 121.932296
48 229.408119 -82.233991
49 212.182955 229.408119
50 -265.110257 212.182955
51 472.856942 -265.110257
52 -226.642830 472.856942
53 33.357170 -226.642830
54 124.124368 33.357170
55 50.824596 124.124368
56 307.024596 50.824596
57 -175.888296 307.024596
58 -93.269071 -175.888296
59 -37.402557 -93.269071
60 -458.760447 -37.402557
> 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/7veoh1258654377.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/8a0111258654377.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/9vayd1258654377.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/10q3yq1258654377.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/11yxme1258654377.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/12trc21258654377.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/13ists1258654377.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/14it8h1258654377.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/15fhsl1258654377.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/16tkya1258654377.tab")
+ }
> system("convert tmp/14yv91258654376.ps tmp/14yv91258654376.png")
> system("convert tmp/2mv281258654376.ps tmp/2mv281258654376.png")
> system("convert tmp/3flqy1258654376.ps tmp/3flqy1258654376.png")
> system("convert tmp/43rpi1258654376.ps tmp/43rpi1258654376.png")
> system("convert tmp/5yfs31258654376.ps tmp/5yfs31258654376.png")
> system("convert tmp/69x8c1258654376.ps tmp/69x8c1258654376.png")
> system("convert tmp/7veoh1258654377.ps tmp/7veoh1258654377.png")
> system("convert tmp/8a0111258654377.ps tmp/8a0111258654377.png")
> system("convert tmp/9vayd1258654377.ps tmp/9vayd1258654377.png")
> system("convert tmp/10q3yq1258654377.ps tmp/10q3yq1258654377.png")
>
>
> proc.time()
user system elapsed
2.392 1.551 2.798