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(8.2,267722,8,266003,7.9,262971,7.6,265521,7.6,264676,8.3,270223,8.4,269508,8.4,268457,8.4,265814,8.4,266680,8.6,263018,8.9,269285,8.8,269829,8.3,270911,7.5,266844,7.2,271244,7.4,269907,8.8,271296,9.3,270157,9.3,271322,8.7,267179,8.2,264101,8.3,265518,8.5,269419,8.6,268714,8.5,272482,8.2,268351,8.1,268175,7.9,270674,8.6,272764,8.7,272599,8.7,270333,8.5,270846,8.4,270491,8.5,269160,8.7,274027,8.7,273784,8.6,276663,8.5,274525,8.3,271344,8,271115,8.2,270798,8.1,273911,8.1,273985,8,271917,7.9,273338,7.9,270601,8,273547,8,275363,7.9,281229,8,277793,7.7,279913,7.2,282500,7.5,280041,7.3,282166,7,290304,7,283519,7,287816,7.2,285226,7.3,287595),dim=c(2,60),dimnames=list(c('wkh','los'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('wkh','los'),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
wkh los M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 8.2 267722 1 0 0 0 0 0 0 0 0 0 0
2 8.0 266003 0 1 0 0 0 0 0 0 0 0 0
3 7.9 262971 0 0 1 0 0 0 0 0 0 0 0
4 7.6 265521 0 0 0 1 0 0 0 0 0 0 0
5 7.6 264676 0 0 0 0 1 0 0 0 0 0 0
6 8.3 270223 0 0 0 0 0 1 0 0 0 0 0
7 8.4 269508 0 0 0 0 0 0 1 0 0 0 0
8 8.4 268457 0 0 0 0 0 0 0 1 0 0 0
9 8.4 265814 0 0 0 0 0 0 0 0 1 0 0
10 8.4 266680 0 0 0 0 0 0 0 0 0 1 0
11 8.6 263018 0 0 0 0 0 0 0 0 0 0 1
12 8.9 269285 0 0 0 0 0 0 0 0 0 0 0
13 8.8 269829 1 0 0 0 0 0 0 0 0 0 0
14 8.3 270911 0 1 0 0 0 0 0 0 0 0 0
15 7.5 266844 0 0 1 0 0 0 0 0 0 0 0
16 7.2 271244 0 0 0 1 0 0 0 0 0 0 0
17 7.4 269907 0 0 0 0 1 0 0 0 0 0 0
18 8.8 271296 0 0 0 0 0 1 0 0 0 0 0
19 9.3 270157 0 0 0 0 0 0 1 0 0 0 0
20 9.3 271322 0 0 0 0 0 0 0 1 0 0 0
21 8.7 267179 0 0 0 0 0 0 0 0 1 0 0
22 8.2 264101 0 0 0 0 0 0 0 0 0 1 0
23 8.3 265518 0 0 0 0 0 0 0 0 0 0 1
24 8.5 269419 0 0 0 0 0 0 0 0 0 0 0
25 8.6 268714 1 0 0 0 0 0 0 0 0 0 0
26 8.5 272482 0 1 0 0 0 0 0 0 0 0 0
27 8.2 268351 0 0 1 0 0 0 0 0 0 0 0
28 8.1 268175 0 0 0 1 0 0 0 0 0 0 0
29 7.9 270674 0 0 0 0 1 0 0 0 0 0 0
30 8.6 272764 0 0 0 0 0 1 0 0 0 0 0
31 8.7 272599 0 0 0 0 0 0 1 0 0 0 0
32 8.7 270333 0 0 0 0 0 0 0 1 0 0 0
33 8.5 270846 0 0 0 0 0 0 0 0 1 0 0
34 8.4 270491 0 0 0 0 0 0 0 0 0 1 0
35 8.5 269160 0 0 0 0 0 0 0 0 0 0 1
36 8.7 274027 0 0 0 0 0 0 0 0 0 0 0
37 8.7 273784 1 0 0 0 0 0 0 0 0 0 0
38 8.6 276663 0 1 0 0 0 0 0 0 0 0 0
39 8.5 274525 0 0 1 0 0 0 0 0 0 0 0
40 8.3 271344 0 0 0 1 0 0 0 0 0 0 0
41 8.0 271115 0 0 0 0 1 0 0 0 0 0 0
42 8.2 270798 0 0 0 0 0 1 0 0 0 0 0
43 8.1 273911 0 0 0 0 0 0 1 0 0 0 0
44 8.1 273985 0 0 0 0 0 0 0 1 0 0 0
45 8.0 271917 0 0 0 0 0 0 0 0 1 0 0
46 7.9 273338 0 0 0 0 0 0 0 0 0 1 0
47 7.9 270601 0 0 0 0 0 0 0 0 0 0 1
48 8.0 273547 0 0 0 0 0 0 0 0 0 0 0
49 8.0 275363 1 0 0 0 0 0 0 0 0 0 0
50 7.9 281229 0 1 0 0 0 0 0 0 0 0 0
51 8.0 277793 0 0 1 0 0 0 0 0 0 0 0
52 7.7 279913 0 0 0 1 0 0 0 0 0 0 0
53 7.2 282500 0 0 0 0 1 0 0 0 0 0 0
54 7.5 280041 0 0 0 0 0 1 0 0 0 0 0
55 7.3 282166 0 0 0 0 0 0 1 0 0 0 0
56 7.0 290304 0 0 0 0 0 0 0 1 0 0 0
57 7.0 283519 0 0 0 0 0 0 0 0 1 0 0
58 7.0 287816 0 0 0 0 0 0 0 0 0 1 0
59 7.2 285226 0 0 0 0 0 0 0 0 0 0 1
60 7.3 287595 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) los M1 M2 M3 M4
2.372e+01 -5.621e-05 -2.753e-02 -9.402e-02 -5.229e-01 -6.987e-01
M5 M6 M7 M8 M9 M10
-8.286e-01 -9.837e-02 1.781e-02 2.594e-02 -3.241e-01 -4.287e-01
M11
-4.088e-01
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.70283 -0.25329 -0.04581 0.30880 0.80000
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.372e+01 2.451e+00 9.681 9.02e-13 ***
los -5.621e-05 8.893e-06 -6.320 8.81e-08 ***
M1 -2.753e-02 2.631e-01 -0.105 0.91712
M2 -9.402e-02 2.613e-01 -0.360 0.72059
M3 -5.229e-01 2.643e-01 -1.978 0.05378 .
M4 -6.987e-01 2.629e-01 -2.657 0.01073 *
M5 -8.286e-01 2.624e-01 -3.158 0.00278 **
M6 -9.837e-02 2.615e-01 -0.376 0.70848
M7 1.781e-02 2.612e-01 0.068 0.94593
M8 2.594e-02 2.610e-01 0.099 0.92128
M9 -3.241e-01 2.623e-01 -1.235 0.22280
M10 -4.287e-01 2.618e-01 -1.637 0.10827
M11 -4.088e-01 2.635e-01 -1.551 0.12760
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.4127 on 47 degrees of freedom
Multiple R-squared: 0.5592, Adjusted R-squared: 0.4467
F-statistic: 4.969 on 12 and 47 DF, p-value: 3.046e-05
> 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.6105701 0.77885984 0.389429919
[2,] 0.4888527 0.97770542 0.511147290
[3,] 0.5175609 0.96487819 0.482439094
[4,] 0.8067556 0.38648888 0.193244440
[5,] 0.9468830 0.10623393 0.053116967
[6,] 0.9253201 0.14935978 0.074679889
[7,] 0.9122385 0.17552310 0.087761548
[8,] 0.8886957 0.22260856 0.111304279
[9,] 0.8615640 0.27687207 0.138436036
[10,] 0.8062246 0.38755085 0.193775424
[11,] 0.7633681 0.47326389 0.236631946
[12,] 0.8286016 0.34279686 0.171398428
[13,] 0.9035529 0.19289414 0.096447072
[14,] 0.8736941 0.25261171 0.126305857
[15,] 0.8850981 0.22980377 0.114901886
[16,] 0.9176395 0.16472106 0.082360530
[17,] 0.8884935 0.22301292 0.111506462
[18,] 0.9076088 0.18478240 0.092391199
[19,] 0.8707869 0.25842611 0.129213056
[20,] 0.8508907 0.29821862 0.149109311
[21,] 0.9376450 0.12470996 0.062354982
[22,] 0.9813144 0.03737123 0.018685617
[23,] 0.9895506 0.02089879 0.010449397
[24,] 0.9912149 0.01757023 0.008785115
[25,] 0.9835394 0.03292114 0.016460568
[26,] 0.9633299 0.07334019 0.036670093
[27,] 0.9292975 0.14140506 0.070702528
[28,] 0.9426650 0.11467003 0.057335016
[29,] 0.8930106 0.21397881 0.106989405
> postscript(file="/var/www/html/rcomp/tmp/143521258707016.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/2xh171258707016.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/3g49y1258707016.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/4wr9n1258707016.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/50gje1258707016.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.448877703 -0.679000038 -0.520519206 -0.501413599 -0.418979136 -0.137458040
7 8 9 10 11 12
-0.193831991 -0.261028230 -0.059545949 0.093707641 0.067959959 0.311446542
13 14 15 16 17 18
0.269550258 -0.103136519 -0.702829840 -0.579741448 -0.324960785 0.422851975
19 20 21 22 23 24
0.742646294 0.800004570 0.317176485 -0.251249982 -0.091522764 -0.081021732
25 26 27 28 29 30
0.006879552 0.185164538 0.081873975 0.147759542 0.218149915 0.305363720
31 32 33 34 35 36
0.279903571 0.144415935 0.323287227 0.307912178 0.313182805 0.377979713
37 38 39 40 41 42
0.391848591 0.520165632 0.728895443 0.525879243 0.342937163 -0.205139066
43 44 45 46 47 48
-0.246352962 -0.250316427 -0.116515172 -0.032066746 -0.205823036 -0.348999604
49 50 51 52 53 54
-0.219400697 0.076806387 0.412579628 0.407516262 0.182852844 -0.385618589
55 56 57 58 59 60
-0.582364913 -0.433075848 -0.464402591 -0.118303090 -0.083796964 -0.259404919
> postscript(file="/var/www/html/rcomp/tmp/6z3wq1258707016.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.448877703 NA
1 -0.679000038 -0.448877703
2 -0.520519206 -0.679000038
3 -0.501413599 -0.520519206
4 -0.418979136 -0.501413599
5 -0.137458040 -0.418979136
6 -0.193831991 -0.137458040
7 -0.261028230 -0.193831991
8 -0.059545949 -0.261028230
9 0.093707641 -0.059545949
10 0.067959959 0.093707641
11 0.311446542 0.067959959
12 0.269550258 0.311446542
13 -0.103136519 0.269550258
14 -0.702829840 -0.103136519
15 -0.579741448 -0.702829840
16 -0.324960785 -0.579741448
17 0.422851975 -0.324960785
18 0.742646294 0.422851975
19 0.800004570 0.742646294
20 0.317176485 0.800004570
21 -0.251249982 0.317176485
22 -0.091522764 -0.251249982
23 -0.081021732 -0.091522764
24 0.006879552 -0.081021732
25 0.185164538 0.006879552
26 0.081873975 0.185164538
27 0.147759542 0.081873975
28 0.218149915 0.147759542
29 0.305363720 0.218149915
30 0.279903571 0.305363720
31 0.144415935 0.279903571
32 0.323287227 0.144415935
33 0.307912178 0.323287227
34 0.313182805 0.307912178
35 0.377979713 0.313182805
36 0.391848591 0.377979713
37 0.520165632 0.391848591
38 0.728895443 0.520165632
39 0.525879243 0.728895443
40 0.342937163 0.525879243
41 -0.205139066 0.342937163
42 -0.246352962 -0.205139066
43 -0.250316427 -0.246352962
44 -0.116515172 -0.250316427
45 -0.032066746 -0.116515172
46 -0.205823036 -0.032066746
47 -0.348999604 -0.205823036
48 -0.219400697 -0.348999604
49 0.076806387 -0.219400697
50 0.412579628 0.076806387
51 0.407516262 0.412579628
52 0.182852844 0.407516262
53 -0.385618589 0.182852844
54 -0.582364913 -0.385618589
55 -0.433075848 -0.582364913
56 -0.464402591 -0.433075848
57 -0.118303090 -0.464402591
58 -0.083796964 -0.118303090
59 -0.259404919 -0.083796964
60 NA -0.259404919
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.679000038 -0.448877703
[2,] -0.520519206 -0.679000038
[3,] -0.501413599 -0.520519206
[4,] -0.418979136 -0.501413599
[5,] -0.137458040 -0.418979136
[6,] -0.193831991 -0.137458040
[7,] -0.261028230 -0.193831991
[8,] -0.059545949 -0.261028230
[9,] 0.093707641 -0.059545949
[10,] 0.067959959 0.093707641
[11,] 0.311446542 0.067959959
[12,] 0.269550258 0.311446542
[13,] -0.103136519 0.269550258
[14,] -0.702829840 -0.103136519
[15,] -0.579741448 -0.702829840
[16,] -0.324960785 -0.579741448
[17,] 0.422851975 -0.324960785
[18,] 0.742646294 0.422851975
[19,] 0.800004570 0.742646294
[20,] 0.317176485 0.800004570
[21,] -0.251249982 0.317176485
[22,] -0.091522764 -0.251249982
[23,] -0.081021732 -0.091522764
[24,] 0.006879552 -0.081021732
[25,] 0.185164538 0.006879552
[26,] 0.081873975 0.185164538
[27,] 0.147759542 0.081873975
[28,] 0.218149915 0.147759542
[29,] 0.305363720 0.218149915
[30,] 0.279903571 0.305363720
[31,] 0.144415935 0.279903571
[32,] 0.323287227 0.144415935
[33,] 0.307912178 0.323287227
[34,] 0.313182805 0.307912178
[35,] 0.377979713 0.313182805
[36,] 0.391848591 0.377979713
[37,] 0.520165632 0.391848591
[38,] 0.728895443 0.520165632
[39,] 0.525879243 0.728895443
[40,] 0.342937163 0.525879243
[41,] -0.205139066 0.342937163
[42,] -0.246352962 -0.205139066
[43,] -0.250316427 -0.246352962
[44,] -0.116515172 -0.250316427
[45,] -0.032066746 -0.116515172
[46,] -0.205823036 -0.032066746
[47,] -0.348999604 -0.205823036
[48,] -0.219400697 -0.348999604
[49,] 0.076806387 -0.219400697
[50,] 0.412579628 0.076806387
[51,] 0.407516262 0.412579628
[52,] 0.182852844 0.407516262
[53,] -0.385618589 0.182852844
[54,] -0.582364913 -0.385618589
[55,] -0.433075848 -0.582364913
[56,] -0.464402591 -0.433075848
[57,] -0.118303090 -0.464402591
[58,] -0.083796964 -0.118303090
[59,] -0.259404919 -0.083796964
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.679000038 -0.448877703
2 -0.520519206 -0.679000038
3 -0.501413599 -0.520519206
4 -0.418979136 -0.501413599
5 -0.137458040 -0.418979136
6 -0.193831991 -0.137458040
7 -0.261028230 -0.193831991
8 -0.059545949 -0.261028230
9 0.093707641 -0.059545949
10 0.067959959 0.093707641
11 0.311446542 0.067959959
12 0.269550258 0.311446542
13 -0.103136519 0.269550258
14 -0.702829840 -0.103136519
15 -0.579741448 -0.702829840
16 -0.324960785 -0.579741448
17 0.422851975 -0.324960785
18 0.742646294 0.422851975
19 0.800004570 0.742646294
20 0.317176485 0.800004570
21 -0.251249982 0.317176485
22 -0.091522764 -0.251249982
23 -0.081021732 -0.091522764
24 0.006879552 -0.081021732
25 0.185164538 0.006879552
26 0.081873975 0.185164538
27 0.147759542 0.081873975
28 0.218149915 0.147759542
29 0.305363720 0.218149915
30 0.279903571 0.305363720
31 0.144415935 0.279903571
32 0.323287227 0.144415935
33 0.307912178 0.323287227
34 0.313182805 0.307912178
35 0.377979713 0.313182805
36 0.391848591 0.377979713
37 0.520165632 0.391848591
38 0.728895443 0.520165632
39 0.525879243 0.728895443
40 0.342937163 0.525879243
41 -0.205139066 0.342937163
42 -0.246352962 -0.205139066
43 -0.250316427 -0.246352962
44 -0.116515172 -0.250316427
45 -0.032066746 -0.116515172
46 -0.205823036 -0.032066746
47 -0.348999604 -0.205823036
48 -0.219400697 -0.348999604
49 0.076806387 -0.219400697
50 0.412579628 0.076806387
51 0.407516262 0.412579628
52 0.182852844 0.407516262
53 -0.385618589 0.182852844
54 -0.582364913 -0.385618589
55 -0.433075848 -0.582364913
56 -0.464402591 -0.433075848
57 -0.118303090 -0.464402591
58 -0.083796964 -0.118303090
59 -0.259404919 -0.083796964
> 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/7yvvo1258707016.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/8ryla1258707016.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/9kt3p1258707016.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/10a4ba1258707016.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/112cwt1258707016.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/126eg11258707016.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/13ohmm1258707016.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/14wkhq1258707016.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/15fgo41258707016.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/16jmge1258707016.tab")
+ }
>
> system("convert tmp/143521258707016.ps tmp/143521258707016.png")
> system("convert tmp/2xh171258707016.ps tmp/2xh171258707016.png")
> system("convert tmp/3g49y1258707016.ps tmp/3g49y1258707016.png")
> system("convert tmp/4wr9n1258707016.ps tmp/4wr9n1258707016.png")
> system("convert tmp/50gje1258707016.ps tmp/50gje1258707016.png")
> system("convert tmp/6z3wq1258707016.ps tmp/6z3wq1258707016.png")
> system("convert tmp/7yvvo1258707016.ps tmp/7yvvo1258707016.png")
> system("convert tmp/8ryla1258707016.ps tmp/8ryla1258707016.png")
> system("convert tmp/9kt3p1258707016.ps tmp/9kt3p1258707016.png")
> system("convert tmp/10a4ba1258707016.ps tmp/10a4ba1258707016.png")
>
>
> proc.time()
user system elapsed
2.390 1.529 2.929