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(3956.2,3977.7,3142.7,3983.4,3884.3,4152.9,3892.2,4286.1,3613,4348.1,3730.5,3949.3,3481.3,4166.7,3649.5,4217.9,4215.2,4528.2,4066.6,4232.2,4196.8,4470.9,4536.6,5121.2,4441.6,4170.8,3548.3,4398.6,4735.9,4491.4,4130.6,4251.8,4356.2,4901.9,4159.6,4745.2,3988,4666.9,4167.8,4210.4,4902.2,5273.6,3909.4,4095.3,4697.6,4610.1,4308.9,4718.1,4420.4,4185.5,3544.2,4314.7,4433,4422.6,4479.7,5059.2,4533.2,5043.6,4237.5,4436.6,4207.4,4922.6,4394,4454.8,5148.4,5058.7,4202.2,4768.9,4682.5,5171.8,4884.3,4989.3,5288.9,5202.1,4505.2,4838.4,4611.5,4876.5,5104,5875.5,4586.6,5717.9,4529.3,4778.8,4504.1,6195.9,4604.9,4625.4,4795.4,5549.8,5391.1,6397.6,5213.9,5856.7,5415,6343.8,5990.3,6615.5,4241.8,5904.6,5677.6,6861,5164.2,6553.5,3962.3,5481,4011,5435.3,3310.3,5278,3837.3,4671.8,4145.3,4891.5,3796.7,4241.6,3849.6,4152.1,4285,4484.4,4189.6,4124.7),dim=c(2,61),dimnames=list(c('Y','X'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('Y','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
Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 3956.2 3977.7 1 0 0 0 0 0 0 0 0 0 0
2 3142.7 3983.4 0 1 0 0 0 0 0 0 0 0 0
3 3884.3 4152.9 0 0 1 0 0 0 0 0 0 0 0
4 3892.2 4286.1 0 0 0 1 0 0 0 0 0 0 0
5 3613.0 4348.1 0 0 0 0 1 0 0 0 0 0 0
6 3730.5 3949.3 0 0 0 0 0 1 0 0 0 0 0
7 3481.3 4166.7 0 0 0 0 0 0 1 0 0 0 0
8 3649.5 4217.9 0 0 0 0 0 0 0 1 0 0 0
9 4215.2 4528.2 0 0 0 0 0 0 0 0 1 0 0
10 4066.6 4232.2 0 0 0 0 0 0 0 0 0 1 0
11 4196.8 4470.9 0 0 0 0 0 0 0 0 0 0 1
12 4536.6 5121.2 0 0 0 0 0 0 0 0 0 0 0
13 4441.6 4170.8 1 0 0 0 0 0 0 0 0 0 0
14 3548.3 4398.6 0 1 0 0 0 0 0 0 0 0 0
15 4735.9 4491.4 0 0 1 0 0 0 0 0 0 0 0
16 4130.6 4251.8 0 0 0 1 0 0 0 0 0 0 0
17 4356.2 4901.9 0 0 0 0 1 0 0 0 0 0 0
18 4159.6 4745.2 0 0 0 0 0 1 0 0 0 0 0
19 3988.0 4666.9 0 0 0 0 0 0 1 0 0 0 0
20 4167.8 4210.4 0 0 0 0 0 0 0 1 0 0 0
21 4902.2 5273.6 0 0 0 0 0 0 0 0 1 0 0
22 3909.4 4095.3 0 0 0 0 0 0 0 0 0 1 0
23 4697.6 4610.1 0 0 0 0 0 0 0 0 0 0 1
24 4308.9 4718.1 0 0 0 0 0 0 0 0 0 0 0
25 4420.4 4185.5 1 0 0 0 0 0 0 0 0 0 0
26 3544.2 4314.7 0 1 0 0 0 0 0 0 0 0 0
27 4433.0 4422.6 0 0 1 0 0 0 0 0 0 0 0
28 4479.7 5059.2 0 0 0 1 0 0 0 0 0 0 0
29 4533.2 5043.6 0 0 0 0 1 0 0 0 0 0 0
30 4237.5 4436.6 0 0 0 0 0 1 0 0 0 0 0
31 4207.4 4922.6 0 0 0 0 0 0 1 0 0 0 0
32 4394.0 4454.8 0 0 0 0 0 0 0 1 0 0 0
33 5148.4 5058.7 0 0 0 0 0 0 0 0 1 0 0
34 4202.2 4768.9 0 0 0 0 0 0 0 0 0 1 0
35 4682.5 5171.8 0 0 0 0 0 0 0 0 0 0 1
36 4884.3 4989.3 0 0 0 0 0 0 0 0 0 0 0
37 5288.9 5202.1 1 0 0 0 0 0 0 0 0 0 0
38 4505.2 4838.4 0 1 0 0 0 0 0 0 0 0 0
39 4611.5 4876.5 0 0 1 0 0 0 0 0 0 0 0
40 5104.0 5875.5 0 0 0 1 0 0 0 0 0 0 0
41 4586.6 5717.9 0 0 0 0 1 0 0 0 0 0 0
42 4529.3 4778.8 0 0 0 0 0 1 0 0 0 0 0
43 4504.1 6195.9 0 0 0 0 0 0 1 0 0 0 0
44 4604.9 4625.4 0 0 0 0 0 0 0 1 0 0 0
45 4795.4 5549.8 0 0 0 0 0 0 0 0 1 0 0
46 5391.1 6397.6 0 0 0 0 0 0 0 0 0 1 0
47 5213.9 5856.7 0 0 0 0 0 0 0 0 0 0 1
48 5415.0 6343.8 0 0 0 0 0 0 0 0 0 0 0
49 5990.3 6615.5 1 0 0 0 0 0 0 0 0 0 0
50 4241.8 5904.6 0 1 0 0 0 0 0 0 0 0 0
51 5677.6 6861.0 0 0 1 0 0 0 0 0 0 0 0
52 5164.2 6553.5 0 0 0 1 0 0 0 0 0 0 0
53 3962.3 5481.0 0 0 0 0 1 0 0 0 0 0 0
54 4011.0 5435.3 0 0 0 0 0 1 0 0 0 0 0
55 3310.3 5278.0 0 0 0 0 0 0 1 0 0 0 0
56 3837.3 4671.8 0 0 0 0 0 0 0 1 0 0 0
57 4145.3 4891.5 0 0 0 0 0 0 0 0 1 0 0
58 3796.7 4241.6 0 0 0 0 0 0 0 0 0 1 0
59 3849.6 4152.1 0 0 0 0 0 0 0 0 0 0 1
60 4285.0 4484.4 0 0 0 0 0 0 0 0 0 0 0
61 4189.6 4124.7 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
1677.6889 0.5863 273.9706 -629.5641 82.4443 -175.1206
M5 M6 M7 M8 M9 M10
-456.4358 -281.3439 -737.7092 -147.6388 -3.0361 -187.4985
M11
5.7078
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-723.92 -143.40 11.16 160.29 620.55
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1677.68894 309.74801 5.416 1.93e-06 ***
X 0.58625 0.05459 10.739 2.33e-14 ***
M1 273.97057 180.45697 1.518 0.135522
M2 -629.56405 188.52405 -3.339 0.001630 **
M3 82.44427 187.19507 0.440 0.661611
M4 -175.12059 187.00706 -0.936 0.353735
M5 -456.43575 186.97220 -2.441 0.018377 *
M6 -281.34389 188.65930 -1.491 0.142431
M7 -737.70924 187.02163 -3.945 0.000260 ***
M8 -147.63885 190.77748 -0.774 0.442797
M9 -3.03609 187.00376 -0.016 0.987114
M10 -187.49846 188.13653 -0.997 0.323952
M11 5.70781 187.58310 0.030 0.975852
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 295.6 on 48 degrees of freedom
Multiple R-squared: 0.7911, Adjusted R-squared: 0.7389
F-statistic: 15.15 on 12 and 48 DF, p-value: 1.845e-12
> 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.270722889 0.541445778 0.72927711
[2,] 0.151622012 0.303244024 0.84837799
[3,] 0.247921304 0.495842607 0.75207870
[4,] 0.157151154 0.314302308 0.84284885
[5,] 0.203745615 0.407491230 0.79625439
[6,] 0.127206591 0.254413181 0.87279341
[7,] 0.073334575 0.146669150 0.92666543
[8,] 0.068681126 0.137362252 0.93131887
[9,] 0.044184134 0.088368269 0.95581587
[10,] 0.025230432 0.050460865 0.97476957
[11,] 0.013959426 0.027918853 0.98604057
[12,] 0.006840005 0.013680009 0.99316000
[13,] 0.005034147 0.010068294 0.99496585
[14,] 0.004094406 0.008188811 0.99590559
[15,] 0.002892720 0.005785440 0.99710728
[16,] 0.003420685 0.006841370 0.99657932
[17,] 0.002744921 0.005489842 0.99725508
[18,] 0.010917090 0.021834181 0.98908291
[19,] 0.009654925 0.019309850 0.99034508
[20,] 0.007391865 0.014783730 0.99260813
[21,] 0.008200963 0.016401926 0.99179904
[22,] 0.005079878 0.010159756 0.99492012
[23,] 0.036045406 0.072090812 0.96395459
[24,] 0.027051642 0.054103284 0.97294836
[25,] 0.024654371 0.049308741 0.97534563
[26,] 0.028371548 0.056743097 0.97162845
[27,] 0.176889602 0.353779204 0.82311040
[28,] 0.316415736 0.632831472 0.68358426
[29,] 0.937226582 0.125546835 0.06277342
[30,] 0.913186304 0.173627393 0.08681370
> postscript(file="/var/www/html/rcomp/tmp/143eu1258737433.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/259271258737433.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/3plq41258737433.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/4ofot1258737433.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/5kwox1258737433.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 7
-327.39487 -240.70188 -310.47995 -123.10388 -157.33635 18.86915 98.58328
8 9 10 11 12 13 14
-353.30322 -114.12003 95.27298 -107.67169 -143.40368 44.79983 -78.51379
15 16 17 18 19 20 21
342.67368 135.40457 261.19718 -18.62897 312.03993 169.39367 135.88758
22 23 24 25 26 27 28
18.33090 311.52201 -134.78542 14.98193 -33.42723 80.10783 11.16455
29 30 31 32 33 34 35
355.12525 240.18846 381.53525 252.31363 508.07318 -83.76857 -32.87585
36 37 38 39 40 41 42
281.62299 287.49795 620.55249 -7.49204 156.90688 13.21539 331.37296
43 44 45 46 47 48 49
-68.23967 363.19901 -132.83527 150.30248 97.00002 18.24439 160.28910
50 51 52 53 54 55 56
-267.90959 -104.80952 -180.37211 -472.20146 -571.80161 -723.91878 -431.60309
57 58 59 60 61
-397.00545 -180.13779 -267.97449 -21.67828 -180.17394
> postscript(file="/var/www/html/rcomp/tmp/6zm4c1258737433.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 -327.39487 NA
1 -240.70188 -327.39487
2 -310.47995 -240.70188
3 -123.10388 -310.47995
4 -157.33635 -123.10388
5 18.86915 -157.33635
6 98.58328 18.86915
7 -353.30322 98.58328
8 -114.12003 -353.30322
9 95.27298 -114.12003
10 -107.67169 95.27298
11 -143.40368 -107.67169
12 44.79983 -143.40368
13 -78.51379 44.79983
14 342.67368 -78.51379
15 135.40457 342.67368
16 261.19718 135.40457
17 -18.62897 261.19718
18 312.03993 -18.62897
19 169.39367 312.03993
20 135.88758 169.39367
21 18.33090 135.88758
22 311.52201 18.33090
23 -134.78542 311.52201
24 14.98193 -134.78542
25 -33.42723 14.98193
26 80.10783 -33.42723
27 11.16455 80.10783
28 355.12525 11.16455
29 240.18846 355.12525
30 381.53525 240.18846
31 252.31363 381.53525
32 508.07318 252.31363
33 -83.76857 508.07318
34 -32.87585 -83.76857
35 281.62299 -32.87585
36 287.49795 281.62299
37 620.55249 287.49795
38 -7.49204 620.55249
39 156.90688 -7.49204
40 13.21539 156.90688
41 331.37296 13.21539
42 -68.23967 331.37296
43 363.19901 -68.23967
44 -132.83527 363.19901
45 150.30248 -132.83527
46 97.00002 150.30248
47 18.24439 97.00002
48 160.28910 18.24439
49 -267.90959 160.28910
50 -104.80952 -267.90959
51 -180.37211 -104.80952
52 -472.20146 -180.37211
53 -571.80161 -472.20146
54 -723.91878 -571.80161
55 -431.60309 -723.91878
56 -397.00545 -431.60309
57 -180.13779 -397.00545
58 -267.97449 -180.13779
59 -21.67828 -267.97449
60 -180.17394 -21.67828
61 NA -180.17394
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -240.70188 -327.39487
[2,] -310.47995 -240.70188
[3,] -123.10388 -310.47995
[4,] -157.33635 -123.10388
[5,] 18.86915 -157.33635
[6,] 98.58328 18.86915
[7,] -353.30322 98.58328
[8,] -114.12003 -353.30322
[9,] 95.27298 -114.12003
[10,] -107.67169 95.27298
[11,] -143.40368 -107.67169
[12,] 44.79983 -143.40368
[13,] -78.51379 44.79983
[14,] 342.67368 -78.51379
[15,] 135.40457 342.67368
[16,] 261.19718 135.40457
[17,] -18.62897 261.19718
[18,] 312.03993 -18.62897
[19,] 169.39367 312.03993
[20,] 135.88758 169.39367
[21,] 18.33090 135.88758
[22,] 311.52201 18.33090
[23,] -134.78542 311.52201
[24,] 14.98193 -134.78542
[25,] -33.42723 14.98193
[26,] 80.10783 -33.42723
[27,] 11.16455 80.10783
[28,] 355.12525 11.16455
[29,] 240.18846 355.12525
[30,] 381.53525 240.18846
[31,] 252.31363 381.53525
[32,] 508.07318 252.31363
[33,] -83.76857 508.07318
[34,] -32.87585 -83.76857
[35,] 281.62299 -32.87585
[36,] 287.49795 281.62299
[37,] 620.55249 287.49795
[38,] -7.49204 620.55249
[39,] 156.90688 -7.49204
[40,] 13.21539 156.90688
[41,] 331.37296 13.21539
[42,] -68.23967 331.37296
[43,] 363.19901 -68.23967
[44,] -132.83527 363.19901
[45,] 150.30248 -132.83527
[46,] 97.00002 150.30248
[47,] 18.24439 97.00002
[48,] 160.28910 18.24439
[49,] -267.90959 160.28910
[50,] -104.80952 -267.90959
[51,] -180.37211 -104.80952
[52,] -472.20146 -180.37211
[53,] -571.80161 -472.20146
[54,] -723.91878 -571.80161
[55,] -431.60309 -723.91878
[56,] -397.00545 -431.60309
[57,] -180.13779 -397.00545
[58,] -267.97449 -180.13779
[59,] -21.67828 -267.97449
[60,] -180.17394 -21.67828
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -240.70188 -327.39487
2 -310.47995 -240.70188
3 -123.10388 -310.47995
4 -157.33635 -123.10388
5 18.86915 -157.33635
6 98.58328 18.86915
7 -353.30322 98.58328
8 -114.12003 -353.30322
9 95.27298 -114.12003
10 -107.67169 95.27298
11 -143.40368 -107.67169
12 44.79983 -143.40368
13 -78.51379 44.79983
14 342.67368 -78.51379
15 135.40457 342.67368
16 261.19718 135.40457
17 -18.62897 261.19718
18 312.03993 -18.62897
19 169.39367 312.03993
20 135.88758 169.39367
21 18.33090 135.88758
22 311.52201 18.33090
23 -134.78542 311.52201
24 14.98193 -134.78542
25 -33.42723 14.98193
26 80.10783 -33.42723
27 11.16455 80.10783
28 355.12525 11.16455
29 240.18846 355.12525
30 381.53525 240.18846
31 252.31363 381.53525
32 508.07318 252.31363
33 -83.76857 508.07318
34 -32.87585 -83.76857
35 281.62299 -32.87585
36 287.49795 281.62299
37 620.55249 287.49795
38 -7.49204 620.55249
39 156.90688 -7.49204
40 13.21539 156.90688
41 331.37296 13.21539
42 -68.23967 331.37296
43 363.19901 -68.23967
44 -132.83527 363.19901
45 150.30248 -132.83527
46 97.00002 150.30248
47 18.24439 97.00002
48 160.28910 18.24439
49 -267.90959 160.28910
50 -104.80952 -267.90959
51 -180.37211 -104.80952
52 -472.20146 -180.37211
53 -571.80161 -472.20146
54 -723.91878 -571.80161
55 -431.60309 -723.91878
56 -397.00545 -431.60309
57 -180.13779 -397.00545
58 -267.97449 -180.13779
59 -21.67828 -267.97449
60 -180.17394 -21.67828
> 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/7nxyx1258737433.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/8pyqq1258737433.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/9k7wd1258737433.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/109ae51258737433.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/11qt9g1258737433.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/12cym41258737433.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/13vmty1258737433.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/14vup01258737433.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/15nmft1258737433.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/16epcx1258737433.tab")
+ }
>
> system("convert tmp/143eu1258737433.ps tmp/143eu1258737433.png")
> system("convert tmp/259271258737433.ps tmp/259271258737433.png")
> system("convert tmp/3plq41258737433.ps tmp/3plq41258737433.png")
> system("convert tmp/4ofot1258737433.ps tmp/4ofot1258737433.png")
> system("convert tmp/5kwox1258737433.ps tmp/5kwox1258737433.png")
> system("convert tmp/6zm4c1258737433.ps tmp/6zm4c1258737433.png")
> system("convert tmp/7nxyx1258737433.ps tmp/7nxyx1258737433.png")
> system("convert tmp/8pyqq1258737433.ps tmp/8pyqq1258737433.png")
> system("convert tmp/9k7wd1258737433.ps tmp/9k7wd1258737433.png")
> system("convert tmp/109ae51258737433.ps tmp/109ae51258737433.png")
>
>
> proc.time()
user system elapsed
2.497 1.604 5.514