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(7.6
+ ,2.16
+ ,7.6
+ ,2.23
+ ,7.8
+ ,2.40
+ ,8.0
+ ,2.84
+ ,8.0
+ ,2.77
+ ,8.0
+ ,2.93
+ ,7.9
+ ,2.91
+ ,7.9
+ ,2.69
+ ,8.0
+ ,2.38
+ ,8.5
+ ,2.58
+ ,9.2
+ ,3.19
+ ,9.4
+ ,2.82
+ ,9.5
+ ,2.72
+ ,9.5
+ ,2.53
+ ,9.6
+ ,2.70
+ ,9.7
+ ,2.42
+ ,9.7
+ ,2.50
+ ,9.6
+ ,2.31
+ ,9.5
+ ,2.41
+ ,9.4
+ ,2.56
+ ,9.3
+ ,2.76
+ ,9.6
+ ,2.71
+ ,10.2
+ ,2.44
+ ,10.2
+ ,2.46
+ ,10.1
+ ,2.12
+ ,9.9
+ ,1.99
+ ,9.8
+ ,1.86
+ ,9.8
+ ,1.88
+ ,9.7
+ ,1.82
+ ,9.5
+ ,1.74
+ ,9.3
+ ,1.71
+ ,9.1
+ ,1.38
+ ,9.0
+ ,1.27
+ ,9.5
+ ,1.19
+ ,10.0
+ ,1.28
+ ,10.2
+ ,1.19
+ ,10.1
+ ,1.22
+ ,10.0
+ ,1.47
+ ,9.9
+ ,1.46
+ ,10.0
+ ,1.96
+ ,9.9
+ ,1.88
+ ,9.7
+ ,2.03
+ ,9.5
+ ,2.04
+ ,9.2
+ ,1.90
+ ,9.0
+ ,1.80
+ ,9.3
+ ,1.92
+ ,9.8
+ ,1.92
+ ,9.8
+ ,1.97
+ ,9.6
+ ,2.46
+ ,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ric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Include Monthly Dummies'
> par1 = '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11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
161 8.7 2.38 0 0 0 0 1 0 0 0 0 0 0
162 8.6 1.69 0 0 0 0 0 1 0 0 0 0 0
163 8.5 1.96 0 0 0 0 0 0 1 0 0 0 0
164 8.3 2.19 0 0 0 0 0 0 0 1 0 0 0
165 8.0 1.87 0 0 0 0 0 0 0 0 1 0 0
166 8.2 1.60 0 0 0 0 0 0 0 0 0 1 0
167 8.1 1.63 0 0 0 0 0 0 0 0 0 0 1
168 8.1 1.22 0 0 0 0 0 0 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X M1 M2 M3 M4
9.70562 -0.44104 -0.09853 -0.25609 -0.23708 -0.19370
M5 M6 M7 M8 M9 M10
-0.27658 -0.44275 -0.60935 -0.78730 -0.89769 -0.40893
M11
-0.03519
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-2.3367 -0.7819 0.1439 0.7911 1.7093
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.70562 0.34832 27.864 < 2e-16 ***
X -0.44104 0.11451 -3.852 0.000171 ***
M1 -0.09853 0.37943 -0.260 0.795448
M2 -0.25609 0.37942 -0.675 0.500699
M3 -0.23708 0.37942 -0.625 0.532987
M4 -0.19370 0.37941 -0.511 0.610410
M5 -0.27658 0.37942 -0.729 0.467128
M6 -0.44275 0.37941 -1.167 0.245026
M7 -0.60935 0.37944 -1.606 0.110326
M8 -0.78730 0.37944 -2.075 0.039652 *
M9 -0.89769 0.37942 -2.366 0.019219 *
M10 -0.40893 0.37941 -1.078 0.282797
M11 -0.03519 0.37943 -0.093 0.926219
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.004 on 155 degrees of freedom
Multiple R-squared: 0.1513, Adjusted R-squared: 0.08557
F-statistic: 2.302 on 12 and 155 DF, p-value: 0.00997
> 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.812618092 3.747638e-01 1.873819e-01
[2,] 0.866420672 2.671587e-01 1.335793e-01
[3,] 0.888143848 2.237123e-01 1.118562e-01
[4,] 0.876710185 2.465796e-01 1.232898e-01
[5,] 0.868179840 2.636403e-01 1.318202e-01
[6,] 0.868848232 2.623035e-01 1.311518e-01
[7,] 0.851524081 2.969518e-01 1.484759e-01
[8,] 0.820917845 3.581643e-01 1.790822e-01
[9,] 0.786126522 4.277470e-01 2.138735e-01
[10,] 0.796110471 4.077791e-01 2.038895e-01
[11,] 0.780313370 4.393733e-01 2.196866e-01
[12,] 0.732646088 5.347078e-01 2.673539e-01
[13,] 0.678173195 6.436536e-01 3.218268e-01
[14,] 0.620867824 7.582644e-01 3.791322e-01
[15,] 0.564495023 8.710100e-01 4.355050e-01
[16,] 0.511174314 9.776514e-01 4.888257e-01
[17,] 0.471384690 9.427694e-01 5.286153e-01
[18,] 0.431250428 8.625009e-01 5.687496e-01
[19,] 0.385338725 7.706775e-01 6.146613e-01
[20,] 0.350786529 7.015731e-01 6.492135e-01
[21,] 0.310709954 6.214199e-01 6.892900e-01
[22,] 0.273779795 5.475596e-01 7.262202e-01
[23,] 0.250616510 5.012330e-01 7.493835e-01
[24,] 0.219440213 4.388804e-01 7.805598e-01
[25,] 0.209960454 4.199209e-01 7.900395e-01
[26,] 0.196408405 3.928168e-01 8.035916e-01
[27,] 0.187402693 3.748054e-01 8.125973e-01
[28,] 0.177363802 3.547276e-01 8.226362e-01
[29,] 0.159105527 3.182111e-01 8.408945e-01
[30,] 0.138669430 2.773389e-01 8.613306e-01
[31,] 0.118310033 2.366201e-01 8.816900e-01
[32,] 0.105958207 2.119164e-01 8.940418e-01
[33,] 0.095305170 1.906103e-01 9.046948e-01
[34,] 0.093922620 1.878452e-01 9.060774e-01
[35,] 0.087966805 1.759336e-01 9.120332e-01
[36,] 0.082326916 1.646538e-01 9.176731e-01
[37,] 0.072503401 1.450068e-01 9.274966e-01
[38,] 0.063336091 1.266722e-01 9.366639e-01
[39,] 0.058195119 1.163902e-01 9.418049e-01
[40,] 0.055739940 1.114799e-01 9.442601e-01
[41,] 0.048804420 9.760884e-02 9.511956e-01
[42,] 0.042493497 8.498699e-02 9.575065e-01
[43,] 0.036535689 7.307138e-02 9.634643e-01
[44,] 0.034728875 6.945775e-02 9.652711e-01
[45,] 0.032999032 6.599806e-02 9.670010e-01
[46,] 0.027718798 5.543760e-02 9.722812e-01
[47,] 0.023750830 4.750166e-02 9.762492e-01
[48,] 0.020165040 4.033008e-02 9.798350e-01
[49,] 0.017921221 3.584244e-02 9.820788e-01
[50,] 0.015173985 3.034797e-02 9.848260e-01
[51,] 0.012774864 2.554973e-02 9.872251e-01
[52,] 0.011838411 2.367682e-02 9.881616e-01
[53,] 0.012089716 2.417943e-02 9.879103e-01
[54,] 0.011837386 2.367477e-02 9.881626e-01
[55,] 0.010101246 2.020249e-02 9.898988e-01
[56,] 0.009538099 1.907620e-02 9.904619e-01
[57,] 0.009455378 1.891076e-02 9.905446e-01
[58,] 0.008196228 1.639246e-02 9.918038e-01
[59,] 0.007117965 1.423593e-02 9.928820e-01
[60,] 0.006225540 1.245108e-02 9.937745e-01
[61,] 0.005438900 1.087780e-02 9.945611e-01
[62,] 0.004844043 9.688086e-03 9.951560e-01
[63,] 0.004413319 8.826638e-03 9.955867e-01
[64,] 0.004141939 8.283878e-03 9.958581e-01
[65,] 0.003986404 7.972809e-03 9.960136e-01
[66,] 0.003993443 7.986887e-03 9.960066e-01
[67,] 0.004061896 8.123792e-03 9.959381e-01
[68,] 0.005405568 1.081114e-02 9.945944e-01
[69,] 0.009452032 1.890406e-02 9.905480e-01
[70,] 0.013243899 2.648780e-02 9.867561e-01
[71,] 0.019627035 3.925407e-02 9.803730e-01
[72,] 0.028691669 5.738334e-02 9.713083e-01
[73,] 0.050585971 1.011719e-01 9.494140e-01
[74,] 0.096303693 1.926074e-01 9.036963e-01
[75,] 0.184729364 3.694587e-01 8.152706e-01
[76,] 0.289951976 5.799040e-01 7.100480e-01
[77,] 0.423405568 8.468111e-01 5.765944e-01
[78,] 0.529333190 9.413336e-01 4.706668e-01
[79,] 0.611955943 7.760881e-01 3.880441e-01
[80,] 0.664334563 6.713309e-01 3.356654e-01
[81,] 0.718231203 5.635376e-01 2.817688e-01
[82,] 0.763689039 4.726219e-01 2.363110e-01
[83,] 0.804267004 3.914660e-01 1.957330e-01
[84,] 0.878488117 2.430238e-01 1.215119e-01
[85,] 0.957932958 8.413408e-02 4.206704e-02
[86,] 0.991075697 1.784861e-02 8.924303e-03
[87,] 0.998308032 3.383936e-03 1.691968e-03
[88,] 0.999257403 1.485194e-03 7.425972e-04
[89,] 0.999555231 8.895390e-04 4.447695e-04
[90,] 0.999846031 3.079386e-04 1.539693e-04
[91,] 0.999989295 2.141040e-05 1.070520e-05
[92,] 0.999999721 5.587602e-07 2.793801e-07
[93,] 0.999999987 2.555509e-08 1.277754e-08
[94,] 0.999999992 1.632496e-08 8.162481e-09
[95,] 0.999999993 1.449418e-08 7.247090e-09
[96,] 0.999999994 1.266342e-08 6.331711e-09
[97,] 0.999999998 3.636013e-09 1.818006e-09
[98,] 1.000000000 4.436297e-10 2.218149e-10
[99,] 1.000000000 4.445019e-11 2.222509e-11
[100,] 1.000000000 1.908963e-11 9.544814e-12
[101,] 1.000000000 1.306409e-11 6.532046e-12
[102,] 1.000000000 1.097428e-11 5.487140e-12
[103,] 1.000000000 6.225556e-12 3.112778e-12
[104,] 1.000000000 2.080131e-12 1.040065e-12
[105,] 1.000000000 1.288312e-12 6.441559e-13
[106,] 1.000000000 2.657657e-12 1.328828e-12
[107,] 1.000000000 8.387270e-12 4.193635e-12
[108,] 1.000000000 2.659536e-11 1.329768e-11
[109,] 1.000000000 7.203345e-11 3.601673e-11
[110,] 1.000000000 1.343814e-10 6.719071e-11
[111,] 1.000000000 2.573550e-10 1.286775e-10
[112,] 1.000000000 8.353487e-10 4.176744e-10
[113,] 0.999999999 2.523787e-09 1.261894e-09
[114,] 0.999999996 7.963618e-09 3.981809e-09
[115,] 0.999999988 2.440145e-08 1.220072e-08
[116,] 0.999999967 6.564063e-08 3.282031e-08
[117,] 0.999999916 1.685587e-07 8.427934e-08
[118,] 0.999999752 4.953025e-07 2.476513e-07
[119,] 0.999999304 1.392345e-06 6.961725e-07
[120,] 0.999998269 3.461471e-06 1.730735e-06
[121,] 0.999996354 7.291666e-06 3.645833e-06
[122,] 0.999991645 1.670938e-05 8.354688e-06
[123,] 0.999977072 4.585629e-05 2.292815e-05
[124,] 0.999978334 4.333130e-05 2.166565e-05
[125,] 0.999993499 1.300230e-05 6.501149e-06
[126,] 0.999989637 2.072538e-05 1.036269e-05
[127,] 0.999977381 4.523733e-05 2.261866e-05
[128,] 0.999994420 1.115963e-05 5.579817e-06
[129,] 0.999999835 3.299906e-07 1.649953e-07
[130,] 0.999999119 1.761662e-06 8.808308e-07
[131,] 0.999995993 8.013667e-06 4.006834e-06
[132,] 0.999978482 4.303533e-05 2.151767e-05
[133,] 0.999895419 2.091624e-04 1.045812e-04
[134,] 0.999513123 9.737533e-04 4.868767e-04
[135,] 0.998724547 2.550905e-03 1.275453e-03
[136,] 0.998244968 3.510063e-03 1.755032e-03
[137,] 0.993722162 1.255568e-02 6.277838e-03
> postscript(file="/var/www/html/rcomp/tmp/1sujl1258726167.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/2netu1258726167.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/3w7as1258726167.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/46ndc1258726167.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/5y16s1258726167.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 168
Frequency = 1
1 2 3 4 5 6
-1.054436785 -0.866003238 -0.610037469 -0.259363950 -0.207357775 0.029384625
7 8 9 10 11 12
0.087164135 0.168076551 0.241749893 0.341196269 0.936494510 0.938115817
13 14 15 16 17 18
1.092546008 1.166308972 1.322274741 1.255398955 1.373561235 1.355939391
19 20 21 22 23 24
1.466643785 1.610741260 1.709345360 1.498531560 1.605713984 1.579341165
25 26 27 28 29 30
1.427921587 1.328146993 1.151800552 1.117236976 1.073653558 1.004546191
31 32 33 34 35 36
0.957915294 0.790313233 0.752194715 0.728149694 0.894106771 1.019219474
37 38 39 40 41 42
1.030984956 1.198805829 1.075384271 1.352520233 1.300116001 1.332447994
43 44 45 46 47 48
1.303458725 1.119654398 0.985946287 0.850109406 0.976372820 0.963231221
49 50 51 52 53 54
1.077875425 0.991332053 0.947297822 0.706884478 0.644220071 0.381054795
55 56 57 58 59 60
0.259446978 0.478521373 0.659483845 0.636878185 0.845499971 0.808866976
61 62 63 64 65 66
0.566268212 0.576753794 0.438661654 0.173317553 0.297329601 0.486996886
67 68 69 70 71 72
0.769707154 0.902012770 0.793327740 0.357583182 0.323632582 0.556034415
73 74 75 76 77 78
0.372210303 0.006279605 -0.108321138 0.007069124 0.003179370 0.179615434
79 80 81 82 83 84
0.119753315 -0.047848746 -0.181556856 -0.510012284 -0.569078289 -0.780780526
85 86 87 88 89 90
-0.933731788 -0.974731729 -0.912916192 -1.222456687 -1.369011150 -1.466112644
91 92 93 94 95 96
-1.496541275 -1.565675020 -1.295065047 -1.266185184 -1.100228107 -1.123722204
97 98 99 100 101 102
-1.297193817 -1.282297828 -1.770343806 -2.241629999 -2.336698940 -2.241089563
103 104 105 106 107 108
-1.565760749 -1.233455133 -1.515677721 -1.927930882 -2.092846655 -1.908866976
109 110 111 112 113 114
-1.070639052 -1.010107308 -0.907066424 -0.632901508 -0.869103474 -0.785285957
115 116 117 118 119 120
-1.197980636 -1.431738802 -1.619811158 -1.232156643 -1.514714043 -1.349907677
121 122 123 124 125 126
-1.038142195 -0.864379231 -0.664309392 -0.678260293 -0.461629698 -0.486632995
127 128 129 130 131 132
-0.543524067 -0.859640605 -0.493441039 -0.339538095 -0.480962472 -0.511745698
133 134 135 136 137 138
-0.510240392 -0.229188298 -0.101124332 0.089335173 -0.073329234 -0.464488637
139 140 141 142 143 144
-0.749466159 -0.567206705 -0.411174991 0.566219350 0.626326658 0.489693663
145 146 147 148 149 150
0.354291706 -0.124870214 -0.167372761 -0.015167557 0.304434084 0.591130324
151 152 153 154 155 156
0.321008030 0.288689225 0.357859837 0.688179061 0.401211254 0.388069655
157 158 159 160 161 162
-0.017714168 0.083950600 0.306072474 0.348017502 0.320636351 0.082494156
163 164 165 166 167 168
0.268175469 0.347556201 0.016819136 -0.391023618 -0.851528984 -1.067549305
> postscript(file="/var/www/html/rcomp/tmp/69quy1258726167.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 = 168
Frequency = 1
lag(myerror, k = 1) myerror
0 -1.054436785 NA
1 -0.866003238 -1.054436785
2 -0.610037469 -0.866003238
3 -0.259363950 -0.610037469
4 -0.207357775 -0.259363950
5 0.029384625 -0.207357775
6 0.087164135 0.029384625
7 0.168076551 0.087164135
8 0.241749893 0.168076551
9 0.341196269 0.241749893
10 0.936494510 0.341196269
11 0.938115817 0.936494510
12 1.092546008 0.938115817
13 1.166308972 1.092546008
14 1.322274741 1.166308972
15 1.255398955 1.322274741
16 1.373561235 1.255398955
17 1.355939391 1.373561235
18 1.466643785 1.355939391
19 1.610741260 1.466643785
20 1.709345360 1.610741260
21 1.498531560 1.709345360
22 1.605713984 1.498531560
23 1.579341165 1.605713984
24 1.427921587 1.579341165
25 1.328146993 1.427921587
26 1.151800552 1.328146993
27 1.117236976 1.151800552
28 1.073653558 1.117236976
29 1.004546191 1.073653558
30 0.957915294 1.004546191
31 0.790313233 0.957915294
32 0.752194715 0.790313233
33 0.728149694 0.752194715
34 0.894106771 0.728149694
35 1.019219474 0.894106771
36 1.030984956 1.019219474
37 1.198805829 1.030984956
38 1.075384271 1.198805829
39 1.352520233 1.075384271
40 1.300116001 1.352520233
41 1.332447994 1.300116001
42 1.303458725 1.332447994
43 1.119654398 1.303458725
44 0.985946287 1.119654398
45 0.850109406 0.985946287
46 0.976372820 0.850109406
47 0.963231221 0.976372820
48 1.077875425 0.963231221
49 0.991332053 1.077875425
50 0.947297822 0.991332053
51 0.706884478 0.947297822
52 0.644220071 0.706884478
53 0.381054795 0.644220071
54 0.259446978 0.381054795
55 0.478521373 0.259446978
56 0.659483845 0.478521373
57 0.636878185 0.659483845
58 0.845499971 0.636878185
59 0.808866976 0.845499971
60 0.566268212 0.808866976
61 0.576753794 0.566268212
62 0.438661654 0.576753794
63 0.173317553 0.438661654
64 0.297329601 0.173317553
65 0.486996886 0.297329601
66 0.769707154 0.486996886
67 0.902012770 0.769707154
68 0.793327740 0.902012770
69 0.357583182 0.793327740
70 0.323632582 0.357583182
71 0.556034415 0.323632582
72 0.372210303 0.556034415
73 0.006279605 0.372210303
74 -0.108321138 0.006279605
75 0.007069124 -0.108321138
76 0.003179370 0.007069124
77 0.179615434 0.003179370
78 0.119753315 0.179615434
79 -0.047848746 0.119753315
80 -0.181556856 -0.047848746
81 -0.510012284 -0.181556856
82 -0.569078289 -0.510012284
83 -0.780780526 -0.569078289
84 -0.933731788 -0.780780526
85 -0.974731729 -0.933731788
86 -0.912916192 -0.974731729
87 -1.222456687 -0.912916192
88 -1.369011150 -1.222456687
89 -1.466112644 -1.369011150
90 -1.496541275 -1.466112644
91 -1.565675020 -1.496541275
92 -1.295065047 -1.565675020
93 -1.266185184 -1.295065047
94 -1.100228107 -1.266185184
95 -1.123722204 -1.100228107
96 -1.297193817 -1.123722204
97 -1.282297828 -1.297193817
98 -1.770343806 -1.282297828
99 -2.241629999 -1.770343806
100 -2.336698940 -2.241629999
101 -2.241089563 -2.336698940
102 -1.565760749 -2.241089563
103 -1.233455133 -1.565760749
104 -1.515677721 -1.233455133
105 -1.927930882 -1.515677721
106 -2.092846655 -1.927930882
107 -1.908866976 -2.092846655
108 -1.070639052 -1.908866976
109 -1.010107308 -1.070639052
110 -0.907066424 -1.010107308
111 -0.632901508 -0.907066424
112 -0.869103474 -0.632901508
113 -0.785285957 -0.869103474
114 -1.197980636 -0.785285957
115 -1.431738802 -1.197980636
116 -1.619811158 -1.431738802
117 -1.232156643 -1.619811158
118 -1.514714043 -1.232156643
119 -1.349907677 -1.514714043
120 -1.038142195 -1.349907677
121 -0.864379231 -1.038142195
122 -0.664309392 -0.864379231
123 -0.678260293 -0.664309392
124 -0.461629698 -0.678260293
125 -0.486632995 -0.461629698
126 -0.543524067 -0.486632995
127 -0.859640605 -0.543524067
128 -0.493441039 -0.859640605
129 -0.339538095 -0.493441039
130 -0.480962472 -0.339538095
131 -0.511745698 -0.480962472
132 -0.510240392 -0.511745698
133 -0.229188298 -0.510240392
134 -0.101124332 -0.229188298
135 0.089335173 -0.101124332
136 -0.073329234 0.089335173
137 -0.464488637 -0.073329234
138 -0.749466159 -0.464488637
139 -0.567206705 -0.749466159
140 -0.411174991 -0.567206705
141 0.566219350 -0.411174991
142 0.626326658 0.566219350
143 0.489693663 0.626326658
144 0.354291706 0.489693663
145 -0.124870214 0.354291706
146 -0.167372761 -0.124870214
147 -0.015167557 -0.167372761
148 0.304434084 -0.015167557
149 0.591130324 0.304434084
150 0.321008030 0.591130324
151 0.288689225 0.321008030
152 0.357859837 0.288689225
153 0.688179061 0.357859837
154 0.401211254 0.688179061
155 0.388069655 0.401211254
156 -0.017714168 0.388069655
157 0.083950600 -0.017714168
158 0.306072474 0.083950600
159 0.348017502 0.306072474
160 0.320636351 0.348017502
161 0.082494156 0.320636351
162 0.268175469 0.082494156
163 0.347556201 0.268175469
164 0.016819136 0.347556201
165 -0.391023618 0.016819136
166 -0.851528984 -0.391023618
167 -1.067549305 -0.851528984
168 NA -1.067549305
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.866003238 -1.054436785
[2,] -0.610037469 -0.866003238
[3,] -0.259363950 -0.610037469
[4,] -0.207357775 -0.259363950
[5,] 0.029384625 -0.207357775
[6,] 0.087164135 0.029384625
[7,] 0.168076551 0.087164135
[8,] 0.241749893 0.168076551
[9,] 0.341196269 0.241749893
[10,] 0.936494510 0.341196269
[11,] 0.938115817 0.936494510
[12,] 1.092546008 0.938115817
[13,] 1.166308972 1.092546008
[14,] 1.322274741 1.166308972
[15,] 1.255398955 1.322274741
[16,] 1.373561235 1.255398955
[17,] 1.355939391 1.373561235
[18,] 1.466643785 1.355939391
[19,] 1.610741260 1.466643785
[20,] 1.709345360 1.610741260
[21,] 1.498531560 1.709345360
[22,] 1.605713984 1.498531560
[23,] 1.579341165 1.605713984
[24,] 1.427921587 1.579341165
[25,] 1.328146993 1.427921587
[26,] 1.151800552 1.328146993
[27,] 1.117236976 1.151800552
[28,] 1.073653558 1.117236976
[29,] 1.004546191 1.073653558
[30,] 0.957915294 1.004546191
[31,] 0.790313233 0.957915294
[32,] 0.752194715 0.790313233
[33,] 0.728149694 0.752194715
[34,] 0.894106771 0.728149694
[35,] 1.019219474 0.894106771
[36,] 1.030984956 1.019219474
[37,] 1.198805829 1.030984956
[38,] 1.075384271 1.198805829
[39,] 1.352520233 1.075384271
[40,] 1.300116001 1.352520233
[41,] 1.332447994 1.300116001
[42,] 1.303458725 1.332447994
[43,] 1.119654398 1.303458725
[44,] 0.985946287 1.119654398
[45,] 0.850109406 0.985946287
[46,] 0.976372820 0.850109406
[47,] 0.963231221 0.976372820
[48,] 1.077875425 0.963231221
[49,] 0.991332053 1.077875425
[50,] 0.947297822 0.991332053
[51,] 0.706884478 0.947297822
[52,] 0.644220071 0.706884478
[53,] 0.381054795 0.644220071
[54,] 0.259446978 0.381054795
[55,] 0.478521373 0.259446978
[56,] 0.659483845 0.478521373
[57,] 0.636878185 0.659483845
[58,] 0.845499971 0.636878185
[59,] 0.808866976 0.845499971
[60,] 0.566268212 0.808866976
[61,] 0.576753794 0.566268212
[62,] 0.438661654 0.576753794
[63,] 0.173317553 0.438661654
[64,] 0.297329601 0.173317553
[65,] 0.486996886 0.297329601
[66,] 0.769707154 0.486996886
[67,] 0.902012770 0.769707154
[68,] 0.793327740 0.902012770
[69,] 0.357583182 0.793327740
[70,] 0.323632582 0.357583182
[71,] 0.556034415 0.323632582
[72,] 0.372210303 0.556034415
[73,] 0.006279605 0.372210303
[74,] -0.108321138 0.006279605
[75,] 0.007069124 -0.108321138
[76,] 0.003179370 0.007069124
[77,] 0.179615434 0.003179370
[78,] 0.119753315 0.179615434
[79,] -0.047848746 0.119753315
[80,] -0.181556856 -0.047848746
[81,] -0.510012284 -0.181556856
[82,] -0.569078289 -0.510012284
[83,] -0.780780526 -0.569078289
[84,] -0.933731788 -0.780780526
[85,] -0.974731729 -0.933731788
[86,] -0.912916192 -0.974731729
[87,] -1.222456687 -0.912916192
[88,] -1.369011150 -1.222456687
[89,] -1.466112644 -1.369011150
[90,] -1.496541275 -1.466112644
[91,] -1.565675020 -1.496541275
[92,] -1.295065047 -1.565675020
[93,] -1.266185184 -1.295065047
[94,] -1.100228107 -1.266185184
[95,] -1.123722204 -1.100228107
[96,] -1.297193817 -1.123722204
[97,] -1.282297828 -1.297193817
[98,] -1.770343806 -1.282297828
[99,] -2.241629999 -1.770343806
[100,] -2.336698940 -2.241629999
[101,] -2.241089563 -2.336698940
[102,] -1.565760749 -2.241089563
[103,] -1.233455133 -1.565760749
[104,] -1.515677721 -1.233455133
[105,] -1.927930882 -1.515677721
[106,] -2.092846655 -1.927930882
[107,] -1.908866976 -2.092846655
[108,] -1.070639052 -1.908866976
[109,] -1.010107308 -1.070639052
[110,] -0.907066424 -1.010107308
[111,] -0.632901508 -0.907066424
[112,] -0.869103474 -0.632901508
[113,] -0.785285957 -0.869103474
[114,] -1.197980636 -0.785285957
[115,] -1.431738802 -1.197980636
[116,] -1.619811158 -1.431738802
[117,] -1.232156643 -1.619811158
[118,] -1.514714043 -1.232156643
[119,] -1.349907677 -1.514714043
[120,] -1.038142195 -1.349907677
[121,] -0.864379231 -1.038142195
[122,] -0.664309392 -0.864379231
[123,] -0.678260293 -0.664309392
[124,] -0.461629698 -0.678260293
[125,] -0.486632995 -0.461629698
[126,] -0.543524067 -0.486632995
[127,] -0.859640605 -0.543524067
[128,] -0.493441039 -0.859640605
[129,] -0.339538095 -0.493441039
[130,] -0.480962472 -0.339538095
[131,] -0.511745698 -0.480962472
[132,] -0.510240392 -0.511745698
[133,] -0.229188298 -0.510240392
[134,] -0.101124332 -0.229188298
[135,] 0.089335173 -0.101124332
[136,] -0.073329234 0.089335173
[137,] -0.464488637 -0.073329234
[138,] -0.749466159 -0.464488637
[139,] -0.567206705 -0.749466159
[140,] -0.411174991 -0.567206705
[141,] 0.566219350 -0.411174991
[142,] 0.626326658 0.566219350
[143,] 0.489693663 0.626326658
[144,] 0.354291706 0.489693663
[145,] -0.124870214 0.354291706
[146,] -0.167372761 -0.124870214
[147,] -0.015167557 -0.167372761
[148,] 0.304434084 -0.015167557
[149,] 0.591130324 0.304434084
[150,] 0.321008030 0.591130324
[151,] 0.288689225 0.321008030
[152,] 0.357859837 0.288689225
[153,] 0.688179061 0.357859837
[154,] 0.401211254 0.688179061
[155,] 0.388069655 0.401211254
[156,] -0.017714168 0.388069655
[157,] 0.083950600 -0.017714168
[158,] 0.306072474 0.083950600
[159,] 0.348017502 0.306072474
[160,] 0.320636351 0.348017502
[161,] 0.082494156 0.320636351
[162,] 0.268175469 0.082494156
[163,] 0.347556201 0.268175469
[164,] 0.016819136 0.347556201
[165,] -0.391023618 0.016819136
[166,] -0.851528984 -0.391023618
[167,] -1.067549305 -0.851528984
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.866003238 -1.054436785
2 -0.610037469 -0.866003238
3 -0.259363950 -0.610037469
4 -0.207357775 -0.259363950
5 0.029384625 -0.207357775
6 0.087164135 0.029384625
7 0.168076551 0.087164135
8 0.241749893 0.168076551
9 0.341196269 0.241749893
10 0.936494510 0.341196269
11 0.938115817 0.936494510
12 1.092546008 0.938115817
13 1.166308972 1.092546008
14 1.322274741 1.166308972
15 1.255398955 1.322274741
16 1.373561235 1.255398955
17 1.355939391 1.373561235
18 1.466643785 1.355939391
19 1.610741260 1.466643785
20 1.709345360 1.610741260
21 1.498531560 1.709345360
22 1.605713984 1.498531560
23 1.579341165 1.605713984
24 1.427921587 1.579341165
25 1.328146993 1.427921587
26 1.151800552 1.328146993
27 1.117236976 1.151800552
28 1.073653558 1.117236976
29 1.004546191 1.073653558
30 0.957915294 1.004546191
31 0.790313233 0.957915294
32 0.752194715 0.790313233
33 0.728149694 0.752194715
34 0.894106771 0.728149694
35 1.019219474 0.894106771
36 1.030984956 1.019219474
37 1.198805829 1.030984956
38 1.075384271 1.198805829
39 1.352520233 1.075384271
40 1.300116001 1.352520233
41 1.332447994 1.300116001
42 1.303458725 1.332447994
43 1.119654398 1.303458725
44 0.985946287 1.119654398
45 0.850109406 0.985946287
46 0.976372820 0.850109406
47 0.963231221 0.976372820
48 1.077875425 0.963231221
49 0.991332053 1.077875425
50 0.947297822 0.991332053
51 0.706884478 0.947297822
52 0.644220071 0.706884478
53 0.381054795 0.644220071
54 0.259446978 0.381054795
55 0.478521373 0.259446978
56 0.659483845 0.478521373
57 0.636878185 0.659483845
58 0.845499971 0.636878185
59 0.808866976 0.845499971
60 0.566268212 0.808866976
61 0.576753794 0.566268212
62 0.438661654 0.576753794
63 0.173317553 0.438661654
64 0.297329601 0.173317553
65 0.486996886 0.297329601
66 0.769707154 0.486996886
67 0.902012770 0.769707154
68 0.793327740 0.902012770
69 0.357583182 0.793327740
70 0.323632582 0.357583182
71 0.556034415 0.323632582
72 0.372210303 0.556034415
73 0.006279605 0.372210303
74 -0.108321138 0.006279605
75 0.007069124 -0.108321138
76 0.003179370 0.007069124
77 0.179615434 0.003179370
78 0.119753315 0.179615434
79 -0.047848746 0.119753315
80 -0.181556856 -0.047848746
81 -0.510012284 -0.181556856
82 -0.569078289 -0.510012284
83 -0.780780526 -0.569078289
84 -0.933731788 -0.780780526
85 -0.974731729 -0.933731788
86 -0.912916192 -0.974731729
87 -1.222456687 -0.912916192
88 -1.369011150 -1.222456687
89 -1.466112644 -1.369011150
90 -1.496541275 -1.466112644
91 -1.565675020 -1.496541275
92 -1.295065047 -1.565675020
93 -1.266185184 -1.295065047
94 -1.100228107 -1.266185184
95 -1.123722204 -1.100228107
96 -1.297193817 -1.123722204
97 -1.282297828 -1.297193817
98 -1.770343806 -1.282297828
99 -2.241629999 -1.770343806
100 -2.336698940 -2.241629999
101 -2.241089563 -2.336698940
102 -1.565760749 -2.241089563
103 -1.233455133 -1.565760749
104 -1.515677721 -1.233455133
105 -1.927930882 -1.515677721
106 -2.092846655 -1.927930882
107 -1.908866976 -2.092846655
108 -1.070639052 -1.908866976
109 -1.010107308 -1.070639052
110 -0.907066424 -1.010107308
111 -0.632901508 -0.907066424
112 -0.869103474 -0.632901508
113 -0.785285957 -0.869103474
114 -1.197980636 -0.785285957
115 -1.431738802 -1.197980636
116 -1.619811158 -1.431738802
117 -1.232156643 -1.619811158
118 -1.514714043 -1.232156643
119 -1.349907677 -1.514714043
120 -1.038142195 -1.349907677
121 -0.864379231 -1.038142195
122 -0.664309392 -0.864379231
123 -0.678260293 -0.664309392
124 -0.461629698 -0.678260293
125 -0.486632995 -0.461629698
126 -0.543524067 -0.486632995
127 -0.859640605 -0.543524067
128 -0.493441039 -0.859640605
129 -0.339538095 -0.493441039
130 -0.480962472 -0.339538095
131 -0.511745698 -0.480962472
132 -0.510240392 -0.511745698
133 -0.229188298 -0.510240392
134 -0.101124332 -0.229188298
135 0.089335173 -0.101124332
136 -0.073329234 0.089335173
137 -0.464488637 -0.073329234
138 -0.749466159 -0.464488637
139 -0.567206705 -0.749466159
140 -0.411174991 -0.567206705
141 0.566219350 -0.411174991
142 0.626326658 0.566219350
143 0.489693663 0.626326658
144 0.354291706 0.489693663
145 -0.124870214 0.354291706
146 -0.167372761 -0.124870214
147 -0.015167557 -0.167372761
148 0.304434084 -0.015167557
149 0.591130324 0.304434084
150 0.321008030 0.591130324
151 0.288689225 0.321008030
152 0.357859837 0.288689225
153 0.688179061 0.357859837
154 0.401211254 0.688179061
155 0.388069655 0.401211254
156 -0.017714168 0.388069655
157 0.083950600 -0.017714168
158 0.306072474 0.083950600
159 0.348017502 0.306072474
160 0.320636351 0.348017502
161 0.082494156 0.320636351
162 0.268175469 0.082494156
163 0.347556201 0.268175469
164 0.016819136 0.347556201
165 -0.391023618 0.016819136
166 -0.851528984 -0.391023618
167 -1.067549305 -0.851528984
> 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/7uizh1258726167.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/87nrx1258726167.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/9gl8y1258726167.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/www/html/rcomp/tmp/10yo921258726167.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/www/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/rcomp/createtable")
>
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE)
> a<-table.row.end(a)
> myeq <- colnames(x)[1]
> myeq <- paste(myeq, '[t] = ', sep='')
> for (i in 1:k){
+ if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '')
+ myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ')
+ if (rownames(mysum$coefficients)[i] != '(Intercept)') {
+ myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='')
+ if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='')
+ }
+ }
> myeq <- paste(myeq, ' + e[t]')
> a<-table.row.start(a)
> a<-table.element(a, myeq)
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/11wylk1258726167.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/12wpsk1258726167.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/13kq3u1258726167.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/14jk981258726167.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/1552301258726167.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/16pk1f1258726167.tab")
+ }
> system("convert tmp/1sujl1258726167.ps tmp/1sujl1258726167.png")
> system("convert tmp/2netu1258726167.ps tmp/2netu1258726167.png")
> system("convert tmp/3w7as1258726167.ps tmp/3w7as1258726167.png")
> system("convert tmp/46ndc1258726167.ps tmp/46ndc1258726167.png")
> system("convert tmp/5y16s1258726167.ps tmp/5y16s1258726167.png")
> system("convert tmp/69quy1258726167.ps tmp/69quy1258726167.png")
> system("convert tmp/7uizh1258726167.ps tmp/7uizh1258726167.png")
> system("convert tmp/87nrx1258726167.ps tmp/87nrx1258726167.png")
> system("convert tmp/9gl8y1258726167.ps tmp/9gl8y1258726167.png")
> system("convert tmp/10yo921258726167.ps tmp/10yo921258726167.png")
>
>
> proc.time()
user system elapsed
4.230 1.694 4.865