R version 2.12.1 (2010-12-16)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-pc-linux-gnu (32-bit)
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(4
+ ,9.3
+ ,141
+ ,16
+ ,6
+ ,7
+ ,5
+ ,140002
+ ,135
+ ,20
+ ,20
+ ,0
+ ,7
+ ,23
+ ,308
+ ,8
+ ,15
+ ,0
+ ,8
+ ,160003
+ ,94
+ ,21
+ ,25
+ ,0
+ ,9
+ ,180004
+ ,160
+ ,7
+ ,4
+ ,0
+ ,10
+ ,14.2
+ ,108
+ ,17
+ ,6
+ ,0
+ ,11
+ ,901
+ ,79
+ ,20
+ ,2
+ ,0
+ ,12
+ ,5.9
+ ,40
+ ,18
+ ,1
+ ,1
+ ,1
+ ,7.2
+ ,35
+ ,26
+ ,4
+ ,2
+ ,2
+ ,6.8
+ ,48
+ ,18
+ ,4
+ ,2
+ ,3
+ ,8
+ ,144
+ ,20
+ ,0
+ ,2
+ ,4
+ ,14.3
+ ,284
+ ,0
+ ,3
+ ,0
+ ,5
+ ,14.6
+ ,164
+ ,22
+ ,14
+ ,0
+ ,6
+ ,17.5
+ ,130
+ ,19
+ ,17
+ ,0
+ ,7
+ ,17.2
+ ,178
+ ,18
+ ,14
+ ,0
+ ,8
+ ,17.5
+ ,150
+ ,13
+ ,10
+ ,0
+ ,9
+ ,14.1
+ ,103
+ ,16
+ ,7
+ ,0
+ ,10
+ ,10.4
+ ,110
+ ,11
+ ,4
+ ,0
+ ,11
+ ,6.8
+ ,51
+ ,22
+ ,1
+ ,1
+ ,12
+ ,4.1
+ ,70
+ ,19
+ ,6
+ ,0
+ ,1
+ ,6.5
+ ,41
+ ,23
+ ,2
+ ,1
+ ,2
+ ,6.1
+ ,125
+ ,11
+ ,2
+ ,0
+ ,3
+ ,6.3
+ ,68
+ ,24
+ ,8
+ ,7
+ ,4
+ ,9.3
+ ,135
+ ,14
+ ,10
+ ,0
+ ,5
+ ,16.4
+ ,231
+ ,11
+ ,13
+ ,0
+ ,6
+ ,16.1
+ ,184
+ ,17
+ ,10
+ ,0
+ ,7
+ ,18
+ ,181
+ ,20
+ ,14
+ ,0
+ ,8
+ ,17.6
+ ,138
+ ,19
+ ,13
+ ,0
+ ,9
+ ,14
+ ,157
+ ,12
+ ,6
+ ,0
+ ,10
+ ,10.5
+ ,122
+ ,19
+ ,6
+ ,2
+ ,11
+ ,6.9
+ ,39
+ ,26
+ ,9
+ ,3
+ ,12
+ ,2.8
+ ,61
+ ,13
+ ,2
+ ,5
+ ,1
+ ,0.7
+ ,88
+ ,12
+ ,4
+ ,5
+ ,2
+ ,3.6
+ ,32
+ ,20
+ ,3
+ ,7
+ ,3
+ ,6.7
+ ,149
+ ,15
+ ,4
+ ,2
+ ,4
+ ,12.5
+ ,196
+ ,15
+ ,10
+ ,0
+ ,5
+ ,14.4
+ ,195
+ ,17
+ ,15
+ ,0
+ ,6
+ ,16.5
+ ,224
+ ,11
+ ,14
+ ,0
+ ,7
+ ,18.7
+ ,212
+ ,20
+ ,18
+ ,0
+ ,8
+ ,19.4
+ ,257
+ ,9
+ ,10
+ ,0
+ ,9
+ ,15.8
+ ,156
+ ,10
+ ,5
+ ,0
+ ,10
+ ,11.3
+ ,89
+ ,17
+ ,5
+ ,0
+ ,11
+ ,9.7
+ ,48
+ ,25
+ ,7
+ ,0
+ ,12
+ ,2.9
+ ,46
+ ,19
+ ,2
+ ,7
+ ,1
+ ,0.1
+ ,48
+ ,18
+ ,0
+ ,4
+ ,2
+ ,2.5
+ ,28
+ ,24
+ ,4
+ ,10
+ ,3
+ ,6.7
+ ,117
+ ,13
+ ,7
+ ,2
+ ,4
+ ,10.3
+ ,223
+ ,6
+ ,8
+ ,0
+ ,5
+ ,11.2
+ ,171
+ ,14
+ ,6
+ ,0
+ ,6
+ ,17.4
+ ,258
+ ,9
+ ,3
+ ,0
+ ,7
+ ,20.5
+ ,252
+ ,13
+ ,12
+ ,0
+ ,8
+ ,17
+ ,136
+ ,23
+ ,15
+ ,0
+ ,9
+ ,14.2
+ ,142
+ ,18
+ ,8
+ ,0
+ ,10
+ ,10.6
+ ,118
+ ,16
+ ,6
+ ,0
+ ,11
+ ,6.1
+ ,23
+ ,21
+ ,1
+ ,6
+ ,12
+ ,-0.7
+ ,33
+ ,26
+ ,1
+ ,23
+ ,1
+ ,4
+ ,52
+ ,21
+ ,0
+ ,4
+ ,2
+ ,5.4
+ ,54
+ ,15
+ ,0
+ ,1
+ ,3
+ ,7.7
+ ,204
+ ,7
+ ,0
+ ,1
+ ,4
+ ,14.1
+ ,238
+ ,11
+ ,10
+ ,0
+ ,5
+ ,14.8
+ ,264
+ ,9
+ ,9
+ ,0
+ ,6
+ ,16.8
+ ,180
+ ,19
+ ,16
+ ,0
+ ,7
+ ,16
+ ,140
+ ,20
+ ,10
+ ,0
+ ,8
+ ,17.3
+ ,144
+ ,22
+ ,15
+ ,0
+ ,9
+ ,16.5
+ ,173
+ ,10
+ ,8
+ ,0
+ ,10
+ ,12.1
+ ,161
+ ,16
+ ,4
+ ,0)
+ ,dim=c(6
+ ,66)
+ ,dimnames=list(c('maanden'
+ ,'gemiddeldetemperatuur'
+ ,'aantaldagenzonneschijn'
+ ,'aantaldagenregen'
+ ,'aantaldagenonweer'
+ ,'aantaldagensneeuw')
+ ,1:66))
> y <- array(NA,dim=c(6,66),dimnames=list(c('maanden','gemiddeldetemperatuur','aantaldagenzonneschijn','aantaldagenregen','aantaldagenonweer','aantaldagensneeuw'),1:66))
> 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 = '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
> 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
maanden gemiddeldetemperatuur aantaldagenzonneschijn aantaldagenregen
1 4 9.3 141 16
2 5 140002.0 135 20
3 7 23.0 308 8
4 8 160003.0 94 21
5 9 180004.0 160 7
6 10 14.2 108 17
7 11 901.0 79 20
8 12 5.9 40 18
9 1 7.2 35 26
10 2 6.8 48 18
11 3 8.0 144 20
12 4 14.3 284 0
13 5 14.6 164 22
14 6 17.5 130 19
15 7 17.2 178 18
16 8 17.5 150 13
17 9 14.1 103 16
18 10 10.4 110 11
19 11 6.8 51 22
20 12 4.1 70 19
21 1 6.5 41 23
22 2 6.1 125 11
23 3 6.3 68 24
24 4 9.3 135 14
25 5 16.4 231 11
26 6 16.1 184 17
27 7 18.0 181 20
28 8 17.6 138 19
29 9 14.0 157 12
30 10 10.5 122 19
31 11 6.9 39 26
32 12 2.8 61 13
33 1 0.7 88 12
34 2 3.6 32 20
35 3 6.7 149 15
36 4 12.5 196 15
37 5 14.4 195 17
38 6 16.5 224 11
39 7 18.7 212 20
40 8 19.4 257 9
41 9 15.8 156 10
42 10 11.3 89 17
43 11 9.7 48 25
44 12 2.9 46 19
45 1 0.1 48 18
46 2 2.5 28 24
47 3 6.7 117 13
48 4 10.3 223 6
49 5 11.2 171 14
50 6 17.4 258 9
51 7 20.5 252 13
52 8 17.0 136 23
53 9 14.2 142 18
54 10 10.6 118 16
55 11 6.1 23 21
56 12 -0.7 33 26
57 1 4.0 52 21
58 2 5.4 54 15
59 3 7.7 204 7
60 4 14.1 238 11
61 5 14.8 264 9
62 6 16.8 180 19
63 7 16.0 140 20
64 8 17.3 144 22
65 9 16.5 173 10
66 10 12.1 161 16
aantaldagenonweer aantaldagensneeuw
1 6 7
2 20 0
3 15 0
4 25 0
5 4 0
6 6 0
7 2 0
8 1 1
9 4 2
10 4 2
11 0 2
12 3 0
13 14 0
14 17 0
15 14 0
16 10 0
17 7 0
18 4 0
19 1 1
20 6 0
21 2 1
22 2 0
23 8 7
24 10 0
25 13 0
26 10 0
27 14 0
28 13 0
29 6 0
30 6 2
31 9 3
32 2 5
33 4 5
34 3 7
35 4 2
36 10 0
37 15 0
38 14 0
39 18 0
40 10 0
41 5 0
42 5 0
43 7 0
44 2 7
45 0 4
46 4 10
47 7 2
48 8 0
49 6 0
50 3 0
51 12 0
52 15 0
53 8 0
54 6 0
55 1 6
56 1 23
57 0 4
58 0 1
59 0 1
60 10 0
61 9 0
62 16 0
63 10 0
64 15 0
65 8 0
66 4 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) gemiddeldetemperatuur aantaldagenzonneschijn
7.086e+00 2.496e-06 -7.798e-03
aantaldagenregen aantaldagenonweer aantaldagensneeuw
8.763e-03 5.764e-02 -4.675e-02
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-6.1778 -2.4484 0.2959 2.7448 5.9613
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 7.086e+00 3.367e+00 2.104 0.0396 *
gemiddeldetemperatuur 2.496e-06 1.475e-05 0.169 0.8662
aantaldagenzonneschijn -7.798e-03 1.260e-02 -0.619 0.5382
aantaldagenregen 8.763e-03 1.499e-01 0.058 0.9536
aantaldagenonweer 5.764e-02 1.288e-01 0.447 0.6562
aantaldagensneeuw -4.675e-02 1.455e-01 -0.321 0.7491
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.475 on 60 degrees of freedom
Multiple R-squared: 0.02639, Adjusted R-squared: -0.05475
F-statistic: 0.3252 on 5 and 60 DF, p-value: 0.8958
> 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.4414443 0.8828886 0.55855568
[2,] 0.9140735 0.1718529 0.08592647
[3,] 0.8539129 0.2921743 0.14608713
[4,] 0.9021216 0.1957568 0.09787839
[5,] 0.8436704 0.3126591 0.15632956
[6,] 0.7844278 0.4311445 0.21557225
[7,] 0.7086066 0.5827868 0.29139338
[8,] 0.6228754 0.7542493 0.37712463
[9,] 0.5336357 0.9327287 0.46636433
[10,] 0.4507303 0.9014605 0.54926973
[11,] 0.5017536 0.9964928 0.49824640
[12,] 0.6708449 0.6583103 0.32915513
[13,] 0.8534506 0.2930988 0.14654941
[14,] 0.9218592 0.1562815 0.07814077
[15,] 0.9101427 0.1797146 0.08985731
[16,] 0.8997805 0.2004391 0.10021953
[17,] 0.8630532 0.2738936 0.13694680
[18,] 0.8191434 0.3617131 0.18085657
[19,] 0.7728702 0.4542596 0.22712979
[20,] 0.7291007 0.5417987 0.27089934
[21,] 0.6758359 0.6483281 0.32416406
[22,] 0.7137892 0.5724217 0.28621083
[23,] 0.7979322 0.4041356 0.20206778
[24,] 0.9215659 0.1568682 0.07843412
[25,] 0.9290522 0.1418956 0.07094780
[26,] 0.9493415 0.1013170 0.05065851
[27,] 0.9316015 0.1367970 0.06839850
[28,] 0.9062255 0.1875490 0.09377452
[29,] 0.8696583 0.2606834 0.13034172
[30,] 0.8222009 0.3555982 0.17779911
[31,] 0.7703454 0.4593092 0.22965459
[32,] 0.7176378 0.5647245 0.28236224
[33,] 0.6574513 0.6850974 0.34254871
[34,] 0.6050978 0.7898044 0.39490218
[35,] 0.6685877 0.6628247 0.33141233
[36,] 0.8988942 0.2022115 0.10110577
[37,] 0.8837701 0.2324598 0.11622992
[38,] 0.9189091 0.1621818 0.08109088
[39,] 0.8951557 0.2096885 0.10484427
[40,] 0.8526285 0.2947430 0.14737152
[41,] 0.7902752 0.4194496 0.20972482
[42,] 0.7560721 0.4878557 0.24392787
[43,] 0.7821448 0.4357105 0.21785525
[44,] 0.6899554 0.6200891 0.31004455
[45,] 0.5875968 0.8248064 0.41240322
[46,] 0.8282130 0.3435740 0.17178699
[47,] 0.8983410 0.2033180 0.10165899
[48,] 0.9371703 0.1256595 0.06282973
[49,] 0.8665783 0.2668434 0.13342169
> postscript(file="/var/www/rcomp/tmp/1am6p1322149602.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/rcomp/tmp/2oa8n1322149602.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/rcomp/tmp/39a0v1322149602.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/rcomp/tmp/4cdoz1322149602.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/rcomp/tmp/5ufq31322149602.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 = 66
Frequency = 1
1 2 3 4 5 6 7
-2.1450560 -2.7104345 1.3813574 -0.3770418 2.4208437 3.2615953 4.2374996
8 9 10 11 12 13 14
5.0575076 -6.1777595 -5.0062794 -3.0446042 -1.0440077 -1.8066249 -1.2184083
15 16 17 18 19 20 21
0.3375961 1.3936112 2.1737265 3.4450556 4.1082376 4.9477567 -6.0361476
22 23 24 25 26 27 28
-4.3226788 -3.8997098 -2.7321067 -1.1301104 -0.3762902 0.3434642 1.0745366
29 30 31 32 33 34 35
2.6875292 3.4467504 3.6119839 5.3944414 -5.5015134 -4.8571973 -3.1923546
36 37 38 39 40 41 42
-2.2651756 -1.5787014 -0.2423388 0.3546543 2.2630838 2.7548909 3.1710727
43 44 45 46 47 48 49
3.6659637 5.3183839 -5.6822111 -4.8408374 -3.5972966 -1.8604720 -1.2208114
50 51 52 53 54 55 56
0.6743639 1.0737601 0.9086123 2.4026988 3.3483506 4.1323807 5.9612638
57 58 59 60 61 62 63
-5.6773148 -4.7493867 -2.5095344 -1.9025973 -0.6246765 -0.7708477 0.2542935
64 65 66
0.9797611 2.7145431 3.7989566
> postscript(file="/var/www/rcomp/tmp/693hi1322149602.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 = 66
Frequency = 1
lag(myerror, k = 1) myerror
0 -2.1450560 NA
1 -2.7104345 -2.1450560
2 1.3813574 -2.7104345
3 -0.3770418 1.3813574
4 2.4208437 -0.3770418
5 3.2615953 2.4208437
6 4.2374996 3.2615953
7 5.0575076 4.2374996
8 -6.1777595 5.0575076
9 -5.0062794 -6.1777595
10 -3.0446042 -5.0062794
11 -1.0440077 -3.0446042
12 -1.8066249 -1.0440077
13 -1.2184083 -1.8066249
14 0.3375961 -1.2184083
15 1.3936112 0.3375961
16 2.1737265 1.3936112
17 3.4450556 2.1737265
18 4.1082376 3.4450556
19 4.9477567 4.1082376
20 -6.0361476 4.9477567
21 -4.3226788 -6.0361476
22 -3.8997098 -4.3226788
23 -2.7321067 -3.8997098
24 -1.1301104 -2.7321067
25 -0.3762902 -1.1301104
26 0.3434642 -0.3762902
27 1.0745366 0.3434642
28 2.6875292 1.0745366
29 3.4467504 2.6875292
30 3.6119839 3.4467504
31 5.3944414 3.6119839
32 -5.5015134 5.3944414
33 -4.8571973 -5.5015134
34 -3.1923546 -4.8571973
35 -2.2651756 -3.1923546
36 -1.5787014 -2.2651756
37 -0.2423388 -1.5787014
38 0.3546543 -0.2423388
39 2.2630838 0.3546543
40 2.7548909 2.2630838
41 3.1710727 2.7548909
42 3.6659637 3.1710727
43 5.3183839 3.6659637
44 -5.6822111 5.3183839
45 -4.8408374 -5.6822111
46 -3.5972966 -4.8408374
47 -1.8604720 -3.5972966
48 -1.2208114 -1.8604720
49 0.6743639 -1.2208114
50 1.0737601 0.6743639
51 0.9086123 1.0737601
52 2.4026988 0.9086123
53 3.3483506 2.4026988
54 4.1323807 3.3483506
55 5.9612638 4.1323807
56 -5.6773148 5.9612638
57 -4.7493867 -5.6773148
58 -2.5095344 -4.7493867
59 -1.9025973 -2.5095344
60 -0.6246765 -1.9025973
61 -0.7708477 -0.6246765
62 0.2542935 -0.7708477
63 0.9797611 0.2542935
64 2.7145431 0.9797611
65 3.7989566 2.7145431
66 NA 3.7989566
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -2.7104345 -2.1450560
[2,] 1.3813574 -2.7104345
[3,] -0.3770418 1.3813574
[4,] 2.4208437 -0.3770418
[5,] 3.2615953 2.4208437
[6,] 4.2374996 3.2615953
[7,] 5.0575076 4.2374996
[8,] -6.1777595 5.0575076
[9,] -5.0062794 -6.1777595
[10,] -3.0446042 -5.0062794
[11,] -1.0440077 -3.0446042
[12,] -1.8066249 -1.0440077
[13,] -1.2184083 -1.8066249
[14,] 0.3375961 -1.2184083
[15,] 1.3936112 0.3375961
[16,] 2.1737265 1.3936112
[17,] 3.4450556 2.1737265
[18,] 4.1082376 3.4450556
[19,] 4.9477567 4.1082376
[20,] -6.0361476 4.9477567
[21,] -4.3226788 -6.0361476
[22,] -3.8997098 -4.3226788
[23,] -2.7321067 -3.8997098
[24,] -1.1301104 -2.7321067
[25,] -0.3762902 -1.1301104
[26,] 0.3434642 -0.3762902
[27,] 1.0745366 0.3434642
[28,] 2.6875292 1.0745366
[29,] 3.4467504 2.6875292
[30,] 3.6119839 3.4467504
[31,] 5.3944414 3.6119839
[32,] -5.5015134 5.3944414
[33,] -4.8571973 -5.5015134
[34,] -3.1923546 -4.8571973
[35,] -2.2651756 -3.1923546
[36,] -1.5787014 -2.2651756
[37,] -0.2423388 -1.5787014
[38,] 0.3546543 -0.2423388
[39,] 2.2630838 0.3546543
[40,] 2.7548909 2.2630838
[41,] 3.1710727 2.7548909
[42,] 3.6659637 3.1710727
[43,] 5.3183839 3.6659637
[44,] -5.6822111 5.3183839
[45,] -4.8408374 -5.6822111
[46,] -3.5972966 -4.8408374
[47,] -1.8604720 -3.5972966
[48,] -1.2208114 -1.8604720
[49,] 0.6743639 -1.2208114
[50,] 1.0737601 0.6743639
[51,] 0.9086123 1.0737601
[52,] 2.4026988 0.9086123
[53,] 3.3483506 2.4026988
[54,] 4.1323807 3.3483506
[55,] 5.9612638 4.1323807
[56,] -5.6773148 5.9612638
[57,] -4.7493867 -5.6773148
[58,] -2.5095344 -4.7493867
[59,] -1.9025973 -2.5095344
[60,] -0.6246765 -1.9025973
[61,] -0.7708477 -0.6246765
[62,] 0.2542935 -0.7708477
[63,] 0.9797611 0.2542935
[64,] 2.7145431 0.9797611
[65,] 3.7989566 2.7145431
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -2.7104345 -2.1450560
2 1.3813574 -2.7104345
3 -0.3770418 1.3813574
4 2.4208437 -0.3770418
5 3.2615953 2.4208437
6 4.2374996 3.2615953
7 5.0575076 4.2374996
8 -6.1777595 5.0575076
9 -5.0062794 -6.1777595
10 -3.0446042 -5.0062794
11 -1.0440077 -3.0446042
12 -1.8066249 -1.0440077
13 -1.2184083 -1.8066249
14 0.3375961 -1.2184083
15 1.3936112 0.3375961
16 2.1737265 1.3936112
17 3.4450556 2.1737265
18 4.1082376 3.4450556
19 4.9477567 4.1082376
20 -6.0361476 4.9477567
21 -4.3226788 -6.0361476
22 -3.8997098 -4.3226788
23 -2.7321067 -3.8997098
24 -1.1301104 -2.7321067
25 -0.3762902 -1.1301104
26 0.3434642 -0.3762902
27 1.0745366 0.3434642
28 2.6875292 1.0745366
29 3.4467504 2.6875292
30 3.6119839 3.4467504
31 5.3944414 3.6119839
32 -5.5015134 5.3944414
33 -4.8571973 -5.5015134
34 -3.1923546 -4.8571973
35 -2.2651756 -3.1923546
36 -1.5787014 -2.2651756
37 -0.2423388 -1.5787014
38 0.3546543 -0.2423388
39 2.2630838 0.3546543
40 2.7548909 2.2630838
41 3.1710727 2.7548909
42 3.6659637 3.1710727
43 5.3183839 3.6659637
44 -5.6822111 5.3183839
45 -4.8408374 -5.6822111
46 -3.5972966 -4.8408374
47 -1.8604720 -3.5972966
48 -1.2208114 -1.8604720
49 0.6743639 -1.2208114
50 1.0737601 0.6743639
51 0.9086123 1.0737601
52 2.4026988 0.9086123
53 3.3483506 2.4026988
54 4.1323807 3.3483506
55 5.9612638 4.1323807
56 -5.6773148 5.9612638
57 -4.7493867 -5.6773148
58 -2.5095344 -4.7493867
59 -1.9025973 -2.5095344
60 -0.6246765 -1.9025973
61 -0.7708477 -0.6246765
62 0.2542935 -0.7708477
63 0.9797611 0.2542935
64 2.7145431 0.9797611
65 3.7989566 2.7145431
> 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/rcomp/tmp/744gq1322149602.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/rcomp/tmp/8dd8n1322149602.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/rcomp/tmp/90fcp1322149602.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/rcomp/tmp/10plcy1322149602.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/rcomp/tmp/11vdu81322149602.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/rcomp/tmp/12qi8k1322149602.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/rcomp/tmp/13yyo71322149603.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/rcomp/tmp/1425q61322149603.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/rcomp/tmp/15a6wn1322149603.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/rcomp/tmp/16k5bl1322149603.tab")
+ }
>
> try(system("convert tmp/1am6p1322149602.ps tmp/1am6p1322149602.png",intern=TRUE))
character(0)
> try(system("convert tmp/2oa8n1322149602.ps tmp/2oa8n1322149602.png",intern=TRUE))
character(0)
> try(system("convert tmp/39a0v1322149602.ps tmp/39a0v1322149602.png",intern=TRUE))
character(0)
> try(system("convert tmp/4cdoz1322149602.ps tmp/4cdoz1322149602.png",intern=TRUE))
character(0)
> try(system("convert tmp/5ufq31322149602.ps tmp/5ufq31322149602.png",intern=TRUE))
character(0)
> try(system("convert tmp/693hi1322149602.ps tmp/693hi1322149602.png",intern=TRUE))
character(0)
> try(system("convert tmp/744gq1322149602.ps tmp/744gq1322149602.png",intern=TRUE))
character(0)
> try(system("convert tmp/8dd8n1322149602.ps tmp/8dd8n1322149602.png",intern=TRUE))
character(0)
> try(system("convert tmp/90fcp1322149602.ps tmp/90fcp1322149602.png",intern=TRUE))
character(0)
> try(system("convert tmp/10plcy1322149602.ps tmp/10plcy1322149602.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.828 0.676 5.488