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(109,102.86,108.6,102.55,108.8,102.28,108.5,102.26,108.3,102.57,108.2,103.08,108,102.76,107.9,102.51,108,102.87,109.3,103.14,109.6,103.12,109,103.16,108.7,102.48,108.3,102.57,108.4,102.88,107.8,102.63,107.8,102.38,107.6,101.69,107.7,101.96,107.6,102.19,107.6,101.87,108.6,101.6,108.6,101.63,108.2,101.22,107.5,101.21,107.1,101.49,107,101.64,106.9,101.66,106.6,101.77,106.3,101.82,106.1,101.78,105.9,101.28,106,101.29,107.2,101.37,107.2,101.12,106.4,101.51,106.1,102.24,105.9,102.94,106.1,103.09,105.9,103.46,105.8,103.64,105.7,104.39,105.6,104.15,105.3,105.21,105.5,105.8,106.5,105.91,106.5,105.39,106.1,105.46,105.9,104.72,105.8,103.14,106.2,102.63,106.5,102.32,106.6,101.93,106.7,100.62,106.6,100.6,106.5,99.63,106.8,98.9,107.8,98.32,107.9,99.22,107.4,98.81),dim=c(2,60),dimnames=list(c('Werkl','Infl'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Werkl','Infl'),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 = '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
Werkl Infl M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 109.0 102.86 1 0 0 0 0 0 0 0 0 0 0 1
2 108.6 102.55 0 1 0 0 0 0 0 0 0 0 0 2
3 108.8 102.28 0 0 1 0 0 0 0 0 0 0 0 3
4 108.5 102.26 0 0 0 1 0 0 0 0 0 0 0 4
5 108.3 102.57 0 0 0 0 1 0 0 0 0 0 0 5
6 108.2 103.08 0 0 0 0 0 1 0 0 0 0 0 6
7 108.0 102.76 0 0 0 0 0 0 1 0 0 0 0 7
8 107.9 102.51 0 0 0 0 0 0 0 1 0 0 0 8
9 108.0 102.87 0 0 0 0 0 0 0 0 1 0 0 9
10 109.3 103.14 0 0 0 0 0 0 0 0 0 1 0 10
11 109.6 103.12 0 0 0 0 0 0 0 0 0 0 1 11
12 109.0 103.16 0 0 0 0 0 0 0 0 0 0 0 12
13 108.7 102.48 1 0 0 0 0 0 0 0 0 0 0 13
14 108.3 102.57 0 1 0 0 0 0 0 0 0 0 0 14
15 108.4 102.88 0 0 1 0 0 0 0 0 0 0 0 15
16 107.8 102.63 0 0 0 1 0 0 0 0 0 0 0 16
17 107.8 102.38 0 0 0 0 1 0 0 0 0 0 0 17
18 107.6 101.69 0 0 0 0 0 1 0 0 0 0 0 18
19 107.7 101.96 0 0 0 0 0 0 1 0 0 0 0 19
20 107.6 102.19 0 0 0 0 0 0 0 1 0 0 0 20
21 107.6 101.87 0 0 0 0 0 0 0 0 1 0 0 21
22 108.6 101.60 0 0 0 0 0 0 0 0 0 1 0 22
23 108.6 101.63 0 0 0 0 0 0 0 0 0 0 1 23
24 108.2 101.22 0 0 0 0 0 0 0 0 0 0 0 24
25 107.5 101.21 1 0 0 0 0 0 0 0 0 0 0 25
26 107.1 101.49 0 1 0 0 0 0 0 0 0 0 0 26
27 107.0 101.64 0 0 1 0 0 0 0 0 0 0 0 27
28 106.9 101.66 0 0 0 1 0 0 0 0 0 0 0 28
29 106.6 101.77 0 0 0 0 1 0 0 0 0 0 0 29
30 106.3 101.82 0 0 0 0 0 1 0 0 0 0 0 30
31 106.1 101.78 0 0 0 0 0 0 1 0 0 0 0 31
32 105.9 101.28 0 0 0 0 0 0 0 1 0 0 0 32
33 106.0 101.29 0 0 0 0 0 0 0 0 1 0 0 33
34 107.2 101.37 0 0 0 0 0 0 0 0 0 1 0 34
35 107.2 101.12 0 0 0 0 0 0 0 0 0 0 1 35
36 106.4 101.51 0 0 0 0 0 0 0 0 0 0 0 36
37 106.1 102.24 1 0 0 0 0 0 0 0 0 0 0 37
38 105.9 102.94 0 1 0 0 0 0 0 0 0 0 0 38
39 106.1 103.09 0 0 1 0 0 0 0 0 0 0 0 39
40 105.9 103.46 0 0 0 1 0 0 0 0 0 0 0 40
41 105.8 103.64 0 0 0 0 1 0 0 0 0 0 0 41
42 105.7 104.39 0 0 0 0 0 1 0 0 0 0 0 42
43 105.6 104.15 0 0 0 0 0 0 1 0 0 0 0 43
44 105.3 105.21 0 0 0 0 0 0 0 1 0 0 0 44
45 105.5 105.80 0 0 0 0 0 0 0 0 1 0 0 45
46 106.5 105.91 0 0 0 0 0 0 0 0 0 1 0 46
47 106.5 105.39 0 0 0 0 0 0 0 0 0 0 1 47
48 106.1 105.46 0 0 0 0 0 0 0 0 0 0 0 48
49 105.9 104.72 1 0 0 0 0 0 0 0 0 0 0 49
50 105.8 103.14 0 1 0 0 0 0 0 0 0 0 0 50
51 106.2 102.63 0 0 1 0 0 0 0 0 0 0 0 51
52 106.5 102.32 0 0 0 1 0 0 0 0 0 0 0 52
53 106.6 101.93 0 0 0 0 1 0 0 0 0 0 0 53
54 106.7 100.62 0 0 0 0 0 1 0 0 0 0 0 54
55 106.6 100.60 0 0 0 0 0 0 1 0 0 0 0 55
56 106.5 99.63 0 0 0 0 0 0 0 1 0 0 0 56
57 106.8 98.90 0 0 0 0 0 0 0 0 1 0 0 57
58 107.8 98.32 0 0 0 0 0 0 0 0 0 1 0 58
59 107.9 99.22 0 0 0 0 0 0 0 0 0 0 1 59
60 107.4 98.81 0 0 0 0 0 0 0 0 0 0 0 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Infl M1 M2 M3 M4
133.50302 -0.23721 -0.39539 -0.68208 -0.47794 -0.61474
M5 M6 M7 M8 M9 M10
-0.66443 -0.76495 -0.82934 -0.95753 -0.76959 0.36412
M11 t
0.50297 -0.05221
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.14383 -0.29871 0.09069 0.34083 0.70782
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 133.503019 4.668324 28.598 < 2e-16 ***
Infl -0.237214 0.045466 -5.217 4.22e-06 ***
M1 -0.395389 0.349086 -1.133 0.26323
M2 -0.682081 0.348157 -1.959 0.05618 .
M3 -0.477936 0.347639 -1.375 0.17585
M4 -0.614738 0.347165 -1.771 0.08323 .
M5 -0.664425 0.346801 -1.916 0.06161 .
M6 -0.764949 0.346271 -2.209 0.03219 *
M7 -0.829343 0.345934 -2.397 0.02063 *
M8 -0.957532 0.345658 -2.770 0.00805 **
M9 -0.769591 0.345481 -2.228 0.03084 *
M10 0.364117 0.345339 1.054 0.29722
M11 0.502971 0.345271 1.457 0.15198
t -0.052211 0.004192 -12.456 2.42e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.5459 on 46 degrees of freedom
Multiple R-squared: 0.8133, Adjusted R-squared: 0.7605
F-statistic: 15.41 on 13 and 46 DF, p-value: 1.287e-12
> if (n > n25) {
+ kp3 <- k + 3
+ nmkm3 <- n - k - 3
+ gqarr <- array(NA, dim=c(nmkm3-kp3+1,3))
+ numgqtests <- 0
+ numsignificant1 <- 0
+ numsignificant5 <- 0
+ numsignificant10 <- 0
+ for (mypoint in kp3:nmkm3) {
+ j <- 0
+ numgqtests <- numgqtests + 1
+ for (myalt in c('greater', 'two.sided', 'less')) {
+ j <- j + 1
+ gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value
+ }
+ if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1
+ }
+ gqarr
+ }
[,1] [,2] [,3]
[1,] 0.0198476053 0.0396952106 9.801524e-01
[2,] 0.0077791309 0.0155582617 9.922209e-01
[3,] 0.0030765448 0.0061530896 9.969235e-01
[4,] 0.0014229698 0.0028459395 9.985770e-01
[5,] 0.0005026775 0.0010053550 9.994973e-01
[6,] 0.0005366088 0.0010732176 9.994634e-01
[7,] 0.0031797489 0.0063594977 9.968203e-01
[8,] 0.0063142670 0.0126285340 9.936857e-01
[9,] 0.0541568427 0.1083136853 9.458432e-01
[10,] 0.2961631517 0.5923263034 7.038368e-01
[11,] 0.7903257076 0.4193485848 2.096743e-01
[12,] 0.9445052343 0.1109895315 5.549477e-02
[13,] 0.9873236228 0.0253527544 1.267638e-02
[14,] 0.9942398138 0.0115203724 5.760186e-03
[15,] 0.9969162493 0.0061675014 3.083751e-03
[16,] 0.9973272314 0.0053455371 2.672769e-03
[17,] 0.9963356089 0.0073287821 3.664391e-03
[18,] 0.9969786956 0.0060426088 3.021304e-03
[19,] 0.9966634362 0.0066731276 3.336564e-03
[20,] 0.9968040175 0.0063919651 3.195983e-03
[21,] 0.9933234716 0.0133530569 6.676528e-03
[22,] 0.9966567900 0.0066864200 3.343210e-03
[23,] 0.9999361321 0.0001277357 6.386786e-05
[24,] 0.9998948441 0.0002103118 1.051559e-04
[25,] 0.9993940739 0.0012118522 6.059261e-04
[26,] 0.9969668478 0.0060663044 3.033152e-03
[27,] 0.9909945063 0.0180109874 9.005494e-03
> postscript(file="/var/www/html/rcomp/tmp/1m6001258796747.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/2ohpe1258796747.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/32nzr1258796747.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/4rxad1258796747.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/51lso1258796747.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.344411734 0.209778492 0.193795992 0.078065844 0.053499890 0.227214552
7 8 9 10 11 12
0.067911056 0.089007963 0.138674848 0.421225315 0.629839044 0.594509298
13 14 15 16 17 18
0.580804458 0.541056810 0.562658420 0.092369055 0.134963271 -0.075978848
19 20 21 22 23 24
0.204673907 0.339633526 0.127994903 -0.017550182 -0.097075754 -0.039151793
25 26 27 28 29 30
-0.293923264 -0.288600255 -0.504952882 -0.411194471 -0.583203221 -0.718606992
31 32 33 34 35 36
-0.811490572 -0.949697162 -0.983055170 -0.845575361 -0.991520848 -1.143825699
37 38 39 40 41 42
-0.823058823 -0.518105941 -0.434458568 -0.357675262 -0.313079033 -0.082433016
43 44 45 46 47 48
-0.122759393 0.009087832 0.213313934 0.157910163 -0.052083100 0.119703574
49 50 51 52 53 54
0.191765895 0.055870894 0.182957038 0.598434834 0.707819092 0.649804304
55 56 57 58 59 60
0.661665003 0.511967841 0.503071485 0.283990065 0.510840659 0.468764620
> postscript(file="/var/www/html/rcomp/tmp/63rqx1258796747.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.344411734 NA
1 0.209778492 0.344411734
2 0.193795992 0.209778492
3 0.078065844 0.193795992
4 0.053499890 0.078065844
5 0.227214552 0.053499890
6 0.067911056 0.227214552
7 0.089007963 0.067911056
8 0.138674848 0.089007963
9 0.421225315 0.138674848
10 0.629839044 0.421225315
11 0.594509298 0.629839044
12 0.580804458 0.594509298
13 0.541056810 0.580804458
14 0.562658420 0.541056810
15 0.092369055 0.562658420
16 0.134963271 0.092369055
17 -0.075978848 0.134963271
18 0.204673907 -0.075978848
19 0.339633526 0.204673907
20 0.127994903 0.339633526
21 -0.017550182 0.127994903
22 -0.097075754 -0.017550182
23 -0.039151793 -0.097075754
24 -0.293923264 -0.039151793
25 -0.288600255 -0.293923264
26 -0.504952882 -0.288600255
27 -0.411194471 -0.504952882
28 -0.583203221 -0.411194471
29 -0.718606992 -0.583203221
30 -0.811490572 -0.718606992
31 -0.949697162 -0.811490572
32 -0.983055170 -0.949697162
33 -0.845575361 -0.983055170
34 -0.991520848 -0.845575361
35 -1.143825699 -0.991520848
36 -0.823058823 -1.143825699
37 -0.518105941 -0.823058823
38 -0.434458568 -0.518105941
39 -0.357675262 -0.434458568
40 -0.313079033 -0.357675262
41 -0.082433016 -0.313079033
42 -0.122759393 -0.082433016
43 0.009087832 -0.122759393
44 0.213313934 0.009087832
45 0.157910163 0.213313934
46 -0.052083100 0.157910163
47 0.119703574 -0.052083100
48 0.191765895 0.119703574
49 0.055870894 0.191765895
50 0.182957038 0.055870894
51 0.598434834 0.182957038
52 0.707819092 0.598434834
53 0.649804304 0.707819092
54 0.661665003 0.649804304
55 0.511967841 0.661665003
56 0.503071485 0.511967841
57 0.283990065 0.503071485
58 0.510840659 0.283990065
59 0.468764620 0.510840659
60 NA 0.468764620
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.209778492 0.344411734
[2,] 0.193795992 0.209778492
[3,] 0.078065844 0.193795992
[4,] 0.053499890 0.078065844
[5,] 0.227214552 0.053499890
[6,] 0.067911056 0.227214552
[7,] 0.089007963 0.067911056
[8,] 0.138674848 0.089007963
[9,] 0.421225315 0.138674848
[10,] 0.629839044 0.421225315
[11,] 0.594509298 0.629839044
[12,] 0.580804458 0.594509298
[13,] 0.541056810 0.580804458
[14,] 0.562658420 0.541056810
[15,] 0.092369055 0.562658420
[16,] 0.134963271 0.092369055
[17,] -0.075978848 0.134963271
[18,] 0.204673907 -0.075978848
[19,] 0.339633526 0.204673907
[20,] 0.127994903 0.339633526
[21,] -0.017550182 0.127994903
[22,] -0.097075754 -0.017550182
[23,] -0.039151793 -0.097075754
[24,] -0.293923264 -0.039151793
[25,] -0.288600255 -0.293923264
[26,] -0.504952882 -0.288600255
[27,] -0.411194471 -0.504952882
[28,] -0.583203221 -0.411194471
[29,] -0.718606992 -0.583203221
[30,] -0.811490572 -0.718606992
[31,] -0.949697162 -0.811490572
[32,] -0.983055170 -0.949697162
[33,] -0.845575361 -0.983055170
[34,] -0.991520848 -0.845575361
[35,] -1.143825699 -0.991520848
[36,] -0.823058823 -1.143825699
[37,] -0.518105941 -0.823058823
[38,] -0.434458568 -0.518105941
[39,] -0.357675262 -0.434458568
[40,] -0.313079033 -0.357675262
[41,] -0.082433016 -0.313079033
[42,] -0.122759393 -0.082433016
[43,] 0.009087832 -0.122759393
[44,] 0.213313934 0.009087832
[45,] 0.157910163 0.213313934
[46,] -0.052083100 0.157910163
[47,] 0.119703574 -0.052083100
[48,] 0.191765895 0.119703574
[49,] 0.055870894 0.191765895
[50,] 0.182957038 0.055870894
[51,] 0.598434834 0.182957038
[52,] 0.707819092 0.598434834
[53,] 0.649804304 0.707819092
[54,] 0.661665003 0.649804304
[55,] 0.511967841 0.661665003
[56,] 0.503071485 0.511967841
[57,] 0.283990065 0.503071485
[58,] 0.510840659 0.283990065
[59,] 0.468764620 0.510840659
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.209778492 0.344411734
2 0.193795992 0.209778492
3 0.078065844 0.193795992
4 0.053499890 0.078065844
5 0.227214552 0.053499890
6 0.067911056 0.227214552
7 0.089007963 0.067911056
8 0.138674848 0.089007963
9 0.421225315 0.138674848
10 0.629839044 0.421225315
11 0.594509298 0.629839044
12 0.580804458 0.594509298
13 0.541056810 0.580804458
14 0.562658420 0.541056810
15 0.092369055 0.562658420
16 0.134963271 0.092369055
17 -0.075978848 0.134963271
18 0.204673907 -0.075978848
19 0.339633526 0.204673907
20 0.127994903 0.339633526
21 -0.017550182 0.127994903
22 -0.097075754 -0.017550182
23 -0.039151793 -0.097075754
24 -0.293923264 -0.039151793
25 -0.288600255 -0.293923264
26 -0.504952882 -0.288600255
27 -0.411194471 -0.504952882
28 -0.583203221 -0.411194471
29 -0.718606992 -0.583203221
30 -0.811490572 -0.718606992
31 -0.949697162 -0.811490572
32 -0.983055170 -0.949697162
33 -0.845575361 -0.983055170
34 -0.991520848 -0.845575361
35 -1.143825699 -0.991520848
36 -0.823058823 -1.143825699
37 -0.518105941 -0.823058823
38 -0.434458568 -0.518105941
39 -0.357675262 -0.434458568
40 -0.313079033 -0.357675262
41 -0.082433016 -0.313079033
42 -0.122759393 -0.082433016
43 0.009087832 -0.122759393
44 0.213313934 0.009087832
45 0.157910163 0.213313934
46 -0.052083100 0.157910163
47 0.119703574 -0.052083100
48 0.191765895 0.119703574
49 0.055870894 0.191765895
50 0.182957038 0.055870894
51 0.598434834 0.182957038
52 0.707819092 0.598434834
53 0.649804304 0.707819092
54 0.661665003 0.649804304
55 0.511967841 0.661665003
56 0.503071485 0.511967841
57 0.283990065 0.503071485
58 0.510840659 0.283990065
59 0.468764620 0.510840659
> 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/7nxde1258796747.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/8h4q51258796747.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/90vqd1258796747.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/10nfqt1258796747.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/116yvw1258796747.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/12d52a1258796747.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/13y0k21258796748.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/14j02k1258796748.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/15icpr1258796748.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/1693kd1258796748.tab")
+ }
>
> system("convert tmp/1m6001258796747.ps tmp/1m6001258796747.png")
> system("convert tmp/2ohpe1258796747.ps tmp/2ohpe1258796747.png")
> system("convert tmp/32nzr1258796747.ps tmp/32nzr1258796747.png")
> system("convert tmp/4rxad1258796747.ps tmp/4rxad1258796747.png")
> system("convert tmp/51lso1258796747.ps tmp/51lso1258796747.png")
> system("convert tmp/63rqx1258796747.ps tmp/63rqx1258796747.png")
> system("convert tmp/7nxde1258796747.ps tmp/7nxde1258796747.png")
> system("convert tmp/8h4q51258796747.ps tmp/8h4q51258796747.png")
> system("convert tmp/90vqd1258796747.ps tmp/90vqd1258796747.png")
> system("convert tmp/10nfqt1258796747.ps tmp/10nfqt1258796747.png")
>
>
> proc.time()
user system elapsed
2.351 1.533 3.239