R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-pc-linux-gnu (32-bit)
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(1,14,3,1,1,1,8,3,0,1,0,12,6,1,1,1,7,2,0,1,0,10,1,1,0,0,7,2,0,0,1,16,8,1,1,1,11,1,1,0,0,14,4,1,1,0,6,0,0,0,0,16,4,1,0,1,11,2,0,1,0,16,1,1,1,1,12,2,1,1,0,7,3,0,0,0,13,1,1,0,1,11,2,1,1,1,15,6,1,0,1,7,0,0,1,1,9,1,0,1,0,7,3,0,1,1,14,5,1,1,1,15,0,1,1,1,7,1,0,1,1,15,3,1,1,1,17,6,1,1,1,15,5,1,0,1,14,4,1,0,0,14,4,0,0,1,8,4,1,1,0,8,0,0,1,1,14,3,1,0,1,14,5,1,1,0,8,3,0,0,1,11,1,1,1,1,16,5,1,1,1,10,5,1,1,1,8,0,0,1,1,14,3,1,1,1,16,6,1,0,0,13,3,1,1,1,5,1,0,0,1,8,2,0,1,1,10,2,0,0,0,8,2,0,1,1,13,4,1,1,1,15,4,1,1,0,6,0,0,1,0,12,3,1,1,1,16,6,0,1,1,5,3,1,0,0,15,1,1,1,0,12,4,1,0,0,8,3,0,1,0,13,3,1,1,1,14,3,1,1,0,12,2,1,1,0,16,6,1,1,1,10,5,1,1,0,15,5,1,0,0,8,2,0,1,1,16,4,1,1,0,19,2,1,1,0,14,5,1,0),dim=c(5,64),dimnames=list(c('Change','Size','Complex','Big4','Product'),1:64))
> y <- array(NA,dim=c(5,64),dimnames=list(c('Change','Size','Complex','Big4','Product'),1:64))
> 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
> 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
Change Size Complex Big4 Product
1 1 14 3 1 1
2 1 8 3 0 1
3 0 12 6 1 1
4 1 7 2 0 1
5 0 10 1 1 0
6 0 7 2 0 0
7 1 16 8 1 1
8 1 11 1 1 0
9 0 14 4 1 1
10 0 6 0 0 0
11 0 16 4 1 0
12 1 11 2 0 1
13 0 16 1 1 1
14 1 12 2 1 1
15 0 7 3 0 0
16 0 13 1 1 0
17 1 11 2 1 1
18 1 15 6 1 0
19 1 7 0 0 1
20 1 9 1 0 1
21 0 7 3 0 1
22 1 14 5 1 1
23 1 15 0 1 1
24 1 7 1 0 1
25 1 15 3 1 1
26 1 17 6 1 1
27 1 15 5 1 0
28 1 14 4 1 0
29 0 14 4 0 0
30 1 8 4 1 1
31 0 8 0 0 1
32 1 14 3 1 0
33 1 14 5 1 1
34 0 8 3 0 0
35 1 11 1 1 1
36 1 16 5 1 1
37 1 10 5 1 1
38 1 8 0 0 1
39 1 14 3 1 1
40 1 16 6 1 0
41 0 13 3 1 1
42 1 5 1 0 0
43 1 8 2 0 1
44 1 10 2 0 0
45 0 8 2 0 1
46 1 13 4 1 1
47 1 15 4 1 1
48 0 6 0 0 1
49 0 12 3 1 1
50 1 16 6 0 1
51 1 5 3 1 0
52 0 15 1 1 1
53 0 12 4 1 0
54 0 8 3 0 1
55 0 13 3 1 1
56 1 14 3 1 1
57 0 12 2 1 1
58 0 16 6 1 1
59 1 10 5 1 1
60 0 15 5 1 0
61 0 8 2 0 1
62 1 16 4 1 1
63 0 19 2 1 1
64 0 14 5 1 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Size Complex Big4 Product
0.42440 -0.01758 0.04365 0.13477 0.20310
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.8133 -0.5172 0.2656 0.4004 0.6641
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.42440 0.24200 1.754 0.0847 .
Size -0.01758 0.02662 -0.660 0.5117
Complex 0.04365 0.04006 1.090 0.2802
Big4 0.13477 0.18382 0.733 0.4664
Product 0.20310 0.13545 1.499 0.1391
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.4978 on 59 degrees of freedom
Multiple R-squared: 0.06339, Adjusted R-squared: -0.0001051
F-statistic: 0.9983 on 4 and 59 DF, p-value: 0.4158
> 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.5374534 0.9250933 0.4625466
[2,] 0.8082563 0.3834874 0.1917437
[3,] 0.7631723 0.4736554 0.2368277
[4,] 0.7231569 0.5536863 0.2768431
[5,] 0.6308353 0.7383294 0.3691647
[6,] 0.7142396 0.5715209 0.2857604
[7,] 0.6712148 0.6575703 0.3287852
[8,] 0.6077429 0.7845141 0.3922571
[9,] 0.5332880 0.9334240 0.4667120
[10,] 0.4639206 0.9278411 0.5360794
[11,] 0.5819009 0.8361982 0.4180991
[12,] 0.5373948 0.9252104 0.4626052
[13,] 0.4933787 0.9867573 0.5066213
[14,] 0.5694890 0.8610219 0.4305110
[15,] 0.5116400 0.9767200 0.4883600
[16,] 0.4770753 0.9541507 0.5229247
[17,] 0.4457959 0.8915917 0.5542041
[18,] 0.3996024 0.7992048 0.6003976
[19,] 0.3402466 0.6804933 0.6597534
[20,] 0.3605367 0.7210734 0.6394633
[21,] 0.3714312 0.7428625 0.6285688
[22,] 0.3510964 0.7021927 0.6489036
[23,] 0.2930827 0.5861654 0.7069173
[24,] 0.3012825 0.6025650 0.6987175
[25,] 0.3154598 0.6309196 0.6845402
[26,] 0.2655234 0.5310469 0.7344766
[27,] 0.2475142 0.4950283 0.7524858
[28,] 0.2403876 0.4807752 0.7596124
[29,] 0.2080086 0.4160171 0.7919914
[30,] 0.1694768 0.3389535 0.8305232
[31,] 0.1811779 0.3623559 0.8188221
[32,] 0.1840208 0.3680416 0.8159792
[33,] 0.1711534 0.3423068 0.8288466
[34,] 0.2021103 0.4042207 0.7978897
[35,] 0.2417763 0.4835525 0.7582237
[36,] 0.2510398 0.5020796 0.7489602
[37,] 0.4752154 0.9504307 0.5247846
[38,] 0.4444322 0.8888645 0.5555678
[39,] 0.4052067 0.8104134 0.5947933
[40,] 0.4085272 0.8170544 0.5914728
[41,] 0.3493248 0.6986496 0.6506752
[42,] 0.3608837 0.7217674 0.6391163
[43,] 0.5727280 0.8545441 0.4272720
[44,] 0.5685355 0.8629290 0.4314645
[45,] 0.4920848 0.9841696 0.5079152
[46,] 0.3927793 0.7855585 0.6072207
[47,] 0.2962672 0.5925344 0.7037328
[48,] 0.2909421 0.5818843 0.7090579
[49,] 0.2923815 0.5847629 0.7076185
> postscript(file="/var/wessaorg/rcomp/tmp/1a81k1321893612.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/wessaorg/rcomp/tmp/2u6ck1321893612.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/wessaorg/rcomp/tmp/3nei51321893612.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/wessaorg/rcomp/tmp/4b8n81321893612.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/wessaorg/rcomp/tmp/5yes21321893612.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 = 64
Frequency = 1
1 2 3 4 5 6 7
0.3528619 0.3821620 -0.8132560 0.4082386 -0.4270411 -0.3886625 0.1697459
8 9 10 11 12 13 14
0.5905365 -0.6907923 -0.3189316 -0.4525383 0.4785489 -0.5246745 0.3613610
15 16 17 18 19 20 21
-0.4323167 -0.3743083 0.3437834 0.4425757 0.4955471 0.4870480 -0.6354156
22 23 24 25 26 27 28
0.2655534 0.5014022 0.4518928 0.3704395 0.2746319 0.4862299 0.5123065
29 30 31 32 33 34 35
-0.3529279 0.2037422 -0.4868753 0.5559608 0.2655534 -0.4147392 0.3874376
36 37 38 39 40 41 42
0.3007086 0.1952431 0.5131247 0.3528619 0.4601532 -0.6647157 0.6198366
43 44 45 46 47 48 49
0.4258162 0.6640702 -0.5741838 0.2916301 0.3267852 -0.5220305 -0.6822933
50 51 52 53 54 55 56
0.3918199 0.3977626 -0.5422521 -0.5228486 -0.6178380 -0.6647157 0.3528619
57 58 59 60 61 62 63
-0.6386390 -0.7429457 0.1952431 -0.5137701 -0.5741838 0.3443628 -0.5155960
64
-0.5313477
> postscript(file="/var/wessaorg/rcomp/tmp/65rr31321893612.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 = 64
Frequency = 1
lag(myerror, k = 1) myerror
0 0.3528619 NA
1 0.3821620 0.3528619
2 -0.8132560 0.3821620
3 0.4082386 -0.8132560
4 -0.4270411 0.4082386
5 -0.3886625 -0.4270411
6 0.1697459 -0.3886625
7 0.5905365 0.1697459
8 -0.6907923 0.5905365
9 -0.3189316 -0.6907923
10 -0.4525383 -0.3189316
11 0.4785489 -0.4525383
12 -0.5246745 0.4785489
13 0.3613610 -0.5246745
14 -0.4323167 0.3613610
15 -0.3743083 -0.4323167
16 0.3437834 -0.3743083
17 0.4425757 0.3437834
18 0.4955471 0.4425757
19 0.4870480 0.4955471
20 -0.6354156 0.4870480
21 0.2655534 -0.6354156
22 0.5014022 0.2655534
23 0.4518928 0.5014022
24 0.3704395 0.4518928
25 0.2746319 0.3704395
26 0.4862299 0.2746319
27 0.5123065 0.4862299
28 -0.3529279 0.5123065
29 0.2037422 -0.3529279
30 -0.4868753 0.2037422
31 0.5559608 -0.4868753
32 0.2655534 0.5559608
33 -0.4147392 0.2655534
34 0.3874376 -0.4147392
35 0.3007086 0.3874376
36 0.1952431 0.3007086
37 0.5131247 0.1952431
38 0.3528619 0.5131247
39 0.4601532 0.3528619
40 -0.6647157 0.4601532
41 0.6198366 -0.6647157
42 0.4258162 0.6198366
43 0.6640702 0.4258162
44 -0.5741838 0.6640702
45 0.2916301 -0.5741838
46 0.3267852 0.2916301
47 -0.5220305 0.3267852
48 -0.6822933 -0.5220305
49 0.3918199 -0.6822933
50 0.3977626 0.3918199
51 -0.5422521 0.3977626
52 -0.5228486 -0.5422521
53 -0.6178380 -0.5228486
54 -0.6647157 -0.6178380
55 0.3528619 -0.6647157
56 -0.6386390 0.3528619
57 -0.7429457 -0.6386390
58 0.1952431 -0.7429457
59 -0.5137701 0.1952431
60 -0.5741838 -0.5137701
61 0.3443628 -0.5741838
62 -0.5155960 0.3443628
63 -0.5313477 -0.5155960
64 NA -0.5313477
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.3821620 0.3528619
[2,] -0.8132560 0.3821620
[3,] 0.4082386 -0.8132560
[4,] -0.4270411 0.4082386
[5,] -0.3886625 -0.4270411
[6,] 0.1697459 -0.3886625
[7,] 0.5905365 0.1697459
[8,] -0.6907923 0.5905365
[9,] -0.3189316 -0.6907923
[10,] -0.4525383 -0.3189316
[11,] 0.4785489 -0.4525383
[12,] -0.5246745 0.4785489
[13,] 0.3613610 -0.5246745
[14,] -0.4323167 0.3613610
[15,] -0.3743083 -0.4323167
[16,] 0.3437834 -0.3743083
[17,] 0.4425757 0.3437834
[18,] 0.4955471 0.4425757
[19,] 0.4870480 0.4955471
[20,] -0.6354156 0.4870480
[21,] 0.2655534 -0.6354156
[22,] 0.5014022 0.2655534
[23,] 0.4518928 0.5014022
[24,] 0.3704395 0.4518928
[25,] 0.2746319 0.3704395
[26,] 0.4862299 0.2746319
[27,] 0.5123065 0.4862299
[28,] -0.3529279 0.5123065
[29,] 0.2037422 -0.3529279
[30,] -0.4868753 0.2037422
[31,] 0.5559608 -0.4868753
[32,] 0.2655534 0.5559608
[33,] -0.4147392 0.2655534
[34,] 0.3874376 -0.4147392
[35,] 0.3007086 0.3874376
[36,] 0.1952431 0.3007086
[37,] 0.5131247 0.1952431
[38,] 0.3528619 0.5131247
[39,] 0.4601532 0.3528619
[40,] -0.6647157 0.4601532
[41,] 0.6198366 -0.6647157
[42,] 0.4258162 0.6198366
[43,] 0.6640702 0.4258162
[44,] -0.5741838 0.6640702
[45,] 0.2916301 -0.5741838
[46,] 0.3267852 0.2916301
[47,] -0.5220305 0.3267852
[48,] -0.6822933 -0.5220305
[49,] 0.3918199 -0.6822933
[50,] 0.3977626 0.3918199
[51,] -0.5422521 0.3977626
[52,] -0.5228486 -0.5422521
[53,] -0.6178380 -0.5228486
[54,] -0.6647157 -0.6178380
[55,] 0.3528619 -0.6647157
[56,] -0.6386390 0.3528619
[57,] -0.7429457 -0.6386390
[58,] 0.1952431 -0.7429457
[59,] -0.5137701 0.1952431
[60,] -0.5741838 -0.5137701
[61,] 0.3443628 -0.5741838
[62,] -0.5155960 0.3443628
[63,] -0.5313477 -0.5155960
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.3821620 0.3528619
2 -0.8132560 0.3821620
3 0.4082386 -0.8132560
4 -0.4270411 0.4082386
5 -0.3886625 -0.4270411
6 0.1697459 -0.3886625
7 0.5905365 0.1697459
8 -0.6907923 0.5905365
9 -0.3189316 -0.6907923
10 -0.4525383 -0.3189316
11 0.4785489 -0.4525383
12 -0.5246745 0.4785489
13 0.3613610 -0.5246745
14 -0.4323167 0.3613610
15 -0.3743083 -0.4323167
16 0.3437834 -0.3743083
17 0.4425757 0.3437834
18 0.4955471 0.4425757
19 0.4870480 0.4955471
20 -0.6354156 0.4870480
21 0.2655534 -0.6354156
22 0.5014022 0.2655534
23 0.4518928 0.5014022
24 0.3704395 0.4518928
25 0.2746319 0.3704395
26 0.4862299 0.2746319
27 0.5123065 0.4862299
28 -0.3529279 0.5123065
29 0.2037422 -0.3529279
30 -0.4868753 0.2037422
31 0.5559608 -0.4868753
32 0.2655534 0.5559608
33 -0.4147392 0.2655534
34 0.3874376 -0.4147392
35 0.3007086 0.3874376
36 0.1952431 0.3007086
37 0.5131247 0.1952431
38 0.3528619 0.5131247
39 0.4601532 0.3528619
40 -0.6647157 0.4601532
41 0.6198366 -0.6647157
42 0.4258162 0.6198366
43 0.6640702 0.4258162
44 -0.5741838 0.6640702
45 0.2916301 -0.5741838
46 0.3267852 0.2916301
47 -0.5220305 0.3267852
48 -0.6822933 -0.5220305
49 0.3918199 -0.6822933
50 0.3977626 0.3918199
51 -0.5422521 0.3977626
52 -0.5228486 -0.5422521
53 -0.6178380 -0.5228486
54 -0.6647157 -0.6178380
55 0.3528619 -0.6647157
56 -0.6386390 0.3528619
57 -0.7429457 -0.6386390
58 0.1952431 -0.7429457
59 -0.5137701 0.1952431
60 -0.5741838 -0.5137701
61 0.3443628 -0.5741838
62 -0.5155960 0.3443628
63 -0.5313477 -0.5155960
> 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/wessaorg/rcomp/tmp/72qm81321893612.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/wessaorg/rcomp/tmp/88vej1321893612.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/wessaorg/rcomp/tmp/93f3y1321893612.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/wessaorg/rcomp/tmp/10mgi91321893612.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/11u0f61321893612.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/wessaorg/rcomp/tmp/1293f81321893612.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/wessaorg/rcomp/tmp/13h8am1321893612.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/wessaorg/rcomp/tmp/14z2q21321893612.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/wessaorg/rcomp/tmp/15tcb11321893612.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/wessaorg/rcomp/tmp/167plb1321893612.tab")
+ }
>
> try(system("convert tmp/1a81k1321893612.ps tmp/1a81k1321893612.png",intern=TRUE))
character(0)
> try(system("convert tmp/2u6ck1321893612.ps tmp/2u6ck1321893612.png",intern=TRUE))
character(0)
> try(system("convert tmp/3nei51321893612.ps tmp/3nei51321893612.png",intern=TRUE))
character(0)
> try(system("convert tmp/4b8n81321893612.ps tmp/4b8n81321893612.png",intern=TRUE))
character(0)
> try(system("convert tmp/5yes21321893612.ps tmp/5yes21321893612.png",intern=TRUE))
character(0)
> try(system("convert tmp/65rr31321893612.ps tmp/65rr31321893612.png",intern=TRUE))
character(0)
> try(system("convert tmp/72qm81321893612.ps tmp/72qm81321893612.png",intern=TRUE))
character(0)
> try(system("convert tmp/88vej1321893612.ps tmp/88vej1321893612.png",intern=TRUE))
character(0)
> try(system("convert tmp/93f3y1321893612.ps tmp/93f3y1321893612.png",intern=TRUE))
character(0)
> try(system("convert tmp/10mgi91321893612.ps tmp/10mgi91321893612.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.481 0.538 4.108