R version 2.7.0 (2008-04-22)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
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(0.9059,0,0.8883,1,0.8924,1,0.8833,0,0.8700,0,0.8758,1,0.8858,1,0.9170,1,0.9554,1,0.9922,1,0.9778,1,0.9808,1,0.9811,1,1.0014,1,1.0183,1,1.0622,1,1.0773,1,1.0807,1,1.0848,1,1.1582,1,1.1663,1,1.1372,1,1.1139,1,1.1222,1,1.1692,1,1.1702,1,1.2286,1,1.2613,1,1.2646,1,1.2262,1,1.1985,0,1.2007,1,1.2138,1,1.2266,1,1.2176,0,1.2218,1,1.2490,1,1.2991,1,1.3408,1,1.3119,0,1.3014,0,1.3201,1,1.2938,0,1.2694,0,1.2165,0,1.2037,0,1.2292,1,1.2256,0,1.2015,0,1.1786,0,1.1856,1,1.2103,1,1.1938,0,1.2020,1,1.2271,1,1.2770,1,1.2650,0,1.2684,1,1.2811,1,1.2727,0,1.2611,0,1.2881,1,1.3213,1,1.2999,0,1.3074,1,1.3242,1,1.3516,1,1.3511,0,1.3419,0,1.3716,1,1.3622,0,1.3896,1,1.4227,1,1.4684,1),dim=c(2,74),dimnames=list(c('y','x'),1:74))
> y <- array(NA,dim=c(2,74),dimnames=list(c('y','x'),1:74))
> 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
y x M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 0.9059 0 1 0 0 0 0 0 0 0 0 0 0 1
2 0.8883 1 0 1 0 0 0 0 0 0 0 0 0 2
3 0.8924 1 0 0 1 0 0 0 0 0 0 0 0 3
4 0.8833 0 0 0 0 1 0 0 0 0 0 0 0 4
5 0.8700 0 0 0 0 0 1 0 0 0 0 0 0 5
6 0.8758 1 0 0 0 0 0 1 0 0 0 0 0 6
7 0.8858 1 0 0 0 0 0 0 1 0 0 0 0 7
8 0.9170 1 0 0 0 0 0 0 0 1 0 0 0 8
9 0.9554 1 0 0 0 0 0 0 0 0 1 0 0 9
10 0.9922 1 0 0 0 0 0 0 0 0 0 1 0 10
11 0.9778 1 0 0 0 0 0 0 0 0 0 0 1 11
12 0.9808 1 0 0 0 0 0 0 0 0 0 0 0 12
13 0.9811 1 1 0 0 0 0 0 0 0 0 0 0 13
14 1.0014 1 0 1 0 0 0 0 0 0 0 0 0 14
15 1.0183 1 0 0 1 0 0 0 0 0 0 0 0 15
16 1.0622 1 0 0 0 1 0 0 0 0 0 0 0 16
17 1.0773 1 0 0 0 0 1 0 0 0 0 0 0 17
18 1.0807 1 0 0 0 0 0 1 0 0 0 0 0 18
19 1.0848 1 0 0 0 0 0 0 1 0 0 0 0 19
20 1.1582 1 0 0 0 0 0 0 0 1 0 0 0 20
21 1.1663 1 0 0 0 0 0 0 0 0 1 0 0 21
22 1.1372 1 0 0 0 0 0 0 0 0 0 1 0 22
23 1.1139 1 0 0 0 0 0 0 0 0 0 0 1 23
24 1.1222 1 0 0 0 0 0 0 0 0 0 0 0 24
25 1.1692 1 1 0 0 0 0 0 0 0 0 0 0 25
26 1.1702 1 0 1 0 0 0 0 0 0 0 0 0 26
27 1.2286 1 0 0 1 0 0 0 0 0 0 0 0 27
28 1.2613 1 0 0 0 1 0 0 0 0 0 0 0 28
29 1.2646 1 0 0 0 0 1 0 0 0 0 0 0 29
30 1.2262 1 0 0 0 0 0 1 0 0 0 0 0 30
31 1.1985 0 0 0 0 0 0 0 1 0 0 0 0 31
32 1.2007 1 0 0 0 0 0 0 0 1 0 0 0 32
33 1.2138 1 0 0 0 0 0 0 0 0 1 0 0 33
34 1.2266 1 0 0 0 0 0 0 0 0 0 1 0 34
35 1.2176 0 0 0 0 0 0 0 0 0 0 0 1 35
36 1.2218 1 0 0 0 0 0 0 0 0 0 0 0 36
37 1.2490 1 1 0 0 0 0 0 0 0 0 0 0 37
38 1.2991 1 0 1 0 0 0 0 0 0 0 0 0 38
39 1.3408 1 0 0 1 0 0 0 0 0 0 0 0 39
40 1.3119 0 0 0 0 1 0 0 0 0 0 0 0 40
41 1.3014 0 0 0 0 0 1 0 0 0 0 0 0 41
42 1.3201 1 0 0 0 0 0 1 0 0 0 0 0 42
43 1.2938 0 0 0 0 0 0 0 1 0 0 0 0 43
44 1.2694 0 0 0 0 0 0 0 0 1 0 0 0 44
45 1.2165 0 0 0 0 0 0 0 0 0 1 0 0 45
46 1.2037 0 0 0 0 0 0 0 0 0 0 1 0 46
47 1.2292 1 0 0 0 0 0 0 0 0 0 0 1 47
48 1.2256 0 0 0 0 0 0 0 0 0 0 0 0 48
49 1.2015 0 1 0 0 0 0 0 0 0 0 0 0 49
50 1.1786 0 0 1 0 0 0 0 0 0 0 0 0 50
51 1.1856 1 0 0 1 0 0 0 0 0 0 0 0 51
52 1.2103 1 0 0 0 1 0 0 0 0 0 0 0 52
53 1.1938 0 0 0 0 0 1 0 0 0 0 0 0 53
54 1.2020 1 0 0 0 0 0 1 0 0 0 0 0 54
55 1.2271 1 0 0 0 0 0 0 1 0 0 0 0 55
56 1.2770 1 0 0 0 0 0 0 0 1 0 0 0 56
57 1.2650 0 0 0 0 0 0 0 0 0 1 0 0 57
58 1.2684 1 0 0 0 0 0 0 0 0 0 1 0 58
59 1.2811 1 0 0 0 0 0 0 0 0 0 0 1 59
60 1.2727 0 0 0 0 0 0 0 0 0 0 0 0 60
61 1.2611 0 1 0 0 0 0 0 0 0 0 0 0 61
62 1.2881 1 0 1 0 0 0 0 0 0 0 0 0 62
63 1.3213 1 0 0 1 0 0 0 0 0 0 0 0 63
64 1.2999 0 0 0 0 1 0 0 0 0 0 0 0 64
65 1.3074 1 0 0 0 0 1 0 0 0 0 0 0 65
66 1.3242 1 0 0 0 0 0 1 0 0 0 0 0 66
67 1.3516 1 0 0 0 0 0 0 1 0 0 0 0 67
68 1.3511 0 0 0 0 0 0 0 0 1 0 0 0 68
69 1.3419 0 0 0 0 0 0 0 0 0 1 0 0 69
70 1.3716 1 0 0 0 0 0 0 0 0 0 1 0 70
71 1.3622 0 0 0 0 0 0 0 0 0 0 0 1 71
72 1.3896 1 0 0 0 0 0 0 0 0 0 0 0 72
73 1.4227 1 1 0 0 0 0 0 0 0 0 0 0 73
74 1.4684 1 0 1 0 0 0 0 0 0 0 0 0 74
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) x M1 M2 M3 M4
0.915412 0.030048 0.002563 0.002429 0.009511 0.025169
M5 M6 M7 M8 M9 M10
0.016420 -0.002537 0.003230 0.018847 0.015089 0.005524
M11 t
0.001199 0.006349
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.10734 -0.04633 -0.01540 0.05449 0.13820
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.9154120 0.0381934 23.968 <2e-16 ***
x 0.0300484 0.0204342 1.470 0.147
M1 0.0025632 0.0403261 0.064 0.950
M2 0.0024286 0.0403883 0.060 0.952
M3 0.0095113 0.0422946 0.225 0.823
M4 0.0251695 0.0420497 0.599 0.552
M5 0.0164201 0.0420123 0.391 0.697
M6 -0.0025367 0.0422524 -0.060 0.952
M7 0.0032300 0.0417718 0.077 0.939
M8 0.0188474 0.0417538 0.451 0.653
M9 0.0150894 0.0419020 0.360 0.720
M10 0.0055240 0.0418531 0.132 0.895
M11 0.0011993 0.0417240 0.029 0.977
t 0.0063493 0.0004076 15.576 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.07226 on 60 degrees of freedom
Multiple R-squared: 0.8066, Adjusted R-squared: 0.7647
F-statistic: 19.25 on 13 and 60 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.332099297 0.664198594 0.6679007031
[2,] 0.331692696 0.663385392 0.6683073040
[3,] 0.261981553 0.523963105 0.7380184475
[4,] 0.261575895 0.523151789 0.7384241053
[5,] 0.180573844 0.361147688 0.8194261559
[6,] 0.125520163 0.251040326 0.8744798370
[7,] 0.093928821 0.187857643 0.9060711787
[8,] 0.065775344 0.131550688 0.9342246560
[9,] 0.039834319 0.079668639 0.9601656806
[10,] 0.025192852 0.050385703 0.9748071484
[11,] 0.015416277 0.030832553 0.9845837233
[12,] 0.012581928 0.025163855 0.9874180724
[13,] 0.010171679 0.020343358 0.9898283209
[14,] 0.005365117 0.010730234 0.9946348831
[15,] 0.003499055 0.006998109 0.9965009454
[16,] 0.006684860 0.013369720 0.9933151398
[17,] 0.010670623 0.021341245 0.9893293774
[18,] 0.011171300 0.022342599 0.9888287004
[19,] 0.007050148 0.014100297 0.9929498517
[20,] 0.005472040 0.010944080 0.9945279599
[21,] 0.005928516 0.011857033 0.9940714836
[22,] 0.004089668 0.008179335 0.9959103323
[23,] 0.008049895 0.016099791 0.9919501046
[24,] 0.016442355 0.032884710 0.9835576449
[25,] 0.047693472 0.095386944 0.9523065279
[26,] 0.218374086 0.436748172 0.7816259140
[27,] 0.576026252 0.847947495 0.4239737476
[28,] 0.837422021 0.325155959 0.1625779795
[29,] 0.937655541 0.124688919 0.0623444593
[30,] 0.976509152 0.046981697 0.0234908485
[31,] 0.993615423 0.012769153 0.0063845766
[32,] 0.998562490 0.002875020 0.0014375098
[33,] 0.999402977 0.001194046 0.0005970228
[34,] 0.999081842 0.001836316 0.0009181580
[35,] 0.999376641 0.001246718 0.0006233588
[36,] 0.999123334 0.001753332 0.0008766658
[37,] 0.998479334 0.003041333 0.0015206664
[38,] 0.996089400 0.007821199 0.0039105996
[39,] 0.989146064 0.021707871 0.0108539356
[40,] 0.967898958 0.064202085 0.0321010424
[41,] 0.938083720 0.123832561 0.0619162804
> postscript(file="/var/www/html/rcomp/tmp/1lifg1227377336.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/2eqrx1227377336.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/3cogw1227377336.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/4ceie1227377336.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/5rk601227377336.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 = 74
Frequency = 1
1 2 3 4 5
-0.0184245809 -0.0722877046 -0.0816197094 -0.0826788562 -0.0935788562
6 7 8 9 10
-0.1052197094 -0.1073358338 -0.0981025005 -0.0622938960 -0.0222777716
11 12 13 14 15
-0.0387025005 -0.0408525005 -0.0494650703 -0.0353798208 -0.0319118256
16 17 18 19 20
-0.0100193455 0.0074806545 0.0234881744 0.0154720500 0.0669053833
21 22 23 24 25
0.0724139878 0.0465301122 0.0212053833 0.0243553833 0.0624428135
26 27 28 29 30
0.0572280629 0.1021960581 0.1128885382 0.1185885382 0.0927960581
31 32 33 34 35
0.0830283069 0.0332132671 0.0437218715 0.0597379959 0.0787616402
36 37 38 39 40
0.0477632671 0.0660506972 0.1099359467 0.1382039419 0.1173447951
41 42 43 44 45
0.1092447951 0.1105039419 0.1021361906 0.0557695240 0.0002781285
46 47 48 49 50
-0.0093057472 -0.0158788492 0.0054195240 -0.0275930459 -0.0567077964
51 52 53 54 55
-0.0931881744 -0.0904956943 -0.0745473211 -0.0837881744 -0.0708042987
56 57 58 59 60
-0.0428709654 -0.0274139878 -0.0508462365 -0.0401709654 -0.0236725923
61 62 63 64 65
-0.0441851621 -0.0534482858 -0.0336802906 -0.0470394374 -0.0671878105
66 67 68 69 70
-0.0377802906 -0.0224964150 -0.0149147085 -0.0267061040 -0.0238383528
71 72 73 74
-0.0052147085 -0.0130130816 0.0111743485 0.0506595980
> postscript(file="/var/www/html/rcomp/tmp/6yv541227377336.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 = 74
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.0184245809 NA
1 -0.0722877046 -0.0184245809
2 -0.0816197094 -0.0722877046
3 -0.0826788562 -0.0816197094
4 -0.0935788562 -0.0826788562
5 -0.1052197094 -0.0935788562
6 -0.1073358338 -0.1052197094
7 -0.0981025005 -0.1073358338
8 -0.0622938960 -0.0981025005
9 -0.0222777716 -0.0622938960
10 -0.0387025005 -0.0222777716
11 -0.0408525005 -0.0387025005
12 -0.0494650703 -0.0408525005
13 -0.0353798208 -0.0494650703
14 -0.0319118256 -0.0353798208
15 -0.0100193455 -0.0319118256
16 0.0074806545 -0.0100193455
17 0.0234881744 0.0074806545
18 0.0154720500 0.0234881744
19 0.0669053833 0.0154720500
20 0.0724139878 0.0669053833
21 0.0465301122 0.0724139878
22 0.0212053833 0.0465301122
23 0.0243553833 0.0212053833
24 0.0624428135 0.0243553833
25 0.0572280629 0.0624428135
26 0.1021960581 0.0572280629
27 0.1128885382 0.1021960581
28 0.1185885382 0.1128885382
29 0.0927960581 0.1185885382
30 0.0830283069 0.0927960581
31 0.0332132671 0.0830283069
32 0.0437218715 0.0332132671
33 0.0597379959 0.0437218715
34 0.0787616402 0.0597379959
35 0.0477632671 0.0787616402
36 0.0660506972 0.0477632671
37 0.1099359467 0.0660506972
38 0.1382039419 0.1099359467
39 0.1173447951 0.1382039419
40 0.1092447951 0.1173447951
41 0.1105039419 0.1092447951
42 0.1021361906 0.1105039419
43 0.0557695240 0.1021361906
44 0.0002781285 0.0557695240
45 -0.0093057472 0.0002781285
46 -0.0158788492 -0.0093057472
47 0.0054195240 -0.0158788492
48 -0.0275930459 0.0054195240
49 -0.0567077964 -0.0275930459
50 -0.0931881744 -0.0567077964
51 -0.0904956943 -0.0931881744
52 -0.0745473211 -0.0904956943
53 -0.0837881744 -0.0745473211
54 -0.0708042987 -0.0837881744
55 -0.0428709654 -0.0708042987
56 -0.0274139878 -0.0428709654
57 -0.0508462365 -0.0274139878
58 -0.0401709654 -0.0508462365
59 -0.0236725923 -0.0401709654
60 -0.0441851621 -0.0236725923
61 -0.0534482858 -0.0441851621
62 -0.0336802906 -0.0534482858
63 -0.0470394374 -0.0336802906
64 -0.0671878105 -0.0470394374
65 -0.0377802906 -0.0671878105
66 -0.0224964150 -0.0377802906
67 -0.0149147085 -0.0224964150
68 -0.0267061040 -0.0149147085
69 -0.0238383528 -0.0267061040
70 -0.0052147085 -0.0238383528
71 -0.0130130816 -0.0052147085
72 0.0111743485 -0.0130130816
73 0.0506595980 0.0111743485
74 NA 0.0506595980
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.0722877046 -0.0184245809
[2,] -0.0816197094 -0.0722877046
[3,] -0.0826788562 -0.0816197094
[4,] -0.0935788562 -0.0826788562
[5,] -0.1052197094 -0.0935788562
[6,] -0.1073358338 -0.1052197094
[7,] -0.0981025005 -0.1073358338
[8,] -0.0622938960 -0.0981025005
[9,] -0.0222777716 -0.0622938960
[10,] -0.0387025005 -0.0222777716
[11,] -0.0408525005 -0.0387025005
[12,] -0.0494650703 -0.0408525005
[13,] -0.0353798208 -0.0494650703
[14,] -0.0319118256 -0.0353798208
[15,] -0.0100193455 -0.0319118256
[16,] 0.0074806545 -0.0100193455
[17,] 0.0234881744 0.0074806545
[18,] 0.0154720500 0.0234881744
[19,] 0.0669053833 0.0154720500
[20,] 0.0724139878 0.0669053833
[21,] 0.0465301122 0.0724139878
[22,] 0.0212053833 0.0465301122
[23,] 0.0243553833 0.0212053833
[24,] 0.0624428135 0.0243553833
[25,] 0.0572280629 0.0624428135
[26,] 0.1021960581 0.0572280629
[27,] 0.1128885382 0.1021960581
[28,] 0.1185885382 0.1128885382
[29,] 0.0927960581 0.1185885382
[30,] 0.0830283069 0.0927960581
[31,] 0.0332132671 0.0830283069
[32,] 0.0437218715 0.0332132671
[33,] 0.0597379959 0.0437218715
[34,] 0.0787616402 0.0597379959
[35,] 0.0477632671 0.0787616402
[36,] 0.0660506972 0.0477632671
[37,] 0.1099359467 0.0660506972
[38,] 0.1382039419 0.1099359467
[39,] 0.1173447951 0.1382039419
[40,] 0.1092447951 0.1173447951
[41,] 0.1105039419 0.1092447951
[42,] 0.1021361906 0.1105039419
[43,] 0.0557695240 0.1021361906
[44,] 0.0002781285 0.0557695240
[45,] -0.0093057472 0.0002781285
[46,] -0.0158788492 -0.0093057472
[47,] 0.0054195240 -0.0158788492
[48,] -0.0275930459 0.0054195240
[49,] -0.0567077964 -0.0275930459
[50,] -0.0931881744 -0.0567077964
[51,] -0.0904956943 -0.0931881744
[52,] -0.0745473211 -0.0904956943
[53,] -0.0837881744 -0.0745473211
[54,] -0.0708042987 -0.0837881744
[55,] -0.0428709654 -0.0708042987
[56,] -0.0274139878 -0.0428709654
[57,] -0.0508462365 -0.0274139878
[58,] -0.0401709654 -0.0508462365
[59,] -0.0236725923 -0.0401709654
[60,] -0.0441851621 -0.0236725923
[61,] -0.0534482858 -0.0441851621
[62,] -0.0336802906 -0.0534482858
[63,] -0.0470394374 -0.0336802906
[64,] -0.0671878105 -0.0470394374
[65,] -0.0377802906 -0.0671878105
[66,] -0.0224964150 -0.0377802906
[67,] -0.0149147085 -0.0224964150
[68,] -0.0267061040 -0.0149147085
[69,] -0.0238383528 -0.0267061040
[70,] -0.0052147085 -0.0238383528
[71,] -0.0130130816 -0.0052147085
[72,] 0.0111743485 -0.0130130816
[73,] 0.0506595980 0.0111743485
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.0722877046 -0.0184245809
2 -0.0816197094 -0.0722877046
3 -0.0826788562 -0.0816197094
4 -0.0935788562 -0.0826788562
5 -0.1052197094 -0.0935788562
6 -0.1073358338 -0.1052197094
7 -0.0981025005 -0.1073358338
8 -0.0622938960 -0.0981025005
9 -0.0222777716 -0.0622938960
10 -0.0387025005 -0.0222777716
11 -0.0408525005 -0.0387025005
12 -0.0494650703 -0.0408525005
13 -0.0353798208 -0.0494650703
14 -0.0319118256 -0.0353798208
15 -0.0100193455 -0.0319118256
16 0.0074806545 -0.0100193455
17 0.0234881744 0.0074806545
18 0.0154720500 0.0234881744
19 0.0669053833 0.0154720500
20 0.0724139878 0.0669053833
21 0.0465301122 0.0724139878
22 0.0212053833 0.0465301122
23 0.0243553833 0.0212053833
24 0.0624428135 0.0243553833
25 0.0572280629 0.0624428135
26 0.1021960581 0.0572280629
27 0.1128885382 0.1021960581
28 0.1185885382 0.1128885382
29 0.0927960581 0.1185885382
30 0.0830283069 0.0927960581
31 0.0332132671 0.0830283069
32 0.0437218715 0.0332132671
33 0.0597379959 0.0437218715
34 0.0787616402 0.0597379959
35 0.0477632671 0.0787616402
36 0.0660506972 0.0477632671
37 0.1099359467 0.0660506972
38 0.1382039419 0.1099359467
39 0.1173447951 0.1382039419
40 0.1092447951 0.1173447951
41 0.1105039419 0.1092447951
42 0.1021361906 0.1105039419
43 0.0557695240 0.1021361906
44 0.0002781285 0.0557695240
45 -0.0093057472 0.0002781285
46 -0.0158788492 -0.0093057472
47 0.0054195240 -0.0158788492
48 -0.0275930459 0.0054195240
49 -0.0567077964 -0.0275930459
50 -0.0931881744 -0.0567077964
51 -0.0904956943 -0.0931881744
52 -0.0745473211 -0.0904956943
53 -0.0837881744 -0.0745473211
54 -0.0708042987 -0.0837881744
55 -0.0428709654 -0.0708042987
56 -0.0274139878 -0.0428709654
57 -0.0508462365 -0.0274139878
58 -0.0401709654 -0.0508462365
59 -0.0236725923 -0.0401709654
60 -0.0441851621 -0.0236725923
61 -0.0534482858 -0.0441851621
62 -0.0336802906 -0.0534482858
63 -0.0470394374 -0.0336802906
64 -0.0671878105 -0.0470394374
65 -0.0377802906 -0.0671878105
66 -0.0224964150 -0.0377802906
67 -0.0149147085 -0.0224964150
68 -0.0267061040 -0.0149147085
69 -0.0238383528 -0.0267061040
70 -0.0052147085 -0.0238383528
71 -0.0130130816 -0.0052147085
72 0.0111743485 -0.0130130816
73 0.0506595980 0.0111743485
> 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/7e75m1227377336.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/81d8d1227377336.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/9g4dt1227377336.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/10oih11227377336.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/11oekx1227377336.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/120iz51227377336.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/13kc311227377336.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/14goc01227377336.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/15cd951227377336.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/16th361227377336.tab")
+ }
>
> system("convert tmp/1lifg1227377336.ps tmp/1lifg1227377336.png")
> system("convert tmp/2eqrx1227377336.ps tmp/2eqrx1227377336.png")
> system("convert tmp/3cogw1227377336.ps tmp/3cogw1227377336.png")
> system("convert tmp/4ceie1227377336.ps tmp/4ceie1227377336.png")
> system("convert tmp/5rk601227377336.ps tmp/5rk601227377336.png")
> system("convert tmp/6yv541227377336.ps tmp/6yv541227377336.png")
> system("convert tmp/7e75m1227377336.ps tmp/7e75m1227377336.png")
> system("convert tmp/81d8d1227377336.ps tmp/81d8d1227377336.png")
> system("convert tmp/9g4dt1227377336.ps tmp/9g4dt1227377336.png")
> system("convert tmp/10oih11227377336.ps tmp/10oih11227377336.png")
>
>
> proc.time()
user system elapsed
5.210 2.682 5.607