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(7357
+ ,4922
+ ,7862
+ ,8031
+ ,6820
+ ,7291
+ ,7213
+ ,4879
+ ,7357
+ ,7862
+ ,8031
+ ,6820
+ ,7079
+ ,4853
+ ,7213
+ ,7357
+ ,7862
+ ,8031
+ ,7012
+ ,4545
+ ,7079
+ ,7213
+ ,7357
+ ,7862
+ ,7319
+ ,4733
+ ,7012
+ ,7079
+ ,7213
+ ,7357
+ ,8148
+ ,5191
+ ,7319
+ ,7012
+ ,7079
+ ,7213
+ ,7599
+ ,4983
+ ,8148
+ ,7319
+ ,7012
+ ,7079
+ ,6908
+ ,4593
+ ,7599
+ ,8148
+ ,7319
+ ,7012
+ ,7878
+ ,4656
+ ,6908
+ ,7599
+ ,8148
+ ,7319
+ ,7407
+ ,4513
+ ,7878
+ ,6908
+ ,7599
+ ,8148
+ ,7911
+ ,4857
+ ,7407
+ ,7878
+ ,6908
+ ,7599
+ ,7323
+ ,4681
+ ,7911
+ ,7407
+ ,7878
+ ,6908
+ ,7179
+ ,4897
+ ,7323
+ ,7911
+ ,7407
+ ,7878
+ ,6758
+ ,4547
+ ,7179
+ ,7323
+ ,7911
+ ,7407
+ ,6934
+ ,4692
+ ,6758
+ ,7179
+ ,7323
+ ,7911
+ ,6696
+ ,4390
+ ,6934
+ ,6758
+ ,7179
+ ,7323
+ ,7688
+ ,5341
+ ,6696
+ ,6934
+ ,6758
+ ,7179
+ ,8296
+ ,5415
+ ,7688
+ ,6696
+ ,6934
+ ,6758
+ ,7697
+ ,4890
+ ,8296
+ ,7688
+ ,6696
+ ,6934
+ ,7907
+ ,5120
+ ,7697
+ ,8296
+ ,7688
+ ,6696
+ ,7592
+ ,4422
+ ,7907
+ ,7697
+ ,8296
+ ,7688
+ ,7710
+ ,4797
+ ,7592
+ ,7907
+ ,7697
+ ,8296
+ ,9011
+ ,5689
+ ,7710
+ ,7592
+ ,7907
+ ,7697
+ ,8225
+ ,5171
+ ,9011
+ ,7710
+ ,7592
+ ,7907
+ ,7733
+ ,4265
+ ,8225
+ ,9011
+ ,7710
+ ,7592
+ ,8062
+ ,5215
+ ,7733
+ ,8225
+ ,9011
+ ,7710
+ ,7859
+ ,4874
+ ,8062
+ ,7733
+ ,8225
+ ,9011
+ ,8221
+ ,4590
+ ,7859
+ ,8062
+ ,7733
+ ,8225
+ ,8330
+ ,4994
+ ,8221
+ ,7859
+ ,8062
+ ,7733
+ ,8868
+ ,4988
+ ,8330
+ ,8221
+ ,7859
+ ,8062
+ ,9053
+ ,5110
+ ,8868
+ ,8330
+ ,8221
+ ,7859
+ ,8811
+ ,5141
+ ,9053
+ ,8868
+ ,8330
+ ,8221
+ ,8120
+ ,4395
+ ,8811
+ ,9053
+ ,8868
+ ,8330
+ ,7953
+ ,4523
+ ,8120
+ ,8811
+ ,9053
+ ,8868
+ ,8878
+ ,5306
+ ,7953
+ ,8120
+ ,8811
+ ,9053
+ ,8601
+ ,5365
+ ,8878
+ ,7953
+ ,8120
+ ,8811
+ ,8361
+ ,5496
+ ,8601
+ ,8878
+ ,7953
+ ,8120
+ ,9116
+ ,5647
+ ,8361
+ ,8601
+ ,8878
+ ,7953
+ ,9310
+ ,5443
+ ,9116
+ ,8361
+ ,8601
+ ,8878
+ ,9891
+ ,5546
+ ,9310
+ ,9116
+ ,8361
+ ,8601
+ ,10147
+ ,5912
+ ,9891
+ ,9310
+ ,9116
+ ,8361
+ ,10317
+ ,5665
+ ,10147
+ ,9891
+ ,9310
+ ,9116
+ ,10682
+ ,5963
+ ,10317
+ ,10147
+ ,9891
+ ,9310
+ ,10276
+ ,5861
+ ,10682
+ ,10317
+ ,10147
+ ,9891
+ ,10614
+ ,5366
+ ,10276
+ ,10682
+ ,10317
+ ,10147
+ ,9413
+ ,5619
+ ,10614
+ ,10276
+ ,10682
+ ,10317
+ ,11068
+ ,6721
+ ,9413
+ ,10614
+ ,10276
+ ,10682
+ ,9772
+ ,6054
+ ,11068
+ ,9413
+ ,10614
+ ,10276
+ ,10350
+ ,6619
+ ,9772
+ ,11068
+ ,9413
+ ,10614
+ ,10541
+ ,6856
+ ,10350
+ ,9772
+ ,11068
+ ,9413
+ ,10049
+ ,6193
+ ,10541
+ ,10350
+ ,9772
+ ,11068
+ ,10714
+ ,6317
+ ,10049
+ ,10541
+ ,10350
+ ,9772
+ ,10759
+ ,6618
+ ,10714
+ ,10049
+ ,10541
+ ,10350
+ ,11684
+ ,6585
+ ,10759
+ ,10714
+ ,10049
+ ,10541
+ ,11462
+ ,6852
+ ,11684
+ ,10759
+ ,10714
+ ,10049
+ ,10485
+ ,6586
+ ,11462
+ ,11684
+ ,10759
+ ,10714
+ ,11056
+ ,6154
+ ,10485
+ ,11462
+ ,11684
+ ,10759
+ ,10184
+ ,6193
+ ,11056
+ ,10485
+ ,11462
+ ,11684
+ ,11082
+ ,7606
+ ,10184
+ ,11056
+ ,10485
+ ,11462
+ ,10554
+ ,6588
+ ,11082
+ ,10184
+ ,11056
+ ,10485
+ ,11315
+ ,7143
+ ,10554
+ ,11082
+ ,10184
+ ,11056
+ ,10847
+ ,7629
+ ,11315
+ ,10554
+ ,11082
+ ,10184
+ ,11104
+ ,7041
+ ,10847
+ ,11315
+ ,10554
+ ,11082
+ ,11026
+ ,7146
+ ,11104
+ ,10847
+ ,11315
+ ,10554
+ ,11073
+ ,7200
+ ,11026
+ ,11104
+ ,10847
+ ,11315
+ ,12073
+ ,7739
+ ,11073
+ ,11026
+ ,11104
+ ,10847
+ ,12328
+ ,7953
+ ,12073
+ ,11073
+ ,11026
+ ,11104
+ ,11172
+ ,7082
+ ,12328
+ ,12073
+ ,11073
+ ,11026)
+ ,dim=c(6
+ ,68)
+ ,dimnames=list(c('UitEu'
+ ,'UitnietEU'
+ ,'Y1'
+ ,'Y2'
+ ,'Y3'
+ ,'Y4')
+ ,1:68))
> y <- array(NA,dim=c(6,68),dimnames=list(c('UitEu','UitnietEU','Y1','Y2','Y3','Y4'),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 = '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
UitEu UitnietEU Y1 Y2 Y3 Y4 M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 7357 4922 7862 8031 6820 7291 1 0 0 0 0 0 0 0 0 0 0
2 7213 4879 7357 7862 8031 6820 0 1 0 0 0 0 0 0 0 0 0
3 7079 4853 7213 7357 7862 8031 0 0 1 0 0 0 0 0 0 0 0
4 7012 4545 7079 7213 7357 7862 0 0 0 1 0 0 0 0 0 0 0
5 7319 4733 7012 7079 7213 7357 0 0 0 0 1 0 0 0 0 0 0
6 8148 5191 7319 7012 7079 7213 0 0 0 0 0 1 0 0 0 0 0
7 7599 4983 8148 7319 7012 7079 0 0 0 0 0 0 1 0 0 0 0
8 6908 4593 7599 8148 7319 7012 0 0 0 0 0 0 0 1 0 0 0
9 7878 4656 6908 7599 8148 7319 0 0 0 0 0 0 0 0 1 0 0
10 7407 4513 7878 6908 7599 8148 0 0 0 0 0 0 0 0 0 1 0
11 7911 4857 7407 7878 6908 7599 0 0 0 0 0 0 0 0 0 0 1
12 7323 4681 7911 7407 7878 6908 0 0 0 0 0 0 0 0 0 0 0
13 7179 4897 7323 7911 7407 7878 1 0 0 0 0 0 0 0 0 0 0
14 6758 4547 7179 7323 7911 7407 0 1 0 0 0 0 0 0 0 0 0
15 6934 4692 6758 7179 7323 7911 0 0 1 0 0 0 0 0 0 0 0
16 6696 4390 6934 6758 7179 7323 0 0 0 1 0 0 0 0 0 0 0
17 7688 5341 6696 6934 6758 7179 0 0 0 0 1 0 0 0 0 0 0
18 8296 5415 7688 6696 6934 6758 0 0 0 0 0 1 0 0 0 0 0
19 7697 4890 8296 7688 6696 6934 0 0 0 0 0 0 1 0 0 0 0
20 7907 5120 7697 8296 7688 6696 0 0 0 0 0 0 0 1 0 0 0
21 7592 4422 7907 7697 8296 7688 0 0 0 0 0 0 0 0 1 0 0
22 7710 4797 7592 7907 7697 8296 0 0 0 0 0 0 0 0 0 1 0
23 9011 5689 7710 7592 7907 7697 0 0 0 0 0 0 0 0 0 0 1
24 8225 5171 9011 7710 7592 7907 0 0 0 0 0 0 0 0 0 0 0
25 7733 4265 8225 9011 7710 7592 1 0 0 0 0 0 0 0 0 0 0
26 8062 5215 7733 8225 9011 7710 0 1 0 0 0 0 0 0 0 0 0
27 7859 4874 8062 7733 8225 9011 0 0 1 0 0 0 0 0 0 0 0
28 8221 4590 7859 8062 7733 8225 0 0 0 1 0 0 0 0 0 0 0
29 8330 4994 8221 7859 8062 7733 0 0 0 0 1 0 0 0 0 0 0
30 8868 4988 8330 8221 7859 8062 0 0 0 0 0 1 0 0 0 0 0
31 9053 5110 8868 8330 8221 7859 0 0 0 0 0 0 1 0 0 0 0
32 8811 5141 9053 8868 8330 8221 0 0 0 0 0 0 0 1 0 0 0
33 8120 4395 8811 9053 8868 8330 0 0 0 0 0 0 0 0 1 0 0
34 7953 4523 8120 8811 9053 8868 0 0 0 0 0 0 0 0 0 1 0
35 8878 5306 7953 8120 8811 9053 0 0 0 0 0 0 0 0 0 0 1
36 8601 5365 8878 7953 8120 8811 0 0 0 0 0 0 0 0 0 0 0
37 8361 5496 8601 8878 7953 8120 1 0 0 0 0 0 0 0 0 0 0
38 9116 5647 8361 8601 8878 7953 0 1 0 0 0 0 0 0 0 0 0
39 9310 5443 9116 8361 8601 8878 0 0 1 0 0 0 0 0 0 0 0
40 9891 5546 9310 9116 8361 8601 0 0 0 1 0 0 0 0 0 0 0
41 10147 5912 9891 9310 9116 8361 0 0 0 0 1 0 0 0 0 0 0
42 10317 5665 10147 9891 9310 9116 0 0 0 0 0 1 0 0 0 0 0
43 10682 5963 10317 10147 9891 9310 0 0 0 0 0 0 1 0 0 0 0
44 10276 5861 10682 10317 10147 9891 0 0 0 0 0 0 0 1 0 0 0
45 10614 5366 10276 10682 10317 10147 0 0 0 0 0 0 0 0 1 0 0
46 9413 5619 10614 10276 10682 10317 0 0 0 0 0 0 0 0 0 1 0
47 11068 6721 9413 10614 10276 10682 0 0 0 0 0 0 0 0 0 0 1
48 9772 6054 11068 9413 10614 10276 0 0 0 0 0 0 0 0 0 0 0
49 10350 6619 9772 11068 9413 10614 1 0 0 0 0 0 0 0 0 0 0
50 10541 6856 10350 9772 11068 9413 0 1 0 0 0 0 0 0 0 0 0
51 10049 6193 10541 10350 9772 11068 0 0 1 0 0 0 0 0 0 0 0
52 10714 6317 10049 10541 10350 9772 0 0 0 1 0 0 0 0 0 0 0
53 10759 6618 10714 10049 10541 10350 0 0 0 0 1 0 0 0 0 0 0
54 11684 6585 10759 10714 10049 10541 0 0 0 0 0 1 0 0 0 0 0
55 11462 6852 11684 10759 10714 10049 0 0 0 0 0 0 1 0 0 0 0
56 10485 6586 11462 11684 10759 10714 0 0 0 0 0 0 0 1 0 0 0
57 11056 6154 10485 11462 11684 10759 0 0 0 0 0 0 0 0 1 0 0
58 10184 6193 11056 10485 11462 11684 0 0 0 0 0 0 0 0 0 1 0
59 11082 7606 10184 11056 10485 11462 0 0 0 0 0 0 0 0 0 0 1
60 10554 6588 11082 10184 11056 10485 0 0 0 0 0 0 0 0 0 0 0
61 11315 7143 10554 11082 10184 11056 1 0 0 0 0 0 0 0 0 0 0
62 10847 7629 11315 10554 11082 10184 0 1 0 0 0 0 0 0 0 0 0
63 11104 7041 10847 11315 10554 11082 0 0 1 0 0 0 0 0 0 0 0
64 11026 7146 11104 10847 11315 10554 0 0 0 1 0 0 0 0 0 0 0
65 11073 7200 11026 11104 10847 11315 0 0 0 0 1 0 0 0 0 0 0
66 12073 7739 11073 11026 11104 10847 0 0 0 0 0 1 0 0 0 0 0
67 12328 7953 12073 11073 11026 11104 0 0 0 0 0 0 1 0 0 0 0
68 11172 7082 12328 12073 11073 11026 0 0 0 0 0 0 0 1 0 0 0
t
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
19 19
20 20
21 21
22 22
23 23
24 24
25 25
26 26
27 27
28 28
29 29
30 30
31 31
32 32
33 33
34 34
35 35
36 36
37 37
38 38
39 39
40 40
41 41
42 42
43 43
44 44
45 45
46 46
47 47
48 48
49 49
50 50
51 51
52 52
53 53
54 54
55 55
56 56
57 57
58 58
59 59
60 60
61 61
62 62
63 63
64 64
65 65
66 66
67 67
68 68
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) UitnietEU Y1 Y2 Y3 Y4
1328.02804 0.46261 0.24707 0.26469 0.07355 -0.11662
M1 M2 M3 M4 M5 M6
-22.19766 -89.16698 148.94281 303.47595 355.97006 834.30959
M7 M8 M9 M10 M11 t
442.88757 -169.60136 423.02506 -24.18380 686.38861 20.29782
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-588.10 -190.12 -15.64 206.13 556.83
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1328.02804 702.75499 1.890 0.064597 .
UitnietEU 0.46261 0.12393 3.733 0.000485 ***
Y1 0.24707 0.12129 2.037 0.046963 *
Y2 0.26469 0.12811 2.066 0.044009 *
Y3 0.07355 0.12818 0.574 0.568660
Y4 -0.11662 0.12241 -0.953 0.345328
M1 -22.19766 285.23234 -0.078 0.938279
M2 -89.16698 257.74329 -0.346 0.730830
M3 148.94281 241.97191 0.616 0.540992
M4 303.47595 232.90697 1.303 0.198546
M5 355.97006 228.06213 1.561 0.124868
M6 834.30959 230.77666 3.615 0.000697 ***
M7 442.88757 230.40484 1.922 0.060286 .
M8 -169.60136 257.00661 -0.660 0.512340
M9 423.02506 271.98709 1.555 0.126179
M10 -24.18380 247.64333 -0.098 0.922596
M11 686.38861 281.16759 2.441 0.018221 *
t 20.29782 7.61355 2.666 0.010311 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 335.9 on 50 degrees of freedom
Multiple R-squared: 0.9662, Adjusted R-squared: 0.9547
F-statistic: 84.11 on 17 and 50 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.13963597 0.27927194 0.8603640
[2,] 0.09266349 0.18532699 0.9073365
[3,] 0.04078494 0.08156987 0.9592151
[4,] 0.02834268 0.05668536 0.9716573
[5,] 0.06022434 0.12044869 0.9397757
[6,] 0.03342001 0.06684003 0.9665800
[7,] 0.02333365 0.04666730 0.9766664
[8,] 0.03140907 0.06281813 0.9685909
[9,] 0.02352754 0.04705509 0.9764725
[10,] 0.01566904 0.03133808 0.9843310
[11,] 0.01651836 0.03303672 0.9834816
[12,] 0.01031941 0.02063881 0.9896806
[13,] 0.08965377 0.17930755 0.9103462
[14,] 0.10729634 0.21459269 0.8927037
[15,] 0.08363718 0.16727437 0.9163628
[16,] 0.05591646 0.11183293 0.9440835
[17,] 0.29225112 0.58450225 0.7077489
[18,] 0.28438644 0.56877288 0.7156136
[19,] 0.32493323 0.64986647 0.6750668
[20,] 0.23651050 0.47302100 0.7634895
[21,] 0.20092613 0.40185225 0.7990739
[22,] 0.34167781 0.68335562 0.6583222
[23,] 0.55813621 0.88372757 0.4418638
[24,] 0.44582317 0.89164634 0.5541768
[25,] 0.34889392 0.69778784 0.6511061
[26,] 0.43267957 0.86535915 0.5673204
[27,] 0.48120457 0.96240913 0.5187954
> postscript(file="/var/www/html/rcomp/tmp/1z9u01258565350.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/2y5te1258565350.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/3x7511258565350.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/4grxx1258565350.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/5gfw71258565350.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 = 68
Frequency = 1
1 2 3 4 5 6
34.310797 -17.617176 -75.098522 -85.786394 65.173120 118.605534
7 8 9 10 11 12
-259.825795 -292.396880 326.402768 428.765768 -110.824319 -103.090731
13 14 15 16 17 18
-185.485179 -298.676504 -204.010041 -467.158580 38.491582 -130.514859
19 20 21 22 23 24
-490.281464 91.853817 -335.535597 173.094798 299.498219 114.210199
25 26 27 28 29 30
-152.341857 31.523718 -13.662975 212.487145 -55.480199 -82.793951
31 32 33 34 35 36
204.818637 386.754199 -588.095692 -103.486906 -8.048703 192.014697
37 38 39 40 41 42
-351.388215 425.536281 460.733258 556.828624 292.304371 -65.327356
43 44 45 46 47 48
403.065459 550.189879 525.307287 -348.888751 345.129550 -139.425446
49 50 51 52 53 54
188.982691 255.469581 -100.088007 210.073598 62.317653 375.268286
55 56 57 58 59 60
54.138868 -323.366173 71.921234 -149.484909 -525.754748 -63.708719
61 62 63 64 65 66
465.921763 -396.235900 -67.873714 -426.444394 -402.806527 -215.237653
67 68
88.084294 -413.034842
> postscript(file="/var/www/html/rcomp/tmp/65bqh1258565350.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 = 68
Frequency = 1
lag(myerror, k = 1) myerror
0 34.310797 NA
1 -17.617176 34.310797
2 -75.098522 -17.617176
3 -85.786394 -75.098522
4 65.173120 -85.786394
5 118.605534 65.173120
6 -259.825795 118.605534
7 -292.396880 -259.825795
8 326.402768 -292.396880
9 428.765768 326.402768
10 -110.824319 428.765768
11 -103.090731 -110.824319
12 -185.485179 -103.090731
13 -298.676504 -185.485179
14 -204.010041 -298.676504
15 -467.158580 -204.010041
16 38.491582 -467.158580
17 -130.514859 38.491582
18 -490.281464 -130.514859
19 91.853817 -490.281464
20 -335.535597 91.853817
21 173.094798 -335.535597
22 299.498219 173.094798
23 114.210199 299.498219
24 -152.341857 114.210199
25 31.523718 -152.341857
26 -13.662975 31.523718
27 212.487145 -13.662975
28 -55.480199 212.487145
29 -82.793951 -55.480199
30 204.818637 -82.793951
31 386.754199 204.818637
32 -588.095692 386.754199
33 -103.486906 -588.095692
34 -8.048703 -103.486906
35 192.014697 -8.048703
36 -351.388215 192.014697
37 425.536281 -351.388215
38 460.733258 425.536281
39 556.828624 460.733258
40 292.304371 556.828624
41 -65.327356 292.304371
42 403.065459 -65.327356
43 550.189879 403.065459
44 525.307287 550.189879
45 -348.888751 525.307287
46 345.129550 -348.888751
47 -139.425446 345.129550
48 188.982691 -139.425446
49 255.469581 188.982691
50 -100.088007 255.469581
51 210.073598 -100.088007
52 62.317653 210.073598
53 375.268286 62.317653
54 54.138868 375.268286
55 -323.366173 54.138868
56 71.921234 -323.366173
57 -149.484909 71.921234
58 -525.754748 -149.484909
59 -63.708719 -525.754748
60 465.921763 -63.708719
61 -396.235900 465.921763
62 -67.873714 -396.235900
63 -426.444394 -67.873714
64 -402.806527 -426.444394
65 -215.237653 -402.806527
66 88.084294 -215.237653
67 -413.034842 88.084294
68 NA -413.034842
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -17.617176 34.310797
[2,] -75.098522 -17.617176
[3,] -85.786394 -75.098522
[4,] 65.173120 -85.786394
[5,] 118.605534 65.173120
[6,] -259.825795 118.605534
[7,] -292.396880 -259.825795
[8,] 326.402768 -292.396880
[9,] 428.765768 326.402768
[10,] -110.824319 428.765768
[11,] -103.090731 -110.824319
[12,] -185.485179 -103.090731
[13,] -298.676504 -185.485179
[14,] -204.010041 -298.676504
[15,] -467.158580 -204.010041
[16,] 38.491582 -467.158580
[17,] -130.514859 38.491582
[18,] -490.281464 -130.514859
[19,] 91.853817 -490.281464
[20,] -335.535597 91.853817
[21,] 173.094798 -335.535597
[22,] 299.498219 173.094798
[23,] 114.210199 299.498219
[24,] -152.341857 114.210199
[25,] 31.523718 -152.341857
[26,] -13.662975 31.523718
[27,] 212.487145 -13.662975
[28,] -55.480199 212.487145
[29,] -82.793951 -55.480199
[30,] 204.818637 -82.793951
[31,] 386.754199 204.818637
[32,] -588.095692 386.754199
[33,] -103.486906 -588.095692
[34,] -8.048703 -103.486906
[35,] 192.014697 -8.048703
[36,] -351.388215 192.014697
[37,] 425.536281 -351.388215
[38,] 460.733258 425.536281
[39,] 556.828624 460.733258
[40,] 292.304371 556.828624
[41,] -65.327356 292.304371
[42,] 403.065459 -65.327356
[43,] 550.189879 403.065459
[44,] 525.307287 550.189879
[45,] -348.888751 525.307287
[46,] 345.129550 -348.888751
[47,] -139.425446 345.129550
[48,] 188.982691 -139.425446
[49,] 255.469581 188.982691
[50,] -100.088007 255.469581
[51,] 210.073598 -100.088007
[52,] 62.317653 210.073598
[53,] 375.268286 62.317653
[54,] 54.138868 375.268286
[55,] -323.366173 54.138868
[56,] 71.921234 -323.366173
[57,] -149.484909 71.921234
[58,] -525.754748 -149.484909
[59,] -63.708719 -525.754748
[60,] 465.921763 -63.708719
[61,] -396.235900 465.921763
[62,] -67.873714 -396.235900
[63,] -426.444394 -67.873714
[64,] -402.806527 -426.444394
[65,] -215.237653 -402.806527
[66,] 88.084294 -215.237653
[67,] -413.034842 88.084294
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -17.617176 34.310797
2 -75.098522 -17.617176
3 -85.786394 -75.098522
4 65.173120 -85.786394
5 118.605534 65.173120
6 -259.825795 118.605534
7 -292.396880 -259.825795
8 326.402768 -292.396880
9 428.765768 326.402768
10 -110.824319 428.765768
11 -103.090731 -110.824319
12 -185.485179 -103.090731
13 -298.676504 -185.485179
14 -204.010041 -298.676504
15 -467.158580 -204.010041
16 38.491582 -467.158580
17 -130.514859 38.491582
18 -490.281464 -130.514859
19 91.853817 -490.281464
20 -335.535597 91.853817
21 173.094798 -335.535597
22 299.498219 173.094798
23 114.210199 299.498219
24 -152.341857 114.210199
25 31.523718 -152.341857
26 -13.662975 31.523718
27 212.487145 -13.662975
28 -55.480199 212.487145
29 -82.793951 -55.480199
30 204.818637 -82.793951
31 386.754199 204.818637
32 -588.095692 386.754199
33 -103.486906 -588.095692
34 -8.048703 -103.486906
35 192.014697 -8.048703
36 -351.388215 192.014697
37 425.536281 -351.388215
38 460.733258 425.536281
39 556.828624 460.733258
40 292.304371 556.828624
41 -65.327356 292.304371
42 403.065459 -65.327356
43 550.189879 403.065459
44 525.307287 550.189879
45 -348.888751 525.307287
46 345.129550 -348.888751
47 -139.425446 345.129550
48 188.982691 -139.425446
49 255.469581 188.982691
50 -100.088007 255.469581
51 210.073598 -100.088007
52 62.317653 210.073598
53 375.268286 62.317653
54 54.138868 375.268286
55 -323.366173 54.138868
56 71.921234 -323.366173
57 -149.484909 71.921234
58 -525.754748 -149.484909
59 -63.708719 -525.754748
60 465.921763 -63.708719
61 -396.235900 465.921763
62 -67.873714 -396.235900
63 -426.444394 -67.873714
64 -402.806527 -426.444394
65 -215.237653 -402.806527
66 88.084294 -215.237653
67 -413.034842 88.084294
> 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/74ejw1258565350.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/8nyts1258565350.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/9h2g41258565350.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/10limf1258565350.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/111otz1258565350.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/12nzxx1258565350.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/13c1181258565350.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/1492041258565350.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/15tefp1258565350.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/16ex3i1258565350.tab")
+ }
>
> system("convert tmp/1z9u01258565350.ps tmp/1z9u01258565350.png")
> system("convert tmp/2y5te1258565350.ps tmp/2y5te1258565350.png")
> system("convert tmp/3x7511258565350.ps tmp/3x7511258565350.png")
> system("convert tmp/4grxx1258565350.ps tmp/4grxx1258565350.png")
> system("convert tmp/5gfw71258565350.ps tmp/5gfw71258565350.png")
> system("convert tmp/65bqh1258565350.ps tmp/65bqh1258565350.png")
> system("convert tmp/74ejw1258565350.ps tmp/74ejw1258565350.png")
> system("convert tmp/8nyts1258565350.ps tmp/8nyts1258565350.png")
> system("convert tmp/9h2g41258565350.ps tmp/9h2g41258565350.png")
> system("convert tmp/10limf1258565350.ps tmp/10limf1258565350.png")
>
>
> proc.time()
user system elapsed
2.555 1.647 3.006