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(612613,0,611324,0,594167,0,595454,0,590865,0,589379,0,584428,0,573100,0,567456,0,569028,0,620735,0,628884,0,628232,0,612117,0,595404,0,597141,0,593408,0,590072,0,579799,0,574205,0,572775,0,572942,0,619567,0,625809,0,619916,0,587625,0,565742,0,557274,0,560576,1,548854,1,531673,1,525919,1,511038,1,498662,1,555362,1,564591,1,541657,1,527070,1,509846,1,514258,1,516922,1,507561,1,492622,1,490243,1,469357,1,477580,1,528379,1,533590,1,517945,1,506174,1,501866,1,516141,1,528222,1,532638,1,536322,1,536535,1,523597,1,536214,1,586570,1,596594,1),dim=c(2,60),dimnames=list(c('wlh','dummies'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('wlh','dummies'),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 = '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
wlh dummies M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 612613 0 1 0 0 0 0 0 0 0 0 0 0 1
2 611324 0 0 1 0 0 0 0 0 0 0 0 0 2
3 594167 0 0 0 1 0 0 0 0 0 0 0 0 3
4 595454 0 0 0 0 1 0 0 0 0 0 0 0 4
5 590865 0 0 0 0 0 1 0 0 0 0 0 0 5
6 589379 0 0 0 0 0 0 1 0 0 0 0 0 6
7 584428 0 0 0 0 0 0 0 1 0 0 0 0 7
8 573100 0 0 0 0 0 0 0 0 1 0 0 0 8
9 567456 0 0 0 0 0 0 0 0 0 1 0 0 9
10 569028 0 0 0 0 0 0 0 0 0 0 1 0 10
11 620735 0 0 0 0 0 0 0 0 0 0 0 1 11
12 628884 0 0 0 0 0 0 0 0 0 0 0 0 12
13 628232 0 1 0 0 0 0 0 0 0 0 0 0 13
14 612117 0 0 1 0 0 0 0 0 0 0 0 0 14
15 595404 0 0 0 1 0 0 0 0 0 0 0 0 15
16 597141 0 0 0 0 1 0 0 0 0 0 0 0 16
17 593408 0 0 0 0 0 1 0 0 0 0 0 0 17
18 590072 0 0 0 0 0 0 1 0 0 0 0 0 18
19 579799 0 0 0 0 0 0 0 1 0 0 0 0 19
20 574205 0 0 0 0 0 0 0 0 1 0 0 0 20
21 572775 0 0 0 0 0 0 0 0 0 1 0 0 21
22 572942 0 0 0 0 0 0 0 0 0 0 1 0 22
23 619567 0 0 0 0 0 0 0 0 0 0 0 1 23
24 625809 0 0 0 0 0 0 0 0 0 0 0 0 24
25 619916 0 1 0 0 0 0 0 0 0 0 0 0 25
26 587625 0 0 1 0 0 0 0 0 0 0 0 0 26
27 565742 0 0 0 1 0 0 0 0 0 0 0 0 27
28 557274 0 0 0 0 1 0 0 0 0 0 0 0 28
29 560576 1 0 0 0 0 1 0 0 0 0 0 0 29
30 548854 1 0 0 0 0 0 1 0 0 0 0 0 30
31 531673 1 0 0 0 0 0 0 1 0 0 0 0 31
32 525919 1 0 0 0 0 0 0 0 1 0 0 0 32
33 511038 1 0 0 0 0 0 0 0 0 1 0 0 33
34 498662 1 0 0 0 0 0 0 0 0 0 1 0 34
35 555362 1 0 0 0 0 0 0 0 0 0 0 1 35
36 564591 1 0 0 0 0 0 0 0 0 0 0 0 36
37 541657 1 1 0 0 0 0 0 0 0 0 0 0 37
38 527070 1 0 1 0 0 0 0 0 0 0 0 0 38
39 509846 1 0 0 1 0 0 0 0 0 0 0 0 39
40 514258 1 0 0 0 1 0 0 0 0 0 0 0 40
41 516922 1 0 0 0 0 1 0 0 0 0 0 0 41
42 507561 1 0 0 0 0 0 1 0 0 0 0 0 42
43 492622 1 0 0 0 0 0 0 1 0 0 0 0 43
44 490243 1 0 0 0 0 0 0 0 1 0 0 0 44
45 469357 1 0 0 0 0 0 0 0 0 1 0 0 45
46 477580 1 0 0 0 0 0 0 0 0 0 1 0 46
47 528379 1 0 0 0 0 0 0 0 0 0 0 1 47
48 533590 1 0 0 0 0 0 0 0 0 0 0 0 48
49 517945 1 1 0 0 0 0 0 0 0 0 0 0 49
50 506174 1 0 1 0 0 0 0 0 0 0 0 0 50
51 501866 1 0 0 1 0 0 0 0 0 0 0 0 51
52 516141 1 0 0 0 1 0 0 0 0 0 0 0 52
53 528222 1 0 0 0 0 1 0 0 0 0 0 0 53
54 532638 1 0 0 0 0 0 1 0 0 0 0 0 54
55 536322 1 0 0 0 0 0 0 1 0 0 0 0 55
56 536535 1 0 0 0 0 0 0 0 1 0 0 0 56
57 523597 1 0 0 0 0 0 0 0 0 1 0 0 57
58 536214 1 0 0 0 0 0 0 0 0 0 1 0 58
59 586570 1 0 0 0 0 0 0 0 0 0 0 1 59
60 596594 1 0 0 0 0 0 0 0 0 0 0 0 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) dummies M1 M2 M3 M4
632253.38 -66268.72 -19868.75 -35007.16 -50391.98 -47671.20
M5 M6 M7 M8 M9 M10
-32400.27 -36625.89 -45285.71 -50181.93 -61265.55 -59152.76
M11 t
-7843.18 -72.18
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-32114 -7907 -1911 12450 34940
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 632253.38 10091.24 62.654 < 2e-16 ***
dummies -66268.72 9710.30 -6.825 1.67e-08 ***
M1 -19868.75 11776.45 -1.687 0.098344 .
M2 -35007.16 11746.38 -2.980 0.004590 **
M3 -50391.98 11722.95 -4.299 8.84e-05 ***
M4 -47671.20 11706.18 -4.072 0.000182 ***
M5 -32400.27 11816.41 -2.742 0.008671 **
M6 -36625.89 11773.11 -3.111 0.003199 **
M7 -45285.71 11736.34 -3.859 0.000354 ***
M8 -50181.93 11706.18 -4.287 9.18e-05 ***
M9 -61265.55 11682.66 -5.244 3.86e-06 ***
M10 -59152.76 11665.83 -5.071 6.93e-06 ***
M11 -7843.18 11655.73 -0.673 0.504375
t -72.18 280.31 -0.258 0.797937
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 18420 on 46 degrees of freedom
Multiple R-squared: 0.8522, Adjusted R-squared: 0.8105
F-statistic: 20.41 on 13 and 46 DF, p-value: 7.556e-15
> 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,] 2.026434e-02 4.052867e-02 0.9797357
[2,] 4.514374e-03 9.028749e-03 0.9954856
[3,] 1.685494e-03 3.370989e-03 0.9983145
[4,] 3.292891e-04 6.585782e-04 0.9996707
[5,] 6.435393e-05 1.287079e-04 0.9999356
[6,] 1.075157e-05 2.150315e-05 0.9999892
[7,] 2.096589e-06 4.193178e-06 0.9999979
[8,] 5.043505e-07 1.008701e-06 0.9999995
[9,] 1.151077e-07 2.302154e-07 0.9999999
[10,] 2.453955e-05 4.907911e-05 0.9999755
[11,] 1.682505e-04 3.365010e-04 0.9998317
[12,] 9.594988e-04 1.918998e-03 0.9990405
[13,] 7.157745e-04 1.431549e-03 0.9992842
[14,] 5.557522e-04 1.111504e-03 0.9994442
[15,] 4.551130e-04 9.102260e-04 0.9995449
[16,] 2.928717e-04 5.857434e-04 0.9997071
[17,] 3.891038e-04 7.782076e-04 0.9996109
[18,] 6.189901e-04 1.237980e-03 0.9993810
[19,] 5.433961e-04 1.086792e-03 0.9994566
[20,] 5.942737e-04 1.188547e-03 0.9994057
[21,] 2.731679e-03 5.463359e-03 0.9972683
[22,] 1.495749e-02 2.991498e-02 0.9850425
[23,] 5.700239e-02 1.140048e-01 0.9429976
[24,] 1.794037e-01 3.588073e-01 0.8205963
[25,] 5.392475e-01 9.215051e-01 0.4607525
[26,] 8.856773e-01 2.286453e-01 0.1143227
[27,] 8.966679e-01 2.066643e-01 0.1033321
> postscript(file="/var/www/html/rcomp/tmp/1l4uv1261841532.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/220571261841532.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/3qvyj1261841532.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/411td1261841532.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/5gam81261841532.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
300.5444 14222.1444 12522.1444 11160.5444 -8627.2000 -5815.4000
7 8 9 10 11 12
-2034.4000 -8394.0000 -2882.2000 -3350.8000 -2881.2000 -2503.2000
13 14 15 16 17 18
16785.7278 15881.3278 14625.3278 13713.7278 -5218.0167 -4256.2167
19 20 21 22 23 24
-5797.2167 -6422.8167 3302.9833 1429.3833 -3183.0167 -4712.0167
25 26 27 28 29 30
9335.9111 -7744.4889 -14170.4889 -25287.0889 29084.8889 21660.6889
31 32 33 34 35 36
13211.6889 12426.0889 8700.8889 -5715.7111 -253.1111 1204.8889
37 38 39 40 41 42
-1788.1833 -1164.5833 -2931.5833 -1168.1833 -13702.9278 -18766.1278
43 44 45 46 47 48
-24973.1278 -22383.7278 -32113.9278 -25931.5278 -26369.9278 -28929.9278
49 50 51 52 53 54
-24634.0000 -21194.4000 -10045.4000 1581.0000 -1536.7444 7177.0556
55 56 57 58 59 60
19593.0556 24774.4556 22992.2556 33568.6556 32687.2556 34940.2556
> postscript(file="/var/www/html/rcomp/tmp/688w91261841532.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 300.5444 NA
1 14222.1444 300.5444
2 12522.1444 14222.1444
3 11160.5444 12522.1444
4 -8627.2000 11160.5444
5 -5815.4000 -8627.2000
6 -2034.4000 -5815.4000
7 -8394.0000 -2034.4000
8 -2882.2000 -8394.0000
9 -3350.8000 -2882.2000
10 -2881.2000 -3350.8000
11 -2503.2000 -2881.2000
12 16785.7278 -2503.2000
13 15881.3278 16785.7278
14 14625.3278 15881.3278
15 13713.7278 14625.3278
16 -5218.0167 13713.7278
17 -4256.2167 -5218.0167
18 -5797.2167 -4256.2167
19 -6422.8167 -5797.2167
20 3302.9833 -6422.8167
21 1429.3833 3302.9833
22 -3183.0167 1429.3833
23 -4712.0167 -3183.0167
24 9335.9111 -4712.0167
25 -7744.4889 9335.9111
26 -14170.4889 -7744.4889
27 -25287.0889 -14170.4889
28 29084.8889 -25287.0889
29 21660.6889 29084.8889
30 13211.6889 21660.6889
31 12426.0889 13211.6889
32 8700.8889 12426.0889
33 -5715.7111 8700.8889
34 -253.1111 -5715.7111
35 1204.8889 -253.1111
36 -1788.1833 1204.8889
37 -1164.5833 -1788.1833
38 -2931.5833 -1164.5833
39 -1168.1833 -2931.5833
40 -13702.9278 -1168.1833
41 -18766.1278 -13702.9278
42 -24973.1278 -18766.1278
43 -22383.7278 -24973.1278
44 -32113.9278 -22383.7278
45 -25931.5278 -32113.9278
46 -26369.9278 -25931.5278
47 -28929.9278 -26369.9278
48 -24634.0000 -28929.9278
49 -21194.4000 -24634.0000
50 -10045.4000 -21194.4000
51 1581.0000 -10045.4000
52 -1536.7444 1581.0000
53 7177.0556 -1536.7444
54 19593.0556 7177.0556
55 24774.4556 19593.0556
56 22992.2556 24774.4556
57 33568.6556 22992.2556
58 32687.2556 33568.6556
59 34940.2556 32687.2556
60 NA 34940.2556
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 14222.1444 300.5444
[2,] 12522.1444 14222.1444
[3,] 11160.5444 12522.1444
[4,] -8627.2000 11160.5444
[5,] -5815.4000 -8627.2000
[6,] -2034.4000 -5815.4000
[7,] -8394.0000 -2034.4000
[8,] -2882.2000 -8394.0000
[9,] -3350.8000 -2882.2000
[10,] -2881.2000 -3350.8000
[11,] -2503.2000 -2881.2000
[12,] 16785.7278 -2503.2000
[13,] 15881.3278 16785.7278
[14,] 14625.3278 15881.3278
[15,] 13713.7278 14625.3278
[16,] -5218.0167 13713.7278
[17,] -4256.2167 -5218.0167
[18,] -5797.2167 -4256.2167
[19,] -6422.8167 -5797.2167
[20,] 3302.9833 -6422.8167
[21,] 1429.3833 3302.9833
[22,] -3183.0167 1429.3833
[23,] -4712.0167 -3183.0167
[24,] 9335.9111 -4712.0167
[25,] -7744.4889 9335.9111
[26,] -14170.4889 -7744.4889
[27,] -25287.0889 -14170.4889
[28,] 29084.8889 -25287.0889
[29,] 21660.6889 29084.8889
[30,] 13211.6889 21660.6889
[31,] 12426.0889 13211.6889
[32,] 8700.8889 12426.0889
[33,] -5715.7111 8700.8889
[34,] -253.1111 -5715.7111
[35,] 1204.8889 -253.1111
[36,] -1788.1833 1204.8889
[37,] -1164.5833 -1788.1833
[38,] -2931.5833 -1164.5833
[39,] -1168.1833 -2931.5833
[40,] -13702.9278 -1168.1833
[41,] -18766.1278 -13702.9278
[42,] -24973.1278 -18766.1278
[43,] -22383.7278 -24973.1278
[44,] -32113.9278 -22383.7278
[45,] -25931.5278 -32113.9278
[46,] -26369.9278 -25931.5278
[47,] -28929.9278 -26369.9278
[48,] -24634.0000 -28929.9278
[49,] -21194.4000 -24634.0000
[50,] -10045.4000 -21194.4000
[51,] 1581.0000 -10045.4000
[52,] -1536.7444 1581.0000
[53,] 7177.0556 -1536.7444
[54,] 19593.0556 7177.0556
[55,] 24774.4556 19593.0556
[56,] 22992.2556 24774.4556
[57,] 33568.6556 22992.2556
[58,] 32687.2556 33568.6556
[59,] 34940.2556 32687.2556
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 14222.1444 300.5444
2 12522.1444 14222.1444
3 11160.5444 12522.1444
4 -8627.2000 11160.5444
5 -5815.4000 -8627.2000
6 -2034.4000 -5815.4000
7 -8394.0000 -2034.4000
8 -2882.2000 -8394.0000
9 -3350.8000 -2882.2000
10 -2881.2000 -3350.8000
11 -2503.2000 -2881.2000
12 16785.7278 -2503.2000
13 15881.3278 16785.7278
14 14625.3278 15881.3278
15 13713.7278 14625.3278
16 -5218.0167 13713.7278
17 -4256.2167 -5218.0167
18 -5797.2167 -4256.2167
19 -6422.8167 -5797.2167
20 3302.9833 -6422.8167
21 1429.3833 3302.9833
22 -3183.0167 1429.3833
23 -4712.0167 -3183.0167
24 9335.9111 -4712.0167
25 -7744.4889 9335.9111
26 -14170.4889 -7744.4889
27 -25287.0889 -14170.4889
28 29084.8889 -25287.0889
29 21660.6889 29084.8889
30 13211.6889 21660.6889
31 12426.0889 13211.6889
32 8700.8889 12426.0889
33 -5715.7111 8700.8889
34 -253.1111 -5715.7111
35 1204.8889 -253.1111
36 -1788.1833 1204.8889
37 -1164.5833 -1788.1833
38 -2931.5833 -1164.5833
39 -1168.1833 -2931.5833
40 -13702.9278 -1168.1833
41 -18766.1278 -13702.9278
42 -24973.1278 -18766.1278
43 -22383.7278 -24973.1278
44 -32113.9278 -22383.7278
45 -25931.5278 -32113.9278
46 -26369.9278 -25931.5278
47 -28929.9278 -26369.9278
48 -24634.0000 -28929.9278
49 -21194.4000 -24634.0000
50 -10045.4000 -21194.4000
51 1581.0000 -10045.4000
52 -1536.7444 1581.0000
53 7177.0556 -1536.7444
54 19593.0556 7177.0556
55 24774.4556 19593.0556
56 22992.2556 24774.4556
57 33568.6556 22992.2556
58 32687.2556 33568.6556
59 34940.2556 32687.2556
> 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/72r4y1261841532.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/85orb1261841532.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/9j1dh1261841532.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/10ujp81261841532.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/11fadx1261841532.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/12fezn1261841532.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/138uk51261841532.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/14ctu81261841532.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/15runf1261841532.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/16ggc21261841532.tab")
+ }
>
> try(system("convert tmp/1l4uv1261841532.ps tmp/1l4uv1261841532.png",intern=TRUE))
character(0)
> try(system("convert tmp/220571261841532.ps tmp/220571261841532.png",intern=TRUE))
character(0)
> try(system("convert tmp/3qvyj1261841532.ps tmp/3qvyj1261841532.png",intern=TRUE))
character(0)
> try(system("convert tmp/411td1261841532.ps tmp/411td1261841532.png",intern=TRUE))
character(0)
> try(system("convert tmp/5gam81261841532.ps tmp/5gam81261841532.png",intern=TRUE))
character(0)
> try(system("convert tmp/688w91261841532.ps tmp/688w91261841532.png",intern=TRUE))
character(0)
> try(system("convert tmp/72r4y1261841532.ps tmp/72r4y1261841532.png",intern=TRUE))
character(0)
> try(system("convert tmp/85orb1261841532.ps tmp/85orb1261841532.png",intern=TRUE))
character(0)
> try(system("convert tmp/9j1dh1261841532.ps tmp/9j1dh1261841532.png",intern=TRUE))
character(0)
> try(system("convert tmp/10ujp81261841532.ps tmp/10ujp81261841532.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.377 1.605 2.997