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(100.00,100.00,94.97,106.73,107.50,104.81,124.27,96.15,107.06,88.46,79.71,88.46,163.41,91.35,144.83,92.31,166.82,91.35,154.26,87.50,132.60,85.58,157.51,86.54,104.02,97.12,106.03,99.04,113.23,98.08,117.64,92.31,113.34,88.46,66.62,89.42,185.99,90.38,174.57,90.38,208.19,88.46,163.81,86.54,162.46,86.54,148.16,86.54,113.41,94.23,105.63,96.15,111.79,94.23,132.36,89.42,110.75,86.54,67.37,86.54,178.29,87.50,156.38,87.50,189.71,87.50,152.80,88.46,150.80,84.62,160.40,79.81,127.25,80.77,108.47,77.88,117.09,74.04,147.25,75.96,116.19,75.96,75.83,76.92,181.94,75.96,179.12,73.08,183.15,68.27,197.90,65.38,155.42,62.50,162.54,66.35,125.90,78.85,105.50,83.65,121.11,79.81,137.51,75.96,97.20,72.12,69.74,75.00,152.58,79.81,146.59,80.77,161.16,78.85,152.84,74.04,121.95,69.23,140.12,70.19),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 100.00 100.00 1 0 0 0 0 0 0 0 0 0 0
2 94.97 106.73 0 1 0 0 0 0 0 0 0 0 0
3 107.50 104.81 0 0 1 0 0 0 0 0 0 0 0
4 124.27 96.15 0 0 0 1 0 0 0 0 0 0 0
5 107.06 88.46 0 0 0 0 1 0 0 0 0 0 0
6 79.71 88.46 0 0 0 0 0 1 0 0 0 0 0
7 163.41 91.35 0 0 0 0 0 0 1 0 0 0 0
8 144.83 92.31 0 0 0 0 0 0 0 1 0 0 0
9 166.82 91.35 0 0 0 0 0 0 0 0 1 0 0
10 154.26 87.50 0 0 0 0 0 0 0 0 0 1 0
11 132.60 85.58 0 0 0 0 0 0 0 0 0 0 1
12 157.51 86.54 0 0 0 0 0 0 0 0 0 0 0
13 104.02 97.12 1 0 0 0 0 0 0 0 0 0 0
14 106.03 99.04 0 1 0 0 0 0 0 0 0 0 0
15 113.23 98.08 0 0 1 0 0 0 0 0 0 0 0
16 117.64 92.31 0 0 0 1 0 0 0 0 0 0 0
17 113.34 88.46 0 0 0 0 1 0 0 0 0 0 0
18 66.62 89.42 0 0 0 0 0 1 0 0 0 0 0
19 185.99 90.38 0 0 0 0 0 0 1 0 0 0 0
20 174.57 90.38 0 0 0 0 0 0 0 1 0 0 0
21 208.19 88.46 0 0 0 0 0 0 0 0 1 0 0
22 163.81 86.54 0 0 0 0 0 0 0 0 0 1 0
23 162.46 86.54 0 0 0 0 0 0 0 0 0 0 1
24 148.16 86.54 0 0 0 0 0 0 0 0 0 0 0
25 113.41 94.23 1 0 0 0 0 0 0 0 0 0 0
26 105.63 96.15 0 1 0 0 0 0 0 0 0 0 0
27 111.79 94.23 0 0 1 0 0 0 0 0 0 0 0
28 132.36 89.42 0 0 0 1 0 0 0 0 0 0 0
29 110.75 86.54 0 0 0 0 1 0 0 0 0 0 0
30 67.37 86.54 0 0 0 0 0 1 0 0 0 0 0
31 178.29 87.50 0 0 0 0 0 0 1 0 0 0 0
32 156.38 87.50 0 0 0 0 0 0 0 1 0 0 0
33 189.71 87.50 0 0 0 0 0 0 0 0 1 0 0
34 152.80 88.46 0 0 0 0 0 0 0 0 0 1 0
35 150.80 84.62 0 0 0 0 0 0 0 0 0 0 1
36 160.40 79.81 0 0 0 0 0 0 0 0 0 0 0
37 127.25 80.77 1 0 0 0 0 0 0 0 0 0 0
38 108.47 77.88 0 1 0 0 0 0 0 0 0 0 0
39 117.09 74.04 0 0 1 0 0 0 0 0 0 0 0
40 147.25 75.96 0 0 0 1 0 0 0 0 0 0 0
41 116.19 75.96 0 0 0 0 1 0 0 0 0 0 0
42 75.83 76.92 0 0 0 0 0 1 0 0 0 0 0
43 181.94 75.96 0 0 0 0 0 0 1 0 0 0 0
44 179.12 73.08 0 0 0 0 0 0 0 1 0 0 0
45 183.15 68.27 0 0 0 0 0 0 0 0 1 0 0
46 197.90 65.38 0 0 0 0 0 0 0 0 0 1 0
47 155.42 62.50 0 0 0 0 0 0 0 0 0 0 1
48 162.54 66.35 0 0 0 0 0 0 0 0 0 0 0
49 125.90 78.85 1 0 0 0 0 0 0 0 0 0 0
50 105.50 83.65 0 1 0 0 0 0 0 0 0 0 0
51 121.11 79.81 0 0 1 0 0 0 0 0 0 0 0
52 137.51 75.96 0 0 0 1 0 0 0 0 0 0 0
53 97.20 72.12 0 0 0 0 1 0 0 0 0 0 0
54 69.74 75.00 0 0 0 0 0 1 0 0 0 0 0
55 152.58 79.81 0 0 0 0 0 0 1 0 0 0 0
56 146.59 80.77 0 0 0 0 0 0 0 1 0 0 0
57 161.16 78.85 0 0 0 0 0 0 0 0 1 0 0
58 152.84 74.04 0 0 0 0 0 0 0 0 0 1 0
59 121.95 69.23 0 0 0 0 0 0 0 0 0 0 1
60 140.12 70.19 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
183.653 -0.384 -34.904 -43.942 -34.876 -18.840
M5 M6 M7 M8 M9 M10
-43.140 -79.825 21.428 9.210 29.980 11.535
M11
-9.174
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-25.946 -6.778 0.679 6.798 28.524
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 183.6530 15.5682 11.797 1.19e-15 ***
X -0.3840 0.1868 -2.056 0.045367 *
M1 -34.9039 8.1738 -4.270 9.42e-05 ***
M2 -43.9415 8.3170 -5.283 3.21e-06 ***
M3 -34.8759 8.1738 -4.267 9.52e-05 ***
M4 -18.8397 7.9876 -2.359 0.022552 *
M5 -43.1400 7.8873 -5.470 1.69e-06 ***
M6 -79.8254 7.9081 -10.094 2.36e-13 ***
M7 21.4277 7.9557 2.693 0.009774 **
M8 9.2099 7.9498 1.159 0.252505
M9 29.9799 7.8993 3.795 0.000422 ***
M10 11.5352 7.8578 1.468 0.148767
M11 -9.1737 7.8440 -1.170 0.248091
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 12.4 on 47 degrees of freedom
Multiple R-squared: 0.8938, Adjusted R-squared: 0.8667
F-statistic: 32.97 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.04620492 0.09240983 0.9537951
[2,] 0.02053001 0.04106003 0.9794700
[3,] 0.02446556 0.04893112 0.9755344
[4,] 0.08542950 0.17085900 0.9145705
[5,] 0.21407538 0.42815077 0.7859246
[6,] 0.55326398 0.89347204 0.4467360
[7,] 0.45054776 0.90109552 0.5494522
[8,] 0.63958863 0.72082275 0.3604114
[9,] 0.55195636 0.89608727 0.4480436
[10,] 0.45453769 0.90907538 0.5454623
[11,] 0.37336923 0.74673846 0.6266308
[12,] 0.30346833 0.60693665 0.6965317
[13,] 0.22647822 0.45295644 0.7735218
[14,] 0.16620949 0.33241898 0.8337905
[15,] 0.12167947 0.24335893 0.8783205
[16,] 0.09236862 0.18473724 0.9076314
[17,] 0.06274747 0.12549495 0.9372525
[18,] 0.06834089 0.13668179 0.9316591
[19,] 0.04425392 0.08850785 0.9557461
[20,] 0.08438384 0.16876769 0.9156162
[21,] 0.23036577 0.46073155 0.7696342
[22,] 0.16608544 0.33217087 0.8339146
[23,] 0.17870555 0.35741110 0.8212944
[24,] 0.23641037 0.47282074 0.7635896
[25,] 0.19373385 0.38746769 0.8062662
[26,] 0.51996581 0.96006838 0.4800342
[27,] 0.50209559 0.99580881 0.4979044
[28,] 0.49723016 0.99446031 0.5027698
[29,] 0.34614327 0.69228655 0.6538567
> postscript(file="/var/www/html/rcomp/tmp/1sv411259349442.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/269rk1259349443.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/3q6lc1259349443.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/4jxuc1259349443.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/5l9r41259349443.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
-10.3506533 -3.7588652 -1.0316904 -3.6232034 0.5142693 9.8496447
7 8 9 10 11 12
-6.5937018 -12.5873523 -11.7359597 -7.3295701 -9.0179025 7.0869972
13 14 15 16 17 18
-7.4365271 4.3482982 2.1140975 -11.7277018 6.7942693 -2.8717307
19 20 21 22 23 24
15.6138337 16.4115586 28.5243266 1.8518053 21.2107221 -2.2630028
25 26 27 28 29 30
0.8437593 2.8385845 -0.8042407 1.8825845 3.4670201 -3.2276045
31 32 33 34 35 36
6.8079599 -2.8843152 9.6757020 -8.4209455 8.8134729 7.3927851
37 38 39 40 41 42
9.5153351 -1.3368025 -3.2568769 11.6041604 4.8444698 1.5384698
43 44 45 46 47 48
6.0267850 14.3186361 -4.2683096 27.8167046 4.9397477 4.3643610
49 50 51 52 53 54
7.4280859 -2.0912150 2.9787105 1.8641604 -15.6200286 -5.2887794
55 56 57 58 59 60
-21.8548768 -15.2585272 -22.1957593 -13.9179943 -25.9460403 -16.5811406
> postscript(file="/var/www/html/rcomp/tmp/6do7o1259349443.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 -10.3506533 NA
1 -3.7588652 -10.3506533
2 -1.0316904 -3.7588652
3 -3.6232034 -1.0316904
4 0.5142693 -3.6232034
5 9.8496447 0.5142693
6 -6.5937018 9.8496447
7 -12.5873523 -6.5937018
8 -11.7359597 -12.5873523
9 -7.3295701 -11.7359597
10 -9.0179025 -7.3295701
11 7.0869972 -9.0179025
12 -7.4365271 7.0869972
13 4.3482982 -7.4365271
14 2.1140975 4.3482982
15 -11.7277018 2.1140975
16 6.7942693 -11.7277018
17 -2.8717307 6.7942693
18 15.6138337 -2.8717307
19 16.4115586 15.6138337
20 28.5243266 16.4115586
21 1.8518053 28.5243266
22 21.2107221 1.8518053
23 -2.2630028 21.2107221
24 0.8437593 -2.2630028
25 2.8385845 0.8437593
26 -0.8042407 2.8385845
27 1.8825845 -0.8042407
28 3.4670201 1.8825845
29 -3.2276045 3.4670201
30 6.8079599 -3.2276045
31 -2.8843152 6.8079599
32 9.6757020 -2.8843152
33 -8.4209455 9.6757020
34 8.8134729 -8.4209455
35 7.3927851 8.8134729
36 9.5153351 7.3927851
37 -1.3368025 9.5153351
38 -3.2568769 -1.3368025
39 11.6041604 -3.2568769
40 4.8444698 11.6041604
41 1.5384698 4.8444698
42 6.0267850 1.5384698
43 14.3186361 6.0267850
44 -4.2683096 14.3186361
45 27.8167046 -4.2683096
46 4.9397477 27.8167046
47 4.3643610 4.9397477
48 7.4280859 4.3643610
49 -2.0912150 7.4280859
50 2.9787105 -2.0912150
51 1.8641604 2.9787105
52 -15.6200286 1.8641604
53 -5.2887794 -15.6200286
54 -21.8548768 -5.2887794
55 -15.2585272 -21.8548768
56 -22.1957593 -15.2585272
57 -13.9179943 -22.1957593
58 -25.9460403 -13.9179943
59 -16.5811406 -25.9460403
60 NA -16.5811406
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -3.7588652 -10.3506533
[2,] -1.0316904 -3.7588652
[3,] -3.6232034 -1.0316904
[4,] 0.5142693 -3.6232034
[5,] 9.8496447 0.5142693
[6,] -6.5937018 9.8496447
[7,] -12.5873523 -6.5937018
[8,] -11.7359597 -12.5873523
[9,] -7.3295701 -11.7359597
[10,] -9.0179025 -7.3295701
[11,] 7.0869972 -9.0179025
[12,] -7.4365271 7.0869972
[13,] 4.3482982 -7.4365271
[14,] 2.1140975 4.3482982
[15,] -11.7277018 2.1140975
[16,] 6.7942693 -11.7277018
[17,] -2.8717307 6.7942693
[18,] 15.6138337 -2.8717307
[19,] 16.4115586 15.6138337
[20,] 28.5243266 16.4115586
[21,] 1.8518053 28.5243266
[22,] 21.2107221 1.8518053
[23,] -2.2630028 21.2107221
[24,] 0.8437593 -2.2630028
[25,] 2.8385845 0.8437593
[26,] -0.8042407 2.8385845
[27,] 1.8825845 -0.8042407
[28,] 3.4670201 1.8825845
[29,] -3.2276045 3.4670201
[30,] 6.8079599 -3.2276045
[31,] -2.8843152 6.8079599
[32,] 9.6757020 -2.8843152
[33,] -8.4209455 9.6757020
[34,] 8.8134729 -8.4209455
[35,] 7.3927851 8.8134729
[36,] 9.5153351 7.3927851
[37,] -1.3368025 9.5153351
[38,] -3.2568769 -1.3368025
[39,] 11.6041604 -3.2568769
[40,] 4.8444698 11.6041604
[41,] 1.5384698 4.8444698
[42,] 6.0267850 1.5384698
[43,] 14.3186361 6.0267850
[44,] -4.2683096 14.3186361
[45,] 27.8167046 -4.2683096
[46,] 4.9397477 27.8167046
[47,] 4.3643610 4.9397477
[48,] 7.4280859 4.3643610
[49,] -2.0912150 7.4280859
[50,] 2.9787105 -2.0912150
[51,] 1.8641604 2.9787105
[52,] -15.6200286 1.8641604
[53,] -5.2887794 -15.6200286
[54,] -21.8548768 -5.2887794
[55,] -15.2585272 -21.8548768
[56,] -22.1957593 -15.2585272
[57,] -13.9179943 -22.1957593
[58,] -25.9460403 -13.9179943
[59,] -16.5811406 -25.9460403
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -3.7588652 -10.3506533
2 -1.0316904 -3.7588652
3 -3.6232034 -1.0316904
4 0.5142693 -3.6232034
5 9.8496447 0.5142693
6 -6.5937018 9.8496447
7 -12.5873523 -6.5937018
8 -11.7359597 -12.5873523
9 -7.3295701 -11.7359597
10 -9.0179025 -7.3295701
11 7.0869972 -9.0179025
12 -7.4365271 7.0869972
13 4.3482982 -7.4365271
14 2.1140975 4.3482982
15 -11.7277018 2.1140975
16 6.7942693 -11.7277018
17 -2.8717307 6.7942693
18 15.6138337 -2.8717307
19 16.4115586 15.6138337
20 28.5243266 16.4115586
21 1.8518053 28.5243266
22 21.2107221 1.8518053
23 -2.2630028 21.2107221
24 0.8437593 -2.2630028
25 2.8385845 0.8437593
26 -0.8042407 2.8385845
27 1.8825845 -0.8042407
28 3.4670201 1.8825845
29 -3.2276045 3.4670201
30 6.8079599 -3.2276045
31 -2.8843152 6.8079599
32 9.6757020 -2.8843152
33 -8.4209455 9.6757020
34 8.8134729 -8.4209455
35 7.3927851 8.8134729
36 9.5153351 7.3927851
37 -1.3368025 9.5153351
38 -3.2568769 -1.3368025
39 11.6041604 -3.2568769
40 4.8444698 11.6041604
41 1.5384698 4.8444698
42 6.0267850 1.5384698
43 14.3186361 6.0267850
44 -4.2683096 14.3186361
45 27.8167046 -4.2683096
46 4.9397477 27.8167046
47 4.3643610 4.9397477
48 7.4280859 4.3643610
49 -2.0912150 7.4280859
50 2.9787105 -2.0912150
51 1.8641604 2.9787105
52 -15.6200286 1.8641604
53 -5.2887794 -15.6200286
54 -21.8548768 -5.2887794
55 -15.2585272 -21.8548768
56 -22.1957593 -15.2585272
57 -13.9179943 -22.1957593
58 -25.9460403 -13.9179943
59 -16.5811406 -25.9460403
> 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/739bu1259349443.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/8ks1z1259349443.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/9fhyz1259349443.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/101b2b1259349443.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/11n4941259349443.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/12y5yc1259349443.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/134ok01259349443.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/14ry8c1259349443.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/15lid71259349443.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/16361c1259349443.tab")
+ }
>
> system("convert tmp/1sv411259349442.ps tmp/1sv411259349442.png")
> system("convert tmp/269rk1259349443.ps tmp/269rk1259349443.png")
> system("convert tmp/3q6lc1259349443.ps tmp/3q6lc1259349443.png")
> system("convert tmp/4jxuc1259349443.ps tmp/4jxuc1259349443.png")
> system("convert tmp/5l9r41259349443.ps tmp/5l9r41259349443.png")
> system("convert tmp/6do7o1259349443.ps tmp/6do7o1259349443.png")
> system("convert tmp/739bu1259349443.ps tmp/739bu1259349443.png")
> system("convert tmp/8ks1z1259349443.ps tmp/8ks1z1259349443.png")
> system("convert tmp/9fhyz1259349443.ps tmp/9fhyz1259349443.png")
> system("convert tmp/101b2b1259349443.ps tmp/101b2b1259349443.png")
>
>
> proc.time()
user system elapsed
2.432 1.566 3.296