R version 2.8.0 (2008-10-20)
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.
Natural language support but running in an English locale
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(14544.5
+ ,94.6
+ ,-3.0
+ ,14097.8
+ ,15116.3
+ ,95.9
+ ,-3.7
+ ,14776.8
+ ,17413.2
+ ,104.7
+ ,-4.7
+ ,16833.3
+ ,16181.5
+ ,102.8
+ ,-6.4
+ ,15385.5
+ ,15607.4
+ ,98.1
+ ,-7.5
+ ,15172.6
+ ,17160.9
+ ,113.9
+ ,-7.8
+ ,16858.9
+ ,14915.8
+ ,80.9
+ ,-7.7
+ ,14143.5
+ ,13768
+ ,95.7
+ ,-6.6
+ ,14731.8
+ ,17487.5
+ ,113.2
+ ,-4.2
+ ,16471.6
+ ,16198.1
+ ,105.9
+ ,-2.0
+ ,15214
+ ,17535.2
+ ,108.8
+ ,-0.7
+ ,17637.4
+ ,16571.8
+ ,102.3
+ ,0.1
+ ,17972.4
+ ,16198.9
+ ,99
+ ,0.9
+ ,16896.2
+ ,16554.2
+ ,100.7
+ ,2.1
+ ,16698
+ ,19554.2
+ ,115.5
+ ,3.5
+ ,19691.6
+ ,15903.8
+ ,100.7
+ ,4.9
+ ,15930.7
+ ,18003.8
+ ,109.9
+ ,5.7
+ ,17444.6
+ ,18329.6
+ ,114.6
+ ,6.2
+ ,17699.4
+ ,16260.7
+ ,85.4
+ ,6.5
+ ,15189.8
+ ,14851.9
+ ,100.5
+ ,6.5
+ ,15672.7
+ ,18174.1
+ ,114.8
+ ,6.3
+ ,17180.8
+ ,18406.6
+ ,116.5
+ ,6.2
+ ,17664.9
+ ,18466.5
+ ,112.9
+ ,6.4
+ ,17862.9
+ ,16016.5
+ ,102
+ ,6.3
+ ,16162.3
+ ,17428.5
+ ,106
+ ,5.8
+ ,17463.6
+ ,17167.2
+ ,105.3
+ ,5.1
+ ,16772.1
+ ,19630
+ ,118.8
+ ,5.1
+ ,19106.9
+ ,17183.6
+ ,106.1
+ ,5.8
+ ,16721.3
+ ,18344.7
+ ,109.3
+ ,6.7
+ ,18161.3
+ ,19301.4
+ ,117.2
+ ,7.1
+ ,18509.9
+ ,18147.5
+ ,92.5
+ ,6.7
+ ,17802.7
+ ,16192.9
+ ,104.2
+ ,5.5
+ ,16409.9
+ ,18374.4
+ ,112.5
+ ,4.2
+ ,17967.7
+ ,20515.2
+ ,122.4
+ ,3.0
+ ,20286.6
+ ,18957.2
+ ,113.3
+ ,2.2
+ ,19537.3
+ ,16471.5
+ ,100
+ ,2.0
+ ,18021.9
+ ,18746.8
+ ,110.7
+ ,1.8
+ ,20194.3
+ ,19009.5
+ ,112.8
+ ,1.8
+ ,19049.6
+ ,19211.2
+ ,109.8
+ ,1.5
+ ,20244.7
+ ,20547.7
+ ,117.3
+ ,0.4
+ ,21473.3
+ ,19325.8
+ ,109.1
+ ,-0.9
+ ,19673.6
+ ,20605.5
+ ,115.9
+ ,-1.7
+ ,21053.2
+ ,20056.9
+ ,96
+ ,-2.6
+ ,20159.5
+ ,16141.4
+ ,99.8
+ ,-4.4
+ ,18203.6
+ ,20359.8
+ ,116.8
+ ,-8.3
+ ,21289.5
+ ,19711.6
+ ,115.7
+ ,-14.4
+ ,20432.3
+ ,15638.6
+ ,99.4
+ ,-21.3
+ ,17180.4
+ ,14384.5
+ ,94.3
+ ,-26.5
+ ,15816.8
+ ,13855.6
+ ,91
+ ,-29.2
+ ,15071.8
+ ,14308.3
+ ,93.2
+ ,-30.8
+ ,14521.1
+ ,15290.6
+ ,103.1
+ ,-30.9
+ ,15668.8
+ ,14423.8
+ ,94.1
+ ,-29.5
+ ,14346.9
+ ,13779.7
+ ,91.8
+ ,-27.1
+ ,13881
+ ,15686.3
+ ,102.7
+ ,-24.4
+ ,15465.9
+ ,14733.8
+ ,82.6
+ ,-21.9
+ ,14238.2
+ ,12522.5
+ ,89.1
+ ,-19.3
+ ,13557.7
+ ,16189.4
+ ,104.5
+ ,-17.0
+ ,16127.6
+ ,16059.1
+ ,105.1
+ ,-13.8
+ ,16793.9
+ ,16007.1
+ ,95.1
+ ,-9.9
+ ,16014
+ ,15806.8
+ ,88.7
+ ,-7.9
+ ,16867.9
+ ,15160
+ ,86.3
+ ,-7.2
+ ,16014.6
+ ,15692.1
+ ,91.8
+ ,-6.2
+ ,15878.6
+ ,18908.9
+ ,111.5
+ ,-4.5
+ ,18664.9
+ ,16969.9
+ ,99.7
+ ,-3.9
+ ,17962.5
+ ,16997.5
+ ,97.5
+ ,-5.0
+ ,17332.7
+ ,19858.9
+ ,111.7
+ ,-6.2
+ ,19542.1
+ ,17681.2
+ ,86.2
+ ,-6.1
+ ,17203.6
+ ,16006.9
+ ,95.4
+ ,-5.0
+ ,16579)
+ ,dim=c(4
+ ,68)
+ ,dimnames=list(c('uitvoer'
+ ,'productie'
+ ,'ondernemersvertrouwen'
+ ,'invoer')
+ ,1:68))
> y <- array(NA,dim=c(4,68),dimnames=list(c('uitvoer','productie','ondernemersvertrouwen','invoer'),1:68))
> 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 = 'Do not include Seasonal Dummies'
> par1 = '2'
> #'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
productie uitvoer ondernemersvertrouwen invoer
1 94.6 14544.5 -3.0 14097.8
2 95.9 15116.3 -3.7 14776.8
3 104.7 17413.2 -4.7 16833.3
4 102.8 16181.5 -6.4 15385.5
5 98.1 15607.4 -7.5 15172.6
6 113.9 17160.9 -7.8 16858.9
7 80.9 14915.8 -7.7 14143.5
8 95.7 13768.0 -6.6 14731.8
9 113.2 17487.5 -4.2 16471.6
10 105.9 16198.1 -2.0 15214.0
11 108.8 17535.2 -0.7 17637.4
12 102.3 16571.8 0.1 17972.4
13 99.0 16198.9 0.9 16896.2
14 100.7 16554.2 2.1 16698.0
15 115.5 19554.2 3.5 19691.6
16 100.7 15903.8 4.9 15930.7
17 109.9 18003.8 5.7 17444.6
18 114.6 18329.6 6.2 17699.4
19 85.4 16260.7 6.5 15189.8
20 100.5 14851.9 6.5 15672.7
21 114.8 18174.1 6.3 17180.8
22 116.5 18406.6 6.2 17664.9
23 112.9 18466.5 6.4 17862.9
24 102.0 16016.5 6.3 16162.3
25 106.0 17428.5 5.8 17463.6
26 105.3 17167.2 5.1 16772.1
27 118.8 19630.0 5.1 19106.9
28 106.1 17183.6 5.8 16721.3
29 109.3 18344.7 6.7 18161.3
30 117.2 19301.4 7.1 18509.9
31 92.5 18147.5 6.7 17802.7
32 104.2 16192.9 5.5 16409.9
33 112.5 18374.4 4.2 17967.7
34 122.4 20515.2 3.0 20286.6
35 113.3 18957.2 2.2 19537.3
36 100.0 16471.5 2.0 18021.9
37 110.7 18746.8 1.8 20194.3
38 112.8 19009.5 1.8 19049.6
39 109.8 19211.2 1.5 20244.7
40 117.3 20547.7 0.4 21473.3
41 109.1 19325.8 -0.9 19673.6
42 115.9 20605.5 -1.7 21053.2
43 96.0 20056.9 -2.6 20159.5
44 99.8 16141.4 -4.4 18203.6
45 116.8 20359.8 -8.3 21289.5
46 115.7 19711.6 -14.4 20432.3
47 99.4 15638.6 -21.3 17180.4
48 94.3 14384.5 -26.5 15816.8
49 91.0 13855.6 -29.2 15071.8
50 93.2 14308.3 -30.8 14521.1
51 103.1 15290.6 -30.9 15668.8
52 94.1 14423.8 -29.5 14346.9
53 91.8 13779.7 -27.1 13881.0
54 102.7 15686.3 -24.4 15465.9
55 82.6 14733.8 -21.9 14238.2
56 89.1 12522.5 -19.3 13557.7
57 104.5 16189.4 -17.0 16127.6
58 105.1 16059.1 -13.8 16793.9
59 95.1 16007.1 -9.9 16014.0
60 88.7 15806.8 -7.9 16867.9
61 86.3 15160.0 -7.2 16014.6
62 91.8 15692.1 -6.2 15878.6
63 111.5 18908.9 -4.5 18664.9
64 99.7 16969.9 -3.9 17962.5
65 97.5 16997.5 -5.0 17332.7
66 111.7 19858.9 -6.2 19542.1
67 86.2 17681.2 -6.1 17203.6
68 95.4 16006.9 -5.0 16579.0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) uitvoer ondernemersvertrouwen
36.1042160 0.0041263 0.0086964
invoer
-0.0001794
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-19.723 -1.051 1.186 3.804 10.077
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 36.1042160 8.5147392 4.240 7.33e-05 ***
uitvoer 0.0041263 0.0011907 3.465 0.00095 ***
ondernemersvertrouwen 0.0086964 0.0898266 0.097 0.92318
invoer -0.0001794 0.0010976 -0.163 0.87071
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 6.394 on 64 degrees of freedom
Multiple R-squared: 0.6055, Adjusted R-squared: 0.587
F-statistic: 32.74 on 3 and 64 DF, p-value: 6.009e-13
> 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.5946888 0.8106223 0.4053112
[2,] 0.5051014 0.9897972 0.4948986
[3,] 0.4331775 0.8663549 0.5668225
[4,] 0.3478845 0.6957690 0.6521155
[5,] 0.5475844 0.9048312 0.4524156
[6,] 0.5586006 0.8827988 0.4413994
[7,] 0.4797917 0.9595834 0.5202083
[8,] 0.3866736 0.7733471 0.6133264
[9,] 0.3181534 0.6363069 0.6818466
[10,] 0.2528172 0.5056345 0.7471828
[11,] 0.1863413 0.3726827 0.8136587
[12,] 0.1534984 0.3069968 0.8465016
[13,] 0.3749476 0.7498951 0.6250524
[14,] 0.4177064 0.8354128 0.5822936
[15,] 0.4271618 0.8543235 0.5728382
[16,] 0.4279074 0.8558148 0.5720926
[17,] 0.3683466 0.7366931 0.6316534
[18,] 0.3141047 0.6282094 0.6858953
[19,] 0.2578823 0.5157646 0.7421177
[20,] 0.2070650 0.4141301 0.7929350
[21,] 0.1826760 0.3653521 0.8173240
[22,] 0.1525694 0.3051389 0.8474306
[23,] 0.1280618 0.2561237 0.8719382
[24,] 0.1342814 0.2685627 0.8657186
[25,] 0.4597738 0.9195476 0.5402262
[26,] 0.4851177 0.9702354 0.5148823
[27,] 0.5260543 0.9478913 0.4739457
[28,] 0.5844721 0.8310558 0.4155279
[29,] 0.5846861 0.8306278 0.4153139
[30,] 0.5404308 0.9191384 0.4595692
[31,] 0.4975046 0.9950092 0.5024954
[32,] 0.5436825 0.9126350 0.4563175
[33,] 0.5118391 0.9763219 0.4881609
[34,] 0.4700294 0.9400587 0.5299706
[35,] 0.4424127 0.8848254 0.5575873
[36,] 0.4023451 0.8046903 0.5976549
[37,] 0.8617226 0.2765548 0.1382774
[38,] 0.8173408 0.3653183 0.1826592
[39,] 0.7620162 0.4759675 0.2379838
[40,] 0.7043241 0.5913518 0.2956759
[41,] 0.6480634 0.7038731 0.3519366
[42,] 0.6094742 0.7810515 0.3905258
[43,] 0.6451547 0.7096907 0.3548453
[44,] 0.6058426 0.7883149 0.3941574
[45,] 0.5782284 0.8435432 0.4217716
[46,] 0.5201104 0.9597792 0.4798896
[47,] 0.4325328 0.8650656 0.5674672
[48,] 0.3444145 0.6888289 0.6555855
[49,] 0.5566064 0.8867872 0.4433936
[50,] 0.4534970 0.9069939 0.5465030
[51,] 0.3601309 0.7202618 0.6398691
[52,] 0.3545276 0.7090552 0.6454724
[53,] 0.4911797 0.9823594 0.5088203
[54,] 0.3862563 0.7725126 0.6137437
[55,] 0.2641644 0.5283288 0.7358356
> postscript(file="/var/www/html/freestat/rcomp/tmp/1f3jc1292590989.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/2f3jc1292590989.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/3pcix1292590989.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/4pcix1292590989.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/5pcix1292590989.ps",horizontal=F,onefile=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 = 68
Frequency = 1
1 2 3 4 5 6
1.0359512 0.1044242 -0.1956504 2.7417801 0.3820511 10.0769577
7 8 9 10 11 12
-14.1470624 5.4850207 7.9285448 5.7042594 3.5103832 1.0387592
13 14 15 16 17 18
-0.9225405 -0.7345888 2.2113647 1.7871629 2.5865758 5.9835904
19 20 21 22 23 24
-15.1323051 5.8673955 6.7313390 7.5596798 3.7462904 2.6514974
25 26 27 28 29 30
1.0629564 1.3232099 5.0798070 2.0403401 0.6997823 4.7112276
31 32 33 34 35 36
-15.3508363 4.1749904 3.7642489 5.2570884 2.4583771 -0.8550209
37 38 39 40 41 42
0.8478627 1.6585775 -1.9567278 0.2584428 -3.2111598 -1.4371425
43 44 45 46 47 48
-19.2259395 0.3953073 0.5764611 2.0504085 2.0334428 1.9088413
49 50 51 52 53 54
0.6810813 0.9282598 6.9817481 1.3091257 1.5624198 4.8560645
55 56 57 58 59 60
-11.5556069 3.9241454 4.6344683 5.8638007 -4.0954329 -9.5331779
61 62 63 64 65 66
-9.4234434 -6.1521205 0.7594675 -3.1708984 -5.5881788 -2.7883685
67 68
-19.7228981 -3.7358813
> postscript(file="/var/www/html/freestat/rcomp/tmp/603h01292590989.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 68
Frequency = 1
lag(myerror, k = 1) myerror
0 1.0359512 NA
1 0.1044242 1.0359512
2 -0.1956504 0.1044242
3 2.7417801 -0.1956504
4 0.3820511 2.7417801
5 10.0769577 0.3820511
6 -14.1470624 10.0769577
7 5.4850207 -14.1470624
8 7.9285448 5.4850207
9 5.7042594 7.9285448
10 3.5103832 5.7042594
11 1.0387592 3.5103832
12 -0.9225405 1.0387592
13 -0.7345888 -0.9225405
14 2.2113647 -0.7345888
15 1.7871629 2.2113647
16 2.5865758 1.7871629
17 5.9835904 2.5865758
18 -15.1323051 5.9835904
19 5.8673955 -15.1323051
20 6.7313390 5.8673955
21 7.5596798 6.7313390
22 3.7462904 7.5596798
23 2.6514974 3.7462904
24 1.0629564 2.6514974
25 1.3232099 1.0629564
26 5.0798070 1.3232099
27 2.0403401 5.0798070
28 0.6997823 2.0403401
29 4.7112276 0.6997823
30 -15.3508363 4.7112276
31 4.1749904 -15.3508363
32 3.7642489 4.1749904
33 5.2570884 3.7642489
34 2.4583771 5.2570884
35 -0.8550209 2.4583771
36 0.8478627 -0.8550209
37 1.6585775 0.8478627
38 -1.9567278 1.6585775
39 0.2584428 -1.9567278
40 -3.2111598 0.2584428
41 -1.4371425 -3.2111598
42 -19.2259395 -1.4371425
43 0.3953073 -19.2259395
44 0.5764611 0.3953073
45 2.0504085 0.5764611
46 2.0334428 2.0504085
47 1.9088413 2.0334428
48 0.6810813 1.9088413
49 0.9282598 0.6810813
50 6.9817481 0.9282598
51 1.3091257 6.9817481
52 1.5624198 1.3091257
53 4.8560645 1.5624198
54 -11.5556069 4.8560645
55 3.9241454 -11.5556069
56 4.6344683 3.9241454
57 5.8638007 4.6344683
58 -4.0954329 5.8638007
59 -9.5331779 -4.0954329
60 -9.4234434 -9.5331779
61 -6.1521205 -9.4234434
62 0.7594675 -6.1521205
63 -3.1708984 0.7594675
64 -5.5881788 -3.1708984
65 -2.7883685 -5.5881788
66 -19.7228981 -2.7883685
67 -3.7358813 -19.7228981
68 NA -3.7358813
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.1044242 1.0359512
[2,] -0.1956504 0.1044242
[3,] 2.7417801 -0.1956504
[4,] 0.3820511 2.7417801
[5,] 10.0769577 0.3820511
[6,] -14.1470624 10.0769577
[7,] 5.4850207 -14.1470624
[8,] 7.9285448 5.4850207
[9,] 5.7042594 7.9285448
[10,] 3.5103832 5.7042594
[11,] 1.0387592 3.5103832
[12,] -0.9225405 1.0387592
[13,] -0.7345888 -0.9225405
[14,] 2.2113647 -0.7345888
[15,] 1.7871629 2.2113647
[16,] 2.5865758 1.7871629
[17,] 5.9835904 2.5865758
[18,] -15.1323051 5.9835904
[19,] 5.8673955 -15.1323051
[20,] 6.7313390 5.8673955
[21,] 7.5596798 6.7313390
[22,] 3.7462904 7.5596798
[23,] 2.6514974 3.7462904
[24,] 1.0629564 2.6514974
[25,] 1.3232099 1.0629564
[26,] 5.0798070 1.3232099
[27,] 2.0403401 5.0798070
[28,] 0.6997823 2.0403401
[29,] 4.7112276 0.6997823
[30,] -15.3508363 4.7112276
[31,] 4.1749904 -15.3508363
[32,] 3.7642489 4.1749904
[33,] 5.2570884 3.7642489
[34,] 2.4583771 5.2570884
[35,] -0.8550209 2.4583771
[36,] 0.8478627 -0.8550209
[37,] 1.6585775 0.8478627
[38,] -1.9567278 1.6585775
[39,] 0.2584428 -1.9567278
[40,] -3.2111598 0.2584428
[41,] -1.4371425 -3.2111598
[42,] -19.2259395 -1.4371425
[43,] 0.3953073 -19.2259395
[44,] 0.5764611 0.3953073
[45,] 2.0504085 0.5764611
[46,] 2.0334428 2.0504085
[47,] 1.9088413 2.0334428
[48,] 0.6810813 1.9088413
[49,] 0.9282598 0.6810813
[50,] 6.9817481 0.9282598
[51,] 1.3091257 6.9817481
[52,] 1.5624198 1.3091257
[53,] 4.8560645 1.5624198
[54,] -11.5556069 4.8560645
[55,] 3.9241454 -11.5556069
[56,] 4.6344683 3.9241454
[57,] 5.8638007 4.6344683
[58,] -4.0954329 5.8638007
[59,] -9.5331779 -4.0954329
[60,] -9.4234434 -9.5331779
[61,] -6.1521205 -9.4234434
[62,] 0.7594675 -6.1521205
[63,] -3.1708984 0.7594675
[64,] -5.5881788 -3.1708984
[65,] -2.7883685 -5.5881788
[66,] -19.7228981 -2.7883685
[67,] -3.7358813 -19.7228981
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.1044242 1.0359512
2 -0.1956504 0.1044242
3 2.7417801 -0.1956504
4 0.3820511 2.7417801
5 10.0769577 0.3820511
6 -14.1470624 10.0769577
7 5.4850207 -14.1470624
8 7.9285448 5.4850207
9 5.7042594 7.9285448
10 3.5103832 5.7042594
11 1.0387592 3.5103832
12 -0.9225405 1.0387592
13 -0.7345888 -0.9225405
14 2.2113647 -0.7345888
15 1.7871629 2.2113647
16 2.5865758 1.7871629
17 5.9835904 2.5865758
18 -15.1323051 5.9835904
19 5.8673955 -15.1323051
20 6.7313390 5.8673955
21 7.5596798 6.7313390
22 3.7462904 7.5596798
23 2.6514974 3.7462904
24 1.0629564 2.6514974
25 1.3232099 1.0629564
26 5.0798070 1.3232099
27 2.0403401 5.0798070
28 0.6997823 2.0403401
29 4.7112276 0.6997823
30 -15.3508363 4.7112276
31 4.1749904 -15.3508363
32 3.7642489 4.1749904
33 5.2570884 3.7642489
34 2.4583771 5.2570884
35 -0.8550209 2.4583771
36 0.8478627 -0.8550209
37 1.6585775 0.8478627
38 -1.9567278 1.6585775
39 0.2584428 -1.9567278
40 -3.2111598 0.2584428
41 -1.4371425 -3.2111598
42 -19.2259395 -1.4371425
43 0.3953073 -19.2259395
44 0.5764611 0.3953073
45 2.0504085 0.5764611
46 2.0334428 2.0504085
47 1.9088413 2.0334428
48 0.6810813 1.9088413
49 0.9282598 0.6810813
50 6.9817481 0.9282598
51 1.3091257 6.9817481
52 1.5624198 1.3091257
53 4.8560645 1.5624198
54 -11.5556069 4.8560645
55 3.9241454 -11.5556069
56 4.6344683 3.9241454
57 5.8638007 4.6344683
58 -4.0954329 5.8638007
59 -9.5331779 -4.0954329
60 -9.4234434 -9.5331779
61 -6.1521205 -9.4234434
62 0.7594675 -6.1521205
63 -3.1708984 0.7594675
64 -5.5881788 -3.1708984
65 -2.7883685 -5.5881788
66 -19.7228981 -2.7883685
67 -3.7358813 -19.7228981
> 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/freestat/rcomp/tmp/7bug31292590989.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/8bug31292590989.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/9bug31292590989.ps",horizontal=F,onefile=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/freestat/rcomp/tmp/103mg61292590989.ps",horizontal=F,onefile=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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/11p4et1292590989.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/freestat/rcomp/tmp/12snd01292590989.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/freestat/rcomp/tmp/13h6sb1292590989.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/freestat/rcomp/tmp/14sx9w1292590989.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/freestat/rcomp/tmp/15vy721292590989.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/freestat/rcomp/tmp/16rpnt1292590989.tab")
+ }
>
> try(system("convert tmp/1f3jc1292590989.ps tmp/1f3jc1292590989.png",intern=TRUE))
character(0)
> try(system("convert tmp/2f3jc1292590989.ps tmp/2f3jc1292590989.png",intern=TRUE))
character(0)
> try(system("convert tmp/3pcix1292590989.ps tmp/3pcix1292590989.png",intern=TRUE))
character(0)
> try(system("convert tmp/4pcix1292590989.ps tmp/4pcix1292590989.png",intern=TRUE))
character(0)
> try(system("convert tmp/5pcix1292590989.ps tmp/5pcix1292590989.png",intern=TRUE))
character(0)
> try(system("convert tmp/603h01292590989.ps tmp/603h01292590989.png",intern=TRUE))
character(0)
> try(system("convert tmp/7bug31292590989.ps tmp/7bug31292590989.png",intern=TRUE))
character(0)
> try(system("convert tmp/8bug31292590989.ps tmp/8bug31292590989.png",intern=TRUE))
character(0)
> try(system("convert tmp/9bug31292590989.ps tmp/9bug31292590989.png",intern=TRUE))
character(0)
> try(system("convert tmp/103mg61292590989.ps tmp/103mg61292590989.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.995 2.515 4.327