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,1,611324,1,594167,1,595454,1,590865,1,589379,1,584428,1,573100,1,567456,1,569028,1,620735,1,628884,1,628232,1,612117,1,595404,1,597141,1,593408,1,590072,1,579799,1,574205,1,572775,1,572942,1,619567,1,625809,1,619916,1,587625,0,565742,0,557274,0,560576,0,548854,0,531673,0,525919,0,511038,0,498662,0,555362,0,564591,0,541657,0,527070,0,509846,0,514258,0,516922,0,507561,0,492622,0,490243,0,469357,0,477580,0,528379,0,533590,0,517945,0,506174,0,501866,0,516141,0,528222,0,532638,0,536322,0,536535,0,523597,0,536214,0,586570,0,596594,0),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 1 1 0 0 0 0 0 0 0 0 0 0 1
2 611324 1 0 1 0 0 0 0 0 0 0 0 0 2
3 594167 1 0 0 1 0 0 0 0 0 0 0 0 3
4 595454 1 0 0 0 1 0 0 0 0 0 0 0 4
5 590865 1 0 0 0 0 1 0 0 0 0 0 0 5
6 589379 1 0 0 0 0 0 1 0 0 0 0 0 6
7 584428 1 0 0 0 0 0 0 1 0 0 0 0 7
8 573100 1 0 0 0 0 0 0 0 1 0 0 0 8
9 567456 1 0 0 0 0 0 0 0 0 1 0 0 9
10 569028 1 0 0 0 0 0 0 0 0 0 1 0 10
11 620735 1 0 0 0 0 0 0 0 0 0 0 1 11
12 628884 1 0 0 0 0 0 0 0 0 0 0 0 12
13 628232 1 1 0 0 0 0 0 0 0 0 0 0 13
14 612117 1 0 1 0 0 0 0 0 0 0 0 0 14
15 595404 1 0 0 1 0 0 0 0 0 0 0 0 15
16 597141 1 0 0 0 1 0 0 0 0 0 0 0 16
17 593408 1 0 0 0 0 1 0 0 0 0 0 0 17
18 590072 1 0 0 0 0 0 1 0 0 0 0 0 18
19 579799 1 0 0 0 0 0 0 1 0 0 0 0 19
20 574205 1 0 0 0 0 0 0 0 1 0 0 0 20
21 572775 1 0 0 0 0 0 0 0 0 1 0 0 21
22 572942 1 0 0 0 0 0 0 0 0 0 1 0 22
23 619567 1 0 0 0 0 0 0 0 0 0 0 1 23
24 625809 1 0 0 0 0 0 0 0 0 0 0 0 24
25 619916 1 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 0 0 0 0 0 1 0 0 0 0 0 0 29
30 548854 0 0 0 0 0 0 1 0 0 0 0 0 30
31 531673 0 0 0 0 0 0 0 1 0 0 0 0 31
32 525919 0 0 0 0 0 0 0 0 1 0 0 0 32
33 511038 0 0 0 0 0 0 0 0 0 1 0 0 33
34 498662 0 0 0 0 0 0 0 0 0 0 1 0 34
35 555362 0 0 0 0 0 0 0 0 0 0 0 1 35
36 564591 0 0 0 0 0 0 0 0 0 0 0 0 36
37 541657 0 1 0 0 0 0 0 0 0 0 0 0 37
38 527070 0 0 1 0 0 0 0 0 0 0 0 0 38
39 509846 0 0 0 1 0 0 0 0 0 0 0 0 39
40 514258 0 0 0 0 1 0 0 0 0 0 0 0 40
41 516922 0 0 0 0 0 1 0 0 0 0 0 0 41
42 507561 0 0 0 0 0 0 1 0 0 0 0 0 42
43 492622 0 0 0 0 0 0 0 1 0 0 0 0 43
44 490243 0 0 0 0 0 0 0 0 1 0 0 0 44
45 469357 0 0 0 0 0 0 0 0 0 1 0 0 45
46 477580 0 0 0 0 0 0 0 0 0 0 1 0 46
47 528379 0 0 0 0 0 0 0 0 0 0 0 1 47
48 533590 0 0 0 0 0 0 0 0 0 0 0 0 48
49 517945 0 1 0 0 0 0 0 0 0 0 0 0 49
50 506174 0 0 1 0 0 0 0 0 0 0 0 0 50
51 501866 0 0 0 1 0 0 0 0 0 0 0 0 51
52 516141 0 0 0 0 1 0 0 0 0 0 0 0 52
53 528222 0 0 0 0 0 1 0 0 0 0 0 0 53
54 532638 0 0 0 0 0 0 1 0 0 0 0 0 54
55 536322 0 0 0 0 0 0 0 1 0 0 0 0 55
56 536535 0 0 0 0 0 0 0 0 1 0 0 0 56
57 523597 0 0 0 0 0 0 0 0 0 1 0 0 57
58 536214 0 0 0 0 0 0 0 0 0 0 1 0 58
59 586570 0 0 0 0 0 0 0 0 0 0 0 1 59
60 596594 0 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
577655.9 57290.8 -20542.1 -23997.9 -39158.3 -36213.0
M5 M6 M7 M8 M9 M10
-33971.4 -37972.6 -46407.9 -51079.7 -61938.9 -59601.7
M11 t
-8067.6 -296.6
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-33012 -9449 -2064 8869 41679
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 577655.9 17813.6 32.428 < 2e-16 ***
dummies 57290.8 10881.4 5.265 3.59e-06 ***
M1 -20542.1 13196.8 -1.557 0.126419
M2 -23997.9 13430.2 -1.787 0.080551 .
M3 -39158.3 13360.2 -2.931 0.005247 **
M4 -36213.0 13297.3 -2.723 0.009102 **
M5 -33971.4 13241.5 -2.566 0.013627 *
M6 -37972.6 13193.0 -2.878 0.006048 **
M7 -46407.9 13151.8 -3.529 0.000960 ***
M8 -51079.7 13118.0 -3.894 0.000317 ***
M9 -61938.9 13091.7 -4.731 2.15e-05 ***
M10 -59601.7 13072.8 -4.559 3.79e-05 ***
M11 -8067.6 13061.5 -0.618 0.539841
t -296.6 314.1 -0.944 0.349940
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 20650 on 46 degrees of freedom
Multiple R-squared: 0.8144, Adjusted R-squared: 0.762
F-statistic: 15.53 on 13 and 46 DF, p-value: 1.123e-12
> 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,] 1.134834e-02 2.269669e-02 0.98865166
[2,] 2.082094e-03 4.164188e-03 0.99791791
[3,] 6.460479e-04 1.292096e-03 0.99935395
[4,] 1.045824e-04 2.091649e-04 0.99989542
[5,] 1.667213e-05 3.334426e-05 0.99998333
[6,] 2.275469e-06 4.550937e-06 0.99999772
[7,] 3.720803e-07 7.441606e-07 0.99999963
[8,] 8.112081e-08 1.622416e-07 0.99999992
[9,] 1.222369e-08 2.444738e-08 0.99999999
[10,] 3.772280e-09 7.544561e-09 1.00000000
[11,] 1.715784e-09 3.431569e-09 1.00000000
[12,] 5.112979e-09 1.022596e-08 0.99999999
[13,] 1.763354e-09 3.526709e-09 1.00000000
[14,] 2.753101e-09 5.506203e-09 1.00000000
[15,] 3.373607e-08 6.747215e-08 0.99999997
[16,] 4.501001e-08 9.002002e-08 0.99999995
[17,] 7.301340e-07 1.460268e-06 0.99999927
[18,] 2.200403e-05 4.400806e-05 0.99997800
[19,] 4.445605e-05 8.891209e-05 0.99995554
[20,] 8.167630e-05 1.633526e-04 0.99991832
[21,] 1.647318e-03 3.294636e-03 0.99835268
[22,] 4.526173e-02 9.052347e-02 0.95473827
[23,] 2.075814e-01 4.151628e-01 0.79241862
[24,] 4.648823e-01 9.297647e-01 0.53511765
[25,] 7.735673e-01 4.528654e-01 0.22643272
[26,] 9.499568e-01 1.000864e-01 0.05004319
[27,] 9.451441e-01 1.097117e-01 0.05485586
> postscript(file="/var/www/html/rcomp/tmp/1gfhv1261769132.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/2m8pc1261769132.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/3wl621261769132.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/4nrsk1261769132.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/5ysy51261769132.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
-1495.0333 968.4000 -731.6000 -2093.2000 -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
17683.5167 5320.9500 4064.9500 3153.3500 -2524.6500 -1562.8500
19 20 21 22 23 24
-3103.8500 -3729.4500 5996.3500 4122.7500 -489.6500 -2018.6500
25 26 27 28 29 30
12927.0667 41679.3333 35253.3333 24136.7333 25493.7333 18069.5333
31 32 33 34 35 36
9620.5333 8834.9333 5109.7333 -9306.8667 -3844.2667 -2386.2667
37 38 39 40 41 42
-4481.5500 -15316.1167 -17083.1167 -15319.7167 -14600.7167 -19663.9167
43 44 45 46 47 48
-25870.9167 -23281.5167 -33011.7167 -26829.3167 -27267.7167 -29827.7167
49 50 51 52 53 54
-24634.0000 -32652.5667 -21503.5667 -9877.1667 258.8333 8972.6333
55 56 57 58 59 60
21388.6333 26570.0333 24787.8333 35364.2333 34482.8333 36735.8333
> postscript(file="/var/www/html/rcomp/tmp/6fz9g1261769132.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 -1495.0333 NA
1 968.4000 -1495.0333
2 -731.6000 968.4000
3 -2093.2000 -731.6000
4 -8627.2000 -2093.2000
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 17683.5167 -2503.2000
13 5320.9500 17683.5167
14 4064.9500 5320.9500
15 3153.3500 4064.9500
16 -2524.6500 3153.3500
17 -1562.8500 -2524.6500
18 -3103.8500 -1562.8500
19 -3729.4500 -3103.8500
20 5996.3500 -3729.4500
21 4122.7500 5996.3500
22 -489.6500 4122.7500
23 -2018.6500 -489.6500
24 12927.0667 -2018.6500
25 41679.3333 12927.0667
26 35253.3333 41679.3333
27 24136.7333 35253.3333
28 25493.7333 24136.7333
29 18069.5333 25493.7333
30 9620.5333 18069.5333
31 8834.9333 9620.5333
32 5109.7333 8834.9333
33 -9306.8667 5109.7333
34 -3844.2667 -9306.8667
35 -2386.2667 -3844.2667
36 -4481.5500 -2386.2667
37 -15316.1167 -4481.5500
38 -17083.1167 -15316.1167
39 -15319.7167 -17083.1167
40 -14600.7167 -15319.7167
41 -19663.9167 -14600.7167
42 -25870.9167 -19663.9167
43 -23281.5167 -25870.9167
44 -33011.7167 -23281.5167
45 -26829.3167 -33011.7167
46 -27267.7167 -26829.3167
47 -29827.7167 -27267.7167
48 -24634.0000 -29827.7167
49 -32652.5667 -24634.0000
50 -21503.5667 -32652.5667
51 -9877.1667 -21503.5667
52 258.8333 -9877.1667
53 8972.6333 258.8333
54 21388.6333 8972.6333
55 26570.0333 21388.6333
56 24787.8333 26570.0333
57 35364.2333 24787.8333
58 34482.8333 35364.2333
59 36735.8333 34482.8333
60 NA 36735.8333
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 968.4000 -1495.0333
[2,] -731.6000 968.4000
[3,] -2093.2000 -731.6000
[4,] -8627.2000 -2093.2000
[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,] 17683.5167 -2503.2000
[13,] 5320.9500 17683.5167
[14,] 4064.9500 5320.9500
[15,] 3153.3500 4064.9500
[16,] -2524.6500 3153.3500
[17,] -1562.8500 -2524.6500
[18,] -3103.8500 -1562.8500
[19,] -3729.4500 -3103.8500
[20,] 5996.3500 -3729.4500
[21,] 4122.7500 5996.3500
[22,] -489.6500 4122.7500
[23,] -2018.6500 -489.6500
[24,] 12927.0667 -2018.6500
[25,] 41679.3333 12927.0667
[26,] 35253.3333 41679.3333
[27,] 24136.7333 35253.3333
[28,] 25493.7333 24136.7333
[29,] 18069.5333 25493.7333
[30,] 9620.5333 18069.5333
[31,] 8834.9333 9620.5333
[32,] 5109.7333 8834.9333
[33,] -9306.8667 5109.7333
[34,] -3844.2667 -9306.8667
[35,] -2386.2667 -3844.2667
[36,] -4481.5500 -2386.2667
[37,] -15316.1167 -4481.5500
[38,] -17083.1167 -15316.1167
[39,] -15319.7167 -17083.1167
[40,] -14600.7167 -15319.7167
[41,] -19663.9167 -14600.7167
[42,] -25870.9167 -19663.9167
[43,] -23281.5167 -25870.9167
[44,] -33011.7167 -23281.5167
[45,] -26829.3167 -33011.7167
[46,] -27267.7167 -26829.3167
[47,] -29827.7167 -27267.7167
[48,] -24634.0000 -29827.7167
[49,] -32652.5667 -24634.0000
[50,] -21503.5667 -32652.5667
[51,] -9877.1667 -21503.5667
[52,] 258.8333 -9877.1667
[53,] 8972.6333 258.8333
[54,] 21388.6333 8972.6333
[55,] 26570.0333 21388.6333
[56,] 24787.8333 26570.0333
[57,] 35364.2333 24787.8333
[58,] 34482.8333 35364.2333
[59,] 36735.8333 34482.8333
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 968.4000 -1495.0333
2 -731.6000 968.4000
3 -2093.2000 -731.6000
4 -8627.2000 -2093.2000
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 17683.5167 -2503.2000
13 5320.9500 17683.5167
14 4064.9500 5320.9500
15 3153.3500 4064.9500
16 -2524.6500 3153.3500
17 -1562.8500 -2524.6500
18 -3103.8500 -1562.8500
19 -3729.4500 -3103.8500
20 5996.3500 -3729.4500
21 4122.7500 5996.3500
22 -489.6500 4122.7500
23 -2018.6500 -489.6500
24 12927.0667 -2018.6500
25 41679.3333 12927.0667
26 35253.3333 41679.3333
27 24136.7333 35253.3333
28 25493.7333 24136.7333
29 18069.5333 25493.7333
30 9620.5333 18069.5333
31 8834.9333 9620.5333
32 5109.7333 8834.9333
33 -9306.8667 5109.7333
34 -3844.2667 -9306.8667
35 -2386.2667 -3844.2667
36 -4481.5500 -2386.2667
37 -15316.1167 -4481.5500
38 -17083.1167 -15316.1167
39 -15319.7167 -17083.1167
40 -14600.7167 -15319.7167
41 -19663.9167 -14600.7167
42 -25870.9167 -19663.9167
43 -23281.5167 -25870.9167
44 -33011.7167 -23281.5167
45 -26829.3167 -33011.7167
46 -27267.7167 -26829.3167
47 -29827.7167 -27267.7167
48 -24634.0000 -29827.7167
49 -32652.5667 -24634.0000
50 -21503.5667 -32652.5667
51 -9877.1667 -21503.5667
52 258.8333 -9877.1667
53 8972.6333 258.8333
54 21388.6333 8972.6333
55 26570.0333 21388.6333
56 24787.8333 26570.0333
57 35364.2333 24787.8333
58 34482.8333 35364.2333
59 36735.8333 34482.8333
> 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/7v2m31261769132.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/8uggy1261769132.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/9667h1261769132.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/10xote1261769132.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/11nk6a1261769132.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/12jhaf1261769132.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/1335hz1261769132.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/140ut51261769132.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/15pj3v1261769132.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/168ukb1261769132.tab")
+ }
>
> try(system("convert tmp/1gfhv1261769132.ps tmp/1gfhv1261769132.png",intern=TRUE))
character(0)
> try(system("convert tmp/2m8pc1261769132.ps tmp/2m8pc1261769132.png",intern=TRUE))
character(0)
> try(system("convert tmp/3wl621261769132.ps tmp/3wl621261769132.png",intern=TRUE))
character(0)
> try(system("convert tmp/4nrsk1261769132.ps tmp/4nrsk1261769132.png",intern=TRUE))
character(0)
> try(system("convert tmp/5ysy51261769132.ps tmp/5ysy51261769132.png",intern=TRUE))
character(0)
> try(system("convert tmp/6fz9g1261769132.ps tmp/6fz9g1261769132.png",intern=TRUE))
character(0)
> try(system("convert tmp/7v2m31261769132.ps tmp/7v2m31261769132.png",intern=TRUE))
character(0)
> try(system("convert tmp/8uggy1261769132.ps tmp/8uggy1261769132.png",intern=TRUE))
character(0)
> try(system("convert tmp/9667h1261769132.ps tmp/9667h1261769132.png",intern=TRUE))
character(0)
> try(system("convert tmp/10xote1261769132.ps tmp/10xote1261769132.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.334 1.506 2.907