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(562000,4814,561000,3908,555000,5250,544000,3937,537000,4004,543000,5560,594000,3922,611000,3759,613000,4138,611000,4634,594000,3996,595000,4308,591000,4143,589000,4429,584000,5219,573000,4929,567000,5755,569000,5592,621000,4163,629000,4962,628000,5208,612000,4755,595000,4491,597000,5732,593000,5731,590000,5040,580000,6102,574000,4904,573000,5369,573000,5578,620000,4619,626000,4731,620000,5011,588000,5299,566000,4146,557000,4625,561000,4736,549000,4219,532000,5116,526000,4205,511000,4121,499000,5103,555000,4300,565000,4578,542000,3809,527000,5526,510000,4247,514000,3830,517000,4394,508000,4826,493000,4409,490000,4569,469000,4106,478000,4794,528000,3914,534000,3793,518000,4405,506000,4022,502000,4100,516000,4788),dim=c(2,60),dimnames=list(c('werkloos','bouw'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('werkloos','bouw'),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
werkloos bouw M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 562000 4814 1 0 0 0 0 0 0 0 0 0 0
2 561000 3908 0 1 0 0 0 0 0 0 0 0 0
3 555000 5250 0 0 1 0 0 0 0 0 0 0 0
4 544000 3937 0 0 0 1 0 0 0 0 0 0 0
5 537000 4004 0 0 0 0 1 0 0 0 0 0 0
6 543000 5560 0 0 0 0 0 1 0 0 0 0 0
7 594000 3922 0 0 0 0 0 0 1 0 0 0 0
8 611000 3759 0 0 0 0 0 0 0 1 0 0 0
9 613000 4138 0 0 0 0 0 0 0 0 1 0 0
10 611000 4634 0 0 0 0 0 0 0 0 0 1 0
11 594000 3996 0 0 0 0 0 0 0 0 0 0 1
12 595000 4308 0 0 0 0 0 0 0 0 0 0 0
13 591000 4143 1 0 0 0 0 0 0 0 0 0 0
14 589000 4429 0 1 0 0 0 0 0 0 0 0 0
15 584000 5219 0 0 1 0 0 0 0 0 0 0 0
16 573000 4929 0 0 0 1 0 0 0 0 0 0 0
17 567000 5755 0 0 0 0 1 0 0 0 0 0 0
18 569000 5592 0 0 0 0 0 1 0 0 0 0 0
19 621000 4163 0 0 0 0 0 0 1 0 0 0 0
20 629000 4962 0 0 0 0 0 0 0 1 0 0 0
21 628000 5208 0 0 0 0 0 0 0 0 1 0 0
22 612000 4755 0 0 0 0 0 0 0 0 0 1 0
23 595000 4491 0 0 0 0 0 0 0 0 0 0 1
24 597000 5732 0 0 0 0 0 0 0 0 0 0 0
25 593000 5731 1 0 0 0 0 0 0 0 0 0 0
26 590000 5040 0 1 0 0 0 0 0 0 0 0 0
27 580000 6102 0 0 1 0 0 0 0 0 0 0 0
28 574000 4904 0 0 0 1 0 0 0 0 0 0 0
29 573000 5369 0 0 0 0 1 0 0 0 0 0 0
30 573000 5578 0 0 0 0 0 1 0 0 0 0 0
31 620000 4619 0 0 0 0 0 0 1 0 0 0 0
32 626000 4731 0 0 0 0 0 0 0 1 0 0 0
33 620000 5011 0 0 0 0 0 0 0 0 1 0 0
34 588000 5299 0 0 0 0 0 0 0 0 0 1 0
35 566000 4146 0 0 0 0 0 0 0 0 0 0 1
36 557000 4625 0 0 0 0 0 0 0 0 0 0 0
37 561000 4736 1 0 0 0 0 0 0 0 0 0 0
38 549000 4219 0 1 0 0 0 0 0 0 0 0 0
39 532000 5116 0 0 1 0 0 0 0 0 0 0 0
40 526000 4205 0 0 0 1 0 0 0 0 0 0 0
41 511000 4121 0 0 0 0 1 0 0 0 0 0 0
42 499000 5103 0 0 0 0 0 1 0 0 0 0 0
43 555000 4300 0 0 0 0 0 0 1 0 0 0 0
44 565000 4578 0 0 0 0 0 0 0 1 0 0 0
45 542000 3809 0 0 0 0 0 0 0 0 1 0 0
46 527000 5526 0 0 0 0 0 0 0 0 0 1 0
47 510000 4247 0 0 0 0 0 0 0 0 0 0 1
48 514000 3830 0 0 0 0 0 0 0 0 0 0 0
49 517000 4394 1 0 0 0 0 0 0 0 0 0 0
50 508000 4826 0 1 0 0 0 0 0 0 0 0 0
51 493000 4409 0 0 1 0 0 0 0 0 0 0 0
52 490000 4569 0 0 0 1 0 0 0 0 0 0 0
53 469000 4106 0 0 0 0 1 0 0 0 0 0 0
54 478000 4794 0 0 0 0 0 1 0 0 0 0 0
55 528000 3914 0 0 0 0 0 0 1 0 0 0 0
56 534000 3793 0 0 0 0 0 0 0 1 0 0 0
57 518000 4405 0 0 0 0 0 0 0 0 1 0 0
58 506000 4022 0 0 0 0 0 0 0 0 0 1 0
59 502000 4100 0 0 0 0 0 0 0 0 0 0 1
60 516000 4788 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) bouw M1 M2 M3 M4
381414.28 37.45 4992.94 10048.74 -28068.89 -8865.02
M5 M6 M7 M8 M9 M10
-24939.27 -48445.99 45513.45 48135.15 33732.76 5862.19
M11
14849.08
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-67220 -27068 2047 23393 52255
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 381414.279 47610.143 8.011 2.45e-10 ***
bouw 37.449 9.613 3.896 0.000309 ***
M1 4992.941 22950.216 0.218 0.828717
M2 10048.744 22986.838 0.437 0.664003
M3 -28068.893 23556.425 -1.192 0.239416
M4 -8865.015 22971.137 -0.386 0.701298
M5 -24939.268 22927.571 -1.088 0.282256
M6 -48445.993 23811.563 -2.035 0.047559 *
M7 45513.449 23373.705 1.947 0.057499 .
M8 48135.152 23098.354 2.084 0.042630 *
M9 33732.759 22967.985 1.469 0.148580
M10 5862.192 23000.253 0.255 0.799932
M11 14849.079 23350.808 0.636 0.527918
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 36250 on 47 degrees of freedom
Multiple R-squared: 0.4057, Adjusted R-squared: 0.254
F-statistic: 2.674 on 12 and 47 DF, p-value: 0.00802
> 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.2880467932 0.5760935864 0.7119532
[2,] 0.1504091405 0.3008182810 0.8495909
[3,] 0.1056482847 0.2112965695 0.8943517
[4,] 0.0818409163 0.1636818326 0.9181591
[5,] 0.0403658390 0.0807316779 0.9596342
[6,] 0.0189253117 0.0378506233 0.9810747
[7,] 0.0155102153 0.0310204305 0.9844898
[8,] 0.0095976092 0.0191952184 0.9904024
[9,] 0.0055791854 0.0111583708 0.9944208
[10,] 0.0023371358 0.0046742717 0.9976629
[11,] 0.0010949588 0.0021899175 0.9989050
[12,] 0.0004120905 0.0008241810 0.9995879
[13,] 0.0002210301 0.0004420602 0.9997790
[14,] 0.0001163080 0.0002326160 0.9998837
[15,] 0.0001287847 0.0002575695 0.9998712
[16,] 0.0001101768 0.0002203536 0.9998898
[17,] 0.0001057632 0.0002115264 0.9998942
[18,] 0.0001953656 0.0003907311 0.9998046
[19,] 0.0019279106 0.0038558211 0.9980721
[20,] 0.0133094433 0.0266188865 0.9866906
[21,] 0.0375157341 0.0750314682 0.9624843
[22,] 0.0552319645 0.1104639290 0.9447680
[23,] 0.1456084046 0.2912168093 0.8543916
[24,] 0.2174323698 0.4348647396 0.7825676
[25,] 0.3827338957 0.7654677914 0.6172661
[26,] 0.6492370617 0.7015258766 0.3507629
[27,] 0.6955099290 0.6089801421 0.3044901
[28,] 0.7555184210 0.4889631581 0.2444816
[29,] 0.8019216238 0.3961567524 0.1980784
> postscript(file="/var/www/html/rcomp/tmp/137bl1258815930.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/2xv3r1258815930.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/3l1h11258815930.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/49pz41258815930.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/5kame1258815930.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
-4687.4373 23185.6911 5046.5661 24013.4250 30578.5843 1814.4290
7 8 9 10 11 12
20196.6981 40679.2064 42888.3709 50184.1592 48089.8304 52254.7743
13 14 15 16 17 18
49440.9437 31674.6830 35207.4898 15863.8664 -4994.8806 26616.0561
19 20 21 22 23 24
38171.4525 13627.8767 17817.7784 46652.8118 30552.5002 927.1821
25 26 27 28 29 30
-8028.3095 9793.2512 -1860.1113 17800.0952 15460.4920 31140.3442
31 32 33 34 35 36
20094.6393 19278.6308 17195.2613 2280.4732 14472.4576 2383.3932
37 38 39 40 41 42
-2766.4034 -460.9951 -12935.2475 -4022.9477 197.0335 -25071.3086
43 44 45 46 47 48
-32959.0813 -35991.6490 -15790.8581 -67220.4843 -45309.9067 -10844.5311
49 50 51 52 53 54
-33958.7935 -64192.6303 -25458.6971 -53654.4389 -41241.2292 -34499.5207
55 56 57 58 59 60
-45503.7087 -37594.0648 -62110.5526 -31896.9599 -47804.8814 -44720.8186
> postscript(file="/var/www/html/rcomp/tmp/6a7mq1258815930.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 -4687.4373 NA
1 23185.6911 -4687.4373
2 5046.5661 23185.6911
3 24013.4250 5046.5661
4 30578.5843 24013.4250
5 1814.4290 30578.5843
6 20196.6981 1814.4290
7 40679.2064 20196.6981
8 42888.3709 40679.2064
9 50184.1592 42888.3709
10 48089.8304 50184.1592
11 52254.7743 48089.8304
12 49440.9437 52254.7743
13 31674.6830 49440.9437
14 35207.4898 31674.6830
15 15863.8664 35207.4898
16 -4994.8806 15863.8664
17 26616.0561 -4994.8806
18 38171.4525 26616.0561
19 13627.8767 38171.4525
20 17817.7784 13627.8767
21 46652.8118 17817.7784
22 30552.5002 46652.8118
23 927.1821 30552.5002
24 -8028.3095 927.1821
25 9793.2512 -8028.3095
26 -1860.1113 9793.2512
27 17800.0952 -1860.1113
28 15460.4920 17800.0952
29 31140.3442 15460.4920
30 20094.6393 31140.3442
31 19278.6308 20094.6393
32 17195.2613 19278.6308
33 2280.4732 17195.2613
34 14472.4576 2280.4732
35 2383.3932 14472.4576
36 -2766.4034 2383.3932
37 -460.9951 -2766.4034
38 -12935.2475 -460.9951
39 -4022.9477 -12935.2475
40 197.0335 -4022.9477
41 -25071.3086 197.0335
42 -32959.0813 -25071.3086
43 -35991.6490 -32959.0813
44 -15790.8581 -35991.6490
45 -67220.4843 -15790.8581
46 -45309.9067 -67220.4843
47 -10844.5311 -45309.9067
48 -33958.7935 -10844.5311
49 -64192.6303 -33958.7935
50 -25458.6971 -64192.6303
51 -53654.4389 -25458.6971
52 -41241.2292 -53654.4389
53 -34499.5207 -41241.2292
54 -45503.7087 -34499.5207
55 -37594.0648 -45503.7087
56 -62110.5526 -37594.0648
57 -31896.9599 -62110.5526
58 -47804.8814 -31896.9599
59 -44720.8186 -47804.8814
60 NA -44720.8186
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 23185.6911 -4687.4373
[2,] 5046.5661 23185.6911
[3,] 24013.4250 5046.5661
[4,] 30578.5843 24013.4250
[5,] 1814.4290 30578.5843
[6,] 20196.6981 1814.4290
[7,] 40679.2064 20196.6981
[8,] 42888.3709 40679.2064
[9,] 50184.1592 42888.3709
[10,] 48089.8304 50184.1592
[11,] 52254.7743 48089.8304
[12,] 49440.9437 52254.7743
[13,] 31674.6830 49440.9437
[14,] 35207.4898 31674.6830
[15,] 15863.8664 35207.4898
[16,] -4994.8806 15863.8664
[17,] 26616.0561 -4994.8806
[18,] 38171.4525 26616.0561
[19,] 13627.8767 38171.4525
[20,] 17817.7784 13627.8767
[21,] 46652.8118 17817.7784
[22,] 30552.5002 46652.8118
[23,] 927.1821 30552.5002
[24,] -8028.3095 927.1821
[25,] 9793.2512 -8028.3095
[26,] -1860.1113 9793.2512
[27,] 17800.0952 -1860.1113
[28,] 15460.4920 17800.0952
[29,] 31140.3442 15460.4920
[30,] 20094.6393 31140.3442
[31,] 19278.6308 20094.6393
[32,] 17195.2613 19278.6308
[33,] 2280.4732 17195.2613
[34,] 14472.4576 2280.4732
[35,] 2383.3932 14472.4576
[36,] -2766.4034 2383.3932
[37,] -460.9951 -2766.4034
[38,] -12935.2475 -460.9951
[39,] -4022.9477 -12935.2475
[40,] 197.0335 -4022.9477
[41,] -25071.3086 197.0335
[42,] -32959.0813 -25071.3086
[43,] -35991.6490 -32959.0813
[44,] -15790.8581 -35991.6490
[45,] -67220.4843 -15790.8581
[46,] -45309.9067 -67220.4843
[47,] -10844.5311 -45309.9067
[48,] -33958.7935 -10844.5311
[49,] -64192.6303 -33958.7935
[50,] -25458.6971 -64192.6303
[51,] -53654.4389 -25458.6971
[52,] -41241.2292 -53654.4389
[53,] -34499.5207 -41241.2292
[54,] -45503.7087 -34499.5207
[55,] -37594.0648 -45503.7087
[56,] -62110.5526 -37594.0648
[57,] -31896.9599 -62110.5526
[58,] -47804.8814 -31896.9599
[59,] -44720.8186 -47804.8814
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 23185.6911 -4687.4373
2 5046.5661 23185.6911
3 24013.4250 5046.5661
4 30578.5843 24013.4250
5 1814.4290 30578.5843
6 20196.6981 1814.4290
7 40679.2064 20196.6981
8 42888.3709 40679.2064
9 50184.1592 42888.3709
10 48089.8304 50184.1592
11 52254.7743 48089.8304
12 49440.9437 52254.7743
13 31674.6830 49440.9437
14 35207.4898 31674.6830
15 15863.8664 35207.4898
16 -4994.8806 15863.8664
17 26616.0561 -4994.8806
18 38171.4525 26616.0561
19 13627.8767 38171.4525
20 17817.7784 13627.8767
21 46652.8118 17817.7784
22 30552.5002 46652.8118
23 927.1821 30552.5002
24 -8028.3095 927.1821
25 9793.2512 -8028.3095
26 -1860.1113 9793.2512
27 17800.0952 -1860.1113
28 15460.4920 17800.0952
29 31140.3442 15460.4920
30 20094.6393 31140.3442
31 19278.6308 20094.6393
32 17195.2613 19278.6308
33 2280.4732 17195.2613
34 14472.4576 2280.4732
35 2383.3932 14472.4576
36 -2766.4034 2383.3932
37 -460.9951 -2766.4034
38 -12935.2475 -460.9951
39 -4022.9477 -12935.2475
40 197.0335 -4022.9477
41 -25071.3086 197.0335
42 -32959.0813 -25071.3086
43 -35991.6490 -32959.0813
44 -15790.8581 -35991.6490
45 -67220.4843 -15790.8581
46 -45309.9067 -67220.4843
47 -10844.5311 -45309.9067
48 -33958.7935 -10844.5311
49 -64192.6303 -33958.7935
50 -25458.6971 -64192.6303
51 -53654.4389 -25458.6971
52 -41241.2292 -53654.4389
53 -34499.5207 -41241.2292
54 -45503.7087 -34499.5207
55 -37594.0648 -45503.7087
56 -62110.5526 -37594.0648
57 -31896.9599 -62110.5526
58 -47804.8814 -31896.9599
59 -44720.8186 -47804.8814
> 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/78ihy1258815930.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/8uz0i1258815930.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/9abbn1258815930.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/10x0yv1258815930.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/118k9t1258815930.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/12tvzn1258815930.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/13vo8r1258815930.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/14z57t1258815930.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/15g97v1258815930.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/169gtl1258815930.tab")
+ }
>
> system("convert tmp/137bl1258815930.ps tmp/137bl1258815930.png")
> system("convert tmp/2xv3r1258815930.ps tmp/2xv3r1258815930.png")
> system("convert tmp/3l1h11258815930.ps tmp/3l1h11258815930.png")
> system("convert tmp/49pz41258815930.ps tmp/49pz41258815930.png")
> system("convert tmp/5kame1258815930.ps tmp/5kame1258815930.png")
> system("convert tmp/6a7mq1258815930.ps tmp/6a7mq1258815930.png")
> system("convert tmp/78ihy1258815930.ps tmp/78ihy1258815930.png")
> system("convert tmp/8uz0i1258815930.ps tmp/8uz0i1258815930.png")
> system("convert tmp/9abbn1258815930.ps tmp/9abbn1258815930.png")
> system("convert tmp/10x0yv1258815930.ps tmp/10x0yv1258815930.png")
>
>
> proc.time()
user system elapsed
2.385 1.539 2.915