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(474605,0,470390,0,461251,0,454724,0,455626,0,516847,0,525192,0,522975,0,518585,0,509239,0,512238,0,519164,0,517009,0,509933,0,509127,0,500875,0,506971,0,569323,0,579714,0,577992,0,565644,0,547344,0,554788,0,562325,0,560854,0,555332,0,543599,0,536662,0,542722,0,593530,0,610763,0,612613,0,611324,0,594167,0,595454,0,590865,0,589379,0,584428,0,573100,0,567456,0,569028,0,620735,0,628884,0,628232,0,612117,0,595404,0,597141,0,593408,0,590072,0,579799,0,574205,0,572775,0,572942,0,619567,0,625809,0,619916,0,587625,0,565724,0,557274,0,560576,0,548854,0,531673,0,525919,0,511038,0,498662,0,555362,0,564591,0,541667,0,527070,0,509846,0,514258,0,516922,0,507561,0,492622,0,490243,0,469357,0,477580,0,528379,0,533590,0,517945,1,506174,1,501866,1,516441,1,528222,1,532638,1),dim=c(2,85),dimnames=list(c('Werkzoekend','Crisis'),1:85))
> y <- array(NA,dim=c(2,85),dimnames=list(c('Werkzoekend','Crisis'),1:85))
> 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
Werkzoekend Crisis M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 474605 0 1 0 0 0 0 0 0 0 0 0 0 1
2 470390 0 0 1 0 0 0 0 0 0 0 0 0 2
3 461251 0 0 0 1 0 0 0 0 0 0 0 0 3
4 454724 0 0 0 0 1 0 0 0 0 0 0 0 4
5 455626 0 0 0 0 0 1 0 0 0 0 0 0 5
6 516847 0 0 0 0 0 0 1 0 0 0 0 0 6
7 525192 0 0 0 0 0 0 0 1 0 0 0 0 7
8 522975 0 0 0 0 0 0 0 0 1 0 0 0 8
9 518585 0 0 0 0 0 0 0 0 0 1 0 0 9
10 509239 0 0 0 0 0 0 0 0 0 0 1 0 10
11 512238 0 0 0 0 0 0 0 0 0 0 0 1 11
12 519164 0 0 0 0 0 0 0 0 0 0 0 0 12
13 517009 0 1 0 0 0 0 0 0 0 0 0 0 13
14 509933 0 0 1 0 0 0 0 0 0 0 0 0 14
15 509127 0 0 0 1 0 0 0 0 0 0 0 0 15
16 500875 0 0 0 0 1 0 0 0 0 0 0 0 16
17 506971 0 0 0 0 0 1 0 0 0 0 0 0 17
18 569323 0 0 0 0 0 0 1 0 0 0 0 0 18
19 579714 0 0 0 0 0 0 0 1 0 0 0 0 19
20 577992 0 0 0 0 0 0 0 0 1 0 0 0 20
21 565644 0 0 0 0 0 0 0 0 0 1 0 0 21
22 547344 0 0 0 0 0 0 0 0 0 0 1 0 22
23 554788 0 0 0 0 0 0 0 0 0 0 0 1 23
24 562325 0 0 0 0 0 0 0 0 0 0 0 0 24
25 560854 0 1 0 0 0 0 0 0 0 0 0 0 25
26 555332 0 0 1 0 0 0 0 0 0 0 0 0 26
27 543599 0 0 0 1 0 0 0 0 0 0 0 0 27
28 536662 0 0 0 0 1 0 0 0 0 0 0 0 28
29 542722 0 0 0 0 0 1 0 0 0 0 0 0 29
30 593530 0 0 0 0 0 0 1 0 0 0 0 0 30
31 610763 0 0 0 0 0 0 0 1 0 0 0 0 31
32 612613 0 0 0 0 0 0 0 0 1 0 0 0 32
33 611324 0 0 0 0 0 0 0 0 0 1 0 0 33
34 594167 0 0 0 0 0 0 0 0 0 0 1 0 34
35 595454 0 0 0 0 0 0 0 0 0 0 0 1 35
36 590865 0 0 0 0 0 0 0 0 0 0 0 0 36
37 589379 0 1 0 0 0 0 0 0 0 0 0 0 37
38 584428 0 0 1 0 0 0 0 0 0 0 0 0 38
39 573100 0 0 0 1 0 0 0 0 0 0 0 0 39
40 567456 0 0 0 0 1 0 0 0 0 0 0 0 40
41 569028 0 0 0 0 0 1 0 0 0 0 0 0 41
42 620735 0 0 0 0 0 0 1 0 0 0 0 0 42
43 628884 0 0 0 0 0 0 0 1 0 0 0 0 43
44 628232 0 0 0 0 0 0 0 0 1 0 0 0 44
45 612117 0 0 0 0 0 0 0 0 0 1 0 0 45
46 595404 0 0 0 0 0 0 0 0 0 0 1 0 46
47 597141 0 0 0 0 0 0 0 0 0 0 0 1 47
48 593408 0 0 0 0 0 0 0 0 0 0 0 0 48
49 590072 0 1 0 0 0 0 0 0 0 0 0 0 49
50 579799 0 0 1 0 0 0 0 0 0 0 0 0 50
51 574205 0 0 0 1 0 0 0 0 0 0 0 0 51
52 572775 0 0 0 0 1 0 0 0 0 0 0 0 52
53 572942 0 0 0 0 0 1 0 0 0 0 0 0 53
54 619567 0 0 0 0 0 0 1 0 0 0 0 0 54
55 625809 0 0 0 0 0 0 0 1 0 0 0 0 55
56 619916 0 0 0 0 0 0 0 0 1 0 0 0 56
57 587625 0 0 0 0 0 0 0 0 0 1 0 0 57
58 565724 0 0 0 0 0 0 0 0 0 0 1 0 58
59 557274 0 0 0 0 0 0 0 0 0 0 0 1 59
60 560576 0 0 0 0 0 0 0 0 0 0 0 0 60
61 548854 0 1 0 0 0 0 0 0 0 0 0 0 61
62 531673 0 0 1 0 0 0 0 0 0 0 0 0 62
63 525919 0 0 0 1 0 0 0 0 0 0 0 0 63
64 511038 0 0 0 0 1 0 0 0 0 0 0 0 64
65 498662 0 0 0 0 0 1 0 0 0 0 0 0 65
66 555362 0 0 0 0 0 0 1 0 0 0 0 0 66
67 564591 0 0 0 0 0 0 0 1 0 0 0 0 67
68 541667 0 0 0 0 0 0 0 0 1 0 0 0 68
69 527070 0 0 0 0 0 0 0 0 0 1 0 0 69
70 509846 0 0 0 0 0 0 0 0 0 0 1 0 70
71 514258 0 0 0 0 0 0 0 0 0 0 0 1 71
72 516922 0 0 0 0 0 0 0 0 0 0 0 0 72
73 507561 0 1 0 0 0 0 0 0 0 0 0 0 73
74 492622 0 0 1 0 0 0 0 0 0 0 0 0 74
75 490243 0 0 0 1 0 0 0 0 0 0 0 0 75
76 469357 0 0 0 0 1 0 0 0 0 0 0 0 76
77 477580 0 0 0 0 0 1 0 0 0 0 0 0 77
78 528379 0 0 0 0 0 0 1 0 0 0 0 0 78
79 533590 0 0 0 0 0 0 0 1 0 0 0 0 79
80 517945 1 0 0 0 0 0 0 0 1 0 0 0 80
81 506174 1 0 0 0 0 0 0 0 0 1 0 0 81
82 501866 1 0 0 0 0 0 0 0 0 0 1 0 82
83 516441 1 0 0 0 0 0 0 0 0 0 0 1 83
84 528222 1 0 0 0 0 0 0 0 0 0 0 0 84
85 532638 1 1 0 0 0 0 0 0 0 0 0 0 85
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Crisis M1 M2 M3 M4
547894.5 -54536.9 -12570.7 -26133.5 -33079.7 -42572.2
M5 M6 M7 M8 M9 M10
-41321.8 12724.1 21711.1 22488.7 8961.3 -6301.5
M11 t
-3142.5 270.1
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-60989 -35485 2207 34407 53407
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 547894.5 17618.6 31.098 <2e-16 ***
Crisis -54536.9 19779.1 -2.757 0.0074 **
M1 -12570.7 20955.6 -0.600 0.5505
M2 -26133.5 21785.4 -1.200 0.2343
M3 -33079.7 21779.2 -1.519 0.1332
M4 -42572.2 21774.9 -1.955 0.0545 .
M5 -41321.8 21772.4 -1.898 0.0618 .
M6 12724.1 21771.8 0.584 0.5608
M7 21711.1 21773.0 0.997 0.3221
M8 22488.7 21637.4 1.039 0.3022
M9 8961.3 21631.0 0.414 0.6799
M10 -6301.5 21626.3 -0.291 0.7716
M11 -3142.5 21623.6 -0.145 0.8849
t 270.1 200.1 1.350 0.1814
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 40450 on 71 degrees of freedom
Multiple R-squared: 0.3008, Adjusted R-squared: 0.1728
F-statistic: 2.349 on 13 and 71 DF, p-value: 0.01138
> 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,] 2.851033e-03 5.702067e-03 0.997148967
[2,] 7.021500e-04 1.404300e-03 0.999297850
[3,] 2.220293e-04 4.440586e-04 0.999777971
[4,] 6.639794e-05 1.327959e-04 0.999933602
[5,] 1.161974e-05 2.323949e-05 0.999988380
[6,] 8.451131e-06 1.690226e-05 0.999991549
[7,] 2.498005e-06 4.996010e-06 0.999997502
[8,] 7.075067e-07 1.415013e-06 0.999999292
[9,] 2.681500e-07 5.362999e-07 0.999999732
[10,] 8.245531e-08 1.649106e-07 0.999999918
[11,] 1.224589e-07 2.449177e-07 0.999999878
[12,] 1.234294e-07 2.468588e-07 0.999999877
[13,] 7.514722e-08 1.502944e-07 0.999999925
[14,] 7.462950e-07 1.492590e-06 0.999999254
[15,] 8.323130e-07 1.664626e-06 0.999999168
[16,] 4.528363e-07 9.056725e-07 0.999999547
[17,] 2.297261e-07 4.594522e-07 0.999999770
[18,] 9.418114e-08 1.883623e-07 0.999999906
[19,] 4.467417e-08 8.934834e-08 0.999999955
[20,] 2.865095e-07 5.730190e-07 0.999999713
[21,] 1.252331e-06 2.504663e-06 0.999998748
[22,] 1.665951e-06 3.331902e-06 0.999998334
[23,] 6.340792e-06 1.268158e-05 0.999993659
[24,] 1.180028e-05 2.360056e-05 0.999988200
[25,] 3.001110e-05 6.002220e-05 0.999969989
[26,] 2.185712e-04 4.371424e-04 0.999781429
[27,] 2.152776e-03 4.305552e-03 0.997847224
[28,] 3.901064e-03 7.802128e-03 0.996098936
[29,] 1.474035e-02 2.948070e-02 0.985259648
[30,] 3.551219e-02 7.102438e-02 0.964487808
[31,] 6.825727e-02 1.365145e-01 0.931742733
[32,] 1.719642e-01 3.439283e-01 0.828035845
[33,] 2.881557e-01 5.763114e-01 0.711844291
[34,] 3.616929e-01 7.233858e-01 0.638307106
[35,] 3.872569e-01 7.745138e-01 0.612743090
[36,] 3.784104e-01 7.568209e-01 0.621589572
[37,] 3.936458e-01 7.872916e-01 0.606354179
[38,] 4.259005e-01 8.518009e-01 0.574099539
[39,] 4.668736e-01 9.337472e-01 0.533126424
[40,] 8.639544e-01 2.720913e-01 0.136045631
[41,] 9.802234e-01 3.955322e-02 0.019776612
[42,] 9.962978e-01 7.404478e-03 0.003702239
[43,] 9.976352e-01 4.729569e-03 0.002364784
[44,] 9.974801e-01 5.039862e-03 0.002519931
[45,] 9.968111e-01 6.377856e-03 0.003188928
[46,] 9.959284e-01 8.143128e-03 0.004071564
[47,] 9.932098e-01 1.358040e-02 0.006790199
[48,] 9.907581e-01 1.848381e-02 0.009241907
[49,] 9.840808e-01 3.183835e-02 0.015919173
[50,] 9.671970e-01 6.560591e-02 0.032802955
[51,] 9.289437e-01 1.421126e-01 0.071056292
[52,] 9.099628e-01 1.800744e-01 0.090037198
> postscript(file="/var/www/html/rcomp/tmp/15ivq1258754687.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/2cn3u1258754687.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/3tzjj1258754687.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/46ov91258754687.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/5evtz1258754687.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 = 85
Frequency = 1
1 2 3 4 5 6
-60988.9769 -51911.3141 -54374.1712 -51678.7426 -52297.3141 -45392.3141
7 8 9 10 11 12
-46304.4569 -49569.1547 -40701.8690 -35055.1547 -35485.2975 -31971.8690
13 14 15 16 17 18
-21826.3008 -15609.6380 -9739.4951 -8769.0665 -4193.6380 3842.3620
19 20 21 22 23 24
4976.2192 2206.5214 3115.8072 -191.4786 3823.3786 7947.8072
25 26 27 28 29 30
18777.3753 26548.0382 21491.1810 23776.6096 28316.0382 24808.0382
31 32 33 34 35 36
32783.8953 33586.1976 45554.4833 43390.1976 41248.0547 33246.4833
37 38 39 40 41 42
44061.0514 52402.7143 47750.8571 51329.2857 51380.7143 48771.7143
43 44 45 46 47 48
47663.5714 45963.8737 43106.1594 41385.8737 39693.7308 32548.1594
49 50 51 52 53 54
41512.7275 44532.3904 45614.5333 53406.9618 52053.3904 44362.3904
55 56 57 58 59 60
41347.2475 34406.5498 15372.8355 8464.5498 -3414.5931 -3525.1645
61 62 63 64 65 66
-2946.5963 -6834.9335 -5912.7906 -11571.3620 -25467.9335 -23083.9335
67 68 69 70 71 72
-23112.0763 -47083.7741 -48423.4884 -50654.7741 -49671.9169 -50420.4884
73 74 75 76 77 78
-47480.9202 -49127.2574 -44830.1145 -56493.6859 -49791.2574 -53308.2574
79 80 81 82 83 84
-57354.4002 -19510.2137 -18023.9280 -7339.2137 3806.6434 12175.0720
85
28891.6401
> postscript(file="/var/www/html/rcomp/tmp/6ck851258754687.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 = 85
Frequency = 1
lag(myerror, k = 1) myerror
0 -60988.9769 NA
1 -51911.3141 -60988.9769
2 -54374.1712 -51911.3141
3 -51678.7426 -54374.1712
4 -52297.3141 -51678.7426
5 -45392.3141 -52297.3141
6 -46304.4569 -45392.3141
7 -49569.1547 -46304.4569
8 -40701.8690 -49569.1547
9 -35055.1547 -40701.8690
10 -35485.2975 -35055.1547
11 -31971.8690 -35485.2975
12 -21826.3008 -31971.8690
13 -15609.6380 -21826.3008
14 -9739.4951 -15609.6380
15 -8769.0665 -9739.4951
16 -4193.6380 -8769.0665
17 3842.3620 -4193.6380
18 4976.2192 3842.3620
19 2206.5214 4976.2192
20 3115.8072 2206.5214
21 -191.4786 3115.8072
22 3823.3786 -191.4786
23 7947.8072 3823.3786
24 18777.3753 7947.8072
25 26548.0382 18777.3753
26 21491.1810 26548.0382
27 23776.6096 21491.1810
28 28316.0382 23776.6096
29 24808.0382 28316.0382
30 32783.8953 24808.0382
31 33586.1976 32783.8953
32 45554.4833 33586.1976
33 43390.1976 45554.4833
34 41248.0547 43390.1976
35 33246.4833 41248.0547
36 44061.0514 33246.4833
37 52402.7143 44061.0514
38 47750.8571 52402.7143
39 51329.2857 47750.8571
40 51380.7143 51329.2857
41 48771.7143 51380.7143
42 47663.5714 48771.7143
43 45963.8737 47663.5714
44 43106.1594 45963.8737
45 41385.8737 43106.1594
46 39693.7308 41385.8737
47 32548.1594 39693.7308
48 41512.7275 32548.1594
49 44532.3904 41512.7275
50 45614.5333 44532.3904
51 53406.9618 45614.5333
52 52053.3904 53406.9618
53 44362.3904 52053.3904
54 41347.2475 44362.3904
55 34406.5498 41347.2475
56 15372.8355 34406.5498
57 8464.5498 15372.8355
58 -3414.5931 8464.5498
59 -3525.1645 -3414.5931
60 -2946.5963 -3525.1645
61 -6834.9335 -2946.5963
62 -5912.7906 -6834.9335
63 -11571.3620 -5912.7906
64 -25467.9335 -11571.3620
65 -23083.9335 -25467.9335
66 -23112.0763 -23083.9335
67 -47083.7741 -23112.0763
68 -48423.4884 -47083.7741
69 -50654.7741 -48423.4884
70 -49671.9169 -50654.7741
71 -50420.4884 -49671.9169
72 -47480.9202 -50420.4884
73 -49127.2574 -47480.9202
74 -44830.1145 -49127.2574
75 -56493.6859 -44830.1145
76 -49791.2574 -56493.6859
77 -53308.2574 -49791.2574
78 -57354.4002 -53308.2574
79 -19510.2137 -57354.4002
80 -18023.9280 -19510.2137
81 -7339.2137 -18023.9280
82 3806.6434 -7339.2137
83 12175.0720 3806.6434
84 28891.6401 12175.0720
85 NA 28891.6401
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -51911.3141 -60988.9769
[2,] -54374.1712 -51911.3141
[3,] -51678.7426 -54374.1712
[4,] -52297.3141 -51678.7426
[5,] -45392.3141 -52297.3141
[6,] -46304.4569 -45392.3141
[7,] -49569.1547 -46304.4569
[8,] -40701.8690 -49569.1547
[9,] -35055.1547 -40701.8690
[10,] -35485.2975 -35055.1547
[11,] -31971.8690 -35485.2975
[12,] -21826.3008 -31971.8690
[13,] -15609.6380 -21826.3008
[14,] -9739.4951 -15609.6380
[15,] -8769.0665 -9739.4951
[16,] -4193.6380 -8769.0665
[17,] 3842.3620 -4193.6380
[18,] 4976.2192 3842.3620
[19,] 2206.5214 4976.2192
[20,] 3115.8072 2206.5214
[21,] -191.4786 3115.8072
[22,] 3823.3786 -191.4786
[23,] 7947.8072 3823.3786
[24,] 18777.3753 7947.8072
[25,] 26548.0382 18777.3753
[26,] 21491.1810 26548.0382
[27,] 23776.6096 21491.1810
[28,] 28316.0382 23776.6096
[29,] 24808.0382 28316.0382
[30,] 32783.8953 24808.0382
[31,] 33586.1976 32783.8953
[32,] 45554.4833 33586.1976
[33,] 43390.1976 45554.4833
[34,] 41248.0547 43390.1976
[35,] 33246.4833 41248.0547
[36,] 44061.0514 33246.4833
[37,] 52402.7143 44061.0514
[38,] 47750.8571 52402.7143
[39,] 51329.2857 47750.8571
[40,] 51380.7143 51329.2857
[41,] 48771.7143 51380.7143
[42,] 47663.5714 48771.7143
[43,] 45963.8737 47663.5714
[44,] 43106.1594 45963.8737
[45,] 41385.8737 43106.1594
[46,] 39693.7308 41385.8737
[47,] 32548.1594 39693.7308
[48,] 41512.7275 32548.1594
[49,] 44532.3904 41512.7275
[50,] 45614.5333 44532.3904
[51,] 53406.9618 45614.5333
[52,] 52053.3904 53406.9618
[53,] 44362.3904 52053.3904
[54,] 41347.2475 44362.3904
[55,] 34406.5498 41347.2475
[56,] 15372.8355 34406.5498
[57,] 8464.5498 15372.8355
[58,] -3414.5931 8464.5498
[59,] -3525.1645 -3414.5931
[60,] -2946.5963 -3525.1645
[61,] -6834.9335 -2946.5963
[62,] -5912.7906 -6834.9335
[63,] -11571.3620 -5912.7906
[64,] -25467.9335 -11571.3620
[65,] -23083.9335 -25467.9335
[66,] -23112.0763 -23083.9335
[67,] -47083.7741 -23112.0763
[68,] -48423.4884 -47083.7741
[69,] -50654.7741 -48423.4884
[70,] -49671.9169 -50654.7741
[71,] -50420.4884 -49671.9169
[72,] -47480.9202 -50420.4884
[73,] -49127.2574 -47480.9202
[74,] -44830.1145 -49127.2574
[75,] -56493.6859 -44830.1145
[76,] -49791.2574 -56493.6859
[77,] -53308.2574 -49791.2574
[78,] -57354.4002 -53308.2574
[79,] -19510.2137 -57354.4002
[80,] -18023.9280 -19510.2137
[81,] -7339.2137 -18023.9280
[82,] 3806.6434 -7339.2137
[83,] 12175.0720 3806.6434
[84,] 28891.6401 12175.0720
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -51911.3141 -60988.9769
2 -54374.1712 -51911.3141
3 -51678.7426 -54374.1712
4 -52297.3141 -51678.7426
5 -45392.3141 -52297.3141
6 -46304.4569 -45392.3141
7 -49569.1547 -46304.4569
8 -40701.8690 -49569.1547
9 -35055.1547 -40701.8690
10 -35485.2975 -35055.1547
11 -31971.8690 -35485.2975
12 -21826.3008 -31971.8690
13 -15609.6380 -21826.3008
14 -9739.4951 -15609.6380
15 -8769.0665 -9739.4951
16 -4193.6380 -8769.0665
17 3842.3620 -4193.6380
18 4976.2192 3842.3620
19 2206.5214 4976.2192
20 3115.8072 2206.5214
21 -191.4786 3115.8072
22 3823.3786 -191.4786
23 7947.8072 3823.3786
24 18777.3753 7947.8072
25 26548.0382 18777.3753
26 21491.1810 26548.0382
27 23776.6096 21491.1810
28 28316.0382 23776.6096
29 24808.0382 28316.0382
30 32783.8953 24808.0382
31 33586.1976 32783.8953
32 45554.4833 33586.1976
33 43390.1976 45554.4833
34 41248.0547 43390.1976
35 33246.4833 41248.0547
36 44061.0514 33246.4833
37 52402.7143 44061.0514
38 47750.8571 52402.7143
39 51329.2857 47750.8571
40 51380.7143 51329.2857
41 48771.7143 51380.7143
42 47663.5714 48771.7143
43 45963.8737 47663.5714
44 43106.1594 45963.8737
45 41385.8737 43106.1594
46 39693.7308 41385.8737
47 32548.1594 39693.7308
48 41512.7275 32548.1594
49 44532.3904 41512.7275
50 45614.5333 44532.3904
51 53406.9618 45614.5333
52 52053.3904 53406.9618
53 44362.3904 52053.3904
54 41347.2475 44362.3904
55 34406.5498 41347.2475
56 15372.8355 34406.5498
57 8464.5498 15372.8355
58 -3414.5931 8464.5498
59 -3525.1645 -3414.5931
60 -2946.5963 -3525.1645
61 -6834.9335 -2946.5963
62 -5912.7906 -6834.9335
63 -11571.3620 -5912.7906
64 -25467.9335 -11571.3620
65 -23083.9335 -25467.9335
66 -23112.0763 -23083.9335
67 -47083.7741 -23112.0763
68 -48423.4884 -47083.7741
69 -50654.7741 -48423.4884
70 -49671.9169 -50654.7741
71 -50420.4884 -49671.9169
72 -47480.9202 -50420.4884
73 -49127.2574 -47480.9202
74 -44830.1145 -49127.2574
75 -56493.6859 -44830.1145
76 -49791.2574 -56493.6859
77 -53308.2574 -49791.2574
78 -57354.4002 -53308.2574
79 -19510.2137 -57354.4002
80 -18023.9280 -19510.2137
81 -7339.2137 -18023.9280
82 3806.6434 -7339.2137
83 12175.0720 3806.6434
84 28891.6401 12175.0720
> 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/77zmv1258754687.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/8a05h1258754687.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/93k1a1258754687.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/10ilm91258754687.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/11at9f1258754687.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/12idwp1258754687.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/134hok1258754687.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/14z1zg1258754687.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/15kd4b1258754687.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/1619mv1258754688.tab")
+ }
>
> system("convert tmp/15ivq1258754687.ps tmp/15ivq1258754687.png")
> system("convert tmp/2cn3u1258754687.ps tmp/2cn3u1258754687.png")
> system("convert tmp/3tzjj1258754687.ps tmp/3tzjj1258754687.png")
> system("convert tmp/46ov91258754687.ps tmp/46ov91258754687.png")
> system("convert tmp/5evtz1258754687.ps tmp/5evtz1258754687.png")
> system("convert tmp/6ck851258754687.ps tmp/6ck851258754687.png")
> system("convert tmp/77zmv1258754687.ps tmp/77zmv1258754687.png")
> system("convert tmp/8a05h1258754687.ps tmp/8a05h1258754687.png")
> system("convert tmp/93k1a1258754687.ps tmp/93k1a1258754687.png")
> system("convert tmp/10ilm91258754687.ps tmp/10ilm91258754687.png")
>
>
> proc.time()
user system elapsed
2.756 1.609 3.804