R version 2.7.0 (2008-04-22)
Copyright (C) 2008 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(98.6,0,98,0,106.8,0,96.6,0,100.1,0,107.7,0,91.5,0,97.8,0,107.4,1,117.5,1,105.6,1,97.4,1,99.5,1,98,1,104.3,1,100.6,1,101.1,1,103.9,1,96.9,1,95.5,1,108.4,1,117,1,103.8,1,100.8,1,110.6,1,104,1,112.6,1,107.3,1,98.9,1,109.8,1,104.9,1,102.2,1,123.9,1,124.9,1,112.7,1,121.9,1,100.6,1,104.3,1,120.4,1,107.5,1,102.9,1,125.6,1,107.5,1,108.8,1,128.4,1,121.1,1,119.5,1,128.7,1,108.7,1,105.5,1,119.8,1,111.3,1,110.6,1,120.1,1,97.5,1,107.7,1,127.3,1,117.2,1,119.8,1,116.2,1),dim=c(2,60),dimnames=list(c('Werkloosheid','Dummy'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Werkloosheid','Dummy'),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
Werkloosheid Dummy M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 98.6 0 1 0 0 0 0 0 0 0 0 0 0 1
2 98.0 0 0 1 0 0 0 0 0 0 0 0 0 2
3 106.8 0 0 0 1 0 0 0 0 0 0 0 0 3
4 96.6 0 0 0 0 1 0 0 0 0 0 0 0 4
5 100.1 0 0 0 0 0 1 0 0 0 0 0 0 5
6 107.7 0 0 0 0 0 0 1 0 0 0 0 0 6
7 91.5 0 0 0 0 0 0 0 1 0 0 0 0 7
8 97.8 0 0 0 0 0 0 0 0 1 0 0 0 8
9 107.4 1 0 0 0 0 0 0 0 0 1 0 0 9
10 117.5 1 0 0 0 0 0 0 0 0 0 1 0 10
11 105.6 1 0 0 0 0 0 0 0 0 0 0 1 11
12 97.4 1 0 0 0 0 0 0 0 0 0 0 0 12
13 99.5 1 1 0 0 0 0 0 0 0 0 0 0 13
14 98.0 1 0 1 0 0 0 0 0 0 0 0 0 14
15 104.3 1 0 0 1 0 0 0 0 0 0 0 0 15
16 100.6 1 0 0 0 1 0 0 0 0 0 0 0 16
17 101.1 1 0 0 0 0 1 0 0 0 0 0 0 17
18 103.9 1 0 0 0 0 0 1 0 0 0 0 0 18
19 96.9 1 0 0 0 0 0 0 1 0 0 0 0 19
20 95.5 1 0 0 0 0 0 0 0 1 0 0 0 20
21 108.4 1 0 0 0 0 0 0 0 0 1 0 0 21
22 117.0 1 0 0 0 0 0 0 0 0 0 1 0 22
23 103.8 1 0 0 0 0 0 0 0 0 0 0 1 23
24 100.8 1 0 0 0 0 0 0 0 0 0 0 0 24
25 110.6 1 1 0 0 0 0 0 0 0 0 0 0 25
26 104.0 1 0 1 0 0 0 0 0 0 0 0 0 26
27 112.6 1 0 0 1 0 0 0 0 0 0 0 0 27
28 107.3 1 0 0 0 1 0 0 0 0 0 0 0 28
29 98.9 1 0 0 0 0 1 0 0 0 0 0 0 29
30 109.8 1 0 0 0 0 0 1 0 0 0 0 0 30
31 104.9 1 0 0 0 0 0 0 1 0 0 0 0 31
32 102.2 1 0 0 0 0 0 0 0 1 0 0 0 32
33 123.9 1 0 0 0 0 0 0 0 0 1 0 0 33
34 124.9 1 0 0 0 0 0 0 0 0 0 1 0 34
35 112.7 1 0 0 0 0 0 0 0 0 0 0 1 35
36 121.9 1 0 0 0 0 0 0 0 0 0 0 0 36
37 100.6 1 1 0 0 0 0 0 0 0 0 0 0 37
38 104.3 1 0 1 0 0 0 0 0 0 0 0 0 38
39 120.4 1 0 0 1 0 0 0 0 0 0 0 0 39
40 107.5 1 0 0 0 1 0 0 0 0 0 0 0 40
41 102.9 1 0 0 0 0 1 0 0 0 0 0 0 41
42 125.6 1 0 0 0 0 0 1 0 0 0 0 0 42
43 107.5 1 0 0 0 0 0 0 1 0 0 0 0 43
44 108.8 1 0 0 0 0 0 0 0 1 0 0 0 44
45 128.4 1 0 0 0 0 0 0 0 0 1 0 0 45
46 121.1 1 0 0 0 0 0 0 0 0 0 1 0 46
47 119.5 1 0 0 0 0 0 0 0 0 0 0 1 47
48 128.7 1 0 0 0 0 0 0 0 0 0 0 0 48
49 108.7 1 1 0 0 0 0 0 0 0 0 0 0 49
50 105.5 1 0 1 0 0 0 0 0 0 0 0 0 50
51 119.8 1 0 0 1 0 0 0 0 0 0 0 0 51
52 111.3 1 0 0 0 1 0 0 0 0 0 0 0 52
53 110.6 1 0 0 0 0 1 0 0 0 0 0 0 53
54 120.1 1 0 0 0 0 0 1 0 0 0 0 0 54
55 97.5 1 0 0 0 0 0 0 1 0 0 0 0 55
56 107.7 1 0 0 0 0 0 0 0 1 0 0 0 56
57 127.3 1 0 0 0 0 0 0 0 0 1 0 0 57
58 117.2 1 0 0 0 0 0 0 0 0 0 1 0 58
59 119.8 1 0 0 0 0 0 0 0 0 0 0 1 59
60 116.2 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) Dummy M1 M2 M3 M4
104.1803 -2.7547 -6.4143 -8.3758 2.1227 -6.3189
M5 M6 M7 M8 M9 M10
-8.5804 1.7981 -12.2834 -9.8649 7.0445 7.1830
M11 t
-0.3985 0.3215
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-10.0562 -2.7529 0.3291 2.8149 11.8419
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 104.1803 3.0497 34.161 < 2e-16 ***
Dummy -2.7547 2.4629 -1.118 0.269166
M1 -6.4143 3.2512 -1.973 0.054531 .
M2 -8.3758 3.2481 -2.579 0.013182 *
M3 2.1227 3.2456 0.654 0.516366
M4 -6.3189 3.2439 -1.948 0.057542 .
M5 -8.5804 3.2429 -2.646 0.011113 *
M6 1.7981 3.2425 0.555 0.581892
M7 -12.2834 3.2429 -3.788 0.000440 ***
M8 -9.8649 3.2439 -3.041 0.003884 **
M9 7.0445 3.2206 2.187 0.033840 *
M10 7.1830 3.2189 2.232 0.030560 *
M11 -0.3985 3.2178 -0.124 0.901983
t 0.3215 0.0474 6.783 1.93e-08 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.087 on 46 degrees of freedom
Multiple R-squared: 0.779, Adjusted R-squared: 0.7166
F-statistic: 12.47 on 13 and 46 DF, p-value: 4.951e-11
> 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.045142808 0.090285616 0.9548572
[2,] 0.036147967 0.072295934 0.9638520
[3,] 0.034549689 0.069099377 0.9654503
[4,] 0.017451806 0.034903612 0.9825482
[5,] 0.009145718 0.018291436 0.9908543
[6,] 0.003355589 0.006711178 0.9966444
[7,] 0.001666948 0.003333897 0.9983331
[8,] 0.004886822 0.009773643 0.9951132
[9,] 0.068391780 0.136783561 0.9316082
[10,] 0.042723999 0.085447997 0.9572760
[11,] 0.032011382 0.064022765 0.9679886
[12,] 0.023739402 0.047478804 0.9762606
[13,] 0.039643611 0.079287221 0.9603564
[14,] 0.066324458 0.132648916 0.9336755
[15,] 0.075745654 0.151491309 0.9242543
[16,] 0.061471467 0.122942934 0.9385285
[17,] 0.109121930 0.218243860 0.8908781
[18,] 0.089869611 0.179739223 0.9101304
[19,] 0.097959367 0.195918735 0.9020406
[20,] 0.249495158 0.498990316 0.7505048
[21,] 0.514024790 0.971950420 0.4859752
[22,] 0.445505395 0.891010789 0.5544946
[23,] 0.347066724 0.694133449 0.6529333
[24,] 0.327074243 0.654148486 0.6729258
[25,] 0.604138930 0.791722141 0.3958611
[26,] 0.514410755 0.971178491 0.4855892
[27,] 0.463889357 0.927778714 0.5361106
> postscript(file="/var/www/html/rcomp/tmp/12nnr1229783427.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/2xx7j1229783427.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/376661229783427.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/460fs1229783427.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/5blpr1229783427.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.5125000 1.5525000 -0.4675000 -2.5475000 2.8925000 -0.2075000
7 8 9 10 11 12
-2.6475000 0.9125000 -3.9637500 5.6762500 1.0362500 -7.8837500
13 14 15 16 17 18
0.3090625 0.4490625 -4.0709375 0.3490625 2.7890625 -5.1109375
19 20 21 22 23 24
1.6490625 -2.4909375 -6.8218750 1.3181250 -4.6218750 -8.3418750
25 26 27 28 29 30
7.5509375 2.5909375 0.3709375 3.1909375 -3.2690625 -3.0690625
31 32 33 34 35 36
5.7909375 0.3509375 4.8200000 5.3600000 0.4200000 8.9000000
37 38 39 40 41 42
-6.3071875 -0.9671875 4.3128125 -0.4671875 -3.1271875 8.8728125
43 44 45 46 47 48
4.5328125 3.0928125 5.4618750 -2.2981250 3.3618750 11.8418750
49 50 51 52 53 54
-2.0653125 -3.6253125 -0.1453125 -0.5253125 0.7146875 -0.4853125
55 56 57 58 59 60
-9.3253125 -1.8653125 0.5037500 -10.0562500 -0.1962500 -4.5162500
> postscript(file="/var/www/html/rcomp/tmp/6nhx61229783427.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.5125000 NA
1 1.5525000 0.5125000
2 -0.4675000 1.5525000
3 -2.5475000 -0.4675000
4 2.8925000 -2.5475000
5 -0.2075000 2.8925000
6 -2.6475000 -0.2075000
7 0.9125000 -2.6475000
8 -3.9637500 0.9125000
9 5.6762500 -3.9637500
10 1.0362500 5.6762500
11 -7.8837500 1.0362500
12 0.3090625 -7.8837500
13 0.4490625 0.3090625
14 -4.0709375 0.4490625
15 0.3490625 -4.0709375
16 2.7890625 0.3490625
17 -5.1109375 2.7890625
18 1.6490625 -5.1109375
19 -2.4909375 1.6490625
20 -6.8218750 -2.4909375
21 1.3181250 -6.8218750
22 -4.6218750 1.3181250
23 -8.3418750 -4.6218750
24 7.5509375 -8.3418750
25 2.5909375 7.5509375
26 0.3709375 2.5909375
27 3.1909375 0.3709375
28 -3.2690625 3.1909375
29 -3.0690625 -3.2690625
30 5.7909375 -3.0690625
31 0.3509375 5.7909375
32 4.8200000 0.3509375
33 5.3600000 4.8200000
34 0.4200000 5.3600000
35 8.9000000 0.4200000
36 -6.3071875 8.9000000
37 -0.9671875 -6.3071875
38 4.3128125 -0.9671875
39 -0.4671875 4.3128125
40 -3.1271875 -0.4671875
41 8.8728125 -3.1271875
42 4.5328125 8.8728125
43 3.0928125 4.5328125
44 5.4618750 3.0928125
45 -2.2981250 5.4618750
46 3.3618750 -2.2981250
47 11.8418750 3.3618750
48 -2.0653125 11.8418750
49 -3.6253125 -2.0653125
50 -0.1453125 -3.6253125
51 -0.5253125 -0.1453125
52 0.7146875 -0.5253125
53 -0.4853125 0.7146875
54 -9.3253125 -0.4853125
55 -1.8653125 -9.3253125
56 0.5037500 -1.8653125
57 -10.0562500 0.5037500
58 -0.1962500 -10.0562500
59 -4.5162500 -0.1962500
60 NA -4.5162500
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 1.5525000 0.5125000
[2,] -0.4675000 1.5525000
[3,] -2.5475000 -0.4675000
[4,] 2.8925000 -2.5475000
[5,] -0.2075000 2.8925000
[6,] -2.6475000 -0.2075000
[7,] 0.9125000 -2.6475000
[8,] -3.9637500 0.9125000
[9,] 5.6762500 -3.9637500
[10,] 1.0362500 5.6762500
[11,] -7.8837500 1.0362500
[12,] 0.3090625 -7.8837500
[13,] 0.4490625 0.3090625
[14,] -4.0709375 0.4490625
[15,] 0.3490625 -4.0709375
[16,] 2.7890625 0.3490625
[17,] -5.1109375 2.7890625
[18,] 1.6490625 -5.1109375
[19,] -2.4909375 1.6490625
[20,] -6.8218750 -2.4909375
[21,] 1.3181250 -6.8218750
[22,] -4.6218750 1.3181250
[23,] -8.3418750 -4.6218750
[24,] 7.5509375 -8.3418750
[25,] 2.5909375 7.5509375
[26,] 0.3709375 2.5909375
[27,] 3.1909375 0.3709375
[28,] -3.2690625 3.1909375
[29,] -3.0690625 -3.2690625
[30,] 5.7909375 -3.0690625
[31,] 0.3509375 5.7909375
[32,] 4.8200000 0.3509375
[33,] 5.3600000 4.8200000
[34,] 0.4200000 5.3600000
[35,] 8.9000000 0.4200000
[36,] -6.3071875 8.9000000
[37,] -0.9671875 -6.3071875
[38,] 4.3128125 -0.9671875
[39,] -0.4671875 4.3128125
[40,] -3.1271875 -0.4671875
[41,] 8.8728125 -3.1271875
[42,] 4.5328125 8.8728125
[43,] 3.0928125 4.5328125
[44,] 5.4618750 3.0928125
[45,] -2.2981250 5.4618750
[46,] 3.3618750 -2.2981250
[47,] 11.8418750 3.3618750
[48,] -2.0653125 11.8418750
[49,] -3.6253125 -2.0653125
[50,] -0.1453125 -3.6253125
[51,] -0.5253125 -0.1453125
[52,] 0.7146875 -0.5253125
[53,] -0.4853125 0.7146875
[54,] -9.3253125 -0.4853125
[55,] -1.8653125 -9.3253125
[56,] 0.5037500 -1.8653125
[57,] -10.0562500 0.5037500
[58,] -0.1962500 -10.0562500
[59,] -4.5162500 -0.1962500
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 1.5525000 0.5125000
2 -0.4675000 1.5525000
3 -2.5475000 -0.4675000
4 2.8925000 -2.5475000
5 -0.2075000 2.8925000
6 -2.6475000 -0.2075000
7 0.9125000 -2.6475000
8 -3.9637500 0.9125000
9 5.6762500 -3.9637500
10 1.0362500 5.6762500
11 -7.8837500 1.0362500
12 0.3090625 -7.8837500
13 0.4490625 0.3090625
14 -4.0709375 0.4490625
15 0.3490625 -4.0709375
16 2.7890625 0.3490625
17 -5.1109375 2.7890625
18 1.6490625 -5.1109375
19 -2.4909375 1.6490625
20 -6.8218750 -2.4909375
21 1.3181250 -6.8218750
22 -4.6218750 1.3181250
23 -8.3418750 -4.6218750
24 7.5509375 -8.3418750
25 2.5909375 7.5509375
26 0.3709375 2.5909375
27 3.1909375 0.3709375
28 -3.2690625 3.1909375
29 -3.0690625 -3.2690625
30 5.7909375 -3.0690625
31 0.3509375 5.7909375
32 4.8200000 0.3509375
33 5.3600000 4.8200000
34 0.4200000 5.3600000
35 8.9000000 0.4200000
36 -6.3071875 8.9000000
37 -0.9671875 -6.3071875
38 4.3128125 -0.9671875
39 -0.4671875 4.3128125
40 -3.1271875 -0.4671875
41 8.8728125 -3.1271875
42 4.5328125 8.8728125
43 3.0928125 4.5328125
44 5.4618750 3.0928125
45 -2.2981250 5.4618750
46 3.3618750 -2.2981250
47 11.8418750 3.3618750
48 -2.0653125 11.8418750
49 -3.6253125 -2.0653125
50 -0.1453125 -3.6253125
51 -0.5253125 -0.1453125
52 0.7146875 -0.5253125
53 -0.4853125 0.7146875
54 -9.3253125 -0.4853125
55 -1.8653125 -9.3253125
56 0.5037500 -1.8653125
57 -10.0562500 0.5037500
58 -0.1962500 -10.0562500
59 -4.5162500 -0.1962500
> 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/7jogd1229783427.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/8lxm71229783427.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/9hbc61229783427.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/10f6o81229783427.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/117pvp1229783428.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/12s2sm1229783428.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/13evpm1229783428.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/14cokb1229783428.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/15n24j1229783428.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/164noo1229783428.tab")
+ }
>
> system("convert tmp/12nnr1229783427.ps tmp/12nnr1229783427.png")
> system("convert tmp/2xx7j1229783427.ps tmp/2xx7j1229783427.png")
> system("convert tmp/376661229783427.ps tmp/376661229783427.png")
> system("convert tmp/460fs1229783427.ps tmp/460fs1229783427.png")
> system("convert tmp/5blpr1229783427.ps tmp/5blpr1229783427.png")
> system("convert tmp/6nhx61229783427.ps tmp/6nhx61229783427.png")
> system("convert tmp/7jogd1229783427.ps tmp/7jogd1229783427.png")
> system("convert tmp/8lxm71229783427.ps tmp/8lxm71229783427.png")
> system("convert tmp/9hbc61229783427.ps tmp/9hbc61229783427.png")
> system("convert tmp/10f6o81229783427.ps tmp/10f6o81229783427.png")
>
>
> proc.time()
user system elapsed
4.903 2.683 5.304