R version 2.6.0 (2007-10-03)
Copyright (C) 2007 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.
Natural language support but running in an English locale
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(168.836
+ ,102.161
+ ,66.674
+ ,150.581
+ ,90.488
+ ,60.093
+ ,149.514
+ ,113.022
+ ,36.492
+ ,148.281
+ ,98.250
+ ,50.031
+ ,125.968
+ ,111.717
+ ,14.250
+ ,96.566
+ ,3.027
+ ,93.538
+ ,84.416
+ ,32.943
+ ,51.473
+ ,84.222
+ ,15.236
+ ,68.986
+ ,82.354
+ ,8.606
+ ,73.747
+ ,75.213
+ ,67.359
+ ,7.854
+ ,71.639
+ ,66.225
+ ,5.414
+ ,70.339
+ ,18.636
+ ,51.703
+ ,68.503
+ ,39.376
+ ,29.127
+ ,68.183
+ ,39.383
+ ,28.800
+ ,66.893
+ ,40.266
+ ,26.627
+ ,61.926
+ ,11.407
+ ,50.520
+ ,61.630
+ ,47.735
+ ,13.895
+ ,53.911
+ ,53.284
+ ,627
+ ,53.077
+ ,8.769
+ ,44.309
+ ,51.337
+ ,982
+ ,50.355
+ ,51.314
+ ,117
+ ,51.197
+ ,50.978
+ ,25.464
+ ,25.513
+ ,48.921
+ ,6.915
+ ,42.007
+ ,48.809
+ ,32.405
+ ,16.404
+ ,47.727
+ ,25.255
+ ,22.472
+ ,47.216
+ ,47.121
+ ,95
+ ,45.698
+ ,8.350
+ ,37.348
+ ,45.568
+ ,4.521
+ ,41.047
+ ,44.102
+ ,10.756
+ ,33.346
+ ,42.489
+ ,32.693
+ ,9.796
+ ,42.102
+ ,17.061
+ ,25.041
+ ,38.251
+ ,242
+ ,38.009
+ ,37.657
+ ,12.185
+ ,25.472
+ ,36.817
+ ,12.165
+ ,24.652
+ ,35.818
+ ,13.060
+ ,22.758
+ ,35.685
+ ,2.644
+ ,33.041
+ ,35.516
+ ,12.853
+ ,22.663
+ ,35.101
+ ,370
+ ,34.732
+ ,34.173
+ ,9.495
+ ,24.678
+ ,33.234
+ ,26.133
+ ,7.101
+ ,29.635
+ ,917
+ ,28.718
+ ,27.750
+ ,12.118
+ ,15.632
+ ,27.086
+ ,25.649
+ ,1.437
+ ,26.385
+ ,20.752
+ ,5.633
+ ,25.009
+ ,14.616
+ ,10.393
+ ,24.076
+ ,2.994
+ ,21.082
+ ,23.779
+ ,4.790
+ ,18.989
+ ,23.296
+ ,16.362
+ ,6.934
+ ,23.010
+ ,19.962
+ ,3.048
+ ,22.971
+ ,22.753
+ ,218
+ ,22.723
+ ,5.096
+ ,17.627
+ ,21.938
+ ,9.411
+ ,12.527
+ ,21.446
+ ,703
+ ,20.743
+ ,21.402
+ ,4.333
+ ,17.069
+ ,21.200
+ ,9.835
+ ,11.365
+ ,20.890
+ ,15.452
+ ,5.438
+ ,20.850
+ ,1.814
+ ,19.037
+ ,19.730
+ ,216
+ ,19.514
+ ,19.661
+ ,2.580
+ ,17.082
+ ,19.264
+ ,11.426
+ ,7.838
+ ,18.980
+ ,3.335
+ ,15.644
+ ,18.836
+ ,113
+ ,18.723
+ ,17.203
+ ,4.191
+ ,13.013
+ ,17.060
+ ,7.932
+ ,9.128
+ ,16.828
+ ,544
+ ,16.283
+ ,16.574
+ ,943
+ ,15.631
+ ,16.218
+ ,5.593
+ ,10.625
+ ,16.055
+ ,1.745
+ ,14.310
+ ,15.471
+ ,2.550
+ ,12.921
+ ,15.237
+ ,1.803
+ ,13.434
+ ,15.105
+ ,395
+ ,14.710
+ ,14.560
+ ,100
+ ,14.460
+ ,14.290
+ ,11.176
+ ,3.115
+ ,14.148
+ ,1.478
+ ,12.669
+ ,14.105
+ ,2.787
+ ,11.318
+ ,13.995
+ ,12.425
+ ,1.570
+ ,13.961
+ ,4.227
+ ,9.734
+ ,13.916
+ ,13.387
+ ,528
+ ,12.982
+ ,4.956
+ ,8.026
+ ,12.671
+ ,1.119
+ ,11.553
+ ,11.415
+ ,1.036
+ ,10.380
+ ,11.393
+ ,2.308
+ ,9.085
+ ,11.363
+ ,3.620
+ ,7.743
+ ,11.152
+ ,9.734
+ ,1.418
+ ,10.730
+ ,425
+ ,10.305
+ ,10.402
+ ,7.383
+ ,3.018
+ ,10.004
+ ,2.975
+ ,7.028
+ ,9.902
+ ,2.818
+ ,7.084
+ ,9.857
+ ,7.029
+ ,2.829
+ ,9.738
+ ,554
+ ,9.184
+ ,9.625
+ ,7.197
+ ,2.428
+ ,9.228
+ ,5.354
+ ,3.873
+ ,9.145
+ ,6.297
+ ,2.849
+ ,8.846
+ ,4.816
+ ,4.030
+ ,8.749
+ ,0
+ ,8.749
+ ,8.718
+ ,4.577
+ ,4.142
+ ,8.569
+ ,3.656
+ ,4.913
+ ,8.473
+ ,280
+ ,8.193
+ ,8.309
+ ,321
+ ,7.988
+ ,8.103
+ ,1.315
+ ,6.788)
+ ,dim=c(3
+ ,100)
+ ,dimnames=list(c('Totaal'
+ ,'Vrouwen'
+ ,'Mannen')
+ ,1:100))
> y <- array(NA,dim=c(3,100),dimnames=list(c('Totaal','Vrouwen','Mannen'),1:100))
> 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
Totaal Vrouwen Mannen M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 168.836 102.161 66.674 1 0 0 0 0 0 0 0 0 0 0 1
2 150.581 90.488 60.093 0 1 0 0 0 0 0 0 0 0 0 2
3 149.514 113.022 36.492 0 0 1 0 0 0 0 0 0 0 0 3
4 148.281 98.250 50.031 0 0 0 1 0 0 0 0 0 0 0 4
5 125.968 111.717 14.250 0 0 0 0 1 0 0 0 0 0 0 5
6 96.566 3.027 93.538 0 0 0 0 0 1 0 0 0 0 0 6
7 84.416 32.943 51.473 0 0 0 0 0 0 1 0 0 0 0 7
8 84.222 15.236 68.986 0 0 0 0 0 0 0 1 0 0 0 8
9 82.354 8.606 73.747 0 0 0 0 0 0 0 0 1 0 0 9
10 75.213 67.359 7.854 0 0 0 0 0 0 0 0 0 1 0 10
11 71.639 66.225 5.414 0 0 0 0 0 0 0 0 0 0 1 11
12 70.339 18.636 51.703 0 0 0 0 0 0 0 0 0 0 0 12
13 68.503 39.376 29.127 1 0 0 0 0 0 0 0 0 0 0 13
14 68.183 39.383 28.800 0 1 0 0 0 0 0 0 0 0 0 14
15 66.893 40.266 26.627 0 0 1 0 0 0 0 0 0 0 0 15
16 61.926 11.407 50.520 0 0 0 1 0 0 0 0 0 0 0 16
17 61.630 47.735 13.895 0 0 0 0 1 0 0 0 0 0 0 17
18 53.911 53.284 627.000 0 0 0 0 0 1 0 0 0 0 0 18
19 53.077 8.769 44.309 0 0 0 0 0 0 1 0 0 0 0 19
20 51.337 982.000 50.355 0 0 0 0 0 0 0 1 0 0 0 20
21 51.314 117.000 51.197 0 0 0 0 0 0 0 0 1 0 0 21
22 50.978 25.464 25.513 0 0 0 0 0 0 0 0 0 1 0 22
23 48.921 6.915 42.007 0 0 0 0 0 0 0 0 0 0 1 23
24 48.809 32.405 16.404 0 0 0 0 0 0 0 0 0 0 0 24
25 47.727 25.255 22.472 1 0 0 0 0 0 0 0 0 0 0 25
26 47.216 47.121 95.000 0 1 0 0 0 0 0 0 0 0 0 26
27 45.698 8.350 37.348 0 0 1 0 0 0 0 0 0 0 0 27
28 45.568 4.521 41.047 0 0 0 1 0 0 0 0 0 0 0 28
29 44.102 10.756 33.346 0 0 0 0 1 0 0 0 0 0 0 29
30 42.489 32.693 9.796 0 0 0 0 0 1 0 0 0 0 0 30
31 42.102 17.061 25.041 0 0 0 0 0 0 1 0 0 0 0 31
32 38.251 242.000 38.009 0 0 0 0 0 0 0 1 0 0 0 32
33 37.657 12.185 25.472 0 0 0 0 0 0 0 0 1 0 0 33
34 36.817 12.165 24.652 0 0 0 0 0 0 0 0 0 1 0 34
35 35.818 13.060 22.758 0 0 0 0 0 0 0 0 0 0 1 35
36 35.685 2.644 33.041 0 0 0 0 0 0 0 0 0 0 0 36
37 35.516 12.853 22.663 1 0 0 0 0 0 0 0 0 0 0 37
38 35.101 370.000 34.732 0 1 0 0 0 0 0 0 0 0 0 38
39 34.173 9.495 24.678 0 0 1 0 0 0 0 0 0 0 0 39
40 33.234 26.133 7.101 0 0 0 1 0 0 0 0 0 0 0 40
41 29.635 917.000 28.718 0 0 0 0 1 0 0 0 0 0 0 41
42 27.750 12.118 15.632 0 0 0 0 0 1 0 0 0 0 0 42
43 27.086 25.649 1.437 0 0 0 0 0 0 1 0 0 0 0 43
44 26.385 20.752 5.633 0 0 0 0 0 0 0 1 0 0 0 44
45 25.009 14.616 10.393 0 0 0 0 0 0 0 0 1 0 0 45
46 24.076 2.994 21.082 0 0 0 0 0 0 0 0 0 1 0 46
47 23.779 4.790 18.989 0 0 0 0 0 0 0 0 0 0 1 47
48 23.296 16.362 6.934 0 0 0 0 0 0 0 0 0 0 0 48
49 23.010 19.962 3.048 1 0 0 0 0 0 0 0 0 0 0 49
50 22.971 22.753 218.000 0 1 0 0 0 0 0 0 0 0 0 50
51 22.723 5.096 17.627 0 0 1 0 0 0 0 0 0 0 0 51
52 21.938 9.411 12.527 0 0 0 1 0 0 0 0 0 0 0 52
53 21.446 703.000 20.743 0 0 0 0 1 0 0 0 0 0 0 53
54 21.402 4.333 17.069 0 0 0 0 0 1 0 0 0 0 0 54
55 21.200 9.835 11.365 0 0 0 0 0 0 1 0 0 0 0 55
56 20.890 15.452 5.438 0 0 0 0 0 0 0 1 0 0 0 56
57 20.850 1.814 19.037 0 0 0 0 0 0 0 0 1 0 0 57
58 19.730 216.000 19.514 0 0 0 0 0 0 0 0 0 1 0 58
59 19.661 2.580 17.082 0 0 0 0 0 0 0 0 0 0 1 59
60 19.264 11.426 7.838 0 0 0 0 0 0 0 0 0 0 0 60
61 18.980 3.335 15.644 1 0 0 0 0 0 0 0 0 0 0 61
62 18.836 113.000 18.723 0 1 0 0 0 0 0 0 0 0 0 62
63 17.203 4.191 13.013 0 0 1 0 0 0 0 0 0 0 0 63
64 17.060 7.932 9.128 0 0 0 1 0 0 0 0 0 0 0 64
65 16.828 544.000 16.283 0 0 0 0 1 0 0 0 0 0 0 65
66 16.574 943.000 15.631 0 0 0 0 0 1 0 0 0 0 0 66
67 16.218 5.593 10.625 0 0 0 0 0 0 1 0 0 0 0 67
68 16.055 1.745 14.310 0 0 0 0 0 0 0 1 0 0 0 68
69 15.471 2.550 12.921 0 0 0 0 0 0 0 0 1 0 0 69
70 15.237 1.803 13.434 0 0 0 0 0 0 0 0 0 1 0 70
71 15.105 395.000 14.710 0 0 0 0 0 0 0 0 0 0 1 71
72 14.560 100.000 14.460 0 0 0 0 0 0 0 0 0 0 0 72
73 14.290 11.176 3.115 1 0 0 0 0 0 0 0 0 0 0 73
74 14.148 1.478 12.669 0 1 0 0 0 0 0 0 0 0 0 74
75 14.105 2.787 11.318 0 0 1 0 0 0 0 0 0 0 0 75
76 13.995 12.425 1.570 0 0 0 1 0 0 0 0 0 0 0 76
77 13.961 4.227 9.734 0 0 0 0 1 0 0 0 0 0 0 77
78 13.916 13.387 528.000 0 0 0 0 0 1 0 0 0 0 0 78
79 12.982 4.956 8.026 0 0 0 0 0 0 1 0 0 0 0 79
80 12.671 1.119 11.553 0 0 0 0 0 0 0 1 0 0 0 80
81 11.415 1.036 10.380 0 0 0 0 0 0 0 0 1 0 0 81
82 11.393 2.308 9.085 0 0 0 0 0 0 0 0 0 1 0 82
83 11.363 3.620 7.743 0 0 0 0 0 0 0 0 0 0 1 83
84 11.152 9.734 1.418 0 0 0 0 0 0 0 0 0 0 0 84
85 10.730 425.000 10.305 1 0 0 0 0 0 0 0 0 0 0 85
86 10.402 7.383 3.018 0 1 0 0 0 0 0 0 0 0 0 86
87 10.004 2.975 7.028 0 0 1 0 0 0 0 0 0 0 0 87
88 9.902 2.818 7.084 0 0 0 1 0 0 0 0 0 0 0 88
89 9.857 7.029 2.829 0 0 0 0 1 0 0 0 0 0 0 89
90 9.738 554.000 9.184 0 0 0 0 0 1 0 0 0 0 0 90
91 9.625 7.197 2.428 0 0 0 0 0 0 1 0 0 0 0 91
92 9.228 5.354 3.873 0 0 0 0 0 0 0 1 0 0 0 92
93 9.145 6.297 2.849 0 0 0 0 0 0 0 0 1 0 0 93
94 8.846 4.816 4.030 0 0 0 0 0 0 0 0 0 1 0 94
95 8.749 0.000 8.749 0 0 0 0 0 0 0 0 0 0 1 95
96 8.718 4.577 4.142 0 0 0 0 0 0 0 0 0 0 0 96
97 8.569 3.656 4.913 1 0 0 0 0 0 0 0 0 0 0 97
98 8.473 280.000 8.193 0 1 0 0 0 0 0 0 0 0 0 98
99 8.309 321.000 7.988 0 0 1 0 0 0 0 0 0 0 0 99
100 8.103 1.315 6.788 0 0 0 1 0 0 0 0 0 0 0 100
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Vrouwen Mannen M1 M2 M3
80.619975 -0.002839 -0.001593 10.404993 9.266594 9.212161
M4 M5 M6 M7 M8 M9
9.105100 5.532332 1.326992 -0.438358 -0.017728 -0.186935
M10 M11 t
-0.554201 -0.447555 -0.954547
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-21.181 -11.494 -5.423 8.353 79.162
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 80.619975 7.989903 10.090 3.38e-16 ***
Vrouwen -0.002839 0.011099 -0.256 0.799
Mannen -0.001593 0.028008 -0.057 0.955
M1 10.404993 9.602324 1.084 0.282
M2 9.266594 9.690956 0.956 0.342
M3 9.212161 9.590675 0.961 0.340
M4 9.105100 9.582632 0.950 0.345
M5 5.532332 10.313817 0.536 0.593
M6 1.326992 10.946942 0.121 0.904
M7 -0.438358 9.865543 -0.044 0.965
M8 -0.017728 9.983864 -0.002 0.999
M9 -0.186935 9.863260 -0.019 0.985
M10 -0.554201 9.861989 -0.056 0.955
M11 -0.447555 9.867930 -0.045 0.964
t -0.954547 0.069849 -13.666 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 19.72 on 85 degrees of freedom
Multiple R-Squared: 0.7032, Adjusted R-squared: 0.6543
F-statistic: 14.39 on 14 and 85 DF, p-value: < 2.2e-16
> postscript(file="/var/www/html/rcomp/tmp/122we1195724100.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/2vymo1195724100.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/3difb1195724100.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/4fuha1195724100.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/5jcnj1195724100.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 = 100
Frequency = 1
1 2 3 4 5 6
79.16183171 62.95615394 62.92451543 62.73275160 44.92830423 20.50391013
7 8 9 10 11 12
11.09173485 11.40927722 10.65379262 4.89644826 2.16324341 1.30886064
13 14 15 16 17 18
-9.95466411 -8.18221900 -8.46419346 -12.41345843 -8.13734560 -9.70406884
19 20 21 22 23 24
-8.87274243 -7.30609539 -8.65981989 -7.97479929 -9.21028644 -8.78370990
25 26 27 28 29 30
-19.32678912 -17.56723097 -18.27816142 -17.35153145 -14.28478160 -10.71312687
31 32 33 34 35 36
-8.40032639 -11.05812795 -11.20081136 -10.72036111 -10.87193569 -10.51113580
37 38 39 40 41 42
-20.11812850 -17.40698165 -18.36552624 -18.22367970 -14.73167062 -14.04667809
43 44 45 46 47 48
-11.97497695 -12.14927881 -12.41136249 -12.03851838 -11.48585193 -11.44820889
49 50 51 52 53 54
-21.18062386 -18.77634954 -18.38468034 -18.10394498 -12.08637453 -8.95992456
55 56 57 58 59 60
-6.43549293 -6.20506978 -5.13837244 -4.32770416 -4.15859719 -4.03821580
61 62 63 64 65 66
-13.78319809 -11.51799756 -12.46003265 -11.53699152 -5.70832884 0.32931998
67 68 69 70 71 72
0.02385171 0.38971407 0.92954163 2.01605124 3.85031038 2.97436982
73 74 75 76 77 78
-7.01632771 -5.07769627 -4.11015189 -3.14670796 1.33633707 7.30279358
79 80 81 82 83 84
8.23647005 8.45411195 8.31976247 9.62112419 10.44061282 10.74388756
85 86 87 88 89 90
2.06457956 2.63226208 3.23711505 4.19636713 8.68385989 15.28777467
91 92 93 94 95 96
16.33148210 16.46546868 17.50726946 18.52775925 19.27250465 19.75415236
97 98 99 100
10.15332011 12.94005896 13.90111552 13.84719533
> postscript(file="/var/www/html/rcomp/tmp/6hch31195724101.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 = 100
Frequency = 1
lag(myerror, k = 1) myerror
0 79.16183171 NA
1 62.95615394 79.16183171
2 62.92451543 62.95615394
3 62.73275160 62.92451543
4 44.92830423 62.73275160
5 20.50391013 44.92830423
6 11.09173485 20.50391013
7 11.40927722 11.09173485
8 10.65379262 11.40927722
9 4.89644826 10.65379262
10 2.16324341 4.89644826
11 1.30886064 2.16324341
12 -9.95466411 1.30886064
13 -8.18221900 -9.95466411
14 -8.46419346 -8.18221900
15 -12.41345843 -8.46419346
16 -8.13734560 -12.41345843
17 -9.70406884 -8.13734560
18 -8.87274243 -9.70406884
19 -7.30609539 -8.87274243
20 -8.65981989 -7.30609539
21 -7.97479929 -8.65981989
22 -9.21028644 -7.97479929
23 -8.78370990 -9.21028644
24 -19.32678912 -8.78370990
25 -17.56723097 -19.32678912
26 -18.27816142 -17.56723097
27 -17.35153145 -18.27816142
28 -14.28478160 -17.35153145
29 -10.71312687 -14.28478160
30 -8.40032639 -10.71312687
31 -11.05812795 -8.40032639
32 -11.20081136 -11.05812795
33 -10.72036111 -11.20081136
34 -10.87193569 -10.72036111
35 -10.51113580 -10.87193569
36 -20.11812850 -10.51113580
37 -17.40698165 -20.11812850
38 -18.36552624 -17.40698165
39 -18.22367970 -18.36552624
40 -14.73167062 -18.22367970
41 -14.04667809 -14.73167062
42 -11.97497695 -14.04667809
43 -12.14927881 -11.97497695
44 -12.41136249 -12.14927881
45 -12.03851838 -12.41136249
46 -11.48585193 -12.03851838
47 -11.44820889 -11.48585193
48 -21.18062386 -11.44820889
49 -18.77634954 -21.18062386
50 -18.38468034 -18.77634954
51 -18.10394498 -18.38468034
52 -12.08637453 -18.10394498
53 -8.95992456 -12.08637453
54 -6.43549293 -8.95992456
55 -6.20506978 -6.43549293
56 -5.13837244 -6.20506978
57 -4.32770416 -5.13837244
58 -4.15859719 -4.32770416
59 -4.03821580 -4.15859719
60 -13.78319809 -4.03821580
61 -11.51799756 -13.78319809
62 -12.46003265 -11.51799756
63 -11.53699152 -12.46003265
64 -5.70832884 -11.53699152
65 0.32931998 -5.70832884
66 0.02385171 0.32931998
67 0.38971407 0.02385171
68 0.92954163 0.38971407
69 2.01605124 0.92954163
70 3.85031038 2.01605124
71 2.97436982 3.85031038
72 -7.01632771 2.97436982
73 -5.07769627 -7.01632771
74 -4.11015189 -5.07769627
75 -3.14670796 -4.11015189
76 1.33633707 -3.14670796
77 7.30279358 1.33633707
78 8.23647005 7.30279358
79 8.45411195 8.23647005
80 8.31976247 8.45411195
81 9.62112419 8.31976247
82 10.44061282 9.62112419
83 10.74388756 10.44061282
84 2.06457956 10.74388756
85 2.63226208 2.06457956
86 3.23711505 2.63226208
87 4.19636713 3.23711505
88 8.68385989 4.19636713
89 15.28777467 8.68385989
90 16.33148210 15.28777467
91 16.46546868 16.33148210
92 17.50726946 16.46546868
93 18.52775925 17.50726946
94 19.27250465 18.52775925
95 19.75415236 19.27250465
96 10.15332011 19.75415236
97 12.94005896 10.15332011
98 13.90111552 12.94005896
99 13.84719533 13.90111552
100 NA 13.84719533
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 62.95615394 79.16183171
[2,] 62.92451543 62.95615394
[3,] 62.73275160 62.92451543
[4,] 44.92830423 62.73275160
[5,] 20.50391013 44.92830423
[6,] 11.09173485 20.50391013
[7,] 11.40927722 11.09173485
[8,] 10.65379262 11.40927722
[9,] 4.89644826 10.65379262
[10,] 2.16324341 4.89644826
[11,] 1.30886064 2.16324341
[12,] -9.95466411 1.30886064
[13,] -8.18221900 -9.95466411
[14,] -8.46419346 -8.18221900
[15,] -12.41345843 -8.46419346
[16,] -8.13734560 -12.41345843
[17,] -9.70406884 -8.13734560
[18,] -8.87274243 -9.70406884
[19,] -7.30609539 -8.87274243
[20,] -8.65981989 -7.30609539
[21,] -7.97479929 -8.65981989
[22,] -9.21028644 -7.97479929
[23,] -8.78370990 -9.21028644
[24,] -19.32678912 -8.78370990
[25,] -17.56723097 -19.32678912
[26,] -18.27816142 -17.56723097
[27,] -17.35153145 -18.27816142
[28,] -14.28478160 -17.35153145
[29,] -10.71312687 -14.28478160
[30,] -8.40032639 -10.71312687
[31,] -11.05812795 -8.40032639
[32,] -11.20081136 -11.05812795
[33,] -10.72036111 -11.20081136
[34,] -10.87193569 -10.72036111
[35,] -10.51113580 -10.87193569
[36,] -20.11812850 -10.51113580
[37,] -17.40698165 -20.11812850
[38,] -18.36552624 -17.40698165
[39,] -18.22367970 -18.36552624
[40,] -14.73167062 -18.22367970
[41,] -14.04667809 -14.73167062
[42,] -11.97497695 -14.04667809
[43,] -12.14927881 -11.97497695
[44,] -12.41136249 -12.14927881
[45,] -12.03851838 -12.41136249
[46,] -11.48585193 -12.03851838
[47,] -11.44820889 -11.48585193
[48,] -21.18062386 -11.44820889
[49,] -18.77634954 -21.18062386
[50,] -18.38468034 -18.77634954
[51,] -18.10394498 -18.38468034
[52,] -12.08637453 -18.10394498
[53,] -8.95992456 -12.08637453
[54,] -6.43549293 -8.95992456
[55,] -6.20506978 -6.43549293
[56,] -5.13837244 -6.20506978
[57,] -4.32770416 -5.13837244
[58,] -4.15859719 -4.32770416
[59,] -4.03821580 -4.15859719
[60,] -13.78319809 -4.03821580
[61,] -11.51799756 -13.78319809
[62,] -12.46003265 -11.51799756
[63,] -11.53699152 -12.46003265
[64,] -5.70832884 -11.53699152
[65,] 0.32931998 -5.70832884
[66,] 0.02385171 0.32931998
[67,] 0.38971407 0.02385171
[68,] 0.92954163 0.38971407
[69,] 2.01605124 0.92954163
[70,] 3.85031038 2.01605124
[71,] 2.97436982 3.85031038
[72,] -7.01632771 2.97436982
[73,] -5.07769627 -7.01632771
[74,] -4.11015189 -5.07769627
[75,] -3.14670796 -4.11015189
[76,] 1.33633707 -3.14670796
[77,] 7.30279358 1.33633707
[78,] 8.23647005 7.30279358
[79,] 8.45411195 8.23647005
[80,] 8.31976247 8.45411195
[81,] 9.62112419 8.31976247
[82,] 10.44061282 9.62112419
[83,] 10.74388756 10.44061282
[84,] 2.06457956 10.74388756
[85,] 2.63226208 2.06457956
[86,] 3.23711505 2.63226208
[87,] 4.19636713 3.23711505
[88,] 8.68385989 4.19636713
[89,] 15.28777467 8.68385989
[90,] 16.33148210 15.28777467
[91,] 16.46546868 16.33148210
[92,] 17.50726946 16.46546868
[93,] 18.52775925 17.50726946
[94,] 19.27250465 18.52775925
[95,] 19.75415236 19.27250465
[96,] 10.15332011 19.75415236
[97,] 12.94005896 10.15332011
[98,] 13.90111552 12.94005896
[99,] 13.84719533 13.90111552
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 62.95615394 79.16183171
2 62.92451543 62.95615394
3 62.73275160 62.92451543
4 44.92830423 62.73275160
5 20.50391013 44.92830423
6 11.09173485 20.50391013
7 11.40927722 11.09173485
8 10.65379262 11.40927722
9 4.89644826 10.65379262
10 2.16324341 4.89644826
11 1.30886064 2.16324341
12 -9.95466411 1.30886064
13 -8.18221900 -9.95466411
14 -8.46419346 -8.18221900
15 -12.41345843 -8.46419346
16 -8.13734560 -12.41345843
17 -9.70406884 -8.13734560
18 -8.87274243 -9.70406884
19 -7.30609539 -8.87274243
20 -8.65981989 -7.30609539
21 -7.97479929 -8.65981989
22 -9.21028644 -7.97479929
23 -8.78370990 -9.21028644
24 -19.32678912 -8.78370990
25 -17.56723097 -19.32678912
26 -18.27816142 -17.56723097
27 -17.35153145 -18.27816142
28 -14.28478160 -17.35153145
29 -10.71312687 -14.28478160
30 -8.40032639 -10.71312687
31 -11.05812795 -8.40032639
32 -11.20081136 -11.05812795
33 -10.72036111 -11.20081136
34 -10.87193569 -10.72036111
35 -10.51113580 -10.87193569
36 -20.11812850 -10.51113580
37 -17.40698165 -20.11812850
38 -18.36552624 -17.40698165
39 -18.22367970 -18.36552624
40 -14.73167062 -18.22367970
41 -14.04667809 -14.73167062
42 -11.97497695 -14.04667809
43 -12.14927881 -11.97497695
44 -12.41136249 -12.14927881
45 -12.03851838 -12.41136249
46 -11.48585193 -12.03851838
47 -11.44820889 -11.48585193
48 -21.18062386 -11.44820889
49 -18.77634954 -21.18062386
50 -18.38468034 -18.77634954
51 -18.10394498 -18.38468034
52 -12.08637453 -18.10394498
53 -8.95992456 -12.08637453
54 -6.43549293 -8.95992456
55 -6.20506978 -6.43549293
56 -5.13837244 -6.20506978
57 -4.32770416 -5.13837244
58 -4.15859719 -4.32770416
59 -4.03821580 -4.15859719
60 -13.78319809 -4.03821580
61 -11.51799756 -13.78319809
62 -12.46003265 -11.51799756
63 -11.53699152 -12.46003265
64 -5.70832884 -11.53699152
65 0.32931998 -5.70832884
66 0.02385171 0.32931998
67 0.38971407 0.02385171
68 0.92954163 0.38971407
69 2.01605124 0.92954163
70 3.85031038 2.01605124
71 2.97436982 3.85031038
72 -7.01632771 2.97436982
73 -5.07769627 -7.01632771
74 -4.11015189 -5.07769627
75 -3.14670796 -4.11015189
76 1.33633707 -3.14670796
77 7.30279358 1.33633707
78 8.23647005 7.30279358
79 8.45411195 8.23647005
80 8.31976247 8.45411195
81 9.62112419 8.31976247
82 10.44061282 9.62112419
83 10.74388756 10.44061282
84 2.06457956 10.74388756
85 2.63226208 2.06457956
86 3.23711505 2.63226208
87 4.19636713 3.23711505
88 8.68385989 4.19636713
89 15.28777467 8.68385989
90 16.33148210 15.28777467
91 16.46546868 16.33148210
92 17.50726946 16.46546868
93 18.52775925 17.50726946
94 19.27250465 18.52775925
95 19.75415236 19.27250465
96 10.15332011 19.75415236
97 12.94005896 10.15332011
98 13.90111552 12.94005896
99 13.84719533 13.90111552
> 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/7uasg1195724101.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/88duf1195724101.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/9ngjj1195724101.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
> 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/10zze61195724101.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/11442p1195724102.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/120cwd1195724103.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/13kdwj1195724103.tab")
>
> system("convert tmp/122we1195724100.ps tmp/122we1195724100.png")
> system("convert tmp/2vymo1195724100.ps tmp/2vymo1195724100.png")
> system("convert tmp/3difb1195724100.ps tmp/3difb1195724100.png")
> system("convert tmp/4fuha1195724100.ps tmp/4fuha1195724100.png")
> system("convert tmp/5jcnj1195724100.ps tmp/5jcnj1195724100.png")
> system("convert tmp/6hch31195724101.ps tmp/6hch31195724101.png")
> system("convert tmp/7uasg1195724101.ps tmp/7uasg1195724101.png")
> system("convert tmp/88duf1195724101.ps tmp/88duf1195724101.png")
> system("convert tmp/9ngjj1195724101.ps tmp/9ngjj1195724101.png")
>
>
> proc.time()
user system elapsed
4.497 2.562 4.825