R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-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(9.829,9.125,9.782,9.441,9.162,9.915,10.444,10.209,9.985,9.842,9.429,10.132,9.849,9.172,10.313,9.819,9.955,10.048,10.082,10.541,10.208,10.233,9.439,9.963,10.158,9.225,10.474,9.757,10.490,10.281,10.444,10.640,10.695,10.786,9.832,9.747,10.411,9.511,10.402,9.701,10.540,10.112,10.915,11.183,10.384,10.834,9.886,10.216,10.943,9.867,10.203,10.837,10.573,10.647,11.502,10.656,10.866,10.835,9.945,10.331),dim=c(1,60),dimnames=list(c('Births'),1:60))
> y <- array(NA,dim=c(1,60),dimnames=list(c('Births'),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
> 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
Births M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 9.829 1 0 0 0 0 0 0 0 0 0 0 1
2 9.125 0 1 0 0 0 0 0 0 0 0 0 2
3 9.782 0 0 1 0 0 0 0 0 0 0 0 3
4 9.441 0 0 0 1 0 0 0 0 0 0 0 4
5 9.162 0 0 0 0 1 0 0 0 0 0 0 5
6 9.915 0 0 0 0 0 1 0 0 0 0 0 6
7 10.444 0 0 0 0 0 0 1 0 0 0 0 7
8 10.209 0 0 0 0 0 0 0 1 0 0 0 8
9 9.985 0 0 0 0 0 0 0 0 1 0 0 9
10 9.842 0 0 0 0 0 0 0 0 0 1 0 10
11 9.429 0 0 0 0 0 0 0 0 0 0 1 11
12 10.132 0 0 0 0 0 0 0 0 0 0 0 12
13 9.849 1 0 0 0 0 0 0 0 0 0 0 13
14 9.172 0 1 0 0 0 0 0 0 0 0 0 14
15 10.313 0 0 1 0 0 0 0 0 0 0 0 15
16 9.819 0 0 0 1 0 0 0 0 0 0 0 16
17 9.955 0 0 0 0 1 0 0 0 0 0 0 17
18 10.048 0 0 0 0 0 1 0 0 0 0 0 18
19 10.082 0 0 0 0 0 0 1 0 0 0 0 19
20 10.541 0 0 0 0 0 0 0 1 0 0 0 20
21 10.208 0 0 0 0 0 0 0 0 1 0 0 21
22 10.233 0 0 0 0 0 0 0 0 0 1 0 22
23 9.439 0 0 0 0 0 0 0 0 0 0 1 23
24 9.963 0 0 0 0 0 0 0 0 0 0 0 24
25 10.158 1 0 0 0 0 0 0 0 0 0 0 25
26 9.225 0 1 0 0 0 0 0 0 0 0 0 26
27 10.474 0 0 1 0 0 0 0 0 0 0 0 27
28 9.757 0 0 0 1 0 0 0 0 0 0 0 28
29 10.490 0 0 0 0 1 0 0 0 0 0 0 29
30 10.281 0 0 0 0 0 1 0 0 0 0 0 30
31 10.444 0 0 0 0 0 0 1 0 0 0 0 31
32 10.640 0 0 0 0 0 0 0 1 0 0 0 32
33 10.695 0 0 0 0 0 0 0 0 1 0 0 33
34 10.786 0 0 0 0 0 0 0 0 0 1 0 34
35 9.832 0 0 0 0 0 0 0 0 0 0 1 35
36 9.747 0 0 0 0 0 0 0 0 0 0 0 36
37 10.411 1 0 0 0 0 0 0 0 0 0 0 37
38 9.511 0 1 0 0 0 0 0 0 0 0 0 38
39 10.402 0 0 1 0 0 0 0 0 0 0 0 39
40 9.701 0 0 0 1 0 0 0 0 0 0 0 40
41 10.540 0 0 0 0 1 0 0 0 0 0 0 41
42 10.112 0 0 0 0 0 1 0 0 0 0 0 42
43 10.915 0 0 0 0 0 0 1 0 0 0 0 43
44 11.183 0 0 0 0 0 0 0 1 0 0 0 44
45 10.384 0 0 0 0 0 0 0 0 1 0 0 45
46 10.834 0 0 0 0 0 0 0 0 0 1 0 46
47 9.886 0 0 0 0 0 0 0 0 0 0 1 47
48 10.216 0 0 0 0 0 0 0 0 0 0 0 48
49 10.943 1 0 0 0 0 0 0 0 0 0 0 49
50 9.867 0 1 0 0 0 0 0 0 0 0 0 50
51 10.203 0 0 1 0 0 0 0 0 0 0 0 51
52 10.837 0 0 0 1 0 0 0 0 0 0 0 52
53 10.573 0 0 0 0 1 0 0 0 0 0 0 53
54 10.647 0 0 0 0 0 1 0 0 0 0 0 54
55 11.502 0 0 0 0 0 0 1 0 0 0 0 55
56 10.656 0 0 0 0 0 0 0 1 0 0 0 56
57 10.866 0 0 0 0 0 0 0 0 1 0 0 57
58 10.835 0 0 0 0 0 0 0 0 0 1 0 58
59 9.945 0 0 0 0 0 0 0 0 0 0 1 59
60 10.331 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) M1 M2 M3 M4 M5
9.47047 0.34577 -0.52910 0.30883 -0.03184 0.18429
M6 M7 M8 M9 M10 M11
0.22402 0.68395 0.63548 0.40041 0.46194 -0.35473
t
0.01687
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.57712 -0.09792 -0.00568 0.12562 0.52112
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.470475 0.133009 71.202 < 2e-16 ***
M1 0.345772 0.161813 2.137 0.037845 *
M2 -0.529099 0.161571 -3.275 0.001990 **
M3 0.308831 0.161352 1.914 0.061718 .
M4 -0.031839 0.161156 -0.198 0.844237
M5 0.184291 0.160983 1.145 0.258094
M6 0.224021 0.160832 1.393 0.170209
M7 0.683951 0.160705 4.256 9.86e-05 ***
M8 0.635481 0.160601 3.957 0.000255 ***
M9 0.400410 0.160520 2.494 0.016188 *
M10 0.461940 0.160462 2.879 0.005990 **
M11 -0.354730 0.160427 -2.211 0.031925 *
t 0.016870 0.001929 8.743 2.03e-11 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2536 on 47 degrees of freedom
Multiple R-squared: 0.8096, Adjusted R-squared: 0.761
F-statistic: 16.65 on 12 and 47 DF, p-value: 4.677e-13
> 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.30998885 0.6199777 0.6900111
[2,] 0.47794872 0.9558974 0.5220513
[3,] 0.37110004 0.7422001 0.6289000
[4,] 0.62839748 0.7432050 0.3716025
[5,] 0.51332256 0.9733549 0.4866774
[6,] 0.39233465 0.7846693 0.6076653
[7,] 0.30908114 0.6181623 0.6909189
[8,] 0.24651445 0.4930289 0.7534856
[9,] 0.25103494 0.5020699 0.7489651
[10,] 0.18362648 0.3672530 0.8163735
[11,] 0.14648188 0.2929638 0.8535181
[12,] 0.13590450 0.2718090 0.8640955
[13,] 0.10246665 0.2049333 0.8975333
[14,] 0.22171031 0.4434206 0.7782897
[15,] 0.16521595 0.3304319 0.8347840
[16,] 0.16658505 0.3331701 0.8334149
[17,] 0.11267081 0.2253416 0.8873292
[18,] 0.11352484 0.2270497 0.8864752
[19,] 0.12592727 0.2518545 0.8740727
[20,] 0.09961009 0.1992202 0.9003899
[21,] 0.14817483 0.2963497 0.8518252
[22,] 0.10979757 0.2195951 0.8902024
[23,] 0.07094476 0.1418895 0.9290552
[24,] 0.06731526 0.1346305 0.9326847
[25,] 0.30758339 0.6151668 0.6924166
[26,] 0.23717111 0.4743422 0.7628289
[27,] 0.24971139 0.4994228 0.7502886
[28,] 0.33493977 0.6698795 0.6650602
[29,] 0.73807174 0.5238565 0.2619283
> postscript(file="/var/wessaorg/rcomp/tmp/1hyti1322252532.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/wessaorg/rcomp/tmp/2qi1r1322252532.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/wessaorg/rcomp/tmp/31rsa1322252532.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/wessaorg/rcomp/tmp/4gjz51322252532.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/wessaorg/rcomp/tmp/5e01v1322252532.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 = 60
Frequency = 1
1 2 3 4 5 6
-0.004116667 0.149883333 -0.047916667 -0.065116667 -0.577116667 0.119283333
7 8 9 10 11 12
0.171483333 -0.031916667 -0.037716667 -0.259116667 0.127683333 0.459083333
13 14 15 16 17 18
-0.186558333 -0.005558333 0.280641667 0.110441667 0.013441667 0.049841667
19 20 21 22 23 24
-0.392958333 0.097641667 -0.017158333 -0.070558333 -0.064758333 0.087641667
25 26 27 28 29 30
-0.080000000 -0.155000000 0.239200000 -0.154000000 0.346000000 0.080400000
31 32 33 34 35 36
-0.233400000 -0.005800000 0.267400000 0.280000000 0.125800000 -0.330800000
37 38 39 40 41 42
-0.029441667 -0.071441667 -0.035241667 -0.412441667 0.193558333 -0.291041667
43 44 45 46 47 48
0.035158333 0.334758333 -0.246041667 0.125558333 -0.022641667 -0.064241667
49 50 51 52 53 54
0.300116667 0.082116667 -0.436683333 0.521116667 0.024116667 0.041516667
55 56 57 58 59 60
0.419716667 -0.394683333 0.033516667 -0.075883333 -0.166083333 -0.151683333
> postscript(file="/var/wessaorg/rcomp/tmp/6w3z71322252532.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 = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.004116667 NA
1 0.149883333 -0.004116667
2 -0.047916667 0.149883333
3 -0.065116667 -0.047916667
4 -0.577116667 -0.065116667
5 0.119283333 -0.577116667
6 0.171483333 0.119283333
7 -0.031916667 0.171483333
8 -0.037716667 -0.031916667
9 -0.259116667 -0.037716667
10 0.127683333 -0.259116667
11 0.459083333 0.127683333
12 -0.186558333 0.459083333
13 -0.005558333 -0.186558333
14 0.280641667 -0.005558333
15 0.110441667 0.280641667
16 0.013441667 0.110441667
17 0.049841667 0.013441667
18 -0.392958333 0.049841667
19 0.097641667 -0.392958333
20 -0.017158333 0.097641667
21 -0.070558333 -0.017158333
22 -0.064758333 -0.070558333
23 0.087641667 -0.064758333
24 -0.080000000 0.087641667
25 -0.155000000 -0.080000000
26 0.239200000 -0.155000000
27 -0.154000000 0.239200000
28 0.346000000 -0.154000000
29 0.080400000 0.346000000
30 -0.233400000 0.080400000
31 -0.005800000 -0.233400000
32 0.267400000 -0.005800000
33 0.280000000 0.267400000
34 0.125800000 0.280000000
35 -0.330800000 0.125800000
36 -0.029441667 -0.330800000
37 -0.071441667 -0.029441667
38 -0.035241667 -0.071441667
39 -0.412441667 -0.035241667
40 0.193558333 -0.412441667
41 -0.291041667 0.193558333
42 0.035158333 -0.291041667
43 0.334758333 0.035158333
44 -0.246041667 0.334758333
45 0.125558333 -0.246041667
46 -0.022641667 0.125558333
47 -0.064241667 -0.022641667
48 0.300116667 -0.064241667
49 0.082116667 0.300116667
50 -0.436683333 0.082116667
51 0.521116667 -0.436683333
52 0.024116667 0.521116667
53 0.041516667 0.024116667
54 0.419716667 0.041516667
55 -0.394683333 0.419716667
56 0.033516667 -0.394683333
57 -0.075883333 0.033516667
58 -0.166083333 -0.075883333
59 -0.151683333 -0.166083333
60 NA -0.151683333
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.149883333 -0.004116667
[2,] -0.047916667 0.149883333
[3,] -0.065116667 -0.047916667
[4,] -0.577116667 -0.065116667
[5,] 0.119283333 -0.577116667
[6,] 0.171483333 0.119283333
[7,] -0.031916667 0.171483333
[8,] -0.037716667 -0.031916667
[9,] -0.259116667 -0.037716667
[10,] 0.127683333 -0.259116667
[11,] 0.459083333 0.127683333
[12,] -0.186558333 0.459083333
[13,] -0.005558333 -0.186558333
[14,] 0.280641667 -0.005558333
[15,] 0.110441667 0.280641667
[16,] 0.013441667 0.110441667
[17,] 0.049841667 0.013441667
[18,] -0.392958333 0.049841667
[19,] 0.097641667 -0.392958333
[20,] -0.017158333 0.097641667
[21,] -0.070558333 -0.017158333
[22,] -0.064758333 -0.070558333
[23,] 0.087641667 -0.064758333
[24,] -0.080000000 0.087641667
[25,] -0.155000000 -0.080000000
[26,] 0.239200000 -0.155000000
[27,] -0.154000000 0.239200000
[28,] 0.346000000 -0.154000000
[29,] 0.080400000 0.346000000
[30,] -0.233400000 0.080400000
[31,] -0.005800000 -0.233400000
[32,] 0.267400000 -0.005800000
[33,] 0.280000000 0.267400000
[34,] 0.125800000 0.280000000
[35,] -0.330800000 0.125800000
[36,] -0.029441667 -0.330800000
[37,] -0.071441667 -0.029441667
[38,] -0.035241667 -0.071441667
[39,] -0.412441667 -0.035241667
[40,] 0.193558333 -0.412441667
[41,] -0.291041667 0.193558333
[42,] 0.035158333 -0.291041667
[43,] 0.334758333 0.035158333
[44,] -0.246041667 0.334758333
[45,] 0.125558333 -0.246041667
[46,] -0.022641667 0.125558333
[47,] -0.064241667 -0.022641667
[48,] 0.300116667 -0.064241667
[49,] 0.082116667 0.300116667
[50,] -0.436683333 0.082116667
[51,] 0.521116667 -0.436683333
[52,] 0.024116667 0.521116667
[53,] 0.041516667 0.024116667
[54,] 0.419716667 0.041516667
[55,] -0.394683333 0.419716667
[56,] 0.033516667 -0.394683333
[57,] -0.075883333 0.033516667
[58,] -0.166083333 -0.075883333
[59,] -0.151683333 -0.166083333
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.149883333 -0.004116667
2 -0.047916667 0.149883333
3 -0.065116667 -0.047916667
4 -0.577116667 -0.065116667
5 0.119283333 -0.577116667
6 0.171483333 0.119283333
7 -0.031916667 0.171483333
8 -0.037716667 -0.031916667
9 -0.259116667 -0.037716667
10 0.127683333 -0.259116667
11 0.459083333 0.127683333
12 -0.186558333 0.459083333
13 -0.005558333 -0.186558333
14 0.280641667 -0.005558333
15 0.110441667 0.280641667
16 0.013441667 0.110441667
17 0.049841667 0.013441667
18 -0.392958333 0.049841667
19 0.097641667 -0.392958333
20 -0.017158333 0.097641667
21 -0.070558333 -0.017158333
22 -0.064758333 -0.070558333
23 0.087641667 -0.064758333
24 -0.080000000 0.087641667
25 -0.155000000 -0.080000000
26 0.239200000 -0.155000000
27 -0.154000000 0.239200000
28 0.346000000 -0.154000000
29 0.080400000 0.346000000
30 -0.233400000 0.080400000
31 -0.005800000 -0.233400000
32 0.267400000 -0.005800000
33 0.280000000 0.267400000
34 0.125800000 0.280000000
35 -0.330800000 0.125800000
36 -0.029441667 -0.330800000
37 -0.071441667 -0.029441667
38 -0.035241667 -0.071441667
39 -0.412441667 -0.035241667
40 0.193558333 -0.412441667
41 -0.291041667 0.193558333
42 0.035158333 -0.291041667
43 0.334758333 0.035158333
44 -0.246041667 0.334758333
45 0.125558333 -0.246041667
46 -0.022641667 0.125558333
47 -0.064241667 -0.022641667
48 0.300116667 -0.064241667
49 0.082116667 0.300116667
50 -0.436683333 0.082116667
51 0.521116667 -0.436683333
52 0.024116667 0.521116667
53 0.041516667 0.024116667
54 0.419716667 0.041516667
55 -0.394683333 0.419716667
56 0.033516667 -0.394683333
57 -0.075883333 0.033516667
58 -0.166083333 -0.075883333
59 -0.151683333 -0.166083333
> 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/wessaorg/rcomp/tmp/718e01322252532.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/wessaorg/rcomp/tmp/8593m1322252532.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/wessaorg/rcomp/tmp/97w5y1322252532.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/wessaorg/rcomp/tmp/10f6ph1322252532.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/11xire1322252532.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/wessaorg/rcomp/tmp/121rkf1322252532.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/wessaorg/rcomp/tmp/13rlbo1322252532.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/wessaorg/rcomp/tmp/14obvq1322252532.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/wessaorg/rcomp/tmp/15k9qp1322252533.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/wessaorg/rcomp/tmp/16iucq1322252533.tab")
+ }
>
> try(system("convert tmp/1hyti1322252532.ps tmp/1hyti1322252532.png",intern=TRUE))
character(0)
> try(system("convert tmp/2qi1r1322252532.ps tmp/2qi1r1322252532.png",intern=TRUE))
character(0)
> try(system("convert tmp/31rsa1322252532.ps tmp/31rsa1322252532.png",intern=TRUE))
character(0)
> try(system("convert tmp/4gjz51322252532.ps tmp/4gjz51322252532.png",intern=TRUE))
character(0)
> try(system("convert tmp/5e01v1322252532.ps tmp/5e01v1322252532.png",intern=TRUE))
character(0)
> try(system("convert tmp/6w3z71322252532.ps tmp/6w3z71322252532.png",intern=TRUE))
character(0)
> try(system("convert tmp/718e01322252532.ps tmp/718e01322252532.png",intern=TRUE))
character(0)
> try(system("convert tmp/8593m1322252532.ps tmp/8593m1322252532.png",intern=TRUE))
character(0)
> try(system("convert tmp/97w5y1322252532.ps tmp/97w5y1322252532.png",intern=TRUE))
character(0)
> try(system("convert tmp/10f6ph1322252532.ps tmp/10f6ph1322252532.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.173 0.487 3.672