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(6282929
+ ,213118
+ ,1081
+ ,162556
+ ,4324047
+ ,81767
+ ,309
+ ,29790
+ ,4108272
+ ,153198
+ ,458
+ ,87550
+ ,-1212617
+ ,-26007
+ ,588
+ ,84738
+ ,1485329
+ ,126942
+ ,299
+ ,54660
+ ,1779876
+ ,157214
+ ,156
+ ,42634
+ ,1367203
+ ,129352
+ ,481
+ ,40949
+ ,2519076
+ ,234817
+ ,323
+ ,42312
+ ,912684
+ ,60448
+ ,452
+ ,37704
+ ,1443586
+ ,47818
+ ,109
+ ,16275
+ ,1220017
+ ,245546
+ ,115
+ ,25830
+ ,984885
+ ,48020
+ ,110
+ ,12679
+ ,1457425
+ ,-1710
+ ,239
+ ,18014
+ ,-572920
+ ,32648
+ ,247
+ ,43556
+ ,929144
+ ,95350
+ ,497
+ ,24524
+ ,1151176
+ ,151352
+ ,103
+ ,6532
+ ,790090
+ ,288170
+ ,109
+ ,7123
+ ,774497
+ ,114337
+ ,502
+ ,20813
+ ,990576
+ ,37884
+ ,248
+ ,37597
+ ,454195
+ ,122844
+ ,373
+ ,17821
+ ,876607
+ ,82340
+ ,119
+ ,12988
+ ,711969
+ ,79801
+ ,84
+ ,22330
+ ,702380
+ ,165548
+ ,102
+ ,13326
+ ,264449
+ ,116384
+ ,295
+ ,16189
+ ,450033
+ ,134028
+ ,105
+ ,7146
+ ,541063
+ ,63838
+ ,64
+ ,15824
+ ,588864
+ ,74996
+ ,267
+ ,26088
+ ,-37216
+ ,31080
+ ,129
+ ,11326
+ ,783310
+ ,32168
+ ,37
+ ,8568
+ ,467359
+ ,49857
+ ,361
+ ,14416
+ ,688779
+ ,87161
+ ,28
+ ,3369
+ ,608419
+ ,106113
+ ,85
+ ,11819
+ ,696348
+ ,80570
+ ,44
+ ,6620
+ ,597793
+ ,102129
+ ,49
+ ,4519
+ ,821730
+ ,301670
+ ,22
+ ,2220
+ ,377934
+ ,102313
+ ,155
+ ,18562
+ ,651939
+ ,88577
+ ,91
+ ,10327
+ ,697458
+ ,112477
+ ,81
+ ,5336
+ ,700368
+ ,191778
+ ,79
+ ,2365
+ ,225986
+ ,79804
+ ,145
+ ,4069
+ ,348695
+ ,128294
+ ,816
+ ,7710
+ ,373683
+ ,96448
+ ,61
+ ,13718
+ ,501709
+ ,93811
+ ,226
+ ,4525
+ ,413743
+ ,117520
+ ,105
+ ,6869
+ ,379825
+ ,69159
+ ,62
+ ,4628
+ ,336260
+ ,101792
+ ,24
+ ,3653
+ ,636765
+ ,210568
+ ,26
+ ,1265
+ ,481231
+ ,136996
+ ,322
+ ,7489
+ ,469107
+ ,121920
+ ,84
+ ,4901
+ ,211928
+ ,76403
+ ,33
+ ,2284)
+ ,dim=c(4
+ ,50)
+ ,dimnames=list(c('Wealth'
+ ,'Dividends'
+ ,'Trades'
+ ,'Costs')
+ ,1:50))
> y <- array(NA,dim=c(4,50),dimnames=list(c('Wealth','Dividends','Trades','Costs'),1:50))
> 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
Wealth Dividends Trades Costs
1 6282929 213118 1081 162556
2 4324047 81767 309 29790
3 4108272 153198 458 87550
4 -1212617 -26007 588 84738
5 1485329 126942 299 54660
6 1779876 157214 156 42634
7 1367203 129352 481 40949
8 2519076 234817 323 42312
9 912684 60448 452 37704
10 1443586 47818 109 16275
11 1220017 245546 115 25830
12 984885 48020 110 12679
13 1457425 -1710 239 18014
14 -572920 32648 247 43556
15 929144 95350 497 24524
16 1151176 151352 103 6532
17 790090 288170 109 7123
18 774497 114337 502 20813
19 990576 37884 248 37597
20 454195 122844 373 17821
21 876607 82340 119 12988
22 711969 79801 84 22330
23 702380 165548 102 13326
24 264449 116384 295 16189
25 450033 134028 105 7146
26 541063 63838 64 15824
27 588864 74996 267 26088
28 -37216 31080 129 11326
29 783310 32168 37 8568
30 467359 49857 361 14416
31 688779 87161 28 3369
32 608419 106113 85 11819
33 696348 80570 44 6620
34 597793 102129 49 4519
35 821730 301670 22 2220
36 377934 102313 155 18562
37 651939 88577 91 10327
38 697458 112477 81 5336
39 700368 191778 79 2365
40 225986 79804 145 4069
41 348695 128294 816 7710
42 373683 96448 61 13718
43 501709 93811 226 4525
44 413743 117520 105 6869
45 379825 69159 62 4628
46 336260 101792 24 3653
47 636765 210568 26 1265
48 481231 136996 322 7489
49 469107 121920 84 4901
50 211928 76403 33 2284
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Dividends Trades Costs
-2.162e+05 5.278e+00 -2.307e+02 2.830e+01
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-3121894 -273760 -69108 180356 3336813
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -2.162e+05 2.607e+05 -0.829 0.41119
Dividends 5.278e+00 1.794e+00 2.942 0.00509 **
Trades -2.307e+02 8.344e+02 -0.276 0.78340
Costs 2.830e+01 6.437e+00 4.397 6.43e-05 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 843200 on 46 degrees of freedom
Multiple R-squared: 0.5199, Adjusted R-squared: 0.4886
F-statistic: 16.6 on 3 and 46 DF, p-value: 1.893e-07
> 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,] 1.0000000 8.031600e-09 4.015800e-09
[2,] 1.0000000 5.455439e-11 2.727720e-11
[3,] 1.0000000 2.502350e-10 1.251175e-10
[4,] 1.0000000 4.973963e-11 2.486982e-11
[5,] 1.0000000 1.016444e-11 5.082220e-12
[6,] 1.0000000 2.136949e-11 1.068474e-11
[7,] 1.0000000 5.955642e-13 2.977821e-13
[8,] 1.0000000 8.543981e-17 4.271990e-17
[9,] 1.0000000 1.612871e-16 8.064356e-17
[10,] 1.0000000 3.352837e-17 1.676419e-17
[11,] 1.0000000 7.285144e-17 3.642572e-17
[12,] 1.0000000 2.656680e-16 1.328340e-16
[13,] 1.0000000 5.459536e-16 2.729768e-16
[14,] 1.0000000 3.313018e-15 1.656509e-15
[15,] 1.0000000 3.734301e-15 1.867150e-15
[16,] 1.0000000 1.893709e-14 9.468545e-15
[17,] 1.0000000 1.123192e-13 5.615962e-14
[18,] 1.0000000 3.232489e-13 1.616244e-13
[19,] 1.0000000 1.892198e-12 9.460991e-13
[20,] 1.0000000 1.224819e-11 6.124097e-12
[21,] 1.0000000 6.292362e-11 3.146181e-11
[22,] 1.0000000 2.184779e-11 1.092389e-11
[23,] 1.0000000 1.392781e-11 6.963907e-12
[24,] 1.0000000 8.249948e-11 4.124974e-11
[25,] 1.0000000 2.056484e-10 1.028242e-10
[26,] 1.0000000 1.181441e-09 5.907207e-10
[27,] 1.0000000 1.500012e-09 7.500062e-10
[28,] 1.0000000 6.209901e-09 3.104950e-09
[29,] 1.0000000 3.852171e-08 1.926086e-08
[30,] 0.9999999 1.801582e-07 9.007910e-08
[31,] 0.9999998 3.333244e-07 1.666622e-07
[32,] 0.9999999 1.308796e-07 6.543978e-08
[33,] 0.9999995 9.974432e-07 4.987216e-07
[34,] 0.9999967 6.529508e-06 3.264754e-06
[35,] 0.9999873 2.548958e-05 1.274479e-05
[36,] 0.9998395 3.210832e-04 1.605416e-04
[37,] 0.9992999 1.400292e-03 7.001460e-04
> postscript(file="/var/www/html/rcomp/tmp/137vi1293187793.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/rcomp/tmp/2vgul1293187793.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/rcomp/tmp/3vgul1293187793.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/rcomp/tmp/4vgul1293187793.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/rcomp/tmp/56pco1293187793.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 = 50
Frequency = 1
1 2 3 4 5
1.022669e+06 3.336813e+06 1.143537e+06 -3.121894e+06 -4.465787e+05
6 7 8 9 10
-4.416636e+03 -1.473589e+05 3.728223e+05 -1.530339e+05 9.719314e+05
11 12 13 14 15
-5.643425e+05 6.141768e+05 1.227958e+06 -1.704834e+06 6.263800e+04
16 17 18 19 20
4.074345e+05 -6.911442e+05 -8.603535e+04 -7.958317e+01 -3.963130e+05
21 22 23 24 25
3.180822e+05 -1.056467e+05 -3.088198e+05 -5.237643e+05 -2.191868e+05
26 27 28 29 30
-1.276424e+04 -2.675390e+05 -2.758331e+05 5.957887e+05 9.569632e+04
31 32 33 34 35
3.560723e+05 -5.034004e+04 3.101041e+05 1.583775e+05 -6.120550e+05
36 37 38 39 40
-4.354740e+05 1.293521e+05 1.876819e+05 -1.443422e+05 -6.071011e+04
41 42 43 44 45
-1.421951e+05 -2.933490e+05 1.468616e+05 -1.605044e+05 1.143448e+05
46 47 48 49 50
-8.263283e+04 -2.882146e+05 -1.633007e+05 -7.750648e+04 -3.213256e+04
> postscript(file="/var/www/html/rcomp/tmp/66pco1293187793.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 = 50
Frequency = 1
lag(myerror, k = 1) myerror
0 1.022669e+06 NA
1 3.336813e+06 1.022669e+06
2 1.143537e+06 3.336813e+06
3 -3.121894e+06 1.143537e+06
4 -4.465787e+05 -3.121894e+06
5 -4.416636e+03 -4.465787e+05
6 -1.473589e+05 -4.416636e+03
7 3.728223e+05 -1.473589e+05
8 -1.530339e+05 3.728223e+05
9 9.719314e+05 -1.530339e+05
10 -5.643425e+05 9.719314e+05
11 6.141768e+05 -5.643425e+05
12 1.227958e+06 6.141768e+05
13 -1.704834e+06 1.227958e+06
14 6.263800e+04 -1.704834e+06
15 4.074345e+05 6.263800e+04
16 -6.911442e+05 4.074345e+05
17 -8.603535e+04 -6.911442e+05
18 -7.958317e+01 -8.603535e+04
19 -3.963130e+05 -7.958317e+01
20 3.180822e+05 -3.963130e+05
21 -1.056467e+05 3.180822e+05
22 -3.088198e+05 -1.056467e+05
23 -5.237643e+05 -3.088198e+05
24 -2.191868e+05 -5.237643e+05
25 -1.276424e+04 -2.191868e+05
26 -2.675390e+05 -1.276424e+04
27 -2.758331e+05 -2.675390e+05
28 5.957887e+05 -2.758331e+05
29 9.569632e+04 5.957887e+05
30 3.560723e+05 9.569632e+04
31 -5.034004e+04 3.560723e+05
32 3.101041e+05 -5.034004e+04
33 1.583775e+05 3.101041e+05
34 -6.120550e+05 1.583775e+05
35 -4.354740e+05 -6.120550e+05
36 1.293521e+05 -4.354740e+05
37 1.876819e+05 1.293521e+05
38 -1.443422e+05 1.876819e+05
39 -6.071011e+04 -1.443422e+05
40 -1.421951e+05 -6.071011e+04
41 -2.933490e+05 -1.421951e+05
42 1.468616e+05 -2.933490e+05
43 -1.605044e+05 1.468616e+05
44 1.143448e+05 -1.605044e+05
45 -8.263283e+04 1.143448e+05
46 -2.882146e+05 -8.263283e+04
47 -1.633007e+05 -2.882146e+05
48 -7.750648e+04 -1.633007e+05
49 -3.213256e+04 -7.750648e+04
50 NA -3.213256e+04
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 3.336813e+06 1.022669e+06
[2,] 1.143537e+06 3.336813e+06
[3,] -3.121894e+06 1.143537e+06
[4,] -4.465787e+05 -3.121894e+06
[5,] -4.416636e+03 -4.465787e+05
[6,] -1.473589e+05 -4.416636e+03
[7,] 3.728223e+05 -1.473589e+05
[8,] -1.530339e+05 3.728223e+05
[9,] 9.719314e+05 -1.530339e+05
[10,] -5.643425e+05 9.719314e+05
[11,] 6.141768e+05 -5.643425e+05
[12,] 1.227958e+06 6.141768e+05
[13,] -1.704834e+06 1.227958e+06
[14,] 6.263800e+04 -1.704834e+06
[15,] 4.074345e+05 6.263800e+04
[16,] -6.911442e+05 4.074345e+05
[17,] -8.603535e+04 -6.911442e+05
[18,] -7.958317e+01 -8.603535e+04
[19,] -3.963130e+05 -7.958317e+01
[20,] 3.180822e+05 -3.963130e+05
[21,] -1.056467e+05 3.180822e+05
[22,] -3.088198e+05 -1.056467e+05
[23,] -5.237643e+05 -3.088198e+05
[24,] -2.191868e+05 -5.237643e+05
[25,] -1.276424e+04 -2.191868e+05
[26,] -2.675390e+05 -1.276424e+04
[27,] -2.758331e+05 -2.675390e+05
[28,] 5.957887e+05 -2.758331e+05
[29,] 9.569632e+04 5.957887e+05
[30,] 3.560723e+05 9.569632e+04
[31,] -5.034004e+04 3.560723e+05
[32,] 3.101041e+05 -5.034004e+04
[33,] 1.583775e+05 3.101041e+05
[34,] -6.120550e+05 1.583775e+05
[35,] -4.354740e+05 -6.120550e+05
[36,] 1.293521e+05 -4.354740e+05
[37,] 1.876819e+05 1.293521e+05
[38,] -1.443422e+05 1.876819e+05
[39,] -6.071011e+04 -1.443422e+05
[40,] -1.421951e+05 -6.071011e+04
[41,] -2.933490e+05 -1.421951e+05
[42,] 1.468616e+05 -2.933490e+05
[43,] -1.605044e+05 1.468616e+05
[44,] 1.143448e+05 -1.605044e+05
[45,] -8.263283e+04 1.143448e+05
[46,] -2.882146e+05 -8.263283e+04
[47,] -1.633007e+05 -2.882146e+05
[48,] -7.750648e+04 -1.633007e+05
[49,] -3.213256e+04 -7.750648e+04
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 3.336813e+06 1.022669e+06
2 1.143537e+06 3.336813e+06
3 -3.121894e+06 1.143537e+06
4 -4.465787e+05 -3.121894e+06
5 -4.416636e+03 -4.465787e+05
6 -1.473589e+05 -4.416636e+03
7 3.728223e+05 -1.473589e+05
8 -1.530339e+05 3.728223e+05
9 9.719314e+05 -1.530339e+05
10 -5.643425e+05 9.719314e+05
11 6.141768e+05 -5.643425e+05
12 1.227958e+06 6.141768e+05
13 -1.704834e+06 1.227958e+06
14 6.263800e+04 -1.704834e+06
15 4.074345e+05 6.263800e+04
16 -6.911442e+05 4.074345e+05
17 -8.603535e+04 -6.911442e+05
18 -7.958317e+01 -8.603535e+04
19 -3.963130e+05 -7.958317e+01
20 3.180822e+05 -3.963130e+05
21 -1.056467e+05 3.180822e+05
22 -3.088198e+05 -1.056467e+05
23 -5.237643e+05 -3.088198e+05
24 -2.191868e+05 -5.237643e+05
25 -1.276424e+04 -2.191868e+05
26 -2.675390e+05 -1.276424e+04
27 -2.758331e+05 -2.675390e+05
28 5.957887e+05 -2.758331e+05
29 9.569632e+04 5.957887e+05
30 3.560723e+05 9.569632e+04
31 -5.034004e+04 3.560723e+05
32 3.101041e+05 -5.034004e+04
33 1.583775e+05 3.101041e+05
34 -6.120550e+05 1.583775e+05
35 -4.354740e+05 -6.120550e+05
36 1.293521e+05 -4.354740e+05
37 1.876819e+05 1.293521e+05
38 -1.443422e+05 1.876819e+05
39 -6.071011e+04 -1.443422e+05
40 -1.421951e+05 -6.071011e+04
41 -2.933490e+05 -1.421951e+05
42 1.468616e+05 -2.933490e+05
43 -1.605044e+05 1.468616e+05
44 1.143448e+05 -1.605044e+05
45 -8.263283e+04 1.143448e+05
46 -2.882146e+05 -8.263283e+04
47 -1.633007e+05 -2.882146e+05
48 -7.750648e+04 -1.633007e+05
49 -3.213256e+04 -7.750648e+04
> 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/7hyb91293187793.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/rcomp/tmp/8hyb91293187793.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/rcomp/tmp/9rqac1293187793.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/rcomp/tmp/10rqac1293187793.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/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/11v8901293187793.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/12gq7n1293187793.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/13cinw1293187793.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/14g1m21293187793.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/15jkkq1293187793.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/16xt0z1293187793.tab")
+ }
>
> try(system("convert tmp/137vi1293187793.ps tmp/137vi1293187793.png",intern=TRUE))
character(0)
> try(system("convert tmp/2vgul1293187793.ps tmp/2vgul1293187793.png",intern=TRUE))
character(0)
> try(system("convert tmp/3vgul1293187793.ps tmp/3vgul1293187793.png",intern=TRUE))
character(0)
> try(system("convert tmp/4vgul1293187793.ps tmp/4vgul1293187793.png",intern=TRUE))
character(0)
> try(system("convert tmp/56pco1293187793.ps tmp/56pco1293187793.png",intern=TRUE))
character(0)
> try(system("convert tmp/66pco1293187793.ps tmp/66pco1293187793.png",intern=TRUE))
character(0)
> try(system("convert tmp/7hyb91293187793.ps tmp/7hyb91293187793.png",intern=TRUE))
character(0)
> try(system("convert tmp/8hyb91293187793.ps tmp/8hyb91293187793.png",intern=TRUE))
character(0)
> try(system("convert tmp/9rqac1293187793.ps tmp/9rqac1293187793.png",intern=TRUE))
character(0)
> try(system("convert tmp/10rqac1293187793.ps tmp/10rqac1293187793.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.436 1.641 5.782