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(8.00,96.80,8.10,114.10,7.70,110.30,7.50,103.90,7.60,101.60,7.80,94.60,7.80,95.90,7.80,104.70,7.50,102.80,7.50,98.10,7.10,113.90,7.50,80.90,7.50,95.70,7.60,113.20,7.70,105.90,7.70,108.80,7.90,102.30,8.10,99.00,8.20,100.70,8.20,115.50,8.20,100.70,7.90,109.90,7.30,114.60,6.90,85.40,6.60,100.50,6.70,114.80,6.90,116.50,7.00,112.90,7.10,102.00,7.20,106.00,7.10,105.30,6.90,118.80,7.00,106.10,6.80,109.30,6.40,117.20,6.70,92.50,6.60,104.20,6.40,112.50,6.30,122.40,6.20,113.30,6.50,100.00,6.80,110.70,6.80,112.80,6.40,109.80,6.10,117.30,5.80,109.10,6.10,115.90,7.20,96.00,7.30,99.80,6.90,116.80,6.10,115.70,5.80,99.40,6.20,94.30,7.10,91.00,7.70,93.20,7.90,103.10,7.70,94.10,7.40,91.80,7.50,102.70,8.00,82.60),dim=c(2,60),dimnames=list(c('Wman','Ecogr'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Wman','Ecogr'),1:60))
> 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
Wman Ecogr M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 8.0 96.8 1 0 0 0 0 0 0 0 0 0 0 1
2 8.1 114.1 0 1 0 0 0 0 0 0 0 0 0 2
3 7.7 110.3 0 0 1 0 0 0 0 0 0 0 0 3
4 7.5 103.9 0 0 0 1 0 0 0 0 0 0 0 4
5 7.6 101.6 0 0 0 0 1 0 0 0 0 0 0 5
6 7.8 94.6 0 0 0 0 0 1 0 0 0 0 0 6
7 7.8 95.9 0 0 0 0 0 0 1 0 0 0 0 7
8 7.8 104.7 0 0 0 0 0 0 0 1 0 0 0 8
9 7.5 102.8 0 0 0 0 0 0 0 0 1 0 0 9
10 7.5 98.1 0 0 0 0 0 0 0 0 0 1 0 10
11 7.1 113.9 0 0 0 0 0 0 0 0 0 0 1 11
12 7.5 80.9 0 0 0 0 0 0 0 0 0 0 0 12
13 7.5 95.7 1 0 0 0 0 0 0 0 0 0 0 13
14 7.6 113.2 0 1 0 0 0 0 0 0 0 0 0 14
15 7.7 105.9 0 0 1 0 0 0 0 0 0 0 0 15
16 7.7 108.8 0 0 0 1 0 0 0 0 0 0 0 16
17 7.9 102.3 0 0 0 0 1 0 0 0 0 0 0 17
18 8.1 99.0 0 0 0 0 0 1 0 0 0 0 0 18
19 8.2 100.7 0 0 0 0 0 0 1 0 0 0 0 19
20 8.2 115.5 0 0 0 0 0 0 0 1 0 0 0 20
21 8.2 100.7 0 0 0 0 0 0 0 0 1 0 0 21
22 7.9 109.9 0 0 0 0 0 0 0 0 0 1 0 22
23 7.3 114.6 0 0 0 0 0 0 0 0 0 0 1 23
24 6.9 85.4 0 0 0 0 0 0 0 0 0 0 0 24
25 6.6 100.5 1 0 0 0 0 0 0 0 0 0 0 25
26 6.7 114.8 0 1 0 0 0 0 0 0 0 0 0 26
27 6.9 116.5 0 0 1 0 0 0 0 0 0 0 0 27
28 7.0 112.9 0 0 0 1 0 0 0 0 0 0 0 28
29 7.1 102.0 0 0 0 0 1 0 0 0 0 0 0 29
30 7.2 106.0 0 0 0 0 0 1 0 0 0 0 0 30
31 7.1 105.3 0 0 0 0 0 0 1 0 0 0 0 31
32 6.9 118.8 0 0 0 0 0 0 0 1 0 0 0 32
33 7.0 106.1 0 0 0 0 0 0 0 0 1 0 0 33
34 6.8 109.3 0 0 0 0 0 0 0 0 0 1 0 34
35 6.4 117.2 0 0 0 0 0 0 0 0 0 0 1 35
36 6.7 92.5 0 0 0 0 0 0 0 0 0 0 0 36
37 6.6 104.2 1 0 0 0 0 0 0 0 0 0 0 37
38 6.4 112.5 0 1 0 0 0 0 0 0 0 0 0 38
39 6.3 122.4 0 0 1 0 0 0 0 0 0 0 0 39
40 6.2 113.3 0 0 0 1 0 0 0 0 0 0 0 40
41 6.5 100.0 0 0 0 0 1 0 0 0 0 0 0 41
42 6.8 110.7 0 0 0 0 0 1 0 0 0 0 0 42
43 6.8 112.8 0 0 0 0 0 0 1 0 0 0 0 43
44 6.4 109.8 0 0 0 0 0 0 0 1 0 0 0 44
45 6.1 117.3 0 0 0 0 0 0 0 0 1 0 0 45
46 5.8 109.1 0 0 0 0 0 0 0 0 0 1 0 46
47 6.1 115.9 0 0 0 0 0 0 0 0 0 0 1 47
48 7.2 96.0 0 0 0 0 0 0 0 0 0 0 0 48
49 7.3 99.8 1 0 0 0 0 0 0 0 0 0 0 49
50 6.9 116.8 0 1 0 0 0 0 0 0 0 0 0 50
51 6.1 115.7 0 0 1 0 0 0 0 0 0 0 0 51
52 5.8 99.4 0 0 0 1 0 0 0 0 0 0 0 52
53 6.2 94.3 0 0 0 0 1 0 0 0 0 0 0 53
54 7.1 91.0 0 0 0 0 0 1 0 0 0 0 0 54
55 7.7 93.2 0 0 0 0 0 0 1 0 0 0 0 55
56 7.9 103.1 0 0 0 0 0 0 0 1 0 0 0 56
57 7.7 94.1 0 0 0 0 0 0 0 0 1 0 0 57
58 7.4 91.8 0 0 0 0 0 0 0 0 0 1 0 58
59 7.5 102.7 0 0 0 0 0 0 0 0 0 0 1 59
60 8.0 82.6 0 0 0 0 0 0 0 0 0 0 0 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Ecogr M1 M2 M3 M4
11.84162 -0.04428 0.25138 0.86990 0.68426 0.31613
M5 M6 M7 M8 M9 M10
0.21841 0.58782 0.78594 1.11526 0.72130 0.49617
M11 t
0.72408 -0.01967
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.933565 -0.327805 -0.008259 0.355811 0.996092
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 11.841623 1.050389 11.274 7.85e-15 ***
Ecogr -0.044277 0.011625 -3.809 0.000412 ***
M1 0.251376 0.356335 0.705 0.484088
M2 0.869895 0.452407 1.923 0.060707 .
M3 0.684255 0.451090 1.517 0.136136
M4 0.316127 0.402454 0.785 0.436189
M5 0.218408 0.357688 0.611 0.544463
M6 0.587822 0.358444 1.640 0.107842
M7 0.785942 0.364831 2.154 0.036492 *
M8 1.115255 0.420702 2.651 0.010972 *
M9 0.721295 0.379138 1.902 0.063382 .
M10 0.496173 0.375714 1.321 0.193162
M11 0.724083 0.439165 1.649 0.106008
t -0.019674 0.003912 -5.029 7.98e-06 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.5142 on 46 degrees of freedom
Multiple R-squared: 0.5234, Adjusted R-squared: 0.3887
F-statistic: 3.886 on 13 and 46 DF, p-value: 0.0003082
> 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.14742962 0.29485924 0.8525704
[2,] 0.06375253 0.12750505 0.9362475
[3,] 0.02631989 0.05263978 0.9736801
[4,] 0.01285379 0.02570758 0.9871462
[5,] 0.03930575 0.07861151 0.9606942
[6,] 0.03074172 0.06148344 0.9692583
[7,] 0.01683626 0.03367251 0.9831637
[8,] 0.04347805 0.08695610 0.9565219
[9,] 0.22670521 0.45341042 0.7732948
[10,] 0.28445486 0.56890972 0.7155451
[11,] 0.26824918 0.53649835 0.7317508
[12,] 0.31855990 0.63711980 0.6814401
[13,] 0.33460067 0.66920133 0.6653993
[14,] 0.31302856 0.62605713 0.6869714
[15,] 0.26103951 0.52207902 0.7389605
[16,] 0.25360482 0.50720965 0.7463952
[17,] 0.20160415 0.40320830 0.7983958
[18,] 0.23794845 0.47589690 0.7620515
[19,] 0.18663032 0.37326064 0.8133697
[20,] 0.12938551 0.25877102 0.8706145
[21,] 0.08402143 0.16804286 0.9159786
[22,] 0.06267038 0.12534077 0.9373296
[23,] 0.05189402 0.10378805 0.9481060
[24,] 0.12961623 0.25923246 0.8703838
[25,] 0.38159215 0.76318431 0.6184078
[26,] 0.64130640 0.71738721 0.3586936
[27,] 0.63996380 0.72007241 0.3600362
> postscript(file="/var/www/html/rcomp/tmp/1exho1258562316.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/2hgi21258562316.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/31krw1258562316.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/47bz31258562316.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/5xejj1258562316.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 = 60
Frequency = 1
1 2 3 4 5 6
0.21271397 0.47986495 0.11692462 0.02135234 0.13690739 -0.32277446
7 8 9 10 11 12
-0.44366000 -0.36366000 -0.33415331 -0.29746118 -0.20611679 -0.52350954
13 14 15 16 17 18
-0.09990845 0.17609798 0.15818723 0.67439351 0.70398404 0.40812808
19 20 21 22 23 24
0.40495344 0.75061702 0.50894701 0.86109310 0.26095987 -0.68817928
25 26 27 28 29 30
-0.55129501 -0.41697582 0.06360880 0.39201286 0.12678344 0.05415149
31 32 33 34 35 36
-0.25528858 -0.16718544 -0.21587320 -0.02939069 -0.28783668 -0.33772814
37 38 39 40 41 42
-0.15138656 -0.58273096 -0.03907278 -0.15419366 -0.32568852 0.09833720
43 44 45 46 47 48
0.01287347 -0.82959824 -0.38388528 -0.80216357 -0.40931455 0.55332486
49 50 51 52 53 54
0.58987605 0.34374385 -0.29964787 -0.93356505 -0.64198635 -0.23784232
55 56 57 58 59 60
0.28112168 0.60982667 0.42496478 0.26792234 0.64230815 0.99609210
> postscript(file="/var/www/html/rcomp/tmp/6wz5q1258562316.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 = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 0.21271397 NA
1 0.47986495 0.21271397
2 0.11692462 0.47986495
3 0.02135234 0.11692462
4 0.13690739 0.02135234
5 -0.32277446 0.13690739
6 -0.44366000 -0.32277446
7 -0.36366000 -0.44366000
8 -0.33415331 -0.36366000
9 -0.29746118 -0.33415331
10 -0.20611679 -0.29746118
11 -0.52350954 -0.20611679
12 -0.09990845 -0.52350954
13 0.17609798 -0.09990845
14 0.15818723 0.17609798
15 0.67439351 0.15818723
16 0.70398404 0.67439351
17 0.40812808 0.70398404
18 0.40495344 0.40812808
19 0.75061702 0.40495344
20 0.50894701 0.75061702
21 0.86109310 0.50894701
22 0.26095987 0.86109310
23 -0.68817928 0.26095987
24 -0.55129501 -0.68817928
25 -0.41697582 -0.55129501
26 0.06360880 -0.41697582
27 0.39201286 0.06360880
28 0.12678344 0.39201286
29 0.05415149 0.12678344
30 -0.25528858 0.05415149
31 -0.16718544 -0.25528858
32 -0.21587320 -0.16718544
33 -0.02939069 -0.21587320
34 -0.28783668 -0.02939069
35 -0.33772814 -0.28783668
36 -0.15138656 -0.33772814
37 -0.58273096 -0.15138656
38 -0.03907278 -0.58273096
39 -0.15419366 -0.03907278
40 -0.32568852 -0.15419366
41 0.09833720 -0.32568852
42 0.01287347 0.09833720
43 -0.82959824 0.01287347
44 -0.38388528 -0.82959824
45 -0.80216357 -0.38388528
46 -0.40931455 -0.80216357
47 0.55332486 -0.40931455
48 0.58987605 0.55332486
49 0.34374385 0.58987605
50 -0.29964787 0.34374385
51 -0.93356505 -0.29964787
52 -0.64198635 -0.93356505
53 -0.23784232 -0.64198635
54 0.28112168 -0.23784232
55 0.60982667 0.28112168
56 0.42496478 0.60982667
57 0.26792234 0.42496478
58 0.64230815 0.26792234
59 0.99609210 0.64230815
60 NA 0.99609210
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.47986495 0.21271397
[2,] 0.11692462 0.47986495
[3,] 0.02135234 0.11692462
[4,] 0.13690739 0.02135234
[5,] -0.32277446 0.13690739
[6,] -0.44366000 -0.32277446
[7,] -0.36366000 -0.44366000
[8,] -0.33415331 -0.36366000
[9,] -0.29746118 -0.33415331
[10,] -0.20611679 -0.29746118
[11,] -0.52350954 -0.20611679
[12,] -0.09990845 -0.52350954
[13,] 0.17609798 -0.09990845
[14,] 0.15818723 0.17609798
[15,] 0.67439351 0.15818723
[16,] 0.70398404 0.67439351
[17,] 0.40812808 0.70398404
[18,] 0.40495344 0.40812808
[19,] 0.75061702 0.40495344
[20,] 0.50894701 0.75061702
[21,] 0.86109310 0.50894701
[22,] 0.26095987 0.86109310
[23,] -0.68817928 0.26095987
[24,] -0.55129501 -0.68817928
[25,] -0.41697582 -0.55129501
[26,] 0.06360880 -0.41697582
[27,] 0.39201286 0.06360880
[28,] 0.12678344 0.39201286
[29,] 0.05415149 0.12678344
[30,] -0.25528858 0.05415149
[31,] -0.16718544 -0.25528858
[32,] -0.21587320 -0.16718544
[33,] -0.02939069 -0.21587320
[34,] -0.28783668 -0.02939069
[35,] -0.33772814 -0.28783668
[36,] -0.15138656 -0.33772814
[37,] -0.58273096 -0.15138656
[38,] -0.03907278 -0.58273096
[39,] -0.15419366 -0.03907278
[40,] -0.32568852 -0.15419366
[41,] 0.09833720 -0.32568852
[42,] 0.01287347 0.09833720
[43,] -0.82959824 0.01287347
[44,] -0.38388528 -0.82959824
[45,] -0.80216357 -0.38388528
[46,] -0.40931455 -0.80216357
[47,] 0.55332486 -0.40931455
[48,] 0.58987605 0.55332486
[49,] 0.34374385 0.58987605
[50,] -0.29964787 0.34374385
[51,] -0.93356505 -0.29964787
[52,] -0.64198635 -0.93356505
[53,] -0.23784232 -0.64198635
[54,] 0.28112168 -0.23784232
[55,] 0.60982667 0.28112168
[56,] 0.42496478 0.60982667
[57,] 0.26792234 0.42496478
[58,] 0.64230815 0.26792234
[59,] 0.99609210 0.64230815
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.47986495 0.21271397
2 0.11692462 0.47986495
3 0.02135234 0.11692462
4 0.13690739 0.02135234
5 -0.32277446 0.13690739
6 -0.44366000 -0.32277446
7 -0.36366000 -0.44366000
8 -0.33415331 -0.36366000
9 -0.29746118 -0.33415331
10 -0.20611679 -0.29746118
11 -0.52350954 -0.20611679
12 -0.09990845 -0.52350954
13 0.17609798 -0.09990845
14 0.15818723 0.17609798
15 0.67439351 0.15818723
16 0.70398404 0.67439351
17 0.40812808 0.70398404
18 0.40495344 0.40812808
19 0.75061702 0.40495344
20 0.50894701 0.75061702
21 0.86109310 0.50894701
22 0.26095987 0.86109310
23 -0.68817928 0.26095987
24 -0.55129501 -0.68817928
25 -0.41697582 -0.55129501
26 0.06360880 -0.41697582
27 0.39201286 0.06360880
28 0.12678344 0.39201286
29 0.05415149 0.12678344
30 -0.25528858 0.05415149
31 -0.16718544 -0.25528858
32 -0.21587320 -0.16718544
33 -0.02939069 -0.21587320
34 -0.28783668 -0.02939069
35 -0.33772814 -0.28783668
36 -0.15138656 -0.33772814
37 -0.58273096 -0.15138656
38 -0.03907278 -0.58273096
39 -0.15419366 -0.03907278
40 -0.32568852 -0.15419366
41 0.09833720 -0.32568852
42 0.01287347 0.09833720
43 -0.82959824 0.01287347
44 -0.38388528 -0.82959824
45 -0.80216357 -0.38388528
46 -0.40931455 -0.80216357
47 0.55332486 -0.40931455
48 0.58987605 0.55332486
49 0.34374385 0.58987605
50 -0.29964787 0.34374385
51 -0.93356505 -0.29964787
52 -0.64198635 -0.93356505
53 -0.23784232 -0.64198635
54 0.28112168 -0.23784232
55 0.60982667 0.28112168
56 0.42496478 0.60982667
57 0.26792234 0.42496478
58 0.64230815 0.26792234
59 0.99609210 0.64230815
> 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/7wnjk1258562316.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/8m7sf1258562316.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/9rhm81258562316.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/1054l71258562316.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/11qo561258562316.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/12blk41258562316.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/13nrjg1258562316.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/14ec5w1258562316.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/15j5eg1258562316.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/160mze1258562316.tab")
+ }
>
> system("convert tmp/1exho1258562316.ps tmp/1exho1258562316.png")
> system("convert tmp/2hgi21258562316.ps tmp/2hgi21258562316.png")
> system("convert tmp/31krw1258562316.ps tmp/31krw1258562316.png")
> system("convert tmp/47bz31258562316.ps tmp/47bz31258562316.png")
> system("convert tmp/5xejj1258562316.ps tmp/5xejj1258562316.png")
> system("convert tmp/6wz5q1258562316.ps tmp/6wz5q1258562316.png")
> system("convert tmp/7wnjk1258562316.ps tmp/7wnjk1258562316.png")
> system("convert tmp/8m7sf1258562316.ps tmp/8m7sf1258562316.png")
> system("convert tmp/9rhm81258562316.ps tmp/9rhm81258562316.png")
> system("convert tmp/1054l71258562316.ps tmp/1054l71258562316.png")
>
>
> proc.time()
user system elapsed
2.436 1.595 2.889