R version 2.13.0 (2011-04-13)
Copyright (C) 2011 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 = '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 t
1 143.7 119.3 1 0 0 0 0 0 0 0 0 0 0 1
2 124.1 104.1 0 1 0 0 0 0 0 0 0 0 0 2
3 129.2 97.1 0 0 1 0 0 0 0 0 0 0 0 3
4 121.9 97.3 0 0 0 1 0 0 0 0 0 0 0 4
5 124.8 104.5 0 0 0 0 1 0 0 0 0 0 0 5
6 129.6 111.0 0 0 0 0 0 1 0 0 0 0 0 6
7 125.2 113.0 0 0 0 0 0 0 1 0 0 0 0 7
8 124.8 95.4 0 0 0 0 0 0 0 1 0 0 0 8
9 128.3 86.2 0 0 0 0 0 0 0 0 1 0 0 9
10 129.4 111.7 0 0 0 0 0 0 0 0 0 1 0 10
11 127.6 97.5 0 0 0 0 0 0 0 0 0 0 1 11
12 123.7 99.7 0 0 0 0 0 0 0 0 0 0 0 12
13 129.0 111.5 1 0 0 0 0 0 0 0 0 0 0 13
14 118.4 91.8 0 1 0 0 0 0 0 0 0 0 0 14
15 104.9 86.3 0 0 1 0 0 0 0 0 0 0 0 15
16 101.0 88.7 0 0 0 1 0 0 0 0 0 0 0 16
17 99.5 95.1 0 0 0 0 1 0 0 0 0 0 0 17
18 106.7 105.1 0 0 0 0 0 1 0 0 0 0 0 18
19 101.6 104.5 0 0 0 0 0 0 1 0 0 0 0 19
20 103.2 89.1 0 0 0 0 0 0 0 1 0 0 0 20
21 104.6 82.6 0 0 0 0 0 0 0 0 1 0 0 21
22 105.7 102.7 0 0 0 0 0 0 0 0 0 1 0 22
23 101.1 91.8 0 0 0 0 0 0 0 0 0 0 1 23
24 98.8 94.1 0 0 0 0 0 0 0 0 0 0 0 24
25 107.6 103.1 1 0 0 0 0 0 0 0 0 0 0 25
26 96.9 93.2 0 1 0 0 0 0 0 0 0 0 0 26
27 106.4 91.0 0 0 1 0 0 0 0 0 0 0 0 27
28 102.0 94.3 0 0 0 1 0 0 0 0 0 0 0 28
29 105.7 99.4 0 0 0 0 1 0 0 0 0 0 0 29
30 117.0 115.7 0 0 0 0 0 1 0 0 0 0 0 30
31 116.0 116.8 0 0 0 0 0 0 1 0 0 0 0 31
32 125.5 99.8 0 0 0 0 0 0 0 1 0 0 0 32
33 120.2 96.0 0 0 0 0 0 0 0 0 1 0 0 33
34 124.1 115.9 0 0 0 0 0 0 0 0 0 1 0 34
35 111.4 109.1 0 0 0 0 0 0 0 0 0 0 1 35
36 120.8 117.3 0 0 0 0 0 0 0 0 0 0 0 36
37 120.2 109.8 1 0 0 0 0 0 0 0 0 0 0 37
38 124.6 112.8 0 1 0 0 0 0 0 0 0 0 0 38
39 125.4 110.7 0 0 1 0 0 0 0 0 0 0 0 39
40 114.2 100.0 0 0 0 1 0 0 0 0 0 0 0 40
41 113.6 113.3 0 0 0 0 1 0 0 0 0 0 0 41
42 110.5 122.4 0 0 0 0 0 1 0 0 0 0 0 42
43 106.4 112.5 0 0 0 0 0 0 1 0 0 0 0 43
44 117.0 104.2 0 0 0 0 0 0 0 1 0 0 0 44
45 121.9 92.5 0 0 0 0 0 0 0 0 1 0 0 45
46 114.9 117.2 0 0 0 0 0 0 0 0 0 1 0 46
47 117.6 109.3 0 0 0 0 0 0 0 0 0 0 1 47
48 117.6 106.1 0 0 0 0 0 0 0 0 0 0 0 48
49 125.8 118.8 1 0 0 0 0 0 0 0 0 0 0 49
50 114.9 105.3 0 1 0 0 0 0 0 0 0 0 0 50
51 119.4 106.0 0 0 1 0 0 0 0 0 0 0 0 51
52 117.3 102.0 0 0 0 1 0 0 0 0 0 0 0 52
53 115.0 112.9 0 0 0 0 1 0 0 0 0 0 0 53
54 120.9 116.5 0 0 0 0 0 1 0 0 0 0 0 54
55 117.0 114.8 0 0 0 0 0 0 1 0 0 0 0 55
56 117.8 100.5 0 0 0 0 0 0 0 1 0 0 0 56
57 114.0 85.4 0 0 0 0 0 0 0 0 1 0 0 57
58 114.4 114.6 0 0 0 0 0 0 0 0 0 1 0 58
59 119.6 109.9 0 0 0 0 0 0 0 0 0 0 1 59
60 113.1 100.7 0 0 0 0 0 0 0 0 0 0 0 60
61 125.1 115.5 1 0 0 0 0 0 0 0 0 0 0 61
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) TIP M1 M2 M3 M4
3.0558 1.1794 -2.1246 0.6088 5.9762 2.5615
M5 M6 M7 M8 M9 M10
-6.8286 -12.0520 -13.3159 8.5191 19.8703 -8.1053
M11 t
0.4412 -0.2895
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-12.7080 -4.0111 0.3245 4.2095 12.2918
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.05578 15.07057 0.203 0.840194
TIP 1.17944 0.15113 7.804 5.00e-10 ***
M1 -2.12463 4.30753 -0.493 0.624143
M2 0.60883 4.21457 0.144 0.885756
M3 5.97616 4.24657 1.407 0.165920
M4 2.56150 4.29068 0.597 0.553378
M5 -6.82862 4.21993 -1.618 0.112315
M6 -12.05204 4.55013 -2.649 0.010967 *
M7 -13.31594 4.43901 -3.000 0.004312 **
M8 8.51912 4.25957 2.000 0.051298 .
M9 19.87029 4.72696 4.204 0.000117 ***
M10 -8.10533 4.41188 -1.837 0.072513 .
M11 0.44125 4.18619 0.105 0.916502
t -0.28952 0.05595 -5.175 4.65e-06 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 6.618 on 47 degrees of freedom
Multiple R-squared: 0.6351, Adjusted R-squared: 0.5342
F-statistic: 6.292 on 13 and 47 DF, p-value: 1.18e-06
> 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.8587521 0.282495848 0.141247924
[2,] 0.7662112 0.467577662 0.233788831
[3,] 0.6661134 0.667773252 0.333886626
[4,] 0.5551965 0.889606914 0.444803457
[5,] 0.4583389 0.916677890 0.541661055
[6,] 0.3820901 0.764180229 0.617909886
[7,] 0.2972553 0.594510524 0.702744738
[8,] 0.2177040 0.435408089 0.782295955
[9,] 0.1682707 0.336541485 0.831729257
[10,] 0.4417660 0.883532100 0.558233950
[11,] 0.7380229 0.523954176 0.261977088
[12,] 0.8150749 0.369850253 0.184925127
[13,] 0.8203284 0.359343231 0.179671616
[14,] 0.7573575 0.485285028 0.242642514
[15,] 0.6956146 0.608770798 0.304385399
[16,] 0.8518414 0.296317193 0.148158596
[17,] 0.7956951 0.408609865 0.204304933
[18,] 0.9224635 0.155072990 0.077536495
[19,] 0.9451968 0.109606360 0.054803180
[20,] 0.9233367 0.153326527 0.076663263
[21,] 0.9375105 0.124978967 0.062489483
[22,] 0.9192068 0.161586347 0.080793174
[23,] 0.8934514 0.213097195 0.106548597
[24,] 0.8649888 0.270022380 0.135011190
[25,] 0.7866703 0.426659386 0.213329693
[26,] 0.9963160 0.007367976 0.003683988
[27,] 0.9954618 0.009076448 0.004538224
[28,] 0.9958779 0.008244125 0.004122063
> postscript(file="/var/wessaorg/rcomp/tmp/1scec1322160351.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/wessaorg/rcomp/tmp/2q6ay1322160351.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/wessaorg/rcomp/tmp/3v3xf1322160351.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/wessaorg/rcomp/tmp/4mzlg1322160351.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/wessaorg/rcomp/tmp/5d0jj1322160351.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
2.3506244 -1.7657557 6.5125450 2.6808335 6.7684671 9.4150231
7 8 9 10 11 12
4.2095447 3.0222341 6.3114674 5.6007671 12.2918236 6.5278121
13 14 15 16 17 18
0.3245089 10.5156296 -1.5752367 -4.6017263 -3.9705370 -3.0520372
19 20 21 22 23 24
-5.8909596 -7.6730483 -9.6683155 -4.0100148 -4.0111256 -8.2930815
25 26 27 28 29 30
-7.6939399 -9.1613764 -2.1444099 -6.7323996 0.6320676 -1.7799336
31 32 33 34 35 36
-2.5239119 5.4811108 -6.3986568 2.2955327 -10.6413009 -10.1819801
37 38 39 40 41 42
0.4779977 -1.1042743 -2.9052523 2.2189826 -4.3879960 -12.7079960
43 44 45 46 47 48
-3.5780835 -4.7342290 2.9036158 -4.9635288 -1.2029734 3.3020161
49 50 51 52 53 54
-1.0627874 1.5157768 0.1123539 6.4343098 0.9579983 8.1249437
55 56 57 58 59 60
7.7834103 3.9039325 6.8518891 1.0772437 3.5635763 8.6452335
61
5.6035964
> postscript(file="/var/wessaorg/rcomp/tmp/605r11322160351.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 2.3506244 NA
1 -1.7657557 2.3506244
2 6.5125450 -1.7657557
3 2.6808335 6.5125450
4 6.7684671 2.6808335
5 9.4150231 6.7684671
6 4.2095447 9.4150231
7 3.0222341 4.2095447
8 6.3114674 3.0222341
9 5.6007671 6.3114674
10 12.2918236 5.6007671
11 6.5278121 12.2918236
12 0.3245089 6.5278121
13 10.5156296 0.3245089
14 -1.5752367 10.5156296
15 -4.6017263 -1.5752367
16 -3.9705370 -4.6017263
17 -3.0520372 -3.9705370
18 -5.8909596 -3.0520372
19 -7.6730483 -5.8909596
20 -9.6683155 -7.6730483
21 -4.0100148 -9.6683155
22 -4.0111256 -4.0100148
23 -8.2930815 -4.0111256
24 -7.6939399 -8.2930815
25 -9.1613764 -7.6939399
26 -2.1444099 -9.1613764
27 -6.7323996 -2.1444099
28 0.6320676 -6.7323996
29 -1.7799336 0.6320676
30 -2.5239119 -1.7799336
31 5.4811108 -2.5239119
32 -6.3986568 5.4811108
33 2.2955327 -6.3986568
34 -10.6413009 2.2955327
35 -10.1819801 -10.6413009
36 0.4779977 -10.1819801
37 -1.1042743 0.4779977
38 -2.9052523 -1.1042743
39 2.2189826 -2.9052523
40 -4.3879960 2.2189826
41 -12.7079960 -4.3879960
42 -3.5780835 -12.7079960
43 -4.7342290 -3.5780835
44 2.9036158 -4.7342290
45 -4.9635288 2.9036158
46 -1.2029734 -4.9635288
47 3.3020161 -1.2029734
48 -1.0627874 3.3020161
49 1.5157768 -1.0627874
50 0.1123539 1.5157768
51 6.4343098 0.1123539
52 0.9579983 6.4343098
53 8.1249437 0.9579983
54 7.7834103 8.1249437
55 3.9039325 7.7834103
56 6.8518891 3.9039325
57 1.0772437 6.8518891
58 3.5635763 1.0772437
59 8.6452335 3.5635763
60 5.6035964 8.6452335
61 NA 5.6035964
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.7657557 2.3506244
[2,] 6.5125450 -1.7657557
[3,] 2.6808335 6.5125450
[4,] 6.7684671 2.6808335
[5,] 9.4150231 6.7684671
[6,] 4.2095447 9.4150231
[7,] 3.0222341 4.2095447
[8,] 6.3114674 3.0222341
[9,] 5.6007671 6.3114674
[10,] 12.2918236 5.6007671
[11,] 6.5278121 12.2918236
[12,] 0.3245089 6.5278121
[13,] 10.5156296 0.3245089
[14,] -1.5752367 10.5156296
[15,] -4.6017263 -1.5752367
[16,] -3.9705370 -4.6017263
[17,] -3.0520372 -3.9705370
[18,] -5.8909596 -3.0520372
[19,] -7.6730483 -5.8909596
[20,] -9.6683155 -7.6730483
[21,] -4.0100148 -9.6683155
[22,] -4.0111256 -4.0100148
[23,] -8.2930815 -4.0111256
[24,] -7.6939399 -8.2930815
[25,] -9.1613764 -7.6939399
[26,] -2.1444099 -9.1613764
[27,] -6.7323996 -2.1444099
[28,] 0.6320676 -6.7323996
[29,] -1.7799336 0.6320676
[30,] -2.5239119 -1.7799336
[31,] 5.4811108 -2.5239119
[32,] -6.3986568 5.4811108
[33,] 2.2955327 -6.3986568
[34,] -10.6413009 2.2955327
[35,] -10.1819801 -10.6413009
[36,] 0.4779977 -10.1819801
[37,] -1.1042743 0.4779977
[38,] -2.9052523 -1.1042743
[39,] 2.2189826 -2.9052523
[40,] -4.3879960 2.2189826
[41,] -12.7079960 -4.3879960
[42,] -3.5780835 -12.7079960
[43,] -4.7342290 -3.5780835
[44,] 2.9036158 -4.7342290
[45,] -4.9635288 2.9036158
[46,] -1.2029734 -4.9635288
[47,] 3.3020161 -1.2029734
[48,] -1.0627874 3.3020161
[49,] 1.5157768 -1.0627874
[50,] 0.1123539 1.5157768
[51,] 6.4343098 0.1123539
[52,] 0.9579983 6.4343098
[53,] 8.1249437 0.9579983
[54,] 7.7834103 8.1249437
[55,] 3.9039325 7.7834103
[56,] 6.8518891 3.9039325
[57,] 1.0772437 6.8518891
[58,] 3.5635763 1.0772437
[59,] 8.6452335 3.5635763
[60,] 5.6035964 8.6452335
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.7657557 2.3506244
2 6.5125450 -1.7657557
3 2.6808335 6.5125450
4 6.7684671 2.6808335
5 9.4150231 6.7684671
6 4.2095447 9.4150231
7 3.0222341 4.2095447
8 6.3114674 3.0222341
9 5.6007671 6.3114674
10 12.2918236 5.6007671
11 6.5278121 12.2918236
12 0.3245089 6.5278121
13 10.5156296 0.3245089
14 -1.5752367 10.5156296
15 -4.6017263 -1.5752367
16 -3.9705370 -4.6017263
17 -3.0520372 -3.9705370
18 -5.8909596 -3.0520372
19 -7.6730483 -5.8909596
20 -9.6683155 -7.6730483
21 -4.0100148 -9.6683155
22 -4.0111256 -4.0100148
23 -8.2930815 -4.0111256
24 -7.6939399 -8.2930815
25 -9.1613764 -7.6939399
26 -2.1444099 -9.1613764
27 -6.7323996 -2.1444099
28 0.6320676 -6.7323996
29 -1.7799336 0.6320676
30 -2.5239119 -1.7799336
31 5.4811108 -2.5239119
32 -6.3986568 5.4811108
33 2.2955327 -6.3986568
34 -10.6413009 2.2955327
35 -10.1819801 -10.6413009
36 0.4779977 -10.1819801
37 -1.1042743 0.4779977
38 -2.9052523 -1.1042743
39 2.2189826 -2.9052523
40 -4.3879960 2.2189826
41 -12.7079960 -4.3879960
42 -3.5780835 -12.7079960
43 -4.7342290 -3.5780835
44 2.9036158 -4.7342290
45 -4.9635288 2.9036158
46 -1.2029734 -4.9635288
47 3.3020161 -1.2029734
48 -1.0627874 3.3020161
49 1.5157768 -1.0627874
50 0.1123539 1.5157768
51 6.4343098 0.1123539
52 0.9579983 6.4343098
53 8.1249437 0.9579983
54 7.7834103 8.1249437
55 3.9039325 7.7834103
56 6.8518891 3.9039325
57 1.0772437 6.8518891
58 3.5635763 1.0772437
59 8.6452335 3.5635763
60 5.6035964 8.6452335
> 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/wessaorg/rcomp/tmp/7ggnk1322160351.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/wessaorg/rcomp/tmp/8n7vg1322160351.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/wessaorg/rcomp/tmp/9kata1322160351.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/wessaorg/rcomp/tmp/10g38c1322160351.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/1165st1322160352.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/wessaorg/rcomp/tmp/125dai1322160352.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/wessaorg/rcomp/tmp/13et2e1322160352.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/wessaorg/rcomp/tmp/14ztgg1322160352.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/wessaorg/rcomp/tmp/15930x1322160352.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/wessaorg/rcomp/tmp/16aweu1322160352.tab")
+ }
>
> try(system("convert tmp/1scec1322160351.ps tmp/1scec1322160351.png",intern=TRUE))
character(0)
> try(system("convert tmp/2q6ay1322160351.ps tmp/2q6ay1322160351.png",intern=TRUE))
character(0)
> try(system("convert tmp/3v3xf1322160351.ps tmp/3v3xf1322160351.png",intern=TRUE))
character(0)
> try(system("convert tmp/4mzlg1322160351.ps tmp/4mzlg1322160351.png",intern=TRUE))
character(0)
> try(system("convert tmp/5d0jj1322160351.ps tmp/5d0jj1322160351.png",intern=TRUE))
character(0)
> try(system("convert tmp/605r11322160351.ps tmp/605r11322160351.png",intern=TRUE))
character(0)
> try(system("convert tmp/7ggnk1322160351.ps tmp/7ggnk1322160351.png",intern=TRUE))
character(0)
> try(system("convert tmp/8n7vg1322160351.ps tmp/8n7vg1322160351.png",intern=TRUE))
character(0)
> try(system("convert tmp/9kata1322160351.ps tmp/9kata1322160351.png",intern=TRUE))
character(0)
> try(system("convert tmp/10g38c1322160351.ps tmp/10g38c1322160351.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.247 0.547 3.846