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(83.4,108.8,113.6,128.4,112.9,121.1,104,119.5,109.9,128.7,99,108.7,106.3,105.5,128.9,119.8,111.1,111.3,102.9,110.6,130,120.1,87,97.5,87.5,107.7,117.6,127.3,103.4,117.2,110.8,119.8,112.6,116.2,102.5,111,112.4,112.4,135.6,130.6,105.1,109.1,127.7,118.8,137,123.9,91,101.6,90.5,112.8,122.4,128,123.3,129.6,124.3,125.8,120,119.5,118.1,115.7,119,113.6,142.7,129.7,123.6,112,129.6,116.8,151.6,127,110.4,112.1,99.2,114.2,130.5,121.1,136.2,131.6,129.7,125,128,120.4,121.6,117.7,135.8,117.5,143.8,120.6,147.5,127.5,136.2,112.3,156.6,124.5,123.3,115.2,104.5,104.7,139.8,130.9,136.5,129.2,112.1,113.5,118.5,125.6,94.4,107.6,102.3,107,111.4,121.6,99.2,110.7,87.8,106.3,115.8,118.6,79.7,104.6),dim=c(2,60),dimnames=list(c('inv','cons'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('inv','cons'),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 = '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
inv cons M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 83.4 108.8 1 0 0 0 0 0 0 0 0 0 0
2 113.6 128.4 0 1 0 0 0 0 0 0 0 0 0
3 112.9 121.1 0 0 1 0 0 0 0 0 0 0 0
4 104.0 119.5 0 0 0 1 0 0 0 0 0 0 0
5 109.9 128.7 0 0 0 0 1 0 0 0 0 0 0
6 99.0 108.7 0 0 0 0 0 1 0 0 0 0 0
7 106.3 105.5 0 0 0 0 0 0 1 0 0 0 0
8 128.9 119.8 0 0 0 0 0 0 0 1 0 0 0
9 111.1 111.3 0 0 0 0 0 0 0 0 1 0 0
10 102.9 110.6 0 0 0 0 0 0 0 0 0 1 0
11 130.0 120.1 0 0 0 0 0 0 0 0 0 0 1
12 87.0 97.5 0 0 0 0 0 0 0 0 0 0 0
13 87.5 107.7 1 0 0 0 0 0 0 0 0 0 0
14 117.6 127.3 0 1 0 0 0 0 0 0 0 0 0
15 103.4 117.2 0 0 1 0 0 0 0 0 0 0 0
16 110.8 119.8 0 0 0 1 0 0 0 0 0 0 0
17 112.6 116.2 0 0 0 0 1 0 0 0 0 0 0
18 102.5 111.0 0 0 0 0 0 1 0 0 0 0 0
19 112.4 112.4 0 0 0 0 0 0 1 0 0 0 0
20 135.6 130.6 0 0 0 0 0 0 0 1 0 0 0
21 105.1 109.1 0 0 0 0 0 0 0 0 1 0 0
22 127.7 118.8 0 0 0 0 0 0 0 0 0 1 0
23 137.0 123.9 0 0 0 0 0 0 0 0 0 0 1
24 91.0 101.6 0 0 0 0 0 0 0 0 0 0 0
25 90.5 112.8 1 0 0 0 0 0 0 0 0 0 0
26 122.4 128.0 0 1 0 0 0 0 0 0 0 0 0
27 123.3 129.6 0 0 1 0 0 0 0 0 0 0 0
28 124.3 125.8 0 0 0 1 0 0 0 0 0 0 0
29 120.0 119.5 0 0 0 0 1 0 0 0 0 0 0
30 118.1 115.7 0 0 0 0 0 1 0 0 0 0 0
31 119.0 113.6 0 0 0 0 0 0 1 0 0 0 0
32 142.7 129.7 0 0 0 0 0 0 0 1 0 0 0
33 123.6 112.0 0 0 0 0 0 0 0 0 1 0 0
34 129.6 116.8 0 0 0 0 0 0 0 0 0 1 0
35 151.6 127.0 0 0 0 0 0 0 0 0 0 0 1
36 110.4 112.1 0 0 0 0 0 0 0 0 0 0 0
37 99.2 114.2 1 0 0 0 0 0 0 0 0 0 0
38 130.5 121.1 0 1 0 0 0 0 0 0 0 0 0
39 136.2 131.6 0 0 1 0 0 0 0 0 0 0 0
40 129.7 125.0 0 0 0 1 0 0 0 0 0 0 0
41 128.0 120.4 0 0 0 0 1 0 0 0 0 0 0
42 121.6 117.7 0 0 0 0 0 1 0 0 0 0 0
43 135.8 117.5 0 0 0 0 0 0 1 0 0 0 0
44 143.8 120.6 0 0 0 0 0 0 0 1 0 0 0
45 147.5 127.5 0 0 0 0 0 0 0 0 1 0 0
46 136.2 112.3 0 0 0 0 0 0 0 0 0 1 0
47 156.6 124.5 0 0 0 0 0 0 0 0 0 0 1
48 123.3 115.2 0 0 0 0 0 0 0 0 0 0 0
49 104.5 104.7 1 0 0 0 0 0 0 0 0 0 0
50 139.8 130.9 0 1 0 0 0 0 0 0 0 0 0
51 136.5 129.2 0 0 1 0 0 0 0 0 0 0 0
52 112.1 113.5 0 0 0 1 0 0 0 0 0 0 0
53 118.5 125.6 0 0 0 0 1 0 0 0 0 0 0
54 94.4 107.6 0 0 0 0 0 1 0 0 0 0 0
55 102.3 107.0 0 0 0 0 0 0 1 0 0 0 0
56 111.4 121.6 0 0 0 0 0 0 0 1 0 0 0
57 99.2 110.7 0 0 0 0 0 0 0 0 1 0 0
58 87.8 106.3 0 0 0 0 0 0 0 0 0 1 0
59 115.8 118.6 0 0 0 0 0 0 0 0 0 0 1
60 79.7 104.6 0 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) cons M1 M2 M3 M4
-100.31179 1.86998 -11.69273 -12.65736 -12.35939 -9.25210
M5 M6 M7 M8 M9 M10
-10.17527 -2.26768 7.53010 0.05418 4.20976 5.91894
M11
8.84095
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-20.279 -5.225 -0.905 5.580 20.718
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -100.31179 30.42190 -3.297 0.00186 **
cons 1.86998 0.28311 6.605 3.25e-08 ***
M1 -11.69273 6.62872 -1.764 0.08424 .
M2 -12.65736 8.83951 -1.432 0.15879
M3 -12.35939 8.57873 -1.441 0.15630
M4 -9.25210 7.73886 -1.196 0.23787
M5 -10.17527 7.95008 -1.280 0.20686
M6 -2.26768 6.76901 -0.335 0.73911
M7 7.53010 6.70785 1.123 0.26732
M8 0.05418 8.34964 0.006 0.99485
M9 4.20976 6.92958 0.608 0.54644
M10 5.91894 6.83039 0.867 0.39059
M11 8.84095 8.07041 1.095 0.27889
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 10.37 on 47 degrees of freedom
Multiple R-squared: 0.7309, Adjusted R-squared: 0.6621
F-statistic: 10.64 on 12 and 47 DF, p-value: 9.792e-10
> 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.0824658523 0.1649317046 0.9175341
[2,] 0.0540968771 0.1081937543 0.9459031
[3,] 0.0218709080 0.0437418160 0.9781291
[4,] 0.0104769814 0.0209539629 0.9895230
[5,] 0.0043605667 0.0087211334 0.9956394
[6,] 0.0020095507 0.0040191014 0.9979904
[7,] 0.0198945350 0.0397890701 0.9801055
[8,] 0.0098866394 0.0197732789 0.9901134
[9,] 0.0043304022 0.0086608043 0.9956696
[10,] 0.0024387683 0.0048775366 0.9975612
[11,] 0.0020144975 0.0040289949 0.9979855
[12,] 0.0012202888 0.0024405776 0.9987797
[13,] 0.0014717144 0.0029434288 0.9985283
[14,] 0.0018554928 0.0037109857 0.9981445
[15,] 0.0017184751 0.0034369502 0.9982815
[16,] 0.0008219414 0.0016438828 0.9991781
[17,] 0.0004071204 0.0008142408 0.9995929
[18,] 0.0008099178 0.0016198356 0.9991901
[19,] 0.0006971274 0.0013942548 0.9993029
[20,] 0.0005414467 0.0010828934 0.9994586
[21,] 0.0002297536 0.0004595071 0.9997702
[22,] 0.0004505985 0.0009011969 0.9995494
[23,] 0.0029895275 0.0059790550 0.9970105
[24,] 0.0021087818 0.0042175637 0.9978912
[25,] 0.0025939275 0.0051878550 0.9974061
[26,] 0.0084294816 0.0168589632 0.9915705
[27,] 0.0046874555 0.0093749110 0.9953125
[28,] 0.0027480487 0.0054960974 0.9972520
[29,] 0.0417931566 0.0835863132 0.9582068
> postscript(file="/var/www/html/rcomp/tmp/1v1te1258787635.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/25o8m1258787635.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/3vxux1258787635.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/4iifa1258787635.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/53lgx1258787635.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
-8.04921746 -13.53617380 -0.88329647 -9.89862537 -20.27926236 -1.68727152
7 8 9 10 11 12
1.79888149 5.13410311 -0.92665863 -9.52684907 -3.11365655 4.98881911
13 14 15 16 17 18
-1.89224034 -7.47919667 -3.09037756 -3.65961913 5.79547775 -2.48822370
19 20 21 22 23 24
-5.00397505 -8.36167234 -2.81270437 -0.06067858 -3.21957755 1.32190436
25 26 27 28 29 30
-8.42913430 -3.98818212 -6.37811974 -1.37949438 7.02454636 4.32287402
31 32 33 34 35 36
-0.64795010 0.42130895 10.26435592 5.57927984 5.58348691 1.08712267
37 38 39 40 41 42
-2.34710519 17.01467442 2.78192184 5.51648899 13.34156507 4.08291560
43 44 45 46 47 48
8.85913099 18.53811974 5.17967819 20.59418628 15.25843493 8.19018712
49 50 51 52 53 54
20.71769729 7.98887818 7.56987194 9.42124988 -5.88232681 -4.23029439
55 56 57 58 59 60
-5.00608732 -15.73185946 -11.70467111 -16.58593847 -14.50868774 -15.58803327
> postscript(file="/var/www/html/rcomp/tmp/6gcdf1258787635.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 -8.04921746 NA
1 -13.53617380 -8.04921746
2 -0.88329647 -13.53617380
3 -9.89862537 -0.88329647
4 -20.27926236 -9.89862537
5 -1.68727152 -20.27926236
6 1.79888149 -1.68727152
7 5.13410311 1.79888149
8 -0.92665863 5.13410311
9 -9.52684907 -0.92665863
10 -3.11365655 -9.52684907
11 4.98881911 -3.11365655
12 -1.89224034 4.98881911
13 -7.47919667 -1.89224034
14 -3.09037756 -7.47919667
15 -3.65961913 -3.09037756
16 5.79547775 -3.65961913
17 -2.48822370 5.79547775
18 -5.00397505 -2.48822370
19 -8.36167234 -5.00397505
20 -2.81270437 -8.36167234
21 -0.06067858 -2.81270437
22 -3.21957755 -0.06067858
23 1.32190436 -3.21957755
24 -8.42913430 1.32190436
25 -3.98818212 -8.42913430
26 -6.37811974 -3.98818212
27 -1.37949438 -6.37811974
28 7.02454636 -1.37949438
29 4.32287402 7.02454636
30 -0.64795010 4.32287402
31 0.42130895 -0.64795010
32 10.26435592 0.42130895
33 5.57927984 10.26435592
34 5.58348691 5.57927984
35 1.08712267 5.58348691
36 -2.34710519 1.08712267
37 17.01467442 -2.34710519
38 2.78192184 17.01467442
39 5.51648899 2.78192184
40 13.34156507 5.51648899
41 4.08291560 13.34156507
42 8.85913099 4.08291560
43 18.53811974 8.85913099
44 5.17967819 18.53811974
45 20.59418628 5.17967819
46 15.25843493 20.59418628
47 8.19018712 15.25843493
48 20.71769729 8.19018712
49 7.98887818 20.71769729
50 7.56987194 7.98887818
51 9.42124988 7.56987194
52 -5.88232681 9.42124988
53 -4.23029439 -5.88232681
54 -5.00608732 -4.23029439
55 -15.73185946 -5.00608732
56 -11.70467111 -15.73185946
57 -16.58593847 -11.70467111
58 -14.50868774 -16.58593847
59 -15.58803327 -14.50868774
60 NA -15.58803327
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -13.53617380 -8.04921746
[2,] -0.88329647 -13.53617380
[3,] -9.89862537 -0.88329647
[4,] -20.27926236 -9.89862537
[5,] -1.68727152 -20.27926236
[6,] 1.79888149 -1.68727152
[7,] 5.13410311 1.79888149
[8,] -0.92665863 5.13410311
[9,] -9.52684907 -0.92665863
[10,] -3.11365655 -9.52684907
[11,] 4.98881911 -3.11365655
[12,] -1.89224034 4.98881911
[13,] -7.47919667 -1.89224034
[14,] -3.09037756 -7.47919667
[15,] -3.65961913 -3.09037756
[16,] 5.79547775 -3.65961913
[17,] -2.48822370 5.79547775
[18,] -5.00397505 -2.48822370
[19,] -8.36167234 -5.00397505
[20,] -2.81270437 -8.36167234
[21,] -0.06067858 -2.81270437
[22,] -3.21957755 -0.06067858
[23,] 1.32190436 -3.21957755
[24,] -8.42913430 1.32190436
[25,] -3.98818212 -8.42913430
[26,] -6.37811974 -3.98818212
[27,] -1.37949438 -6.37811974
[28,] 7.02454636 -1.37949438
[29,] 4.32287402 7.02454636
[30,] -0.64795010 4.32287402
[31,] 0.42130895 -0.64795010
[32,] 10.26435592 0.42130895
[33,] 5.57927984 10.26435592
[34,] 5.58348691 5.57927984
[35,] 1.08712267 5.58348691
[36,] -2.34710519 1.08712267
[37,] 17.01467442 -2.34710519
[38,] 2.78192184 17.01467442
[39,] 5.51648899 2.78192184
[40,] 13.34156507 5.51648899
[41,] 4.08291560 13.34156507
[42,] 8.85913099 4.08291560
[43,] 18.53811974 8.85913099
[44,] 5.17967819 18.53811974
[45,] 20.59418628 5.17967819
[46,] 15.25843493 20.59418628
[47,] 8.19018712 15.25843493
[48,] 20.71769729 8.19018712
[49,] 7.98887818 20.71769729
[50,] 7.56987194 7.98887818
[51,] 9.42124988 7.56987194
[52,] -5.88232681 9.42124988
[53,] -4.23029439 -5.88232681
[54,] -5.00608732 -4.23029439
[55,] -15.73185946 -5.00608732
[56,] -11.70467111 -15.73185946
[57,] -16.58593847 -11.70467111
[58,] -14.50868774 -16.58593847
[59,] -15.58803327 -14.50868774
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -13.53617380 -8.04921746
2 -0.88329647 -13.53617380
3 -9.89862537 -0.88329647
4 -20.27926236 -9.89862537
5 -1.68727152 -20.27926236
6 1.79888149 -1.68727152
7 5.13410311 1.79888149
8 -0.92665863 5.13410311
9 -9.52684907 -0.92665863
10 -3.11365655 -9.52684907
11 4.98881911 -3.11365655
12 -1.89224034 4.98881911
13 -7.47919667 -1.89224034
14 -3.09037756 -7.47919667
15 -3.65961913 -3.09037756
16 5.79547775 -3.65961913
17 -2.48822370 5.79547775
18 -5.00397505 -2.48822370
19 -8.36167234 -5.00397505
20 -2.81270437 -8.36167234
21 -0.06067858 -2.81270437
22 -3.21957755 -0.06067858
23 1.32190436 -3.21957755
24 -8.42913430 1.32190436
25 -3.98818212 -8.42913430
26 -6.37811974 -3.98818212
27 -1.37949438 -6.37811974
28 7.02454636 -1.37949438
29 4.32287402 7.02454636
30 -0.64795010 4.32287402
31 0.42130895 -0.64795010
32 10.26435592 0.42130895
33 5.57927984 10.26435592
34 5.58348691 5.57927984
35 1.08712267 5.58348691
36 -2.34710519 1.08712267
37 17.01467442 -2.34710519
38 2.78192184 17.01467442
39 5.51648899 2.78192184
40 13.34156507 5.51648899
41 4.08291560 13.34156507
42 8.85913099 4.08291560
43 18.53811974 8.85913099
44 5.17967819 18.53811974
45 20.59418628 5.17967819
46 15.25843493 20.59418628
47 8.19018712 15.25843493
48 20.71769729 8.19018712
49 7.98887818 20.71769729
50 7.56987194 7.98887818
51 9.42124988 7.56987194
52 -5.88232681 9.42124988
53 -4.23029439 -5.88232681
54 -5.00608732 -4.23029439
55 -15.73185946 -5.00608732
56 -11.70467111 -15.73185946
57 -16.58593847 -11.70467111
58 -14.50868774 -16.58593847
59 -15.58803327 -14.50868774
> 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/7mmz41258787635.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/8nd1x1258787635.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/93vl01258787635.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/103q801258787636.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/11rztc1258787636.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/12dn0a1258787636.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/13ee0n1258787636.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/14xfb21258787636.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/15nb231258787636.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/1621nv1258787636.tab")
+ }
>
> system("convert tmp/1v1te1258787635.ps tmp/1v1te1258787635.png")
> system("convert tmp/25o8m1258787635.ps tmp/25o8m1258787635.png")
> system("convert tmp/3vxux1258787635.ps tmp/3vxux1258787635.png")
> system("convert tmp/4iifa1258787635.ps tmp/4iifa1258787635.png")
> system("convert tmp/53lgx1258787635.ps tmp/53lgx1258787635.png")
> system("convert tmp/6gcdf1258787635.ps tmp/6gcdf1258787635.png")
> system("convert tmp/7mmz41258787635.ps tmp/7mmz41258787635.png")
> system("convert tmp/8nd1x1258787635.ps tmp/8nd1x1258787635.png")
> system("convert tmp/93vl01258787635.ps tmp/93vl01258787635.png")
> system("convert tmp/103q801258787636.ps tmp/103q801258787636.png")
>
>
> proc.time()
user system elapsed
2.378 1.529 3.058