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(95.3
+ ,100.0
+ ,100.6
+ ,90.7
+ ,95.3
+ ,114.2
+ ,88.4
+ ,90.7
+ ,91.5
+ ,86.0
+ ,88.4
+ ,94.7
+ ,86.0
+ ,86.0
+ ,110.6
+ ,95.3
+ ,86.0
+ ,71.3
+ ,95.3
+ ,95.3
+ ,104.1
+ ,88.4
+ ,95.3
+ ,112.3
+ ,86.0
+ ,88.4
+ ,110.2
+ ,81.4
+ ,86.0
+ ,112.9
+ ,83.7
+ ,81.4
+ ,95.1
+ ,95.3
+ ,83.7
+ ,103.1
+ ,88.4
+ ,95.3
+ ,101.9
+ ,86.0
+ ,88.4
+ ,100.4
+ ,83.7
+ ,86.0
+ ,106.9
+ ,76.7
+ ,83.7
+ ,100.7
+ ,79.1
+ ,76.7
+ ,114.3
+ ,86.0
+ ,79.1
+ ,73.3
+ ,86.0
+ ,86.0
+ ,105.9
+ ,79.1
+ ,86.0
+ ,113.9
+ ,76.7
+ ,79.1
+ ,112.1
+ ,69.8
+ ,76.7
+ ,117.5
+ ,69.8
+ ,69.8
+ ,97.5
+ ,76.7
+ ,69.8
+ ,112.3
+ ,69.8
+ ,76.7
+ ,106.9
+ ,67.4
+ ,69.8
+ ,120.9
+ ,65.1
+ ,67.4
+ ,92.7
+ ,58.1
+ ,65.1
+ ,110.9
+ ,60.5
+ ,58.1
+ ,116.5
+ ,65.1
+ ,60.5
+ ,77.1
+ ,62.8
+ ,65.1
+ ,113.1
+ ,55.8
+ ,62.8
+ ,115.9
+ ,51.2
+ ,55.8
+ ,123.5
+ ,48.8
+ ,51.2
+ ,123.6
+ ,48.8
+ ,48.8
+ ,101.5
+ ,53.5
+ ,48.8
+ ,121.0
+ ,48.8
+ ,53.5
+ ,112.2
+ ,46.5
+ ,48.8
+ ,126.0
+ ,44.2
+ ,46.5
+ ,101.8
+ ,39.5
+ ,44.2
+ ,117.9
+ ,41.9
+ ,39.5
+ ,122.2
+ ,48.8
+ ,41.9
+ ,82.7
+ ,46.5
+ ,48.8
+ ,120.5
+ ,41.9
+ ,46.5
+ ,120.3
+ ,39.5
+ ,41.9
+ ,134.2
+ ,37.2
+ ,39.5
+ ,128.2
+ ,37.2
+ ,37.2
+ ,100.5
+ ,41.9
+ ,37.2
+ ,126.0
+ ,39.5
+ ,41.9
+ ,122.9
+ ,39.5
+ ,39.5
+ ,106.1
+ ,34.9
+ ,39.5
+ ,130.4
+ ,34.9
+ ,34.9
+ ,121.3
+ ,34.9
+ ,34.9
+ ,126.1
+ ,41.9
+ ,34.9
+ ,88.7
+ ,41.9
+ ,41.9
+ ,118.7
+ ,39.5
+ ,41.9
+ ,129.3
+ ,39.5
+ ,39.5
+ ,136.2
+ ,41.9
+ ,39.5
+ ,123.0
+ ,46.5
+ ,41.9
+ ,103.5)
+ ,dim=c(3
+ ,59)
+ ,dimnames=list(c('Werkloosheid(Y(t))'
+ ,'Y(t-1)'
+ ,'Productie')
+ ,1:59))
> y <- array(NA,dim=c(3,59),dimnames=list(c('Werkloosheid(Y(t))','Y(t-1)','Productie'),1:59))
> 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(Y(t)) Y(t-1) Productie M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 95.3 100.0 100.6 1 0 0 0 0 0 0 0 0 0 0 1
2 90.7 95.3 114.2 0 1 0 0 0 0 0 0 0 0 0 2
3 88.4 90.7 91.5 0 0 1 0 0 0 0 0 0 0 0 3
4 86.0 88.4 94.7 0 0 0 1 0 0 0 0 0 0 0 4
5 86.0 86.0 110.6 0 0 0 0 1 0 0 0 0 0 0 5
6 95.3 86.0 71.3 0 0 0 0 0 1 0 0 0 0 0 6
7 95.3 95.3 104.1 0 0 0 0 0 0 1 0 0 0 0 7
8 88.4 95.3 112.3 0 0 0 0 0 0 0 1 0 0 0 8
9 86.0 88.4 110.2 0 0 0 0 0 0 0 0 1 0 0 9
10 81.4 86.0 112.9 0 0 0 0 0 0 0 0 0 1 0 10
11 83.7 81.4 95.1 0 0 0 0 0 0 0 0 0 0 1 11
12 95.3 83.7 103.1 0 0 0 0 0 0 0 0 0 0 0 12
13 88.4 95.3 101.9 1 0 0 0 0 0 0 0 0 0 0 13
14 86.0 88.4 100.4 0 1 0 0 0 0 0 0 0 0 0 14
15 83.7 86.0 106.9 0 0 1 0 0 0 0 0 0 0 0 15
16 76.7 83.7 100.7 0 0 0 1 0 0 0 0 0 0 0 16
17 79.1 76.7 114.3 0 0 0 0 1 0 0 0 0 0 0 17
18 86.0 79.1 73.3 0 0 0 0 0 1 0 0 0 0 0 18
19 86.0 86.0 105.9 0 0 0 0 0 0 1 0 0 0 0 19
20 79.1 86.0 113.9 0 0 0 0 0 0 0 1 0 0 0 20
21 76.7 79.1 112.1 0 0 0 0 0 0 0 0 1 0 0 21
22 69.8 76.7 117.5 0 0 0 0 0 0 0 0 0 1 0 22
23 69.8 69.8 97.5 0 0 0 0 0 0 0 0 0 0 1 23
24 76.7 69.8 112.3 0 0 0 0 0 0 0 0 0 0 0 24
25 69.8 76.7 106.9 1 0 0 0 0 0 0 0 0 0 0 25
26 67.4 69.8 120.9 0 1 0 0 0 0 0 0 0 0 0 26
27 65.1 67.4 92.7 0 0 1 0 0 0 0 0 0 0 0 27
28 58.1 65.1 110.9 0 0 0 1 0 0 0 0 0 0 0 28
29 60.5 58.1 116.5 0 0 0 0 1 0 0 0 0 0 0 29
30 65.1 60.5 77.1 0 0 0 0 0 1 0 0 0 0 0 30
31 62.8 65.1 113.1 0 0 0 0 0 0 1 0 0 0 0 31
32 55.8 62.8 115.9 0 0 0 0 0 0 0 1 0 0 0 32
33 51.2 55.8 123.5 0 0 0 0 0 0 0 0 1 0 0 33
34 48.8 51.2 123.6 0 0 0 0 0 0 0 0 0 1 0 34
35 48.8 48.8 101.5 0 0 0 0 0 0 0 0 0 0 1 35
36 53.5 48.8 121.0 0 0 0 0 0 0 0 0 0 0 0 36
37 48.8 53.5 112.2 1 0 0 0 0 0 0 0 0 0 0 37
38 46.5 48.8 126.0 0 1 0 0 0 0 0 0 0 0 0 38
39 44.2 46.5 101.8 0 0 1 0 0 0 0 0 0 0 0 39
40 39.5 44.2 117.9 0 0 0 1 0 0 0 0 0 0 0 40
41 41.9 39.5 122.2 0 0 0 0 1 0 0 0 0 0 0 41
42 48.8 41.9 82.7 0 0 0 0 0 1 0 0 0 0 0 42
43 46.5 48.8 120.5 0 0 0 0 0 0 1 0 0 0 0 43
44 41.9 46.5 120.3 0 0 0 0 0 0 0 1 0 0 0 44
45 39.5 41.9 134.2 0 0 0 0 0 0 0 0 1 0 0 45
46 37.2 39.5 128.2 0 0 0 0 0 0 0 0 0 1 0 46
47 37.2 37.2 100.5 0 0 0 0 0 0 0 0 0 0 1 47
48 41.9 37.2 126.0 0 0 0 0 0 0 0 0 0 0 0 48
49 39.5 41.9 122.9 1 0 0 0 0 0 0 0 0 0 0 49
50 39.5 39.5 106.1 0 1 0 0 0 0 0 0 0 0 0 50
51 34.9 39.5 130.4 0 0 1 0 0 0 0 0 0 0 0 51
52 34.9 34.9 121.3 0 0 0 1 0 0 0 0 0 0 0 52
53 34.9 34.9 126.1 0 0 0 0 1 0 0 0 0 0 0 53
54 41.9 34.9 88.7 0 0 0 0 0 1 0 0 0 0 0 54
55 41.9 41.9 118.7 0 0 0 0 0 0 1 0 0 0 0 55
56 39.5 41.9 129.3 0 0 0 0 0 0 0 1 0 0 0 56
57 39.5 39.5 136.2 0 0 0 0 0 0 0 0 1 0 0 57
58 41.9 39.5 123.0 0 0 0 0 0 0 0 0 0 1 0 58
59 46.5 41.9 103.5 0 0 0 0 0 0 0 0 0 0 1 59
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) `Y(t-1)` Productie M1 M2 M3
11.58416 1.04632 -0.09507 -12.76095 -9.42482 -10.69896
M4 M5 M6 M7 M8 M9
-11.72925 -5.15363 -3.57859 -8.66323 -12.82186 -9.01873
M10 M11 t
-9.63880 -7.52753 0.12024
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-3.8730 -1.1231 -0.1904 0.9483 4.4974
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 11.58416 8.68142 1.334 0.188950
`Y(t-1)` 1.04632 0.05943 17.607 < 2e-16 ***
Productie -0.09507 0.05211 -1.824 0.074920 .
M1 -12.76095 1.44048 -8.859 2.44e-11 ***
M2 -9.42482 1.37732 -6.843 1.94e-08 ***
M3 -10.69896 1.44809 -7.388 3.10e-09 ***
M4 -11.72925 1.38939 -8.442 9.44e-11 ***
M5 -5.15363 1.36825 -3.767 0.000488 ***
M6 -3.57859 2.35178 -1.522 0.135250
M7 -8.66323 1.45165 -5.968 3.76e-07 ***
M8 -12.82186 1.47083 -8.717 3.86e-11 ***
M9 -9.01873 1.43994 -6.263 1.38e-07 ***
M10 -9.63880 1.39554 -6.907 1.57e-08 ***
M11 -7.52753 1.64107 -4.587 3.72e-05 ***
t 0.12024 0.07040 1.708 0.094680 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.025 on 44 degrees of freedom
Multiple R-squared: 0.9926, Adjusted R-squared: 0.9903
F-statistic: 422.9 on 14 and 44 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.6613458 0.6773084 0.3386542
[2,] 0.6075226 0.7849547 0.3924774
[3,] 0.4772726 0.9545453 0.5227274
[4,] 0.3576841 0.7153682 0.6423159
[5,] 0.4615846 0.9231692 0.5384154
[6,] 0.4773836 0.9547672 0.5226164
[7,] 0.6008000 0.7984001 0.3992000
[8,] 0.5607637 0.8784727 0.4392363
[9,] 0.6224261 0.7551477 0.3775739
[10,] 0.5452775 0.9094451 0.4547225
[11,] 0.5969321 0.8061357 0.4030679
[12,] 0.6463579 0.7072842 0.3536421
[13,] 0.6687823 0.6624354 0.3312177
[14,] 0.6004810 0.7990380 0.3995190
[15,] 0.5488247 0.9023506 0.4511753
[16,] 0.5398886 0.9202228 0.4601114
[17,] 0.5858722 0.8282556 0.4141278
[18,] 0.4879834 0.9759667 0.5120166
[19,] 0.4686326 0.9372652 0.5313674
[20,] 0.4747296 0.9494592 0.5252704
[21,] 0.4285968 0.8571935 0.5714032
[22,] 0.2998147 0.5996294 0.7001853
[23,] 0.5243082 0.9513837 0.4756918
[24,] 0.9438537 0.1122926 0.0561463
> postscript(file="/var/www/html/rcomp/tmp/1syxj1261309035.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/2uva21261309035.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/3s9yv1261309035.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/42w3b1261309035.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/5eeb61261309035.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 = 59
Frequency = 1
1 2 3 4 5 6
1.28822776 -0.55752677 0.95143257 2.17224232 -0.50088908 3.36771366
7 8 9 10 11 12
1.71952798 -0.36253178 0.33406983 -0.99824993 2.19112153 4.49735568
13 14 15 16 17 18
-2.01332933 -0.79268793 1.19031766 -3.08250070 1.23878812 0.03460826
19 20 21 22 23 24
0.87857822 -1.22249490 -0.49737324 -3.87301259 -0.78625118 -0.12702569
25 26 27 28 29 30
-2.11928538 0.57489174 -0.74092135 -2.69410929 0.86664497 -2.48542798
31 32 33 34 35 36
-1.21169387 -1.50057750 -1.97719568 0.94521574 -0.87610505 -1.97006551
37 38 39 40 41 42
0.21635253 0.68961137 -0.35056648 -0.20339474 0.82723569 -0.23434394
43 44 45 46 47 48
-1.19602651 0.62988939 0.44102318 0.58162208 -1.87670495 -2.40026448
49 50 51 52 53 54
2.62803443 0.08571160 -1.05026240 3.80776241 -2.43177970 -0.68255001
55 56 57 58 59
-0.19038582 2.45571479 1.69947591 3.34442470 1.34793964
> postscript(file="/var/www/html/rcomp/tmp/6lcb21261309035.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 = 59
Frequency = 1
lag(myerror, k = 1) myerror
0 1.28822776 NA
1 -0.55752677 1.28822776
2 0.95143257 -0.55752677
3 2.17224232 0.95143257
4 -0.50088908 2.17224232
5 3.36771366 -0.50088908
6 1.71952798 3.36771366
7 -0.36253178 1.71952798
8 0.33406983 -0.36253178
9 -0.99824993 0.33406983
10 2.19112153 -0.99824993
11 4.49735568 2.19112153
12 -2.01332933 4.49735568
13 -0.79268793 -2.01332933
14 1.19031766 -0.79268793
15 -3.08250070 1.19031766
16 1.23878812 -3.08250070
17 0.03460826 1.23878812
18 0.87857822 0.03460826
19 -1.22249490 0.87857822
20 -0.49737324 -1.22249490
21 -3.87301259 -0.49737324
22 -0.78625118 -3.87301259
23 -0.12702569 -0.78625118
24 -2.11928538 -0.12702569
25 0.57489174 -2.11928538
26 -0.74092135 0.57489174
27 -2.69410929 -0.74092135
28 0.86664497 -2.69410929
29 -2.48542798 0.86664497
30 -1.21169387 -2.48542798
31 -1.50057750 -1.21169387
32 -1.97719568 -1.50057750
33 0.94521574 -1.97719568
34 -0.87610505 0.94521574
35 -1.97006551 -0.87610505
36 0.21635253 -1.97006551
37 0.68961137 0.21635253
38 -0.35056648 0.68961137
39 -0.20339474 -0.35056648
40 0.82723569 -0.20339474
41 -0.23434394 0.82723569
42 -1.19602651 -0.23434394
43 0.62988939 -1.19602651
44 0.44102318 0.62988939
45 0.58162208 0.44102318
46 -1.87670495 0.58162208
47 -2.40026448 -1.87670495
48 2.62803443 -2.40026448
49 0.08571160 2.62803443
50 -1.05026240 0.08571160
51 3.80776241 -1.05026240
52 -2.43177970 3.80776241
53 -0.68255001 -2.43177970
54 -0.19038582 -0.68255001
55 2.45571479 -0.19038582
56 1.69947591 2.45571479
57 3.34442470 1.69947591
58 1.34793964 3.34442470
59 NA 1.34793964
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.55752677 1.28822776
[2,] 0.95143257 -0.55752677
[3,] 2.17224232 0.95143257
[4,] -0.50088908 2.17224232
[5,] 3.36771366 -0.50088908
[6,] 1.71952798 3.36771366
[7,] -0.36253178 1.71952798
[8,] 0.33406983 -0.36253178
[9,] -0.99824993 0.33406983
[10,] 2.19112153 -0.99824993
[11,] 4.49735568 2.19112153
[12,] -2.01332933 4.49735568
[13,] -0.79268793 -2.01332933
[14,] 1.19031766 -0.79268793
[15,] -3.08250070 1.19031766
[16,] 1.23878812 -3.08250070
[17,] 0.03460826 1.23878812
[18,] 0.87857822 0.03460826
[19,] -1.22249490 0.87857822
[20,] -0.49737324 -1.22249490
[21,] -3.87301259 -0.49737324
[22,] -0.78625118 -3.87301259
[23,] -0.12702569 -0.78625118
[24,] -2.11928538 -0.12702569
[25,] 0.57489174 -2.11928538
[26,] -0.74092135 0.57489174
[27,] -2.69410929 -0.74092135
[28,] 0.86664497 -2.69410929
[29,] -2.48542798 0.86664497
[30,] -1.21169387 -2.48542798
[31,] -1.50057750 -1.21169387
[32,] -1.97719568 -1.50057750
[33,] 0.94521574 -1.97719568
[34,] -0.87610505 0.94521574
[35,] -1.97006551 -0.87610505
[36,] 0.21635253 -1.97006551
[37,] 0.68961137 0.21635253
[38,] -0.35056648 0.68961137
[39,] -0.20339474 -0.35056648
[40,] 0.82723569 -0.20339474
[41,] -0.23434394 0.82723569
[42,] -1.19602651 -0.23434394
[43,] 0.62988939 -1.19602651
[44,] 0.44102318 0.62988939
[45,] 0.58162208 0.44102318
[46,] -1.87670495 0.58162208
[47,] -2.40026448 -1.87670495
[48,] 2.62803443 -2.40026448
[49,] 0.08571160 2.62803443
[50,] -1.05026240 0.08571160
[51,] 3.80776241 -1.05026240
[52,] -2.43177970 3.80776241
[53,] -0.68255001 -2.43177970
[54,] -0.19038582 -0.68255001
[55,] 2.45571479 -0.19038582
[56,] 1.69947591 2.45571479
[57,] 3.34442470 1.69947591
[58,] 1.34793964 3.34442470
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.55752677 1.28822776
2 0.95143257 -0.55752677
3 2.17224232 0.95143257
4 -0.50088908 2.17224232
5 3.36771366 -0.50088908
6 1.71952798 3.36771366
7 -0.36253178 1.71952798
8 0.33406983 -0.36253178
9 -0.99824993 0.33406983
10 2.19112153 -0.99824993
11 4.49735568 2.19112153
12 -2.01332933 4.49735568
13 -0.79268793 -2.01332933
14 1.19031766 -0.79268793
15 -3.08250070 1.19031766
16 1.23878812 -3.08250070
17 0.03460826 1.23878812
18 0.87857822 0.03460826
19 -1.22249490 0.87857822
20 -0.49737324 -1.22249490
21 -3.87301259 -0.49737324
22 -0.78625118 -3.87301259
23 -0.12702569 -0.78625118
24 -2.11928538 -0.12702569
25 0.57489174 -2.11928538
26 -0.74092135 0.57489174
27 -2.69410929 -0.74092135
28 0.86664497 -2.69410929
29 -2.48542798 0.86664497
30 -1.21169387 -2.48542798
31 -1.50057750 -1.21169387
32 -1.97719568 -1.50057750
33 0.94521574 -1.97719568
34 -0.87610505 0.94521574
35 -1.97006551 -0.87610505
36 0.21635253 -1.97006551
37 0.68961137 0.21635253
38 -0.35056648 0.68961137
39 -0.20339474 -0.35056648
40 0.82723569 -0.20339474
41 -0.23434394 0.82723569
42 -1.19602651 -0.23434394
43 0.62988939 -1.19602651
44 0.44102318 0.62988939
45 0.58162208 0.44102318
46 -1.87670495 0.58162208
47 -2.40026448 -1.87670495
48 2.62803443 -2.40026448
49 0.08571160 2.62803443
50 -1.05026240 0.08571160
51 3.80776241 -1.05026240
52 -2.43177970 3.80776241
53 -0.68255001 -2.43177970
54 -0.19038582 -0.68255001
55 2.45571479 -0.19038582
56 1.69947591 2.45571479
57 3.34442470 1.69947591
58 1.34793964 3.34442470
> 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/70xu01261309035.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/810i31261309035.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/9c9ye1261309035.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/10jnjm1261309035.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/11suam1261309035.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/12k7lm1261309035.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/13keyc1261309035.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/1429w91261309036.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/15vic11261309036.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/16sp321261309036.tab")
+ }
>
> try(system("convert tmp/1syxj1261309035.ps tmp/1syxj1261309035.png",intern=TRUE))
character(0)
> try(system("convert tmp/2uva21261309035.ps tmp/2uva21261309035.png",intern=TRUE))
character(0)
> try(system("convert tmp/3s9yv1261309035.ps tmp/3s9yv1261309035.png",intern=TRUE))
character(0)
> try(system("convert tmp/42w3b1261309035.ps tmp/42w3b1261309035.png",intern=TRUE))
character(0)
> try(system("convert tmp/5eeb61261309035.ps tmp/5eeb61261309035.png",intern=TRUE))
character(0)
> try(system("convert tmp/6lcb21261309035.ps tmp/6lcb21261309035.png",intern=TRUE))
character(0)
> try(system("convert tmp/70xu01261309035.ps tmp/70xu01261309035.png",intern=TRUE))
character(0)
> try(system("convert tmp/810i31261309035.ps tmp/810i31261309035.png",intern=TRUE))
character(0)
> try(system("convert tmp/9c9ye1261309035.ps tmp/9c9ye1261309035.png",intern=TRUE))
character(0)
> try(system("convert tmp/10jnjm1261309035.ps tmp/10jnjm1261309035.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.375 1.559 3.954