R version 2.8.0 (2008-10-20)
Copyright (C) 2008 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(149.7,0,163.6,0,173.9,0,164.5,0,154.2,0,147.9,0,159.3,0,170.3,0,170,0,174.2,0,190.8,0,179.9,0,240.8,0,241.9,0,241.1,0,239.6,0,220.8,0,209.3,0,209.9,0,228.3,0,242.1,0,226.4,0,231.5,0,229.7,0,257.6,0,260,0,264.4,0,268.8,0,271.4,0,273.8,0,277.4,0,268.2,0,264.6,0,266.6,0,266,0,267.4,0,289.8,0,294,0,310.3,0,311.7,0,302.1,0,298.2,0,299.2,0,296.2,0,299,0,300,0,299.4,0,300.2,0,470.2,0,472.1,0,484.8,0,513.4,1,547.2,1,548.1,1,544.7,1,521.1,1,459,1,413.2,1),dim=c(2,58),dimnames=list(c('x','y'),1:58))
> y <- array(NA,dim=c(2,58),dimnames=list(c('x','y'),1:58))
> 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
x y M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 149.7 0 1 0 0 0 0 0 0 0 0 0 0 1
2 163.6 0 0 1 0 0 0 0 0 0 0 0 0 2
3 173.9 0 0 0 1 0 0 0 0 0 0 0 0 3
4 164.5 0 0 0 0 1 0 0 0 0 0 0 0 4
5 154.2 0 0 0 0 0 1 0 0 0 0 0 0 5
6 147.9 0 0 0 0 0 0 1 0 0 0 0 0 6
7 159.3 0 0 0 0 0 0 0 1 0 0 0 0 7
8 170.3 0 0 0 0 0 0 0 0 1 0 0 0 8
9 170.0 0 0 0 0 0 0 0 0 0 1 0 0 9
10 174.2 0 0 0 0 0 0 0 0 0 0 1 0 10
11 190.8 0 0 0 0 0 0 0 0 0 0 0 1 11
12 179.9 0 0 0 0 0 0 0 0 0 0 0 0 12
13 240.8 0 1 0 0 0 0 0 0 0 0 0 0 13
14 241.9 0 0 1 0 0 0 0 0 0 0 0 0 14
15 241.1 0 0 0 1 0 0 0 0 0 0 0 0 15
16 239.6 0 0 0 0 1 0 0 0 0 0 0 0 16
17 220.8 0 0 0 0 0 1 0 0 0 0 0 0 17
18 209.3 0 0 0 0 0 0 1 0 0 0 0 0 18
19 209.9 0 0 0 0 0 0 0 1 0 0 0 0 19
20 228.3 0 0 0 0 0 0 0 0 1 0 0 0 20
21 242.1 0 0 0 0 0 0 0 0 0 1 0 0 21
22 226.4 0 0 0 0 0 0 0 0 0 0 1 0 22
23 231.5 0 0 0 0 0 0 0 0 0 0 0 1 23
24 229.7 0 0 0 0 0 0 0 0 0 0 0 0 24
25 257.6 0 1 0 0 0 0 0 0 0 0 0 0 25
26 260.0 0 0 1 0 0 0 0 0 0 0 0 0 26
27 264.4 0 0 0 1 0 0 0 0 0 0 0 0 27
28 268.8 0 0 0 0 1 0 0 0 0 0 0 0 28
29 271.4 0 0 0 0 0 1 0 0 0 0 0 0 29
30 273.8 0 0 0 0 0 0 1 0 0 0 0 0 30
31 277.4 0 0 0 0 0 0 0 1 0 0 0 0 31
32 268.2 0 0 0 0 0 0 0 0 1 0 0 0 32
33 264.6 0 0 0 0 0 0 0 0 0 1 0 0 33
34 266.6 0 0 0 0 0 0 0 0 0 0 1 0 34
35 266.0 0 0 0 0 0 0 0 0 0 0 0 1 35
36 267.4 0 0 0 0 0 0 0 0 0 0 0 0 36
37 289.8 0 1 0 0 0 0 0 0 0 0 0 0 37
38 294.0 0 0 1 0 0 0 0 0 0 0 0 0 38
39 310.3 0 0 0 1 0 0 0 0 0 0 0 0 39
40 311.7 0 0 0 0 1 0 0 0 0 0 0 0 40
41 302.1 0 0 0 0 0 1 0 0 0 0 0 0 41
42 298.2 0 0 0 0 0 0 1 0 0 0 0 0 42
43 299.2 0 0 0 0 0 0 0 1 0 0 0 0 43
44 296.2 0 0 0 0 0 0 0 0 1 0 0 0 44
45 299.0 0 0 0 0 0 0 0 0 0 1 0 0 45
46 300.0 0 0 0 0 0 0 0 0 0 0 1 0 46
47 299.4 0 0 0 0 0 0 0 0 0 0 0 1 47
48 300.2 0 0 0 0 0 0 0 0 0 0 0 0 48
49 470.2 0 1 0 0 0 0 0 0 0 0 0 0 49
50 472.1 0 0 1 0 0 0 0 0 0 0 0 0 50
51 484.8 0 0 0 1 0 0 0 0 0 0 0 0 51
52 513.4 1 0 0 0 1 0 0 0 0 0 0 0 52
53 547.2 1 0 0 0 0 1 0 0 0 0 0 0 53
54 548.1 1 0 0 0 0 0 1 0 0 0 0 0 54
55 544.7 1 0 0 0 0 0 0 1 0 0 0 0 55
56 521.1 1 0 0 0 0 0 0 0 1 0 0 0 56
57 459.0 1 0 0 0 0 0 0 0 0 1 0 0 57
58 413.2 1 0 0 0 0 0 0 0 0 0 1 0 58
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) y M1 M2 M3 M4
109.775 132.361 59.741 59.957 64.053 37.796
M5 M6 M7 M8 M9 M10
32.852 24.688 22.844 17.080 2.715 -12.629
M11 t
7.109 4.484
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-76.389 -21.834 -1.708 12.819 82.280
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 109.7750 19.6165 5.596 1.32e-06 ***
y 132.3607 17.3882 7.612 1.46e-09 ***
M1 59.7408 22.8509 2.614 0.01219 *
M2 59.9567 22.8298 2.626 0.01183 *
M3 64.0525 22.8134 2.808 0.00741 **
M4 37.7962 23.1209 1.635 0.10924
M5 32.8520 23.0862 1.423 0.16178
M6 24.6879 23.0561 1.071 0.29011
M7 22.8437 23.0306 0.992 0.32668
M8 17.0795 23.0097 0.742 0.46186
M9 2.7154 22.9934 0.118 0.90653
M10 -12.6288 22.9818 -0.550 0.58543
M11 7.1092 24.0274 0.296 0.76872
t 4.4842 0.3269 13.715 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 33.98 on 44 degrees of freedom
Multiple R-squared: 0.9258, Adjusted R-squared: 0.9039
F-statistic: 42.22 on 13 and 44 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,] 1.073568e-02 2.147137e-02 0.9892643
[2,] 3.357353e-03 6.714706e-03 0.9966426
[3,] 2.231148e-03 4.462295e-03 0.9977689
[4,] 6.384718e-04 1.276944e-03 0.9993615
[5,] 1.585078e-04 3.170156e-04 0.9998415
[6,] 8.644152e-05 1.728830e-04 0.9999136
[7,] 1.014842e-04 2.029685e-04 0.9998985
[8,] 4.613035e-05 9.226070e-05 0.9999539
[9,] 8.543845e-05 1.708769e-04 0.9999146
[10,] 1.003015e-04 2.006031e-04 0.9998997
[11,] 7.730168e-05 1.546034e-04 0.9999227
[12,] 2.859631e-05 5.719263e-05 0.9999714
[13,] 8.301125e-06 1.660225e-05 0.9999917
[14,] 3.283198e-06 6.566395e-06 0.9999967
[15,] 1.114659e-06 2.229317e-06 0.9999989
[16,] 3.993538e-07 7.987075e-07 0.9999996
[17,] 4.343808e-07 8.687615e-07 0.9999996
[18,] 2.517509e-06 5.035017e-06 0.9999975
[19,] 1.107159e-05 2.214318e-05 0.9999889
[20,] 6.284120e-04 1.256824e-03 0.9993716
[21,] 4.955782e-04 9.911565e-04 0.9995044
[22,] 3.282495e-04 6.564990e-04 0.9996718
[23,] 1.192466e-04 2.384933e-04 0.9998808
[24,] 3.535183e-05 7.070366e-05 0.9999646
[25,] 2.233792e-05 4.467583e-05 0.9999777
> postscript(file="/var/www/html/rcomp/tmp/176ci1227791369.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/2e7vg1227791369.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/34aao1227791369.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/4xwyt1227791369.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/5ly6l1227791369.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 = 58
Frequency = 1
1 2 3 4 5 6
-24.3000000 -15.1000000 -13.3800000 -1.0078571 -10.8478571 -13.4678571
7 8 9 10 11 12
-4.7078571 7.5721429 17.1521429 32.2121429 24.5900000 16.3150000
13 14 15 16 17 18
12.9900000 9.3900000 0.0100000 20.2821429 1.9421429 -5.8778571
19 20 21 22 23 24
-7.9178571 11.7621429 35.4421429 30.6021429 11.4800000 12.3050000
25 26 27 28 29 30
-24.0200000 -26.3200000 -30.5000000 -4.3278571 -1.2678571 4.8121429
31 32 33 34 35 36
5.7721429 -2.1478571 4.1321429 16.9921429 -7.8300000 -3.8050000
37 38 39 40 41 42
-45.6300000 -46.1300000 -38.4100000 -15.2378571 -24.3778571 -24.5978571
43 44 45 46 47 48
-26.2378571 -27.9578571 -15.2778571 -3.4178571 -28.2400000 -24.8150000
49 50 51 52 53 54
80.9600000 78.1600000 82.2800000 0.2914286 34.5514286 39.1314286
55 56 57 58
33.0914286 10.7714286 -41.4485714 -76.3885714
> postscript(file="/var/www/html/rcomp/tmp/6h0r91227791369.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 = 58
Frequency = 1
lag(myerror, k = 1) myerror
0 -24.3000000 NA
1 -15.1000000 -24.3000000
2 -13.3800000 -15.1000000
3 -1.0078571 -13.3800000
4 -10.8478571 -1.0078571
5 -13.4678571 -10.8478571
6 -4.7078571 -13.4678571
7 7.5721429 -4.7078571
8 17.1521429 7.5721429
9 32.2121429 17.1521429
10 24.5900000 32.2121429
11 16.3150000 24.5900000
12 12.9900000 16.3150000
13 9.3900000 12.9900000
14 0.0100000 9.3900000
15 20.2821429 0.0100000
16 1.9421429 20.2821429
17 -5.8778571 1.9421429
18 -7.9178571 -5.8778571
19 11.7621429 -7.9178571
20 35.4421429 11.7621429
21 30.6021429 35.4421429
22 11.4800000 30.6021429
23 12.3050000 11.4800000
24 -24.0200000 12.3050000
25 -26.3200000 -24.0200000
26 -30.5000000 -26.3200000
27 -4.3278571 -30.5000000
28 -1.2678571 -4.3278571
29 4.8121429 -1.2678571
30 5.7721429 4.8121429
31 -2.1478571 5.7721429
32 4.1321429 -2.1478571
33 16.9921429 4.1321429
34 -7.8300000 16.9921429
35 -3.8050000 -7.8300000
36 -45.6300000 -3.8050000
37 -46.1300000 -45.6300000
38 -38.4100000 -46.1300000
39 -15.2378571 -38.4100000
40 -24.3778571 -15.2378571
41 -24.5978571 -24.3778571
42 -26.2378571 -24.5978571
43 -27.9578571 -26.2378571
44 -15.2778571 -27.9578571
45 -3.4178571 -15.2778571
46 -28.2400000 -3.4178571
47 -24.8150000 -28.2400000
48 80.9600000 -24.8150000
49 78.1600000 80.9600000
50 82.2800000 78.1600000
51 0.2914286 82.2800000
52 34.5514286 0.2914286
53 39.1314286 34.5514286
54 33.0914286 39.1314286
55 10.7714286 33.0914286
56 -41.4485714 10.7714286
57 -76.3885714 -41.4485714
58 NA -76.3885714
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -15.1000000 -24.3000000
[2,] -13.3800000 -15.1000000
[3,] -1.0078571 -13.3800000
[4,] -10.8478571 -1.0078571
[5,] -13.4678571 -10.8478571
[6,] -4.7078571 -13.4678571
[7,] 7.5721429 -4.7078571
[8,] 17.1521429 7.5721429
[9,] 32.2121429 17.1521429
[10,] 24.5900000 32.2121429
[11,] 16.3150000 24.5900000
[12,] 12.9900000 16.3150000
[13,] 9.3900000 12.9900000
[14,] 0.0100000 9.3900000
[15,] 20.2821429 0.0100000
[16,] 1.9421429 20.2821429
[17,] -5.8778571 1.9421429
[18,] -7.9178571 -5.8778571
[19,] 11.7621429 -7.9178571
[20,] 35.4421429 11.7621429
[21,] 30.6021429 35.4421429
[22,] 11.4800000 30.6021429
[23,] 12.3050000 11.4800000
[24,] -24.0200000 12.3050000
[25,] -26.3200000 -24.0200000
[26,] -30.5000000 -26.3200000
[27,] -4.3278571 -30.5000000
[28,] -1.2678571 -4.3278571
[29,] 4.8121429 -1.2678571
[30,] 5.7721429 4.8121429
[31,] -2.1478571 5.7721429
[32,] 4.1321429 -2.1478571
[33,] 16.9921429 4.1321429
[34,] -7.8300000 16.9921429
[35,] -3.8050000 -7.8300000
[36,] -45.6300000 -3.8050000
[37,] -46.1300000 -45.6300000
[38,] -38.4100000 -46.1300000
[39,] -15.2378571 -38.4100000
[40,] -24.3778571 -15.2378571
[41,] -24.5978571 -24.3778571
[42,] -26.2378571 -24.5978571
[43,] -27.9578571 -26.2378571
[44,] -15.2778571 -27.9578571
[45,] -3.4178571 -15.2778571
[46,] -28.2400000 -3.4178571
[47,] -24.8150000 -28.2400000
[48,] 80.9600000 -24.8150000
[49,] 78.1600000 80.9600000
[50,] 82.2800000 78.1600000
[51,] 0.2914286 82.2800000
[52,] 34.5514286 0.2914286
[53,] 39.1314286 34.5514286
[54,] 33.0914286 39.1314286
[55,] 10.7714286 33.0914286
[56,] -41.4485714 10.7714286
[57,] -76.3885714 -41.4485714
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -15.1000000 -24.3000000
2 -13.3800000 -15.1000000
3 -1.0078571 -13.3800000
4 -10.8478571 -1.0078571
5 -13.4678571 -10.8478571
6 -4.7078571 -13.4678571
7 7.5721429 -4.7078571
8 17.1521429 7.5721429
9 32.2121429 17.1521429
10 24.5900000 32.2121429
11 16.3150000 24.5900000
12 12.9900000 16.3150000
13 9.3900000 12.9900000
14 0.0100000 9.3900000
15 20.2821429 0.0100000
16 1.9421429 20.2821429
17 -5.8778571 1.9421429
18 -7.9178571 -5.8778571
19 11.7621429 -7.9178571
20 35.4421429 11.7621429
21 30.6021429 35.4421429
22 11.4800000 30.6021429
23 12.3050000 11.4800000
24 -24.0200000 12.3050000
25 -26.3200000 -24.0200000
26 -30.5000000 -26.3200000
27 -4.3278571 -30.5000000
28 -1.2678571 -4.3278571
29 4.8121429 -1.2678571
30 5.7721429 4.8121429
31 -2.1478571 5.7721429
32 4.1321429 -2.1478571
33 16.9921429 4.1321429
34 -7.8300000 16.9921429
35 -3.8050000 -7.8300000
36 -45.6300000 -3.8050000
37 -46.1300000 -45.6300000
38 -38.4100000 -46.1300000
39 -15.2378571 -38.4100000
40 -24.3778571 -15.2378571
41 -24.5978571 -24.3778571
42 -26.2378571 -24.5978571
43 -27.9578571 -26.2378571
44 -15.2778571 -27.9578571
45 -3.4178571 -15.2778571
46 -28.2400000 -3.4178571
47 -24.8150000 -28.2400000
48 80.9600000 -24.8150000
49 78.1600000 80.9600000
50 82.2800000 78.1600000
51 0.2914286 82.2800000
52 34.5514286 0.2914286
53 39.1314286 34.5514286
54 33.0914286 39.1314286
55 10.7714286 33.0914286
56 -41.4485714 10.7714286
57 -76.3885714 -41.4485714
> 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/7yp2b1227791369.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/8hzkc1227791369.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/9b3nr1227791370.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/10wruf1227791370.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/11sh211227791370.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/12h4g61227791370.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/135ceb1227791370.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/14zobl1227791370.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/155yvf1227791370.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/16foc91227791370.tab")
+ }
>
> system("convert tmp/176ci1227791369.ps tmp/176ci1227791369.png")
> system("convert tmp/2e7vg1227791369.ps tmp/2e7vg1227791369.png")
> system("convert tmp/34aao1227791369.ps tmp/34aao1227791369.png")
> system("convert tmp/4xwyt1227791369.ps tmp/4xwyt1227791369.png")
> system("convert tmp/5ly6l1227791369.ps tmp/5ly6l1227791369.png")
> system("convert tmp/6h0r91227791369.ps tmp/6h0r91227791369.png")
> system("convert tmp/7yp2b1227791369.ps tmp/7yp2b1227791369.png")
> system("convert tmp/8hzkc1227791369.ps tmp/8hzkc1227791369.png")
> system("convert tmp/9b3nr1227791370.ps tmp/9b3nr1227791370.png")
> system("convert tmp/10wruf1227791370.ps tmp/10wruf1227791370.png")
>
>
> proc.time()
user system elapsed
2.342 1.533 2.841