R version 2.8.0 (2008-10-20)
Copyright (C) 2008 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(3.4,1,3,1,3.1,1,2.5,0,2.2,0,2.3,0,2.1,0,2.8,0,3.1,1,2.9,0,2.6,0,2.7,0,2.3,0,2.3,0,2.1,0,2.2,0,2.9,0,2.6,0,2.7,0,1.8,0,1.3,0,0.9,0,1.3,0,1.3,0,1.3,0,1.3,0,1.1,0,1.4,0,1.2,0,1.7,0,1.8,0,1.5,0,1,0,1.6,0,1.5,0,1.8,0,1.8,0,1.6,0,1.9,0,1.7,0,1.6,0,1.3,0,1.1,0,1.9,0,2.6,0,2.3,0,2.4,0,2.2,0,2,0,2.9,0,2.6,0,2.3,0,2.3,0,2.6,0,3.1,1,2.8,0,2.5,0,2.9,0,3.1,1,3.1,1,3.2,1,2.5,0,2.6,0,2.9,0,2.6,0,2.4,0,1.7,0,2,0,2.2,0,1.9,0,1.6,0,1.6,0,1.2,0,1.2,0,1.5,0,1.6,0,1.7,0,1.8,0,1.8,0,1.8,0,1.3,0,1.3,0,1.4,0,1.1,0,1.5,0,2.2,0,2.9,0,3.1,1,3.5,1,3.6,1,4.4,1,4.2,1,5.2,1,5.8,1),dim=c(2,94),dimnames=list(c('Consumptieprijsindex','Dumivariabele'),1:94))
> y <- array(NA,dim=c(2,94),dimnames=list(c('Consumptieprijsindex','Dumivariabele'),1:94))
> 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)
> 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
Consumptieprijsindex Dumivariabele M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 3.4 1 1 0 0 0 0 0 0 0 0 0 0 1
2 3.0 1 0 1 0 0 0 0 0 0 0 0 0 2
3 3.1 1 0 0 1 0 0 0 0 0 0 0 0 3
4 2.5 0 0 0 0 1 0 0 0 0 0 0 0 4
5 2.2 0 0 0 0 0 1 0 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0 0 1 0 0 69
70 1.9 0 0 0 0 0 0 0 0 0 0 1 0 70
71 1.6 0 0 0 0 0 0 0 0 0 0 0 1 71
72 1.6 0 0 0 0 0 0 0 0 0 0 0 0 72
73 1.2 0 1 0 0 0 0 0 0 0 0 0 0 73
74 1.2 0 0 1 0 0 0 0 0 0 0 0 0 74
75 1.5 0 0 0 1 0 0 0 0 0 0 0 0 75
76 1.6 0 0 0 0 1 0 0 0 0 0 0 0 76
77 1.7 0 0 0 0 0 1 0 0 0 0 0 0 77
78 1.8 0 0 0 0 0 0 1 0 0 0 0 0 78
79 1.8 0 0 0 0 0 0 0 1 0 0 0 0 79
80 1.8 0 0 0 0 0 0 0 0 1 0 0 0 80
81 1.3 0 0 0 0 0 0 0 0 0 1 0 0 81
82 1.3 0 0 0 0 0 0 0 0 0 0 1 0 82
83 1.4 0 0 0 0 0 0 0 0 0 0 0 1 83
84 1.1 0 0 0 0 0 0 0 0 0 0 0 0 84
85 1.5 0 1 0 0 0 0 0 0 0 0 0 0 85
86 2.2 0 0 1 0 0 0 0 0 0 0 0 0 86
87 2.9 0 0 0 1 0 0 0 0 0 0 0 0 87
88 3.1 1 0 0 0 1 0 0 0 0 0 0 0 88
89 3.5 1 0 0 0 0 1 0 0 0 0 0 0 89
90 3.6 1 0 0 0 0 0 1 0 0 0 0 0 90
91 4.4 1 0 0 0 0 0 0 1 0 0 0 0 91
92 4.2 1 0 0 0 0 0 0 0 1 0 0 0 92
93 5.2 1 0 0 0 0 0 0 0 0 1 0 0 93
94 5.8 1 0 0 0 0 0 0 0 0 0 1 0 94
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Dumivariabele M1 M2 M3
1.668972 1.716920 -0.061928 0.188996 0.287805
M4 M5 M6 M7 M8
0.274113 0.310422 0.346731 0.180924 0.406848
M9 M10 M11 t
0.241042 0.504466 0.015477 0.001191
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.2996 -0.4241 -0.1558 0.5216 1.7977
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.668972 0.269648 6.189 2.43e-08 ***
Dumivariabele 1.716920 0.186074 9.227 3.15e-14 ***
M1 -0.061928 0.333148 -0.186 0.853
M2 0.188996 0.332322 0.569 0.571
M3 0.287805 0.332261 0.866 0.389
M4 0.274113 0.332219 0.825 0.412
M5 0.310422 0.332196 0.934 0.353
M6 0.346731 0.332191 1.044 0.300
M7 0.180924 0.332753 0.544 0.588
M8 0.406848 0.332238 1.225 0.224
M9 0.241042 0.332772 0.724 0.471
M10 0.504466 0.332360 1.518 0.133
M11 0.015477 0.343077 0.045 0.964
t 0.001191 0.002497 0.477 0.635
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.6418 on 80 degrees of freedom
Multiple R-squared: 0.5431, Adjusted R-squared: 0.4689
F-statistic: 7.316 on 13 and 80 DF, p-value: 3.322e-09
> postscript(file="/var/www/html/rcomp/tmp/1dse11227104306.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/21s871227104306.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/33m5z1227104306.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/46xx11227104306.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/57uq81227104306.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 94
Frequency = 1
1 2 3 4 5 6
0.07484384 -0.57727122 -0.57727122 0.55214927 0.21464927 0.27714927
7 8 9 10 11 12
0.24176434 0.71464927 -0.53765616 0.71464927 0.90244654 1.01673225
13 14 15 16 17 18
0.67746885 0.42535378 0.12535378 0.23785378 0.90035378 0.56285378
19 20 21 22 23 24
0.82746885 -0.29964622 -0.63503115 -1.29964622 -0.41184895 -0.39756324
25 26 27 28 29 30
-0.33682664 -0.58894170 -0.88894170 -0.57644170 -0.81394170 -0.35144170
31 32 33 34 35 36
-0.08682664 -0.61394170 -0.94932664 -0.61394170 -0.22614444 0.08814127
37 38 39 40 41 42
0.14887787 -0.30323719 -0.10323719 -0.29073719 -0.42823719 -0.76573719
43 44 45 46 47 48
-0.80112213 -0.22823719 0.63637787 0.07176281 0.65956007 0.47384579
49 50 51 52 53 54
0.33458238 0.98246732 0.58246732 0.29496732 0.25746732 0.51996732
55 56 57 58 59 60
-0.53233812 0.65746732 0.52208238 0.65746732 -0.37165591 -0.35737020
61 62 63 64 65 66
-0.19663361 0.56817183 0.56817183 0.88067183 0.54317183 0.30567183
67 68 69 70 71 72
-0.22971311 -0.15682817 0.20778689 -0.35682817 -0.16903091 -0.15474519
73 74 75 76 77 78
-0.49400860 -0.74612366 -0.54612366 -0.43362366 -0.37112366 -0.30862366
79 80 81 82 83 84
-0.14400860 -0.37112366 -0.70650860 -0.97112366 -0.38332640 -0.66904068
85 86 87 88 89 90
-0.20830409 0.23958085 0.83958085 -0.66483965 -0.30233965 -0.23983965
91 92 93 94
0.72477542 0.29766035 1.46227542 1.79766035
> postscript(file="/var/www/html/rcomp/tmp/6snc11227104306.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 = 94
Frequency = 1
lag(myerror, k = 1) myerror
0 0.07484384 NA
1 -0.57727122 0.07484384
2 -0.57727122 -0.57727122
3 0.55214927 -0.57727122
4 0.21464927 0.55214927
5 0.27714927 0.21464927
6 0.24176434 0.27714927
7 0.71464927 0.24176434
8 -0.53765616 0.71464927
9 0.71464927 -0.53765616
10 0.90244654 0.71464927
11 1.01673225 0.90244654
12 0.67746885 1.01673225
13 0.42535378 0.67746885
14 0.12535378 0.42535378
15 0.23785378 0.12535378
16 0.90035378 0.23785378
17 0.56285378 0.90035378
18 0.82746885 0.56285378
19 -0.29964622 0.82746885
20 -0.63503115 -0.29964622
21 -1.29964622 -0.63503115
22 -0.41184895 -1.29964622
23 -0.39756324 -0.41184895
24 -0.33682664 -0.39756324
25 -0.58894170 -0.33682664
26 -0.88894170 -0.58894170
27 -0.57644170 -0.88894170
28 -0.81394170 -0.57644170
29 -0.35144170 -0.81394170
30 -0.08682664 -0.35144170
31 -0.61394170 -0.08682664
32 -0.94932664 -0.61394170
33 -0.61394170 -0.94932664
34 -0.22614444 -0.61394170
35 0.08814127 -0.22614444
36 0.14887787 0.08814127
37 -0.30323719 0.14887787
38 -0.10323719 -0.30323719
39 -0.29073719 -0.10323719
40 -0.42823719 -0.29073719
41 -0.76573719 -0.42823719
42 -0.80112213 -0.76573719
43 -0.22823719 -0.80112213
44 0.63637787 -0.22823719
45 0.07176281 0.63637787
46 0.65956007 0.07176281
47 0.47384579 0.65956007
48 0.33458238 0.47384579
49 0.98246732 0.33458238
50 0.58246732 0.98246732
51 0.29496732 0.58246732
52 0.25746732 0.29496732
53 0.51996732 0.25746732
54 -0.53233812 0.51996732
55 0.65746732 -0.53233812
56 0.52208238 0.65746732
57 0.65746732 0.52208238
58 -0.37165591 0.65746732
59 -0.35737020 -0.37165591
60 -0.19663361 -0.35737020
61 0.56817183 -0.19663361
62 0.56817183 0.56817183
63 0.88067183 0.56817183
64 0.54317183 0.88067183
65 0.30567183 0.54317183
66 -0.22971311 0.30567183
67 -0.15682817 -0.22971311
68 0.20778689 -0.15682817
69 -0.35682817 0.20778689
70 -0.16903091 -0.35682817
71 -0.15474519 -0.16903091
72 -0.49400860 -0.15474519
73 -0.74612366 -0.49400860
74 -0.54612366 -0.74612366
75 -0.43362366 -0.54612366
76 -0.37112366 -0.43362366
77 -0.30862366 -0.37112366
78 -0.14400860 -0.30862366
79 -0.37112366 -0.14400860
80 -0.70650860 -0.37112366
81 -0.97112366 -0.70650860
82 -0.38332640 -0.97112366
83 -0.66904068 -0.38332640
84 -0.20830409 -0.66904068
85 0.23958085 -0.20830409
86 0.83958085 0.23958085
87 -0.66483965 0.83958085
88 -0.30233965 -0.66483965
89 -0.23983965 -0.30233965
90 0.72477542 -0.23983965
91 0.29766035 0.72477542
92 1.46227542 0.29766035
93 1.79766035 1.46227542
94 NA 1.79766035
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.57727122 0.07484384
[2,] -0.57727122 -0.57727122
[3,] 0.55214927 -0.57727122
[4,] 0.21464927 0.55214927
[5,] 0.27714927 0.21464927
[6,] 0.24176434 0.27714927
[7,] 0.71464927 0.24176434
[8,] -0.53765616 0.71464927
[9,] 0.71464927 -0.53765616
[10,] 0.90244654 0.71464927
[11,] 1.01673225 0.90244654
[12,] 0.67746885 1.01673225
[13,] 0.42535378 0.67746885
[14,] 0.12535378 0.42535378
[15,] 0.23785378 0.12535378
[16,] 0.90035378 0.23785378
[17,] 0.56285378 0.90035378
[18,] 0.82746885 0.56285378
[19,] -0.29964622 0.82746885
[20,] -0.63503115 -0.29964622
[21,] -1.29964622 -0.63503115
[22,] -0.41184895 -1.29964622
[23,] -0.39756324 -0.41184895
[24,] -0.33682664 -0.39756324
[25,] -0.58894170 -0.33682664
[26,] -0.88894170 -0.58894170
[27,] -0.57644170 -0.88894170
[28,] -0.81394170 -0.57644170
[29,] -0.35144170 -0.81394170
[30,] -0.08682664 -0.35144170
[31,] -0.61394170 -0.08682664
[32,] -0.94932664 -0.61394170
[33,] -0.61394170 -0.94932664
[34,] -0.22614444 -0.61394170
[35,] 0.08814127 -0.22614444
[36,] 0.14887787 0.08814127
[37,] -0.30323719 0.14887787
[38,] -0.10323719 -0.30323719
[39,] -0.29073719 -0.10323719
[40,] -0.42823719 -0.29073719
[41,] -0.76573719 -0.42823719
[42,] -0.80112213 -0.76573719
[43,] -0.22823719 -0.80112213
[44,] 0.63637787 -0.22823719
[45,] 0.07176281 0.63637787
[46,] 0.65956007 0.07176281
[47,] 0.47384579 0.65956007
[48,] 0.33458238 0.47384579
[49,] 0.98246732 0.33458238
[50,] 0.58246732 0.98246732
[51,] 0.29496732 0.58246732
[52,] 0.25746732 0.29496732
[53,] 0.51996732 0.25746732
[54,] -0.53233812 0.51996732
[55,] 0.65746732 -0.53233812
[56,] 0.52208238 0.65746732
[57,] 0.65746732 0.52208238
[58,] -0.37165591 0.65746732
[59,] -0.35737020 -0.37165591
[60,] -0.19663361 -0.35737020
[61,] 0.56817183 -0.19663361
[62,] 0.56817183 0.56817183
[63,] 0.88067183 0.56817183
[64,] 0.54317183 0.88067183
[65,] 0.30567183 0.54317183
[66,] -0.22971311 0.30567183
[67,] -0.15682817 -0.22971311
[68,] 0.20778689 -0.15682817
[69,] -0.35682817 0.20778689
[70,] -0.16903091 -0.35682817
[71,] -0.15474519 -0.16903091
[72,] -0.49400860 -0.15474519
[73,] -0.74612366 -0.49400860
[74,] -0.54612366 -0.74612366
[75,] -0.43362366 -0.54612366
[76,] -0.37112366 -0.43362366
[77,] -0.30862366 -0.37112366
[78,] -0.14400860 -0.30862366
[79,] -0.37112366 -0.14400860
[80,] -0.70650860 -0.37112366
[81,] -0.97112366 -0.70650860
[82,] -0.38332640 -0.97112366
[83,] -0.66904068 -0.38332640
[84,] -0.20830409 -0.66904068
[85,] 0.23958085 -0.20830409
[86,] 0.83958085 0.23958085
[87,] -0.66483965 0.83958085
[88,] -0.30233965 -0.66483965
[89,] -0.23983965 -0.30233965
[90,] 0.72477542 -0.23983965
[91,] 0.29766035 0.72477542
[92,] 1.46227542 0.29766035
[93,] 1.79766035 1.46227542
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.57727122 0.07484384
2 -0.57727122 -0.57727122
3 0.55214927 -0.57727122
4 0.21464927 0.55214927
5 0.27714927 0.21464927
6 0.24176434 0.27714927
7 0.71464927 0.24176434
8 -0.53765616 0.71464927
9 0.71464927 -0.53765616
10 0.90244654 0.71464927
11 1.01673225 0.90244654
12 0.67746885 1.01673225
13 0.42535378 0.67746885
14 0.12535378 0.42535378
15 0.23785378 0.12535378
16 0.90035378 0.23785378
17 0.56285378 0.90035378
18 0.82746885 0.56285378
19 -0.29964622 0.82746885
20 -0.63503115 -0.29964622
21 -1.29964622 -0.63503115
22 -0.41184895 -1.29964622
23 -0.39756324 -0.41184895
24 -0.33682664 -0.39756324
25 -0.58894170 -0.33682664
26 -0.88894170 -0.58894170
27 -0.57644170 -0.88894170
28 -0.81394170 -0.57644170
29 -0.35144170 -0.81394170
30 -0.08682664 -0.35144170
31 -0.61394170 -0.08682664
32 -0.94932664 -0.61394170
33 -0.61394170 -0.94932664
34 -0.22614444 -0.61394170
35 0.08814127 -0.22614444
36 0.14887787 0.08814127
37 -0.30323719 0.14887787
38 -0.10323719 -0.30323719
39 -0.29073719 -0.10323719
40 -0.42823719 -0.29073719
41 -0.76573719 -0.42823719
42 -0.80112213 -0.76573719
43 -0.22823719 -0.80112213
44 0.63637787 -0.22823719
45 0.07176281 0.63637787
46 0.65956007 0.07176281
47 0.47384579 0.65956007
48 0.33458238 0.47384579
49 0.98246732 0.33458238
50 0.58246732 0.98246732
51 0.29496732 0.58246732
52 0.25746732 0.29496732
53 0.51996732 0.25746732
54 -0.53233812 0.51996732
55 0.65746732 -0.53233812
56 0.52208238 0.65746732
57 0.65746732 0.52208238
58 -0.37165591 0.65746732
59 -0.35737020 -0.37165591
60 -0.19663361 -0.35737020
61 0.56817183 -0.19663361
62 0.56817183 0.56817183
63 0.88067183 0.56817183
64 0.54317183 0.88067183
65 0.30567183 0.54317183
66 -0.22971311 0.30567183
67 -0.15682817 -0.22971311
68 0.20778689 -0.15682817
69 -0.35682817 0.20778689
70 -0.16903091 -0.35682817
71 -0.15474519 -0.16903091
72 -0.49400860 -0.15474519
73 -0.74612366 -0.49400860
74 -0.54612366 -0.74612366
75 -0.43362366 -0.54612366
76 -0.37112366 -0.43362366
77 -0.30862366 -0.37112366
78 -0.14400860 -0.30862366
79 -0.37112366 -0.14400860
80 -0.70650860 -0.37112366
81 -0.97112366 -0.70650860
82 -0.38332640 -0.97112366
83 -0.66904068 -0.38332640
84 -0.20830409 -0.66904068
85 0.23958085 -0.20830409
86 0.83958085 0.23958085
87 -0.66483965 0.83958085
88 -0.30233965 -0.66483965
89 -0.23983965 -0.30233965
90 0.72477542 -0.23983965
91 0.29766035 0.72477542
92 1.46227542 0.29766035
93 1.79766035 1.46227542
> 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/709zy1227104306.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/8e11s1227104306.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/9ba1z1227104306.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
>
> #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/10sig91227104306.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/11viz11227104307.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/127eaz1227104307.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/13xdt61227104307.tab")
>
> system("convert tmp/1dse11227104306.ps tmp/1dse11227104306.png")
> system("convert tmp/21s871227104306.ps tmp/21s871227104306.png")
> system("convert tmp/33m5z1227104306.ps tmp/33m5z1227104306.png")
> system("convert tmp/46xx11227104306.ps tmp/46xx11227104306.png")
> system("convert tmp/57uq81227104306.ps tmp/57uq81227104306.png")
> system("convert tmp/6snc11227104306.ps tmp/6snc11227104306.png")
> system("convert tmp/709zy1227104306.ps tmp/709zy1227104306.png")
> system("convert tmp/8e11s1227104306.ps tmp/8e11s1227104306.png")
> system("convert tmp/9ba1z1227104306.ps tmp/9ba1z1227104306.png")
>
>
> proc.time()
user system elapsed
2.056 1.469 3.022