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(2.085,0,2.053,0,2.077,0,2.058,0,2.057,0,2.076,0,2.07,0,2.062,0,2.073,0,2.061,0,2.094,0,2.067,0,2.086,0,2.276,0,2.326,0,2.349,0,2.52,0,2.628,0,2.577,0,2.698,0,2.814,0,2.968,0,3.041,0,3.278,0,3.328,0,3.5,0,3.563,0,3.569,0,3.69,0,3.819,0,3.79,0,3.956,0,4.063,0,4.047,0,4.029,0,3.941,0,4.022,0,3.879,0,4.022,0,4.028,0,4.091,0,3.987,0,4.01,0,4.007,0,4.191,0,4.299,0,4.273,0,3.82,0,3.15,1,2.486,1,1.812,1,1.257,1,1.062,1,0.842,1,0.782,1,0.698,1,0.358,1,0.347,1,0.363,1,0.359,1,0.355,1),dim=c(2,61),dimnames=list(c('intb','x'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('intb','x'),1:61))
> 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
intb x M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 2.085 0 1 0 0 0 0 0 0 0 0 0 0
2 2.053 0 0 1 0 0 0 0 0 0 0 0 0
3 2.077 0 0 0 1 0 0 0 0 0 0 0 0
4 2.058 0 0 0 0 1 0 0 0 0 0 0 0
5 2.057 0 0 0 0 0 1 0 0 0 0 0 0
6 2.076 0 0 0 0 0 0 1 0 0 0 0 0
7 2.070 0 0 0 0 0 0 0 1 0 0 0 0
8 2.062 0 0 0 0 0 0 0 0 1 0 0 0
9 2.073 0 0 0 0 0 0 0 0 0 1 0 0
10 2.061 0 0 0 0 0 0 0 0 0 0 1 0
11 2.094 0 0 0 0 0 0 0 0 0 0 0 1
12 2.067 0 0 0 0 0 0 0 0 0 0 0 0
13 2.086 0 1 0 0 0 0 0 0 0 0 0 0
14 2.276 0 0 1 0 0 0 0 0 0 0 0 0
15 2.326 0 0 0 1 0 0 0 0 0 0 0 0
16 2.349 0 0 0 0 1 0 0 0 0 0 0 0
17 2.520 0 0 0 0 0 1 0 0 0 0 0 0
18 2.628 0 0 0 0 0 0 1 0 0 0 0 0
19 2.577 0 0 0 0 0 0 0 1 0 0 0 0
20 2.698 0 0 0 0 0 0 0 0 1 0 0 0
21 2.814 0 0 0 0 0 0 0 0 0 1 0 0
22 2.968 0 0 0 0 0 0 0 0 0 0 1 0
23 3.041 0 0 0 0 0 0 0 0 0 0 0 1
24 3.278 0 0 0 0 0 0 0 0 0 0 0 0
25 3.328 0 1 0 0 0 0 0 0 0 0 0 0
26 3.500 0 0 1 0 0 0 0 0 0 0 0 0
27 3.563 0 0 0 1 0 0 0 0 0 0 0 0
28 3.569 0 0 0 0 1 0 0 0 0 0 0 0
29 3.690 0 0 0 0 0 1 0 0 0 0 0 0
30 3.819 0 0 0 0 0 0 1 0 0 0 0 0
31 3.790 0 0 0 0 0 0 0 1 0 0 0 0
32 3.956 0 0 0 0 0 0 0 0 1 0 0 0
33 4.063 0 0 0 0 0 0 0 0 0 1 0 0
34 4.047 0 0 0 0 0 0 0 0 0 0 1 0
35 4.029 0 0 0 0 0 0 0 0 0 0 0 1
36 3.941 0 0 0 0 0 0 0 0 0 0 0 0
37 4.022 0 1 0 0 0 0 0 0 0 0 0 0
38 3.879 0 0 1 0 0 0 0 0 0 0 0 0
39 4.022 0 0 0 1 0 0 0 0 0 0 0 0
40 4.028 0 0 0 0 1 0 0 0 0 0 0 0
41 4.091 0 0 0 0 0 1 0 0 0 0 0 0
42 3.987 0 0 0 0 0 0 1 0 0 0 0 0
43 4.010 0 0 0 0 0 0 0 1 0 0 0 0
44 4.007 0 0 0 0 0 0 0 0 1 0 0 0
45 4.191 0 0 0 0 0 0 0 0 0 1 0 0
46 4.299 0 0 0 0 0 0 0 0 0 0 1 0
47 4.273 0 0 0 0 0 0 0 0 0 0 0 1
48 3.820 0 0 0 0 0 0 0 0 0 0 0 0
49 3.150 1 1 0 0 0 0 0 0 0 0 0 0
50 2.486 1 0 1 0 0 0 0 0 0 0 0 0
51 1.812 1 0 0 1 0 0 0 0 0 0 0 0
52 1.257 1 0 0 0 1 0 0 0 0 0 0 0
53 1.062 1 0 0 0 0 1 0 0 0 0 0 0
54 0.842 1 0 0 0 0 0 1 0 0 0 0 0
55 0.782 1 0 0 0 0 0 0 1 0 0 0 0
56 0.698 1 0 0 0 0 0 0 0 1 0 0 0
57 0.358 1 0 0 0 0 0 0 0 0 1 0 0
58 0.347 1 0 0 0 0 0 0 0 0 0 1 0
59 0.363 1 0 0 0 0 0 0 0 0 0 0 1
60 0.359 1 0 0 0 0 0 0 0 0 0 0 0
61 0.355 1 1 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
3.10689 -2.06943 0.08726 0.14580 0.06700 -0.04080
M5 M6 M7 M8 M9 M10
-0.00900 -0.02260 -0.04720 -0.00880 0.00680 0.05140
M11
0.06700
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.1997 -0.7697 -0.1329 0.8341 2.0253
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.10689 0.42975 7.230 3.27e-09 ***
x -2.06943 0.29894 -6.923 9.66e-09 ***
M1 0.08726 0.57760 0.151 0.881
M2 0.14580 0.60185 0.242 0.810
M3 0.06700 0.60185 0.111 0.912
M4 -0.04080 0.60185 -0.068 0.946
M5 -0.00900 0.60185 -0.015 0.988
M6 -0.02260 0.60185 -0.038 0.970
M7 -0.04720 0.60185 -0.078 0.938
M8 -0.00880 0.60185 -0.015 0.988
M9 0.00680 0.60185 0.011 0.991
M10 0.05140 0.60185 0.085 0.932
M11 0.06700 0.60185 0.111 0.912
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.9516 on 48 degrees of freedom
Multiple R-squared: 0.5019, Adjusted R-squared: 0.3774
F-statistic: 4.03 on 12 and 48 DF, p-value: 0.0002536
> 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.02162466 0.04324932 0.9783753
[2,] 0.02045590 0.04091179 0.9795441
[3,] 0.02253337 0.04506673 0.9774666
[4,] 0.02030239 0.04060477 0.9796976
[5,] 0.02517119 0.05034239 0.9748288
[6,] 0.03579322 0.07158644 0.9642068
[7,] 0.06087978 0.12175956 0.9391202
[8,] 0.09042479 0.18084958 0.9095752
[9,] 0.15059345 0.30118690 0.8494065
[10,] 0.30429272 0.60858543 0.6957073
[11,] 0.49374727 0.98749454 0.5062527
[12,] 0.62458918 0.75082165 0.3754108
[13,] 0.69718001 0.60563998 0.3028200
[14,] 0.74005666 0.51988668 0.2599433
[15,] 0.76429379 0.47141242 0.2357062
[16,] 0.77412028 0.45175944 0.2258797
[17,] 0.78243509 0.43512982 0.2175649
[18,] 0.78627432 0.42745135 0.2137257
[19,] 0.77199414 0.45601173 0.2280059
[20,] 0.74426606 0.51146789 0.2557339
[21,] 0.70074015 0.59851971 0.2992599
[22,] 0.70340956 0.59318087 0.2965904
[23,] 0.79869340 0.40261320 0.2013066
[24,] 0.80746032 0.38507936 0.1925397
[25,] 0.77007568 0.45984863 0.2299243
[26,] 0.70695507 0.58608986 0.2930449
[27,] 0.61732111 0.76535777 0.3826789
[28,] 0.51187225 0.97625550 0.4881277
[29,] 0.39018469 0.78036938 0.6098153
[30,] 0.25712285 0.51424570 0.7428772
> postscript(file="/var/www/html/rcomp/tmp/1jy211258617076.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/29e931258617076.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/3h6001258617076.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/4nt2c1258617076.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/5fac91258617076.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 = 61
Frequency = 1
1 2 3 4 5 6
-1.10914474 -1.19968684 -1.09688684 -1.00808684 -1.04088684 -1.00828684
7 8 9 10 11 12
-0.98968684 -1.03608684 -1.04068684 -1.09728684 -1.07988684 -1.03988684
13 14 15 16 17 18
-1.10814474 -0.97668684 -0.84788684 -0.71708684 -0.57788684 -0.45628684
19 20 21 22 23 24
-0.48268684 -0.40008684 -0.29968684 -0.19028684 -0.13288684 0.17111316
25 26 27 28 29 30
0.13385526 0.24731316 0.38911316 0.50291316 0.59211316 0.73471316
31 32 33 34 35 36
0.73031316 0.85791316 0.94931316 0.88871316 0.85511316 0.83411316
37 38 39 40 41 42
0.82785526 0.62631316 0.84811316 0.96191316 0.99311316 0.90271316
43 44 45 46 47 48
0.95031316 0.90891316 1.07731316 1.14071316 1.09911316 0.71311316
49 50 51 52 53 54
2.02528947 1.30274737 0.70754737 0.26034737 0.03354737 -0.17285263
55 56 57 58 59 60
-0.20825263 -0.33065263 -0.68625263 -0.74185263 -0.74145263 -0.67845263
61
-0.76971053
> postscript(file="/var/www/html/rcomp/tmp/6fab91258617076.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 = 61
Frequency = 1
lag(myerror, k = 1) myerror
0 -1.10914474 NA
1 -1.19968684 -1.10914474
2 -1.09688684 -1.19968684
3 -1.00808684 -1.09688684
4 -1.04088684 -1.00808684
5 -1.00828684 -1.04088684
6 -0.98968684 -1.00828684
7 -1.03608684 -0.98968684
8 -1.04068684 -1.03608684
9 -1.09728684 -1.04068684
10 -1.07988684 -1.09728684
11 -1.03988684 -1.07988684
12 -1.10814474 -1.03988684
13 -0.97668684 -1.10814474
14 -0.84788684 -0.97668684
15 -0.71708684 -0.84788684
16 -0.57788684 -0.71708684
17 -0.45628684 -0.57788684
18 -0.48268684 -0.45628684
19 -0.40008684 -0.48268684
20 -0.29968684 -0.40008684
21 -0.19028684 -0.29968684
22 -0.13288684 -0.19028684
23 0.17111316 -0.13288684
24 0.13385526 0.17111316
25 0.24731316 0.13385526
26 0.38911316 0.24731316
27 0.50291316 0.38911316
28 0.59211316 0.50291316
29 0.73471316 0.59211316
30 0.73031316 0.73471316
31 0.85791316 0.73031316
32 0.94931316 0.85791316
33 0.88871316 0.94931316
34 0.85511316 0.88871316
35 0.83411316 0.85511316
36 0.82785526 0.83411316
37 0.62631316 0.82785526
38 0.84811316 0.62631316
39 0.96191316 0.84811316
40 0.99311316 0.96191316
41 0.90271316 0.99311316
42 0.95031316 0.90271316
43 0.90891316 0.95031316
44 1.07731316 0.90891316
45 1.14071316 1.07731316
46 1.09911316 1.14071316
47 0.71311316 1.09911316
48 2.02528947 0.71311316
49 1.30274737 2.02528947
50 0.70754737 1.30274737
51 0.26034737 0.70754737
52 0.03354737 0.26034737
53 -0.17285263 0.03354737
54 -0.20825263 -0.17285263
55 -0.33065263 -0.20825263
56 -0.68625263 -0.33065263
57 -0.74185263 -0.68625263
58 -0.74145263 -0.74185263
59 -0.67845263 -0.74145263
60 -0.76971053 -0.67845263
61 NA -0.76971053
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.19968684 -1.10914474
[2,] -1.09688684 -1.19968684
[3,] -1.00808684 -1.09688684
[4,] -1.04088684 -1.00808684
[5,] -1.00828684 -1.04088684
[6,] -0.98968684 -1.00828684
[7,] -1.03608684 -0.98968684
[8,] -1.04068684 -1.03608684
[9,] -1.09728684 -1.04068684
[10,] -1.07988684 -1.09728684
[11,] -1.03988684 -1.07988684
[12,] -1.10814474 -1.03988684
[13,] -0.97668684 -1.10814474
[14,] -0.84788684 -0.97668684
[15,] -0.71708684 -0.84788684
[16,] -0.57788684 -0.71708684
[17,] -0.45628684 -0.57788684
[18,] -0.48268684 -0.45628684
[19,] -0.40008684 -0.48268684
[20,] -0.29968684 -0.40008684
[21,] -0.19028684 -0.29968684
[22,] -0.13288684 -0.19028684
[23,] 0.17111316 -0.13288684
[24,] 0.13385526 0.17111316
[25,] 0.24731316 0.13385526
[26,] 0.38911316 0.24731316
[27,] 0.50291316 0.38911316
[28,] 0.59211316 0.50291316
[29,] 0.73471316 0.59211316
[30,] 0.73031316 0.73471316
[31,] 0.85791316 0.73031316
[32,] 0.94931316 0.85791316
[33,] 0.88871316 0.94931316
[34,] 0.85511316 0.88871316
[35,] 0.83411316 0.85511316
[36,] 0.82785526 0.83411316
[37,] 0.62631316 0.82785526
[38,] 0.84811316 0.62631316
[39,] 0.96191316 0.84811316
[40,] 0.99311316 0.96191316
[41,] 0.90271316 0.99311316
[42,] 0.95031316 0.90271316
[43,] 0.90891316 0.95031316
[44,] 1.07731316 0.90891316
[45,] 1.14071316 1.07731316
[46,] 1.09911316 1.14071316
[47,] 0.71311316 1.09911316
[48,] 2.02528947 0.71311316
[49,] 1.30274737 2.02528947
[50,] 0.70754737 1.30274737
[51,] 0.26034737 0.70754737
[52,] 0.03354737 0.26034737
[53,] -0.17285263 0.03354737
[54,] -0.20825263 -0.17285263
[55,] -0.33065263 -0.20825263
[56,] -0.68625263 -0.33065263
[57,] -0.74185263 -0.68625263
[58,] -0.74145263 -0.74185263
[59,] -0.67845263 -0.74145263
[60,] -0.76971053 -0.67845263
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.19968684 -1.10914474
2 -1.09688684 -1.19968684
3 -1.00808684 -1.09688684
4 -1.04088684 -1.00808684
5 -1.00828684 -1.04088684
6 -0.98968684 -1.00828684
7 -1.03608684 -0.98968684
8 -1.04068684 -1.03608684
9 -1.09728684 -1.04068684
10 -1.07988684 -1.09728684
11 -1.03988684 -1.07988684
12 -1.10814474 -1.03988684
13 -0.97668684 -1.10814474
14 -0.84788684 -0.97668684
15 -0.71708684 -0.84788684
16 -0.57788684 -0.71708684
17 -0.45628684 -0.57788684
18 -0.48268684 -0.45628684
19 -0.40008684 -0.48268684
20 -0.29968684 -0.40008684
21 -0.19028684 -0.29968684
22 -0.13288684 -0.19028684
23 0.17111316 -0.13288684
24 0.13385526 0.17111316
25 0.24731316 0.13385526
26 0.38911316 0.24731316
27 0.50291316 0.38911316
28 0.59211316 0.50291316
29 0.73471316 0.59211316
30 0.73031316 0.73471316
31 0.85791316 0.73031316
32 0.94931316 0.85791316
33 0.88871316 0.94931316
34 0.85511316 0.88871316
35 0.83411316 0.85511316
36 0.82785526 0.83411316
37 0.62631316 0.82785526
38 0.84811316 0.62631316
39 0.96191316 0.84811316
40 0.99311316 0.96191316
41 0.90271316 0.99311316
42 0.95031316 0.90271316
43 0.90891316 0.95031316
44 1.07731316 0.90891316
45 1.14071316 1.07731316
46 1.09911316 1.14071316
47 0.71311316 1.09911316
48 2.02528947 0.71311316
49 1.30274737 2.02528947
50 0.70754737 1.30274737
51 0.26034737 0.70754737
52 0.03354737 0.26034737
53 -0.17285263 0.03354737
54 -0.20825263 -0.17285263
55 -0.33065263 -0.20825263
56 -0.68625263 -0.33065263
57 -0.74185263 -0.68625263
58 -0.74145263 -0.74185263
59 -0.67845263 -0.74145263
60 -0.76971053 -0.67845263
> 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/7u1qv1258617076.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/8flmy1258617076.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/96vm71258617076.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/108ye01258617076.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/11az7l1258617077.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/12z91m1258617077.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/136nhh1258617077.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/142tqf1258617077.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/15fan01258617077.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/164c5h1258617077.tab")
+ }
>
> system("convert tmp/1jy211258617076.ps tmp/1jy211258617076.png")
> system("convert tmp/29e931258617076.ps tmp/29e931258617076.png")
> system("convert tmp/3h6001258617076.ps tmp/3h6001258617076.png")
> system("convert tmp/4nt2c1258617076.ps tmp/4nt2c1258617076.png")
> system("convert tmp/5fac91258617076.ps tmp/5fac91258617076.png")
> system("convert tmp/6fab91258617076.ps tmp/6fab91258617076.png")
> system("convert tmp/7u1qv1258617076.ps tmp/7u1qv1258617076.png")
> system("convert tmp/8flmy1258617076.ps tmp/8flmy1258617076.png")
> system("convert tmp/96vm71258617076.ps tmp/96vm71258617076.png")
> system("convert tmp/108ye01258617076.ps tmp/108ye01258617076.png")
>
>
> proc.time()
user system elapsed
2.377 1.548 3.014