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.32
+ ,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
+ ,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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.63 0 0 0 0 1 0 0 0 0 0 0
162 8.7 2.38 0 0 0 0 0 1 0 0 0 0 0
163 8.6 1.69 0 0 0 0 0 0 1 0 0 0 0
164 8.5 1.96 0 0 0 0 0 0 0 1 0 0 0
165 8.3 2.19 0 0 0 0 0 0 0 0 1 0 0
166 8.0 1.87 0 0 0 0 0 0 0 0 0 1 0
167 8.2 1.60 0 0 0 0 0 0 0 0 0 0 1
168 8.1 1.63 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.70088 -0.45647 0.03483 -0.06331 -0.22113 -0.20196
M5 M6 M7 M8 M9 M10
-0.15880 -0.24158 -0.40783 -0.57401 -0.75193 -0.86269
M11
-0.37407
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-2.3322 -0.7788 0.1284 0.7826 1.7217
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.70088 0.35123 27.619 < 2e-16 ***
X -0.45647 0.11486 -3.974 0.000108 ***
M1 0.03483 0.37946 0.092 0.926991
M2 -0.06331 0.37943 -0.167 0.867705
M3 -0.22113 0.37943 -0.583 0.560873
M4 -0.20196 0.37943 -0.532 0.595303
M5 -0.15880 0.37943 -0.419 0.676140
M6 -0.24158 0.37943 -0.637 0.525258
M7 -0.40783 0.37943 -1.075 0.284119
M8 -0.57401 0.37943 -1.513 0.132361
M9 -0.75193 0.37943 -1.982 0.049277 *
M10 -0.86269 0.37943 -2.274 0.024360 *
M11 -0.37407 0.37943 -0.986 0.325740
---
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.1541, Adjusted R-squared: 0.08863
F-statistic: 2.353 on 12 and 155 DF, p-value: 0.00836
> 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.07530811 1.506162e-01 9.246919e-01
[2,] 0.71147152 5.770570e-01 2.885285e-01
[3,] 0.81496245 3.700751e-01 1.850376e-01
[4,] 0.88303843 2.339231e-01 1.169616e-01
[5,] 0.89218727 2.156255e-01 1.078127e-01
[6,] 0.89002136 2.199573e-01 1.099786e-01
[7,] 0.88172937 2.365413e-01 1.182706e-01
[8,] 0.86498745 2.700251e-01 1.350125e-01
[9,] 0.85186886 2.962623e-01 1.481311e-01
[10,] 0.88408326 2.318335e-01 1.159167e-01
[11,] 0.89539720 2.092056e-01 1.046028e-01
[12,] 0.89125562 2.174888e-01 1.087444e-01
[13,] 0.86743671 2.651266e-01 1.325633e-01
[14,] 0.83571800 3.285640e-01 1.642820e-01
[15,] 0.79794043 4.041191e-01 2.020596e-01
[16,] 0.75551669 4.889666e-01 2.444833e-01
[17,] 0.71069505 5.786099e-01 2.893050e-01
[18,] 0.66818976 6.636205e-01 3.318102e-01
[19,] 0.62433010 7.513398e-01 3.756699e-01
[20,] 0.57483181 8.503364e-01 4.251682e-01
[21,] 0.53439150 9.312170e-01 4.656085e-01
[22,] 0.49081566 9.816313e-01 5.091843e-01
[23,] 0.44869047 8.973809e-01 5.513095e-01
[24,] 0.42095481 8.419096e-01 5.790452e-01
[25,] 0.38340604 7.668121e-01 6.165940e-01
[26,] 0.37212087 7.442417e-01 6.278791e-01
[27,] 0.35576136 7.115227e-01 6.442386e-01
[28,] 0.34539723 6.907945e-01 6.546028e-01
[29,] 0.33370747 6.674149e-01 6.662925e-01
[30,] 0.31015343 6.203069e-01 6.898466e-01
[31,] 0.28211233 5.642247e-01 7.178877e-01
[32,] 0.25229171 5.045834e-01 7.477083e-01
[33,] 0.23412023 4.682405e-01 7.658798e-01
[34,] 0.21604339 4.320868e-01 7.839566e-01
[35,] 0.21485439 4.297088e-01 7.851456e-01
[36,] 0.20614985 4.122997e-01 7.938501e-01
[37,] 0.19800530 3.960106e-01 8.019947e-01
[38,] 0.18129882 3.625976e-01 8.187012e-01
[39,] 0.16453554 3.290711e-01 8.354645e-01
[40,] 0.15369073 3.073815e-01 8.463093e-01
[41,] 0.14752397 2.950479e-01 8.524760e-01
[42,] 0.13318511 2.663702e-01 8.668149e-01
[43,] 0.12022883 2.404577e-01 8.797712e-01
[44,] 0.10750341 2.150068e-01 8.924966e-01
[45,] 0.10424156 2.084831e-01 8.957584e-01
[46,] 0.09610512 1.922102e-01 9.038949e-01
[47,] 0.08425658 1.685132e-01 9.157434e-01
[48,] 0.07501513 1.500303e-01 9.249849e-01
[49,] 0.06620502 1.324100e-01 9.337950e-01
[50,] 0.06053802 1.210760e-01 9.394620e-01
[51,] 0.05316884 1.063377e-01 9.468312e-01
[52,] 0.04653758 9.307517e-02 9.534624e-01
[53,] 0.04413379 8.826758e-02 9.558662e-01
[54,] 0.04538661 9.077322e-02 9.546134e-01
[55,] 0.04504309 9.008618e-02 9.549569e-01
[56,] 0.03973284 7.946568e-02 9.602672e-01
[57,] 0.03796052 7.592104e-02 9.620395e-01
[58,] 0.03548468 7.096936e-02 9.645153e-01
[59,] 0.03175586 6.351172e-02 9.682441e-01
[60,] 0.02837490 5.674980e-02 9.716251e-01
[61,] 0.02541952 5.083904e-02 9.745805e-01
[62,] 0.02269249 4.538499e-02 9.773075e-01
[63,] 0.02054306 4.108611e-02 9.794569e-01
[64,] 0.01898707 3.797415e-02 9.810129e-01
[65,] 0.01795137 3.590274e-02 9.820486e-01
[66,] 0.01729183 3.458365e-02 9.827082e-01
[67,] 0.01711642 3.423285e-02 9.828836e-01
[68,] 0.01699579 3.399158e-02 9.830042e-01
[69,] 0.02055730 4.111460e-02 9.794427e-01
[70,] 0.02421996 4.843993e-02 9.757800e-01
[71,] 0.03104770 6.209541e-02 9.689523e-01
[72,] 0.04160336 8.320671e-02 9.583966e-01
[73,] 0.05503823 1.100765e-01 9.449618e-01
[74,] 0.08577937 1.715587e-01 9.142206e-01
[75,] 0.14326809 2.865362e-01 8.567319e-01
[76,] 0.24207469 4.841494e-01 7.579253e-01
[77,] 0.34996456 6.999291e-01 6.500354e-01
[78,] 0.47838854 9.567771e-01 5.216115e-01
[79,] 0.57331368 8.533726e-01 4.266863e-01
[80,] 0.64591593 7.081681e-01 3.540841e-01
[81,] 0.68997830 6.200434e-01 3.100217e-01
[82,] 0.72380661 5.523868e-01 2.761934e-01
[83,] 0.76568181 4.686364e-01 2.343182e-01
[84,] 0.80344770 3.931046e-01 1.965523e-01
[85,] 0.87582461 2.483508e-01 1.241754e-01
[86,] 0.95564194 8.871612e-02 4.435806e-02
[87,] 0.99014432 1.971136e-02 9.855678e-03
[88,] 0.99803485 3.930292e-03 1.965146e-03
[89,] 0.99910546 1.789077e-03 8.945386e-04
[90,] 0.99944835 1.103301e-03 5.516504e-04
[91,] 0.99980064 3.987157e-04 1.993579e-04
[92,] 0.99998497 3.006562e-05 1.503281e-05
[93,] 0.99999956 8.725269e-07 4.362635e-07
[94,] 0.99999998 4.356160e-08 2.178080e-08
[95,] 0.99999999 2.854144e-08 1.427072e-08
[96,] 0.99999999 2.573026e-08 1.286513e-08
[97,] 0.99999999 2.282672e-08 1.141336e-08
[98,] 1.00000000 6.967183e-09 3.483592e-09
[99,] 1.00000000 9.176395e-10 4.588197e-10
[100,] 1.00000000 1.004267e-10 5.021336e-11
[101,] 1.00000000 4.450376e-11 2.225188e-11
[102,] 1.00000000 3.081104e-11 1.540552e-11
[103,] 1.00000000 2.578381e-11 1.289190e-11
[104,] 1.00000000 1.457642e-11 7.288210e-12
[105,] 1.00000000 4.823111e-12 2.411555e-12
[106,] 1.00000000 1.817919e-12 9.089594e-13
[107,] 1.00000000 3.535477e-12 1.767738e-12
[108,] 1.00000000 1.122656e-11 5.613280e-12
[109,] 1.00000000 3.529744e-11 1.764872e-11
[110,] 1.00000000 9.177998e-11 4.588999e-11
[111,] 1.00000000 1.648893e-10 8.244467e-11
[112,] 1.00000000 3.080841e-10 1.540421e-10
[113,] 1.00000000 1.007464e-09 5.037321e-10
[114,] 1.00000000 2.999859e-09 1.499929e-09
[115,] 1.00000000 9.513027e-09 4.756513e-09
[116,] 0.99999999 2.877681e-08 1.438841e-08
[117,] 0.99999996 7.596453e-08 3.798227e-08
[118,] 0.99999994 1.142279e-07 5.711394e-08
[119,] 0.99999983 3.343646e-07 1.671823e-07
[120,] 0.99999949 1.019271e-06 5.096357e-07
[121,] 0.99999859 2.821059e-06 1.410529e-06
[122,] 0.99999663 6.730909e-06 3.365454e-06
[123,] 0.99999109 1.782215e-05 8.911075e-06
[124,] 0.99997577 4.846086e-05 2.423043e-05
[125,] 0.99998190 3.620548e-05 1.810274e-05
[126,] 0.99999532 9.360528e-06 4.680264e-06
[127,] 0.99999331 1.337449e-05 6.687244e-06
[128,] 0.99998554 2.891852e-05 1.445926e-05
[129,] 0.99999830 3.403124e-06 1.701562e-06
[130,] 0.99999944 1.112299e-06 5.561494e-07
[131,] 0.99999711 5.773306e-06 2.886653e-06
[132,] 0.99998679 2.642691e-05 1.321346e-05
[133,] 0.99993124 1.375164e-04 6.875819e-05
[134,] 0.99967317 6.536649e-04 3.268324e-04
[135,] 0.99844279 3.114414e-03 1.557207e-03
[136,] 0.99475636 1.048728e-02 5.243641e-03
[137,] 0.98997848 2.004305e-02 1.002152e-02
> postscript(file="/var/www/html/rcomp/tmp/1g0081258725647.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/29q8d1258725647.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/3yclh1258725647.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/4b2mh1258725647.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/5jwmq1258725647.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.076692018 -1.051593021 -0.861814748 -0.603390997 -0.245696247 -0.194869462
7 8 9 10 11 12
0.044408077 0.101460113 0.178955603 0.248208986 0.350884907 0.955265558
13 14 15 16 17 18
0.951543972 1.104031288 1.175126845 1.333550597 1.262585522 1.381883103
19 20 21 22 23 24
1.361395450 1.473224123 1.619614245 1.721668338 1.510226265 1.612911573
25 26 27 28 29 30
1.587214060 1.430148100 1.328631977 1.150114134 1.116090653 1.071482157
31 32 33 34 35 36
1.001206422 0.953693737 0.780977309 0.741525088 0.716388856 0.883404077
37 38 39 40 41 42
1.007494645 1.019323318 1.191266547 1.067525342 1.352608411 1.298870476
43 44 45 46 47 48
1.333583296 1.304329490 1.118342739 0.983455238 0.849613401 0.975546144
49 50 51 52 53 54
0.963542790 1.085348573 0.997526609 0.955950360 0.712373604 0.644517674
55 56 57 58 59 60
0.373394267 0.248281346 0.472271705 0.656066919 0.635919241 0.843593105
61 62 63 64 65 66
0.803777597 0.555841077 0.568442948 0.426019028 0.149641563 0.278492419
67 68 69 70 71 72
0.472546596 0.762399341 0.900083860 0.787596122 0.343353339 0.299967614
73 74 75 76 77 78
0.538600013 0.354993406 -0.014993515 -0.129605280 -0.008428288 -0.011954306
79 80 81 82 83 84
0.168405712 0.107198868 -0.065517560 -0.200405061 -0.530106013 -0.585490555
85 86 87 88 89 90
-0.792505355 -0.944158923 -0.981345134 -0.913368108 -1.224991825 -1.369176485
91 92 93 94 95 96
-1.461428149 -1.495670510 -1.562974546 -1.282896382 -1.253255977 -1.086240756
97 98 99 100 101 102
-1.101961159 -1.281850717 -1.264684126 -1.762308519 -2.237838314 -2.332234892
103 104 105 106 107 108
-2.239028386 -1.553316525 -1.215632006 -1.500731425 -1.917162054 -2.082099871
109 110 111 112 113 114
-1.904080336 -1.064863345 -1.007461946 -0.903814833 -0.618307928 -0.858775539
115 116 117 118 119 120
-0.774274637 -1.200659065 -1.441846290 -1.636498984 -1.242528666 -1.525725363
121 122 123 124 125 126
-1.360552316 -1.048723643 -0.877628085 -0.673557136 -0.689745573 -0.465035601
127 128 129 130 131 132
-0.489664139 -0.551294818 -0.874223164 -0.498709719 -0.346669551 -0.483795213
133 134 135 136 137 138
-0.514057447 -0.516346769 -0.230709381 -0.104662504 0.083713779 -0.084142151
139 140 141 142 143 144
-0.477241486 -0.750447147 -0.557562156 -0.406567652 0.573284671 0.630746617
145 146 147 148 149 150
0.490931108 0.367937365 -0.115743715 -0.162732355 -0.010449995 0.313836142
151 152 153 154 155 156
0.608314154 0.332989316 0.296790646 0.371880256 0.706509216 0.418747800
157 158 159 160 161 162
0.406744445 -0.010086707 0.093385725 0.320280273 0.358444638 0.327106466
163 164 165 166 167 168
0.078382823 0.267811732 0.350719613 0.015408276 -0.396457633 -0.856830730
> postscript(file="/var/www/html/rcomp/tmp/6qyk61258725647.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.076692018 NA
1 -1.051593021 -1.076692018
2 -0.861814748 -1.051593021
3 -0.603390997 -0.861814748
4 -0.245696247 -0.603390997
5 -0.194869462 -0.245696247
6 0.044408077 -0.194869462
7 0.101460113 0.044408077
8 0.178955603 0.101460113
9 0.248208986 0.178955603
10 0.350884907 0.248208986
11 0.955265558 0.350884907
12 0.951543972 0.955265558
13 1.104031288 0.951543972
14 1.175126845 1.104031288
15 1.333550597 1.175126845
16 1.262585522 1.333550597
17 1.381883103 1.262585522
18 1.361395450 1.381883103
19 1.473224123 1.361395450
20 1.619614245 1.473224123
21 1.721668338 1.619614245
22 1.510226265 1.721668338
23 1.612911573 1.510226265
24 1.587214060 1.612911573
25 1.430148100 1.587214060
26 1.328631977 1.430148100
27 1.150114134 1.328631977
28 1.116090653 1.150114134
29 1.071482157 1.116090653
30 1.001206422 1.071482157
31 0.953693737 1.001206422
32 0.780977309 0.953693737
33 0.741525088 0.780977309
34 0.716388856 0.741525088
35 0.883404077 0.716388856
36 1.007494645 0.883404077
37 1.019323318 1.007494645
38 1.191266547 1.019323318
39 1.067525342 1.191266547
40 1.352608411 1.067525342
41 1.298870476 1.352608411
42 1.333583296 1.298870476
43 1.304329490 1.333583296
44 1.118342739 1.304329490
45 0.983455238 1.118342739
46 0.849613401 0.983455238
47 0.975546144 0.849613401
48 0.963542790 0.975546144
49 1.085348573 0.963542790
50 0.997526609 1.085348573
51 0.955950360 0.997526609
52 0.712373604 0.955950360
53 0.644517674 0.712373604
54 0.373394267 0.644517674
55 0.248281346 0.373394267
56 0.472271705 0.248281346
57 0.656066919 0.472271705
58 0.635919241 0.656066919
59 0.843593105 0.635919241
60 0.803777597 0.843593105
61 0.555841077 0.803777597
62 0.568442948 0.555841077
63 0.426019028 0.568442948
64 0.149641563 0.426019028
65 0.278492419 0.149641563
66 0.472546596 0.278492419
67 0.762399341 0.472546596
68 0.900083860 0.762399341
69 0.787596122 0.900083860
70 0.343353339 0.787596122
71 0.299967614 0.343353339
72 0.538600013 0.299967614
73 0.354993406 0.538600013
74 -0.014993515 0.354993406
75 -0.129605280 -0.014993515
76 -0.008428288 -0.129605280
77 -0.011954306 -0.008428288
78 0.168405712 -0.011954306
79 0.107198868 0.168405712
80 -0.065517560 0.107198868
81 -0.200405061 -0.065517560
82 -0.530106013 -0.200405061
83 -0.585490555 -0.530106013
84 -0.792505355 -0.585490555
85 -0.944158923 -0.792505355
86 -0.981345134 -0.944158923
87 -0.913368108 -0.981345134
88 -1.224991825 -0.913368108
89 -1.369176485 -1.224991825
90 -1.461428149 -1.369176485
91 -1.495670510 -1.461428149
92 -1.562974546 -1.495670510
93 -1.282896382 -1.562974546
94 -1.253255977 -1.282896382
95 -1.086240756 -1.253255977
96 -1.101961159 -1.086240756
97 -1.281850717 -1.101961159
98 -1.264684126 -1.281850717
99 -1.762308519 -1.264684126
100 -2.237838314 -1.762308519
101 -2.332234892 -2.237838314
102 -2.239028386 -2.332234892
103 -1.553316525 -2.239028386
104 -1.215632006 -1.553316525
105 -1.500731425 -1.215632006
106 -1.917162054 -1.500731425
107 -2.082099871 -1.917162054
108 -1.904080336 -2.082099871
109 -1.064863345 -1.904080336
110 -1.007461946 -1.064863345
111 -0.903814833 -1.007461946
112 -0.618307928 -0.903814833
113 -0.858775539 -0.618307928
114 -0.774274637 -0.858775539
115 -1.200659065 -0.774274637
116 -1.441846290 -1.200659065
117 -1.636498984 -1.441846290
118 -1.242528666 -1.636498984
119 -1.525725363 -1.242528666
120 -1.360552316 -1.525725363
121 -1.048723643 -1.360552316
122 -0.877628085 -1.048723643
123 -0.673557136 -0.877628085
124 -0.689745573 -0.673557136
125 -0.465035601 -0.689745573
126 -0.489664139 -0.465035601
127 -0.551294818 -0.489664139
128 -0.874223164 -0.551294818
129 -0.498709719 -0.874223164
130 -0.346669551 -0.498709719
131 -0.483795213 -0.346669551
132 -0.514057447 -0.483795213
133 -0.516346769 -0.514057447
134 -0.230709381 -0.516346769
135 -0.104662504 -0.230709381
136 0.083713779 -0.104662504
137 -0.084142151 0.083713779
138 -0.477241486 -0.084142151
139 -0.750447147 -0.477241486
140 -0.557562156 -0.750447147
141 -0.406567652 -0.557562156
142 0.573284671 -0.406567652
143 0.630746617 0.573284671
144 0.490931108 0.630746617
145 0.367937365 0.490931108
146 -0.115743715 0.367937365
147 -0.162732355 -0.115743715
148 -0.010449995 -0.162732355
149 0.313836142 -0.010449995
150 0.608314154 0.313836142
151 0.332989316 0.608314154
152 0.296790646 0.332989316
153 0.371880256 0.296790646
154 0.706509216 0.371880256
155 0.418747800 0.706509216
156 0.406744445 0.418747800
157 -0.010086707 0.406744445
158 0.093385725 -0.010086707
159 0.320280273 0.093385725
160 0.358444638 0.320280273
161 0.327106466 0.358444638
162 0.078382823 0.327106466
163 0.267811732 0.078382823
164 0.350719613 0.267811732
165 0.015408276 0.350719613
166 -0.396457633 0.015408276
167 -0.856830730 -0.396457633
168 NA -0.856830730
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.051593021 -1.076692018
[2,] -0.861814748 -1.051593021
[3,] -0.603390997 -0.861814748
[4,] -0.245696247 -0.603390997
[5,] -0.194869462 -0.245696247
[6,] 0.044408077 -0.194869462
[7,] 0.101460113 0.044408077
[8,] 0.178955603 0.101460113
[9,] 0.248208986 0.178955603
[10,] 0.350884907 0.248208986
[11,] 0.955265558 0.350884907
[12,] 0.951543972 0.955265558
[13,] 1.104031288 0.951543972
[14,] 1.175126845 1.104031288
[15,] 1.333550597 1.175126845
[16,] 1.262585522 1.333550597
[17,] 1.381883103 1.262585522
[18,] 1.361395450 1.381883103
[19,] 1.473224123 1.361395450
[20,] 1.619614245 1.473224123
[21,] 1.721668338 1.619614245
[22,] 1.510226265 1.721668338
[23,] 1.612911573 1.510226265
[24,] 1.587214060 1.612911573
[25,] 1.430148100 1.587214060
[26,] 1.328631977 1.430148100
[27,] 1.150114134 1.328631977
[28,] 1.116090653 1.150114134
[29,] 1.071482157 1.116090653
[30,] 1.001206422 1.071482157
[31,] 0.953693737 1.001206422
[32,] 0.780977309 0.953693737
[33,] 0.741525088 0.780977309
[34,] 0.716388856 0.741525088
[35,] 0.883404077 0.716388856
[36,] 1.007494645 0.883404077
[37,] 1.019323318 1.007494645
[38,] 1.191266547 1.019323318
[39,] 1.067525342 1.191266547
[40,] 1.352608411 1.067525342
[41,] 1.298870476 1.352608411
[42,] 1.333583296 1.298870476
[43,] 1.304329490 1.333583296
[44,] 1.118342739 1.304329490
[45,] 0.983455238 1.118342739
[46,] 0.849613401 0.983455238
[47,] 0.975546144 0.849613401
[48,] 0.963542790 0.975546144
[49,] 1.085348573 0.963542790
[50,] 0.997526609 1.085348573
[51,] 0.955950360 0.997526609
[52,] 0.712373604 0.955950360
[53,] 0.644517674 0.712373604
[54,] 0.373394267 0.644517674
[55,] 0.248281346 0.373394267
[56,] 0.472271705 0.248281346
[57,] 0.656066919 0.472271705
[58,] 0.635919241 0.656066919
[59,] 0.843593105 0.635919241
[60,] 0.803777597 0.843593105
[61,] 0.555841077 0.803777597
[62,] 0.568442948 0.555841077
[63,] 0.426019028 0.568442948
[64,] 0.149641563 0.426019028
[65,] 0.278492419 0.149641563
[66,] 0.472546596 0.278492419
[67,] 0.762399341 0.472546596
[68,] 0.900083860 0.762399341
[69,] 0.787596122 0.900083860
[70,] 0.343353339 0.787596122
[71,] 0.299967614 0.343353339
[72,] 0.538600013 0.299967614
[73,] 0.354993406 0.538600013
[74,] -0.014993515 0.354993406
[75,] -0.129605280 -0.014993515
[76,] -0.008428288 -0.129605280
[77,] -0.011954306 -0.008428288
[78,] 0.168405712 -0.011954306
[79,] 0.107198868 0.168405712
[80,] -0.065517560 0.107198868
[81,] -0.200405061 -0.065517560
[82,] -0.530106013 -0.200405061
[83,] -0.585490555 -0.530106013
[84,] -0.792505355 -0.585490555
[85,] -0.944158923 -0.792505355
[86,] -0.981345134 -0.944158923
[87,] -0.913368108 -0.981345134
[88,] -1.224991825 -0.913368108
[89,] -1.369176485 -1.224991825
[90,] -1.461428149 -1.369176485
[91,] -1.495670510 -1.461428149
[92,] -1.562974546 -1.495670510
[93,] -1.282896382 -1.562974546
[94,] -1.253255977 -1.282896382
[95,] -1.086240756 -1.253255977
[96,] -1.101961159 -1.086240756
[97,] -1.281850717 -1.101961159
[98,] -1.264684126 -1.281850717
[99,] -1.762308519 -1.264684126
[100,] -2.237838314 -1.762308519
[101,] -2.332234892 -2.237838314
[102,] -2.239028386 -2.332234892
[103,] -1.553316525 -2.239028386
[104,] -1.215632006 -1.553316525
[105,] -1.500731425 -1.215632006
[106,] -1.917162054 -1.500731425
[107,] -2.082099871 -1.917162054
[108,] -1.904080336 -2.082099871
[109,] -1.064863345 -1.904080336
[110,] -1.007461946 -1.064863345
[111,] -0.903814833 -1.007461946
[112,] -0.618307928 -0.903814833
[113,] -0.858775539 -0.618307928
[114,] -0.774274637 -0.858775539
[115,] -1.200659065 -0.774274637
[116,] -1.441846290 -1.200659065
[117,] -1.636498984 -1.441846290
[118,] -1.242528666 -1.636498984
[119,] -1.525725363 -1.242528666
[120,] -1.360552316 -1.525725363
[121,] -1.048723643 -1.360552316
[122,] -0.877628085 -1.048723643
[123,] -0.673557136 -0.877628085
[124,] -0.689745573 -0.673557136
[125,] -0.465035601 -0.689745573
[126,] -0.489664139 -0.465035601
[127,] -0.551294818 -0.489664139
[128,] -0.874223164 -0.551294818
[129,] -0.498709719 -0.874223164
[130,] -0.346669551 -0.498709719
[131,] -0.483795213 -0.346669551
[132,] -0.514057447 -0.483795213
[133,] -0.516346769 -0.514057447
[134,] -0.230709381 -0.516346769
[135,] -0.104662504 -0.230709381
[136,] 0.083713779 -0.104662504
[137,] -0.084142151 0.083713779
[138,] -0.477241486 -0.084142151
[139,] -0.750447147 -0.477241486
[140,] -0.557562156 -0.750447147
[141,] -0.406567652 -0.557562156
[142,] 0.573284671 -0.406567652
[143,] 0.630746617 0.573284671
[144,] 0.490931108 0.630746617
[145,] 0.367937365 0.490931108
[146,] -0.115743715 0.367937365
[147,] -0.162732355 -0.115743715
[148,] -0.010449995 -0.162732355
[149,] 0.313836142 -0.010449995
[150,] 0.608314154 0.313836142
[151,] 0.332989316 0.608314154
[152,] 0.296790646 0.332989316
[153,] 0.371880256 0.296790646
[154,] 0.706509216 0.371880256
[155,] 0.418747800 0.706509216
[156,] 0.406744445 0.418747800
[157,] -0.010086707 0.406744445
[158,] 0.093385725 -0.010086707
[159,] 0.320280273 0.093385725
[160,] 0.358444638 0.320280273
[161,] 0.327106466 0.358444638
[162,] 0.078382823 0.327106466
[163,] 0.267811732 0.078382823
[164,] 0.350719613 0.267811732
[165,] 0.015408276 0.350719613
[166,] -0.396457633 0.015408276
[167,] -0.856830730 -0.396457633
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.051593021 -1.076692018
2 -0.861814748 -1.051593021
3 -0.603390997 -0.861814748
4 -0.245696247 -0.603390997
5 -0.194869462 -0.245696247
6 0.044408077 -0.194869462
7 0.101460113 0.044408077
8 0.178955603 0.101460113
9 0.248208986 0.178955603
10 0.350884907 0.248208986
11 0.955265558 0.350884907
12 0.951543972 0.955265558
13 1.104031288 0.951543972
14 1.175126845 1.104031288
15 1.333550597 1.175126845
16 1.262585522 1.333550597
17 1.381883103 1.262585522
18 1.361395450 1.381883103
19 1.473224123 1.361395450
20 1.619614245 1.473224123
21 1.721668338 1.619614245
22 1.510226265 1.721668338
23 1.612911573 1.510226265
24 1.587214060 1.612911573
25 1.430148100 1.587214060
26 1.328631977 1.430148100
27 1.150114134 1.328631977
28 1.116090653 1.150114134
29 1.071482157 1.116090653
30 1.001206422 1.071482157
31 0.953693737 1.001206422
32 0.780977309 0.953693737
33 0.741525088 0.780977309
34 0.716388856 0.741525088
35 0.883404077 0.716388856
36 1.007494645 0.883404077
37 1.019323318 1.007494645
38 1.191266547 1.019323318
39 1.067525342 1.191266547
40 1.352608411 1.067525342
41 1.298870476 1.352608411
42 1.333583296 1.298870476
43 1.304329490 1.333583296
44 1.118342739 1.304329490
45 0.983455238 1.118342739
46 0.849613401 0.983455238
47 0.975546144 0.849613401
48 0.963542790 0.975546144
49 1.085348573 0.963542790
50 0.997526609 1.085348573
51 0.955950360 0.997526609
52 0.712373604 0.955950360
53 0.644517674 0.712373604
54 0.373394267 0.644517674
55 0.248281346 0.373394267
56 0.472271705 0.248281346
57 0.656066919 0.472271705
58 0.635919241 0.656066919
59 0.843593105 0.635919241
60 0.803777597 0.843593105
61 0.555841077 0.803777597
62 0.568442948 0.555841077
63 0.426019028 0.568442948
64 0.149641563 0.426019028
65 0.278492419 0.149641563
66 0.472546596 0.278492419
67 0.762399341 0.472546596
68 0.900083860 0.762399341
69 0.787596122 0.900083860
70 0.343353339 0.787596122
71 0.299967614 0.343353339
72 0.538600013 0.299967614
73 0.354993406 0.538600013
74 -0.014993515 0.354993406
75 -0.129605280 -0.014993515
76 -0.008428288 -0.129605280
77 -0.011954306 -0.008428288
78 0.168405712 -0.011954306
79 0.107198868 0.168405712
80 -0.065517560 0.107198868
81 -0.200405061 -0.065517560
82 -0.530106013 -0.200405061
83 -0.585490555 -0.530106013
84 -0.792505355 -0.585490555
85 -0.944158923 -0.792505355
86 -0.981345134 -0.944158923
87 -0.913368108 -0.981345134
88 -1.224991825 -0.913368108
89 -1.369176485 -1.224991825
90 -1.461428149 -1.369176485
91 -1.495670510 -1.461428149
92 -1.562974546 -1.495670510
93 -1.282896382 -1.562974546
94 -1.253255977 -1.282896382
95 -1.086240756 -1.253255977
96 -1.101961159 -1.086240756
97 -1.281850717 -1.101961159
98 -1.264684126 -1.281850717
99 -1.762308519 -1.264684126
100 -2.237838314 -1.762308519
101 -2.332234892 -2.237838314
102 -2.239028386 -2.332234892
103 -1.553316525 -2.239028386
104 -1.215632006 -1.553316525
105 -1.500731425 -1.215632006
106 -1.917162054 -1.500731425
107 -2.082099871 -1.917162054
108 -1.904080336 -2.082099871
109 -1.064863345 -1.904080336
110 -1.007461946 -1.064863345
111 -0.903814833 -1.007461946
112 -0.618307928 -0.903814833
113 -0.858775539 -0.618307928
114 -0.774274637 -0.858775539
115 -1.200659065 -0.774274637
116 -1.441846290 -1.200659065
117 -1.636498984 -1.441846290
118 -1.242528666 -1.636498984
119 -1.525725363 -1.242528666
120 -1.360552316 -1.525725363
121 -1.048723643 -1.360552316
122 -0.877628085 -1.048723643
123 -0.673557136 -0.877628085
124 -0.689745573 -0.673557136
125 -0.465035601 -0.689745573
126 -0.489664139 -0.465035601
127 -0.551294818 -0.489664139
128 -0.874223164 -0.551294818
129 -0.498709719 -0.874223164
130 -0.346669551 -0.498709719
131 -0.483795213 -0.346669551
132 -0.514057447 -0.483795213
133 -0.516346769 -0.514057447
134 -0.230709381 -0.516346769
135 -0.104662504 -0.230709381
136 0.083713779 -0.104662504
137 -0.084142151 0.083713779
138 -0.477241486 -0.084142151
139 -0.750447147 -0.477241486
140 -0.557562156 -0.750447147
141 -0.406567652 -0.557562156
142 0.573284671 -0.406567652
143 0.630746617 0.573284671
144 0.490931108 0.630746617
145 0.367937365 0.490931108
146 -0.115743715 0.367937365
147 -0.162732355 -0.115743715
148 -0.010449995 -0.162732355
149 0.313836142 -0.010449995
150 0.608314154 0.313836142
151 0.332989316 0.608314154
152 0.296790646 0.332989316
153 0.371880256 0.296790646
154 0.706509216 0.371880256
155 0.418747800 0.706509216
156 0.406744445 0.418747800
157 -0.010086707 0.406744445
158 0.093385725 -0.010086707
159 0.320280273 0.093385725
160 0.358444638 0.320280273
161 0.327106466 0.358444638
162 0.078382823 0.327106466
163 0.267811732 0.078382823
164 0.350719613 0.267811732
165 0.015408276 0.350719613
166 -0.396457633 0.015408276
167 -0.856830730 -0.396457633
> 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/75oip1258725647.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/8whlr1258725647.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/9zh1l1258725647.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/10ry121258725647.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/11pjdj1258725647.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/12jzwg1258725648.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/13tc2u1258725648.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/14slbt1258725648.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/15fyak1258725648.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/16kt2r1258725648.tab")
+ }
> system("convert tmp/1g0081258725647.ps tmp/1g0081258725647.png")
> system("convert tmp/29q8d1258725647.ps tmp/29q8d1258725647.png")
> system("convert tmp/3yclh1258725647.ps tmp/3yclh1258725647.png")
> system("convert tmp/4b2mh1258725647.ps tmp/4b2mh1258725647.png")
> system("convert tmp/5jwmq1258725647.ps tmp/5jwmq1258725647.png")
> system("convert tmp/6qyk61258725647.ps tmp/6qyk61258725647.png")
> system("convert tmp/75oip1258725647.ps tmp/75oip1258725647.png")
> system("convert tmp/8whlr1258725647.ps tmp/8whlr1258725647.png")
> system("convert tmp/9zh1l1258725647.ps tmp/9zh1l1258725647.png")
> system("convert tmp/10ry121258725647.ps tmp/10ry121258725647.png")
>
>
> proc.time()
user system elapsed
4.205 1.693 4.741