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(7.55,42.97,7.55,42.98,7.59,43.01,7.59,43.09,7.59,43.14,7.57,43.39,7.57,43.46,7.59,43.54,7.6,43.62,7.64,44.01,7.64,44.5,7.76,44.73,7.76,44.89,7.76,45.09,7.77,45.17,7.83,45.24,7.94,45.42,7.94,45.67,7.94,45.68,8.09,46.56,8.18,46.72,8.26,47.01,8.28,47.26,8.28,47.49,8.28,47.51,8.29,47.52,8.3,47.66,8.3,47.71,8.31,47.87,8.33,48,8.33,48,8.34,48.05,8.48,48.25,8.59,48.72,8.67,48.94,8.67,49.16,8.67,49.18,8.71,49.25,8.72,49.34,8.72,49.49,8.72,49.57,8.74,49.63,8.74,49.67,8.74,49.7,8.74,49.8,8.79,50.09,8.85,50.49,8.86,50.73,8.87,51.12,8.92,51.15,8.96,51.41,8.97,51.61,8.99,52.06,8.98,52.17,8.98,52.18,9.01,52.19,9.01,52.74,9.03,53.05,9.05,53.38,9.05,53.78),dim=c(2,60),dimnames=list(c('Y','X'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Y','X'),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 = 'No 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
Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 7.55 42.97 1 0 0 0 0 0 0 0 0 0 0
2 7.55 42.98 0 1 0 0 0 0 0 0 0 0 0
3 7.59 43.01 0 0 1 0 0 0 0 0 0 0 0
4 7.59 43.09 0 0 0 1 0 0 0 0 0 0 0
5 7.59 43.14 0 0 0 0 1 0 0 0 0 0 0
6 7.57 43.39 0 0 0 0 0 1 0 0 0 0 0
7 7.57 43.46 0 0 0 0 0 0 1 0 0 0 0
8 7.59 43.54 0 0 0 0 0 0 0 1 0 0 0
9 7.60 43.62 0 0 0 0 0 0 0 0 1 0 0
10 7.64 44.01 0 0 0 0 0 0 0 0 0 1 0
11 7.64 44.50 0 0 0 0 0 0 0 0 0 0 1
12 7.76 44.73 0 0 0 0 0 0 0 0 0 0 0
13 7.76 44.89 1 0 0 0 0 0 0 0 0 0 0
14 7.76 45.09 0 1 0 0 0 0 0 0 0 0 0
15 7.77 45.17 0 0 1 0 0 0 0 0 0 0 0
16 7.83 45.24 0 0 0 1 0 0 0 0 0 0 0
17 7.94 45.42 0 0 0 0 1 0 0 0 0 0 0
18 7.94 45.67 0 0 0 0 0 1 0 0 0 0 0
19 7.94 45.68 0 0 0 0 0 0 1 0 0 0 0
20 8.09 46.56 0 0 0 0 0 0 0 1 0 0 0
21 8.18 46.72 0 0 0 0 0 0 0 0 1 0 0
22 8.26 47.01 0 0 0 0 0 0 0 0 0 1 0
23 8.28 47.26 0 0 0 0 0 0 0 0 0 0 1
24 8.28 47.49 0 0 0 0 0 0 0 0 0 0 0
25 8.28 47.51 1 0 0 0 0 0 0 0 0 0 0
26 8.29 47.52 0 1 0 0 0 0 0 0 0 0 0
27 8.30 47.66 0 0 1 0 0 0 0 0 0 0 0
28 8.30 47.71 0 0 0 1 0 0 0 0 0 0 0
29 8.31 47.87 0 0 0 0 1 0 0 0 0 0 0
30 8.33 48.00 0 0 0 0 0 1 0 0 0 0 0
31 8.33 48.00 0 0 0 0 0 0 1 0 0 0 0
32 8.34 48.05 0 0 0 0 0 0 0 1 0 0 0
33 8.48 48.25 0 0 0 0 0 0 0 0 1 0 0
34 8.59 48.72 0 0 0 0 0 0 0 0 0 1 0
35 8.67 48.94 0 0 0 0 0 0 0 0 0 0 1
36 8.67 49.16 0 0 0 0 0 0 0 0 0 0 0
37 8.67 49.18 1 0 0 0 0 0 0 0 0 0 0
38 8.71 49.25 0 1 0 0 0 0 0 0 0 0 0
39 8.72 49.34 0 0 1 0 0 0 0 0 0 0 0
40 8.72 49.49 0 0 0 1 0 0 0 0 0 0 0
41 8.72 49.57 0 0 0 0 1 0 0 0 0 0 0
42 8.74 49.63 0 0 0 0 0 1 0 0 0 0 0
43 8.74 49.67 0 0 0 0 0 0 1 0 0 0 0
44 8.74 49.70 0 0 0 0 0 0 0 1 0 0 0
45 8.74 49.80 0 0 0 0 0 0 0 0 1 0 0
46 8.79 50.09 0 0 0 0 0 0 0 0 0 1 0
47 8.85 50.49 0 0 0 0 0 0 0 0 0 0 1
48 8.86 50.73 0 0 0 0 0 0 0 0 0 0 0
49 8.87 51.12 1 0 0 0 0 0 0 0 0 0 0
50 8.92 51.15 0 1 0 0 0 0 0 0 0 0 0
51 8.96 51.41 0 0 1 0 0 0 0 0 0 0 0
52 8.97 51.61 0 0 0 1 0 0 0 0 0 0 0
53 8.99 52.06 0 0 0 0 1 0 0 0 0 0 0
54 8.98 52.17 0 0 0 0 0 1 0 0 0 0 0
55 8.98 52.18 0 0 0 0 0 0 1 0 0 0 0
56 9.01 52.19 0 0 0 0 0 0 0 1 0 0 0
57 9.01 52.74 0 0 0 0 0 0 0 0 1 0 0
58 9.03 53.05 0 0 0 0 0 0 0 0 0 1 0
59 9.05 53.38 0 0 0 0 0 0 0 0 0 0 1
60 9.05 53.78 0 0 0 0 0 0 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X M1 M2 M3 M4
0.39231 0.16535 0.03998 0.04940 0.05156 0.04737
M5 M6 M7 M8 M9 M10
0.04494 0.02049 0.01619 0.02346 0.03542 0.03754
M11
0.01765
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.234951 -0.036724 -0.008708 0.074938 0.167701
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.392309 0.209051 1.877 0.0668 .
X 0.165352 0.004159 39.758 <2e-16 ***
M1 0.039980 0.061744 0.648 0.5205
M2 0.049397 0.061708 0.801 0.4274
M3 0.051555 0.061643 0.836 0.4072
M4 0.047366 0.061588 0.769 0.4457
M5 0.044942 0.061502 0.731 0.4686
M6 0.020485 0.061435 0.333 0.7403
M7 0.016186 0.061425 0.264 0.7933
M8 0.023462 0.061349 0.382 0.7039
M9 0.035415 0.061284 0.578 0.5661
M10 0.037542 0.061207 0.613 0.5426
M11 0.017653 0.061166 0.289 0.7742
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.0967 on 47 degrees of freedom
Multiple R-squared: 0.9721, Adjusted R-squared: 0.965
F-statistic: 136.6 on 12 and 47 DF, p-value: < 2.2e-16
> if (n > n25) {
+ kp3 <- k + 3
+ nmkm3 <- n - k - 3
+ gqarr <- array(NA, dim=c(nmkm3-kp3+1,3))
+ numgqtests <- 0
+ numsignificant1 <- 0
+ numsignificant5 <- 0
+ numsignificant10 <- 0
+ for (mypoint in kp3:nmkm3) {
+ j <- 0
+ numgqtests <- numgqtests + 1
+ for (myalt in c('greater', 'two.sided', 'less')) {
+ j <- j + 1
+ gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value
+ }
+ if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1
+ }
+ gqarr
+ }
[,1] [,2] [,3]
[1,] 0.01138452 0.022769047 0.988615476
[2,] 0.05481732 0.109634643 0.945182679
[3,] 0.06965464 0.139309280 0.930345360
[4,] 0.06759597 0.135191936 0.932404032
[5,] 0.06980296 0.139605921 0.930197039
[6,] 0.10370817 0.207416348 0.896291826
[7,] 0.16079724 0.321594478 0.839202761
[8,] 0.26057728 0.521154555 0.739422722
[9,] 0.20238989 0.404779775 0.797610113
[10,] 0.16129717 0.322594343 0.838702828
[11,] 0.15095707 0.301914146 0.849042927
[12,] 0.15249129 0.304982589 0.847508706
[13,] 0.16816868 0.336337369 0.831831315
[14,] 0.22567910 0.451358197 0.774320901
[15,] 0.31567504 0.631350074 0.684324963
[16,] 0.54139502 0.917209967 0.458604984
[17,] 0.96922891 0.061542171 0.030771086
[18,] 0.99250853 0.014982939 0.007491469
[19,] 0.99436046 0.011279080 0.005639540
[20,] 0.99574709 0.008505814 0.004252907
[21,] 0.99311116 0.013777674 0.006888837
[22,] 0.98818625 0.023627503 0.011813752
[23,] 0.98410923 0.031781542 0.015890771
[24,] 0.98089602 0.038207965 0.019103982
[25,] 0.97879400 0.042411992 0.021205996
[26,] 0.97264818 0.054703636 0.027351818
[27,] 0.94555896 0.108882076 0.054441038
[28,] 0.89964452 0.200710962 0.100355481
[29,] 0.92262862 0.154742761 0.077371381
> postscript(file="/var/www/html/rcomp/tmp/1krd71258558931.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/2xjsg1258558931.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/3i7731258558931.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/4ywk41258558931.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/5kqw01258558931.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.012526624 0.001455643 0.034337343 0.025297909 0.019455106 -0.017426593
7 8 9 10 11 12
-0.024702091 -0.025206303 -0.040387697 -0.067001786 -0.128135323 -0.028513347
13 14 15 16 17 18
-0.094949629 -0.137437531 -0.142823442 -0.090209353 -0.007547944 -0.024429644
19 20 21 22 23 24
-0.021784008 -0.024569993 0.027020436 0.056941569 0.055492564 0.035114539
25 26 27 28 29 30
-0.008172433 -0.009243413 -0.024550458 -0.028629325 -0.042660871 -0.019700305
31 32 33 34 35 36
-0.015401147 -0.020944793 0.074031547 0.104189281 0.167700842 0.148976340
37 38 39 40 41 42
0.105689368 0.124697255 0.117657821 0.097043732 0.086240363 0.120775584
43 44 45 46 47 48
0.118460653 0.106224052 0.077735613 0.077656746 0.091404909 0.079373362
49 50 51 52 53 54
-0.015093929 0.020528046 0.015378736 -0.003502964 -0.055486653 -0.059219042
55 56 57 58 59 60
-0.056573407 -0.035502964 -0.138399899 -0.171785810 -0.186462993 -0.234950894
> postscript(file="/var/www/html/rcomp/tmp/67mqw1258558931.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.012526624 NA
1 0.001455643 0.012526624
2 0.034337343 0.001455643
3 0.025297909 0.034337343
4 0.019455106 0.025297909
5 -0.017426593 0.019455106
6 -0.024702091 -0.017426593
7 -0.025206303 -0.024702091
8 -0.040387697 -0.025206303
9 -0.067001786 -0.040387697
10 -0.128135323 -0.067001786
11 -0.028513347 -0.128135323
12 -0.094949629 -0.028513347
13 -0.137437531 -0.094949629
14 -0.142823442 -0.137437531
15 -0.090209353 -0.142823442
16 -0.007547944 -0.090209353
17 -0.024429644 -0.007547944
18 -0.021784008 -0.024429644
19 -0.024569993 -0.021784008
20 0.027020436 -0.024569993
21 0.056941569 0.027020436
22 0.055492564 0.056941569
23 0.035114539 0.055492564
24 -0.008172433 0.035114539
25 -0.009243413 -0.008172433
26 -0.024550458 -0.009243413
27 -0.028629325 -0.024550458
28 -0.042660871 -0.028629325
29 -0.019700305 -0.042660871
30 -0.015401147 -0.019700305
31 -0.020944793 -0.015401147
32 0.074031547 -0.020944793
33 0.104189281 0.074031547
34 0.167700842 0.104189281
35 0.148976340 0.167700842
36 0.105689368 0.148976340
37 0.124697255 0.105689368
38 0.117657821 0.124697255
39 0.097043732 0.117657821
40 0.086240363 0.097043732
41 0.120775584 0.086240363
42 0.118460653 0.120775584
43 0.106224052 0.118460653
44 0.077735613 0.106224052
45 0.077656746 0.077735613
46 0.091404909 0.077656746
47 0.079373362 0.091404909
48 -0.015093929 0.079373362
49 0.020528046 -0.015093929
50 0.015378736 0.020528046
51 -0.003502964 0.015378736
52 -0.055486653 -0.003502964
53 -0.059219042 -0.055486653
54 -0.056573407 -0.059219042
55 -0.035502964 -0.056573407
56 -0.138399899 -0.035502964
57 -0.171785810 -0.138399899
58 -0.186462993 -0.171785810
59 -0.234950894 -0.186462993
60 NA -0.234950894
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.001455643 0.012526624
[2,] 0.034337343 0.001455643
[3,] 0.025297909 0.034337343
[4,] 0.019455106 0.025297909
[5,] -0.017426593 0.019455106
[6,] -0.024702091 -0.017426593
[7,] -0.025206303 -0.024702091
[8,] -0.040387697 -0.025206303
[9,] -0.067001786 -0.040387697
[10,] -0.128135323 -0.067001786
[11,] -0.028513347 -0.128135323
[12,] -0.094949629 -0.028513347
[13,] -0.137437531 -0.094949629
[14,] -0.142823442 -0.137437531
[15,] -0.090209353 -0.142823442
[16,] -0.007547944 -0.090209353
[17,] -0.024429644 -0.007547944
[18,] -0.021784008 -0.024429644
[19,] -0.024569993 -0.021784008
[20,] 0.027020436 -0.024569993
[21,] 0.056941569 0.027020436
[22,] 0.055492564 0.056941569
[23,] 0.035114539 0.055492564
[24,] -0.008172433 0.035114539
[25,] -0.009243413 -0.008172433
[26,] -0.024550458 -0.009243413
[27,] -0.028629325 -0.024550458
[28,] -0.042660871 -0.028629325
[29,] -0.019700305 -0.042660871
[30,] -0.015401147 -0.019700305
[31,] -0.020944793 -0.015401147
[32,] 0.074031547 -0.020944793
[33,] 0.104189281 0.074031547
[34,] 0.167700842 0.104189281
[35,] 0.148976340 0.167700842
[36,] 0.105689368 0.148976340
[37,] 0.124697255 0.105689368
[38,] 0.117657821 0.124697255
[39,] 0.097043732 0.117657821
[40,] 0.086240363 0.097043732
[41,] 0.120775584 0.086240363
[42,] 0.118460653 0.120775584
[43,] 0.106224052 0.118460653
[44,] 0.077735613 0.106224052
[45,] 0.077656746 0.077735613
[46,] 0.091404909 0.077656746
[47,] 0.079373362 0.091404909
[48,] -0.015093929 0.079373362
[49,] 0.020528046 -0.015093929
[50,] 0.015378736 0.020528046
[51,] -0.003502964 0.015378736
[52,] -0.055486653 -0.003502964
[53,] -0.059219042 -0.055486653
[54,] -0.056573407 -0.059219042
[55,] -0.035502964 -0.056573407
[56,] -0.138399899 -0.035502964
[57,] -0.171785810 -0.138399899
[58,] -0.186462993 -0.171785810
[59,] -0.234950894 -0.186462993
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.001455643 0.012526624
2 0.034337343 0.001455643
3 0.025297909 0.034337343
4 0.019455106 0.025297909
5 -0.017426593 0.019455106
6 -0.024702091 -0.017426593
7 -0.025206303 -0.024702091
8 -0.040387697 -0.025206303
9 -0.067001786 -0.040387697
10 -0.128135323 -0.067001786
11 -0.028513347 -0.128135323
12 -0.094949629 -0.028513347
13 -0.137437531 -0.094949629
14 -0.142823442 -0.137437531
15 -0.090209353 -0.142823442
16 -0.007547944 -0.090209353
17 -0.024429644 -0.007547944
18 -0.021784008 -0.024429644
19 -0.024569993 -0.021784008
20 0.027020436 -0.024569993
21 0.056941569 0.027020436
22 0.055492564 0.056941569
23 0.035114539 0.055492564
24 -0.008172433 0.035114539
25 -0.009243413 -0.008172433
26 -0.024550458 -0.009243413
27 -0.028629325 -0.024550458
28 -0.042660871 -0.028629325
29 -0.019700305 -0.042660871
30 -0.015401147 -0.019700305
31 -0.020944793 -0.015401147
32 0.074031547 -0.020944793
33 0.104189281 0.074031547
34 0.167700842 0.104189281
35 0.148976340 0.167700842
36 0.105689368 0.148976340
37 0.124697255 0.105689368
38 0.117657821 0.124697255
39 0.097043732 0.117657821
40 0.086240363 0.097043732
41 0.120775584 0.086240363
42 0.118460653 0.120775584
43 0.106224052 0.118460653
44 0.077735613 0.106224052
45 0.077656746 0.077735613
46 0.091404909 0.077656746
47 0.079373362 0.091404909
48 -0.015093929 0.079373362
49 0.020528046 -0.015093929
50 0.015378736 0.020528046
51 -0.003502964 0.015378736
52 -0.055486653 -0.003502964
53 -0.059219042 -0.055486653
54 -0.056573407 -0.059219042
55 -0.035502964 -0.056573407
56 -0.138399899 -0.035502964
57 -0.171785810 -0.138399899
58 -0.186462993 -0.171785810
59 -0.234950894 -0.186462993
> 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/72o9g1258558931.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/8cfve1258558931.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/9rel51258558931.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/10xlbn1258558931.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/111e6l1258558931.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/12uphw1258558931.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/13a18i1258558931.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/14yvhb1258558931.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/15eu701258558931.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/16kt101258558931.tab")
+ }
>
> system("convert tmp/1krd71258558931.ps tmp/1krd71258558931.png")
> system("convert tmp/2xjsg1258558931.ps tmp/2xjsg1258558931.png")
> system("convert tmp/3i7731258558931.ps tmp/3i7731258558931.png")
> system("convert tmp/4ywk41258558931.ps tmp/4ywk41258558931.png")
> system("convert tmp/5kqw01258558931.ps tmp/5kqw01258558931.png")
> system("convert tmp/67mqw1258558931.ps tmp/67mqw1258558931.png")
> system("convert tmp/72o9g1258558931.ps tmp/72o9g1258558931.png")
> system("convert tmp/8cfve1258558931.ps tmp/8cfve1258558931.png")
> system("convert tmp/9rel51258558931.ps tmp/9rel51258558931.png")
> system("convert tmp/10xlbn1258558931.ps tmp/10xlbn1258558931.png")
>
>
> proc.time()
user system elapsed
2.416 1.575 2.909