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(4.3,96.2,4.1,96.8,3.9,109.9,3.8,88,3.7,91.1,3.7,106.4,4.1,68.6,4.1,100.1,3.8,108,3.7,106,3.5,108.6,3.6,91.5,4.1,99.2,3.8,98,3.7,96.6,3.6,102.8,3.3,96.9,3.4,110,3.7,70.5,3.7,101.9,3.4,109.6,3.3,107.8,3,113,3,93.8,3.3,108,3,102.8,2.9,116.3,2.8,89.2,2.5,106.7,2.6,112.1,2.8,74.2,2.7,108.8,2.4,111.5,2.2,118.8,2.1,118.9,2.1,97.6,2.3,116.4,2.1,107.9,2,121.2,1.9,97.9,1.7,113.4,1.8,117.6,2.1,79.6,2,115.9,1.8,115.7,1.7,129.1,1.6,123.3,1.6,96.7,1.8,121.2,1.7,118.2,1.7,102.1,1.5,125.4,1.5,116.7,1.5,121.3,1.8,85.3,1.8,114.2,1.7,124.4,1.7,131,1.8,118.3,2,99.6),dim=c(2,60),dimnames=list(c('unempl','proman'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('unempl','proman'),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
unempl proman M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 4.3 96.2 1 0 0 0 0 0 0 0 0 0 0
2 4.1 96.8 0 1 0 0 0 0 0 0 0 0 0
3 3.9 109.9 0 0 1 0 0 0 0 0 0 0 0
4 3.8 88.0 0 0 0 1 0 0 0 0 0 0 0
5 3.7 91.1 0 0 0 0 1 0 0 0 0 0 0
6 3.7 106.4 0 0 0 0 0 1 0 0 0 0 0
7 4.1 68.6 0 0 0 0 0 0 1 0 0 0 0
8 4.1 100.1 0 0 0 0 0 0 0 1 0 0 0
9 3.8 108.0 0 0 0 0 0 0 0 0 1 0 0
10 3.7 106.0 0 0 0 0 0 0 0 0 0 1 0
11 3.5 108.6 0 0 0 0 0 0 0 0 0 0 1
12 3.6 91.5 0 0 0 0 0 0 0 0 0 0 0
13 4.1 99.2 1 0 0 0 0 0 0 0 0 0 0
14 3.8 98.0 0 1 0 0 0 0 0 0 0 0 0
15 3.7 96.6 0 0 1 0 0 0 0 0 0 0 0
16 3.6 102.8 0 0 0 1 0 0 0 0 0 0 0
17 3.3 96.9 0 0 0 0 1 0 0 0 0 0 0
18 3.4 110.0 0 0 0 0 0 1 0 0 0 0 0
19 3.7 70.5 0 0 0 0 0 0 1 0 0 0 0
20 3.7 101.9 0 0 0 0 0 0 0 1 0 0 0
21 3.4 109.6 0 0 0 0 0 0 0 0 1 0 0
22 3.3 107.8 0 0 0 0 0 0 0 0 0 1 0
23 3.0 113.0 0 0 0 0 0 0 0 0 0 0 1
24 3.0 93.8 0 0 0 0 0 0 0 0 0 0 0
25 3.3 108.0 1 0 0 0 0 0 0 0 0 0 0
26 3.0 102.8 0 1 0 0 0 0 0 0 0 0 0
27 2.9 116.3 0 0 1 0 0 0 0 0 0 0 0
28 2.8 89.2 0 0 0 1 0 0 0 0 0 0 0
29 2.5 106.7 0 0 0 0 1 0 0 0 0 0 0
30 2.6 112.1 0 0 0 0 0 1 0 0 0 0 0
31 2.8 74.2 0 0 0 0 0 0 1 0 0 0 0
32 2.7 108.8 0 0 0 0 0 0 0 1 0 0 0
33 2.4 111.5 0 0 0 0 0 0 0 0 1 0 0
34 2.2 118.8 0 0 0 0 0 0 0 0 0 1 0
35 2.1 118.9 0 0 0 0 0 0 0 0 0 0 1
36 2.1 97.6 0 0 0 0 0 0 0 0 0 0 0
37 2.3 116.4 1 0 0 0 0 0 0 0 0 0 0
38 2.1 107.9 0 1 0 0 0 0 0 0 0 0 0
39 2.0 121.2 0 0 1 0 0 0 0 0 0 0 0
40 1.9 97.9 0 0 0 1 0 0 0 0 0 0 0
41 1.7 113.4 0 0 0 0 1 0 0 0 0 0 0
42 1.8 117.6 0 0 0 0 0 1 0 0 0 0 0
43 2.1 79.6 0 0 0 0 0 0 1 0 0 0 0
44 2.0 115.9 0 0 0 0 0 0 0 1 0 0 0
45 1.8 115.7 0 0 0 0 0 0 0 0 1 0 0
46 1.7 129.1 0 0 0 0 0 0 0 0 0 1 0
47 1.6 123.3 0 0 0 0 0 0 0 0 0 0 1
48 1.6 96.7 0 0 0 0 0 0 0 0 0 0 0
49 1.8 121.2 1 0 0 0 0 0 0 0 0 0 0
50 1.7 118.2 0 1 0 0 0 0 0 0 0 0 0
51 1.7 102.1 0 0 1 0 0 0 0 0 0 0 0
52 1.5 125.4 0 0 0 1 0 0 0 0 0 0 0
53 1.5 116.7 0 0 0 0 1 0 0 0 0 0 0
54 1.5 121.3 0 0 0 0 0 1 0 0 0 0 0
55 1.8 85.3 0 0 0 0 0 0 1 0 0 0 0
56 1.8 114.2 0 0 0 0 0 0 0 1 0 0 0
57 1.7 124.4 0 0 0 0 0 0 0 0 1 0 0
58 1.7 131.0 0 0 0 0 0 0 0 0 0 1 0
59 1.8 118.3 0 0 0 0 0 0 0 0 0 0 1
60 2.0 99.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) proman M1 M2 M3 M4
10.73621 -0.08635 1.76734 1.24855 1.53542 0.67623
M5 M6 M7 M8 M9 M10
0.86755 1.66329 -1.30436 1.46561 1.71438 2.02025
M11
1.71717
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.75484 -0.23169 -0.03154 0.31754 1.11872
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 10.736212 0.906545 11.843 1.04e-15 ***
proman -0.086354 0.009075 -9.516 1.55e-12 ***
M1 1.767341 0.378500 4.669 2.55e-05 ***
M2 1.248555 0.370410 3.371 0.001507 **
M3 1.535423 0.381345 4.026 0.000205 ***
M4 0.676229 0.364134 1.857 0.069572 .
M5 0.867553 0.370851 2.339 0.023618 *
M6 1.663293 0.395358 4.207 0.000115 ***
M7 -1.304360 0.405322 -3.218 0.002340 **
M8 1.465614 0.378446 3.873 0.000332 ***
M9 1.714380 0.396692 4.322 7.97e-05 ***
M10 2.020246 0.416075 4.855 1.37e-05 ***
M11 1.717175 0.406893 4.220 0.000111 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.5716 on 47 degrees of freedom
Multiple R-squared: 0.6788, Adjusted R-squared: 0.5968
F-statistic: 8.278 on 12 and 47 DF, p-value: 4.406e-08
> 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.05828631 0.116572627 0.941713686
[2,] 0.04215368 0.084307360 0.957846320
[3,] 0.02570983 0.051419666 0.974290167
[4,] 0.02369567 0.047391348 0.976304326
[5,] 0.02269115 0.045382306 0.977308847
[6,] 0.02569326 0.051386519 0.974306741
[7,] 0.02174451 0.043489014 0.978255493
[8,] 0.02665464 0.053309274 0.973345363
[9,] 0.05196065 0.103921309 0.948039345
[10,] 0.10884450 0.217688996 0.891155502
[11,] 0.23306801 0.466136010 0.766931995
[12,] 0.42676760 0.853535197 0.573232401
[13,] 0.74989948 0.500201042 0.250100521
[14,] 0.79162160 0.416756794 0.208378397
[15,] 0.90441847 0.191163058 0.095581529
[16,] 0.96254938 0.074901247 0.037450624
[17,] 0.98814987 0.023700267 0.011850133
[18,] 0.99619624 0.007607517 0.003803758
[19,] 0.99596004 0.008079915 0.004039958
[20,] 0.99642846 0.007143077 0.003571538
[21,] 0.99649072 0.007018566 0.003509283
[22,] 0.99696994 0.006060129 0.003030064
[23,] 0.99663247 0.006735059 0.003367529
[24,] 0.99851662 0.002966761 0.001483381
[25,] 0.99713205 0.005735895 0.002867948
[26,] 0.99188743 0.016225137 0.008112569
[27,] 0.98487512 0.030249758 0.015124879
[28,] 0.97131960 0.057360803 0.028680401
[29,] 0.93275908 0.134481844 0.067240922
> postscript(file="/var/www/html/rcomp/tmp/1f1fd1258665198.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/2z4f71258665198.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/33z9t1258665198.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/401871258665198.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/568g31258665198.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
0.103746422 0.474345549 1.118721036 -0.013247525 -0.036872883 0.488610389
7 8 9 10 11 12
0.592064567 0.542255924 0.675689925 0.097115011 0.424708085 0.765221622
13 14 15 16 17 18
0.162809816 0.277970907 -0.229793347 1.064798555 0.063983013 0.499486462
19 20 21 22 23 24
0.356138051 0.297693961 0.413857069 -0.147446953 0.304667730 0.363836892
25 26 27 28 29 30
0.122729107 -0.107527662 0.671389611 -0.909622167 0.110256769 -0.119169162
31 32 33 34 35 36
-0.224350429 -0.106460232 -0.422069448 -0.297547839 -0.085840927 -0.208016142
37 38 39 40 41 42
-0.151893388 -0.567119891 0.194526489 -1.058338323 -0.111168317 -0.444219605
43 44 45 46 47 48
-0.458036319 -0.193343531 -0.659380695 0.091903149 -0.205881282 -0.785735160
49 50 51 52 53 54
-0.237391957 -0.077668903 -1.754843790 0.916409461 -0.026198582 -0.424708085
55 56 57 58 59 60
-0.265815869 -0.540146121 -0.008096851 0.255976632 -0.437653606 -0.135307212
> postscript(file="/var/www/html/rcomp/tmp/6wvyi1258665198.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 0.103746422 NA
1 0.474345549 0.103746422
2 1.118721036 0.474345549
3 -0.013247525 1.118721036
4 -0.036872883 -0.013247525
5 0.488610389 -0.036872883
6 0.592064567 0.488610389
7 0.542255924 0.592064567
8 0.675689925 0.542255924
9 0.097115011 0.675689925
10 0.424708085 0.097115011
11 0.765221622 0.424708085
12 0.162809816 0.765221622
13 0.277970907 0.162809816
14 -0.229793347 0.277970907
15 1.064798555 -0.229793347
16 0.063983013 1.064798555
17 0.499486462 0.063983013
18 0.356138051 0.499486462
19 0.297693961 0.356138051
20 0.413857069 0.297693961
21 -0.147446953 0.413857069
22 0.304667730 -0.147446953
23 0.363836892 0.304667730
24 0.122729107 0.363836892
25 -0.107527662 0.122729107
26 0.671389611 -0.107527662
27 -0.909622167 0.671389611
28 0.110256769 -0.909622167
29 -0.119169162 0.110256769
30 -0.224350429 -0.119169162
31 -0.106460232 -0.224350429
32 -0.422069448 -0.106460232
33 -0.297547839 -0.422069448
34 -0.085840927 -0.297547839
35 -0.208016142 -0.085840927
36 -0.151893388 -0.208016142
37 -0.567119891 -0.151893388
38 0.194526489 -0.567119891
39 -1.058338323 0.194526489
40 -0.111168317 -1.058338323
41 -0.444219605 -0.111168317
42 -0.458036319 -0.444219605
43 -0.193343531 -0.458036319
44 -0.659380695 -0.193343531
45 0.091903149 -0.659380695
46 -0.205881282 0.091903149
47 -0.785735160 -0.205881282
48 -0.237391957 -0.785735160
49 -0.077668903 -0.237391957
50 -1.754843790 -0.077668903
51 0.916409461 -1.754843790
52 -0.026198582 0.916409461
53 -0.424708085 -0.026198582
54 -0.265815869 -0.424708085
55 -0.540146121 -0.265815869
56 -0.008096851 -0.540146121
57 0.255976632 -0.008096851
58 -0.437653606 0.255976632
59 -0.135307212 -0.437653606
60 NA -0.135307212
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.474345549 0.103746422
[2,] 1.118721036 0.474345549
[3,] -0.013247525 1.118721036
[4,] -0.036872883 -0.013247525
[5,] 0.488610389 -0.036872883
[6,] 0.592064567 0.488610389
[7,] 0.542255924 0.592064567
[8,] 0.675689925 0.542255924
[9,] 0.097115011 0.675689925
[10,] 0.424708085 0.097115011
[11,] 0.765221622 0.424708085
[12,] 0.162809816 0.765221622
[13,] 0.277970907 0.162809816
[14,] -0.229793347 0.277970907
[15,] 1.064798555 -0.229793347
[16,] 0.063983013 1.064798555
[17,] 0.499486462 0.063983013
[18,] 0.356138051 0.499486462
[19,] 0.297693961 0.356138051
[20,] 0.413857069 0.297693961
[21,] -0.147446953 0.413857069
[22,] 0.304667730 -0.147446953
[23,] 0.363836892 0.304667730
[24,] 0.122729107 0.363836892
[25,] -0.107527662 0.122729107
[26,] 0.671389611 -0.107527662
[27,] -0.909622167 0.671389611
[28,] 0.110256769 -0.909622167
[29,] -0.119169162 0.110256769
[30,] -0.224350429 -0.119169162
[31,] -0.106460232 -0.224350429
[32,] -0.422069448 -0.106460232
[33,] -0.297547839 -0.422069448
[34,] -0.085840927 -0.297547839
[35,] -0.208016142 -0.085840927
[36,] -0.151893388 -0.208016142
[37,] -0.567119891 -0.151893388
[38,] 0.194526489 -0.567119891
[39,] -1.058338323 0.194526489
[40,] -0.111168317 -1.058338323
[41,] -0.444219605 -0.111168317
[42,] -0.458036319 -0.444219605
[43,] -0.193343531 -0.458036319
[44,] -0.659380695 -0.193343531
[45,] 0.091903149 -0.659380695
[46,] -0.205881282 0.091903149
[47,] -0.785735160 -0.205881282
[48,] -0.237391957 -0.785735160
[49,] -0.077668903 -0.237391957
[50,] -1.754843790 -0.077668903
[51,] 0.916409461 -1.754843790
[52,] -0.026198582 0.916409461
[53,] -0.424708085 -0.026198582
[54,] -0.265815869 -0.424708085
[55,] -0.540146121 -0.265815869
[56,] -0.008096851 -0.540146121
[57,] 0.255976632 -0.008096851
[58,] -0.437653606 0.255976632
[59,] -0.135307212 -0.437653606
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.474345549 0.103746422
2 1.118721036 0.474345549
3 -0.013247525 1.118721036
4 -0.036872883 -0.013247525
5 0.488610389 -0.036872883
6 0.592064567 0.488610389
7 0.542255924 0.592064567
8 0.675689925 0.542255924
9 0.097115011 0.675689925
10 0.424708085 0.097115011
11 0.765221622 0.424708085
12 0.162809816 0.765221622
13 0.277970907 0.162809816
14 -0.229793347 0.277970907
15 1.064798555 -0.229793347
16 0.063983013 1.064798555
17 0.499486462 0.063983013
18 0.356138051 0.499486462
19 0.297693961 0.356138051
20 0.413857069 0.297693961
21 -0.147446953 0.413857069
22 0.304667730 -0.147446953
23 0.363836892 0.304667730
24 0.122729107 0.363836892
25 -0.107527662 0.122729107
26 0.671389611 -0.107527662
27 -0.909622167 0.671389611
28 0.110256769 -0.909622167
29 -0.119169162 0.110256769
30 -0.224350429 -0.119169162
31 -0.106460232 -0.224350429
32 -0.422069448 -0.106460232
33 -0.297547839 -0.422069448
34 -0.085840927 -0.297547839
35 -0.208016142 -0.085840927
36 -0.151893388 -0.208016142
37 -0.567119891 -0.151893388
38 0.194526489 -0.567119891
39 -1.058338323 0.194526489
40 -0.111168317 -1.058338323
41 -0.444219605 -0.111168317
42 -0.458036319 -0.444219605
43 -0.193343531 -0.458036319
44 -0.659380695 -0.193343531
45 0.091903149 -0.659380695
46 -0.205881282 0.091903149
47 -0.785735160 -0.205881282
48 -0.237391957 -0.785735160
49 -0.077668903 -0.237391957
50 -1.754843790 -0.077668903
51 0.916409461 -1.754843790
52 -0.026198582 0.916409461
53 -0.424708085 -0.026198582
54 -0.265815869 -0.424708085
55 -0.540146121 -0.265815869
56 -0.008096851 -0.540146121
57 0.255976632 -0.008096851
58 -0.437653606 0.255976632
59 -0.135307212 -0.437653606
> 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/74wyb1258665198.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/8pk3r1258665198.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/9jnte1258665198.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/10wt721258665198.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/11pd8v1258665198.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/12ww1b1258665198.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/138bc71258665198.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/142pk81258665198.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/15tj9j1258665198.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/16b32n1258665198.tab")
+ }
>
> system("convert tmp/1f1fd1258665198.ps tmp/1f1fd1258665198.png")
> system("convert tmp/2z4f71258665198.ps tmp/2z4f71258665198.png")
> system("convert tmp/33z9t1258665198.ps tmp/33z9t1258665198.png")
> system("convert tmp/401871258665198.ps tmp/401871258665198.png")
> system("convert tmp/568g31258665198.ps tmp/568g31258665198.png")
> system("convert tmp/6wvyi1258665198.ps tmp/6wvyi1258665198.png")
> system("convert tmp/74wyb1258665198.ps tmp/74wyb1258665198.png")
> system("convert tmp/8pk3r1258665198.ps tmp/8pk3r1258665198.png")
> system("convert tmp/9jnte1258665198.ps tmp/9jnte1258665198.png")
> system("convert tmp/10wt721258665198.ps tmp/10wt721258665198.png")
>
>
> proc.time()
user system elapsed
2.374 1.543 3.086