R version 2.12.0 (2010-10-15)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-pc-linux-gnu (32-bit)
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(119.3,143.7,104.1,124.1,97.1,129.2,97.3,121.9,104.5,124.8,111,129.6,113,125.2,95.4,124.8,86.2,128.3,111.7,129.4,97.5,127.6,99.7,123.7,111.5,129,91.8,118.4,86.3,104.9,88.7,101,95.1,99.5,105.1,106.7,104.5,101.6,89.1,103.2,82.6,104.6,102.7,105.7,91.8,101.1,94.1,98.8,103.1,107.6,93.2,96.9,91,106.4,94.3,102,99.4,105.7,115.7,117,116.8,116,99.8,125.5,96,120.2,115.9,124.1,109.1,111.4,117.3,120.8,109.8,120.2,112.8,124.6,110.7,125.4,100,114.2,113.3,113.6,122.4,110.5,112.5,106.4,104.2,117,92.5,121.9,117.2,114.9,109.3,117.6,106.1,117.6,118.8,125.8,105.3,114.9,106,119.4,102,117.3,112.9,115,116.5,120.9,114.8,117,100.5,117.8,85.4,114,114.6,114.4,109.9,119.6,100.7,113.1,115.5,125.1),dim=c(2,61),dimnames=list(c('TIP','IPCN'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('TIP','IPCN'),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 = '2'
> #'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
> 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
IPCN TIP M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 143.7 119.3 1 0 0 0 0 0 0 0 0 0 0
2 124.1 104.1 0 1 0 0 0 0 0 0 0 0 0
3 129.2 97.1 0 0 1 0 0 0 0 0 0 0 0
4 121.9 97.3 0 0 0 1 0 0 0 0 0 0 0
5 124.8 104.5 0 0 0 0 1 0 0 0 0 0 0
6 129.6 111.0 0 0 0 0 0 1 0 0 0 0 0
7 125.2 113.0 0 0 0 0 0 0 1 0 0 0 0
8 124.8 95.4 0 0 0 0 0 0 0 1 0 0 0
9 128.3 86.2 0 0 0 0 0 0 0 0 1 0 0
10 129.4 111.7 0 0 0 0 0 0 0 0 0 1 0
11 127.6 97.5 0 0 0 0 0 0 0 0 0 0 1
12 123.7 99.7 0 0 0 0 0 0 0 0 0 0 0
13 129.0 111.5 1 0 0 0 0 0 0 0 0 0 0
14 118.4 91.8 0 1 0 0 0 0 0 0 0 0 0
15 104.9 86.3 0 0 1 0 0 0 0 0 0 0 0
16 101.0 88.7 0 0 0 1 0 0 0 0 0 0 0
17 99.5 95.1 0 0 0 0 1 0 0 0 0 0 0
18 106.7 105.1 0 0 0 0 0 1 0 0 0 0 0
19 101.6 104.5 0 0 0 0 0 0 1 0 0 0 0
20 103.2 89.1 0 0 0 0 0 0 0 1 0 0 0
21 104.6 82.6 0 0 0 0 0 0 0 0 1 0 0
22 105.7 102.7 0 0 0 0 0 0 0 0 0 1 0
23 101.1 91.8 0 0 0 0 0 0 0 0 0 0 1
24 98.8 94.1 0 0 0 0 0 0 0 0 0 0 0
25 107.6 103.1 1 0 0 0 0 0 0 0 0 0 0
26 96.9 93.2 0 1 0 0 0 0 0 0 0 0 0
27 106.4 91.0 0 0 1 0 0 0 0 0 0 0 0
28 102.0 94.3 0 0 0 1 0 0 0 0 0 0 0
29 105.7 99.4 0 0 0 0 1 0 0 0 0 0 0
30 117.0 115.7 0 0 0 0 0 1 0 0 0 0 0
31 116.0 116.8 0 0 0 0 0 0 1 0 0 0 0
32 125.5 99.8 0 0 0 0 0 0 0 1 0 0 0
33 120.2 96.0 0 0 0 0 0 0 0 0 1 0 0
34 124.1 115.9 0 0 0 0 0 0 0 0 0 1 0
35 111.4 109.1 0 0 0 0 0 0 0 0 0 0 1
36 120.8 117.3 0 0 0 0 0 0 0 0 0 0 0
37 120.2 109.8 1 0 0 0 0 0 0 0 0 0 0
38 124.6 112.8 0 1 0 0 0 0 0 0 0 0 0
39 125.4 110.7 0 0 1 0 0 0 0 0 0 0 0
40 114.2 100.0 0 0 0 1 0 0 0 0 0 0 0
41 113.6 113.3 0 0 0 0 1 0 0 0 0 0 0
42 110.5 122.4 0 0 0 0 0 1 0 0 0 0 0
43 106.4 112.5 0 0 0 0 0 0 1 0 0 0 0
44 117.0 104.2 0 0 0 0 0 0 0 1 0 0 0
45 121.9 92.5 0 0 0 0 0 0 0 0 1 0 0
46 114.9 117.2 0 0 0 0 0 0 0 0 0 1 0
47 117.6 109.3 0 0 0 0 0 0 0 0 0 0 1
48 117.6 106.1 0 0 0 0 0 0 0 0 0 0 0
49 125.8 118.8 1 0 0 0 0 0 0 0 0 0 0
50 114.9 105.3 0 1 0 0 0 0 0 0 0 0 0
51 119.4 106.0 0 0 1 0 0 0 0 0 0 0 0
52 117.3 102.0 0 0 0 1 0 0 0 0 0 0 0
53 115.0 112.9 0 0 0 0 1 0 0 0 0 0 0
54 120.9 116.5 0 0 0 0 0 1 0 0 0 0 0
55 117.0 114.8 0 0 0 0 0 0 1 0 0 0 0
56 117.8 100.5 0 0 0 0 0 0 0 1 0 0 0
57 114.0 85.4 0 0 0 0 0 0 0 0 1 0 0
58 114.4 114.6 0 0 0 0 0 0 0 0 0 1 0
59 119.6 109.9 0 0 0 0 0 0 0 0 0 0 1
60 113.1 100.7 0 0 0 0 0 0 0 0 0 0 0
61 125.1 115.5 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) TIP M1 M2 M3 M4
32.1360 0.7981 2.9155 2.6879 6.5377 2.1623
M5 M6 M7 M8 M9 M10
-4.2452 -6.2876 -8.5351 7.4728 15.0030 -4.1549
M11
0.7079
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-13.032 -4.898 -2.015 3.623 16.944
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 32.1360 17.3366 1.854 0.0699 .
TIP 0.7981 0.1636 4.879 1.22e-05 ***
M1 2.9155 5.2021 0.560 0.5778
M2 2.6879 5.2013 0.517 0.6077
M3 6.5377 5.2631 1.242 0.2202
M4 2.1623 5.3186 0.407 0.6862
M5 -4.2452 5.1950 -0.817 0.4179
M6 -6.2876 5.4695 -1.150 0.2560
M7 -8.5351 5.3829 -1.586 0.1194
M8 7.4728 5.2750 1.417 0.1630
M9 15.0030 5.7432 2.612 0.0120 *
M10 -4.1549 5.3872 -0.771 0.4443
M11 0.7079 5.1895 0.136 0.8921
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 8.205 on 48 degrees of freedom
Multiple R-squared: 0.4272, Adjusted R-squared: 0.284
F-statistic: 2.983 on 12 and 48 DF, p-value: 0.003506
> 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.9331872 0.1336256236 0.0668128118
[2,] 0.9382158 0.1235684140 0.0617842070
[3,] 0.9609625 0.0780749983 0.0390374991
[4,] 0.9461311 0.1077378077 0.0538689038
[5,] 0.9441172 0.1117656590 0.0558828295
[6,] 0.9787896 0.0424207480 0.0212103740
[7,] 0.9633775 0.0732450011 0.0366225006
[8,] 0.9708292 0.0583416317 0.0291708159
[9,] 0.9744842 0.0510315948 0.0255157974
[10,] 0.9646448 0.0707104774 0.0353552387
[11,] 0.9865915 0.0268169404 0.0134084702
[12,] 0.9852718 0.0294564313 0.0147282156
[13,] 0.9944306 0.0111388190 0.0055694095
[14,] 0.9905356 0.0189288792 0.0094644396
[15,] 0.9953423 0.0093153217 0.0046576609
[16,] 0.9954785 0.0090430072 0.0045215036
[17,] 0.9967774 0.0064451801 0.0032225901
[18,] 0.9972271 0.0055457430 0.0027728715
[19,] 0.9985442 0.0029116676 0.0014558338
[20,] 0.9995867 0.0008265330 0.0004132665
[21,] 0.9994037 0.0011925714 0.0005962857
[22,] 0.9984042 0.0031916922 0.0015958461
[23,] 0.9973850 0.0052299377 0.0026149688
[24,] 0.9950520 0.0098960214 0.0049480107
[25,] 0.9882935 0.0234130892 0.0117065446
[26,] 0.9751836 0.0496328346 0.0248164173
[27,] 0.9971407 0.0057185904 0.0028592952
[28,] 0.9995834 0.0008332557 0.0004166278
[29,] 0.9994072 0.0011856224 0.0005928112
[30,] 0.9980339 0.0039322793 0.0019661396
> postscript(file="/var/www/rcomp/tmp/1ae4f1322159138.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/2na7r1322159138.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/3pmkh1322159138.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/46tj11322159138.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/5rutq1322159138.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 61
Frequency = 1
1 2 3 4 5 6
13.43883049 6.19713584 13.03383754 9.94962184 13.51095739 15.16593740
7 8 9 10 11 12
11.41731292 9.05536616 12.36748201 12.27460985 16.94437679 11.99650863
13 14 15 16 17 18
4.96377052 10.31338742 -2.64701473 -4.08698274 -4.28719181 -3.02545412
19 20 21 22 23 24
-5.39909859 -7.51679766 -8.45946875 -4.24276704 -5.00662858 -8.43430366
25 26 27 28 29 30
-9.73244792 -12.30390951 -4.89794013 -7.55617045 -1.51888952 -1.18498801
31 32 33 34 35 36
-0.81535017 6.24386153 -3.55359649 3.62271907 -8.51322633 -4.94950989
37 38 39 40 41 42
-2.47951178 -0.24606650 -1.61990404 0.09483491 -4.71205187 -13.03205187
43 44 45 46 47 48
-6.98365246 -5.76764310 0.93964583 -6.61477094 -2.47284017 0.78886553
49 50 51 52 53 54
-4.06213489 -3.96054724 -3.86897864 1.59869644 -2.99282418 2.07655661
55 56 57 58 59 60
1.78078830 -2.01478693 -1.29406260 -5.03979093 -0.95168171 0.59843939
61
-2.12850642
> postscript(file="/var/www/rcomp/tmp/6lhz11322159138.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 61
Frequency = 1
lag(myerror, k = 1) myerror
0 13.43883049 NA
1 6.19713584 13.43883049
2 13.03383754 6.19713584
3 9.94962184 13.03383754
4 13.51095739 9.94962184
5 15.16593740 13.51095739
6 11.41731292 15.16593740
7 9.05536616 11.41731292
8 12.36748201 9.05536616
9 12.27460985 12.36748201
10 16.94437679 12.27460985
11 11.99650863 16.94437679
12 4.96377052 11.99650863
13 10.31338742 4.96377052
14 -2.64701473 10.31338742
15 -4.08698274 -2.64701473
16 -4.28719181 -4.08698274
17 -3.02545412 -4.28719181
18 -5.39909859 -3.02545412
19 -7.51679766 -5.39909859
20 -8.45946875 -7.51679766
21 -4.24276704 -8.45946875
22 -5.00662858 -4.24276704
23 -8.43430366 -5.00662858
24 -9.73244792 -8.43430366
25 -12.30390951 -9.73244792
26 -4.89794013 -12.30390951
27 -7.55617045 -4.89794013
28 -1.51888952 -7.55617045
29 -1.18498801 -1.51888952
30 -0.81535017 -1.18498801
31 6.24386153 -0.81535017
32 -3.55359649 6.24386153
33 3.62271907 -3.55359649
34 -8.51322633 3.62271907
35 -4.94950989 -8.51322633
36 -2.47951178 -4.94950989
37 -0.24606650 -2.47951178
38 -1.61990404 -0.24606650
39 0.09483491 -1.61990404
40 -4.71205187 0.09483491
41 -13.03205187 -4.71205187
42 -6.98365246 -13.03205187
43 -5.76764310 -6.98365246
44 0.93964583 -5.76764310
45 -6.61477094 0.93964583
46 -2.47284017 -6.61477094
47 0.78886553 -2.47284017
48 -4.06213489 0.78886553
49 -3.96054724 -4.06213489
50 -3.86897864 -3.96054724
51 1.59869644 -3.86897864
52 -2.99282418 1.59869644
53 2.07655661 -2.99282418
54 1.78078830 2.07655661
55 -2.01478693 1.78078830
56 -1.29406260 -2.01478693
57 -5.03979093 -1.29406260
58 -0.95168171 -5.03979093
59 0.59843939 -0.95168171
60 -2.12850642 0.59843939
61 NA -2.12850642
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 6.19713584 13.43883049
[2,] 13.03383754 6.19713584
[3,] 9.94962184 13.03383754
[4,] 13.51095739 9.94962184
[5,] 15.16593740 13.51095739
[6,] 11.41731292 15.16593740
[7,] 9.05536616 11.41731292
[8,] 12.36748201 9.05536616
[9,] 12.27460985 12.36748201
[10,] 16.94437679 12.27460985
[11,] 11.99650863 16.94437679
[12,] 4.96377052 11.99650863
[13,] 10.31338742 4.96377052
[14,] -2.64701473 10.31338742
[15,] -4.08698274 -2.64701473
[16,] -4.28719181 -4.08698274
[17,] -3.02545412 -4.28719181
[18,] -5.39909859 -3.02545412
[19,] -7.51679766 -5.39909859
[20,] -8.45946875 -7.51679766
[21,] -4.24276704 -8.45946875
[22,] -5.00662858 -4.24276704
[23,] -8.43430366 -5.00662858
[24,] -9.73244792 -8.43430366
[25,] -12.30390951 -9.73244792
[26,] -4.89794013 -12.30390951
[27,] -7.55617045 -4.89794013
[28,] -1.51888952 -7.55617045
[29,] -1.18498801 -1.51888952
[30,] -0.81535017 -1.18498801
[31,] 6.24386153 -0.81535017
[32,] -3.55359649 6.24386153
[33,] 3.62271907 -3.55359649
[34,] -8.51322633 3.62271907
[35,] -4.94950989 -8.51322633
[36,] -2.47951178 -4.94950989
[37,] -0.24606650 -2.47951178
[38,] -1.61990404 -0.24606650
[39,] 0.09483491 -1.61990404
[40,] -4.71205187 0.09483491
[41,] -13.03205187 -4.71205187
[42,] -6.98365246 -13.03205187
[43,] -5.76764310 -6.98365246
[44,] 0.93964583 -5.76764310
[45,] -6.61477094 0.93964583
[46,] -2.47284017 -6.61477094
[47,] 0.78886553 -2.47284017
[48,] -4.06213489 0.78886553
[49,] -3.96054724 -4.06213489
[50,] -3.86897864 -3.96054724
[51,] 1.59869644 -3.86897864
[52,] -2.99282418 1.59869644
[53,] 2.07655661 -2.99282418
[54,] 1.78078830 2.07655661
[55,] -2.01478693 1.78078830
[56,] -1.29406260 -2.01478693
[57,] -5.03979093 -1.29406260
[58,] -0.95168171 -5.03979093
[59,] 0.59843939 -0.95168171
[60,] -2.12850642 0.59843939
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 6.19713584 13.43883049
2 13.03383754 6.19713584
3 9.94962184 13.03383754
4 13.51095739 9.94962184
5 15.16593740 13.51095739
6 11.41731292 15.16593740
7 9.05536616 11.41731292
8 12.36748201 9.05536616
9 12.27460985 12.36748201
10 16.94437679 12.27460985
11 11.99650863 16.94437679
12 4.96377052 11.99650863
13 10.31338742 4.96377052
14 -2.64701473 10.31338742
15 -4.08698274 -2.64701473
16 -4.28719181 -4.08698274
17 -3.02545412 -4.28719181
18 -5.39909859 -3.02545412
19 -7.51679766 -5.39909859
20 -8.45946875 -7.51679766
21 -4.24276704 -8.45946875
22 -5.00662858 -4.24276704
23 -8.43430366 -5.00662858
24 -9.73244792 -8.43430366
25 -12.30390951 -9.73244792
26 -4.89794013 -12.30390951
27 -7.55617045 -4.89794013
28 -1.51888952 -7.55617045
29 -1.18498801 -1.51888952
30 -0.81535017 -1.18498801
31 6.24386153 -0.81535017
32 -3.55359649 6.24386153
33 3.62271907 -3.55359649
34 -8.51322633 3.62271907
35 -4.94950989 -8.51322633
36 -2.47951178 -4.94950989
37 -0.24606650 -2.47951178
38 -1.61990404 -0.24606650
39 0.09483491 -1.61990404
40 -4.71205187 0.09483491
41 -13.03205187 -4.71205187
42 -6.98365246 -13.03205187
43 -5.76764310 -6.98365246
44 0.93964583 -5.76764310
45 -6.61477094 0.93964583
46 -2.47284017 -6.61477094
47 0.78886553 -2.47284017
48 -4.06213489 0.78886553
49 -3.96054724 -4.06213489
50 -3.86897864 -3.96054724
51 1.59869644 -3.86897864
52 -2.99282418 1.59869644
53 2.07655661 -2.99282418
54 1.78078830 2.07655661
55 -2.01478693 1.78078830
56 -1.29406260 -2.01478693
57 -5.03979093 -1.29406260
58 -0.95168171 -5.03979093
59 0.59843939 -0.95168171
60 -2.12850642 0.59843939
> 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/rcomp/tmp/73r711322159138.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/8ocnz1322159138.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/9qsee1322159138.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/www/rcomp/tmp/103l5s1322159138.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/rcomp/tmp/118q9e1322159138.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/rcomp/tmp/12ksgb1322159138.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/rcomp/tmp/13n9291322159138.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/rcomp/tmp/14r1au1322159138.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/rcomp/tmp/15siwh1322159138.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/rcomp/tmp/16vkgm1322159138.tab")
+ }
>
> try(system("convert tmp/1ae4f1322159138.ps tmp/1ae4f1322159138.png",intern=TRUE))
character(0)
> try(system("convert tmp/2na7r1322159138.ps tmp/2na7r1322159138.png",intern=TRUE))
character(0)
> try(system("convert tmp/3pmkh1322159138.ps tmp/3pmkh1322159138.png",intern=TRUE))
character(0)
> try(system("convert tmp/46tj11322159138.ps tmp/46tj11322159138.png",intern=TRUE))
character(0)
> try(system("convert tmp/5rutq1322159138.ps tmp/5rutq1322159138.png",intern=TRUE))
character(0)
> try(system("convert tmp/6lhz11322159138.ps tmp/6lhz11322159138.png",intern=TRUE))
character(0)
> try(system("convert tmp/73r711322159138.ps tmp/73r711322159138.png",intern=TRUE))
character(0)
> try(system("convert tmp/8ocnz1322159138.ps tmp/8ocnz1322159138.png",intern=TRUE))
character(0)
> try(system("convert tmp/9qsee1322159138.ps tmp/9qsee1322159138.png",intern=TRUE))
character(0)
> try(system("convert tmp/103l5s1322159138.ps tmp/103l5s1322159138.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.520 0.440 4.931