R version 2.12.0 (2010-10-15)
Copyright (C) 2010 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(20,1,14,3,1,1,14,1,8,3,0,1,18,0,12,6,1,1,12,1,7,2,0,1,16,0,10,1,1,0,13,0,7,2,0,0,22,1,16,8,1,1,16,1,11,1,1,0,20,0,14,4,1,1,10,0,6,0,0,0,22,0,16,4,1,0,17,1,11,2,0,1,21,0,16,1,1,1,18,1,12,2,1,1,13,0,7,3,0,0,17,0,13,1,1,0,17,1,11,2,1,1,19,1,15,6,1,0,12,1,7,0,0,1,14,1,9,1,0,1,13,0,7,3,0,1,20,1,14,5,1,1,20,1,15,0,1,1,13,1,7,1,0,1,21,1,15,3,1,1,21,1,17,6,1,1,19,1,15,5,1,0,18,1,14,4,1,0,20,0,14,4,0,0,14,1,8,4,1,1,14,0,8,0,0,1,20,1,14,3,1,0,21,1,14,5,1,1,14,0,8,3,0,0,16,1,11,1,1,1,21,1,16,5,1,1,16,1,10,5,1,1,14,1,8,0,0,1,19,1,14,3,1,1,22,1,16,6,1,0,19,0,13,3,1,1,11,1,5,1,0,0,13,1,8,2,0,1,16,1,10,2,0,0,14,0,8,2,0,1,19,1,13,4,1,1,21,1,15,4,1,1,12,0,6,0,0,1,17,0,12,3,1,1,21,1,16,6,0,1,11,1,5,3,1,0,19,0,15,1,1,1,18,0,12,4,1,0,14,0,8,3,0,1,19,0,13,3,1,1,20,1,14,3,1,1,18,0,12,2,1,1,22,0,16,6,1,1,16,1,10,5,1,1,20,0,15,5,1,0,14,0,8,2,0,1,22,1,16,4,1,1,25,0,19,2,1,1,20,0,14,5,1,0),dim=c(6,64),dimnames=list(c('Income','Change','Size','Complex','Big4','Product'),1:64))
> y <- array(NA,dim=c(6,64),dimnames=list(c('Income','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 = '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
Income Change Size Complex Big4 Product t
1 20 1 14 3 1 1 1
2 14 1 8 3 0 1 2
3 18 0 12 6 1 1 3
4 12 1 7 2 0 1 4
5 16 0 10 1 1 0 5
6 13 0 7 2 0 0 6
7 22 1 16 8 1 1 7
8 16 1 11 1 1 0 8
9 20 0 14 4 1 1 9
10 10 0 6 0 0 0 10
11 22 0 16 4 1 0 11
12 17 1 11 2 0 1 12
13 21 0 16 1 1 1 13
14 18 1 12 2 1 1 14
15 13 0 7 3 0 0 15
16 17 0 13 1 1 0 16
17 17 1 11 2 1 1 17
18 19 1 15 6 1 0 18
19 12 1 7 0 0 1 19
20 14 1 9 1 0 1 20
21 13 0 7 3 0 1 21
22 20 1 14 5 1 1 22
23 20 1 15 0 1 1 23
24 13 1 7 1 0 1 24
25 21 1 15 3 1 1 25
26 21 1 17 6 1 1 26
27 19 1 15 5 1 0 27
28 18 1 14 4 1 0 28
29 20 0 14 4 0 0 29
30 14 1 8 4 1 1 30
31 14 0 8 0 0 1 31
32 20 1 14 3 1 0 32
33 21 1 14 5 1 1 33
34 14 0 8 3 0 0 34
35 16 1 11 1 1 1 35
36 21 1 16 5 1 1 36
37 16 1 10 5 1 1 37
38 14 1 8 0 0 1 38
39 19 1 14 3 1 1 39
40 22 1 16 6 1 0 40
41 19 0 13 3 1 1 41
42 11 1 5 1 0 0 42
43 13 1 8 2 0 1 43
44 16 1 10 2 0 0 44
45 14 0 8 2 0 1 45
46 19 1 13 4 1 1 46
47 21 1 15 4 1 1 47
48 12 0 6 0 0 1 48
49 17 0 12 3 1 1 49
50 21 1 16 6 0 1 50
51 11 1 5 3 1 0 51
52 19 0 15 1 1 1 52
53 18 0 12 4 1 0 53
54 14 0 8 3 0 1 54
55 19 0 13 3 1 1 55
56 20 1 14 3 1 1 56
57 18 0 12 2 1 1 57
58 22 0 16 6 1 1 58
59 16 1 10 5 1 1 59
60 20 0 15 5 1 0 60
61 14 0 8 2 0 1 61
62 22 1 16 4 1 1 62
63 25 0 19 2 1 1 63
64 20 0 14 5 1 0 64
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Change Size Complex Big4 Product
5.859836 -0.193750 0.918766 0.111644 0.098764 0.363758
t
0.004502
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.5345 -0.5008 0.1618 0.4409 1.3019
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.859836 0.358551 16.343 <2e-16 ***
Change -0.193750 0.180539 -1.073 0.2877
Size 0.918766 0.036376 25.257 <2e-16 ***
Complex 0.111644 0.055308 2.019 0.0482 *
Big4 0.098764 0.251436 0.393 0.6959
Product 0.363758 0.189636 1.918 0.0601 .
t 0.004502 0.004752 0.947 0.3474
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.6773 on 57 degrees of freedom
Multiple R-squared: 0.9661, Adjusted R-squared: 0.9626
F-statistic: 270.9 on 6 and 57 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.5200402 0.95991957 0.47995978
[2,] 0.3780108 0.75602163 0.62198918
[3,] 0.5116037 0.97679264 0.48839632
[4,] 0.4782458 0.95649155 0.52175423
[5,] 0.5978518 0.80429644 0.40214822
[6,] 0.5508708 0.89825834 0.44912917
[7,] 0.6998765 0.60024693 0.30012346
[8,] 0.6652859 0.66942826 0.33471413
[9,] 0.8283125 0.34337497 0.17168748
[10,] 0.7749418 0.45011642 0.22505821
[11,] 0.7128962 0.57420757 0.28710378
[12,] 0.6427032 0.71459363 0.35729681
[13,] 0.6078976 0.78420472 0.39210236
[14,] 0.5231536 0.95369282 0.47684641
[15,] 0.4936982 0.98739633 0.50630184
[16,] 0.5043826 0.99123481 0.49561740
[17,] 0.7092663 0.58146731 0.29073366
[18,] 0.7716839 0.45663223 0.22831611
[19,] 0.8821231 0.23575378 0.11787689
[20,] 0.9192833 0.16143334 0.08071667
[21,] 0.8941052 0.21178955 0.10589477
[22,] 0.8635631 0.27287381 0.13643691
[23,] 0.9089090 0.18218196 0.09109098
[24,] 0.9785059 0.04298816 0.02149408
[25,] 0.9697817 0.06043665 0.03021833
[26,] 0.9619813 0.07603745 0.03801873
[27,] 0.9522215 0.09555707 0.04777853
[28,] 0.9283924 0.14321519 0.07160760
[29,] 0.9120328 0.17593448 0.08796724
[30,] 0.8961796 0.20764080 0.10382040
[31,] 0.8892585 0.22148305 0.11074152
[32,] 0.8791063 0.24178731 0.12089366
[33,] 0.8411562 0.31768756 0.15884378
[34,] 0.8632286 0.27354288 0.13677144
[35,] 0.8462647 0.30747067 0.15373534
[36,] 0.8102789 0.37944213 0.18972107
[37,] 0.7678642 0.46427166 0.23213583
[38,] 0.7982736 0.40345286 0.20172643
[39,] 0.7746760 0.45064808 0.22532404
[40,] 0.7220031 0.55599376 0.27799688
[41,] 0.6253268 0.74934632 0.37467316
[42,] 0.5117214 0.97655725 0.48827862
[43,] 0.9456768 0.10864640 0.05432320
[44,] 0.9407308 0.11853834 0.05926917
[45,] 0.8762545 0.24749100 0.12374550
> postscript(file="/var/www/rcomp/tmp/1casu1321898480.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/2hk231321898480.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/3k7401321898480.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/4znik1321898480.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/5thly1321898480.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
0.6692358895 0.2760940257 -0.0309172795 -0.7025003046 0.7195867537
6 7 8 9 10
0.4585032742 0.2464737707 -0.0189349491 0.3278261352 -1.4174513758
11 12 13 14 15
0.8450479728 0.5864198688 -0.1927828352 0.5598857284 0.3063417738
16 17 18 19 20
-1.0862330345 0.4651457668 -1.2972369811 -0.5467427640 -0.5004203740
21 22 23 24 25
-0.0844279117 0.3514069377 -0.0136427972 0.3191036701 0.6424222927
26 27 28 29 30
-1.5345426126 -1.2261111863 -1.2002035329 0.7003084297 -0.0603693477
31 32 33 34 35
0.2867172054 0.8934321801 1.3018851176 0.3020380952 -0.5042462911
36 37 38 39 40
-0.5491528120 -0.0410588596 0.4489535574 -0.5018394890 0.6849533894
41 42 43 44 45
0.2141722956 0.4393577268 -0.7968436561 0.7248801652 0.0004021391
46 47 48 49 50
0.2737689672 0.4317350049 0.0477154622 -0.9030775842 -0.6250600469
51 52 53 54 55
0.0767883950 -1.4495942079 0.3310286172 -0.1517593613 0.1511445246
56 57 58 59 60
0.4216267891 0.1725501943 0.0464096627 -0.1401024997 -0.5684268840
61 62 63 64
-0.0716295992 0.4454392609 0.7141763670 0.3323311708
> postscript(file="/var/www/rcomp/tmp/6x58m1321898480.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.6692358895 NA
1 0.2760940257 0.6692358895
2 -0.0309172795 0.2760940257
3 -0.7025003046 -0.0309172795
4 0.7195867537 -0.7025003046
5 0.4585032742 0.7195867537
6 0.2464737707 0.4585032742
7 -0.0189349491 0.2464737707
8 0.3278261352 -0.0189349491
9 -1.4174513758 0.3278261352
10 0.8450479728 -1.4174513758
11 0.5864198688 0.8450479728
12 -0.1927828352 0.5864198688
13 0.5598857284 -0.1927828352
14 0.3063417738 0.5598857284
15 -1.0862330345 0.3063417738
16 0.4651457668 -1.0862330345
17 -1.2972369811 0.4651457668
18 -0.5467427640 -1.2972369811
19 -0.5004203740 -0.5467427640
20 -0.0844279117 -0.5004203740
21 0.3514069377 -0.0844279117
22 -0.0136427972 0.3514069377
23 0.3191036701 -0.0136427972
24 0.6424222927 0.3191036701
25 -1.5345426126 0.6424222927
26 -1.2261111863 -1.5345426126
27 -1.2002035329 -1.2261111863
28 0.7003084297 -1.2002035329
29 -0.0603693477 0.7003084297
30 0.2867172054 -0.0603693477
31 0.8934321801 0.2867172054
32 1.3018851176 0.8934321801
33 0.3020380952 1.3018851176
34 -0.5042462911 0.3020380952
35 -0.5491528120 -0.5042462911
36 -0.0410588596 -0.5491528120
37 0.4489535574 -0.0410588596
38 -0.5018394890 0.4489535574
39 0.6849533894 -0.5018394890
40 0.2141722956 0.6849533894
41 0.4393577268 0.2141722956
42 -0.7968436561 0.4393577268
43 0.7248801652 -0.7968436561
44 0.0004021391 0.7248801652
45 0.2737689672 0.0004021391
46 0.4317350049 0.2737689672
47 0.0477154622 0.4317350049
48 -0.9030775842 0.0477154622
49 -0.6250600469 -0.9030775842
50 0.0767883950 -0.6250600469
51 -1.4495942079 0.0767883950
52 0.3310286172 -1.4495942079
53 -0.1517593613 0.3310286172
54 0.1511445246 -0.1517593613
55 0.4216267891 0.1511445246
56 0.1725501943 0.4216267891
57 0.0464096627 0.1725501943
58 -0.1401024997 0.0464096627
59 -0.5684268840 -0.1401024997
60 -0.0716295992 -0.5684268840
61 0.4454392609 -0.0716295992
62 0.7141763670 0.4454392609
63 0.3323311708 0.7141763670
64 NA 0.3323311708
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.2760940257 0.6692358895
[2,] -0.0309172795 0.2760940257
[3,] -0.7025003046 -0.0309172795
[4,] 0.7195867537 -0.7025003046
[5,] 0.4585032742 0.7195867537
[6,] 0.2464737707 0.4585032742
[7,] -0.0189349491 0.2464737707
[8,] 0.3278261352 -0.0189349491
[9,] -1.4174513758 0.3278261352
[10,] 0.8450479728 -1.4174513758
[11,] 0.5864198688 0.8450479728
[12,] -0.1927828352 0.5864198688
[13,] 0.5598857284 -0.1927828352
[14,] 0.3063417738 0.5598857284
[15,] -1.0862330345 0.3063417738
[16,] 0.4651457668 -1.0862330345
[17,] -1.2972369811 0.4651457668
[18,] -0.5467427640 -1.2972369811
[19,] -0.5004203740 -0.5467427640
[20,] -0.0844279117 -0.5004203740
[21,] 0.3514069377 -0.0844279117
[22,] -0.0136427972 0.3514069377
[23,] 0.3191036701 -0.0136427972
[24,] 0.6424222927 0.3191036701
[25,] -1.5345426126 0.6424222927
[26,] -1.2261111863 -1.5345426126
[27,] -1.2002035329 -1.2261111863
[28,] 0.7003084297 -1.2002035329
[29,] -0.0603693477 0.7003084297
[30,] 0.2867172054 -0.0603693477
[31,] 0.8934321801 0.2867172054
[32,] 1.3018851176 0.8934321801
[33,] 0.3020380952 1.3018851176
[34,] -0.5042462911 0.3020380952
[35,] -0.5491528120 -0.5042462911
[36,] -0.0410588596 -0.5491528120
[37,] 0.4489535574 -0.0410588596
[38,] -0.5018394890 0.4489535574
[39,] 0.6849533894 -0.5018394890
[40,] 0.2141722956 0.6849533894
[41,] 0.4393577268 0.2141722956
[42,] -0.7968436561 0.4393577268
[43,] 0.7248801652 -0.7968436561
[44,] 0.0004021391 0.7248801652
[45,] 0.2737689672 0.0004021391
[46,] 0.4317350049 0.2737689672
[47,] 0.0477154622 0.4317350049
[48,] -0.9030775842 0.0477154622
[49,] -0.6250600469 -0.9030775842
[50,] 0.0767883950 -0.6250600469
[51,] -1.4495942079 0.0767883950
[52,] 0.3310286172 -1.4495942079
[53,] -0.1517593613 0.3310286172
[54,] 0.1511445246 -0.1517593613
[55,] 0.4216267891 0.1511445246
[56,] 0.1725501943 0.4216267891
[57,] 0.0464096627 0.1725501943
[58,] -0.1401024997 0.0464096627
[59,] -0.5684268840 -0.1401024997
[60,] -0.0716295992 -0.5684268840
[61,] 0.4454392609 -0.0716295992
[62,] 0.7141763670 0.4454392609
[63,] 0.3323311708 0.7141763670
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.2760940257 0.6692358895
2 -0.0309172795 0.2760940257
3 -0.7025003046 -0.0309172795
4 0.7195867537 -0.7025003046
5 0.4585032742 0.7195867537
6 0.2464737707 0.4585032742
7 -0.0189349491 0.2464737707
8 0.3278261352 -0.0189349491
9 -1.4174513758 0.3278261352
10 0.8450479728 -1.4174513758
11 0.5864198688 0.8450479728
12 -0.1927828352 0.5864198688
13 0.5598857284 -0.1927828352
14 0.3063417738 0.5598857284
15 -1.0862330345 0.3063417738
16 0.4651457668 -1.0862330345
17 -1.2972369811 0.4651457668
18 -0.5467427640 -1.2972369811
19 -0.5004203740 -0.5467427640
20 -0.0844279117 -0.5004203740
21 0.3514069377 -0.0844279117
22 -0.0136427972 0.3514069377
23 0.3191036701 -0.0136427972
24 0.6424222927 0.3191036701
25 -1.5345426126 0.6424222927
26 -1.2261111863 -1.5345426126
27 -1.2002035329 -1.2261111863
28 0.7003084297 -1.2002035329
29 -0.0603693477 0.7003084297
30 0.2867172054 -0.0603693477
31 0.8934321801 0.2867172054
32 1.3018851176 0.8934321801
33 0.3020380952 1.3018851176
34 -0.5042462911 0.3020380952
35 -0.5491528120 -0.5042462911
36 -0.0410588596 -0.5491528120
37 0.4489535574 -0.0410588596
38 -0.5018394890 0.4489535574
39 0.6849533894 -0.5018394890
40 0.2141722956 0.6849533894
41 0.4393577268 0.2141722956
42 -0.7968436561 0.4393577268
43 0.7248801652 -0.7968436561
44 0.0004021391 0.7248801652
45 0.2737689672 0.0004021391
46 0.4317350049 0.2737689672
47 0.0477154622 0.4317350049
48 -0.9030775842 0.0477154622
49 -0.6250600469 -0.9030775842
50 0.0767883950 -0.6250600469
51 -1.4495942079 0.0767883950
52 0.3310286172 -1.4495942079
53 -0.1517593613 0.3310286172
54 0.1511445246 -0.1517593613
55 0.4216267891 0.1511445246
56 0.1725501943 0.4216267891
57 0.0464096627 0.1725501943
58 -0.1401024997 0.0464096627
59 -0.5684268840 -0.1401024997
60 -0.0716295992 -0.5684268840
61 0.4454392609 -0.0716295992
62 0.7141763670 0.4454392609
63 0.3323311708 0.7141763670
> 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/rcomp/tmp/73vtr1321898480.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/8sb851321898480.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/9m1z41321898480.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/www/rcomp/tmp/10l2751321898480.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/rcomp/tmp/11ac6a1321898480.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/rcomp/tmp/12zovs1321898480.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/rcomp/tmp/136gr41321898481.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/rcomp/tmp/14mzqp1321898481.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/rcomp/tmp/15vjhn1321898481.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/rcomp/tmp/16upsh1321898481.tab")
+ }
>
> try(system("convert tmp/1casu1321898480.ps tmp/1casu1321898480.png",intern=TRUE))
character(0)
> try(system("convert tmp/2hk231321898480.ps tmp/2hk231321898480.png",intern=TRUE))
character(0)
> try(system("convert tmp/3k7401321898480.ps tmp/3k7401321898480.png",intern=TRUE))
character(0)
> try(system("convert tmp/4znik1321898480.ps tmp/4znik1321898480.png",intern=TRUE))
character(0)
> try(system("convert tmp/5thly1321898480.ps tmp/5thly1321898480.png",intern=TRUE))
character(0)
> try(system("convert tmp/6x58m1321898480.ps tmp/6x58m1321898480.png",intern=TRUE))
character(0)
> try(system("convert tmp/73vtr1321898480.ps tmp/73vtr1321898480.png",intern=TRUE))
character(0)
> try(system("convert tmp/8sb851321898480.ps tmp/8sb851321898480.png",intern=TRUE))
character(0)
> try(system("convert tmp/9m1z41321898480.ps tmp/9m1z41321898480.png",intern=TRUE))
character(0)
> try(system("convert tmp/10l2751321898480.ps tmp/10l2751321898480.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.450 0.340 4.774