R version 2.9.0 (2009-04-17)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> x <- array(list(2
+ ,2
+ ,1
+ ,4
+ ,3
+ ,3
+ ,3
+ ,3
+ ,3
+ ,2
+ ,3
+ ,4
+ ,3
+ ,3
+ ,4
+ ,3
+ ,3
+ ,4
+ ,2
+ ,3
+ ,4
+ ,4
+ ,4
+ ,3
+ ,3
+ ,3
+ ,3
+ ,2
+ ,3
+ ,3
+ ,3
+ ,3
+ ,3
+ ,3
+ ,2
+ ,3
+ ,3
+ ,2
+ ,2
+ ,2
+ ,3
+ ,1
+ ,2
+ ,4
+ ,3
+ ,3
+ ,2
+ ,2
+ ,2
+ ,4
+ ,4
+ ,5
+ ,4
+ ,4
+ ,5
+ ,4
+ ,3
+ ,2
+ ,2
+ ,4
+ ,2
+ ,2
+ ,3
+ ,2
+ ,3
+ ,2
+ ,2
+ ,4
+ ,4
+ ,3
+ ,2
+ ,3
+ ,4
+ ,2
+ ,2
+ ,2
+ ,2
+ ,2
+ ,2
+ ,2
+ ,3
+ ,4
+ ,2
+ ,2
+ ,3
+ ,2
+ ,4
+ ,4
+ ,3
+ ,3
+ ,3
+ ,4
+ ,3
+ ,2
+ ,3
+ ,3
+ ,2
+ ,3
+ ,2
+ ,4
+ ,4
+ ,4
+ ,3
+ ,3
+ ,3
+ ,2
+ ,2
+ ,5
+ ,3
+ ,4
+ ,2
+ ,3
+ ,3
+ ,3
+ ,5
+ ,3
+ ,3
+ ,4
+ ,3
+ ,3
+ ,2
+ ,2
+ ,4
+ ,3
+ ,2
+ ,2
+ ,2
+ ,3
+ ,3
+ ,3
+ ,3
+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,3
+ ,3
+ ,3
+ ,4
+ ,3
+ ,1
+ ,3
+ ,3
+ ,4
+ ,2
+ ,3
+ ,4
+ ,3
+ ,2
+ ,3
+ ,3
+ ,1
+ ,3
+ ,3
+ ,5
+ ,3
+ ,5
+ ,5
+ ,4
+ ,2
+ ,3
+ ,3
+ ,4
+ ,3
+ ,4
+ ,4
+ ,4
+ ,2
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,3
+ ,4
+ ,3
+ ,4
+ ,3
+ ,3
+ ,3
+ ,3
+ ,2
+ ,4
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,2
+ ,2
+ ,3
+ ,3
+ ,2
+ ,3
+ ,2
+ ,3
+ ,3
+ ,3
+ ,3
+ ,4
+ ,4
+ ,4
+ ,3
+ ,3
+ ,3
+ ,3
+ ,4
+ ,3
+ ,4
+ ,4
+ ,4
+ ,3
+ ,1
+ ,1
+ ,3
+ ,3
+ ,3
+ ,4
+ ,2)
+ ,dim=c(8
+ ,156)
+ ,dimnames=list(c('Y'
+ ,'X1t'
+ ,'X2t'
+ ,'X3t'
+ ,'X4t'
+ ,'X5t'
+ ,'X6t'
+ ,'X7t')
+ ,1:156))
> y <- array(NA,dim=c(8,156),dimnames=list(c('Y','X1t','X2t','X3t','X4t','X5t','X6t','X7t'),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 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
Y X1t X2t X3t X4t X5t X6t X7t
1 2 2 1 4 3 3 3 3
2 3 2 3 4 3 3 4 3
3 3 4 2 3 4 4 4 3
4 3 3 3 2 3 3 3 3
5 3 3 2 3 3 2 2 2
6 3 1 2 4 3 3 2 2
7 2 4 4 5 4 4 5 4
8 3 2 2 4 2 2 3 2
9 3 2 2 4 4 3 2 3
10 4 2 2 2 2 2 2 2
11 3 4 2 2 3 2 4 4
12 3 3 3 4 3 2 3 3
13 2 3 2 4 4 4 3 3
14 3 2 2 5 3 4 2 3
15 3 3 5 3 3 4 3 3
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1 1
130 1 1 1 2 4 4 4 4
131 4 4 4 2 3 3 4 3
132 4 3 3 3 2 2 4 4
133 2 4 2 1 2 4 4 4
134 2 4 2 3 3 3 4 4
135 4 3 4 3 2 2 4 3
136 3 4 3 3 3 3 4 3
137 4 4 4 4 2 1 4 3
138 2 2 2 1 3 3 4 4
139 5 4 4 2 3 2 3 3
140 3 3 4 4 2 2 4 3
141 4 3 3 2 3 3 4 3
142 3 4 3 2 2 2 4 4
143 4 4 3 4 2 2 4 2
144 2 2 2 3 2 2 4 3
145 3 3 3 3 3 3 4 3
146 1 3 3 4 2 3 4 3
147 2 3 3 1 3 3 5 3
148 5 5 4 2 3 3 4 3
149 4 4 4 2 4 4 4 4
150 4 4 3 3 4 3 4 3
151 3 3 3 2 4 3 4 4
152 4 4 4 3 2 2 3 3
153 2 3 2 3 3 3 3 4
154 4 4 3 3 3 3 4 3
155 4 4 4 3 1 1 3 3
156 3 4 2 2 2 1 4 3
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X1t X2t X3t X4t X5t
0.53018 0.08203 0.38222 0.12542 -0.12083 -0.04125
X6t X7t
0.16539 0.13966
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-2.13973 -0.57708 0.04524 0.54741 2.00454
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.53018 0.54282 0.977 0.3303
X1t 0.08203 0.07292 1.125 0.2624
X2t 0.38222 0.08267 4.623 8.16e-06 ***
X3t 0.12542 0.07484 1.676 0.0959 .
X4t -0.12083 0.08220 -1.470 0.1437
X5t -0.04125 0.08737 -0.472 0.6375
X6t 0.16539 0.08064 2.051 0.0420 *
X7t 0.13966 0.07695 1.815 0.0716 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.7812 on 148 degrees of freedom
Multiple R-squared: 0.2072, Adjusted R-squared: 0.1697
F-statistic: 5.526 on 7 and 148 DF, p-value: 1.154e-05
> 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.21906137 0.4381227 0.78093863
[2,] 0.11359460 0.2271892 0.88640540
[3,] 0.05660164 0.1132033 0.94339836
[4,] 0.11906497 0.2381299 0.88093503
[5,] 0.08562226 0.1712445 0.91437774
[6,] 0.23382727 0.4676545 0.76617273
[7,] 0.16040112 0.3208022 0.83959888
[8,] 0.10381220 0.2076244 0.89618780
[9,] 0.08451044 0.1690209 0.91548956
[10,] 0.09373237 0.1874647 0.90626763
[11,] 0.35233158 0.7046632 0.64766842
[12,] 0.55170886 0.8965823 0.44829114
[13,] 0.53673202 0.9265360 0.46326798
[14,] 0.54587822 0.9082436 0.45412178
[15,] 0.47082303 0.9416461 0.52917697
[16,] 0.42777229 0.8555446 0.57222771
[17,] 0.40744845 0.8148969 0.59255155
[18,] 0.36936957 0.7387391 0.63063043
[19,] 0.31749389 0.6349878 0.68250611
[20,] 0.27507365 0.5501473 0.72492635
[21,] 0.22226722 0.4445344 0.77773278
[22,] 0.23300902 0.4660180 0.76699098
[23,] 0.24425325 0.4885065 0.75574675
[24,] 0.26783273 0.5356655 0.73216727
[25,] 0.33925919 0.6785184 0.66074081
[26,] 0.28708059 0.5741612 0.71291941
[27,] 0.23885119 0.4777024 0.76114881
[28,] 0.21548449 0.4309690 0.78451551
[29,] 0.17567501 0.3513500 0.82432499
[30,] 0.21265120 0.4253024 0.78734880
[31,] 0.18485606 0.3697121 0.81514394
[32,] 0.21281526 0.4256305 0.78718474
[33,] 0.40599941 0.8119988 0.59400059
[34,] 0.38625670 0.7725134 0.61374330
[35,] 0.34123854 0.6824771 0.65876146
[36,] 0.31182514 0.6236503 0.68817486
[37,] 0.41582422 0.8316484 0.58417578
[38,] 0.39606070 0.7921214 0.60393930
[39,] 0.36824210 0.7364842 0.63175790
[40,] 0.32811452 0.6562290 0.67188548
[41,] 0.29490393 0.5898079 0.70509607
[42,] 0.27063879 0.5412776 0.72936121
[43,] 0.32474464 0.6494893 0.67525536
[44,] 0.30365022 0.6073004 0.69634978
[45,] 0.26209690 0.5241938 0.73790310
[46,] 0.22689804 0.4537961 0.77310196
[47,] 0.23113633 0.4622727 0.76886367
[48,] 0.19441596 0.3888319 0.80558404
[49,] 0.29071455 0.5814291 0.70928545
[50,] 0.25078781 0.5015756 0.74921219
[51,] 0.33029554 0.6605911 0.66970446
[52,] 0.30405938 0.6081188 0.69594062
[53,] 0.29391318 0.5878264 0.70608682
[54,] 0.30948725 0.6189745 0.69051275
[55,] 0.28377917 0.5675583 0.71622083
[56,] 0.30279616 0.6055923 0.69720384
[57,] 0.28956086 0.5791217 0.71043914
[58,] 0.26916783 0.5383357 0.73083217
[59,] 0.23425846 0.4685169 0.76574154
[60,] 0.31073479 0.6214696 0.68926521
[61,] 0.31579456 0.6315891 0.68420544
[62,] 0.32836100 0.6567220 0.67163900
[63,] 0.37036733 0.7407347 0.62963267
[64,] 0.36385504 0.7277101 0.63614496
[65,] 0.33627041 0.6725408 0.66372959
[66,] 0.34490268 0.6898054 0.65509732
[67,] 0.37801923 0.7560385 0.62198077
[68,] 0.35611306 0.7122261 0.64388694
[69,] 0.45387140 0.9077428 0.54612860
[70,] 0.61328730 0.7734254 0.38671270
[71,] 0.65973975 0.6805205 0.34026025
[72,] 0.61837108 0.7632578 0.38162892
[73,] 0.71429815 0.5714037 0.28570185
[74,] 0.73343001 0.5331400 0.26656999
[75,] 0.72281013 0.5543797 0.27718987
[76,] 0.70305420 0.5938916 0.29694580
[77,] 0.71502988 0.5699402 0.28497012
[78,] 0.70859658 0.5828068 0.29140342
[79,] 0.76580663 0.4683867 0.23419337
[80,] 0.73091169 0.5381766 0.26908831
[81,] 0.74449641 0.5110072 0.25550359
[82,] 0.73717991 0.5256402 0.26282009
[83,] 0.72682247 0.5463551 0.27317753
[84,] 0.69039239 0.6192152 0.30960761
[85,] 0.65314677 0.6937065 0.34685323
[86,] 0.72135627 0.5572875 0.27864373
[87,] 0.69013761 0.6197248 0.30986239
[88,] 0.65745267 0.6850947 0.34254733
[89,] 0.68465494 0.6306901 0.31534506
[90,] 0.64670024 0.7065995 0.35329976
[91,] 0.62655044 0.7468991 0.37344956
[92,] 0.59058341 0.8188332 0.40941659
[93,] 0.77048162 0.4590368 0.22951838
[94,] 0.75567911 0.4886418 0.24432089
[95,] 0.78180200 0.4363960 0.21819800
[96,] 0.79281442 0.4143712 0.20718558
[97,] 0.75939157 0.4812169 0.24060843
[98,] 0.74474767 0.5105047 0.25525233
[99,] 0.70972270 0.5805546 0.29027730
[100,] 0.67114758 0.6577048 0.32885242
[101,] 0.81146171 0.3770766 0.18853829
[102,] 0.80005126 0.3998975 0.19994874
[103,] 0.77385157 0.4522969 0.22614843
[104,] 0.76239487 0.4752103 0.23760513
[105,] 0.76497352 0.4700530 0.23502648
[106,] 0.78413484 0.4317303 0.21586516
[107,] 0.79423898 0.4115220 0.20576102
[108,] 0.88909200 0.2218160 0.11090800
[109,] 0.87403042 0.2519392 0.12596958
[110,] 0.83958573 0.3208285 0.16041427
[111,] 0.79989213 0.4002157 0.20010787
[112,] 0.87815335 0.2436933 0.12184665
[113,] 0.87200883 0.2559823 0.12799117
[114,] 0.84282470 0.3143506 0.15717530
[115,] 0.90149025 0.1970195 0.09850975
[116,] 0.87526373 0.2494725 0.12473627
[117,] 0.84388832 0.3122234 0.15611168
[118,] 0.81905385 0.3618923 0.18094615
[119,] 0.77170662 0.4565868 0.22829338
[120,] 0.74414815 0.5117037 0.25585185
[121,] 0.69891373 0.6021725 0.30108627
[122,] 0.93735368 0.1252926 0.06264632
[123,] 0.92187813 0.1562437 0.07812187
[124,] 0.88870514 0.2225897 0.11129486
[125,] 0.89930814 0.2013837 0.10069186
[126,] 0.87560568 0.2487886 0.12439432
[127,] 0.82627752 0.3474450 0.17372248
[128,] 0.78306637 0.4338673 0.21693363
[129,] 0.76106598 0.4778680 0.23893402
[130,] 0.68376168 0.6324766 0.31623832
[131,] 0.76902845 0.4619431 0.23097155
[132,] 0.71987252 0.5602550 0.28012748
[133,] 0.61883604 0.7623279 0.38116396
[134,] 0.78376074 0.4324785 0.21623926
[135,] 0.77481948 0.4503610 0.22518052
> postscript(file="/var/www/html/rcomp/tmp/1mpsv1291322444.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/www/html/rcomp/tmp/2mpsv1291322444.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/rcomp/tmp/3mpsv1291322444.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/rcomp/tmp/4fy9y1291322444.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/rcomp/tmp/5fy9y1291322444.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 = 156
Frequency = 1
1 2 3 4 5 6
-0.00704189 0.06312856 0.56877450 0.39731815 0.91791458 0.99781725
7 8 9 10 11 12
-1.75154644 0.58831612 0.89695326 2.00454053 0.35120822 0.10523178
13 14 15 16 17 18
-0.30921962 0.69195961 -0.45128955 -1.02497378 0.27190036 0.06599550
19 20 21 22 23 24
-1.03921181 -0.42592191 -1.64120567 0.92633968 -0.06953596 -0.76449130
25 26 27 28 29 30
0.15016249 -0.21331614 0.65895334 0.22851740 0.28613839 -0.96589247
31 32 33 34 35 36
-0.27568232 0.86394699 0.64012418 -1.14911182 -0.91105098 -0.23904916
37 38 39 40 41 42
-0.06906919 0.48266436 0.02933583 0.76095084 0.33106910 -0.41158336
43 44 45 46 47 48
-1.20527053 -0.72596748 0.34101634 -0.11113297 -1.13686599 -0.57234164
49 50 51 52 53 54
0.47608103 -0.07152816 0.13106532 -0.63934152 -1.17683705 -0.54506086
55 56 57 58 59 60
0.16331953 0.16413251 -0.80895524 0.04026247 -2.01114998 -0.18142818
61 62 63 64 65 66
-1.43516085 -0.33660177 -0.82778440 -0.97525530 0.52273593 -0.89430146
67 68 69 70 71 72
0.14861473 -0.68599642 0.34044799 -1.41787944 -0.69143997 -0.81344585
73 74 75 76 77 78
-1.08458697 -0.70246485 0.05020971 -0.81013447 -0.89216930 -0.34561128
79 80 81 82 83 84
-0.91635457 -1.24406236 -0.85138527 0.01141788 0.88722104 0.92940957
85 86 87 88 89 90
-0.34624867 0.53569422 1.16661799 0.50505949 0.91295406 0.27190036
91 92 93 94 95 96
0.78881602 0.54503054 0.42174492 -0.11645887 0.25638259 -0.76321156
97 98 99 100 101 102
-0.05777296 0.38425934 0.83205902 -0.32955167 0.46299571 -0.47166646
103 104 105 106 107 108
-0.71337857 0.44740621 0.30218507 1.30003355 -0.37411385 0.95292512
109 110 111 112 113 114
0.20244151 -0.23492480 -0.68930781 -0.27570883 0.02447669 0.74884497
115 116 117 118 119 120
0.52270942 1.14989448 1.01023866 -0.72468774 -0.01218298 -0.05556594
121 122 123 124 125 126
-0.09634997 0.81901628 0.18608738 0.62801831 0.90365003 0.55453647
127 128 129 130 131 132
0.64225634 0.01141788 0.38950079 -0.81713869 0.76767412 0.80477825
133 134 135 136 137 138
-0.56169906 -0.73295877 0.56221371 0.02447669 0.31351030 -0.31805354
139 140 141 142 143 144
1.89181217 -0.56320407 1.23192931 -0.15183880 0.87663727 -0.59131075
145 146 147 148 149 150
0.10651152 -2.13973293 -0.80804175 1.68563929 0.79009576 1.14530335
151 152 153 154 155 156
0.21310015 0.64556772 -0.48553510 1.02447669 0.48349027 0.32878658
> postscript(file="/var/www/html/rcomp/tmp/6fy9y1291322444.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 = 156
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.00704189 NA
1 0.06312856 -0.00704189
2 0.56877450 0.06312856
3 0.39731815 0.56877450
4 0.91791458 0.39731815
5 0.99781725 0.91791458
6 -1.75154644 0.99781725
7 0.58831612 -1.75154644
8 0.89695326 0.58831612
9 2.00454053 0.89695326
10 0.35120822 2.00454053
11 0.10523178 0.35120822
12 -0.30921962 0.10523178
13 0.69195961 -0.30921962
14 -0.45128955 0.69195961
15 -1.02497378 -0.45128955
16 0.27190036 -1.02497378
17 0.06599550 0.27190036
18 -1.03921181 0.06599550
19 -0.42592191 -1.03921181
20 -1.64120567 -0.42592191
21 0.92633968 -1.64120567
22 -0.06953596 0.92633968
23 -0.76449130 -0.06953596
24 0.15016249 -0.76449130
25 -0.21331614 0.15016249
26 0.65895334 -0.21331614
27 0.22851740 0.65895334
28 0.28613839 0.22851740
29 -0.96589247 0.28613839
30 -0.27568232 -0.96589247
31 0.86394699 -0.27568232
32 0.64012418 0.86394699
33 -1.14911182 0.64012418
34 -0.91105098 -1.14911182
35 -0.23904916 -0.91105098
36 -0.06906919 -0.23904916
37 0.48266436 -0.06906919
38 0.02933583 0.48266436
39 0.76095084 0.02933583
40 0.33106910 0.76095084
41 -0.41158336 0.33106910
42 -1.20527053 -0.41158336
43 -0.72596748 -1.20527053
44 0.34101634 -0.72596748
45 -0.11113297 0.34101634
46 -1.13686599 -0.11113297
47 -0.57234164 -1.13686599
48 0.47608103 -0.57234164
49 -0.07152816 0.47608103
50 0.13106532 -0.07152816
51 -0.63934152 0.13106532
52 -1.17683705 -0.63934152
53 -0.54506086 -1.17683705
54 0.16331953 -0.54506086
55 0.16413251 0.16331953
56 -0.80895524 0.16413251
57 0.04026247 -0.80895524
58 -2.01114998 0.04026247
59 -0.18142818 -2.01114998
60 -1.43516085 -0.18142818
61 -0.33660177 -1.43516085
62 -0.82778440 -0.33660177
63 -0.97525530 -0.82778440
64 0.52273593 -0.97525530
65 -0.89430146 0.52273593
66 0.14861473 -0.89430146
67 -0.68599642 0.14861473
68 0.34044799 -0.68599642
69 -1.41787944 0.34044799
70 -0.69143997 -1.41787944
71 -0.81344585 -0.69143997
72 -1.08458697 -0.81344585
73 -0.70246485 -1.08458697
74 0.05020971 -0.70246485
75 -0.81013447 0.05020971
76 -0.89216930 -0.81013447
77 -0.34561128 -0.89216930
78 -0.91635457 -0.34561128
79 -1.24406236 -0.91635457
80 -0.85138527 -1.24406236
81 0.01141788 -0.85138527
82 0.88722104 0.01141788
83 0.92940957 0.88722104
84 -0.34624867 0.92940957
85 0.53569422 -0.34624867
86 1.16661799 0.53569422
87 0.50505949 1.16661799
88 0.91295406 0.50505949
89 0.27190036 0.91295406
90 0.78881602 0.27190036
91 0.54503054 0.78881602
92 0.42174492 0.54503054
93 -0.11645887 0.42174492
94 0.25638259 -0.11645887
95 -0.76321156 0.25638259
96 -0.05777296 -0.76321156
97 0.38425934 -0.05777296
98 0.83205902 0.38425934
99 -0.32955167 0.83205902
100 0.46299571 -0.32955167
101 -0.47166646 0.46299571
102 -0.71337857 -0.47166646
103 0.44740621 -0.71337857
104 0.30218507 0.44740621
105 1.30003355 0.30218507
106 -0.37411385 1.30003355
107 0.95292512 -0.37411385
108 0.20244151 0.95292512
109 -0.23492480 0.20244151
110 -0.68930781 -0.23492480
111 -0.27570883 -0.68930781
112 0.02447669 -0.27570883
113 0.74884497 0.02447669
114 0.52270942 0.74884497
115 1.14989448 0.52270942
116 1.01023866 1.14989448
117 -0.72468774 1.01023866
118 -0.01218298 -0.72468774
119 -0.05556594 -0.01218298
120 -0.09634997 -0.05556594
121 0.81901628 -0.09634997
122 0.18608738 0.81901628
123 0.62801831 0.18608738
124 0.90365003 0.62801831
125 0.55453647 0.90365003
126 0.64225634 0.55453647
127 0.01141788 0.64225634
128 0.38950079 0.01141788
129 -0.81713869 0.38950079
130 0.76767412 -0.81713869
131 0.80477825 0.76767412
132 -0.56169906 0.80477825
133 -0.73295877 -0.56169906
134 0.56221371 -0.73295877
135 0.02447669 0.56221371
136 0.31351030 0.02447669
137 -0.31805354 0.31351030
138 1.89181217 -0.31805354
139 -0.56320407 1.89181217
140 1.23192931 -0.56320407
141 -0.15183880 1.23192931
142 0.87663727 -0.15183880
143 -0.59131075 0.87663727
144 0.10651152 -0.59131075
145 -2.13973293 0.10651152
146 -0.80804175 -2.13973293
147 1.68563929 -0.80804175
148 0.79009576 1.68563929
149 1.14530335 0.79009576
150 0.21310015 1.14530335
151 0.64556772 0.21310015
152 -0.48553510 0.64556772
153 1.02447669 -0.48553510
154 0.48349027 1.02447669
155 0.32878658 0.48349027
156 NA 0.32878658
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.06312856 -0.00704189
[2,] 0.56877450 0.06312856
[3,] 0.39731815 0.56877450
[4,] 0.91791458 0.39731815
[5,] 0.99781725 0.91791458
[6,] -1.75154644 0.99781725
[7,] 0.58831612 -1.75154644
[8,] 0.89695326 0.58831612
[9,] 2.00454053 0.89695326
[10,] 0.35120822 2.00454053
[11,] 0.10523178 0.35120822
[12,] -0.30921962 0.10523178
[13,] 0.69195961 -0.30921962
[14,] -0.45128955 0.69195961
[15,] -1.02497378 -0.45128955
[16,] 0.27190036 -1.02497378
[17,] 0.06599550 0.27190036
[18,] -1.03921181 0.06599550
[19,] -0.42592191 -1.03921181
[20,] -1.64120567 -0.42592191
[21,] 0.92633968 -1.64120567
[22,] -0.06953596 0.92633968
[23,] -0.76449130 -0.06953596
[24,] 0.15016249 -0.76449130
[25,] -0.21331614 0.15016249
[26,] 0.65895334 -0.21331614
[27,] 0.22851740 0.65895334
[28,] 0.28613839 0.22851740
[29,] -0.96589247 0.28613839
[30,] -0.27568232 -0.96589247
[31,] 0.86394699 -0.27568232
[32,] 0.64012418 0.86394699
[33,] -1.14911182 0.64012418
[34,] -0.91105098 -1.14911182
[35,] -0.23904916 -0.91105098
[36,] -0.06906919 -0.23904916
[37,] 0.48266436 -0.06906919
[38,] 0.02933583 0.48266436
[39,] 0.76095084 0.02933583
[40,] 0.33106910 0.76095084
[41,] -0.41158336 0.33106910
[42,] -1.20527053 -0.41158336
[43,] -0.72596748 -1.20527053
[44,] 0.34101634 -0.72596748
[45,] -0.11113297 0.34101634
[46,] -1.13686599 -0.11113297
[47,] -0.57234164 -1.13686599
[48,] 0.47608103 -0.57234164
[49,] -0.07152816 0.47608103
[50,] 0.13106532 -0.07152816
[51,] -0.63934152 0.13106532
[52,] -1.17683705 -0.63934152
[53,] -0.54506086 -1.17683705
[54,] 0.16331953 -0.54506086
[55,] 0.16413251 0.16331953
[56,] -0.80895524 0.16413251
[57,] 0.04026247 -0.80895524
[58,] -2.01114998 0.04026247
[59,] -0.18142818 -2.01114998
[60,] -1.43516085 -0.18142818
[61,] -0.33660177 -1.43516085
[62,] -0.82778440 -0.33660177
[63,] -0.97525530 -0.82778440
[64,] 0.52273593 -0.97525530
[65,] -0.89430146 0.52273593
[66,] 0.14861473 -0.89430146
[67,] -0.68599642 0.14861473
[68,] 0.34044799 -0.68599642
[69,] -1.41787944 0.34044799
[70,] -0.69143997 -1.41787944
[71,] -0.81344585 -0.69143997
[72,] -1.08458697 -0.81344585
[73,] -0.70246485 -1.08458697
[74,] 0.05020971 -0.70246485
[75,] -0.81013447 0.05020971
[76,] -0.89216930 -0.81013447
[77,] -0.34561128 -0.89216930
[78,] -0.91635457 -0.34561128
[79,] -1.24406236 -0.91635457
[80,] -0.85138527 -1.24406236
[81,] 0.01141788 -0.85138527
[82,] 0.88722104 0.01141788
[83,] 0.92940957 0.88722104
[84,] -0.34624867 0.92940957
[85,] 0.53569422 -0.34624867
[86,] 1.16661799 0.53569422
[87,] 0.50505949 1.16661799
[88,] 0.91295406 0.50505949
[89,] 0.27190036 0.91295406
[90,] 0.78881602 0.27190036
[91,] 0.54503054 0.78881602
[92,] 0.42174492 0.54503054
[93,] -0.11645887 0.42174492
[94,] 0.25638259 -0.11645887
[95,] -0.76321156 0.25638259
[96,] -0.05777296 -0.76321156
[97,] 0.38425934 -0.05777296
[98,] 0.83205902 0.38425934
[99,] -0.32955167 0.83205902
[100,] 0.46299571 -0.32955167
[101,] -0.47166646 0.46299571
[102,] -0.71337857 -0.47166646
[103,] 0.44740621 -0.71337857
[104,] 0.30218507 0.44740621
[105,] 1.30003355 0.30218507
[106,] -0.37411385 1.30003355
[107,] 0.95292512 -0.37411385
[108,] 0.20244151 0.95292512
[109,] -0.23492480 0.20244151
[110,] -0.68930781 -0.23492480
[111,] -0.27570883 -0.68930781
[112,] 0.02447669 -0.27570883
[113,] 0.74884497 0.02447669
[114,] 0.52270942 0.74884497
[115,] 1.14989448 0.52270942
[116,] 1.01023866 1.14989448
[117,] -0.72468774 1.01023866
[118,] -0.01218298 -0.72468774
[119,] -0.05556594 -0.01218298
[120,] -0.09634997 -0.05556594
[121,] 0.81901628 -0.09634997
[122,] 0.18608738 0.81901628
[123,] 0.62801831 0.18608738
[124,] 0.90365003 0.62801831
[125,] 0.55453647 0.90365003
[126,] 0.64225634 0.55453647
[127,] 0.01141788 0.64225634
[128,] 0.38950079 0.01141788
[129,] -0.81713869 0.38950079
[130,] 0.76767412 -0.81713869
[131,] 0.80477825 0.76767412
[132,] -0.56169906 0.80477825
[133,] -0.73295877 -0.56169906
[134,] 0.56221371 -0.73295877
[135,] 0.02447669 0.56221371
[136,] 0.31351030 0.02447669
[137,] -0.31805354 0.31351030
[138,] 1.89181217 -0.31805354
[139,] -0.56320407 1.89181217
[140,] 1.23192931 -0.56320407
[141,] -0.15183880 1.23192931
[142,] 0.87663727 -0.15183880
[143,] -0.59131075 0.87663727
[144,] 0.10651152 -0.59131075
[145,] -2.13973293 0.10651152
[146,] -0.80804175 -2.13973293
[147,] 1.68563929 -0.80804175
[148,] 0.79009576 1.68563929
[149,] 1.14530335 0.79009576
[150,] 0.21310015 1.14530335
[151,] 0.64556772 0.21310015
[152,] -0.48553510 0.64556772
[153,] 1.02447669 -0.48553510
[154,] 0.48349027 1.02447669
[155,] 0.32878658 0.48349027
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.06312856 -0.00704189
2 0.56877450 0.06312856
3 0.39731815 0.56877450
4 0.91791458 0.39731815
5 0.99781725 0.91791458
6 -1.75154644 0.99781725
7 0.58831612 -1.75154644
8 0.89695326 0.58831612
9 2.00454053 0.89695326
10 0.35120822 2.00454053
11 0.10523178 0.35120822
12 -0.30921962 0.10523178
13 0.69195961 -0.30921962
14 -0.45128955 0.69195961
15 -1.02497378 -0.45128955
16 0.27190036 -1.02497378
17 0.06599550 0.27190036
18 -1.03921181 0.06599550
19 -0.42592191 -1.03921181
20 -1.64120567 -0.42592191
21 0.92633968 -1.64120567
22 -0.06953596 0.92633968
23 -0.76449130 -0.06953596
24 0.15016249 -0.76449130
25 -0.21331614 0.15016249
26 0.65895334 -0.21331614
27 0.22851740 0.65895334
28 0.28613839 0.22851740
29 -0.96589247 0.28613839
30 -0.27568232 -0.96589247
31 0.86394699 -0.27568232
32 0.64012418 0.86394699
33 -1.14911182 0.64012418
34 -0.91105098 -1.14911182
35 -0.23904916 -0.91105098
36 -0.06906919 -0.23904916
37 0.48266436 -0.06906919
38 0.02933583 0.48266436
39 0.76095084 0.02933583
40 0.33106910 0.76095084
41 -0.41158336 0.33106910
42 -1.20527053 -0.41158336
43 -0.72596748 -1.20527053
44 0.34101634 -0.72596748
45 -0.11113297 0.34101634
46 -1.13686599 -0.11113297
47 -0.57234164 -1.13686599
48 0.47608103 -0.57234164
49 -0.07152816 0.47608103
50 0.13106532 -0.07152816
51 -0.63934152 0.13106532
52 -1.17683705 -0.63934152
53 -0.54506086 -1.17683705
54 0.16331953 -0.54506086
55 0.16413251 0.16331953
56 -0.80895524 0.16413251
57 0.04026247 -0.80895524
58 -2.01114998 0.04026247
59 -0.18142818 -2.01114998
60 -1.43516085 -0.18142818
61 -0.33660177 -1.43516085
62 -0.82778440 -0.33660177
63 -0.97525530 -0.82778440
64 0.52273593 -0.97525530
65 -0.89430146 0.52273593
66 0.14861473 -0.89430146
67 -0.68599642 0.14861473
68 0.34044799 -0.68599642
69 -1.41787944 0.34044799
70 -0.69143997 -1.41787944
71 -0.81344585 -0.69143997
72 -1.08458697 -0.81344585
73 -0.70246485 -1.08458697
74 0.05020971 -0.70246485
75 -0.81013447 0.05020971
76 -0.89216930 -0.81013447
77 -0.34561128 -0.89216930
78 -0.91635457 -0.34561128
79 -1.24406236 -0.91635457
80 -0.85138527 -1.24406236
81 0.01141788 -0.85138527
82 0.88722104 0.01141788
83 0.92940957 0.88722104
84 -0.34624867 0.92940957
85 0.53569422 -0.34624867
86 1.16661799 0.53569422
87 0.50505949 1.16661799
88 0.91295406 0.50505949
89 0.27190036 0.91295406
90 0.78881602 0.27190036
91 0.54503054 0.78881602
92 0.42174492 0.54503054
93 -0.11645887 0.42174492
94 0.25638259 -0.11645887
95 -0.76321156 0.25638259
96 -0.05777296 -0.76321156
97 0.38425934 -0.05777296
98 0.83205902 0.38425934
99 -0.32955167 0.83205902
100 0.46299571 -0.32955167
101 -0.47166646 0.46299571
102 -0.71337857 -0.47166646
103 0.44740621 -0.71337857
104 0.30218507 0.44740621
105 1.30003355 0.30218507
106 -0.37411385 1.30003355
107 0.95292512 -0.37411385
108 0.20244151 0.95292512
109 -0.23492480 0.20244151
110 -0.68930781 -0.23492480
111 -0.27570883 -0.68930781
112 0.02447669 -0.27570883
113 0.74884497 0.02447669
114 0.52270942 0.74884497
115 1.14989448 0.52270942
116 1.01023866 1.14989448
117 -0.72468774 1.01023866
118 -0.01218298 -0.72468774
119 -0.05556594 -0.01218298
120 -0.09634997 -0.05556594
121 0.81901628 -0.09634997
122 0.18608738 0.81901628
123 0.62801831 0.18608738
124 0.90365003 0.62801831
125 0.55453647 0.90365003
126 0.64225634 0.55453647
127 0.01141788 0.64225634
128 0.38950079 0.01141788
129 -0.81713869 0.38950079
130 0.76767412 -0.81713869
131 0.80477825 0.76767412
132 -0.56169906 0.80477825
133 -0.73295877 -0.56169906
134 0.56221371 -0.73295877
135 0.02447669 0.56221371
136 0.31351030 0.02447669
137 -0.31805354 0.31351030
138 1.89181217 -0.31805354
139 -0.56320407 1.89181217
140 1.23192931 -0.56320407
141 -0.15183880 1.23192931
142 0.87663727 -0.15183880
143 -0.59131075 0.87663727
144 0.10651152 -0.59131075
145 -2.13973293 0.10651152
146 -0.80804175 -2.13973293
147 1.68563929 -0.80804175
148 0.79009576 1.68563929
149 1.14530335 0.79009576
150 0.21310015 1.14530335
151 0.64556772 0.21310015
152 -0.48553510 0.64556772
153 1.02447669 -0.48553510
154 0.48349027 1.02447669
155 0.32878658 0.48349027
> plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals')
> lines(lowess(z))
> abline(lm(z))
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/78q811291322444.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/rcomp/tmp/81h741291322444.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/rcomp/tmp/91h741291322444.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/rcomp/tmp/101h741291322444.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/rcomp/createtable")
>
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE)
> a<-table.row.end(a)
> myeq <- colnames(x)[1]
> myeq <- paste(myeq, '[t] = ', sep='')
> for (i in 1:k){
+ if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '')
+ myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ')
+ if (rownames(mysum$coefficients)[i] != '(Intercept)') {
+ myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='')
+ if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='')
+ }
+ }
> myeq <- paste(myeq, ' + e[t]')
> a<-table.row.start(a)
> a<-table.element(a, myeq)
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/11xrnv1291322444.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'Variable',header=TRUE)
> a<-table.element(a,'Parameter',header=TRUE)
> a<-table.element(a,'S.D.',header=TRUE)
> a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE)
> a<-table.element(a,'2-tail p-value',header=TRUE)
> a<-table.element(a,'1-tail p-value',header=TRUE)
> a<-table.row.end(a)
> for (i in 1:k){
+ a<-table.row.start(a)
+ a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE)
+ a<-table.element(a,mysum$coefficients[i,1])
+ a<-table.element(a, round(mysum$coefficients[i,2],6))
+ a<-table.element(a, round(mysum$coefficients[i,3],4))
+ a<-table.element(a, round(mysum$coefficients[i,4],6))
+ a<-table.element(a, round(mysum$coefficients[i,4]/2,6))
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/120r4j1291322444.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple R',1,TRUE)
> a<-table.element(a, sqrt(mysum$r.squared))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'R-squared',1,TRUE)
> a<-table.element(a, mysum$r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Adjusted R-squared',1,TRUE)
> a<-table.element(a, mysum$adj.r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (value)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[1])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[2])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[3])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'p-value',1,TRUE)
> a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3]))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Residual Standard Deviation',1,TRUE)
> a<-table.element(a, mysum$sigma)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Sum Squared Residuals',1,TRUE)
> a<-table.element(a, sum(myerror*myerror))
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/13e12s1291322444.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Time or Index', 1, TRUE)
> a<-table.element(a, 'Actuals', 1, TRUE)
> a<-table.element(a, 'Interpolation
Forecast', 1, TRUE)
> a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE)
> a<-table.row.end(a)
> for (i in 1:n) {
+ a<-table.row.start(a)
+ a<-table.element(a,i, 1, TRUE)
+ a<-table.element(a,x[i])
+ a<-table.element(a,x[i]-mysum$resid[i])
+ a<-table.element(a,mysum$resid[i])
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/www/html/rcomp/tmp/14i10g1291322444.tab")
> if (n > n25) {
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'p-values',header=TRUE)
+ a<-table.element(a,'Alternative Hypothesis',3,header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'breakpoint index',header=TRUE)
+ a<-table.element(a,'greater',header=TRUE)
+ a<-table.element(a,'2-sided',header=TRUE)
+ a<-table.element(a,'less',header=TRUE)
+ a<-table.row.end(a)
+ for (mypoint in kp3:nmkm3) {
+ a<-table.row.start(a)
+ a<-table.element(a,mypoint,header=TRUE)
+ a<-table.element(a,gqarr[mypoint-kp3+1,1])
+ a<-table.element(a,gqarr[mypoint-kp3+1,2])
+ a<-table.element(a,gqarr[mypoint-kp3+1,3])
+ a<-table.row.end(a)
+ }
+ a<-table.end(a)
+ table.save(a,file="/var/www/html/rcomp/tmp/15l2h41291322444.tab")
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'Description',header=TRUE)
+ a<-table.element(a,'# significant tests',header=TRUE)
+ a<-table.element(a,'% significant tests',header=TRUE)
+ a<-table.element(a,'OK/NOK',header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'1% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant1)
+ a<-table.element(a,numsignificant1/numgqtests)
+ if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'5% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant5)
+ a<-table.element(a,numsignificant5/numgqtests)
+ if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'10% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant10)
+ a<-table.element(a,numsignificant10/numgqtests)
+ if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.end(a)
+ table.save(a,file="/var/www/html/rcomp/tmp/166lfr1291322444.tab")
+ }
>
> try(system("convert tmp/1mpsv1291322444.ps tmp/1mpsv1291322444.png",intern=TRUE))
character(0)
> try(system("convert tmp/2mpsv1291322444.ps tmp/2mpsv1291322444.png",intern=TRUE))
character(0)
> try(system("convert tmp/3mpsv1291322444.ps tmp/3mpsv1291322444.png",intern=TRUE))
character(0)
> try(system("convert tmp/4fy9y1291322444.ps tmp/4fy9y1291322444.png",intern=TRUE))
character(0)
> try(system("convert tmp/5fy9y1291322444.ps tmp/5fy9y1291322444.png",intern=TRUE))
character(0)
> try(system("convert tmp/6fy9y1291322444.ps tmp/6fy9y1291322444.png",intern=TRUE))
character(0)
> try(system("convert tmp/78q811291322444.ps tmp/78q811291322444.png",intern=TRUE))
character(0)
> try(system("convert tmp/81h741291322444.ps tmp/81h741291322444.png",intern=TRUE))
character(0)
> try(system("convert tmp/91h741291322444.ps tmp/91h741291322444.png",intern=TRUE))
character(0)
> try(system("convert tmp/101h741291322444.ps tmp/101h741291322444.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.127 1.771 9.853