R version 2.8.0 (2008-10-20)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> x <- array(list(4
+ ,4
+ ,3
+ ,3
+ ,2
+ ,2
+ ,2
+ ,2
+ ,2
+ ,4
+ ,2
+ ,4
+ ,2
+ ,3
+ ,1
+ ,1
+ ,2
+ ,3
+ ,3
+ ,2
+ ,2
+ ,1
+ ,2
+ ,2
+ ,5
+ ,4
+ ,4
+ ,3
+ ,4
+ ,3
+ ,2
+ ,2
+ ,4
+ ,4
+ ,4
+ ,2
+ ,2
+ ,1
+ ,1
+ ,2
+ ,4
+ ,4
+ ,4
+ ,4
+ ,2
+ ,3
+ ,3
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,2
+ ,2
+ ,1
+ ,1
+ ,2
+ ,3
+ ,4
+ ,4
+ ,2
+ ,3
+ ,3
+ ,2
+ ,3
+ ,3
+ ,4
+ ,4
+ ,3
+ ,4
+ ,1
+ ,2
+ ,2
+ ,2
+ ,2
+ ,3
+ ,2
+ ,2
+ ,1
+ ,3
+ ,1
+ ,2
+ ,4
+ ,3
+ ,4
+ ,3
+ ,4
+ ,3
+ ,4
+ ,4
+ ,1
+ ,2
+ ,2
+ ,2
+ ,4
+ ,4
+ ,4
+ ,3
+ ,5
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,4
+ ,4
+ ,3
+ ,3
+ ,4
+ ,4
+ ,3
+ ,3
+ ,2
+ ,2
+ ,2
+ ,2
+ ,2
+ ,2
+ ,2
+ ,2
+ ,4
+ ,4
+ ,2
+ ,4
+ ,4
+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(c('Q1','Q2','Q3','Q4
'),1:156))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'Linear Trend'
> par2 = 'Include Monthly Dummies'
> par1 = '4'
> #'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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0 0 0 0 0 1 0 118
119 3 4 4 4 0 0 0 0 0 0 0 0 0 0 1 119
120 2 3 3 4 0 0 0 0 0 0 0 0 0 0 0 120
121 3 3 3 3 1 0 0 0 0 0 0 0 0 0 0 121
122 4 4 4 4 0 1 0 0 0 0 0 0 0 0 0 122
123 2 2 2 3 0 0 1 0 0 0 0 0 0 0 0 123
124 4 4 3 4 0 0 0 1 0 0 0 0 0 0 0 124
125 4 4 4 3 0 0 0 0 1 0 0 0 0 0 0 125
126 2 1 1 2 0 0 0 0 0 1 0 0 0 0 0 126
127 3 4 4 3 0 0 0 0 0 0 1 0 0 0 0 127
128 3 4 4 4 0 0 0 0 0 0 0 1 0 0 0 128
129 3 3 2 2 0 0 0 0 0 0 0 0 1 0 0 129
130 3 1 1 1 0 0 0 0 0 0 0 0 0 1 0 130
131 4 4 4 2 0 0 0 0 0 0 0 0 0 0 1 131
132 3 3 2 4 0 0 0 0 0 0 0 0 0 0 0 132
133 2 2 2 2 1 0 0 0 0 0 0 0 0 0 0 133
134 3 3 3 2 0 1 0 0 0 0 0 0 0 0 0 134
135 3 4 3 3 0 0 1 0 0 0 0 0 0 0 0 135
136 3 2 2 2 0 0 0 1 0 0 0 0 0 0 0 136
137 4 4 3 4 0 0 0 0 1 0 0 0 0 0 0 137
138 3 4 3 3 0 0 0 0 0 1 0 0 0 0 0 138
139 4 3 4 4 0 0 0 0 0 0 1 0 0 0 0 139
140 4 4 3 3 0 0 0 0 0 0 0 1 0 0 0 140
141 4 4 4 4 0 0 0 0 0 0 0 0 1 0 0 141
142 3 4 3 4 0 0 0 0 0 0 0 0 0 1 0 142
143 3 4 4 3 0 0 0 0 0 0 0 0 0 0 1 143
144 2 3 3 2 0 0 0 0 0 0 0 0 0 0 0 144
145 3 3 2 2 1 0 0 0 0 0 0 0 0 0 0 145
146 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 146
147 2 2 2 2 0 0 1 0 0 0 0 0 0 0 0 147
148 4 4 4 3 0 0 0 1 0 0 0 0 0 0 0 148
149 4 4 4 4 0 0 0 0 1 0 0 0 0 0 0 149
150 3 3 3 3 0 0 0 0 0 1 0 0 0 0 0 150
151 3 3 3 3 0 0 0 0 0 0 1 0 0 0 0 151
152 4 4 3 4 0 0 0 0 0 0 0 1 0 0 0 152
153 2 3 2 2 0 0 0 0 0 0 0 0 1 0 0 153
154 4 4 NA 4 0 0 0 0 0 0 0 0 0 1 0 154
155 3 4 4 3 0 0 0 0 0 0 0 0 0 0 1 155
156 3 4 2 2 0 0 0 0 0 0 0 0 0 0 0 156
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Q1 Q2 Q3 M1 M2
0.865046 0.145400 0.252561 0.220272 -0.077694 -0.135577
M3 M4 M5 M6 M7 M8
0.071660 0.097698 0.278052 0.056742 0.133278 0.087319
M9 M10 M11 t
0.121227 0.207612 0.230803 0.002075
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.79614 -0.46164 -0.02281 0.42775 1.54526
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.865046 0.261534 3.308 0.00120 **
Q1 0.145400 0.067585 2.151 0.03319 *
Q2 0.252561 0.076826 3.287 0.00128 **
Q3 0.220272 0.072113 3.055 0.00271 **
M1 -0.077694 0.258216 -0.301 0.76395
M2 -0.135577 0.259051 -0.523 0.60156
M3 0.071660 0.256919 0.279 0.78072
M4 0.097698 0.259071 0.377 0.70667
M5 0.278052 0.255952 1.086 0.27922
M6 0.056742 0.255813 0.222 0.82479
M7 0.133278 0.257550 0.517 0.60565
M8 0.087319 0.265127 0.329 0.74239
M9 0.121227 0.259243 0.468 0.64079
M10 0.207612 0.261986 0.792 0.42946
M11 0.230803 0.256484 0.900 0.36976
t 0.002075 0.001186 1.750 0.08233 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.6464 on 138 degrees of freedom
(2 observations deleted due to missingness)
Multiple R-squared: 0.4921, Adjusted R-squared: 0.4369
F-statistic: 8.913 on 15 and 138 DF, p-value: 3.716e-14
> 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.6619287 0.67614251 0.338071255
[2,] 0.5318880 0.93622399 0.468111993
[3,] 0.5567617 0.88647655 0.443238273
[4,] 0.4713865 0.94277307 0.528613465
[5,] 0.3682480 0.73649596 0.631752022
[6,] 0.3937281 0.78745628 0.606271861
[7,] 0.4587933 0.91758655 0.541206723
[8,] 0.4706585 0.94131696 0.529341521
[9,] 0.7687370 0.46252597 0.231262987
[10,] 0.7164158 0.56716835 0.283584176
[11,] 0.6602666 0.67946681 0.339733405
[12,] 0.6685651 0.66286975 0.331434875
[13,] 0.6003142 0.79937167 0.399685834
[14,] 0.7220684 0.55586328 0.277931639
[15,] 0.6831019 0.63379625 0.316898127
[16,] 0.6483972 0.70320567 0.351602837
[17,] 0.8007364 0.39852714 0.199263570
[18,] 0.7614387 0.47712269 0.238561344
[19,] 0.7234908 0.55301838 0.276509192
[20,] 0.6663121 0.66737589 0.333687947
[21,] 0.7258917 0.54821664 0.274108320
[22,] 0.7576906 0.48461871 0.242309353
[23,] 0.7905610 0.41887793 0.209438963
[24,] 0.7515556 0.49688875 0.248444376
[25,] 0.8766683 0.24666339 0.123331696
[26,] 0.8645930 0.27081399 0.135406996
[27,] 0.8934814 0.21303729 0.106518647
[28,] 0.8792460 0.24150793 0.120753963
[29,] 0.8581803 0.28363933 0.141819667
[30,] 0.8448241 0.31035183 0.155175917
[31,] 0.8108781 0.37824382 0.189121908
[32,] 0.8091183 0.38176340 0.190881702
[33,] 0.7894474 0.42110520 0.210552602
[34,] 0.9364733 0.12705331 0.063526655
[35,] 0.9180384 0.16392320 0.081961598
[36,] 0.9055943 0.18881144 0.094405720
[37,] 0.9498869 0.10022611 0.050113057
[38,] 0.9396106 0.12077874 0.060389368
[39,] 0.9224027 0.15519458 0.077597288
[40,] 0.9043002 0.19139954 0.095699768
[41,] 0.9604097 0.07918062 0.039590310
[42,] 0.9645278 0.07094447 0.035472234
[43,] 0.9608449 0.07831023 0.039155113
[44,] 0.9604030 0.07919398 0.039596989
[45,] 0.9536337 0.09273266 0.046366329
[46,] 0.9688676 0.06226475 0.031132373
[47,] 0.9607023 0.07859533 0.039297665
[48,] 0.9497644 0.10047126 0.050235631
[49,] 0.9502474 0.09950529 0.049752643
[50,] 0.9369516 0.12609671 0.063048356
[51,] 0.9571810 0.08563810 0.042819048
[52,] 0.9703611 0.05927778 0.029638892
[53,] 0.9705235 0.05895291 0.029476454
[54,] 0.9636376 0.07272470 0.036362351
[55,] 0.9688681 0.06226374 0.031131869
[56,] 0.9908791 0.01824186 0.009120929
[57,] 0.9882942 0.02341155 0.011705775
[58,] 0.9911029 0.01779417 0.008897085
[59,] 0.9920183 0.01596347 0.007981735
[60,] 0.9889056 0.02218872 0.011094359
[61,] 0.9907907 0.01841863 0.009209313
[62,] 0.9871268 0.02574634 0.012873172
[63,] 0.9828220 0.03435592 0.017177962
[64,] 0.9790315 0.04193691 0.020968455
[65,] 0.9754518 0.04909632 0.024548161
[66,] 0.9763681 0.04726380 0.023631898
[67,] 0.9745653 0.05086934 0.025434669
[68,] 0.9662302 0.06753969 0.033769847
[69,] 0.9591471 0.08170586 0.040852932
[70,] 0.9512896 0.09742077 0.048710387
[71,] 0.9591517 0.08169668 0.040848341
[72,] 0.9564600 0.08707999 0.043539993
[73,] 0.9485321 0.10293590 0.051467949
[74,] 0.9446079 0.11078417 0.055392086
[75,] 0.9305403 0.13891946 0.069459731
[76,] 0.9138480 0.17230391 0.086151956
[77,] 0.9010329 0.19793414 0.098967068
[78,] 0.8809775 0.23804506 0.119022531
[79,] 0.8726235 0.25475298 0.127376491
[80,] 0.8427813 0.31443749 0.157218743
[81,] 0.8160329 0.36793412 0.183967061
[82,] 0.7879615 0.42407696 0.212038478
[83,] 0.8333134 0.33337317 0.166686587
[84,] 0.8199926 0.36001473 0.180007364
[85,] 0.8953653 0.20926931 0.104634656
[86,] 0.9138810 0.17223808 0.086119041
[87,] 0.8909152 0.21816957 0.109084784
[88,] 0.8664528 0.26709437 0.133547183
[89,] 0.8982397 0.20352066 0.101760331
[90,] 0.9067950 0.18641007 0.093205035
[91,] 0.9015131 0.19697378 0.098486892
[92,] 0.8732556 0.25348887 0.126744437
[93,] 0.8543596 0.29128081 0.145640404
[94,] 0.8500270 0.29994591 0.149972956
[95,] 0.8131732 0.37365350 0.186826750
[96,] 0.7676903 0.46461935 0.232309675
[97,] 0.7446205 0.51075900 0.255379501
[98,] 0.7933970 0.41320607 0.206603037
[99,] 0.7976394 0.40472126 0.202360629
[100,] 0.7875746 0.42485085 0.212425423
[101,] 0.8314597 0.33708052 0.168540260
[102,] 0.7802467 0.43950653 0.219753265
[103,] 0.7746186 0.45076276 0.225381379
[104,] 0.7298926 0.54021486 0.270107430
[105,] 0.6699756 0.66004887 0.330024433
[106,] 0.5952584 0.80948316 0.404741578
[107,] 0.5146822 0.97063557 0.485317784
[108,] 0.5807327 0.83853454 0.419267271
[109,] 0.8022737 0.39545262 0.197726312
[110,] 0.7305355 0.53892892 0.269464460
[111,] 0.8911091 0.21778180 0.108890901
[112,] 0.9596638 0.08067235 0.040336173
[113,] 0.9295010 0.14099808 0.070499038
[114,] 0.9194604 0.16107923 0.080539615
[115,] 0.9066794 0.18664114 0.093320572
[116,] 0.8421076 0.31578482 0.157892409
[117,] 0.7525111 0.49497788 0.247488941
[118,] 0.5565768 0.88684633 0.443423165
[119,] 0.5918122 0.81637554 0.408187768
> postscript(file="/var/www/html/freestat/rcomp/tmp/1tdzz1291202429.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)
Warning message:
In x[, 1] - mysum$resid :
longer object length is not a multiple of shorter object length
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/2tdzz1291202429.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/34myk1291202429.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/44myk1291202429.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/54myk1291202429.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 = 154
Frequency = 1
1 2 3 4 5 6
-0.042088001 0.029914043 1.315480218 -1.239799392 -0.862772828 0.081856780
7 8 9 10 11 12
-0.631182520 -0.748792655 -1.477881307 0.142959239 0.408393205 0.400754461
13 14 15 16 17 18
0.712740419 -0.790907441 1.193664485 -0.028332132 0.219489134 0.788201747
19 20 21 22 23 24
-0.128814576 -0.482891822 -0.153202114 -0.338679451 0.636055173 -0.005911162
25 26 27 28 29 30
-0.312158760 0.598248570 -0.465662956 -0.273503713 -0.455932344 -0.220502724
31 32 33 34 35 36
-0.299113761 0.948847841 -0.275118518 0.840599735 -0.990882853 0.587322543
37 38 39 40 41 42
0.721720420 -0.044783493 -0.270289732 0.481324706 0.917129630 0.372831652
43 44 45 46 47 48
-1.544285342 -0.570929045 0.904160669 -0.275366547 0.586256816 0.164562882
49 50 51 52 53 54
0.288565182 0.693850218 0.339239351 -1.796135619 -0.075480804 -0.377462222
55 56 57 58 59 60
0.850820790 -0.321222919 0.115627929 0.334061866 1.545263600 0.790085332
61 62 63 64 65 66
-0.150389187 0.668951040 -0.158594047 0.829487502 -0.041601624 -0.058833821
67 68 69 70 71 72
-0.610278407 -0.109654988 1.015856354 -0.836136648 -0.463541542 0.017747300
73 74 75 76 77 78
-0.718649524 -1.355948139 0.052973884 -0.593372830 -0.630401455 -0.158605396
79 80 81 82 83 84
0.821561926 0.043134584 -0.170536868 -0.242902943 -0.375329459 -0.679718336
85 86 87 88 89 90
0.418046011 0.237386237 -0.353691740 0.252522693 -0.548139493 -0.490398623
91 92 93 94 95 96
0.430990339 -0.143359309 0.347824442 0.259364330 0.030021260 -0.300706241
97 98 99 100 101 102
-0.606853168 -0.023879381 -0.362496882 0.120462374 1.174400181 0.539035100
103 105 106 107 108 109
1.389896453 -0.822374072 0.218371115 0.154866873 0.690488617 -0.647947054
110 111 112 113 114 115
-0.264706176 0.053148744 0.691651921 -0.468631881 -0.158430536 0.015519573
116 117 118 119 120 121
0.806842334 0.588826097 -0.553966918 -0.815699403 -1.189010555 0.106881365
122 123 124 125 126 127
0.544455146 -0.648661678 0.559591602 0.344874226 -0.021735001 -0.514501898
128 129 130 131 132 133
-0.690890393 0.364194009 1.039367459 0.599946223 0.038651413 -0.299784259
134 135 136 137 138 139
0.358061924 -0.216922016 0.518598386 0.352263792 -0.208228893 0.385726527
140 141 142 143 144 145
0.757043977 0.248227727 -0.587671238 -0.645225358 -0.798264108 0.529916556
146 147 148 149 150 151
-0.650642547 -0.478187633 0.477504500 0.074803467 -0.087728066 -0.166339103
152 153 155 156
0.511872396 -0.685604348 -0.670124537 0.283997853
> postscript(file="/var/www/html/freestat/rcomp/tmp/6evgm1291202429.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 = 154
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.042088001 NA
1 0.029914043 -0.042088001
2 1.315480218 0.029914043
3 -1.239799392 1.315480218
4 -0.862772828 -1.239799392
5 0.081856780 -0.862772828
6 -0.631182520 0.081856780
7 -0.748792655 -0.631182520
8 -1.477881307 -0.748792655
9 0.142959239 -1.477881307
10 0.408393205 0.142959239
11 0.400754461 0.408393205
12 0.712740419 0.400754461
13 -0.790907441 0.712740419
14 1.193664485 -0.790907441
15 -0.028332132 1.193664485
16 0.219489134 -0.028332132
17 0.788201747 0.219489134
18 -0.128814576 0.788201747
19 -0.482891822 -0.128814576
20 -0.153202114 -0.482891822
21 -0.338679451 -0.153202114
22 0.636055173 -0.338679451
23 -0.005911162 0.636055173
24 -0.312158760 -0.005911162
25 0.598248570 -0.312158760
26 -0.465662956 0.598248570
27 -0.273503713 -0.465662956
28 -0.455932344 -0.273503713
29 -0.220502724 -0.455932344
30 -0.299113761 -0.220502724
31 0.948847841 -0.299113761
32 -0.275118518 0.948847841
33 0.840599735 -0.275118518
34 -0.990882853 0.840599735
35 0.587322543 -0.990882853
36 0.721720420 0.587322543
37 -0.044783493 0.721720420
38 -0.270289732 -0.044783493
39 0.481324706 -0.270289732
40 0.917129630 0.481324706
41 0.372831652 0.917129630
42 -1.544285342 0.372831652
43 -0.570929045 -1.544285342
44 0.904160669 -0.570929045
45 -0.275366547 0.904160669
46 0.586256816 -0.275366547
47 0.164562882 0.586256816
48 0.288565182 0.164562882
49 0.693850218 0.288565182
50 0.339239351 0.693850218
51 -1.796135619 0.339239351
52 -0.075480804 -1.796135619
53 -0.377462222 -0.075480804
54 0.850820790 -0.377462222
55 -0.321222919 0.850820790
56 0.115627929 -0.321222919
57 0.334061866 0.115627929
58 1.545263600 0.334061866
59 0.790085332 1.545263600
60 -0.150389187 0.790085332
61 0.668951040 -0.150389187
62 -0.158594047 0.668951040
63 0.829487502 -0.158594047
64 -0.041601624 0.829487502
65 -0.058833821 -0.041601624
66 -0.610278407 -0.058833821
67 -0.109654988 -0.610278407
68 1.015856354 -0.109654988
69 -0.836136648 1.015856354
70 -0.463541542 -0.836136648
71 0.017747300 -0.463541542
72 -0.718649524 0.017747300
73 -1.355948139 -0.718649524
74 0.052973884 -1.355948139
75 -0.593372830 0.052973884
76 -0.630401455 -0.593372830
77 -0.158605396 -0.630401455
78 0.821561926 -0.158605396
79 0.043134584 0.821561926
80 -0.170536868 0.043134584
81 -0.242902943 -0.170536868
82 -0.375329459 -0.242902943
83 -0.679718336 -0.375329459
84 0.418046011 -0.679718336
85 0.237386237 0.418046011
86 -0.353691740 0.237386237
87 0.252522693 -0.353691740
88 -0.548139493 0.252522693
89 -0.490398623 -0.548139493
90 0.430990339 -0.490398623
91 -0.143359309 0.430990339
92 0.347824442 -0.143359309
93 0.259364330 0.347824442
94 0.030021260 0.259364330
95 -0.300706241 0.030021260
96 -0.606853168 -0.300706241
97 -0.023879381 -0.606853168
98 -0.362496882 -0.023879381
99 0.120462374 -0.362496882
100 1.174400181 0.120462374
101 0.539035100 1.174400181
102 1.389896453 0.539035100
103 -0.822374072 1.389896453
104 0.218371115 -0.822374072
105 0.154866873 0.218371115
106 0.690488617 0.154866873
107 -0.647947054 0.690488617
108 -0.264706176 -0.647947054
109 0.053148744 -0.264706176
110 0.691651921 0.053148744
111 -0.468631881 0.691651921
112 -0.158430536 -0.468631881
113 0.015519573 -0.158430536
114 0.806842334 0.015519573
115 0.588826097 0.806842334
116 -0.553966918 0.588826097
117 -0.815699403 -0.553966918
118 -1.189010555 -0.815699403
119 0.106881365 -1.189010555
120 0.544455146 0.106881365
121 -0.648661678 0.544455146
122 0.559591602 -0.648661678
123 0.344874226 0.559591602
124 -0.021735001 0.344874226
125 -0.514501898 -0.021735001
126 -0.690890393 -0.514501898
127 0.364194009 -0.690890393
128 1.039367459 0.364194009
129 0.599946223 1.039367459
130 0.038651413 0.599946223
131 -0.299784259 0.038651413
132 0.358061924 -0.299784259
133 -0.216922016 0.358061924
134 0.518598386 -0.216922016
135 0.352263792 0.518598386
136 -0.208228893 0.352263792
137 0.385726527 -0.208228893
138 0.757043977 0.385726527
139 0.248227727 0.757043977
140 -0.587671238 0.248227727
141 -0.645225358 -0.587671238
142 -0.798264108 -0.645225358
143 0.529916556 -0.798264108
144 -0.650642547 0.529916556
145 -0.478187633 -0.650642547
146 0.477504500 -0.478187633
147 0.074803467 0.477504500
148 -0.087728066 0.074803467
149 -0.166339103 -0.087728066
150 0.511872396 -0.166339103
151 -0.685604348 0.511872396
152 -0.670124537 -0.685604348
153 0.283997853 -0.670124537
154 NA 0.283997853
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.029914043 -0.042088001
[2,] 1.315480218 0.029914043
[3,] -1.239799392 1.315480218
[4,] -0.862772828 -1.239799392
[5,] 0.081856780 -0.862772828
[6,] -0.631182520 0.081856780
[7,] -0.748792655 -0.631182520
[8,] -1.477881307 -0.748792655
[9,] 0.142959239 -1.477881307
[10,] 0.408393205 0.142959239
[11,] 0.400754461 0.408393205
[12,] 0.712740419 0.400754461
[13,] -0.790907441 0.712740419
[14,] 1.193664485 -0.790907441
[15,] -0.028332132 1.193664485
[16,] 0.219489134 -0.028332132
[17,] 0.788201747 0.219489134
[18,] -0.128814576 0.788201747
[19,] -0.482891822 -0.128814576
[20,] -0.153202114 -0.482891822
[21,] -0.338679451 -0.153202114
[22,] 0.636055173 -0.338679451
[23,] -0.005911162 0.636055173
[24,] -0.312158760 -0.005911162
[25,] 0.598248570 -0.312158760
[26,] -0.465662956 0.598248570
[27,] -0.273503713 -0.465662956
[28,] -0.455932344 -0.273503713
[29,] -0.220502724 -0.455932344
[30,] -0.299113761 -0.220502724
[31,] 0.948847841 -0.299113761
[32,] -0.275118518 0.948847841
[33,] 0.840599735 -0.275118518
[34,] -0.990882853 0.840599735
[35,] 0.587322543 -0.990882853
[36,] 0.721720420 0.587322543
[37,] -0.044783493 0.721720420
[38,] -0.270289732 -0.044783493
[39,] 0.481324706 -0.270289732
[40,] 0.917129630 0.481324706
[41,] 0.372831652 0.917129630
[42,] -1.544285342 0.372831652
[43,] -0.570929045 -1.544285342
[44,] 0.904160669 -0.570929045
[45,] -0.275366547 0.904160669
[46,] 0.586256816 -0.275366547
[47,] 0.164562882 0.586256816
[48,] 0.288565182 0.164562882
[49,] 0.693850218 0.288565182
[50,] 0.339239351 0.693850218
[51,] -1.796135619 0.339239351
[52,] -0.075480804 -1.796135619
[53,] -0.377462222 -0.075480804
[54,] 0.850820790 -0.377462222
[55,] -0.321222919 0.850820790
[56,] 0.115627929 -0.321222919
[57,] 0.334061866 0.115627929
[58,] 1.545263600 0.334061866
[59,] 0.790085332 1.545263600
[60,] -0.150389187 0.790085332
[61,] 0.668951040 -0.150389187
[62,] -0.158594047 0.668951040
[63,] 0.829487502 -0.158594047
[64,] -0.041601624 0.829487502
[65,] -0.058833821 -0.041601624
[66,] -0.610278407 -0.058833821
[67,] -0.109654988 -0.610278407
[68,] 1.015856354 -0.109654988
[69,] -0.836136648 1.015856354
[70,] -0.463541542 -0.836136648
[71,] 0.017747300 -0.463541542
[72,] -0.718649524 0.017747300
[73,] -1.355948139 -0.718649524
[74,] 0.052973884 -1.355948139
[75,] -0.593372830 0.052973884
[76,] -0.630401455 -0.593372830
[77,] -0.158605396 -0.630401455
[78,] 0.821561926 -0.158605396
[79,] 0.043134584 0.821561926
[80,] -0.170536868 0.043134584
[81,] -0.242902943 -0.170536868
[82,] -0.375329459 -0.242902943
[83,] -0.679718336 -0.375329459
[84,] 0.418046011 -0.679718336
[85,] 0.237386237 0.418046011
[86,] -0.353691740 0.237386237
[87,] 0.252522693 -0.353691740
[88,] -0.548139493 0.252522693
[89,] -0.490398623 -0.548139493
[90,] 0.430990339 -0.490398623
[91,] -0.143359309 0.430990339
[92,] 0.347824442 -0.143359309
[93,] 0.259364330 0.347824442
[94,] 0.030021260 0.259364330
[95,] -0.300706241 0.030021260
[96,] -0.606853168 -0.300706241
[97,] -0.023879381 -0.606853168
[98,] -0.362496882 -0.023879381
[99,] 0.120462374 -0.362496882
[100,] 1.174400181 0.120462374
[101,] 0.539035100 1.174400181
[102,] 1.389896453 0.539035100
[103,] -0.822374072 1.389896453
[104,] 0.218371115 -0.822374072
[105,] 0.154866873 0.218371115
[106,] 0.690488617 0.154866873
[107,] -0.647947054 0.690488617
[108,] -0.264706176 -0.647947054
[109,] 0.053148744 -0.264706176
[110,] 0.691651921 0.053148744
[111,] -0.468631881 0.691651921
[112,] -0.158430536 -0.468631881
[113,] 0.015519573 -0.158430536
[114,] 0.806842334 0.015519573
[115,] 0.588826097 0.806842334
[116,] -0.553966918 0.588826097
[117,] -0.815699403 -0.553966918
[118,] -1.189010555 -0.815699403
[119,] 0.106881365 -1.189010555
[120,] 0.544455146 0.106881365
[121,] -0.648661678 0.544455146
[122,] 0.559591602 -0.648661678
[123,] 0.344874226 0.559591602
[124,] -0.021735001 0.344874226
[125,] -0.514501898 -0.021735001
[126,] -0.690890393 -0.514501898
[127,] 0.364194009 -0.690890393
[128,] 1.039367459 0.364194009
[129,] 0.599946223 1.039367459
[130,] 0.038651413 0.599946223
[131,] -0.299784259 0.038651413
[132,] 0.358061924 -0.299784259
[133,] -0.216922016 0.358061924
[134,] 0.518598386 -0.216922016
[135,] 0.352263792 0.518598386
[136,] -0.208228893 0.352263792
[137,] 0.385726527 -0.208228893
[138,] 0.757043977 0.385726527
[139,] 0.248227727 0.757043977
[140,] -0.587671238 0.248227727
[141,] -0.645225358 -0.587671238
[142,] -0.798264108 -0.645225358
[143,] 0.529916556 -0.798264108
[144,] -0.650642547 0.529916556
[145,] -0.478187633 -0.650642547
[146,] 0.477504500 -0.478187633
[147,] 0.074803467 0.477504500
[148,] -0.087728066 0.074803467
[149,] -0.166339103 -0.087728066
[150,] 0.511872396 -0.166339103
[151,] -0.685604348 0.511872396
[152,] -0.670124537 -0.685604348
[153,] 0.283997853 -0.670124537
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.029914043 -0.042088001
2 1.315480218 0.029914043
3 -1.239799392 1.315480218
4 -0.862772828 -1.239799392
5 0.081856780 -0.862772828
6 -0.631182520 0.081856780
7 -0.748792655 -0.631182520
8 -1.477881307 -0.748792655
9 0.142959239 -1.477881307
10 0.408393205 0.142959239
11 0.400754461 0.408393205
12 0.712740419 0.400754461
13 -0.790907441 0.712740419
14 1.193664485 -0.790907441
15 -0.028332132 1.193664485
16 0.219489134 -0.028332132
17 0.788201747 0.219489134
18 -0.128814576 0.788201747
19 -0.482891822 -0.128814576
20 -0.153202114 -0.482891822
21 -0.338679451 -0.153202114
22 0.636055173 -0.338679451
23 -0.005911162 0.636055173
24 -0.312158760 -0.005911162
25 0.598248570 -0.312158760
26 -0.465662956 0.598248570
27 -0.273503713 -0.465662956
28 -0.455932344 -0.273503713
29 -0.220502724 -0.455932344
30 -0.299113761 -0.220502724
31 0.948847841 -0.299113761
32 -0.275118518 0.948847841
33 0.840599735 -0.275118518
34 -0.990882853 0.840599735
35 0.587322543 -0.990882853
36 0.721720420 0.587322543
37 -0.044783493 0.721720420
38 -0.270289732 -0.044783493
39 0.481324706 -0.270289732
40 0.917129630 0.481324706
41 0.372831652 0.917129630
42 -1.544285342 0.372831652
43 -0.570929045 -1.544285342
44 0.904160669 -0.570929045
45 -0.275366547 0.904160669
46 0.586256816 -0.275366547
47 0.164562882 0.586256816
48 0.288565182 0.164562882
49 0.693850218 0.288565182
50 0.339239351 0.693850218
51 -1.796135619 0.339239351
52 -0.075480804 -1.796135619
53 -0.377462222 -0.075480804
54 0.850820790 -0.377462222
55 -0.321222919 0.850820790
56 0.115627929 -0.321222919
57 0.334061866 0.115627929
58 1.545263600 0.334061866
59 0.790085332 1.545263600
60 -0.150389187 0.790085332
61 0.668951040 -0.150389187
62 -0.158594047 0.668951040
63 0.829487502 -0.158594047
64 -0.041601624 0.829487502
65 -0.058833821 -0.041601624
66 -0.610278407 -0.058833821
67 -0.109654988 -0.610278407
68 1.015856354 -0.109654988
69 -0.836136648 1.015856354
70 -0.463541542 -0.836136648
71 0.017747300 -0.463541542
72 -0.718649524 0.017747300
73 -1.355948139 -0.718649524
74 0.052973884 -1.355948139
75 -0.593372830 0.052973884
76 -0.630401455 -0.593372830
77 -0.158605396 -0.630401455
78 0.821561926 -0.158605396
79 0.043134584 0.821561926
80 -0.170536868 0.043134584
81 -0.242902943 -0.170536868
82 -0.375329459 -0.242902943
83 -0.679718336 -0.375329459
84 0.418046011 -0.679718336
85 0.237386237 0.418046011
86 -0.353691740 0.237386237
87 0.252522693 -0.353691740
88 -0.548139493 0.252522693
89 -0.490398623 -0.548139493
90 0.430990339 -0.490398623
91 -0.143359309 0.430990339
92 0.347824442 -0.143359309
93 0.259364330 0.347824442
94 0.030021260 0.259364330
95 -0.300706241 0.030021260
96 -0.606853168 -0.300706241
97 -0.023879381 -0.606853168
98 -0.362496882 -0.023879381
99 0.120462374 -0.362496882
100 1.174400181 0.120462374
101 0.539035100 1.174400181
102 1.389896453 0.539035100
103 -0.822374072 1.389896453
104 0.218371115 -0.822374072
105 0.154866873 0.218371115
106 0.690488617 0.154866873
107 -0.647947054 0.690488617
108 -0.264706176 -0.647947054
109 0.053148744 -0.264706176
110 0.691651921 0.053148744
111 -0.468631881 0.691651921
112 -0.158430536 -0.468631881
113 0.015519573 -0.158430536
114 0.806842334 0.015519573
115 0.588826097 0.806842334
116 -0.553966918 0.588826097
117 -0.815699403 -0.553966918
118 -1.189010555 -0.815699403
119 0.106881365 -1.189010555
120 0.544455146 0.106881365
121 -0.648661678 0.544455146
122 0.559591602 -0.648661678
123 0.344874226 0.559591602
124 -0.021735001 0.344874226
125 -0.514501898 -0.021735001
126 -0.690890393 -0.514501898
127 0.364194009 -0.690890393
128 1.039367459 0.364194009
129 0.599946223 1.039367459
130 0.038651413 0.599946223
131 -0.299784259 0.038651413
132 0.358061924 -0.299784259
133 -0.216922016 0.358061924
134 0.518598386 -0.216922016
135 0.352263792 0.518598386
136 -0.208228893 0.352263792
137 0.385726527 -0.208228893
138 0.757043977 0.385726527
139 0.248227727 0.757043977
140 -0.587671238 0.248227727
141 -0.645225358 -0.587671238
142 -0.798264108 -0.645225358
143 0.529916556 -0.798264108
144 -0.650642547 0.529916556
145 -0.478187633 -0.650642547
146 0.477504500 -0.478187633
147 0.074803467 0.477504500
148 -0.087728066 0.074803467
149 -0.166339103 -0.087728066
150 0.511872396 -0.166339103
151 -0.685604348 0.511872396
152 -0.670124537 -0.685604348
153 0.283997853 -0.670124537
> plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals')
> lines(lowess(z))
> abline(lm(z))
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/77nfp1291202429.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/87nfp1291202429.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/97nfp1291202429.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/www/html/freestat/rcomp/tmp/10ieea1291202429.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/freestat/rcomp/createtable")
>
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE)
> a<-table.row.end(a)
> myeq <- colnames(x)[1]
> myeq <- paste(myeq, '[t] = ', sep='')
> for (i in 1:k){
+ if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '')
+ myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ')
+ if (rownames(mysum$coefficients)[i] != '(Intercept)') {
+ myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='')
+ if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='')
+ }
+ }
> myeq <- paste(myeq, ' + e[t]')
> a<-table.row.start(a)
> a<-table.element(a, myeq)
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/www/html/freestat/rcomp/tmp/113wvg1291202429.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'Variable',header=TRUE)
> a<-table.element(a,'Parameter',header=TRUE)
> a<-table.element(a,'S.D.',header=TRUE)
> a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE)
> a<-table.element(a,'2-tail p-value',header=TRUE)
> a<-table.element(a,'1-tail p-value',header=TRUE)
> a<-table.row.end(a)
> for (i in 1:k){
+ a<-table.row.start(a)
+ a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE)
+ a<-table.element(a,mysum$coefficients[i,1])
+ a<-table.element(a, round(mysum$coefficients[i,2],6))
+ a<-table.element(a, round(mysum$coefficients[i,3],4))
+ a<-table.element(a, round(mysum$coefficients[i,4],6))
+ a<-table.element(a, round(mysum$coefficients[i,4]/2,6))
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/www/html/freestat/rcomp/tmp/12z7ez1291202430.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple R',1,TRUE)
> a<-table.element(a, sqrt(mysum$r.squared))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'R-squared',1,TRUE)
> a<-table.element(a, mysum$r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Adjusted R-squared',1,TRUE)
> a<-table.element(a, mysum$adj.r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (value)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[1])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[2])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[3])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'p-value',1,TRUE)
> a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3]))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Residual Standard Deviation',1,TRUE)
> a<-table.element(a, mysum$sigma)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Sum Squared Residuals',1,TRUE)
> a<-table.element(a, sum(myerror*myerror))
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/www/html/freestat/rcomp/tmp/136qbb1291202430.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Time or Index', 1, TRUE)
> a<-table.element(a, 'Actuals', 1, TRUE)
> a<-table.element(a, 'Interpolation
Forecast', 1, TRUE)
> a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE)
> a<-table.row.end(a)
> for (i in 1:n) {
+ a<-table.row.start(a)
+ a<-table.element(a,i, 1, TRUE)
+ a<-table.element(a,x[i])
+ a<-table.element(a,x[i]-mysum$resid[i])
+ a<-table.element(a,mysum$resid[i])
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/www/html/freestat/rcomp/tmp/14ghse1291202430.tab")
> if (n > n25) {
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'p-values',header=TRUE)
+ a<-table.element(a,'Alternative Hypothesis',3,header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'breakpoint index',header=TRUE)
+ a<-table.element(a,'greater',header=TRUE)
+ a<-table.element(a,'2-sided',header=TRUE)
+ a<-table.element(a,'less',header=TRUE)
+ a<-table.row.end(a)
+ for (mypoint in kp3:nmkm3) {
+ a<-table.row.start(a)
+ a<-table.element(a,mypoint,header=TRUE)
+ a<-table.element(a,gqarr[mypoint-kp3+1,1])
+ a<-table.element(a,gqarr[mypoint-kp3+1,2])
+ a<-table.element(a,gqarr[mypoint-kp3+1,3])
+ a<-table.row.end(a)
+ }
+ a<-table.end(a)
+ table.save(a,file="/var/www/html/freestat/rcomp/tmp/152i921291202430.tab")
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'Description',header=TRUE)
+ a<-table.element(a,'# significant tests',header=TRUE)
+ a<-table.element(a,'% significant tests',header=TRUE)
+ a<-table.element(a,'OK/NOK',header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'1% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant1)
+ a<-table.element(a,numsignificant1/numgqtests)
+ if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'5% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant5)
+ a<-table.element(a,numsignificant5/numgqtests)
+ if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'10% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant10)
+ a<-table.element(a,numsignificant10/numgqtests)
+ if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.end(a)
+ table.save(a,file="/var/www/html/freestat/rcomp/tmp/16yaoa1291202430.tab")
+ }
>
> try(system("convert tmp/1tdzz1291202429.ps tmp/1tdzz1291202429.png",intern=TRUE))
character(0)
> try(system("convert tmp/2tdzz1291202429.ps tmp/2tdzz1291202429.png",intern=TRUE))
character(0)
> try(system("convert tmp/34myk1291202429.ps tmp/34myk1291202429.png",intern=TRUE))
character(0)
> try(system("convert tmp/44myk1291202429.ps tmp/44myk1291202429.png",intern=TRUE))
character(0)
> try(system("convert tmp/54myk1291202429.ps tmp/54myk1291202429.png",intern=TRUE))
character(0)
> try(system("convert tmp/6evgm1291202429.ps tmp/6evgm1291202429.png",intern=TRUE))
character(0)
> try(system("convert tmp/77nfp1291202429.ps tmp/77nfp1291202429.png",intern=TRUE))
character(0)
> try(system("convert tmp/87nfp1291202429.ps tmp/87nfp1291202429.png",intern=TRUE))
character(0)
> try(system("convert tmp/97nfp1291202429.ps tmp/97nfp1291202429.png",intern=TRUE))
character(0)
> try(system("convert tmp/10ieea1291202429.ps tmp/10ieea1291202429.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
5.810 2.747 6.536