R version 2.11.1 (2010-05-31)
Copyright (C) 2010 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(5.6
+ ,5.5
+ ,6
+ ,4.8
+ ,4.4
+ ,3.5
+ ,4
+ ,4.4
+ ,2.4
+ ,8.5
+ ,4
+ ,5.6
+ ,4.8
+ ,5
+ ,4
+ ,4.8
+ ,3.2
+ ,6
+ ,4.5
+ ,8.4
+ ,4
+ ,6
+ ,3.5
+ ,4.8
+ ,4
+ ,5.5
+ ,2
+ ,8.8
+ ,4.4
+ ,5.5
+ ,5.5
+ ,4.4
+ ,6.4
+ ,6
+ ,3.5
+ ,4
+ ,4.4
+ ,6.5
+ ,3.5
+ ,5.2
+ ,5.2
+ ,7
+ ,6
+ ,4
+ ,4.8
+ ,8
+ ,5
+ ,3.2
+ ,3.2
+ ,5.5
+ ,5
+ ,6
+ ,4.8
+ ,5
+ ,4
+ ,5.6
+ ,4.4
+ ,5.5
+ ,4
+ ,4
+ ,1.6
+ ,7.5
+ ,2
+ ,5.6
+ ,3.6
+ ,4.5
+ ,4.5
+ ,5.6
+ ,3.2
+ ,5.5
+ ,4
+ ,4.4
+ ,3.2
+ ,8.5
+ ,3.5
+ ,4
+ ,5.6
+ ,8.5
+ ,5.5
+ ,5.2
+ ,6
+ ,5.5
+ ,4.5
+ ,2.8
+ ,6.4
+ ,9
+ ,5.5
+ ,5.6
+ ,3.6
+ ,7
+ ,6.5
+ ,4.8
+ ,5.6
+ ,5
+ ,4
+ ,5.6
+ ,4.4
+ ,5.5
+ ,4
+ ,4.4
+ ,3.2
+ ,7.5
+ ,4.5
+ ,3.6
+ ,3.6
+ ,7.5
+ ,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NU 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
> 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
Depression Doubts Expectat Criticism
1 4.8 5.6 5.5 6.0
2 4.4 4.4 3.5 4.0
3 5.6 2.4 8.5 4.0
4 4.8 4.8 5.0 4.0
5 8.4 3.2 6.0 4.5
6 4.8 4.0 6.0 3.5
7 8.8 4.0 5.5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 3.5 2.0
122 5.6 4.4 6.0 3.5
123 4.4 5.6 7.0 5.5
124 3.2 3.2 3.0 3.0
125 4.4 8.0 4.0 3.5
126 4.4 4.4 8.5 4.0
127 3.2 3.2 5.0 2.0
128 4.0 4.4 5.5 4.0
129 4.4 4.0 7.0 4.5
130 5.2 5.6 5.5 4.0
131 4.4 4.4 6.5 5.5
132 8.0 3.6 6.0 4.0
133 4.0 3.6 5.5 2.5
134 6.0 3.2 4.5 2.0
135 4.8 4.0 6.0 4.0
136 5.6 5.2 10.0 5.0
137 9.2 5.2 6.0 3.0
138 5.6 4.8 6.5 4.5
139 6.4 3.2 6.0 4.5
140 4.4 5.2 6.0 6.5
141 4.8 5.6 4.5 4.5
142 4.0 4.8 7.5 5.0
143 5.6 5.6 12.0 10.0
144 4.8 6.0 3.5 2.5
145 4.8 5.2 8.5 5.5
146 4.4 6.4 5.5 3.0
147 4.8 3.6 8.5 4.5
148 5.2 3.6 5.5 3.5
149 4.4 3.6 6.0 4.5
150 7.6 3.2 7.0 5.0
151 4.8 2.8 5.5 4.5
152 6.8 6.4 8.0 4.0
153 3.6 4.4 10.5 3.5
154 4.8 3.6 7.0 3.0
155 7.6 4.4 10.0 6.5
156 7.2 3.6 6.5 3.0
157 6.0 5.6 5.5 4.0
158 5.6 5.2 7.5 5.0
159 4.4 6.4 9.5 8.0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Doubts Expectat Criticism
5.70985 -0.07996 -0.02180 -0.01558
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-2.2401 -0.8202 -0.2487 0.5929 4.5155
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.70985 0.54612 10.455 <2e-16 ***
Doubts -0.07996 0.09127 -0.876 0.382
Expectat -0.02180 0.07284 -0.299 0.765
Criticism -0.01558 0.09380 -0.166 0.868
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.266 on 155 degrees of freedom
Multiple R-squared: 0.007318, Adjusted R-squared: -0.0119
F-statistic: 0.3809 on 3 and 155 DF, p-value: 0.7669
> 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.97639453 0.04721093 0.02360547
[2,] 0.95190339 0.09619323 0.04809661
[3,] 0.91986285 0.16027430 0.08013715
[4,] 0.87349813 0.25300373 0.12650187
[5,] 0.81206607 0.37586786 0.18793393
[6,] 0.78758805 0.42482391 0.21241195
[7,] 0.71078555 0.57842891 0.28921445
[8,] 0.62751399 0.74497201 0.37248601
[9,] 0.65500430 0.68999139 0.34499570
[10,] 0.72318559 0.55362883 0.27681441
[11,] 0.65482027 0.69035945 0.34517973
[12,] 0.67176193 0.65647614 0.32823807
[13,] 0.64816428 0.70367144 0.35183572
[14,] 0.68010436 0.63979127 0.31989564
[15,] 0.72398311 0.55203378 0.27601689
[16,] 0.77571352 0.44857296 0.22428648
[17,] 0.72137841 0.55724318 0.27862159
[18,] 0.68092381 0.63815237 0.31907619
[19,] 0.64095470 0.71809060 0.35904530
[20,] 0.67098840 0.65802319 0.32901160
[21,] 0.63973861 0.72052277 0.36026139
[22,] 0.60749071 0.78501858 0.39250929
[23,] 0.55908749 0.88182501 0.44091251
[24,] 0.49882721 0.99765441 0.50117279
[25,] 0.55211562 0.89576875 0.44788438
[26,] 0.58754794 0.82490413 0.41245206
[27,] 0.55927067 0.88145866 0.44072933
[28,] 0.52483688 0.95032625 0.47516312
[29,] 0.46740839 0.93481678 0.53259161
[30,] 0.47138657 0.94277313 0.52861343
[31,] 0.71100033 0.57799933 0.28899967
[32,] 0.66710474 0.66579053 0.33289526
[33,] 0.63806477 0.72387046 0.36193523
[34,] 0.61564790 0.76870420 0.38435210
[35,] 0.59806912 0.80386175 0.40193088
[36,] 0.55208748 0.89582504 0.44791252
[37,] 0.60418592 0.79162815 0.39581408
[38,] 0.56492158 0.87015683 0.43507842
[39,] 0.53313897 0.93372205 0.46686103
[40,] 0.48394022 0.96788043 0.51605978
[41,] 0.47562958 0.95125916 0.52437042
[42,] 0.43420539 0.86841078 0.56579461
[43,] 0.40928013 0.81856026 0.59071987
[44,] 0.36870953 0.73741906 0.63129047
[45,] 0.34611500 0.69222999 0.65388500
[46,] 0.30519130 0.61038261 0.69480870
[47,] 0.38451586 0.76903172 0.61548414
[48,] 0.34087107 0.68174214 0.65912893
[49,] 0.30643839 0.61287677 0.69356161
[50,] 0.26716110 0.53432220 0.73283890
[51,] 0.22858810 0.45717620 0.77141190
[52,] 0.25688318 0.51376636 0.74311682
[53,] 0.27458806 0.54917612 0.72541194
[54,] 0.27915633 0.55831265 0.72084367
[55,] 0.45541149 0.91082298 0.54458851
[56,] 0.41229321 0.82458642 0.58770679
[57,] 0.37012746 0.74025493 0.62987254
[58,] 0.33342856 0.66685712 0.66657144
[59,] 0.29211983 0.58423966 0.70788017
[60,] 0.26811591 0.53623183 0.73188409
[61,] 0.28348640 0.56697281 0.71651360
[62,] 0.24905565 0.49811130 0.75094435
[63,] 0.21571054 0.43142107 0.78428946
[64,] 0.18721421 0.37442842 0.81278579
[65,] 0.15754815 0.31509631 0.84245185
[66,] 0.13840713 0.27681426 0.86159287
[67,] 0.11430331 0.22860662 0.88569669
[68,] 0.10394748 0.20789496 0.89605252
[69,] 0.09184988 0.18369975 0.90815012
[70,] 0.15678948 0.31357895 0.84321052
[71,] 0.13565871 0.27131743 0.86434129
[72,] 0.16248413 0.32496826 0.83751587
[73,] 0.13569138 0.27138277 0.86430862
[74,] 0.15048636 0.30097272 0.84951364
[75,] 0.13151561 0.26303121 0.86848439
[76,] 0.13984272 0.27968544 0.86015728
[77,] 0.15271226 0.30542452 0.84728774
[78,] 0.12952343 0.25904686 0.87047657
[79,] 0.10982775 0.21965549 0.89017225
[80,] 0.09196942 0.18393885 0.90803058
[81,] 0.07484782 0.14969564 0.92515218
[82,] 0.06110176 0.12220353 0.93889824
[83,] 0.05618714 0.11237428 0.94381286
[84,] 0.22061928 0.44123856 0.77938072
[85,] 0.19173465 0.38346929 0.80826535
[86,] 0.17153398 0.34306796 0.82846602
[87,] 0.14382110 0.28764219 0.85617890
[88,] 0.12887709 0.25775419 0.87112291
[89,] 0.12683484 0.25366967 0.87316516
[90,] 0.11139440 0.22278880 0.88860560
[91,] 0.11662385 0.23324769 0.88337615
[92,] 0.10226809 0.20453617 0.89773191
[93,] 0.09135894 0.18271789 0.90864106
[94,] 0.09028123 0.18056246 0.90971877
[95,] 0.08822235 0.17644469 0.91177765
[96,] 0.08243453 0.16486906 0.91756547
[97,] 0.06839922 0.13679844 0.93160078
[98,] 0.05994715 0.11989431 0.94005285
[99,] 0.06023543 0.12047086 0.93976457
[100,] 0.10322936 0.20645871 0.89677064
[101,] 0.09201326 0.18402652 0.90798674
[102,] 0.08872884 0.17745767 0.91127116
[103,] 0.07911388 0.15822777 0.92088612
[104,] 0.46949552 0.93899103 0.53050448
[105,] 0.42260121 0.84520243 0.57739879
[106,] 0.39011858 0.78023715 0.60988142
[107,] 0.35820489 0.71640978 0.64179511
[108,] 0.32443090 0.64886181 0.67556910
[109,] 0.28410119 0.56820238 0.71589881
[110,] 0.28655584 0.57311169 0.71344416
[111,] 0.24489463 0.48978925 0.75510537
[112,] 0.20539278 0.41078556 0.79460722
[113,] 0.22206114 0.44412227 0.77793886
[114,] 0.19818496 0.39636992 0.80181504
[115,] 0.17914787 0.35829574 0.82085213
[116,] 0.14888228 0.29776457 0.85111772
[117,] 0.12740581 0.25481163 0.87259419
[118,] 0.16585525 0.33171050 0.83414475
[119,] 0.13799033 0.27598067 0.86200967
[120,] 0.12272003 0.24544006 0.87727997
[121,] 0.18549876 0.37099751 0.81450124
[122,] 0.18708553 0.37417106 0.81291447
[123,] 0.17323128 0.34646256 0.82676872
[124,] 0.13781181 0.27562361 0.86218819
[125,] 0.12345249 0.24690497 0.87654751
[126,] 0.22167263 0.44334526 0.77832737
[127,] 0.24164862 0.48329724 0.75835138
[128,] 0.19733569 0.39467138 0.80266431
[129,] 0.16641408 0.33282816 0.83358592
[130,] 0.13012321 0.26024642 0.86987679
[131,] 0.59495868 0.81008264 0.40504132
[132,] 0.52755139 0.94489721 0.47244861
[133,] 0.48853509 0.97707017 0.51146491
[134,] 0.44797632 0.89595265 0.55202368
[135,] 0.37925800 0.75851599 0.62074200
[136,] 0.38725794 0.77451588 0.61274206
[137,] 0.31659231 0.63318461 0.68340769
[138,] 0.24863128 0.49726257 0.75136872
[139,] 0.19821003 0.39642005 0.80178997
[140,] 0.16885831 0.33771663 0.83114169
[141,] 0.12588863 0.25177727 0.87411137
[142,] 0.08647370 0.17294741 0.91352630
[143,] 0.09387708 0.18775415 0.90612292
[144,] 0.11592257 0.23184514 0.88407743
[145,] 0.11270127 0.22540254 0.88729873
[146,] 0.35459812 0.70919624 0.64540188
> postscript(file="/var/www/rcomp/tmp/1f11s1290461686.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/rcomp/tmp/2qb0w1290461686.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/rcomp/tmp/3qb0w1290461686.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/rcomp/tmp/4qb0w1290461686.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/rcomp/tmp/5qb0w1290461686.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 = 159
Frequency = 1
1 2 3 4 5 6
-0.248689928 -0.819401736 0.329679930 -0.354716514 3.146936377 -0.404673894
7 8 9 10 11 12
3.561057523 -0.752432219 -1.012768159 0.038210707 -1.047973283 -1.873735798
13 14 15 16 17 18
0.743825489 0.445283486 -1.175800492 0.212753033 0.346219732 -0.871753359
19 20 21 22 23 24
-1.214140916 0.208922515 -2.240073911 0.683791405 -0.368121015 0.509252065
25 26 27 28 29 30
-0.775800492 -1.620362690 -0.811746673 0.789820977 0.422521910 -0.033547296
31 32 33 34 35 36
-1.645164251 1.122738525 -1.122866586 -0.868642472 0.033422222 -1.853258517
37 38 39 40 41 42
2.786820038 -0.228347007 -1.036356328 -1.140705315 -1.387966598 0.400721288
43 44 45 46 47 48
-1.964183536 0.391364214 -0.818685092 0.056183798 -1.431567842 -0.717227095
49 50 51 52 53 54
0.803115531 -0.622235181 -1.112438610 0.371131241 2.003115531 0.178618811
55 56 57 58 59 60
-0.636576224 -0.300931602 0.003115531 -1.654631274 -1.378496589 0.973937287
61 62 63 64 65 66
2.778920666 -0.401563007 -0.318904693 0.463256577 -0.031153053 -0.820969386
67 68 69 70 71 72
1.528246641 -0.417968447 0.061688927 0.424199508 -0.068642472 0.730640884
73 74 75 76 77 78
0.011621599 -0.948192884 -0.811746673 2.403115531 0.126374150 1.696674155
79 80 81 82 83 84
0.045283486 -1.569578717 -0.642468154 -1.335721937 -1.522015580 -0.401672955
85 86 87 88 89 90
-0.335916830 0.070911640 -0.031153053 -0.301648247 0.957421898 3.595326106
91 92 93 94 95 96
0.152853309 0.584013992 -0.020969386 0.820237616 -1.224190221 -0.667623972
97 98 99 100 101 102
1.424611312 -0.604372039 -0.836658183 -1.185984158 -1.148604688 1.091583815
103 104 105 106 107 108
-0.336987732 -0.812573266 1.335731224 2.496784103 -0.890443094 1.197610401
109 110 111 112 113 114
0.987121893 4.515473839 0.331357528 0.813905894 -0.870185709 0.795932803
115 116 117 118 119 120
-0.545054598 -1.273321009 0.329679930 -0.013179962 -1.428456955 0.760340878
121 122 123 124 125 126
0.749440567 0.427310396 -0.623778418 -2.141833763 -0.528432247 -0.710398624
127 128 129 130 131 132
-2.113811367 -1.175800492 -0.767294423 0.120152376 -0.730631597 2.771131241
133 134 135 136 137 138
-1.263137342 0.675288322 -0.396884469 0.601849736 4.083489550 0.485773844
139 140 141 142 143 144
1.146936377 -0.661984481 -0.293858822 -1.084636109 0.755329511 -0.314832852
145 146 147 148 149 150
-0.223061774 -0.631457894 -0.366577778 -0.047558494 -0.821079334 2.376526423
151 152 153 154 155 156
-0.495948224 1.838622510 -1.474586804 -0.422646984 2.561249430 1.966452704
157 158 159
0.920152376 0.547348180 -0.466361163
> postscript(file="/var/www/rcomp/tmp/6i2hh1290461686.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 = 159
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.248689928 NA
1 -0.819401736 -0.248689928
2 0.329679930 -0.819401736
3 -0.354716514 0.329679930
4 3.146936377 -0.354716514
5 -0.404673894 3.146936377
6 3.561057523 -0.404673894
7 -0.752432219 3.561057523
8 -1.012768159 -0.752432219
9 0.038210707 -1.012768159
10 -1.047973283 0.038210707
11 -1.873735798 -1.047973283
12 0.743825489 -1.873735798
13 0.445283486 0.743825489
14 -1.175800492 0.445283486
15 0.212753033 -1.175800492
16 0.346219732 0.212753033
17 -0.871753359 0.346219732
18 -1.214140916 -0.871753359
19 0.208922515 -1.214140916
20 -2.240073911 0.208922515
21 0.683791405 -2.240073911
22 -0.368121015 0.683791405
23 0.509252065 -0.368121015
24 -0.775800492 0.509252065
25 -1.620362690 -0.775800492
26 -0.811746673 -1.620362690
27 0.789820977 -0.811746673
28 0.422521910 0.789820977
29 -0.033547296 0.422521910
30 -1.645164251 -0.033547296
31 1.122738525 -1.645164251
32 -1.122866586 1.122738525
33 -0.868642472 -1.122866586
34 0.033422222 -0.868642472
35 -1.853258517 0.033422222
36 2.786820038 -1.853258517
37 -0.228347007 2.786820038
38 -1.036356328 -0.228347007
39 -1.140705315 -1.036356328
40 -1.387966598 -1.140705315
41 0.400721288 -1.387966598
42 -1.964183536 0.400721288
43 0.391364214 -1.964183536
44 -0.818685092 0.391364214
45 0.056183798 -0.818685092
46 -1.431567842 0.056183798
47 -0.717227095 -1.431567842
48 0.803115531 -0.717227095
49 -0.622235181 0.803115531
50 -1.112438610 -0.622235181
51 0.371131241 -1.112438610
52 2.003115531 0.371131241
53 0.178618811 2.003115531
54 -0.636576224 0.178618811
55 -0.300931602 -0.636576224
56 0.003115531 -0.300931602
57 -1.654631274 0.003115531
58 -1.378496589 -1.654631274
59 0.973937287 -1.378496589
60 2.778920666 0.973937287
61 -0.401563007 2.778920666
62 -0.318904693 -0.401563007
63 0.463256577 -0.318904693
64 -0.031153053 0.463256577
65 -0.820969386 -0.031153053
66 1.528246641 -0.820969386
67 -0.417968447 1.528246641
68 0.061688927 -0.417968447
69 0.424199508 0.061688927
70 -0.068642472 0.424199508
71 0.730640884 -0.068642472
72 0.011621599 0.730640884
73 -0.948192884 0.011621599
74 -0.811746673 -0.948192884
75 2.403115531 -0.811746673
76 0.126374150 2.403115531
77 1.696674155 0.126374150
78 0.045283486 1.696674155
79 -1.569578717 0.045283486
80 -0.642468154 -1.569578717
81 -1.335721937 -0.642468154
82 -1.522015580 -1.335721937
83 -0.401672955 -1.522015580
84 -0.335916830 -0.401672955
85 0.070911640 -0.335916830
86 -0.031153053 0.070911640
87 -0.301648247 -0.031153053
88 0.957421898 -0.301648247
89 3.595326106 0.957421898
90 0.152853309 3.595326106
91 0.584013992 0.152853309
92 -0.020969386 0.584013992
93 0.820237616 -0.020969386
94 -1.224190221 0.820237616
95 -0.667623972 -1.224190221
96 1.424611312 -0.667623972
97 -0.604372039 1.424611312
98 -0.836658183 -0.604372039
99 -1.185984158 -0.836658183
100 -1.148604688 -1.185984158
101 1.091583815 -1.148604688
102 -0.336987732 1.091583815
103 -0.812573266 -0.336987732
104 1.335731224 -0.812573266
105 2.496784103 1.335731224
106 -0.890443094 2.496784103
107 1.197610401 -0.890443094
108 0.987121893 1.197610401
109 4.515473839 0.987121893
110 0.331357528 4.515473839
111 0.813905894 0.331357528
112 -0.870185709 0.813905894
113 0.795932803 -0.870185709
114 -0.545054598 0.795932803
115 -1.273321009 -0.545054598
116 0.329679930 -1.273321009
117 -0.013179962 0.329679930
118 -1.428456955 -0.013179962
119 0.760340878 -1.428456955
120 0.749440567 0.760340878
121 0.427310396 0.749440567
122 -0.623778418 0.427310396
123 -2.141833763 -0.623778418
124 -0.528432247 -2.141833763
125 -0.710398624 -0.528432247
126 -2.113811367 -0.710398624
127 -1.175800492 -2.113811367
128 -0.767294423 -1.175800492
129 0.120152376 -0.767294423
130 -0.730631597 0.120152376
131 2.771131241 -0.730631597
132 -1.263137342 2.771131241
133 0.675288322 -1.263137342
134 -0.396884469 0.675288322
135 0.601849736 -0.396884469
136 4.083489550 0.601849736
137 0.485773844 4.083489550
138 1.146936377 0.485773844
139 -0.661984481 1.146936377
140 -0.293858822 -0.661984481
141 -1.084636109 -0.293858822
142 0.755329511 -1.084636109
143 -0.314832852 0.755329511
144 -0.223061774 -0.314832852
145 -0.631457894 -0.223061774
146 -0.366577778 -0.631457894
147 -0.047558494 -0.366577778
148 -0.821079334 -0.047558494
149 2.376526423 -0.821079334
150 -0.495948224 2.376526423
151 1.838622510 -0.495948224
152 -1.474586804 1.838622510
153 -0.422646984 -1.474586804
154 2.561249430 -0.422646984
155 1.966452704 2.561249430
156 0.920152376 1.966452704
157 0.547348180 0.920152376
158 -0.466361163 0.547348180
159 NA -0.466361163
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.819401736 -0.248689928
[2,] 0.329679930 -0.819401736
[3,] -0.354716514 0.329679930
[4,] 3.146936377 -0.354716514
[5,] -0.404673894 3.146936377
[6,] 3.561057523 -0.404673894
[7,] -0.752432219 3.561057523
[8,] -1.012768159 -0.752432219
[9,] 0.038210707 -1.012768159
[10,] -1.047973283 0.038210707
[11,] -1.873735798 -1.047973283
[12,] 0.743825489 -1.873735798
[13,] 0.445283486 0.743825489
[14,] -1.175800492 0.445283486
[15,] 0.212753033 -1.175800492
[16,] 0.346219732 0.212753033
[17,] -0.871753359 0.346219732
[18,] -1.214140916 -0.871753359
[19,] 0.208922515 -1.214140916
[20,] -2.240073911 0.208922515
[21,] 0.683791405 -2.240073911
[22,] -0.368121015 0.683791405
[23,] 0.509252065 -0.368121015
[24,] -0.775800492 0.509252065
[25,] -1.620362690 -0.775800492
[26,] -0.811746673 -1.620362690
[27,] 0.789820977 -0.811746673
[28,] 0.422521910 0.789820977
[29,] -0.033547296 0.422521910
[30,] -1.645164251 -0.033547296
[31,] 1.122738525 -1.645164251
[32,] -1.122866586 1.122738525
[33,] -0.868642472 -1.122866586
[34,] 0.033422222 -0.868642472
[35,] -1.853258517 0.033422222
[36,] 2.786820038 -1.853258517
[37,] -0.228347007 2.786820038
[38,] -1.036356328 -0.228347007
[39,] -1.140705315 -1.036356328
[40,] -1.387966598 -1.140705315
[41,] 0.400721288 -1.387966598
[42,] -1.964183536 0.400721288
[43,] 0.391364214 -1.964183536
[44,] -0.818685092 0.391364214
[45,] 0.056183798 -0.818685092
[46,] -1.431567842 0.056183798
[47,] -0.717227095 -1.431567842
[48,] 0.803115531 -0.717227095
[49,] -0.622235181 0.803115531
[50,] -1.112438610 -0.622235181
[51,] 0.371131241 -1.112438610
[52,] 2.003115531 0.371131241
[53,] 0.178618811 2.003115531
[54,] -0.636576224 0.178618811
[55,] -0.300931602 -0.636576224
[56,] 0.003115531 -0.300931602
[57,] -1.654631274 0.003115531
[58,] -1.378496589 -1.654631274
[59,] 0.973937287 -1.378496589
[60,] 2.778920666 0.973937287
[61,] -0.401563007 2.778920666
[62,] -0.318904693 -0.401563007
[63,] 0.463256577 -0.318904693
[64,] -0.031153053 0.463256577
[65,] -0.820969386 -0.031153053
[66,] 1.528246641 -0.820969386
[67,] -0.417968447 1.528246641
[68,] 0.061688927 -0.417968447
[69,] 0.424199508 0.061688927
[70,] -0.068642472 0.424199508
[71,] 0.730640884 -0.068642472
[72,] 0.011621599 0.730640884
[73,] -0.948192884 0.011621599
[74,] -0.811746673 -0.948192884
[75,] 2.403115531 -0.811746673
[76,] 0.126374150 2.403115531
[77,] 1.696674155 0.126374150
[78,] 0.045283486 1.696674155
[79,] -1.569578717 0.045283486
[80,] -0.642468154 -1.569578717
[81,] -1.335721937 -0.642468154
[82,] -1.522015580 -1.335721937
[83,] -0.401672955 -1.522015580
[84,] -0.335916830 -0.401672955
[85,] 0.070911640 -0.335916830
[86,] -0.031153053 0.070911640
[87,] -0.301648247 -0.031153053
[88,] 0.957421898 -0.301648247
[89,] 3.595326106 0.957421898
[90,] 0.152853309 3.595326106
[91,] 0.584013992 0.152853309
[92,] -0.020969386 0.584013992
[93,] 0.820237616 -0.020969386
[94,] -1.224190221 0.820237616
[95,] -0.667623972 -1.224190221
[96,] 1.424611312 -0.667623972
[97,] -0.604372039 1.424611312
[98,] -0.836658183 -0.604372039
[99,] -1.185984158 -0.836658183
[100,] -1.148604688 -1.185984158
[101,] 1.091583815 -1.148604688
[102,] -0.336987732 1.091583815
[103,] -0.812573266 -0.336987732
[104,] 1.335731224 -0.812573266
[105,] 2.496784103 1.335731224
[106,] -0.890443094 2.496784103
[107,] 1.197610401 -0.890443094
[108,] 0.987121893 1.197610401
[109,] 4.515473839 0.987121893
[110,] 0.331357528 4.515473839
[111,] 0.813905894 0.331357528
[112,] -0.870185709 0.813905894
[113,] 0.795932803 -0.870185709
[114,] -0.545054598 0.795932803
[115,] -1.273321009 -0.545054598
[116,] 0.329679930 -1.273321009
[117,] -0.013179962 0.329679930
[118,] -1.428456955 -0.013179962
[119,] 0.760340878 -1.428456955
[120,] 0.749440567 0.760340878
[121,] 0.427310396 0.749440567
[122,] -0.623778418 0.427310396
[123,] -2.141833763 -0.623778418
[124,] -0.528432247 -2.141833763
[125,] -0.710398624 -0.528432247
[126,] -2.113811367 -0.710398624
[127,] -1.175800492 -2.113811367
[128,] -0.767294423 -1.175800492
[129,] 0.120152376 -0.767294423
[130,] -0.730631597 0.120152376
[131,] 2.771131241 -0.730631597
[132,] -1.263137342 2.771131241
[133,] 0.675288322 -1.263137342
[134,] -0.396884469 0.675288322
[135,] 0.601849736 -0.396884469
[136,] 4.083489550 0.601849736
[137,] 0.485773844 4.083489550
[138,] 1.146936377 0.485773844
[139,] -0.661984481 1.146936377
[140,] -0.293858822 -0.661984481
[141,] -1.084636109 -0.293858822
[142,] 0.755329511 -1.084636109
[143,] -0.314832852 0.755329511
[144,] -0.223061774 -0.314832852
[145,] -0.631457894 -0.223061774
[146,] -0.366577778 -0.631457894
[147,] -0.047558494 -0.366577778
[148,] -0.821079334 -0.047558494
[149,] 2.376526423 -0.821079334
[150,] -0.495948224 2.376526423
[151,] 1.838622510 -0.495948224
[152,] -1.474586804 1.838622510
[153,] -0.422646984 -1.474586804
[154,] 2.561249430 -0.422646984
[155,] 1.966452704 2.561249430
[156,] 0.920152376 1.966452704
[157,] 0.547348180 0.920152376
[158,] -0.466361163 0.547348180
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.819401736 -0.248689928
2 0.329679930 -0.819401736
3 -0.354716514 0.329679930
4 3.146936377 -0.354716514
5 -0.404673894 3.146936377
6 3.561057523 -0.404673894
7 -0.752432219 3.561057523
8 -1.012768159 -0.752432219
9 0.038210707 -1.012768159
10 -1.047973283 0.038210707
11 -1.873735798 -1.047973283
12 0.743825489 -1.873735798
13 0.445283486 0.743825489
14 -1.175800492 0.445283486
15 0.212753033 -1.175800492
16 0.346219732 0.212753033
17 -0.871753359 0.346219732
18 -1.214140916 -0.871753359
19 0.208922515 -1.214140916
20 -2.240073911 0.208922515
21 0.683791405 -2.240073911
22 -0.368121015 0.683791405
23 0.509252065 -0.368121015
24 -0.775800492 0.509252065
25 -1.620362690 -0.775800492
26 -0.811746673 -1.620362690
27 0.789820977 -0.811746673
28 0.422521910 0.789820977
29 -0.033547296 0.422521910
30 -1.645164251 -0.033547296
31 1.122738525 -1.645164251
32 -1.122866586 1.122738525
33 -0.868642472 -1.122866586
34 0.033422222 -0.868642472
35 -1.853258517 0.033422222
36 2.786820038 -1.853258517
37 -0.228347007 2.786820038
38 -1.036356328 -0.228347007
39 -1.140705315 -1.036356328
40 -1.387966598 -1.140705315
41 0.400721288 -1.387966598
42 -1.964183536 0.400721288
43 0.391364214 -1.964183536
44 -0.818685092 0.391364214
45 0.056183798 -0.818685092
46 -1.431567842 0.056183798
47 -0.717227095 -1.431567842
48 0.803115531 -0.717227095
49 -0.622235181 0.803115531
50 -1.112438610 -0.622235181
51 0.371131241 -1.112438610
52 2.003115531 0.371131241
53 0.178618811 2.003115531
54 -0.636576224 0.178618811
55 -0.300931602 -0.636576224
56 0.003115531 -0.300931602
57 -1.654631274 0.003115531
58 -1.378496589 -1.654631274
59 0.973937287 -1.378496589
60 2.778920666 0.973937287
61 -0.401563007 2.778920666
62 -0.318904693 -0.401563007
63 0.463256577 -0.318904693
64 -0.031153053 0.463256577
65 -0.820969386 -0.031153053
66 1.528246641 -0.820969386
67 -0.417968447 1.528246641
68 0.061688927 -0.417968447
69 0.424199508 0.061688927
70 -0.068642472 0.424199508
71 0.730640884 -0.068642472
72 0.011621599 0.730640884
73 -0.948192884 0.011621599
74 -0.811746673 -0.948192884
75 2.403115531 -0.811746673
76 0.126374150 2.403115531
77 1.696674155 0.126374150
78 0.045283486 1.696674155
79 -1.569578717 0.045283486
80 -0.642468154 -1.569578717
81 -1.335721937 -0.642468154
82 -1.522015580 -1.335721937
83 -0.401672955 -1.522015580
84 -0.335916830 -0.401672955
85 0.070911640 -0.335916830
86 -0.031153053 0.070911640
87 -0.301648247 -0.031153053
88 0.957421898 -0.301648247
89 3.595326106 0.957421898
90 0.152853309 3.595326106
91 0.584013992 0.152853309
92 -0.020969386 0.584013992
93 0.820237616 -0.020969386
94 -1.224190221 0.820237616
95 -0.667623972 -1.224190221
96 1.424611312 -0.667623972
97 -0.604372039 1.424611312
98 -0.836658183 -0.604372039
99 -1.185984158 -0.836658183
100 -1.148604688 -1.185984158
101 1.091583815 -1.148604688
102 -0.336987732 1.091583815
103 -0.812573266 -0.336987732
104 1.335731224 -0.812573266
105 2.496784103 1.335731224
106 -0.890443094 2.496784103
107 1.197610401 -0.890443094
108 0.987121893 1.197610401
109 4.515473839 0.987121893
110 0.331357528 4.515473839
111 0.813905894 0.331357528
112 -0.870185709 0.813905894
113 0.795932803 -0.870185709
114 -0.545054598 0.795932803
115 -1.273321009 -0.545054598
116 0.329679930 -1.273321009
117 -0.013179962 0.329679930
118 -1.428456955 -0.013179962
119 0.760340878 -1.428456955
120 0.749440567 0.760340878
121 0.427310396 0.749440567
122 -0.623778418 0.427310396
123 -2.141833763 -0.623778418
124 -0.528432247 -2.141833763
125 -0.710398624 -0.528432247
126 -2.113811367 -0.710398624
127 -1.175800492 -2.113811367
128 -0.767294423 -1.175800492
129 0.120152376 -0.767294423
130 -0.730631597 0.120152376
131 2.771131241 -0.730631597
132 -1.263137342 2.771131241
133 0.675288322 -1.263137342
134 -0.396884469 0.675288322
135 0.601849736 -0.396884469
136 4.083489550 0.601849736
137 0.485773844 4.083489550
138 1.146936377 0.485773844
139 -0.661984481 1.146936377
140 -0.293858822 -0.661984481
141 -1.084636109 -0.293858822
142 0.755329511 -1.084636109
143 -0.314832852 0.755329511
144 -0.223061774 -0.314832852
145 -0.631457894 -0.223061774
146 -0.366577778 -0.631457894
147 -0.047558494 -0.366577778
148 -0.821079334 -0.047558494
149 2.376526423 -0.821079334
150 -0.495948224 2.376526423
151 1.838622510 -0.495948224
152 -1.474586804 1.838622510
153 -0.422646984 -1.474586804
154 2.561249430 -0.422646984
155 1.966452704 2.561249430
156 0.920152376 1.966452704
157 0.547348180 0.920152376
158 -0.466361163 0.547348180
> 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/rcomp/tmp/7btz11290461686.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/rcomp/tmp/8btz11290461686.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/rcomp/tmp/9btz11290461686.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/rcomp/tmp/10ev1z1290461687.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/rcomp/tmp/11hvzn1290461687.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/rcomp/tmp/123wgb1290461687.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/rcomp/tmp/13afd51290461687.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/rcomp/tmp/1426u71290461687.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/rcomp/tmp/1566sv1290461687.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/rcomp/tmp/162yq41290461687.tab")
+ }
>
> try(system("convert tmp/1f11s1290461686.ps tmp/1f11s1290461686.png",intern=TRUE))
character(0)
> try(system("convert tmp/2qb0w1290461686.ps tmp/2qb0w1290461686.png",intern=TRUE))
character(0)
> try(system("convert tmp/3qb0w1290461686.ps tmp/3qb0w1290461686.png",intern=TRUE))
character(0)
> try(system("convert tmp/4qb0w1290461686.ps tmp/4qb0w1290461686.png",intern=TRUE))
character(0)
> try(system("convert tmp/5qb0w1290461686.ps tmp/5qb0w1290461686.png",intern=TRUE))
character(0)
> try(system("convert tmp/6i2hh1290461686.ps tmp/6i2hh1290461686.png",intern=TRUE))
character(0)
> try(system("convert tmp/7btz11290461686.ps tmp/7btz11290461686.png",intern=TRUE))
character(0)
> try(system("convert tmp/8btz11290461686.ps tmp/8btz11290461686.png",intern=TRUE))
character(0)
> try(system("convert tmp/9btz11290461686.ps tmp/9btz11290461686.png",intern=TRUE))
character(0)
> try(system("convert tmp/10ev1z1290461687.ps tmp/10ev1z1290461687.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
5.310 2.090 7.414