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(785.8,35,819.3,31.3,849.4,30,880.4,31.3,900.1,33,937.2,31.3,948.9,29,952.6,28.7,947.3,28,974.2,29.7,1000.8,30.7,1032.8,24,1050.7,29,1057.3,33,1075.4,28,1118.4,28.7,1179.8,31.7,1227,34,1257.8,35.3,1251.5,27,1236.3,31.3,1170.6,38.7,1213.1,37.3,1265.5,37.3,1300.8,37.7,1348.4,34.7,1371.9,34.7,1403.3,33.7,1451.8,38.3,1474.2,38,1438.2,38.3,1513.6,42.7,1562.2,41.7,1546.2,39.7,1527.5,39.3,1418.7,39.3,1448.5,37.7,1492.1,38.3,1395.4,37.7,1403.7,37,1316.6,34.3,1274.5,29.7,1264.4,34.7,1323.9,32,1332.1,30.3,1250.2,28.3,1096.7,31.3,1080.8,17.7,1039.2,15.7,792,14.3,746.6,13.3,688.8,11,715.8,2.7,672.9,3.3,629.5,3.7,681.2,1.4,755.4,7.1,760.6,8.1,765.9,12.4,836.8,12.4,904.9,9.2),dim=c(2,61),dimnames=list(c('Herdiv','handact'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('Herdiv','handact'),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
Herdiv handact M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 785.8 35.0 1 0 0 0 0 0 0 0 0 0 0 1
2 819.3 31.3 0 1 0 0 0 0 0 0 0 0 0 2
3 849.4 30.0 0 0 1 0 0 0 0 0 0 0 0 3
4 880.4 31.3 0 0 0 1 0 0 0 0 0 0 0 4
5 900.1 33.0 0 0 0 0 1 0 0 0 0 0 0 5
6 937.2 31.3 0 0 0 0 0 1 0 0 0 0 0 6
7 948.9 29.0 0 0 0 0 0 0 1 0 0 0 0 7
8 952.6 28.7 0 0 0 0 0 0 0 1 0 0 0 8
9 947.3 28.0 0 0 0 0 0 0 0 0 1 0 0 9
10 974.2 29.7 0 0 0 0 0 0 0 0 0 1 0 10
11 1000.8 30.7 0 0 0 0 0 0 0 0 0 0 1 11
12 1032.8 24.0 0 0 0 0 0 0 0 0 0 0 0 12
13 1050.7 29.0 1 0 0 0 0 0 0 0 0 0 0 13
14 1057.3 33.0 0 1 0 0 0 0 0 0 0 0 0 14
15 1075.4 28.0 0 0 1 0 0 0 0 0 0 0 0 15
16 1118.4 28.7 0 0 0 1 0 0 0 0 0 0 0 16
17 1179.8 31.7 0 0 0 0 1 0 0 0 0 0 0 17
18 1227.0 34.0 0 0 0 0 0 1 0 0 0 0 0 18
19 1257.8 35.3 0 0 0 0 0 0 1 0 0 0 0 19
20 1251.5 27.0 0 0 0 0 0 0 0 1 0 0 0 20
21 1236.3 31.3 0 0 0 0 0 0 0 0 1 0 0 21
22 1170.6 38.7 0 0 0 0 0 0 0 0 0 1 0 22
23 1213.1 37.3 0 0 0 0 0 0 0 0 0 0 1 23
24 1265.5 37.3 0 0 0 0 0 0 0 0 0 0 0 24
25 1300.8 37.7 1 0 0 0 0 0 0 0 0 0 0 25
26 1348.4 34.7 0 1 0 0 0 0 0 0 0 0 0 26
27 1371.9 34.7 0 0 1 0 0 0 0 0 0 0 0 27
28 1403.3 33.7 0 0 0 1 0 0 0 0 0 0 0 28
29 1451.8 38.3 0 0 0 0 1 0 0 0 0 0 0 29
30 1474.2 38.0 0 0 0 0 0 1 0 0 0 0 0 30
31 1438.2 38.3 0 0 0 0 0 0 1 0 0 0 0 31
32 1513.6 42.7 0 0 0 0 0 0 0 1 0 0 0 32
33 1562.2 41.7 0 0 0 0 0 0 0 0 1 0 0 33
34 1546.2 39.7 0 0 0 0 0 0 0 0 0 1 0 34
35 1527.5 39.3 0 0 0 0 0 0 0 0 0 0 1 35
36 1418.7 39.3 0 0 0 0 0 0 0 0 0 0 0 36
37 1448.5 37.7 1 0 0 0 0 0 0 0 0 0 0 37
38 1492.1 38.3 0 1 0 0 0 0 0 0 0 0 0 38
39 1395.4 37.7 0 0 1 0 0 0 0 0 0 0 0 39
40 1403.7 37.0 0 0 0 1 0 0 0 0 0 0 0 40
41 1316.6 34.3 0 0 0 0 1 0 0 0 0 0 0 41
42 1274.5 29.7 0 0 0 0 0 1 0 0 0 0 0 42
43 1264.4 34.7 0 0 0 0 0 0 1 0 0 0 0 43
44 1323.9 32.0 0 0 0 0 0 0 0 1 0 0 0 44
45 1332.1 30.3 0 0 0 0 0 0 0 0 1 0 0 45
46 1250.2 28.3 0 0 0 0 0 0 0 0 0 1 0 46
47 1096.7 31.3 0 0 0 0 0 0 0 0 0 0 1 47
48 1080.8 17.7 0 0 0 0 0 0 0 0 0 0 0 48
49 1039.2 15.7 1 0 0 0 0 0 0 0 0 0 0 49
50 792.0 14.3 0 1 0 0 0 0 0 0 0 0 0 50
51 746.6 13.3 0 0 1 0 0 0 0 0 0 0 0 51
52 688.8 11.0 0 0 0 1 0 0 0 0 0 0 0 52
53 715.8 2.7 0 0 0 0 1 0 0 0 0 0 0 53
54 672.9 3.3 0 0 0 0 0 1 0 0 0 0 0 54
55 629.5 3.7 0 0 0 0 0 0 1 0 0 0 0 55
56 681.2 1.4 0 0 0 0 0 0 0 1 0 0 0 56
57 755.4 7.1 0 0 0 0 0 0 0 0 1 0 0 57
58 760.6 8.1 0 0 0 0 0 0 0 0 0 1 0 58
59 765.9 12.4 0 0 0 0 0 0 0 0 0 0 1 59
60 836.8 12.4 0 0 0 0 0 0 0 0 0 0 0 60
61 904.9 9.2 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) handact M1 M2 M3 M4
105.727 27.522 -30.908 -56.312 -35.291 -21.485
M5 M6 M7 M8 M9 M10
-6.610 9.713 -33.940 45.116 22.505 -45.754
M11 t
-109.475 8.383
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-260.655 -70.199 -2.509 67.427 189.920
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 105.7266 81.3282 1.300 0.200
handact 27.5215 1.5117 18.205 < 2e-16 ***
M1 -30.9077 64.2984 -0.481 0.633
M2 -56.3119 67.4843 -0.834 0.408
M3 -35.2907 67.4043 -0.524 0.603
M4 -21.4849 67.3278 -0.319 0.751
M5 -6.6104 67.2588 -0.098 0.922
M6 9.7127 67.2113 0.145 0.886
M7 -33.9403 67.1407 -0.506 0.616
M8 45.1165 67.1265 0.672 0.505
M9 22.5053 67.0701 0.336 0.739
M10 -45.7538 67.1134 -0.682 0.499
M11 -109.4746 67.2620 -1.628 0.110
t 8.3828 0.9638 8.697 2.37e-11 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 106 on 47 degrees of freedom
Multiple R-squared: 0.8786, Adjusted R-squared: 0.845
F-statistic: 26.15 on 13 and 47 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,] 9.299660e-03 1.859932e-02 0.99070034
[2,] 4.536800e-03 9.073600e-03 0.99546320
[3,] 1.312350e-03 2.624701e-03 0.99868765
[4,] 7.010307e-04 1.402061e-03 0.99929897
[5,] 1.424305e-04 2.848609e-04 0.99985757
[6,] 1.331017e-03 2.662034e-03 0.99866898
[7,] 7.982030e-04 1.596406e-03 0.99920180
[8,] 4.478443e-04 8.956886e-04 0.99955216
[9,] 1.030409e-03 2.060818e-03 0.99896959
[10,] 5.019233e-04 1.003847e-03 0.99949808
[11,] 2.181078e-04 4.362157e-04 0.99978189
[12,] 9.041574e-05 1.808315e-04 0.99990958
[13,] 3.942714e-05 7.885427e-05 0.99996057
[14,] 1.194234e-05 2.388467e-05 0.99998806
[15,] 1.633541e-05 3.267083e-05 0.99998366
[16,] 1.622946e-05 3.245893e-05 0.99998377
[17,] 6.136574e-05 1.227315e-04 0.99993863
[18,] 1.050289e-04 2.100577e-04 0.99989497
[19,] 2.973426e-04 5.946852e-04 0.99970266
[20,] 5.013468e-03 1.002694e-02 0.99498653
[21,] 3.885964e-02 7.771927e-02 0.96114036
[22,] 1.198131e-01 2.396261e-01 0.88018694
[23,] 4.048569e-01 8.097139e-01 0.59514307
[24,] 8.173809e-01 3.652382e-01 0.18261909
[25,] 9.061919e-01 1.876161e-01 0.09380807
[26,] 8.987914e-01 2.024173e-01 0.10120863
[27,] 8.649229e-01 2.701542e-01 0.13507712
[28,] 7.607939e-01 4.784122e-01 0.23920608
> postscript(file="/var/www/html/rcomp/tmp/1i6771258554697.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/2r9i11258554697.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/3myaz1258554697.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/49b011258554697.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/5uudb1258554697.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
-260.654754 -108.303779 -71.829804 -98.796383 -149.140278 -89.959621
7 8 9 10 11 12
20.310094 -55.173042 -26.979577 13.010094 67.426550 165.963355
13 14 15 16 17 18
68.780695 -17.684012 108.619577 110.165908 65.744040 24.938628
19 20 21 22 23 24
55.230882 189.919883 70.605762 -138.877215 -2.509118 -67.966478
25 26 27 28 29 30
-21.150159 126.035755 120.131757 156.864668 55.508373 61.458905
31 32 33 34 35 36
52.472676 -80.661591 9.688329 108.607614 156.254193 -70.403167
37 38 39 40 41 42
25.956187 70.064639 -39.526448 -34.149993 -70.199213 -10.406156
43 44 45 46 47 48
-122.843516 -76.475011 -7.260029 25.759256 -154.967323 85.567951
49 50 51 52 53 54
121.535912 -70.112602 -117.395082 -134.084199 98.087078 13.968245
55 56 57 58 59 60
-5.170136 22.389762 -46.054484 -8.499750 -66.204302 -113.161661
61
65.532120
> postscript(file="/var/www/html/rcomp/tmp/6i1o31258554697.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 -260.654754 NA
1 -108.303779 -260.654754
2 -71.829804 -108.303779
3 -98.796383 -71.829804
4 -149.140278 -98.796383
5 -89.959621 -149.140278
6 20.310094 -89.959621
7 -55.173042 20.310094
8 -26.979577 -55.173042
9 13.010094 -26.979577
10 67.426550 13.010094
11 165.963355 67.426550
12 68.780695 165.963355
13 -17.684012 68.780695
14 108.619577 -17.684012
15 110.165908 108.619577
16 65.744040 110.165908
17 24.938628 65.744040
18 55.230882 24.938628
19 189.919883 55.230882
20 70.605762 189.919883
21 -138.877215 70.605762
22 -2.509118 -138.877215
23 -67.966478 -2.509118
24 -21.150159 -67.966478
25 126.035755 -21.150159
26 120.131757 126.035755
27 156.864668 120.131757
28 55.508373 156.864668
29 61.458905 55.508373
30 52.472676 61.458905
31 -80.661591 52.472676
32 9.688329 -80.661591
33 108.607614 9.688329
34 156.254193 108.607614
35 -70.403167 156.254193
36 25.956187 -70.403167
37 70.064639 25.956187
38 -39.526448 70.064639
39 -34.149993 -39.526448
40 -70.199213 -34.149993
41 -10.406156 -70.199213
42 -122.843516 -10.406156
43 -76.475011 -122.843516
44 -7.260029 -76.475011
45 25.759256 -7.260029
46 -154.967323 25.759256
47 85.567951 -154.967323
48 121.535912 85.567951
49 -70.112602 121.535912
50 -117.395082 -70.112602
51 -134.084199 -117.395082
52 98.087078 -134.084199
53 13.968245 98.087078
54 -5.170136 13.968245
55 22.389762 -5.170136
56 -46.054484 22.389762
57 -8.499750 -46.054484
58 -66.204302 -8.499750
59 -113.161661 -66.204302
60 65.532120 -113.161661
61 NA 65.532120
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -108.303779 -260.654754
[2,] -71.829804 -108.303779
[3,] -98.796383 -71.829804
[4,] -149.140278 -98.796383
[5,] -89.959621 -149.140278
[6,] 20.310094 -89.959621
[7,] -55.173042 20.310094
[8,] -26.979577 -55.173042
[9,] 13.010094 -26.979577
[10,] 67.426550 13.010094
[11,] 165.963355 67.426550
[12,] 68.780695 165.963355
[13,] -17.684012 68.780695
[14,] 108.619577 -17.684012
[15,] 110.165908 108.619577
[16,] 65.744040 110.165908
[17,] 24.938628 65.744040
[18,] 55.230882 24.938628
[19,] 189.919883 55.230882
[20,] 70.605762 189.919883
[21,] -138.877215 70.605762
[22,] -2.509118 -138.877215
[23,] -67.966478 -2.509118
[24,] -21.150159 -67.966478
[25,] 126.035755 -21.150159
[26,] 120.131757 126.035755
[27,] 156.864668 120.131757
[28,] 55.508373 156.864668
[29,] 61.458905 55.508373
[30,] 52.472676 61.458905
[31,] -80.661591 52.472676
[32,] 9.688329 -80.661591
[33,] 108.607614 9.688329
[34,] 156.254193 108.607614
[35,] -70.403167 156.254193
[36,] 25.956187 -70.403167
[37,] 70.064639 25.956187
[38,] -39.526448 70.064639
[39,] -34.149993 -39.526448
[40,] -70.199213 -34.149993
[41,] -10.406156 -70.199213
[42,] -122.843516 -10.406156
[43,] -76.475011 -122.843516
[44,] -7.260029 -76.475011
[45,] 25.759256 -7.260029
[46,] -154.967323 25.759256
[47,] 85.567951 -154.967323
[48,] 121.535912 85.567951
[49,] -70.112602 121.535912
[50,] -117.395082 -70.112602
[51,] -134.084199 -117.395082
[52,] 98.087078 -134.084199
[53,] 13.968245 98.087078
[54,] -5.170136 13.968245
[55,] 22.389762 -5.170136
[56,] -46.054484 22.389762
[57,] -8.499750 -46.054484
[58,] -66.204302 -8.499750
[59,] -113.161661 -66.204302
[60,] 65.532120 -113.161661
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -108.303779 -260.654754
2 -71.829804 -108.303779
3 -98.796383 -71.829804
4 -149.140278 -98.796383
5 -89.959621 -149.140278
6 20.310094 -89.959621
7 -55.173042 20.310094
8 -26.979577 -55.173042
9 13.010094 -26.979577
10 67.426550 13.010094
11 165.963355 67.426550
12 68.780695 165.963355
13 -17.684012 68.780695
14 108.619577 -17.684012
15 110.165908 108.619577
16 65.744040 110.165908
17 24.938628 65.744040
18 55.230882 24.938628
19 189.919883 55.230882
20 70.605762 189.919883
21 -138.877215 70.605762
22 -2.509118 -138.877215
23 -67.966478 -2.509118
24 -21.150159 -67.966478
25 126.035755 -21.150159
26 120.131757 126.035755
27 156.864668 120.131757
28 55.508373 156.864668
29 61.458905 55.508373
30 52.472676 61.458905
31 -80.661591 52.472676
32 9.688329 -80.661591
33 108.607614 9.688329
34 156.254193 108.607614
35 -70.403167 156.254193
36 25.956187 -70.403167
37 70.064639 25.956187
38 -39.526448 70.064639
39 -34.149993 -39.526448
40 -70.199213 -34.149993
41 -10.406156 -70.199213
42 -122.843516 -10.406156
43 -76.475011 -122.843516
44 -7.260029 -76.475011
45 25.759256 -7.260029
46 -154.967323 25.759256
47 85.567951 -154.967323
48 121.535912 85.567951
49 -70.112602 121.535912
50 -117.395082 -70.112602
51 -134.084199 -117.395082
52 98.087078 -134.084199
53 13.968245 98.087078
54 -5.170136 13.968245
55 22.389762 -5.170136
56 -46.054484 22.389762
57 -8.499750 -46.054484
58 -66.204302 -8.499750
59 -113.161661 -66.204302
60 65.532120 -113.161661
> 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/7v5y91258554697.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/8xqte1258554697.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/9g6p01258554697.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/10jrkd1258554697.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/11m5om1258554697.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/12qak81258554697.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/13jfy01258554697.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/14vxp71258554697.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/15gmtk1258554697.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/16fxyz1258554697.tab")
+ }
>
> system("convert tmp/1i6771258554697.ps tmp/1i6771258554697.png")
> system("convert tmp/2r9i11258554697.ps tmp/2r9i11258554697.png")
> system("convert tmp/3myaz1258554697.ps tmp/3myaz1258554697.png")
> system("convert tmp/49b011258554697.ps tmp/49b011258554697.png")
> system("convert tmp/5uudb1258554697.ps tmp/5uudb1258554697.png")
> system("convert tmp/6i1o31258554697.ps tmp/6i1o31258554697.png")
> system("convert tmp/7v5y91258554697.ps tmp/7v5y91258554697.png")
> system("convert tmp/8xqte1258554697.ps tmp/8xqte1258554697.png")
> system("convert tmp/9g6p01258554697.ps tmp/9g6p01258554697.png")
> system("convert tmp/10jrkd1258554697.ps tmp/10jrkd1258554697.png")
>
>
> proc.time()
user system elapsed
2.402 1.555 2.889