R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-pc-linux-gnu (32-bit)
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
+ ,7
+ ,7
+ ,5
+ ,5
+ ,5
+ ,5
+ ,5
+ ,6
+ ,5
+ ,4
+ ,4
+ ,4
+ ,5
+ ,5
+ ,5
+ ,5
+ ,5
+ ,5
+ ,5
+ ,6
+ ,6
+ ,6
+ ,7
+ ,7
+ ,4
+ ,7
+ ,7
+ ,6
+ ,5
+ ,5
+ ,6
+ ,6
+ ,7
+ ,7
+ ,6
+ ,6
+ ,5
+ ,5
+ ,6
+ ,5
+ ,2
+ ,4
+ ,6
+ ,5
+ ,5
+ ,6
+ ,6
+ ,4
+ ,5
+ ,4
+ ,6
+ ,6
+ ,6
+ ,6
+ ,6
+ ,6
+ ,6
+ ,7
+ ,7
+ ,5
+ ,5
+ ,6
+ ,5
+ ,3
+ ,3
+ ,4
+ ,3
+ ,7
+ ,6
+ ,6
+ ,7
+ ,3
+ ,5
+ ,6
+ ,6
+ ,5
+ ,5
+ ,6
+ ,6
+ ,3
+ ,3
+ ,4
+ ,4
+ ,5
+ ,5
+ ,5
+ ,6
+ ,2
+ ,1
+ ,2
+ ,2
+ ,6
+ ,5
+ ,6
+ ,6
+ ,3
+ ,4
+ ,5
+ ,5
+ ,6
+ ,6
+ ,6
+ ,7
+ ,6
+ ,6
+ ,6
+ ,7
+ ,5
+ ,4
+ ,5
+ ,5
+ ,5
+ ,4
+ ,5
+ ,6
+ ,7
+ ,5
+ ,5
+ ,6
+ ,6
+ ,4
+ ,6
+ ,6
+ ,5
+ ,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5
+ ,6
+ ,4
+ ,5
+ ,4
+ ,4
+ ,5
+ ,5
+ ,5
+ ,5
+ ,5)
+ ,dim=c(4
+ ,162)
+ ,dimnames=list(c('Q2'
+ ,'Q9'
+ ,'Q16'
+ ,'Q23')
+ ,1:162))
> y <- array(NA,dim=c(4,162),dimnames=list(c('Q2','Q9','Q16','Q23'),1:162))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '1'
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from 'package:base':
as.Date, 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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7 7 6
101 4 5 6 6
102 5 5 5 5
103 6 6 6 6
104 5 5 6 6
105 5 5 5 5
106 4 4 5 5
107 4 5 5 4
108 6 6 5 7
109 5 5 7 7
110 6 5 6 5
111 5 4 7 7
112 6 4 6 6
113 5 5 5 5
114 4 5 4 5
115 6 6 6 7
116 4 5 4 5
117 5 3 3 5
118 5 5 5 5
119 6 3 5 5
120 3 4 5 3
121 5 4 5 5
122 4 5 5 5
123 5 2 5 4
124 5 5 3 4
125 7 7 7 7
126 5 6 6 6
127 7 6 6 6
128 5 5 4 6
129 4 4 4 5
130 6 6 6 5
131 4 3 4 5
132 4 7 6 6
133 4 3 2 2
134 4 4 5 5
135 6 6 5 7
136 6 5 6 6
137 5 6 5 5
138 3 4 4 5
139 6 6 6 6
140 5 6 6 6
141 4 4 5 5
142 5 5 5 5
143 2 3 2 2
144 5 6 6 7
145 7 5 6 7
146 4 6 5 5
147 4 5 6 6
148 7 6 7 5
149 6 5 5 6
150 5 6 5 5
151 5 5 5 6
152 5 5 6 6
153 7 6 7 7
154 6 5 7 6
155 6 6 6 6
156 5 5 5 6
157 2 4 6 6
158 4 4 4 4
159 6 4 6 6
160 5 5 6 4
161 5 4 4 5
162 5 5 5 5
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Q9 Q16 Q23
0.6441 0.2754 0.1359 0.4386
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-3.1928 -0.4788 0.0265 0.6651 1.9325
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.64415 0.41541 1.551 0.122992
Q9 0.27537 0.07764 3.547 0.000513 ***
Q16 0.13594 0.09914 1.371 0.172239
Q23 0.43858 0.09543 4.596 8.77e-06 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.9016 on 158 degrees of freedom
Multiple R-squared: 0.4366, Adjusted R-squared: 0.4259
F-statistic: 40.81 on 3 and 158 DF, p-value: < 2.2e-16
> 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.81132364 0.37735272 0.1886764
[2,] 0.74673675 0.50652650 0.2532632
[3,] 0.66496199 0.67007603 0.3350380
[4,] 0.58011835 0.83976331 0.4198817
[5,] 0.46619281 0.93238563 0.5338072
[6,] 0.47642232 0.95284464 0.5235777
[7,] 0.46196462 0.92392923 0.5380354
[8,] 0.36899792 0.73799585 0.6310021
[9,] 0.29411850 0.58823699 0.7058815
[10,] 0.29747803 0.59495606 0.7025220
[11,] 0.36319480 0.72638960 0.6368052
[12,] 0.34545582 0.69091165 0.6545442
[13,] 0.83527132 0.32945736 0.1647287
[14,] 0.80058516 0.39882968 0.1994148
[15,] 0.78143926 0.43712148 0.2185607
[16,] 0.73115048 0.53769903 0.2688495
[17,] 0.67140513 0.65718975 0.3285949
[18,] 0.62651696 0.74696608 0.3734830
[19,] 0.73361239 0.53277522 0.2663876
[20,] 0.67919039 0.64161922 0.3208096
[21,] 0.62111715 0.75776570 0.3788829
[22,] 0.57424110 0.85151781 0.4257589
[23,] 0.51236158 0.97527683 0.4876384
[24,] 0.65232915 0.69534170 0.3476708
[25,] 0.63908310 0.72183380 0.3609169
[26,] 0.59941358 0.80117284 0.4005864
[27,] 0.54407434 0.91185132 0.4559257
[28,] 0.49103692 0.98207383 0.5089631
[29,] 0.50630894 0.98738213 0.4936911
[30,] 0.47673467 0.95346934 0.5232653
[31,] 0.45129114 0.90258229 0.5487089
[32,] 0.39713138 0.79426276 0.6028686
[33,] 0.35239891 0.70479782 0.6476011
[34,] 0.32684037 0.65368074 0.6731596
[35,] 0.31790218 0.63580436 0.6820978
[36,] 0.29873589 0.59747178 0.7012641
[37,] 0.25424793 0.50849585 0.7457521
[38,] 0.21386067 0.42772134 0.7861393
[39,] 0.21892775 0.43785549 0.7810723
[40,] 0.27243151 0.54486303 0.7275685
[41,] 0.26851961 0.53703922 0.7314804
[42,] 0.26117585 0.52235171 0.7388241
[43,] 0.27316419 0.54632839 0.7268358
[44,] 0.43745322 0.87490645 0.5625468
[45,] 0.43319870 0.86639740 0.5668013
[46,] 0.42054737 0.84109475 0.5794526
[47,] 0.39742724 0.79485449 0.6025728
[48,] 0.48039537 0.96079074 0.5196046
[49,] 0.43450804 0.86901608 0.5654920
[50,] 0.61169745 0.77660511 0.3883026
[51,] 0.56492035 0.87015931 0.4350797
[52,] 0.52006879 0.95986243 0.4799312
[53,] 0.86964096 0.26071809 0.1303590
[54,] 0.85038794 0.29922412 0.1496121
[55,] 0.87907343 0.24185314 0.1209266
[56,] 0.86560161 0.26879678 0.1343984
[57,] 0.84037698 0.31924604 0.1596230
[58,] 0.81605468 0.36789063 0.1839453
[59,] 0.78810467 0.42379066 0.2118953
[60,] 0.78070507 0.43858985 0.2192949
[61,] 0.74784702 0.50430596 0.2521530
[62,] 0.71119727 0.57760545 0.2888027
[63,] 0.69336453 0.61327095 0.3066355
[64,] 0.73918096 0.52163808 0.2608190
[65,] 0.70668098 0.58663803 0.2933190
[66,] 0.68017517 0.63964967 0.3198248
[67,] 0.64931514 0.70136972 0.3506849
[68,] 0.60985563 0.78028873 0.3901444
[69,] 0.56940088 0.86119824 0.4305991
[70,] 0.52427779 0.95144441 0.4757222
[71,] 0.47889137 0.95778275 0.5211086
[72,] 0.50088322 0.99823355 0.4991168
[73,] 0.49610249 0.99220498 0.5038975
[74,] 0.45108390 0.90216780 0.5489161
[75,] 0.49907430 0.99814860 0.5009257
[76,] 0.65494511 0.69010978 0.3450549
[77,] 0.62715355 0.74569291 0.3728465
[78,] 0.58347123 0.83305755 0.4165288
[79,] 0.67905190 0.64189619 0.3209481
[80,] 0.71987425 0.56025151 0.2801258
[81,] 0.68163547 0.63672906 0.3183645
[82,] 0.65166400 0.69667201 0.3483360
[83,] 0.63184570 0.73630861 0.3681543
[84,] 0.58827425 0.82345150 0.4117258
[85,] 0.60704078 0.78591844 0.3929592
[86,] 0.60696879 0.78606242 0.3930312
[87,] 0.59553496 0.80893008 0.4044650
[88,] 0.57926963 0.84146075 0.4207304
[89,] 0.53421626 0.93156748 0.4657837
[90,] 0.49481740 0.98963480 0.5051826
[91,] 0.45279751 0.90559503 0.5472025
[92,] 0.40869155 0.81738311 0.5913084
[93,] 0.49504116 0.99008232 0.5049588
[94,] 0.44947817 0.89895634 0.5505218
[95,] 0.52076129 0.95847743 0.4792387
[96,] 0.47436253 0.94872506 0.5256375
[97,] 0.43473167 0.86946334 0.5652683
[98,] 0.39890620 0.79781240 0.6010938
[99,] 0.35443290 0.70886580 0.6455671
[100,] 0.33266701 0.66533401 0.6673330
[101,] 0.30290197 0.60580394 0.6970980
[102,] 0.27053513 0.54107025 0.7294649
[103,] 0.28021393 0.56042786 0.7197861
[104,] 0.28037702 0.56075404 0.7196230
[105,] 0.27713432 0.55426865 0.7228657
[106,] 0.26118352 0.52236705 0.7388165
[107,] 0.22330685 0.44661370 0.7766931
[108,] 0.20600855 0.41201710 0.7939915
[109,] 0.17373732 0.34747465 0.8262627
[110,] 0.15853218 0.31706435 0.8414678
[111,] 0.16210793 0.32421586 0.8378921
[112,] 0.13332471 0.26664943 0.8666753
[113,] 0.19584777 0.39169553 0.8041522
[114,] 0.20745771 0.41491543 0.7925423
[115,] 0.17752555 0.35505110 0.8224745
[116,] 0.17422157 0.34844314 0.8257784
[117,] 0.20638064 0.41276129 0.7936194
[118,] 0.20397707 0.40795415 0.7960229
[119,] 0.17708727 0.35417453 0.8229127
[120,] 0.16060840 0.32121680 0.8393916
[121,] 0.19893418 0.39786836 0.8010658
[122,] 0.16878067 0.33756133 0.8312193
[123,] 0.13847961 0.27695922 0.8615204
[124,] 0.12178868 0.24357735 0.8782113
[125,] 0.09550902 0.19101805 0.9044910
[126,] 0.21282216 0.42564432 0.7871778
[127,] 0.32014150 0.64028299 0.6798585
[128,] 0.27430473 0.54860946 0.7256953
[129,] 0.23216343 0.46432686 0.7678366
[130,] 0.20775019 0.41550037 0.7922498
[131,] 0.16604538 0.33209077 0.8339546
[132,] 0.17202340 0.34404680 0.8279766
[133,] 0.13497798 0.26995596 0.8650220
[134,] 0.12266867 0.24533734 0.8773313
[135,] 0.09521357 0.19042714 0.9047864
[136,] 0.06959878 0.13919757 0.9304012
[137,] 0.05027849 0.10055699 0.9497215
[138,] 0.05632311 0.11264622 0.9436769
[139,] 0.07684916 0.15369831 0.9231508
[140,] 0.13252013 0.26504026 0.8674799
[141,] 0.17714024 0.35428048 0.8228598
[142,] 0.17335175 0.34670350 0.8266482
[143,] 0.15135424 0.30270849 0.8486458
[144,] 0.13488694 0.26977389 0.8651131
[145,] 0.09062570 0.18125139 0.9093743
[146,] 0.05818097 0.11636193 0.9418190
[147,] 0.03804742 0.07609484 0.9619526
[148,] 0.03057119 0.06114239 0.9694288
[149,] 0.01367090 0.02734180 0.9863291
> postscript(file="/var/wessaorg/rcomp/tmp/10vw01353318648.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/2zyje1353318648.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/wessaorg/rcomp/tmp/391lf1353318648.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/wessaorg/rcomp/tmp/447vc1353318648.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/wessaorg/rcomp/tmp/5k5s21353318648.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 = 162
Frequency = 1
1 2 3 4 5 6
1.28375006 0.10637694 1.68090185 -0.89362306 0.10637694 -0.18209891
7 8 9 10 11 12
1.23269682 0.66779573 -0.15483115 0.66779573 0.62984862 -0.46814798
13 14 15 16 17 18
-1.19626056 0.25648229 -0.31804263 -0.02956678 -0.32977749 0.81790109
19 20 21 22 23 24
-2.46814798 -0.46814798 -0.76835870 -0.33220427 -0.06856941 0.53185202
25 26 27 28 29 30
-1.61825334 -0.18209891 -0.18209891 0.38174666 -0.05683455 1.66779573
31 32 33 34 35 36
0.80722174 -0.46814798 -0.16899279 0.23164130 -1.02956678 0.66779573
37 38 39 40 41 42
0.65711639 0.10637694 0.40658765 -0.60757400 0.82032787 0.83448951
43 44 45 46 47 48
0.10637694 0.12053858 0.98111257 1.36758502 0.95627158 -0.74351771
49 50 51 52 53 54
1.10637694 -1.93157018 -0.92089083 -0.75419705 0.66779573 -1.48230963
55 56 57 58 59 60
0.25648229 1.93248611 -0.05683455 0.25648229 -2.87703464 -0.46814798
61 62 63 64 65 66
1.39242600 -0.61825334 -0.16899279 0.39242600 -0.31909815 0.83100721
67 68 69 70 71 72
0.25648229 -0.19277826 -0.60757400 -1.34288361 -0.33220427 0.53185202
73 74 75 76 77 78
-0.46814798 0.25648229 0.25648229 -0.04372842 -0.04372842 1.10637694
79 80 81 82 83 84
0.81790109 -0.07099619 -1.31804263 1.93248611 0.53185202 0.08259147
85 86 87 88 89 90
-1.61825334 1.25648229 0.09327081 -0.48230963 -0.59098557 0.10637694
91 92 93 94 95 96
-1.04372842 0.84516885 0.80722174 0.69506350 -0.04372842 0.38174666
97 98 99 100 101 102
-0.18209891 0.21853518 1.51769037 -0.15483115 -1.46814798 0.10637694
103 104 105 106 107 108
0.25648229 -0.46814798 0.10637694 -0.61825334 -0.45504186 -0.04615520
109 110 111 112 113 114
-1.04267290 0.97043322 -0.76730318 0.80722174 0.10637694 -0.75767935
115 116 117 118 119 120
-0.18209891 -0.75767935 0.92900381 0.10637694 1.65711639 -0.74109093
121 122 123 124 125 126
0.38174666 -0.89362306 1.37106732 0.81684557 0.40658765 -0.74351771
127 128 129 130 131 132
1.25648229 -0.19626056 -0.48230963 0.69506350 -0.20693990 -2.01888743
133 134 135 136 137 138
1.38069114 -0.61825334 -0.04615520 0.53185202 -0.16899279 -1.48230963
139 140 141 142 143 144
0.25648229 -0.74351771 -0.61825334 0.10637694 -0.61930886 -1.18209891
145 146 147 148 149 150
1.09327081 -1.16899279 -1.46814798 1.55911979 0.66779573 -0.16899279
151 152 153 154 155 156
-0.33220427 -0.46814798 0.68195737 0.39590830 0.25648229 -0.33220427
157 158 159 160 161 162
-3.19277826 -0.04372842 0.80722174 0.40901443 0.51769037 0.10637694
> postscript(file="/var/wessaorg/rcomp/tmp/68g8u1353318648.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 = 162
Frequency = 1
lag(myerror, k = 1) myerror
0 1.28375006 NA
1 0.10637694 1.28375006
2 1.68090185 0.10637694
3 -0.89362306 1.68090185
4 0.10637694 -0.89362306
5 -0.18209891 0.10637694
6 1.23269682 -0.18209891
7 0.66779573 1.23269682
8 -0.15483115 0.66779573
9 0.66779573 -0.15483115
10 0.62984862 0.66779573
11 -0.46814798 0.62984862
12 -1.19626056 -0.46814798
13 0.25648229 -1.19626056
14 -0.31804263 0.25648229
15 -0.02956678 -0.31804263
16 -0.32977749 -0.02956678
17 0.81790109 -0.32977749
18 -2.46814798 0.81790109
19 -0.46814798 -2.46814798
20 -0.76835870 -0.46814798
21 -0.33220427 -0.76835870
22 -0.06856941 -0.33220427
23 0.53185202 -0.06856941
24 -1.61825334 0.53185202
25 -0.18209891 -1.61825334
26 -0.18209891 -0.18209891
27 0.38174666 -0.18209891
28 -0.05683455 0.38174666
29 1.66779573 -0.05683455
30 0.80722174 1.66779573
31 -0.46814798 0.80722174
32 -0.16899279 -0.46814798
33 0.23164130 -0.16899279
34 -1.02956678 0.23164130
35 0.66779573 -1.02956678
36 0.65711639 0.66779573
37 0.10637694 0.65711639
38 0.40658765 0.10637694
39 -0.60757400 0.40658765
40 0.82032787 -0.60757400
41 0.83448951 0.82032787
42 0.10637694 0.83448951
43 0.12053858 0.10637694
44 0.98111257 0.12053858
45 1.36758502 0.98111257
46 0.95627158 1.36758502
47 -0.74351771 0.95627158
48 1.10637694 -0.74351771
49 -1.93157018 1.10637694
50 -0.92089083 -1.93157018
51 -0.75419705 -0.92089083
52 0.66779573 -0.75419705
53 -1.48230963 0.66779573
54 0.25648229 -1.48230963
55 1.93248611 0.25648229
56 -0.05683455 1.93248611
57 0.25648229 -0.05683455
58 -2.87703464 0.25648229
59 -0.46814798 -2.87703464
60 1.39242600 -0.46814798
61 -0.61825334 1.39242600
62 -0.16899279 -0.61825334
63 0.39242600 -0.16899279
64 -0.31909815 0.39242600
65 0.83100721 -0.31909815
66 0.25648229 0.83100721
67 -0.19277826 0.25648229
68 -0.60757400 -0.19277826
69 -1.34288361 -0.60757400
70 -0.33220427 -1.34288361
71 0.53185202 -0.33220427
72 -0.46814798 0.53185202
73 0.25648229 -0.46814798
74 0.25648229 0.25648229
75 -0.04372842 0.25648229
76 -0.04372842 -0.04372842
77 1.10637694 -0.04372842
78 0.81790109 1.10637694
79 -0.07099619 0.81790109
80 -1.31804263 -0.07099619
81 1.93248611 -1.31804263
82 0.53185202 1.93248611
83 0.08259147 0.53185202
84 -1.61825334 0.08259147
85 1.25648229 -1.61825334
86 0.09327081 1.25648229
87 -0.48230963 0.09327081
88 -0.59098557 -0.48230963
89 0.10637694 -0.59098557
90 -1.04372842 0.10637694
91 0.84516885 -1.04372842
92 0.80722174 0.84516885
93 0.69506350 0.80722174
94 -0.04372842 0.69506350
95 0.38174666 -0.04372842
96 -0.18209891 0.38174666
97 0.21853518 -0.18209891
98 1.51769037 0.21853518
99 -0.15483115 1.51769037
100 -1.46814798 -0.15483115
101 0.10637694 -1.46814798
102 0.25648229 0.10637694
103 -0.46814798 0.25648229
104 0.10637694 -0.46814798
105 -0.61825334 0.10637694
106 -0.45504186 -0.61825334
107 -0.04615520 -0.45504186
108 -1.04267290 -0.04615520
109 0.97043322 -1.04267290
110 -0.76730318 0.97043322
111 0.80722174 -0.76730318
112 0.10637694 0.80722174
113 -0.75767935 0.10637694
114 -0.18209891 -0.75767935
115 -0.75767935 -0.18209891
116 0.92900381 -0.75767935
117 0.10637694 0.92900381
118 1.65711639 0.10637694
119 -0.74109093 1.65711639
120 0.38174666 -0.74109093
121 -0.89362306 0.38174666
122 1.37106732 -0.89362306
123 0.81684557 1.37106732
124 0.40658765 0.81684557
125 -0.74351771 0.40658765
126 1.25648229 -0.74351771
127 -0.19626056 1.25648229
128 -0.48230963 -0.19626056
129 0.69506350 -0.48230963
130 -0.20693990 0.69506350
131 -2.01888743 -0.20693990
132 1.38069114 -2.01888743
133 -0.61825334 1.38069114
134 -0.04615520 -0.61825334
135 0.53185202 -0.04615520
136 -0.16899279 0.53185202
137 -1.48230963 -0.16899279
138 0.25648229 -1.48230963
139 -0.74351771 0.25648229
140 -0.61825334 -0.74351771
141 0.10637694 -0.61825334
142 -0.61930886 0.10637694
143 -1.18209891 -0.61930886
144 1.09327081 -1.18209891
145 -1.16899279 1.09327081
146 -1.46814798 -1.16899279
147 1.55911979 -1.46814798
148 0.66779573 1.55911979
149 -0.16899279 0.66779573
150 -0.33220427 -0.16899279
151 -0.46814798 -0.33220427
152 0.68195737 -0.46814798
153 0.39590830 0.68195737
154 0.25648229 0.39590830
155 -0.33220427 0.25648229
156 -3.19277826 -0.33220427
157 -0.04372842 -3.19277826
158 0.80722174 -0.04372842
159 0.40901443 0.80722174
160 0.51769037 0.40901443
161 0.10637694 0.51769037
162 NA 0.10637694
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.10637694 1.28375006
[2,] 1.68090185 0.10637694
[3,] -0.89362306 1.68090185
[4,] 0.10637694 -0.89362306
[5,] -0.18209891 0.10637694
[6,] 1.23269682 -0.18209891
[7,] 0.66779573 1.23269682
[8,] -0.15483115 0.66779573
[9,] 0.66779573 -0.15483115
[10,] 0.62984862 0.66779573
[11,] -0.46814798 0.62984862
[12,] -1.19626056 -0.46814798
[13,] 0.25648229 -1.19626056
[14,] -0.31804263 0.25648229
[15,] -0.02956678 -0.31804263
[16,] -0.32977749 -0.02956678
[17,] 0.81790109 -0.32977749
[18,] -2.46814798 0.81790109
[19,] -0.46814798 -2.46814798
[20,] -0.76835870 -0.46814798
[21,] -0.33220427 -0.76835870
[22,] -0.06856941 -0.33220427
[23,] 0.53185202 -0.06856941
[24,] -1.61825334 0.53185202
[25,] -0.18209891 -1.61825334
[26,] -0.18209891 -0.18209891
[27,] 0.38174666 -0.18209891
[28,] -0.05683455 0.38174666
[29,] 1.66779573 -0.05683455
[30,] 0.80722174 1.66779573
[31,] -0.46814798 0.80722174
[32,] -0.16899279 -0.46814798
[33,] 0.23164130 -0.16899279
[34,] -1.02956678 0.23164130
[35,] 0.66779573 -1.02956678
[36,] 0.65711639 0.66779573
[37,] 0.10637694 0.65711639
[38,] 0.40658765 0.10637694
[39,] -0.60757400 0.40658765
[40,] 0.82032787 -0.60757400
[41,] 0.83448951 0.82032787
[42,] 0.10637694 0.83448951
[43,] 0.12053858 0.10637694
[44,] 0.98111257 0.12053858
[45,] 1.36758502 0.98111257
[46,] 0.95627158 1.36758502
[47,] -0.74351771 0.95627158
[48,] 1.10637694 -0.74351771
[49,] -1.93157018 1.10637694
[50,] -0.92089083 -1.93157018
[51,] -0.75419705 -0.92089083
[52,] 0.66779573 -0.75419705
[53,] -1.48230963 0.66779573
[54,] 0.25648229 -1.48230963
[55,] 1.93248611 0.25648229
[56,] -0.05683455 1.93248611
[57,] 0.25648229 -0.05683455
[58,] -2.87703464 0.25648229
[59,] -0.46814798 -2.87703464
[60,] 1.39242600 -0.46814798
[61,] -0.61825334 1.39242600
[62,] -0.16899279 -0.61825334
[63,] 0.39242600 -0.16899279
[64,] -0.31909815 0.39242600
[65,] 0.83100721 -0.31909815
[66,] 0.25648229 0.83100721
[67,] -0.19277826 0.25648229
[68,] -0.60757400 -0.19277826
[69,] -1.34288361 -0.60757400
[70,] -0.33220427 -1.34288361
[71,] 0.53185202 -0.33220427
[72,] -0.46814798 0.53185202
[73,] 0.25648229 -0.46814798
[74,] 0.25648229 0.25648229
[75,] -0.04372842 0.25648229
[76,] -0.04372842 -0.04372842
[77,] 1.10637694 -0.04372842
[78,] 0.81790109 1.10637694
[79,] -0.07099619 0.81790109
[80,] -1.31804263 -0.07099619
[81,] 1.93248611 -1.31804263
[82,] 0.53185202 1.93248611
[83,] 0.08259147 0.53185202
[84,] -1.61825334 0.08259147
[85,] 1.25648229 -1.61825334
[86,] 0.09327081 1.25648229
[87,] -0.48230963 0.09327081
[88,] -0.59098557 -0.48230963
[89,] 0.10637694 -0.59098557
[90,] -1.04372842 0.10637694
[91,] 0.84516885 -1.04372842
[92,] 0.80722174 0.84516885
[93,] 0.69506350 0.80722174
[94,] -0.04372842 0.69506350
[95,] 0.38174666 -0.04372842
[96,] -0.18209891 0.38174666
[97,] 0.21853518 -0.18209891
[98,] 1.51769037 0.21853518
[99,] -0.15483115 1.51769037
[100,] -1.46814798 -0.15483115
[101,] 0.10637694 -1.46814798
[102,] 0.25648229 0.10637694
[103,] -0.46814798 0.25648229
[104,] 0.10637694 -0.46814798
[105,] -0.61825334 0.10637694
[106,] -0.45504186 -0.61825334
[107,] -0.04615520 -0.45504186
[108,] -1.04267290 -0.04615520
[109,] 0.97043322 -1.04267290
[110,] -0.76730318 0.97043322
[111,] 0.80722174 -0.76730318
[112,] 0.10637694 0.80722174
[113,] -0.75767935 0.10637694
[114,] -0.18209891 -0.75767935
[115,] -0.75767935 -0.18209891
[116,] 0.92900381 -0.75767935
[117,] 0.10637694 0.92900381
[118,] 1.65711639 0.10637694
[119,] -0.74109093 1.65711639
[120,] 0.38174666 -0.74109093
[121,] -0.89362306 0.38174666
[122,] 1.37106732 -0.89362306
[123,] 0.81684557 1.37106732
[124,] 0.40658765 0.81684557
[125,] -0.74351771 0.40658765
[126,] 1.25648229 -0.74351771
[127,] -0.19626056 1.25648229
[128,] -0.48230963 -0.19626056
[129,] 0.69506350 -0.48230963
[130,] -0.20693990 0.69506350
[131,] -2.01888743 -0.20693990
[132,] 1.38069114 -2.01888743
[133,] -0.61825334 1.38069114
[134,] -0.04615520 -0.61825334
[135,] 0.53185202 -0.04615520
[136,] -0.16899279 0.53185202
[137,] -1.48230963 -0.16899279
[138,] 0.25648229 -1.48230963
[139,] -0.74351771 0.25648229
[140,] -0.61825334 -0.74351771
[141,] 0.10637694 -0.61825334
[142,] -0.61930886 0.10637694
[143,] -1.18209891 -0.61930886
[144,] 1.09327081 -1.18209891
[145,] -1.16899279 1.09327081
[146,] -1.46814798 -1.16899279
[147,] 1.55911979 -1.46814798
[148,] 0.66779573 1.55911979
[149,] -0.16899279 0.66779573
[150,] -0.33220427 -0.16899279
[151,] -0.46814798 -0.33220427
[152,] 0.68195737 -0.46814798
[153,] 0.39590830 0.68195737
[154,] 0.25648229 0.39590830
[155,] -0.33220427 0.25648229
[156,] -3.19277826 -0.33220427
[157,] -0.04372842 -3.19277826
[158,] 0.80722174 -0.04372842
[159,] 0.40901443 0.80722174
[160,] 0.51769037 0.40901443
[161,] 0.10637694 0.51769037
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.10637694 1.28375006
2 1.68090185 0.10637694
3 -0.89362306 1.68090185
4 0.10637694 -0.89362306
5 -0.18209891 0.10637694
6 1.23269682 -0.18209891
7 0.66779573 1.23269682
8 -0.15483115 0.66779573
9 0.66779573 -0.15483115
10 0.62984862 0.66779573
11 -0.46814798 0.62984862
12 -1.19626056 -0.46814798
13 0.25648229 -1.19626056
14 -0.31804263 0.25648229
15 -0.02956678 -0.31804263
16 -0.32977749 -0.02956678
17 0.81790109 -0.32977749
18 -2.46814798 0.81790109
19 -0.46814798 -2.46814798
20 -0.76835870 -0.46814798
21 -0.33220427 -0.76835870
22 -0.06856941 -0.33220427
23 0.53185202 -0.06856941
24 -1.61825334 0.53185202
25 -0.18209891 -1.61825334
26 -0.18209891 -0.18209891
27 0.38174666 -0.18209891
28 -0.05683455 0.38174666
29 1.66779573 -0.05683455
30 0.80722174 1.66779573
31 -0.46814798 0.80722174
32 -0.16899279 -0.46814798
33 0.23164130 -0.16899279
34 -1.02956678 0.23164130
35 0.66779573 -1.02956678
36 0.65711639 0.66779573
37 0.10637694 0.65711639
38 0.40658765 0.10637694
39 -0.60757400 0.40658765
40 0.82032787 -0.60757400
41 0.83448951 0.82032787
42 0.10637694 0.83448951
43 0.12053858 0.10637694
44 0.98111257 0.12053858
45 1.36758502 0.98111257
46 0.95627158 1.36758502
47 -0.74351771 0.95627158
48 1.10637694 -0.74351771
49 -1.93157018 1.10637694
50 -0.92089083 -1.93157018
51 -0.75419705 -0.92089083
52 0.66779573 -0.75419705
53 -1.48230963 0.66779573
54 0.25648229 -1.48230963
55 1.93248611 0.25648229
56 -0.05683455 1.93248611
57 0.25648229 -0.05683455
58 -2.87703464 0.25648229
59 -0.46814798 -2.87703464
60 1.39242600 -0.46814798
61 -0.61825334 1.39242600
62 -0.16899279 -0.61825334
63 0.39242600 -0.16899279
64 -0.31909815 0.39242600
65 0.83100721 -0.31909815
66 0.25648229 0.83100721
67 -0.19277826 0.25648229
68 -0.60757400 -0.19277826
69 -1.34288361 -0.60757400
70 -0.33220427 -1.34288361
71 0.53185202 -0.33220427
72 -0.46814798 0.53185202
73 0.25648229 -0.46814798
74 0.25648229 0.25648229
75 -0.04372842 0.25648229
76 -0.04372842 -0.04372842
77 1.10637694 -0.04372842
78 0.81790109 1.10637694
79 -0.07099619 0.81790109
80 -1.31804263 -0.07099619
81 1.93248611 -1.31804263
82 0.53185202 1.93248611
83 0.08259147 0.53185202
84 -1.61825334 0.08259147
85 1.25648229 -1.61825334
86 0.09327081 1.25648229
87 -0.48230963 0.09327081
88 -0.59098557 -0.48230963
89 0.10637694 -0.59098557
90 -1.04372842 0.10637694
91 0.84516885 -1.04372842
92 0.80722174 0.84516885
93 0.69506350 0.80722174
94 -0.04372842 0.69506350
95 0.38174666 -0.04372842
96 -0.18209891 0.38174666
97 0.21853518 -0.18209891
98 1.51769037 0.21853518
99 -0.15483115 1.51769037
100 -1.46814798 -0.15483115
101 0.10637694 -1.46814798
102 0.25648229 0.10637694
103 -0.46814798 0.25648229
104 0.10637694 -0.46814798
105 -0.61825334 0.10637694
106 -0.45504186 -0.61825334
107 -0.04615520 -0.45504186
108 -1.04267290 -0.04615520
109 0.97043322 -1.04267290
110 -0.76730318 0.97043322
111 0.80722174 -0.76730318
112 0.10637694 0.80722174
113 -0.75767935 0.10637694
114 -0.18209891 -0.75767935
115 -0.75767935 -0.18209891
116 0.92900381 -0.75767935
117 0.10637694 0.92900381
118 1.65711639 0.10637694
119 -0.74109093 1.65711639
120 0.38174666 -0.74109093
121 -0.89362306 0.38174666
122 1.37106732 -0.89362306
123 0.81684557 1.37106732
124 0.40658765 0.81684557
125 -0.74351771 0.40658765
126 1.25648229 -0.74351771
127 -0.19626056 1.25648229
128 -0.48230963 -0.19626056
129 0.69506350 -0.48230963
130 -0.20693990 0.69506350
131 -2.01888743 -0.20693990
132 1.38069114 -2.01888743
133 -0.61825334 1.38069114
134 -0.04615520 -0.61825334
135 0.53185202 -0.04615520
136 -0.16899279 0.53185202
137 -1.48230963 -0.16899279
138 0.25648229 -1.48230963
139 -0.74351771 0.25648229
140 -0.61825334 -0.74351771
141 0.10637694 -0.61825334
142 -0.61930886 0.10637694
143 -1.18209891 -0.61930886
144 1.09327081 -1.18209891
145 -1.16899279 1.09327081
146 -1.46814798 -1.16899279
147 1.55911979 -1.46814798
148 0.66779573 1.55911979
149 -0.16899279 0.66779573
150 -0.33220427 -0.16899279
151 -0.46814798 -0.33220427
152 0.68195737 -0.46814798
153 0.39590830 0.68195737
154 0.25648229 0.39590830
155 -0.33220427 0.25648229
156 -3.19277826 -0.33220427
157 -0.04372842 -3.19277826
158 0.80722174 -0.04372842
159 0.40901443 0.80722174
160 0.51769037 0.40901443
161 0.10637694 0.51769037
> 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/wessaorg/rcomp/tmp/7vvsc1353318648.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/wessaorg/rcomp/tmp/86kc71353318648.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/wessaorg/rcomp/tmp/9u1sx1353318648.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/wessaorg/rcomp/tmp/107o8p1353318648.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/1155ac1353318648.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/wessaorg/rcomp/tmp/12b69t1353318648.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/wessaorg/rcomp/tmp/13nrwj1353318648.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/wessaorg/rcomp/tmp/14pr061353318649.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/wessaorg/rcomp/tmp/15tln11353318649.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/wessaorg/rcomp/tmp/16wkms1353318649.tab")
+ }
>
> try(system("convert tmp/10vw01353318648.ps tmp/10vw01353318648.png",intern=TRUE))
character(0)
> try(system("convert tmp/2zyje1353318648.ps tmp/2zyje1353318648.png",intern=TRUE))
character(0)
> try(system("convert tmp/391lf1353318648.ps tmp/391lf1353318648.png",intern=TRUE))
character(0)
> try(system("convert tmp/447vc1353318648.ps tmp/447vc1353318648.png",intern=TRUE))
character(0)
> try(system("convert tmp/5k5s21353318648.ps tmp/5k5s21353318648.png",intern=TRUE))
character(0)
> try(system("convert tmp/68g8u1353318648.ps tmp/68g8u1353318648.png",intern=TRUE))
character(0)
> try(system("convert tmp/7vvsc1353318648.ps tmp/7vvsc1353318648.png",intern=TRUE))
character(0)
> try(system("convert tmp/86kc71353318648.ps tmp/86kc71353318648.png",intern=TRUE))
character(0)
> try(system("convert tmp/9u1sx1353318648.ps tmp/9u1sx1353318648.png",intern=TRUE))
character(0)
> try(system("convert tmp/107o8p1353318648.ps tmp/107o8p1353318648.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
9.308 1.292 10.595