R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-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(1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,1,0,0,1,1,0,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,1,0,0,1,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,1,1,0,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0),dim=c(4,86),dimnames=list(c('UseLimit','T40','Used','CorrectAnalysis'),1:86))
> y <- array(NA,dim=c(4,86),dimnames=list(c('UseLimit','T40','Used','CorrectAnalysis'),1:86))
> 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 = '4'
> par3 <- 'No Linear Trend'
> par2 <- 'Do not include Seasonal Dummies'
> par1 <- '4'
> #'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, 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
CorrectAnalysis UseLimit T40 Used
1 0 1 1 0
2 0 0 0 0
3 0 0 0 0
4 0 0 0 0
5 0 0 0 0
6 0 1 0 0
7 0 0 0 0
8 0 0 1 0
9 0 0 0 0
10 0 1 0 0
11 0 1 1 0
12 0 0 0 0
13 0 0 0 1
14 0 1 1 0
15 0 0 0 1
16 0 0 1 1
17 1 1 1 1
18 0 1 1 0
19 0 0 0 0
20 1 0 1 1
21 0 1 0 0
22 0 1 0 1
23 0 0 0 0
24 0 1 0 0
25 0 0 1 1
26 0 0 0 1
27 0 1 0 0
28 0 0 0 1
29 0 0 0 0
30 0 0 0 0
31 0 0 0 0
32 0 1 0 0
33 0 1 0 0
34 0 0 1 0
35 0 0 0 0
36 0 0 0 0
37 0 1 1 1
38 0 0 0 1
39 0 0 0 0
40 0 0 1 0
41 1 0 0 1
42 0 0 0 1
43 0 1 0 0
44 0 1 1 0
45 0 0 0 0
46 0 0 0 0
47 0 0 0 0
48 0 0 0 0
49 0 0 0 0
50 0 0 0 0
51 0 0 1 1
52 1 1 1 1
53 0 0 0 0
54 1 0 0 1
55 0 0 0 0
56 0 0 1 1
57 0 0 0 1
58 0 0 0 0
59 0 0 0 0
60 1 1 1 1
61 0 1 1 0
62 0 0 0 1
63 0 0 0 0
64 0 1 1 0
65 0 0 0 0
66 0 0 0 0
67 1 0 1 1
68 0 1 0 0
69 0 0 0 0
70 0 0 0 1
71 0 0 0 0
72 0 0 0 0
73 0 0 0 1
74 0 1 0 1
75 0 0 0 0
76 0 0 1 0
77 0 0 0 0
78 0 0 0 1
79 1 0 1 1
80 0 0 1 0
81 0 0 0 0
82 0 1 0 1
83 0 0 0 0
84 1 0 0 1
85 0 0 0 0
86 0 1 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) UseLimit T40 Used
-0.031918 0.001881 0.151606 0.293317
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.41489 -0.12157 0.03192 0.03192 0.73860
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.031918 0.040351 -0.791 0.4312
UseLimit 0.001881 0.066339 0.028 0.9774
T40 0.151606 0.068498 2.213 0.0297 *
Used 0.293317 0.062393 4.701 1.03e-05 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2644 on 82 degrees of freedom
Multiple R-squared: 0.2887, Adjusted R-squared: 0.2626
F-statistic: 11.09 on 3 and 82 DF, p-value: 3.472e-06
> 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.000000000 0.00000000 1.0000000
[2,] 0.000000000 0.00000000 1.0000000
[3,] 0.000000000 0.00000000 1.0000000
[4,] 0.000000000 0.00000000 1.0000000
[5,] 0.000000000 0.00000000 1.0000000
[6,] 0.000000000 0.00000000 1.0000000
[7,] 0.000000000 0.00000000 1.0000000
[8,] 0.000000000 0.00000000 1.0000000
[9,] 0.000000000 0.00000000 1.0000000
[10,] 0.000000000 0.00000000 1.0000000
[11,] 0.154015677 0.30803135 0.8459843
[12,] 0.116810574 0.23362115 0.8831894
[13,] 0.081400913 0.16280183 0.9185991
[14,] 0.400343982 0.80068796 0.5996560
[15,] 0.324735377 0.64947075 0.6752646
[16,] 0.333254892 0.66650978 0.6667451
[17,] 0.268144973 0.53628995 0.7318550
[18,] 0.211110351 0.42222070 0.7888896
[19,] 0.284311592 0.56862318 0.7156884
[20,] 0.260403068 0.52080614 0.7395969
[21,] 0.205323922 0.41064784 0.7946761
[22,] 0.184358897 0.36871779 0.8156411
[23,] 0.142360235 0.28472047 0.8576398
[24,] 0.107423897 0.21484779 0.8925761
[25,] 0.079204699 0.15840940 0.9207953
[26,] 0.056722496 0.11344499 0.9432775
[27,] 0.039722561 0.07944512 0.9602774
[28,] 0.029379443 0.05875889 0.9706206
[29,] 0.019933362 0.03986672 0.9800666
[30,] 0.013208895 0.02641779 0.9867911
[31,] 0.020618122 0.04123624 0.9793819
[32,] 0.018063137 0.03612627 0.9819369
[33,] 0.011945441 0.02389088 0.9880546
[34,] 0.008472543 0.01694509 0.9915275
[35,] 0.155928787 0.31185757 0.8440712
[36,] 0.151136473 0.30227295 0.8488635
[37,] 0.116778210 0.23355642 0.8832218
[38,] 0.094068567 0.18813713 0.9059314
[39,] 0.069943456 0.13988691 0.9300565
[40,] 0.050890388 0.10178078 0.9491096
[41,] 0.036219799 0.07243960 0.9637802
[42,] 0.025207020 0.05041404 0.9747930
[43,] 0.017147990 0.03429598 0.9828520
[44,] 0.011399341 0.02279868 0.9886007
[45,] 0.022936226 0.04587245 0.9770638
[46,] 0.087736960 0.17547392 0.9122630
[47,] 0.064707452 0.12941490 0.9352925
[48,] 0.320153804 0.64030761 0.6798462
[49,] 0.263815085 0.52763017 0.7361849
[50,] 0.438194020 0.87638804 0.5618060
[51,] 0.453101097 0.90620219 0.5468989
[52,] 0.387294005 0.77458801 0.6127060
[53,] 0.324320874 0.64864175 0.6756791
[54,] 0.533361531 0.93327694 0.4666385
[55,] 0.474441924 0.94888385 0.5255581
[56,] 0.497699493 0.99539899 0.5023005
[57,] 0.424362910 0.84872582 0.5756371
[58,] 0.368720686 0.73744137 0.6312793
[59,] 0.299821699 0.59964340 0.7001783
[60,] 0.236652132 0.47330426 0.7633479
[61,] 0.362086612 0.72417322 0.6379134
[62,] 0.313292633 0.62658527 0.6867074
[63,] 0.243464689 0.48692938 0.7565353
[64,] 0.267645334 0.53529067 0.7323547
[65,] 0.199813801 0.39962760 0.8001862
[66,] 0.142227972 0.28445594 0.8577720
[67,] 0.203890146 0.40778029 0.7961099
[68,] 0.176118007 0.35223601 0.8238820
[69,] 0.116242452 0.23248490 0.8837575
[70,] 0.085893569 0.17178714 0.9141064
[71,] 0.048394766 0.09678953 0.9516052
[72,] 0.239516108 0.47903222 0.7604839
[73,] 0.227764730 0.45552946 0.7722353
> postscript(file="/var/fisher/rcomp/tmp/14rlt1356092598.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/fisher/rcomp/tmp/2r24f1356092598.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/fisher/rcomp/tmp/30lwo1356092598.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/fisher/rcomp/tmp/4tj6g1356092598.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/fisher/rcomp/tmp/5v2ee1356092598.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 = 86
Frequency = 1
1 2 3 4 5 6
-0.12156912 0.03191818 0.03191818 0.03191818 0.03191818 0.03003684
7 8 9 10 11 12
0.03191818 -0.11968778 0.03191818 0.03003684 -0.12156912 0.03191818
13 14 15 16 17 18
-0.26139875 -0.12156912 -0.26139875 -0.41300471 0.58511395 -0.12156912
19 20 21 22 23 24
0.03191818 0.58699529 0.03003684 -0.26328009 0.03191818 0.03003684
25 26 27 28 29 30
-0.41300471 -0.26139875 0.03003684 -0.26139875 0.03191818 0.03191818
31 32 33 34 35 36
0.03191818 0.03003684 0.03003684 -0.11968778 0.03191818 0.03191818
37 38 39 40 41 42
-0.41488605 -0.26139875 0.03191818 -0.11968778 0.73860125 -0.26139875
43 44 45 46 47 48
0.03003684 -0.12156912 0.03191818 0.03191818 0.03191818 0.03191818
49 50 51 52 53 54
0.03191818 0.03191818 -0.41300471 0.58511395 0.03191818 0.73860125
55 56 57 58 59 60
0.03191818 -0.41300471 -0.26139875 0.03191818 0.03191818 0.58511395
61 62 63 64 65 66
-0.12156912 -0.26139875 0.03191818 -0.12156912 0.03191818 0.03191818
67 68 69 70 71 72
0.58699529 0.03003684 0.03191818 -0.26139875 0.03191818 0.03191818
73 74 75 76 77 78
-0.26139875 -0.26328009 0.03191818 -0.11968778 0.03191818 -0.26139875
79 80 81 82 83 84
0.58699529 -0.11968778 0.03191818 -0.26328009 0.03191818 0.73860125
85 86
0.03191818 0.03003684
> postscript(file="/var/fisher/rcomp/tmp/6nape1356092599.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 = 86
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.12156912 NA
1 0.03191818 -0.12156912
2 0.03191818 0.03191818
3 0.03191818 0.03191818
4 0.03191818 0.03191818
5 0.03003684 0.03191818
6 0.03191818 0.03003684
7 -0.11968778 0.03191818
8 0.03191818 -0.11968778
9 0.03003684 0.03191818
10 -0.12156912 0.03003684
11 0.03191818 -0.12156912
12 -0.26139875 0.03191818
13 -0.12156912 -0.26139875
14 -0.26139875 -0.12156912
15 -0.41300471 -0.26139875
16 0.58511395 -0.41300471
17 -0.12156912 0.58511395
18 0.03191818 -0.12156912
19 0.58699529 0.03191818
20 0.03003684 0.58699529
21 -0.26328009 0.03003684
22 0.03191818 -0.26328009
23 0.03003684 0.03191818
24 -0.41300471 0.03003684
25 -0.26139875 -0.41300471
26 0.03003684 -0.26139875
27 -0.26139875 0.03003684
28 0.03191818 -0.26139875
29 0.03191818 0.03191818
30 0.03191818 0.03191818
31 0.03003684 0.03191818
32 0.03003684 0.03003684
33 -0.11968778 0.03003684
34 0.03191818 -0.11968778
35 0.03191818 0.03191818
36 -0.41488605 0.03191818
37 -0.26139875 -0.41488605
38 0.03191818 -0.26139875
39 -0.11968778 0.03191818
40 0.73860125 -0.11968778
41 -0.26139875 0.73860125
42 0.03003684 -0.26139875
43 -0.12156912 0.03003684
44 0.03191818 -0.12156912
45 0.03191818 0.03191818
46 0.03191818 0.03191818
47 0.03191818 0.03191818
48 0.03191818 0.03191818
49 0.03191818 0.03191818
50 -0.41300471 0.03191818
51 0.58511395 -0.41300471
52 0.03191818 0.58511395
53 0.73860125 0.03191818
54 0.03191818 0.73860125
55 -0.41300471 0.03191818
56 -0.26139875 -0.41300471
57 0.03191818 -0.26139875
58 0.03191818 0.03191818
59 0.58511395 0.03191818
60 -0.12156912 0.58511395
61 -0.26139875 -0.12156912
62 0.03191818 -0.26139875
63 -0.12156912 0.03191818
64 0.03191818 -0.12156912
65 0.03191818 0.03191818
66 0.58699529 0.03191818
67 0.03003684 0.58699529
68 0.03191818 0.03003684
69 -0.26139875 0.03191818
70 0.03191818 -0.26139875
71 0.03191818 0.03191818
72 -0.26139875 0.03191818
73 -0.26328009 -0.26139875
74 0.03191818 -0.26328009
75 -0.11968778 0.03191818
76 0.03191818 -0.11968778
77 -0.26139875 0.03191818
78 0.58699529 -0.26139875
79 -0.11968778 0.58699529
80 0.03191818 -0.11968778
81 -0.26328009 0.03191818
82 0.03191818 -0.26328009
83 0.73860125 0.03191818
84 0.03191818 0.73860125
85 0.03003684 0.03191818
86 NA 0.03003684
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.03191818 -0.12156912
[2,] 0.03191818 0.03191818
[3,] 0.03191818 0.03191818
[4,] 0.03191818 0.03191818
[5,] 0.03003684 0.03191818
[6,] 0.03191818 0.03003684
[7,] -0.11968778 0.03191818
[8,] 0.03191818 -0.11968778
[9,] 0.03003684 0.03191818
[10,] -0.12156912 0.03003684
[11,] 0.03191818 -0.12156912
[12,] -0.26139875 0.03191818
[13,] -0.12156912 -0.26139875
[14,] -0.26139875 -0.12156912
[15,] -0.41300471 -0.26139875
[16,] 0.58511395 -0.41300471
[17,] -0.12156912 0.58511395
[18,] 0.03191818 -0.12156912
[19,] 0.58699529 0.03191818
[20,] 0.03003684 0.58699529
[21,] -0.26328009 0.03003684
[22,] 0.03191818 -0.26328009
[23,] 0.03003684 0.03191818
[24,] -0.41300471 0.03003684
[25,] -0.26139875 -0.41300471
[26,] 0.03003684 -0.26139875
[27,] -0.26139875 0.03003684
[28,] 0.03191818 -0.26139875
[29,] 0.03191818 0.03191818
[30,] 0.03191818 0.03191818
[31,] 0.03003684 0.03191818
[32,] 0.03003684 0.03003684
[33,] -0.11968778 0.03003684
[34,] 0.03191818 -0.11968778
[35,] 0.03191818 0.03191818
[36,] -0.41488605 0.03191818
[37,] -0.26139875 -0.41488605
[38,] 0.03191818 -0.26139875
[39,] -0.11968778 0.03191818
[40,] 0.73860125 -0.11968778
[41,] -0.26139875 0.73860125
[42,] 0.03003684 -0.26139875
[43,] -0.12156912 0.03003684
[44,] 0.03191818 -0.12156912
[45,] 0.03191818 0.03191818
[46,] 0.03191818 0.03191818
[47,] 0.03191818 0.03191818
[48,] 0.03191818 0.03191818
[49,] 0.03191818 0.03191818
[50,] -0.41300471 0.03191818
[51,] 0.58511395 -0.41300471
[52,] 0.03191818 0.58511395
[53,] 0.73860125 0.03191818
[54,] 0.03191818 0.73860125
[55,] -0.41300471 0.03191818
[56,] -0.26139875 -0.41300471
[57,] 0.03191818 -0.26139875
[58,] 0.03191818 0.03191818
[59,] 0.58511395 0.03191818
[60,] -0.12156912 0.58511395
[61,] -0.26139875 -0.12156912
[62,] 0.03191818 -0.26139875
[63,] -0.12156912 0.03191818
[64,] 0.03191818 -0.12156912
[65,] 0.03191818 0.03191818
[66,] 0.58699529 0.03191818
[67,] 0.03003684 0.58699529
[68,] 0.03191818 0.03003684
[69,] -0.26139875 0.03191818
[70,] 0.03191818 -0.26139875
[71,] 0.03191818 0.03191818
[72,] -0.26139875 0.03191818
[73,] -0.26328009 -0.26139875
[74,] 0.03191818 -0.26328009
[75,] -0.11968778 0.03191818
[76,] 0.03191818 -0.11968778
[77,] -0.26139875 0.03191818
[78,] 0.58699529 -0.26139875
[79,] -0.11968778 0.58699529
[80,] 0.03191818 -0.11968778
[81,] -0.26328009 0.03191818
[82,] 0.03191818 -0.26328009
[83,] 0.73860125 0.03191818
[84,] 0.03191818 0.73860125
[85,] 0.03003684 0.03191818
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.03191818 -0.12156912
2 0.03191818 0.03191818
3 0.03191818 0.03191818
4 0.03191818 0.03191818
5 0.03003684 0.03191818
6 0.03191818 0.03003684
7 -0.11968778 0.03191818
8 0.03191818 -0.11968778
9 0.03003684 0.03191818
10 -0.12156912 0.03003684
11 0.03191818 -0.12156912
12 -0.26139875 0.03191818
13 -0.12156912 -0.26139875
14 -0.26139875 -0.12156912
15 -0.41300471 -0.26139875
16 0.58511395 -0.41300471
17 -0.12156912 0.58511395
18 0.03191818 -0.12156912
19 0.58699529 0.03191818
20 0.03003684 0.58699529
21 -0.26328009 0.03003684
22 0.03191818 -0.26328009
23 0.03003684 0.03191818
24 -0.41300471 0.03003684
25 -0.26139875 -0.41300471
26 0.03003684 -0.26139875
27 -0.26139875 0.03003684
28 0.03191818 -0.26139875
29 0.03191818 0.03191818
30 0.03191818 0.03191818
31 0.03003684 0.03191818
32 0.03003684 0.03003684
33 -0.11968778 0.03003684
34 0.03191818 -0.11968778
35 0.03191818 0.03191818
36 -0.41488605 0.03191818
37 -0.26139875 -0.41488605
38 0.03191818 -0.26139875
39 -0.11968778 0.03191818
40 0.73860125 -0.11968778
41 -0.26139875 0.73860125
42 0.03003684 -0.26139875
43 -0.12156912 0.03003684
44 0.03191818 -0.12156912
45 0.03191818 0.03191818
46 0.03191818 0.03191818
47 0.03191818 0.03191818
48 0.03191818 0.03191818
49 0.03191818 0.03191818
50 -0.41300471 0.03191818
51 0.58511395 -0.41300471
52 0.03191818 0.58511395
53 0.73860125 0.03191818
54 0.03191818 0.73860125
55 -0.41300471 0.03191818
56 -0.26139875 -0.41300471
57 0.03191818 -0.26139875
58 0.03191818 0.03191818
59 0.58511395 0.03191818
60 -0.12156912 0.58511395
61 -0.26139875 -0.12156912
62 0.03191818 -0.26139875
63 -0.12156912 0.03191818
64 0.03191818 -0.12156912
65 0.03191818 0.03191818
66 0.58699529 0.03191818
67 0.03003684 0.58699529
68 0.03191818 0.03003684
69 -0.26139875 0.03191818
70 0.03191818 -0.26139875
71 0.03191818 0.03191818
72 -0.26139875 0.03191818
73 -0.26328009 -0.26139875
74 0.03191818 -0.26328009
75 -0.11968778 0.03191818
76 0.03191818 -0.11968778
77 -0.26139875 0.03191818
78 0.58699529 -0.26139875
79 -0.11968778 0.58699529
80 0.03191818 -0.11968778
81 -0.26328009 0.03191818
82 0.03191818 -0.26328009
83 0.73860125 0.03191818
84 0.03191818 0.73860125
85 0.03003684 0.03191818
> 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/fisher/rcomp/tmp/75rjg1356092599.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/fisher/rcomp/tmp/8sm571356092599.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/fisher/rcomp/tmp/9bx6b1356092599.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/fisher/rcomp/tmp/10hgie1356092599.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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/fisher/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/fisher/rcomp/tmp/11dh6y1356092599.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/fisher/rcomp/tmp/12wyzv1356092599.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/fisher/rcomp/tmp/13pm771356092599.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/fisher/rcomp/tmp/14on1l1356092599.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/fisher/rcomp/tmp/15lt451356092599.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/fisher/rcomp/tmp/16zact1356092599.tab")
+ }
>
> try(system("convert tmp/14rlt1356092598.ps tmp/14rlt1356092598.png",intern=TRUE))
character(0)
> try(system("convert tmp/2r24f1356092598.ps tmp/2r24f1356092598.png",intern=TRUE))
character(0)
> try(system("convert tmp/30lwo1356092598.ps tmp/30lwo1356092598.png",intern=TRUE))
character(0)
> try(system("convert tmp/4tj6g1356092598.ps tmp/4tj6g1356092598.png",intern=TRUE))
character(0)
> try(system("convert tmp/5v2ee1356092598.ps tmp/5v2ee1356092598.png",intern=TRUE))
character(0)
> try(system("convert tmp/6nape1356092599.ps tmp/6nape1356092599.png",intern=TRUE))
character(0)
> try(system("convert tmp/75rjg1356092599.ps tmp/75rjg1356092599.png",intern=TRUE))
character(0)
> try(system("convert tmp/8sm571356092599.ps tmp/8sm571356092599.png",intern=TRUE))
character(0)
> try(system("convert tmp/9bx6b1356092599.ps tmp/9bx6b1356092599.png",intern=TRUE))
character(0)
> try(system("convert tmp/10hgie1356092599.ps tmp/10hgie1356092599.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
6.458 1.785 8.340