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(96.8,9.3,114.1,9.3,110.3,8.7,103.9,8.2,101.6,8.3,94.6,8.5,95.9,8.6,104.7,8.5,102.8,8.2,98.1,8.1,113.9,7.9,80.9,8.6,95.7,8.7,113.2,8.7,105.9,8.5,108.8,8.4,102.3,8.5,99,8.7,100.7,8.7,115.5,8.6,100.7,8.5,109.9,8.3,114.6,8,85.4,8.2,100.5,8.1,114.8,8.1,116.5,8,112.9,7.9,102,7.9,106,8,105.3,8,118.8,7.9,106.1,8,109.3,7.7,117.2,7.2,92.5,7.5,104.2,7.3,112.5,7,122.4,7,113.3,7,100,7.2,110.7,7.3,112.8,7.1,109.8,6.8,117.3,6.4,109.1,6.1,115.9,6.5,96,7.7,99.8,7.9,116.8,7.5,115.7,6.9,99.4,6.6,94.3,6.9,91,7.7,93.2,8,103.1,8,94.1,7.7,91.8,7.3,102.7,7.4,82.6,8.1,89.1,8.3),dim=c(2,61),dimnames=list(c('tip','wrk'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('tip','wrk'),1:61))
> 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
tip wrk M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 96.8 9.3 1 0 0 0 0 0 0 0 0 0 0 1
2 114.1 9.3 0 1 0 0 0 0 0 0 0 0 0 2
3 110.3 8.7 0 0 1 0 0 0 0 0 0 0 0 3
4 103.9 8.2 0 0 0 1 0 0 0 0 0 0 0 4
5 101.6 8.3 0 0 0 0 1 0 0 0 0 0 0 5
6 94.6 8.5 0 0 0 0 0 1 0 0 0 0 0 6
7 95.9 8.6 0 0 0 0 0 0 1 0 0 0 0 7
8 104.7 8.5 0 0 0 0 0 0 0 1 0 0 0 8
9 102.8 8.2 0 0 0 0 0 0 0 0 1 0 0 9
10 98.1 8.1 0 0 0 0 0 0 0 0 0 1 0 10
11 113.9 7.9 0 0 0 0 0 0 0 0 0 0 1 11
12 80.9 8.6 0 0 0 0 0 0 0 0 0 0 0 12
13 95.7 8.7 1 0 0 0 0 0 0 0 0 0 0 13
14 113.2 8.7 0 1 0 0 0 0 0 0 0 0 0 14
15 105.9 8.5 0 0 1 0 0 0 0 0 0 0 0 15
16 108.8 8.4 0 0 0 1 0 0 0 0 0 0 0 16
17 102.3 8.5 0 0 0 0 1 0 0 0 0 0 0 17
18 99.0 8.7 0 0 0 0 0 1 0 0 0 0 0 18
19 100.7 8.7 0 0 0 0 0 0 1 0 0 0 0 19
20 115.5 8.6 0 0 0 0 0 0 0 1 0 0 0 20
21 100.7 8.5 0 0 0 0 0 0 0 0 1 0 0 21
22 109.9 8.3 0 0 0 0 0 0 0 0 0 1 0 22
23 114.6 8.0 0 0 0 0 0 0 0 0 0 0 1 23
24 85.4 8.2 0 0 0 0 0 0 0 0 0 0 0 24
25 100.5 8.1 1 0 0 0 0 0 0 0 0 0 0 25
26 114.8 8.1 0 1 0 0 0 0 0 0 0 0 0 26
27 116.5 8.0 0 0 1 0 0 0 0 0 0 0 0 27
28 112.9 7.9 0 0 0 1 0 0 0 0 0 0 0 28
29 102.0 7.9 0 0 0 0 1 0 0 0 0 0 0 29
30 106.0 8.0 0 0 0 0 0 1 0 0 0 0 0 30
31 105.3 8.0 0 0 0 0 0 0 1 0 0 0 0 31
32 118.8 7.9 0 0 0 0 0 0 0 1 0 0 0 32
33 106.1 8.0 0 0 0 0 0 0 0 0 1 0 0 33
34 109.3 7.7 0 0 0 0 0 0 0 0 0 1 0 34
35 117.2 7.2 0 0 0 0 0 0 0 0 0 0 1 35
36 92.5 7.5 0 0 0 0 0 0 0 0 0 0 0 36
37 104.2 7.3 1 0 0 0 0 0 0 0 0 0 0 37
38 112.5 7.0 0 1 0 0 0 0 0 0 0 0 0 38
39 122.4 7.0 0 0 1 0 0 0 0 0 0 0 0 39
40 113.3 7.0 0 0 0 1 0 0 0 0 0 0 0 40
41 100.0 7.2 0 0 0 0 1 0 0 0 0 0 0 41
42 110.7 7.3 0 0 0 0 0 1 0 0 0 0 0 42
43 112.8 7.1 0 0 0 0 0 0 1 0 0 0 0 43
44 109.8 6.8 0 0 0 0 0 0 0 1 0 0 0 44
45 117.3 6.4 0 0 0 0 0 0 0 0 1 0 0 45
46 109.1 6.1 0 0 0 0 0 0 0 0 0 1 0 46
47 115.9 6.5 0 0 0 0 0 0 0 0 0 0 1 47
48 96.0 7.7 0 0 0 0 0 0 0 0 0 0 0 48
49 99.8 7.9 1 0 0 0 0 0 0 0 0 0 0 49
50 116.8 7.5 0 1 0 0 0 0 0 0 0 0 0 50
51 115.7 6.9 0 0 1 0 0 0 0 0 0 0 0 51
52 99.4 6.6 0 0 0 1 0 0 0 0 0 0 0 52
53 94.3 6.9 0 0 0 0 1 0 0 0 0 0 0 53
54 91.0 7.7 0 0 0 0 0 1 0 0 0 0 0 54
55 93.2 8.0 0 0 0 0 0 0 1 0 0 0 0 55
56 103.1 8.0 0 0 0 0 0 0 0 1 0 0 0 56
57 94.1 7.7 0 0 0 0 0 0 0 0 1 0 0 57
58 91.8 7.3 0 0 0 0 0 0 0 0 0 1 0 58
59 102.7 7.4 0 0 0 0 0 0 0 0 0 0 1 59
60 82.6 8.1 0 0 0 0 0 0 0 0 0 0 0 60
61 89.1 8.3 1 0 0 0 0 0 0 0 0 0 0 61
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) wrk M1 M2 M3 M4
148.7097 -6.7334 10.8604 25.4657 23.5264 15.8805
M5 M6 M7 M8 M9 M10
9.4040 11.7101 13.5002 21.6929 14.3670 12.2571
M11 t
21.0045 -0.2008
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-10.3098 -4.1004 0.3853 3.5160 9.2376
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 148.70972 15.45962 9.619 1.10e-12 ***
wrk -6.73345 1.68132 -4.005 0.000219 ***
M1 10.86043 3.45775 3.141 0.002912 **
M2 25.46571 3.63683 7.002 8.11e-09 ***
M3 23.52644 3.69835 6.361 7.62e-08 ***
M4 15.88051 3.76437 4.219 0.000111 ***
M5 9.40396 3.69216 2.547 0.014198 *
M6 11.71009 3.61723 3.237 0.002215 **
M7 13.50019 3.60852 3.741 0.000498 ***
M8 21.69294 3.61537 6.000 2.69e-07 ***
M9 14.36701 3.64819 3.938 0.000271 ***
M10 12.25708 3.72877 3.287 0.001920 **
M11 21.00450 3.76136 5.584 1.14e-06 ***
t -0.20076 0.06298 -3.188 0.002551 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.692 on 47 degrees of freedom
Multiple R-squared: 0.7244, Adjusted R-squared: 0.6482
F-statistic: 9.503 on 13 and 47 DF, p-value: 3.171e-09
> 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.10364471 0.20728942 0.8963553
[2,] 0.04932841 0.09865683 0.9506716
[3,] 0.02608969 0.05217938 0.9739103
[4,] 0.07357922 0.14715845 0.9264208
[5,] 0.10396192 0.20792384 0.8960381
[6,] 0.14675718 0.29351435 0.8532428
[7,] 0.09639035 0.19278071 0.9036096
[8,] 0.12933994 0.25867989 0.8706601
[9,] 0.12194835 0.24389670 0.8780517
[10,] 0.08071584 0.16143169 0.9192842
[11,] 0.09028580 0.18057159 0.9097142
[12,] 0.06115013 0.12230026 0.9388499
[13,] 0.04674656 0.09349312 0.9532534
[14,] 0.04382850 0.08765699 0.9561715
[15,] 0.03434804 0.06869608 0.9656520
[16,] 0.02964060 0.05928121 0.9703594
[17,] 0.01976962 0.03953925 0.9802304
[18,] 0.01190304 0.02380607 0.9880970
[19,] 0.00621845 0.01243690 0.9937816
[20,] 0.01359631 0.02719263 0.9864037
[21,] 0.01350848 0.02701696 0.9864915
[22,] 0.21363224 0.42726449 0.7863678
[23,] 0.23976757 0.47953514 0.7602324
[24,] 0.19769661 0.39539322 0.8023034
[25,] 0.23794760 0.47589519 0.7620524
[26,] 0.27046789 0.54093579 0.7295321
[27,] 0.27559206 0.55118413 0.7244079
[28,] 0.81351680 0.37296640 0.1864832
> postscript(file="/var/www/html/rcomp/tmp/10s3c1258650568.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/2de5w1258650568.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/3gd0w1258650568.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/45lgf1258650568.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/5gxuj1258650568.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 = 61
Frequency = 1
1 2 3 4 5 6
0.05165608 2.94714246 -2.75289135 -4.67292515 0.37773701 -7.38093867
7 8 9 10 11 12
-6.99693191 -6.86226299 -3.25560760 -6.31825623 -0.41160083 -7.49292515
13 14 15 16 17 18
-2.67924961 0.41623677 -6.09041863 3.98292597 4.83358813 0.77491245
19 20 21 22 23 24
0.88557461 7.02024353 -0.92641187 9.23759489 3.37090569 -3.27714164
25 26 27 28 29 30
0.48984470 0.38533108 3.55202028 7.12536489 2.90268244 5.47066216
31 32 33 34 35 36
3.18132432 8.01599324 3.51602704 7.00668920 2.99331080 1.51860807
37 38 39 40 41 42
1.21224981 -6.91229762 5.12773619 3.87442539 -1.40156785 7.86641187
43 44 45 46 47 48
7.03038482 -5.98163546 6.35167533 -1.55766251 -0.61093950 8.77445920
49 50 51 52 53 54
3.26147934 3.16358731 0.16355351 -10.30979110 -6.71243973 -6.73104780
55 56 57 58 59 60
-4.10035184 -2.19233832 -5.68568292 -8.36836536 -5.34167616 0.47699953
61
-2.33598033
> postscript(file="/var/www/html/rcomp/tmp/644ql1258650568.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 = 61
Frequency = 1
lag(myerror, k = 1) myerror
0 0.05165608 NA
1 2.94714246 0.05165608
2 -2.75289135 2.94714246
3 -4.67292515 -2.75289135
4 0.37773701 -4.67292515
5 -7.38093867 0.37773701
6 -6.99693191 -7.38093867
7 -6.86226299 -6.99693191
8 -3.25560760 -6.86226299
9 -6.31825623 -3.25560760
10 -0.41160083 -6.31825623
11 -7.49292515 -0.41160083
12 -2.67924961 -7.49292515
13 0.41623677 -2.67924961
14 -6.09041863 0.41623677
15 3.98292597 -6.09041863
16 4.83358813 3.98292597
17 0.77491245 4.83358813
18 0.88557461 0.77491245
19 7.02024353 0.88557461
20 -0.92641187 7.02024353
21 9.23759489 -0.92641187
22 3.37090569 9.23759489
23 -3.27714164 3.37090569
24 0.48984470 -3.27714164
25 0.38533108 0.48984470
26 3.55202028 0.38533108
27 7.12536489 3.55202028
28 2.90268244 7.12536489
29 5.47066216 2.90268244
30 3.18132432 5.47066216
31 8.01599324 3.18132432
32 3.51602704 8.01599324
33 7.00668920 3.51602704
34 2.99331080 7.00668920
35 1.51860807 2.99331080
36 1.21224981 1.51860807
37 -6.91229762 1.21224981
38 5.12773619 -6.91229762
39 3.87442539 5.12773619
40 -1.40156785 3.87442539
41 7.86641187 -1.40156785
42 7.03038482 7.86641187
43 -5.98163546 7.03038482
44 6.35167533 -5.98163546
45 -1.55766251 6.35167533
46 -0.61093950 -1.55766251
47 8.77445920 -0.61093950
48 3.26147934 8.77445920
49 3.16358731 3.26147934
50 0.16355351 3.16358731
51 -10.30979110 0.16355351
52 -6.71243973 -10.30979110
53 -6.73104780 -6.71243973
54 -4.10035184 -6.73104780
55 -2.19233832 -4.10035184
56 -5.68568292 -2.19233832
57 -8.36836536 -5.68568292
58 -5.34167616 -8.36836536
59 0.47699953 -5.34167616
60 -2.33598033 0.47699953
61 NA -2.33598033
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.9471425 0.05165608
[2,] -2.7528913 2.94714246
[3,] -4.6729252 -2.75289135
[4,] 0.3777370 -4.67292515
[5,] -7.3809387 0.37773701
[6,] -6.9969319 -7.38093867
[7,] -6.8622630 -6.99693191
[8,] -3.2556076 -6.86226299
[9,] -6.3182562 -3.25560760
[10,] -0.4116008 -6.31825623
[11,] -7.4929252 -0.41160083
[12,] -2.6792496 -7.49292515
[13,] 0.4162368 -2.67924961
[14,] -6.0904186 0.41623677
[15,] 3.9829260 -6.09041863
[16,] 4.8335881 3.98292597
[17,] 0.7749125 4.83358813
[18,] 0.8855746 0.77491245
[19,] 7.0202435 0.88557461
[20,] -0.9264119 7.02024353
[21,] 9.2375949 -0.92641187
[22,] 3.3709057 9.23759489
[23,] -3.2771416 3.37090569
[24,] 0.4898447 -3.27714164
[25,] 0.3853311 0.48984470
[26,] 3.5520203 0.38533108
[27,] 7.1253649 3.55202028
[28,] 2.9026824 7.12536489
[29,] 5.4706622 2.90268244
[30,] 3.1813243 5.47066216
[31,] 8.0159932 3.18132432
[32,] 3.5160270 8.01599324
[33,] 7.0066892 3.51602704
[34,] 2.9933108 7.00668920
[35,] 1.5186081 2.99331080
[36,] 1.2122498 1.51860807
[37,] -6.9122976 1.21224981
[38,] 5.1277362 -6.91229762
[39,] 3.8744254 5.12773619
[40,] -1.4015678 3.87442539
[41,] 7.8664119 -1.40156785
[42,] 7.0303848 7.86641187
[43,] -5.9816355 7.03038482
[44,] 6.3516753 -5.98163546
[45,] -1.5576625 6.35167533
[46,] -0.6109395 -1.55766251
[47,] 8.7744592 -0.61093950
[48,] 3.2614793 8.77445920
[49,] 3.1635873 3.26147934
[50,] 0.1635535 3.16358731
[51,] -10.3097911 0.16355351
[52,] -6.7124397 -10.30979110
[53,] -6.7310478 -6.71243973
[54,] -4.1003518 -6.73104780
[55,] -2.1923383 -4.10035184
[56,] -5.6856829 -2.19233832
[57,] -8.3683654 -5.68568292
[58,] -5.3416762 -8.36836536
[59,] 0.4769995 -5.34167616
[60,] -2.3359803 0.47699953
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.9471425 0.05165608
2 -2.7528913 2.94714246
3 -4.6729252 -2.75289135
4 0.3777370 -4.67292515
5 -7.3809387 0.37773701
6 -6.9969319 -7.38093867
7 -6.8622630 -6.99693191
8 -3.2556076 -6.86226299
9 -6.3182562 -3.25560760
10 -0.4116008 -6.31825623
11 -7.4929252 -0.41160083
12 -2.6792496 -7.49292515
13 0.4162368 -2.67924961
14 -6.0904186 0.41623677
15 3.9829260 -6.09041863
16 4.8335881 3.98292597
17 0.7749125 4.83358813
18 0.8855746 0.77491245
19 7.0202435 0.88557461
20 -0.9264119 7.02024353
21 9.2375949 -0.92641187
22 3.3709057 9.23759489
23 -3.2771416 3.37090569
24 0.4898447 -3.27714164
25 0.3853311 0.48984470
26 3.5520203 0.38533108
27 7.1253649 3.55202028
28 2.9026824 7.12536489
29 5.4706622 2.90268244
30 3.1813243 5.47066216
31 8.0159932 3.18132432
32 3.5160270 8.01599324
33 7.0066892 3.51602704
34 2.9933108 7.00668920
35 1.5186081 2.99331080
36 1.2122498 1.51860807
37 -6.9122976 1.21224981
38 5.1277362 -6.91229762
39 3.8744254 5.12773619
40 -1.4015678 3.87442539
41 7.8664119 -1.40156785
42 7.0303848 7.86641187
43 -5.9816355 7.03038482
44 6.3516753 -5.98163546
45 -1.5576625 6.35167533
46 -0.6109395 -1.55766251
47 8.7744592 -0.61093950
48 3.2614793 8.77445920
49 3.1635873 3.26147934
50 0.1635535 3.16358731
51 -10.3097911 0.16355351
52 -6.7124397 -10.30979110
53 -6.7310478 -6.71243973
54 -4.1003518 -6.73104780
55 -2.1923383 -4.10035184
56 -5.6856829 -2.19233832
57 -8.3683654 -5.68568292
58 -5.3416762 -8.36836536
59 0.4769995 -5.34167616
60 -2.3359803 0.47699953
> 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/7ho6v1258650568.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/8vzhm1258650568.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/9r11r1258650568.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/10c9ii1258650568.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/119il61258650568.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/12o6lp1258650568.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/13tp1k1258650569.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/14segz1258650569.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/15ypiv1258650569.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/16ok5e1258650569.tab")
+ }
> system("convert tmp/10s3c1258650568.ps tmp/10s3c1258650568.png")
> system("convert tmp/2de5w1258650568.ps tmp/2de5w1258650568.png")
> system("convert tmp/3gd0w1258650568.ps tmp/3gd0w1258650568.png")
> system("convert tmp/45lgf1258650568.ps tmp/45lgf1258650568.png")
> system("convert tmp/5gxuj1258650568.ps tmp/5gxuj1258650568.png")
> system("convert tmp/644ql1258650568.ps tmp/644ql1258650568.png")
> system("convert tmp/7ho6v1258650568.ps tmp/7ho6v1258650568.png")
> system("convert tmp/8vzhm1258650568.ps tmp/8vzhm1258650568.png")
> system("convert tmp/9r11r1258650568.ps tmp/9r11r1258650568.png")
> system("convert tmp/10c9ii1258650568.ps tmp/10c9ii1258650568.png")
>
>
> proc.time()
user system elapsed
2.412 1.577 2.879