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(100.0,100.0,95.3,100.6,90.7,114.2,88.4,91.5,86.0,94.7,86.0,110.6,95.3,71.3,95.3,104.1,88.4,112.3,86.0,110.2,81.4,112.9,83.7,95.1,95.3,103.1,88.4,101.9,86.0,100.4,83.7,106.9,76.7,100.7,79.1,114.3,86.0,73.3,86.0,105.9,79.1,113.9,76.7,112.1,69.8,117.5,69.8,97.5,76.7,112.3,69.8,106.9,67.4,120.9,65.1,92.7,58.1,110.9,60.5,116.5,65.1,77.1,62.8,113.1,55.8,115.9,51.2,123.5,48.8,123.6,48.8,101.5,53.5,121.0,48.8,112.2,46.5,126.0,44.2,101.8,39.5,117.9,41.9,122.2,48.8,82.7,46.5,120.5,41.9,120.3,39.5,134.2,37.2,128.2,37.2,100.5,41.9,126.0,39.5,122.9,39.5,106.1,34.9,130.4,34.9,121.3,34.9,126.1,41.9,88.7,41.9,118.7,39.5,129.3,39.5,136.2,41.9,123.0,46.5,103.5),dim=c(2,60),dimnames=list(c('Werkloosheid','Productie'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Werkloosheid','Productie'),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 Productie M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 100.0 100.0 1 0 0 0 0 0 0 0 0 0 0 1
2 95.3 100.6 0 1 0 0 0 0 0 0 0 0 0 2
3 90.7 114.2 0 0 1 0 0 0 0 0 0 0 0 3
4 88.4 91.5 0 0 0 1 0 0 0 0 0 0 0 4
5 86.0 94.7 0 0 0 0 1 0 0 0 0 0 0 5
6 86.0 110.6 0 0 0 0 0 1 0 0 0 0 0 6
7 95.3 71.3 0 0 0 0 0 0 1 0 0 0 0 7
8 95.3 104.1 0 0 0 0 0 0 0 1 0 0 0 8
9 88.4 112.3 0 0 0 0 0 0 0 0 1 0 0 9
10 86.0 110.2 0 0 0 0 0 0 0 0 0 1 0 10
11 81.4 112.9 0 0 0 0 0 0 0 0 0 0 1 11
12 83.7 95.1 0 0 0 0 0 0 0 0 0 0 0 12
13 95.3 103.1 1 0 0 0 0 0 0 0 0 0 0 13
14 88.4 101.9 0 1 0 0 0 0 0 0 0 0 0 14
15 86.0 100.4 0 0 1 0 0 0 0 0 0 0 0 15
16 83.7 106.9 0 0 0 1 0 0 0 0 0 0 0 16
17 76.7 100.7 0 0 0 0 1 0 0 0 0 0 0 17
18 79.1 114.3 0 0 0 0 0 1 0 0 0 0 0 18
19 86.0 73.3 0 0 0 0 0 0 1 0 0 0 0 19
20 86.0 105.9 0 0 0 0 0 0 0 1 0 0 0 20
21 79.1 113.9 0 0 0 0 0 0 0 0 1 0 0 21
22 76.7 112.1 0 0 0 0 0 0 0 0 0 1 0 22
23 69.8 117.5 0 0 0 0 0 0 0 0 0 0 1 23
24 69.8 97.5 0 0 0 0 0 0 0 0 0 0 0 24
25 76.7 112.3 1 0 0 0 0 0 0 0 0 0 0 25
26 69.8 106.9 0 1 0 0 0 0 0 0 0 0 0 26
27 67.4 120.9 0 0 1 0 0 0 0 0 0 0 0 27
28 65.1 92.7 0 0 0 1 0 0 0 0 0 0 0 28
29 58.1 110.9 0 0 0 0 1 0 0 0 0 0 0 29
30 60.5 116.5 0 0 0 0 0 1 0 0 0 0 0 30
31 65.1 77.1 0 0 0 0 0 0 1 0 0 0 0 31
32 62.8 113.1 0 0 0 0 0 0 0 1 0 0 0 32
33 55.8 115.9 0 0 0 0 0 0 0 0 1 0 0 33
34 51.2 123.5 0 0 0 0 0 0 0 0 0 1 0 34
35 48.8 123.6 0 0 0 0 0 0 0 0 0 0 1 35
36 48.8 101.5 0 0 0 0 0 0 0 0 0 0 0 36
37 53.5 121.0 1 0 0 0 0 0 0 0 0 0 0 37
38 48.8 112.2 0 1 0 0 0 0 0 0 0 0 0 38
39 46.5 126.0 0 0 1 0 0 0 0 0 0 0 0 39
40 44.2 101.8 0 0 0 1 0 0 0 0 0 0 0 40
41 39.5 117.9 0 0 0 0 1 0 0 0 0 0 0 41
42 41.9 122.2 0 0 0 0 0 1 0 0 0 0 0 42
43 48.8 82.7 0 0 0 0 0 0 1 0 0 0 0 43
44 46.5 120.5 0 0 0 0 0 0 0 1 0 0 0 44
45 41.9 120.3 0 0 0 0 0 0 0 0 1 0 0 45
46 39.5 134.2 0 0 0 0 0 0 0 0 0 1 0 46
47 37.2 128.2 0 0 0 0 0 0 0 0 0 0 1 47
48 37.2 100.5 0 0 0 0 0 0 0 0 0 0 0 48
49 41.9 126.0 1 0 0 0 0 0 0 0 0 0 0 49
50 39.5 122.9 0 1 0 0 0 0 0 0 0 0 0 50
51 39.5 106.1 0 0 1 0 0 0 0 0 0 0 0 51
52 34.9 130.4 0 0 0 1 0 0 0 0 0 0 0 52
53 34.9 121.3 0 0 0 0 1 0 0 0 0 0 0 53
54 34.9 126.1 0 0 0 0 0 1 0 0 0 0 0 54
55 41.9 88.7 0 0 0 0 0 0 1 0 0 0 0 55
56 41.9 118.7 0 0 0 0 0 0 0 1 0 0 0 56
57 39.5 129.3 0 0 0 0 0 0 0 0 1 0 0 57
58 39.5 136.2 0 0 0 0 0 0 0 0 0 1 0 58
59 41.9 123.0 0 0 0 0 0 0 0 0 0 0 1 59
60 46.5 103.5 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) Productie M1 M2 M3 M4
122.5787 -0.2824 8.5327 3.4361 3.4354 -0.7925
M5 M6 M7 M8 M9 M10
-2.7240 2.2473 -0.8837 8.7885 5.9238 5.9822
M11 t
3.6354 -1.0345
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-7.8690 -3.6328 -0.3095 3.2430 15.2238
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 122.5787 12.4009 9.885 5.88e-13 ***
Productie -0.2824 0.1411 -2.002 0.0512 .
M1 8.5327 4.3325 1.969 0.0549 .
M2 3.4361 4.0402 0.850 0.3995
M3 3.4354 4.3439 0.791 0.4331
M4 -0.7925 3.7565 -0.211 0.8338
M5 -2.7240 3.9661 -0.687 0.4957
M6 2.2473 4.6089 0.488 0.6281
M7 -0.8838 4.4612 -0.198 0.8438
M8 8.7885 4.1016 2.143 0.0375 *
M9 5.9238 4.5340 1.307 0.1979
M10 5.9822 4.9518 1.208 0.2332
M11 3.6354 4.7040 0.773 0.4436
t -1.0345 0.0703 -14.715 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.625 on 46 degrees of freedom
Multiple R-squared: 0.9437, Adjusted R-squared: 0.9277
F-statistic: 59.28 on 13 and 46 DF, p-value: < 2.2e-16
> 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.0225939756 0.0451879511 0.9774060
[2,] 0.0052892736 0.0105785471 0.9947107
[3,] 0.0029518896 0.0059037791 0.9970481
[4,] 0.0014835630 0.0029671259 0.9985164
[5,] 0.0007068303 0.0014136606 0.9992932
[6,] 0.0002917447 0.0005834894 0.9997083
[7,] 0.0002887593 0.0005775187 0.9997112
[8,] 0.0007101366 0.0014202731 0.9992899
[9,] 0.0047583705 0.0095167411 0.9952416
[10,] 0.0147525736 0.0295051472 0.9852474
[11,] 0.0244674943 0.0489349887 0.9755325
[12,] 0.0403010167 0.0806020334 0.9596990
[13,] 0.0527062858 0.1054125715 0.9472937
[14,] 0.0865498091 0.1730996182 0.9134502
[15,] 0.1764874148 0.3529748296 0.8235126
[16,] 0.3636471452 0.7272942904 0.6363529
[17,] 0.4934834563 0.9869669127 0.5065165
[18,] 0.5331230228 0.9337539545 0.4668770
[19,] 0.4874780688 0.9749561376 0.5125219
[20,] 0.4403277682 0.8806555363 0.5596722
[21,] 0.4934635319 0.9869270638 0.5065365
[22,] 0.4752264044 0.9504528089 0.5247736
[23,] 0.5862432214 0.8275135573 0.4137568
[24,] 0.4919712502 0.9839425004 0.5080287
[25,] 0.3810449290 0.7620898579 0.6189551
[26,] 0.3421950130 0.6843900260 0.6578050
[27,] 0.3228347677 0.6456695354 0.6771652
> postscript(file="/var/www/html/rcomp/tmp/1yhyk1261306627.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/2rcyv1261306627.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/3vgig1261306627.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/4va8x1261306627.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/5lms11261306627.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
-1.83283045 -0.23222913 0.04408664 -3.40489000 -1.93511623 -1.38108624
7 8 9 10 11 12
0.98456257 1.61082444 0.92608642 -1.09099714 -1.54703865 0.39539599
13 14 15 16 17 18
6.75672158 5.64892999 3.86039408 8.65868028 2.87351328 5.17793009
19 20 21 22 23 24
4.66343004 5.23320381 4.49197769 2.55962628 0.56617415 -0.41276033
25 26 27 28 29 30
3.16916071 0.87511898 3.46441095 -1.53798848 -0.43160709 -0.38671433
31 32 33 34 35 36
-2.74930957 -3.51923807 -5.82915484 -7.30656547 -6.29695230 -7.86901184
37 38 39 40 41 42
-5.15962041 -6.21395987 -3.58115600 -7.45379340 -4.64053707 -4.96281698
43 44 45 46 47 48
-5.05365627 -5.31519186 -6.07243015 -3.57046557 -4.18373951 -7.33746590
49 50 51 52 53 54
-2.93343142 -0.07785997 -3.78773566 3.73799159 4.13374711 1.55268746
55 56 57 58 59 60
2.15497323 1.99040168 6.48352088 9.40840190 11.46155631 15.22384208
> postscript(file="/var/www/html/rcomp/tmp/6pssi1261306627.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 -1.83283045 NA
1 -0.23222913 -1.83283045
2 0.04408664 -0.23222913
3 -3.40489000 0.04408664
4 -1.93511623 -3.40489000
5 -1.38108624 -1.93511623
6 0.98456257 -1.38108624
7 1.61082444 0.98456257
8 0.92608642 1.61082444
9 -1.09099714 0.92608642
10 -1.54703865 -1.09099714
11 0.39539599 -1.54703865
12 6.75672158 0.39539599
13 5.64892999 6.75672158
14 3.86039408 5.64892999
15 8.65868028 3.86039408
16 2.87351328 8.65868028
17 5.17793009 2.87351328
18 4.66343004 5.17793009
19 5.23320381 4.66343004
20 4.49197769 5.23320381
21 2.55962628 4.49197769
22 0.56617415 2.55962628
23 -0.41276033 0.56617415
24 3.16916071 -0.41276033
25 0.87511898 3.16916071
26 3.46441095 0.87511898
27 -1.53798848 3.46441095
28 -0.43160709 -1.53798848
29 -0.38671433 -0.43160709
30 -2.74930957 -0.38671433
31 -3.51923807 -2.74930957
32 -5.82915484 -3.51923807
33 -7.30656547 -5.82915484
34 -6.29695230 -7.30656547
35 -7.86901184 -6.29695230
36 -5.15962041 -7.86901184
37 -6.21395987 -5.15962041
38 -3.58115600 -6.21395987
39 -7.45379340 -3.58115600
40 -4.64053707 -7.45379340
41 -4.96281698 -4.64053707
42 -5.05365627 -4.96281698
43 -5.31519186 -5.05365627
44 -6.07243015 -5.31519186
45 -3.57046557 -6.07243015
46 -4.18373951 -3.57046557
47 -7.33746590 -4.18373951
48 -2.93343142 -7.33746590
49 -0.07785997 -2.93343142
50 -3.78773566 -0.07785997
51 3.73799159 -3.78773566
52 4.13374711 3.73799159
53 1.55268746 4.13374711
54 2.15497323 1.55268746
55 1.99040168 2.15497323
56 6.48352088 1.99040168
57 9.40840190 6.48352088
58 11.46155631 9.40840190
59 15.22384208 11.46155631
60 NA 15.22384208
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.23222913 -1.83283045
[2,] 0.04408664 -0.23222913
[3,] -3.40489000 0.04408664
[4,] -1.93511623 -3.40489000
[5,] -1.38108624 -1.93511623
[6,] 0.98456257 -1.38108624
[7,] 1.61082444 0.98456257
[8,] 0.92608642 1.61082444
[9,] -1.09099714 0.92608642
[10,] -1.54703865 -1.09099714
[11,] 0.39539599 -1.54703865
[12,] 6.75672158 0.39539599
[13,] 5.64892999 6.75672158
[14,] 3.86039408 5.64892999
[15,] 8.65868028 3.86039408
[16,] 2.87351328 8.65868028
[17,] 5.17793009 2.87351328
[18,] 4.66343004 5.17793009
[19,] 5.23320381 4.66343004
[20,] 4.49197769 5.23320381
[21,] 2.55962628 4.49197769
[22,] 0.56617415 2.55962628
[23,] -0.41276033 0.56617415
[24,] 3.16916071 -0.41276033
[25,] 0.87511898 3.16916071
[26,] 3.46441095 0.87511898
[27,] -1.53798848 3.46441095
[28,] -0.43160709 -1.53798848
[29,] -0.38671433 -0.43160709
[30,] -2.74930957 -0.38671433
[31,] -3.51923807 -2.74930957
[32,] -5.82915484 -3.51923807
[33,] -7.30656547 -5.82915484
[34,] -6.29695230 -7.30656547
[35,] -7.86901184 -6.29695230
[36,] -5.15962041 -7.86901184
[37,] -6.21395987 -5.15962041
[38,] -3.58115600 -6.21395987
[39,] -7.45379340 -3.58115600
[40,] -4.64053707 -7.45379340
[41,] -4.96281698 -4.64053707
[42,] -5.05365627 -4.96281698
[43,] -5.31519186 -5.05365627
[44,] -6.07243015 -5.31519186
[45,] -3.57046557 -6.07243015
[46,] -4.18373951 -3.57046557
[47,] -7.33746590 -4.18373951
[48,] -2.93343142 -7.33746590
[49,] -0.07785997 -2.93343142
[50,] -3.78773566 -0.07785997
[51,] 3.73799159 -3.78773566
[52,] 4.13374711 3.73799159
[53,] 1.55268746 4.13374711
[54,] 2.15497323 1.55268746
[55,] 1.99040168 2.15497323
[56,] 6.48352088 1.99040168
[57,] 9.40840190 6.48352088
[58,] 11.46155631 9.40840190
[59,] 15.22384208 11.46155631
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.23222913 -1.83283045
2 0.04408664 -0.23222913
3 -3.40489000 0.04408664
4 -1.93511623 -3.40489000
5 -1.38108624 -1.93511623
6 0.98456257 -1.38108624
7 1.61082444 0.98456257
8 0.92608642 1.61082444
9 -1.09099714 0.92608642
10 -1.54703865 -1.09099714
11 0.39539599 -1.54703865
12 6.75672158 0.39539599
13 5.64892999 6.75672158
14 3.86039408 5.64892999
15 8.65868028 3.86039408
16 2.87351328 8.65868028
17 5.17793009 2.87351328
18 4.66343004 5.17793009
19 5.23320381 4.66343004
20 4.49197769 5.23320381
21 2.55962628 4.49197769
22 0.56617415 2.55962628
23 -0.41276033 0.56617415
24 3.16916071 -0.41276033
25 0.87511898 3.16916071
26 3.46441095 0.87511898
27 -1.53798848 3.46441095
28 -0.43160709 -1.53798848
29 -0.38671433 -0.43160709
30 -2.74930957 -0.38671433
31 -3.51923807 -2.74930957
32 -5.82915484 -3.51923807
33 -7.30656547 -5.82915484
34 -6.29695230 -7.30656547
35 -7.86901184 -6.29695230
36 -5.15962041 -7.86901184
37 -6.21395987 -5.15962041
38 -3.58115600 -6.21395987
39 -7.45379340 -3.58115600
40 -4.64053707 -7.45379340
41 -4.96281698 -4.64053707
42 -5.05365627 -4.96281698
43 -5.31519186 -5.05365627
44 -6.07243015 -5.31519186
45 -3.57046557 -6.07243015
46 -4.18373951 -3.57046557
47 -7.33746590 -4.18373951
48 -2.93343142 -7.33746590
49 -0.07785997 -2.93343142
50 -3.78773566 -0.07785997
51 3.73799159 -3.78773566
52 4.13374711 3.73799159
53 1.55268746 4.13374711
54 2.15497323 1.55268746
55 1.99040168 2.15497323
56 6.48352088 1.99040168
57 9.40840190 6.48352088
58 11.46155631 9.40840190
59 15.22384208 11.46155631
> 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/75r741261306627.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/8j13v1261306627.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/94hvf1261306627.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/10ttt11261306627.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/117kde1261306627.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/12zta01261306627.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/1371iz1261306627.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/14r7nm1261306627.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/159n9o1261306627.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/164ean1261306628.tab")
+ }
>
> try(system("convert tmp/1yhyk1261306627.ps tmp/1yhyk1261306627.png",intern=TRUE))
character(0)
> try(system("convert tmp/2rcyv1261306627.ps tmp/2rcyv1261306627.png",intern=TRUE))
character(0)
> try(system("convert tmp/3vgig1261306627.ps tmp/3vgig1261306627.png",intern=TRUE))
character(0)
> try(system("convert tmp/4va8x1261306627.ps tmp/4va8x1261306627.png",intern=TRUE))
character(0)
> try(system("convert tmp/5lms11261306627.ps tmp/5lms11261306627.png",intern=TRUE))
character(0)
> try(system("convert tmp/6pssi1261306627.ps tmp/6pssi1261306627.png",intern=TRUE))
character(0)
> try(system("convert tmp/75r741261306627.ps tmp/75r741261306627.png",intern=TRUE))
character(0)
> try(system("convert tmp/8j13v1261306627.ps tmp/8j13v1261306627.png",intern=TRUE))
character(0)
> try(system("convert tmp/94hvf1261306627.ps tmp/94hvf1261306627.png",intern=TRUE))
character(0)
> try(system("convert tmp/10ttt11261306627.ps tmp/10ttt11261306627.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.414 1.561 3.778