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(5.7
+ ,97.33
+ ,91.4
+ ,6.1
+ ,97.89
+ ,91.1
+ ,6
+ ,98.69
+ ,104.4
+ ,5.9
+ ,99.01
+ ,97.6
+ ,5.8
+ ,99.18
+ ,93.7
+ ,5.7
+ ,98.45
+ ,104.5
+ ,5.6
+ ,98.13
+ ,95.4
+ ,5.4
+ ,98.29
+ ,86.5
+ ,5.4
+ ,99.1
+ ,102.9
+ ,5.5
+ ,99.26
+ ,101.9
+ ,5.6
+ ,98.85
+ ,103.7
+ ,5.7
+ ,98.05
+ ,100.7
+ ,5.9
+ ,98.53
+ ,94.2
+ ,6.1
+ ,99.34
+ ,93.6
+ ,6
+ ,100.14
+ ,104.7
+ ,5.8
+ ,100.3
+ ,101
+ ,5.8
+ ,100.22
+ ,97.6
+ ,5.7
+ ,99.9
+ ,105.8
+ ,5.5
+ ,99.58
+ ,93.7
+ ,5.3
+ ,99.9
+ ,91.2
+ ,5.2
+ ,100.78
+ ,106.3
+ ,5.2
+ ,100.78
+ ,103.4
+ ,5
+ ,100.46
+ ,107.4
+ ,5.1
+ ,100.06
+ ,101.2
+ ,5.1
+ ,100.28
+ ,96.9
+ ,5.2
+ ,100.78
+ ,96.3
+ ,4.9
+ ,101.58
+ ,109.8
+ ,4.8
+ ,102.06
+ ,97.9
+ ,4.5
+ ,102.02
+ ,105.1
+ ,4.5
+ ,101.68
+ ,107.9
+ ,4.4
+ ,101.32
+ ,95
+ ,4.4
+ ,101.81
+ ,95.2
+ ,4.2
+ ,102.3
+ ,105.8
+ ,4.1
+ ,102.12
+ ,110.1
+ ,3.9
+ ,102.1
+ ,112.2
+ ,3.8
+ ,101.75
+ ,102.5
+ ,3.9
+ ,101.5
+ ,103.7
+ ,4.2
+ ,102.16
+ ,102
+ ,4.1
+ ,103.47
+ ,112.3
+ ,3.8
+ ,104.05
+ ,103.3
+ ,3.6
+ ,104.09
+ ,106.9
+ ,3.7
+ ,103.55
+ ,104.6
+ ,3.5
+ ,102.77
+ ,100.7
+ ,3.4
+ ,102.89
+ ,99
+ ,3.1
+ ,103.6
+ ,106.5
+ ,3.1
+ ,103.76
+ ,114.9
+ ,3.1
+ ,103.92
+ ,114.1
+ ,3.2
+ ,103.35
+ ,102.2
+ ,3.3
+ ,103.32
+ ,107
+ ,3.5
+ ,104.2
+ ,107.4
+ ,3.6
+ ,105.44
+ ,107.4
+ ,3.5
+ ,105.81
+ ,110.1
+ ,3.3
+ ,106.25
+ ,105.6
+ ,3.2
+ ,105.94
+ ,110.9
+ ,3.1
+ ,105.82
+ ,101.9
+ ,3.2
+ ,105.96
+ ,93.2
+ ,3
+ ,106.49
+ ,110.5
+ ,3
+ ,106.32
+ ,113.1
+ ,3.1
+ ,105.88
+ ,101.7
+ ,3.4
+ ,105.07
+ ,96.7)
+ ,dim=c(3
+ ,60)
+ ,dimnames=list(c('manwerk'
+ ,'infl'
+ ,'indprod')
+ ,1:60))
> y <- array(NA,dim=c(3,60),dimnames=list(c('manwerk','infl','indprod'),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 = 'Do not include Seasonal 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
manwerk infl indprod
1 5.7 97.33 91.4
2 6.1 97.89 91.1
3 6.0 98.69 104.4
4 5.9 99.01 97.6
5 5.8 99.18 93.7
6 5.7 98.45 104.5
7 5.6 98.13 95.4
8 5.4 98.29 86.5
9 5.4 99.10 102.9
10 5.5 99.26 101.9
11 5.6 98.85 103.7
12 5.7 98.05 100.7
13 5.9 98.53 94.2
14 6.1 99.34 93.6
15 6.0 100.14 104.7
16 5.8 100.30 101.0
17 5.8 100.22 97.6
18 5.7 99.90 105.8
19 5.5 99.58 93.7
20 5.3 99.90 91.2
21 5.2 100.78 106.3
22 5.2 100.78 103.4
23 5.0 100.46 107.4
24 5.1 100.06 101.2
25 5.1 100.28 96.9
26 5.2 100.78 96.3
27 4.9 101.58 109.8
28 4.8 102.06 97.9
29 4.5 102.02 105.1
30 4.5 101.68 107.9
31 4.4 101.32 95.0
32 4.4 101.81 95.2
33 4.2 102.30 105.8
34 4.1 102.12 110.1
35 3.9 102.10 112.2
36 3.8 101.75 102.5
37 3.9 101.50 103.7
38 4.2 102.16 102.0
39 4.1 103.47 112.3
40 3.8 104.05 103.3
41 3.6 104.09 106.9
42 3.7 103.55 104.6
43 3.5 102.77 100.7
44 3.4 102.89 99.0
45 3.1 103.60 106.5
46 3.1 103.76 114.9
47 3.1 103.92 114.1
48 3.2 103.35 102.2
49 3.3 103.32 107.0
50 3.5 104.20 107.4
51 3.6 105.44 107.4
52 3.5 105.81 110.1
53 3.3 106.25 105.6
54 3.2 105.94 110.9
55 3.1 105.82 101.9
56 3.2 105.96 93.2
57 3.0 106.49 110.5
58 3.0 106.32 113.1
59 3.1 105.88 101.7
60 3.4 105.07 96.7
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) infl indprod
42.905395 -0.371175 -0.005961
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.73528 -0.21977 0.03393 0.27836 0.88815
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 42.905395 2.145333 19.999 <2e-16 ***
infl -0.371175 0.024574 -15.105 <2e-16 ***
indprod -0.005961 0.009699 -0.615 0.541
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.4112 on 57 degrees of freedom
Multiple R-squared: 0.8537, Adjusted R-squared: 0.8486
F-statistic: 166.3 on 2 and 57 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.13365465 0.267309309 0.866345345
[2,] 0.09790293 0.195805865 0.902097068
[3,] 0.11767526 0.235350519 0.882324741
[4,] 0.14708265 0.294165307 0.852917346
[5,] 0.09791247 0.195824942 0.902087529
[6,] 0.05610450 0.112209005 0.943895497
[7,] 0.03016262 0.060325246 0.969837377
[8,] 0.01938790 0.038775794 0.980612103
[9,] 0.02615846 0.052316911 0.973841545
[10,] 0.02689622 0.053792441 0.973103780
[11,] 0.02129957 0.042599149 0.978700425
[12,] 0.01755924 0.035118476 0.982440762
[13,] 0.01451436 0.029028711 0.985485644
[14,] 0.01480916 0.029618313 0.985190844
[15,] 0.02261638 0.045232752 0.977383624
[16,] 0.04571911 0.091438220 0.954280890
[17,] 0.06248320 0.124966400 0.937516800
[18,] 0.10356940 0.207138795 0.896430602
[19,] 0.12161493 0.243229860 0.878385070
[20,] 0.13054593 0.261091854 0.869454073
[21,] 0.15242792 0.304855849 0.847572075
[22,] 0.23226153 0.464523062 0.767738469
[23,] 0.32910088 0.658201769 0.670899116
[24,] 0.44663533 0.893270661 0.553364670
[25,] 0.57432743 0.851345142 0.425672571
[26,] 0.66001800 0.679964006 0.339982003
[27,] 0.72024447 0.559511057 0.279755529
[28,] 0.78069361 0.438612788 0.219306394
[29,] 0.83338378 0.333232433 0.166616217
[30,] 0.86843814 0.263123727 0.131561863
[31,] 0.90281820 0.194363595 0.097181798
[32,] 0.91726718 0.165465636 0.082732818
[33,] 0.94761954 0.104760912 0.052380456
[34,] 0.99034210 0.019315805 0.009657903
[35,] 0.99495471 0.010090589 0.005045294
[36,] 0.99488400 0.010232006 0.005116003
[37,] 0.99714706 0.005705876 0.002852938
[38,] 0.99665421 0.006691581 0.003345791
[39,] 0.99500733 0.009985339 0.004992670
[40,] 0.99382015 0.012359694 0.006179847
[41,] 0.99119577 0.017608455 0.008804228
[42,] 0.98880263 0.022394736 0.011197368
[43,] 0.98757167 0.024856655 0.012428327
[44,] 0.99238990 0.015220205 0.007610102
[45,] 0.99199511 0.016009783 0.008004891
[46,] 0.99028116 0.019437688 0.009718844
[47,] 0.99579151 0.008416984 0.004208492
[48,] 0.99883249 0.002335014 0.001167507
[49,] 0.99669148 0.006617036 0.003308518
> postscript(file="/var/www/html/rcomp/tmp/1obi21258468584.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/2g1hp1258468584.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/3g4b01258468584.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/4n7qn1258468584.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/5h7g01258468584.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
-0.534129380 0.071940130 0.348161248 0.326402296 0.266254063 -0.040324571
7 8 9 10 11 12
-0.313345623 -0.507010635 -0.108598650 0.044828290 0.003376489 -0.211446261
13 14 15 16 17 18
0.127971035 0.625045909 0.888152812 0.725485034 0.675523639 0.505628000
19 20 21 22 23 24
0.114723929 0.018597305 0.335242207 0.317955288 0.023023422 -0.062404684
25 26 27 28 29 30
-0.006378586 0.275632142 0.353045461 0.360273322 0.088345582 -0.021162985
31 32 33 34 35 36
-0.331682848 -0.148615062 -0.103552807 -0.244731919 -0.439637298 -0.727370194
37 38 39 40 41 42
-0.713010652 -0.178169085 0.269468092 0.131100338 -0.032593052 -0.146737685
43 44 45 46 47 48
-0.659501849 -0.725094600 -0.716853040 -0.607392639 -0.552773498 -0.735279034
49 50 51 52 53 54
-0.617801442 -0.088783336 0.471473247 0.524902590 0.461394913 0.277924102
55 56 57 58 59 60
0.079734084 0.179837780 0.279685764 0.232084689 0.100812362 0.070355852
> postscript(file="/var/www/html/rcomp/tmp/6rwcv1258468584.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 -0.534129380 NA
1 0.071940130 -0.534129380
2 0.348161248 0.071940130
3 0.326402296 0.348161248
4 0.266254063 0.326402296
5 -0.040324571 0.266254063
6 -0.313345623 -0.040324571
7 -0.507010635 -0.313345623
8 -0.108598650 -0.507010635
9 0.044828290 -0.108598650
10 0.003376489 0.044828290
11 -0.211446261 0.003376489
12 0.127971035 -0.211446261
13 0.625045909 0.127971035
14 0.888152812 0.625045909
15 0.725485034 0.888152812
16 0.675523639 0.725485034
17 0.505628000 0.675523639
18 0.114723929 0.505628000
19 0.018597305 0.114723929
20 0.335242207 0.018597305
21 0.317955288 0.335242207
22 0.023023422 0.317955288
23 -0.062404684 0.023023422
24 -0.006378586 -0.062404684
25 0.275632142 -0.006378586
26 0.353045461 0.275632142
27 0.360273322 0.353045461
28 0.088345582 0.360273322
29 -0.021162985 0.088345582
30 -0.331682848 -0.021162985
31 -0.148615062 -0.331682848
32 -0.103552807 -0.148615062
33 -0.244731919 -0.103552807
34 -0.439637298 -0.244731919
35 -0.727370194 -0.439637298
36 -0.713010652 -0.727370194
37 -0.178169085 -0.713010652
38 0.269468092 -0.178169085
39 0.131100338 0.269468092
40 -0.032593052 0.131100338
41 -0.146737685 -0.032593052
42 -0.659501849 -0.146737685
43 -0.725094600 -0.659501849
44 -0.716853040 -0.725094600
45 -0.607392639 -0.716853040
46 -0.552773498 -0.607392639
47 -0.735279034 -0.552773498
48 -0.617801442 -0.735279034
49 -0.088783336 -0.617801442
50 0.471473247 -0.088783336
51 0.524902590 0.471473247
52 0.461394913 0.524902590
53 0.277924102 0.461394913
54 0.079734084 0.277924102
55 0.179837780 0.079734084
56 0.279685764 0.179837780
57 0.232084689 0.279685764
58 0.100812362 0.232084689
59 0.070355852 0.100812362
60 NA 0.070355852
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.071940130 -0.534129380
[2,] 0.348161248 0.071940130
[3,] 0.326402296 0.348161248
[4,] 0.266254063 0.326402296
[5,] -0.040324571 0.266254063
[6,] -0.313345623 -0.040324571
[7,] -0.507010635 -0.313345623
[8,] -0.108598650 -0.507010635
[9,] 0.044828290 -0.108598650
[10,] 0.003376489 0.044828290
[11,] -0.211446261 0.003376489
[12,] 0.127971035 -0.211446261
[13,] 0.625045909 0.127971035
[14,] 0.888152812 0.625045909
[15,] 0.725485034 0.888152812
[16,] 0.675523639 0.725485034
[17,] 0.505628000 0.675523639
[18,] 0.114723929 0.505628000
[19,] 0.018597305 0.114723929
[20,] 0.335242207 0.018597305
[21,] 0.317955288 0.335242207
[22,] 0.023023422 0.317955288
[23,] -0.062404684 0.023023422
[24,] -0.006378586 -0.062404684
[25,] 0.275632142 -0.006378586
[26,] 0.353045461 0.275632142
[27,] 0.360273322 0.353045461
[28,] 0.088345582 0.360273322
[29,] -0.021162985 0.088345582
[30,] -0.331682848 -0.021162985
[31,] -0.148615062 -0.331682848
[32,] -0.103552807 -0.148615062
[33,] -0.244731919 -0.103552807
[34,] -0.439637298 -0.244731919
[35,] -0.727370194 -0.439637298
[36,] -0.713010652 -0.727370194
[37,] -0.178169085 -0.713010652
[38,] 0.269468092 -0.178169085
[39,] 0.131100338 0.269468092
[40,] -0.032593052 0.131100338
[41,] -0.146737685 -0.032593052
[42,] -0.659501849 -0.146737685
[43,] -0.725094600 -0.659501849
[44,] -0.716853040 -0.725094600
[45,] -0.607392639 -0.716853040
[46,] -0.552773498 -0.607392639
[47,] -0.735279034 -0.552773498
[48,] -0.617801442 -0.735279034
[49,] -0.088783336 -0.617801442
[50,] 0.471473247 -0.088783336
[51,] 0.524902590 0.471473247
[52,] 0.461394913 0.524902590
[53,] 0.277924102 0.461394913
[54,] 0.079734084 0.277924102
[55,] 0.179837780 0.079734084
[56,] 0.279685764 0.179837780
[57,] 0.232084689 0.279685764
[58,] 0.100812362 0.232084689
[59,] 0.070355852 0.100812362
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.071940130 -0.534129380
2 0.348161248 0.071940130
3 0.326402296 0.348161248
4 0.266254063 0.326402296
5 -0.040324571 0.266254063
6 -0.313345623 -0.040324571
7 -0.507010635 -0.313345623
8 -0.108598650 -0.507010635
9 0.044828290 -0.108598650
10 0.003376489 0.044828290
11 -0.211446261 0.003376489
12 0.127971035 -0.211446261
13 0.625045909 0.127971035
14 0.888152812 0.625045909
15 0.725485034 0.888152812
16 0.675523639 0.725485034
17 0.505628000 0.675523639
18 0.114723929 0.505628000
19 0.018597305 0.114723929
20 0.335242207 0.018597305
21 0.317955288 0.335242207
22 0.023023422 0.317955288
23 -0.062404684 0.023023422
24 -0.006378586 -0.062404684
25 0.275632142 -0.006378586
26 0.353045461 0.275632142
27 0.360273322 0.353045461
28 0.088345582 0.360273322
29 -0.021162985 0.088345582
30 -0.331682848 -0.021162985
31 -0.148615062 -0.331682848
32 -0.103552807 -0.148615062
33 -0.244731919 -0.103552807
34 -0.439637298 -0.244731919
35 -0.727370194 -0.439637298
36 -0.713010652 -0.727370194
37 -0.178169085 -0.713010652
38 0.269468092 -0.178169085
39 0.131100338 0.269468092
40 -0.032593052 0.131100338
41 -0.146737685 -0.032593052
42 -0.659501849 -0.146737685
43 -0.725094600 -0.659501849
44 -0.716853040 -0.725094600
45 -0.607392639 -0.716853040
46 -0.552773498 -0.607392639
47 -0.735279034 -0.552773498
48 -0.617801442 -0.735279034
49 -0.088783336 -0.617801442
50 0.471473247 -0.088783336
51 0.524902590 0.471473247
52 0.461394913 0.524902590
53 0.277924102 0.461394913
54 0.079734084 0.277924102
55 0.179837780 0.079734084
56 0.279685764 0.179837780
57 0.232084689 0.279685764
58 0.100812362 0.232084689
59 0.070355852 0.100812362
> 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/7q7471258468584.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/86jz41258468584.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/9b3xv1258468584.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/105mlg1258468584.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/11gwfd1258468584.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/12cixd1258468584.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/13wjj81258468584.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/142f7a1258468584.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/15wb7o1258468584.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/16nagr1258468584.tab")
+ }
>
> system("convert tmp/1obi21258468584.ps tmp/1obi21258468584.png")
> system("convert tmp/2g1hp1258468584.ps tmp/2g1hp1258468584.png")
> system("convert tmp/3g4b01258468584.ps tmp/3g4b01258468584.png")
> system("convert tmp/4n7qn1258468584.ps tmp/4n7qn1258468584.png")
> system("convert tmp/5h7g01258468584.ps tmp/5h7g01258468584.png")
> system("convert tmp/6rwcv1258468584.ps tmp/6rwcv1258468584.png")
> system("convert tmp/7q7471258468584.ps tmp/7q7471258468584.png")
> system("convert tmp/86jz41258468584.ps tmp/86jz41258468584.png")
> system("convert tmp/9b3xv1258468584.ps tmp/9b3xv1258468584.png")
> system("convert tmp/105mlg1258468584.ps tmp/105mlg1258468584.png")
>
>
> proc.time()
user system elapsed
2.456 1.592 3.250