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.
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(1
+ ,162556
+ ,1081
+ ,213118
+ ,6282929
+ ,1
+ ,29790
+ ,309
+ ,81767
+ ,4324047
+ ,1
+ ,87550
+ ,458
+ ,153198
+ ,4108272
+ ,0
+ ,84738
+ ,588
+ ,-26007
+ ,-1212617
+ ,1
+ ,54660
+ ,299
+ ,126942
+ ,1485329
+ ,1
+ ,42634
+ ,156
+ ,157214
+ ,1779876
+ ,0
+ ,40949
+ ,481
+ ,129352
+ ,1367203
+ ,1
+ ,42312
+ ,323
+ ,234817
+ ,2519076
+ ,1
+ ,37704
+ ,452
+ ,60448
+ ,912684
+ ,1
+ ,16275
+ ,109
+ ,47818
+ ,1443586
+ ,0
+ ,25830
+ ,115
+ ,245546
+ ,1220017
+ ,0
+ ,12679
+ ,110
+ ,48020
+ ,984885
+ ,1
+ ,18014
+ ,239
+ ,-1710
+ ,1457425
+ ,0
+ ,43556
+ ,247
+ ,32648
+ ,-572920
+ ,1
+ ,24524
+ ,497
+ ,95350
+ ,929144
+ ,0
+ ,6532
+ ,103
+ ,151352
+ ,1151176
+ ,0
+ ,7123
+ ,109
+ ,288170
+ ,790090
+ ,1
+ ,20813
+ ,502
+ ,114337
+ ,774497
+ ,1
+ ,37597
+ ,248
+ ,37884
+ ,990576
+ ,0
+ ,17821
+ ,373
+ ,122844
+ ,454195
+ ,1
+ ,12988
+ ,119
+ ,82340
+ ,876607
+ ,1
+ ,22330
+ ,84
+ ,79801
+ ,711969
+ ,0
+ ,13326
+ ,102
+ ,165548
+ ,702380
+ ,0
+ ,16189
+ ,295
+ ,116384
+ ,264449
+ ,0
+ ,7146
+ ,105
+ ,134028
+ ,450033
+ ,0
+ ,15824
+ ,64
+ ,63838
+ ,541063
+ ,1
+ ,26088
+ ,267
+ ,74996
+ ,588864
+ ,0
+ ,11326
+ ,129
+ ,31080
+ ,-37216
+ ,0
+ ,8568
+ ,37
+ ,32168
+ ,783310
+ ,0
+ ,14416
+ ,361
+ ,49857
+ ,467359
+ ,1
+ ,3369
+ ,28
+ ,87161
+ ,688779
+ ,1
+ ,11819
+ ,85
+ ,106113
+ ,608419
+ ,1
+ ,6620
+ ,44
+ ,80570
+ ,696348
+ ,1
+ ,4519
+ ,49
+ ,102129
+ ,597793
+ ,0
+ ,2220
+ ,22
+ ,301670
+ ,821730
+ ,0
+ ,18562
+ ,155
+ ,102313
+ ,377934
+ ,0
+ ,10327
+ ,91
+ ,88577
+ ,651939
+ ,1
+ ,5336
+ ,81
+ ,112477
+ ,697458
+ ,1
+ ,2365
+ ,79
+ ,191778
+ ,700368
+ ,0
+ ,4069
+ ,145
+ ,79804
+ ,225986
+ ,0
+ ,7710
+ ,816
+ ,128294
+ ,348695
+ ,0
+ ,13718
+ ,61
+ ,96448
+ ,373683
+ ,0
+ ,4525
+ ,226
+ ,93811
+ ,501709
+ ,0
+ ,6869
+ ,105
+ ,117520
+ ,413743
+ ,0
+ ,4628
+ ,62
+ ,69159
+ ,379825
+ ,1
+ ,3653
+ ,24
+ ,101792
+ ,336260
+ ,1
+ ,1265
+ ,26
+ ,210568
+ ,636765
+ ,1
+ ,7489
+ ,322
+ ,136996
+ ,481231
+ ,0
+ ,4901
+ ,84
+ ,121920
+ ,469107)
+ ,dim=c(5
+ ,49)
+ ,dimnames=list(c('Group'
+ ,'Costs'
+ ,'Trades'
+ ,'Dividends'
+ ,'Wealth')
+ ,1:49))
> y <- array(NA,dim=c(5,49),dimnames=list(c('Group','Costs','Trades','Dividends','Wealth'),1:49))
> 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
Group Costs Trades Dividends Wealth
1 1 162556 1081 213118 6282929
2 1 29790 309 81767 4324047
3 1 87550 458 153198 4108272
4 0 84738 588 -26007 -1212617
5 1 54660 299 126942 1485329
6 1 42634 156 157214 1779876
7 0 40949 481 129352 1367203
8 1 42312 323 234817 2519076
9 1 37704 452 60448 912684
10 1 16275 109 47818 1443586
11 0 25830 115 245546 1220017
12 0 12679 110 48020 984885
13 1 18014 239 -1710 1457425
14 0 43556 247 32648 -572920
15 1 24524 497 95350 929144
16 0 6532 103 151352 1151176
17 0 7123 109 288170 790090
18 1 20813 502 114337 774497
19 1 37597 248 37884 990576
20 0 17821 373 122844 454195
21 1 12988 119 82340 876607
22 1 22330 84 79801 711969
23 0 13326 102 165548 702380
24 0 16189 295 116384 264449
25 0 7146 105 134028 450033
26 0 15824 64 63838 541063
27 1 26088 267 74996 588864
28 0 11326 129 31080 -37216
29 0 8568 37 32168 783310
30 0 14416 361 49857 467359
31 1 3369 28 87161 688779
32 1 11819 85 106113 608419
33 1 6620 44 80570 696348
34 1 4519 49 102129 597793
35 0 2220 22 301670 821730
36 0 18562 155 102313 377934
37 0 10327 91 88577 651939
38 1 5336 81 112477 697458
39 1 2365 79 191778 700368
40 0 4069 145 79804 225986
41 0 7710 816 128294 348695
42 0 13718 61 96448 373683
43 0 4525 226 93811 501709
44 0 6869 105 117520 413743
45 0 4628 62 69159 379825
46 1 3653 24 101792 336260
47 1 1265 26 210568 636765
48 1 7489 322 136996 481231
49 0 4901 84 121920 469107
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Costs Trades Dividends Wealth
4.872e-01 -9.879e-07 -2.344e-04 -1.308e-06 2.343e-07
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.6168 -0.3990 -0.2094 0.4753 0.6621
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.872e-01 1.490e-01 3.269 0.00210 **
Costs -9.879e-07 4.285e-06 -0.231 0.81875
Trades -2.344e-04 4.679e-04 -0.501 0.61889
Dividends -1.308e-06 1.095e-06 -1.195 0.23851
Wealth 2.343e-07 8.236e-08 2.844 0.00673 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.471 on 44 degrees of freedom
Multiple R-squared: 0.2027, Adjusted R-squared: 0.1302
F-statistic: 2.797 on 4 and 44 DF, p-value: 0.03739
> 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.1384740 0.2769480 0.8615260
[2,] 0.4019897 0.8039795 0.5980103
[3,] 0.2621998 0.5243996 0.7378002
[4,] 0.4216400 0.8432800 0.5783600
[5,] 0.5854725 0.8290550 0.4145275
[6,] 0.4987975 0.9975950 0.5012025
[7,] 0.4330139 0.8660278 0.5669861
[8,] 0.4191558 0.8383116 0.5808442
[9,] 0.5321515 0.9356971 0.4678485
[10,] 0.4703247 0.9406494 0.5296753
[11,] 0.4451681 0.8903361 0.5548319
[12,] 0.4011270 0.8022541 0.5988730
[13,] 0.3779114 0.7558227 0.6220886
[14,] 0.3422075 0.6844150 0.6577925
[15,] 0.3412394 0.6824787 0.6587606
[16,] 0.3267721 0.6535441 0.6732279
[17,] 0.2758978 0.5517956 0.7241022
[18,] 0.2438076 0.4876151 0.7561924
[19,] 0.2451464 0.4902928 0.7548536
[20,] 0.3250040 0.6500081 0.6749960
[21,] 0.2825761 0.5651522 0.7174239
[22,] 0.4018787 0.8037574 0.5981213
[23,] 0.3734450 0.7468899 0.6265550
[24,] 0.3328523 0.6657045 0.6671477
[25,] 0.3667848 0.7335695 0.6332152
[26,] 0.3227515 0.6455030 0.6772485
[27,] 0.3103262 0.6206524 0.6896738
[28,] 0.5866521 0.8266957 0.4133479
[29,] 0.4946694 0.9893389 0.5053306
[30,] 0.4390261 0.8780523 0.5609739
[31,] 0.4779726 0.9559453 0.5220274
[32,] 0.3869652 0.7739304 0.6130348
[33,] 0.3189719 0.6379439 0.6810281
[34,] 0.5345276 0.9309449 0.4654724
> postscript(file="/var/www/html/freestat/rcomp/tmp/1hq811291384473.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/2hq811291384473.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/3sh741291384473.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/4sh741291384473.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/5sh741291384473.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 49
Frequency = 1
1 2 3 4 5 6
-0.26642204 -0.29142629 -0.05545204 -0.01559343 0.45494316 0.38013475
7 8 9 10 11 12
-0.48511547 0.34728982 0.52123595 0.27876809 -0.39937087 -0.61682176
13 14 15 16 17 18
0.24293037 -0.20935132 0.56056009 -0.52833076 -0.26278124 0.61913233
19 20 21 22 23 24
0.42555032 -0.32789290 0.45585252 0.49212802 -0.39814057 -0.31178448
25 26 27 28 29 30
-0.38565274 -0.49982797 0.56129080 -0.39640619 -0.61150432 -0.43262400
31 32 33 34 35 36
0.47532995 0.54065526 0.47189744 0.52228335 -0.27777141 -0.38724820
37 38 39 40 41 42
-0.49254610 0.52077737 0.62042111 -0.39775474 -0.20219932 -0.42074267
43 44 45 46 47 48
-0.42459257 -0.39901764 -0.46662275 0.57639885 0.64639049 0.66212317
49
-0.41309941
> postscript(file="/var/www/html/freestat/rcomp/tmp/6k8661291384473.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 49
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.26642204 NA
1 -0.29142629 -0.26642204
2 -0.05545204 -0.29142629
3 -0.01559343 -0.05545204
4 0.45494316 -0.01559343
5 0.38013475 0.45494316
6 -0.48511547 0.38013475
7 0.34728982 -0.48511547
8 0.52123595 0.34728982
9 0.27876809 0.52123595
10 -0.39937087 0.27876809
11 -0.61682176 -0.39937087
12 0.24293037 -0.61682176
13 -0.20935132 0.24293037
14 0.56056009 -0.20935132
15 -0.52833076 0.56056009
16 -0.26278124 -0.52833076
17 0.61913233 -0.26278124
18 0.42555032 0.61913233
19 -0.32789290 0.42555032
20 0.45585252 -0.32789290
21 0.49212802 0.45585252
22 -0.39814057 0.49212802
23 -0.31178448 -0.39814057
24 -0.38565274 -0.31178448
25 -0.49982797 -0.38565274
26 0.56129080 -0.49982797
27 -0.39640619 0.56129080
28 -0.61150432 -0.39640619
29 -0.43262400 -0.61150432
30 0.47532995 -0.43262400
31 0.54065526 0.47532995
32 0.47189744 0.54065526
33 0.52228335 0.47189744
34 -0.27777141 0.52228335
35 -0.38724820 -0.27777141
36 -0.49254610 -0.38724820
37 0.52077737 -0.49254610
38 0.62042111 0.52077737
39 -0.39775474 0.62042111
40 -0.20219932 -0.39775474
41 -0.42074267 -0.20219932
42 -0.42459257 -0.42074267
43 -0.39901764 -0.42459257
44 -0.46662275 -0.39901764
45 0.57639885 -0.46662275
46 0.64639049 0.57639885
47 0.66212317 0.64639049
48 -0.41309941 0.66212317
49 NA -0.41309941
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.29142629 -0.26642204
[2,] -0.05545204 -0.29142629
[3,] -0.01559343 -0.05545204
[4,] 0.45494316 -0.01559343
[5,] 0.38013475 0.45494316
[6,] -0.48511547 0.38013475
[7,] 0.34728982 -0.48511547
[8,] 0.52123595 0.34728982
[9,] 0.27876809 0.52123595
[10,] -0.39937087 0.27876809
[11,] -0.61682176 -0.39937087
[12,] 0.24293037 -0.61682176
[13,] -0.20935132 0.24293037
[14,] 0.56056009 -0.20935132
[15,] -0.52833076 0.56056009
[16,] -0.26278124 -0.52833076
[17,] 0.61913233 -0.26278124
[18,] 0.42555032 0.61913233
[19,] -0.32789290 0.42555032
[20,] 0.45585252 -0.32789290
[21,] 0.49212802 0.45585252
[22,] -0.39814057 0.49212802
[23,] -0.31178448 -0.39814057
[24,] -0.38565274 -0.31178448
[25,] -0.49982797 -0.38565274
[26,] 0.56129080 -0.49982797
[27,] -0.39640619 0.56129080
[28,] -0.61150432 -0.39640619
[29,] -0.43262400 -0.61150432
[30,] 0.47532995 -0.43262400
[31,] 0.54065526 0.47532995
[32,] 0.47189744 0.54065526
[33,] 0.52228335 0.47189744
[34,] -0.27777141 0.52228335
[35,] -0.38724820 -0.27777141
[36,] -0.49254610 -0.38724820
[37,] 0.52077737 -0.49254610
[38,] 0.62042111 0.52077737
[39,] -0.39775474 0.62042111
[40,] -0.20219932 -0.39775474
[41,] -0.42074267 -0.20219932
[42,] -0.42459257 -0.42074267
[43,] -0.39901764 -0.42459257
[44,] -0.46662275 -0.39901764
[45,] 0.57639885 -0.46662275
[46,] 0.64639049 0.57639885
[47,] 0.66212317 0.64639049
[48,] -0.41309941 0.66212317
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.29142629 -0.26642204
2 -0.05545204 -0.29142629
3 -0.01559343 -0.05545204
4 0.45494316 -0.01559343
5 0.38013475 0.45494316
6 -0.48511547 0.38013475
7 0.34728982 -0.48511547
8 0.52123595 0.34728982
9 0.27876809 0.52123595
10 -0.39937087 0.27876809
11 -0.61682176 -0.39937087
12 0.24293037 -0.61682176
13 -0.20935132 0.24293037
14 0.56056009 -0.20935132
15 -0.52833076 0.56056009
16 -0.26278124 -0.52833076
17 0.61913233 -0.26278124
18 0.42555032 0.61913233
19 -0.32789290 0.42555032
20 0.45585252 -0.32789290
21 0.49212802 0.45585252
22 -0.39814057 0.49212802
23 -0.31178448 -0.39814057
24 -0.38565274 -0.31178448
25 -0.49982797 -0.38565274
26 0.56129080 -0.49982797
27 -0.39640619 0.56129080
28 -0.61150432 -0.39640619
29 -0.43262400 -0.61150432
30 0.47532995 -0.43262400
31 0.54065526 0.47532995
32 0.47189744 0.54065526
33 0.52228335 0.47189744
34 -0.27777141 0.52228335
35 -0.38724820 -0.27777141
36 -0.49254610 -0.38724820
37 0.52077737 -0.49254610
38 0.62042111 0.52077737
39 -0.39775474 0.62042111
40 -0.20219932 -0.39775474
41 -0.42074267 -0.20219932
42 -0.42459257 -0.42074267
43 -0.39901764 -0.42459257
44 -0.46662275 -0.39901764
45 0.57639885 -0.46662275
46 0.64639049 0.57639885
47 0.66212317 0.64639049
48 -0.41309941 0.66212317
> 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/freestat/rcomp/tmp/7vzos1291384473.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/8vzos1291384473.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/9vzos1291384473.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/www/html/freestat/rcomp/tmp/10695c1291384473.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/11r93i1291384473.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/freestat/rcomp/tmp/12csk61291384473.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/freestat/rcomp/tmp/139jzx1291384473.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/freestat/rcomp/tmp/14ckgl1291384473.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/freestat/rcomp/tmp/15qvz41291384474.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/freestat/rcomp/tmp/16bdg91291384474.tab")
+ }
>
> try(system("convert tmp/1hq811291384473.ps tmp/1hq811291384473.png",intern=TRUE))
character(0)
> try(system("convert tmp/2hq811291384473.ps tmp/2hq811291384473.png",intern=TRUE))
character(0)
> try(system("convert tmp/3sh741291384473.ps tmp/3sh741291384473.png",intern=TRUE))
character(0)
> try(system("convert tmp/4sh741291384473.ps tmp/4sh741291384473.png",intern=TRUE))
character(0)
> try(system("convert tmp/5sh741291384473.ps tmp/5sh741291384473.png",intern=TRUE))
character(0)
> try(system("convert tmp/6k8661291384473.ps tmp/6k8661291384473.png",intern=TRUE))
character(0)
> try(system("convert tmp/7vzos1291384473.ps tmp/7vzos1291384473.png",intern=TRUE))
character(0)
> try(system("convert tmp/8vzos1291384473.ps tmp/8vzos1291384473.png",intern=TRUE))
character(0)
> try(system("convert tmp/9vzos1291384473.ps tmp/9vzos1291384473.png",intern=TRUE))
character(0)
> try(system("convert tmp/10695c1291384473.ps tmp/10695c1291384473.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.728 2.455 4.083