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(9,2,3,3,2,14,9,2,5,4,1,18,9,4,3,2,2,11,9,3,3,2,2,12,9,3,4,4,1,16,9,2,5,4,1,18,9,4,4,4,2,14,9,3,4,4,3,14,9,2,4,3,2,15,9,2,4,3,2,15,9,2,4,5,2,17,9,1,5,4,1,19,9,2,2,2,4,10,9,1,4,3,2,16,9,2,5,5,2,18,9,3,4,4,3,14,9,2,4,3,3,14,9,2,4,4,1,17,9,3,4,2,1,14,9,2,5,3,2,16,9,1,4,4,1,18,9,3,3,2,3,11,9,4,3,5,2,14,9,3,3,3,3,12,9,2,5,4,2,17,9,4,2,3,4,9,9,2,4,4,2,16,9,4,4,4,2,14,9,3,4,4,2,15,9,4,3,2,2,11,9,2,4,4,2,16,9,3,3,4,3,13,9,1,4,4,2,17,9,2,4,3,2,15,9,3,4,4,3,14,9,2,4,4,2,16,9,4,2,3,4,9,9,2,4,3,2,15,9,2,5,4,2,17,9,2,3,4,4,13,9,2,4,4,3,15,9,2,4,4,2,16,9,2,5,4,3,16,9,3,3,4,4,12,9,2,4,2,12,9,4,3,3,3,11,9,2,4,4,3,15,9,2,4,3,2,15,9,3,5,4,1,17,9,4,4,3,2,13,9,2,3,4,1,16,9,2,3,3,2,14,9,4,4,2,3,11,9,2,3,3,4,12,9,3,4,4,5,12,9,2,4,4,3,15,9,2,4,4,2,16,9,2,3,4,2,15,9,3,3,3,3,12,9,4,3,3,2,12,9,5,3,2,4,8,9,3,4,3,3,13,9,5,4,2,2,11,9,3,4,3,2,14,9,3,4,4,2,15,10,4,3,2,3,10),dim=c(6,66),dimnames=list(c('month','IDT','HPP','TGYW','POP','PPS
'),1:66))
> y <- array(NA,dim=c(6,66),dimnames=list(c('month','IDT','HPP','TGYW','POP','PPS
'),1:66))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '6'
> #'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
PPS\r month IDT HPP TGYW POP
1 14 9 2 3 3 2
2 18 9 2 5 4 1
3 11 9 4 3 2 2
4 12 9 3 3 2 2
5 16 9 3 4 4 1
6 18 9 2 5 4 1
7 14 9 4 4 4 2
8 14 9 3 4 4 3
9 15 9 2 4 3 2
10 15 9 2 4 3 2
11 17 9 2 4 5 2
12 19 9 1 5 4 1
13 10 9 2 2 2 4
14 16 9 1 4 3 2
15 18 9 2 5 5 2
16 14 9 3 4 4 3
17 14 9 2 4 3 3
18 17 9 2 4 4 1
19 14 9 3 4 2 1
20 16 9 2 5 3 2
21 18 9 1 4 4 1
22 11 9 3 3 2 3
23 14 9 4 3 5 2
24 12 9 3 3 3 3
25 17 9 2 5 4 2
26 9 9 4 2 3 4
27 16 9 2 4 4 2
28 14 9 4 4 4 2
29 15 9 3 4 4 2
30 11 9 4 3 2 2
31 16 9 2 4 4 2
32 13 9 3 3 4 3
33 17 9 1 4 4 2
34 15 9 2 4 3 2
35 14 9 3 4 4 3
36 16 9 2 4 4 2
37 9 9 4 2 3 4
38 15 9 2 4 3 2
39 17 9 2 5 4 2
40 13 9 2 3 4 4
41 15 9 2 4 4 3
42 16 9 2 4 4 2
43 16 9 2 5 4 3
44 12 9 3 3 4 4
45 9 9 2 4 2 12
46 9 4 3 3 3 11
47 9 2 4 4 3 15
48 9 2 4 3 2 15
49 9 3 5 4 1 17
50 9 4 4 3 2 13
51 9 2 3 4 1 16
52 9 2 3 3 2 14
53 9 4 4 2 3 11
54 9 2 3 3 4 12
55 9 3 4 4 5 12
56 9 2 4 4 3 15
57 9 2 4 4 2 16
58 9 2 3 4 2 15
59 9 3 3 3 3 12
60 9 4 3 3 2 12
61 9 5 3 2 4 8
62 9 3 4 3 3 13
63 9 5 4 2 2 11
64 9 3 4 3 2 14
65 10 3 4 4 2 15
66 9 4 3 2 3 10
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) month IDT HPP TGYW POP
12.3627 -0.2716 -0.7020 1.6378 0.3462 -0.4630
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-2.4660 -0.5877 -0.1410 0.4759 1.9355
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 12.36265 1.68114 7.354 6.23e-10 ***
month -0.27160 0.12969 -2.094 0.0405 *
IDT -0.70196 0.14758 -4.756 1.28e-05 ***
HPP 1.63777 0.14591 11.224 2.25e-16 ***
TGYW 0.34615 0.13913 2.488 0.0156 *
POP -0.46299 0.07471 -6.197 5.75e-08 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.8514 on 60 degrees of freedom
Multiple R-squared: 0.9394, Adjusted R-squared: 0.9344
F-statistic: 186.1 on 5 and 60 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.358234e-45 2.716468e-45 1.000000000
[2,] 2.396336e-58 4.792672e-58 1.000000000
[3,] 2.047298e-71 4.094596e-71 1.000000000
[4,] 8.729406e-89 1.745881e-88 1.000000000
[5,] 4.698485e-103 9.396969e-103 1.000000000
[6,] 2.998701e-112 5.997402e-112 1.000000000
[7,] 8.117641e-130 1.623528e-129 1.000000000
[8,] 1.889642e-151 3.779283e-151 1.000000000
[9,] 3.881665e-164 7.763329e-164 1.000000000
[10,] 1.051446e-169 2.102891e-169 1.000000000
[11,] 1.329422e-182 2.658844e-182 1.000000000
[12,] 1.533346e-206 3.066692e-206 1.000000000
[13,] 2.564934e-210 5.129869e-210 1.000000000
[14,] 1.671146e-229 3.342291e-229 1.000000000
[15,] 1.454377e-240 2.908754e-240 1.000000000
[16,] 6.133888e-255 1.226778e-254 1.000000000
[17,] 4.824603e-275 9.649206e-275 1.000000000
[18,] 6.131424e-288 1.226285e-287 1.000000000
[19,] 5.633012e-310 1.126602e-309 1.000000000
[20,] 5.001447e-308 1.000289e-307 1.000000000
[21,] 0.000000e+00 0.000000e+00 1.000000000
[22,] 0.000000e+00 0.000000e+00 1.000000000
[23,] 0.000000e+00 0.000000e+00 1.000000000
[24,] 0.000000e+00 0.000000e+00 1.000000000
[25,] 0.000000e+00 0.000000e+00 1.000000000
[26,] 0.000000e+00 0.000000e+00 1.000000000
[27,] 0.000000e+00 0.000000e+00 1.000000000
[28,] 0.000000e+00 0.000000e+00 1.000000000
[29,] 0.000000e+00 0.000000e+00 1.000000000
[30,] 0.000000e+00 0.000000e+00 1.000000000
[31,] 0.000000e+00 0.000000e+00 1.000000000
[32,] 0.000000e+00 0.000000e+00 1.000000000
[33,] 0.000000e+00 0.000000e+00 1.000000000
[34,] 0.000000e+00 0.000000e+00 1.000000000
[35,] 0.000000e+00 0.000000e+00 1.000000000
[36,] 0.000000e+00 0.000000e+00 1.000000000
[37,] 8.914944e-01 2.170112e-01 0.108505610
[38,] 8.471353e-01 3.057294e-01 0.152864725
[39,] 8.633143e-01 2.733714e-01 0.136685709
[40,] 9.806313e-01 3.873748e-02 0.019368742
[41,] 9.984630e-01 3.073900e-03 0.001536950
[42,] 9.972368e-01 5.526315e-03 0.002763158
[43,] 9.945008e-01 1.099835e-02 0.005499174
[44,] 9.874821e-01 2.503581e-02 0.012517906
[45,] 9.737207e-01 5.255856e-02 0.026279280
[46,] 9.816399e-01 3.672022e-02 0.018360112
[47,] 9.827722e-01 3.445552e-02 0.017227762
[48,] 9.628227e-01 7.435468e-02 0.037177339
[49,] 9.242173e-01 1.515655e-01 0.075782743
> postscript(file="/var/www/html/rcomp/tmp/1gt0f1291223042.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/www/html/rcomp/tmp/29kz11291223042.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/www/html/rcomp/tmp/39kz11291223042.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/www/html/rcomp/tmp/49kz11291223042.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/www/html/rcomp/tmp/51uy31291223042.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 = 66
Frequency = 1
1 2 3 4 5 6
0.45983651 0.37514979 -0.79009813 -0.49205375 0.71487785 0.37514979
7 8 9 10 11 12
-0.12017882 -0.35914673 -0.17793593 -0.17793593 1.12975582 0.67319417
13 14 15 16 17 18
-0.63026151 0.12010845 0.49198338 -0.35914673 -0.71494822 1.01292223
19 20 21 22 23 24
-0.59281390 -0.81570837 1.31096661 -1.02906604 1.17143950 -0.37522016
25 26 27 28 29 30
-0.16186249 -0.57250439 0.47590994 -0.12017882 0.17786556 -0.79009813
31 32 33 34 35 36
0.47590994 0.27862571 0.77395432 -0.17793593 -0.35914673 0.47590994
37 38 39 40 41 42
-0.57250439 -0.17793593 -0.16186249 0.03965780 -0.06110235 0.47590994
43 44 45 46 47 48
-0.69887478 -0.25838658 -1.20190470 -1.02930978 -0.65637227 1.32755429
49 50 51 52 53 54
1.93546528 0.94477539 -0.20303193 0.16261096 1.31041828 -1.45567271
55 56 57 58 59 60
-2.46604540 -0.65637227 0.15276956 -1.01217377 -0.83792033 -0.22016794
61 62 63 64 65 66
-0.85505634 0.32702300 1.92817067 1.13616484 0.96138011 0.14547495
> postscript(file="/var/www/html/rcomp/tmp/61uy31291223042.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 = 66
Frequency = 1
lag(myerror, k = 1) myerror
0 0.45983651 NA
1 0.37514979 0.45983651
2 -0.79009813 0.37514979
3 -0.49205375 -0.79009813
4 0.71487785 -0.49205375
5 0.37514979 0.71487785
6 -0.12017882 0.37514979
7 -0.35914673 -0.12017882
8 -0.17793593 -0.35914673
9 -0.17793593 -0.17793593
10 1.12975582 -0.17793593
11 0.67319417 1.12975582
12 -0.63026151 0.67319417
13 0.12010845 -0.63026151
14 0.49198338 0.12010845
15 -0.35914673 0.49198338
16 -0.71494822 -0.35914673
17 1.01292223 -0.71494822
18 -0.59281390 1.01292223
19 -0.81570837 -0.59281390
20 1.31096661 -0.81570837
21 -1.02906604 1.31096661
22 1.17143950 -1.02906604
23 -0.37522016 1.17143950
24 -0.16186249 -0.37522016
25 -0.57250439 -0.16186249
26 0.47590994 -0.57250439
27 -0.12017882 0.47590994
28 0.17786556 -0.12017882
29 -0.79009813 0.17786556
30 0.47590994 -0.79009813
31 0.27862571 0.47590994
32 0.77395432 0.27862571
33 -0.17793593 0.77395432
34 -0.35914673 -0.17793593
35 0.47590994 -0.35914673
36 -0.57250439 0.47590994
37 -0.17793593 -0.57250439
38 -0.16186249 -0.17793593
39 0.03965780 -0.16186249
40 -0.06110235 0.03965780
41 0.47590994 -0.06110235
42 -0.69887478 0.47590994
43 -0.25838658 -0.69887478
44 -1.20190470 -0.25838658
45 -1.02930978 -1.20190470
46 -0.65637227 -1.02930978
47 1.32755429 -0.65637227
48 1.93546528 1.32755429
49 0.94477539 1.93546528
50 -0.20303193 0.94477539
51 0.16261096 -0.20303193
52 1.31041828 0.16261096
53 -1.45567271 1.31041828
54 -2.46604540 -1.45567271
55 -0.65637227 -2.46604540
56 0.15276956 -0.65637227
57 -1.01217377 0.15276956
58 -0.83792033 -1.01217377
59 -0.22016794 -0.83792033
60 -0.85505634 -0.22016794
61 0.32702300 -0.85505634
62 1.92817067 0.32702300
63 1.13616484 1.92817067
64 0.96138011 1.13616484
65 0.14547495 0.96138011
66 NA 0.14547495
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.37514979 0.45983651
[2,] -0.79009813 0.37514979
[3,] -0.49205375 -0.79009813
[4,] 0.71487785 -0.49205375
[5,] 0.37514979 0.71487785
[6,] -0.12017882 0.37514979
[7,] -0.35914673 -0.12017882
[8,] -0.17793593 -0.35914673
[9,] -0.17793593 -0.17793593
[10,] 1.12975582 -0.17793593
[11,] 0.67319417 1.12975582
[12,] -0.63026151 0.67319417
[13,] 0.12010845 -0.63026151
[14,] 0.49198338 0.12010845
[15,] -0.35914673 0.49198338
[16,] -0.71494822 -0.35914673
[17,] 1.01292223 -0.71494822
[18,] -0.59281390 1.01292223
[19,] -0.81570837 -0.59281390
[20,] 1.31096661 -0.81570837
[21,] -1.02906604 1.31096661
[22,] 1.17143950 -1.02906604
[23,] -0.37522016 1.17143950
[24,] -0.16186249 -0.37522016
[25,] -0.57250439 -0.16186249
[26,] 0.47590994 -0.57250439
[27,] -0.12017882 0.47590994
[28,] 0.17786556 -0.12017882
[29,] -0.79009813 0.17786556
[30,] 0.47590994 -0.79009813
[31,] 0.27862571 0.47590994
[32,] 0.77395432 0.27862571
[33,] -0.17793593 0.77395432
[34,] -0.35914673 -0.17793593
[35,] 0.47590994 -0.35914673
[36,] -0.57250439 0.47590994
[37,] -0.17793593 -0.57250439
[38,] -0.16186249 -0.17793593
[39,] 0.03965780 -0.16186249
[40,] -0.06110235 0.03965780
[41,] 0.47590994 -0.06110235
[42,] -0.69887478 0.47590994
[43,] -0.25838658 -0.69887478
[44,] -1.20190470 -0.25838658
[45,] -1.02930978 -1.20190470
[46,] -0.65637227 -1.02930978
[47,] 1.32755429 -0.65637227
[48,] 1.93546528 1.32755429
[49,] 0.94477539 1.93546528
[50,] -0.20303193 0.94477539
[51,] 0.16261096 -0.20303193
[52,] 1.31041828 0.16261096
[53,] -1.45567271 1.31041828
[54,] -2.46604540 -1.45567271
[55,] -0.65637227 -2.46604540
[56,] 0.15276956 -0.65637227
[57,] -1.01217377 0.15276956
[58,] -0.83792033 -1.01217377
[59,] -0.22016794 -0.83792033
[60,] -0.85505634 -0.22016794
[61,] 0.32702300 -0.85505634
[62,] 1.92817067 0.32702300
[63,] 1.13616484 1.92817067
[64,] 0.96138011 1.13616484
[65,] 0.14547495 0.96138011
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.37514979 0.45983651
2 -0.79009813 0.37514979
3 -0.49205375 -0.79009813
4 0.71487785 -0.49205375
5 0.37514979 0.71487785
6 -0.12017882 0.37514979
7 -0.35914673 -0.12017882
8 -0.17793593 -0.35914673
9 -0.17793593 -0.17793593
10 1.12975582 -0.17793593
11 0.67319417 1.12975582
12 -0.63026151 0.67319417
13 0.12010845 -0.63026151
14 0.49198338 0.12010845
15 -0.35914673 0.49198338
16 -0.71494822 -0.35914673
17 1.01292223 -0.71494822
18 -0.59281390 1.01292223
19 -0.81570837 -0.59281390
20 1.31096661 -0.81570837
21 -1.02906604 1.31096661
22 1.17143950 -1.02906604
23 -0.37522016 1.17143950
24 -0.16186249 -0.37522016
25 -0.57250439 -0.16186249
26 0.47590994 -0.57250439
27 -0.12017882 0.47590994
28 0.17786556 -0.12017882
29 -0.79009813 0.17786556
30 0.47590994 -0.79009813
31 0.27862571 0.47590994
32 0.77395432 0.27862571
33 -0.17793593 0.77395432
34 -0.35914673 -0.17793593
35 0.47590994 -0.35914673
36 -0.57250439 0.47590994
37 -0.17793593 -0.57250439
38 -0.16186249 -0.17793593
39 0.03965780 -0.16186249
40 -0.06110235 0.03965780
41 0.47590994 -0.06110235
42 -0.69887478 0.47590994
43 -0.25838658 -0.69887478
44 -1.20190470 -0.25838658
45 -1.02930978 -1.20190470
46 -0.65637227 -1.02930978
47 1.32755429 -0.65637227
48 1.93546528 1.32755429
49 0.94477539 1.93546528
50 -0.20303193 0.94477539
51 0.16261096 -0.20303193
52 1.31041828 0.16261096
53 -1.45567271 1.31041828
54 -2.46604540 -1.45567271
55 -0.65637227 -2.46604540
56 0.15276956 -0.65637227
57 -1.01217377 0.15276956
58 -0.83792033 -1.01217377
59 -0.22016794 -0.83792033
60 -0.85505634 -0.22016794
61 0.32702300 -0.85505634
62 1.92817067 0.32702300
63 1.13616484 1.92817067
64 0.96138011 1.13616484
65 0.14547495 0.96138011
> 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/7clyo1291223042.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/www/html/rcomp/tmp/8clyo1291223042.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/www/html/rcomp/tmp/9ncx91291223042.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/www/html/rcomp/tmp/10ncx91291223042.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/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/11qvex1291223042.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/12uvul1291223042.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/13q5ac1291223042.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/14b58z1291223042.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/15f67o1291223042.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/16tynw1291223042.tab")
+ }
>
> try(system("convert tmp/1gt0f1291223042.ps tmp/1gt0f1291223042.png",intern=TRUE))
character(0)
> try(system("convert tmp/29kz11291223042.ps tmp/29kz11291223042.png",intern=TRUE))
character(0)
> try(system("convert tmp/39kz11291223042.ps tmp/39kz11291223042.png",intern=TRUE))
character(0)
> try(system("convert tmp/49kz11291223042.ps tmp/49kz11291223042.png",intern=TRUE))
character(0)
> try(system("convert tmp/51uy31291223042.ps tmp/51uy31291223042.png",intern=TRUE))
character(0)
> try(system("convert tmp/61uy31291223042.ps tmp/61uy31291223042.png",intern=TRUE))
character(0)
> try(system("convert tmp/7clyo1291223042.ps tmp/7clyo1291223042.png",intern=TRUE))
character(0)
> try(system("convert tmp/8clyo1291223042.ps tmp/8clyo1291223042.png",intern=TRUE))
character(0)
> try(system("convert tmp/9ncx91291223042.ps tmp/9ncx91291223042.png",intern=TRUE))
character(0)
> try(system("convert tmp/10ncx91291223042.ps tmp/10ncx91291223042.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.628 1.685 15.229