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(4
+ ,4
+ ,5
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,4
+ ,4
+ ,5
+ ,5
+ ,4
+ ,4
+ ,5
+ ,5
+ ,4
+ ,3
+ ,3
+ ,2
+ ,3
+ ,4
+ ,4
+ ,3
+ ,2
+ ,3
+ ,2
+ ,3
+ ,2
+ ,4
+ ,3
+ ,5
+ ,4
+ ,3
+ ,3
+ ,4
+ ,5
+ ,4
+ ,4
+ ,3
+ ,3
+ ,3
+ ,3
+ ,4
+ ,4
+ ,2
+ ,3
+ ,4
+ ,4
+ ,2
+ ,4
+ ,2
+ ,4
+ ,4
+ ,3
+ ,4
+ ,4
+ ,5
+ ,3
+ ,4
+ ,3
+ ,2
+ ,3
+ ,2
+ ,2
+ ,3
+ ,4
+ ,3
+ ,2
+ ,4
+ ,4
+ ,4
+ ,4
+ ,2
+ ,3
+ ,2
+ ,4
+ ,2
+ ,3
+ ,2
+ ,5
+ ,4
+ ,2
+ ,5
+ ,5
+ ,5
+ ,4
+ ,3
+ ,4
+ ,2
+ ,3
+ ,3
+ ,4
+ ,4
+ ,4
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,3
+ ,4
+ ,4
+ ,5
+ ,4
+ ,3
+ ,2
+ ,3
+ ,3
+ ,3
+ ,3
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,2
+ ,3
+ ,2
+ ,2
+ ,2
+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4
+ ,4
+ ,3
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,2
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,4
+ ,4
+ ,3
+ ,5
+ ,4
+ ,2
+ ,2
+ ,2
+ ,2
+ ,4
+ ,3
+ ,3
+ ,5
+ ,2
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,3
+ ,3
+ ,4
+ ,4
+ ,2
+ ,4
+ ,4
+ ,2
+ ,4
+ ,4
+ ,4
+ ,4
+ ,3
+ ,3
+ ,3
+ ,3
+ ,3
+ ,4
+ ,4
+ ,3
+ ,4
+ ,2
+ ,4
+ ,3
+ ,4
+ ,4
+ ,5
+ ,3
+ ,5
+ ,5
+ ,5
+ ,5
+ ,5)
+ ,dim=c(7
+ ,152)
+ ,dimnames=list(c('y'
+ ,'x1'
+ ,'x2'
+ ,'x3'
+ ,'x4'
+ ,'x5'
+ ,'x6')
+ ,1:152))
> y <- array(NA,dim=c(7,152),dimnames=list(c('y','x1','x2','x3','x4','x5','x6'),1:152))
> 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 x1 x2 x3 x4 x5 x6
1 4 4 5 4 4 4 4
2 4 4 4 4 3 4 4
3 5 5 4 4 5 5 4
4 3 3 2 3 4 4 3
5 2 3 2 3 2 4 3
6 5 4 3 3 4 5 4
7 4 3 3 3 3 4 4
8 2 3 4 4 2 4 2
9 4 4 3 4 4 5 3
10 4 3 2 3 2 2 3
11 4 3 2 4 4 4 4
12 2 3 2 4 2 3 2
13 5 4 2 5 5 5 4
14 3 4 2 3 3 4 4
15 4 3 4 4 4 4 4
16 4 3 3 4 4 5 4
17 3 2 3 3 3 3 3
18 4 4 4 4 4 4 4
19 2 3 2 2 2 4 2
20 4 2 4 4 3 4 4
21 3 3 2 4 4 4 3
22 3 2 4 4 2 3 4
23 4 4 2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 2 5 4 3
88 4 3 4 2 4 3 2
89 3 2 2 3 4 2 5
90 4 2 4 3 4 4 3
91 3 4 3 2 4 4 4
92 2 4 2 2 5 4 4
93 3 3 4 4 4 3 3
94 3 4 3 3 4 3 3
95 3 3 3 3 3 2 4
96 4 3 3 4 4 3 4
97 4 4 5 4 4 3 3
98 4 4 4 2 4 2 3
99 3 4 2 2 5 4 4
100 4 4 4 4 5 4 2
101 4 3 3 3 4 3 4
102 3 4 2 2 4 2 4
103 4 2 4 4 5 4 4
104 3 3 4 3 5 4 5
105 4 4 3 3 4 5 5
106 4 3 4 4 5 5 5
107 3 3 4 3 4 4 4
108 3 2 4 4 4 3 4
109 3 2 4 3 4 4 3
110 3 2 4 3 4 4 2
111 3 2 4 3 2 3 2
112 2 4 2 2 4 2 4
113 4 2 4 2 5 5 2
114 2 3 3 1 4 3 3
115 3 4 3 2 4 4 4
116 3 3 4 3 4 3 4
117 3 3 3 3 4 3 4
118 4 4 4 3 4 5 4
119 4 3 3 3 3 4 3
120 3 2 3 2 4 3 4
121 4 3 4 4 4 4 3
122 3 2 3 2 3 4 4
123 3 3 4 3 4 4 4
124 3 4 3 3 5 4 4
125 4 3 4 4 5 4 2
126 2 3 2 3 3 4 5
127 4 4 3 3 5 4 5
128 3 2 4 3 4 4 3
129 3 2 3 4 4 2 3
130 4 3 4 4 3 5 3
131 4 3 3 3 3 4 4
132 4 3 4 4 4 4 3
133 3 5 1 5 5 4 2
134 2 4 2 2 2 1 5
135 4 4 4 4 4 4 4
136 2 4 4 4 4 4 2
137 3 3 3 3 4 4 4
138 4 4 4 3 5 4 3
139 3 3 4 4 4 2 2
140 3 2 2 3 4 4 3
141 3 4 4 2 4 4 3
142 3 4 4 4 4 3 4
143 4 4 4 4 4 4 4
144 3 2 4 4 4 4 4
145 3 4 4 3 5 4 2
146 2 2 2 4 3 3 5
147 2 4 4 4 4 4 4
148 3 3 3 4 4 2 4
149 4 2 4 4 4 4 3
150 3 3 3 3 4 4 3
151 4 2 4 3 4 4 5
152 3 5 5 5 5 5 4
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) x1 x2 x3 x4 x5
0.65346 0.02618 0.22870 0.16452 0.10109 0.19702
x6
0.05404
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-2.73966 -0.40608 0.01056 0.38399 1.55870
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.65346 0.41279 1.583 0.11559
x1 0.02618 0.06187 0.423 0.67286
x2 0.22870 0.07276 3.143 0.00203 **
x3 0.16452 0.06564 2.507 0.01329 *
x4 0.10109 0.08143 1.242 0.21642
x5 0.19702 0.07394 2.664 0.00858 **
x6 0.05404 0.06232 0.867 0.38724
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.6439 on 145 degrees of freedom
Multiple R-squared: 0.3097, Adjusted R-squared: 0.2811
F-statistic: 10.84 on 6 and 145 DF, p-value: 5.976e-10
> 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.82749950 0.345000991 0.172500496
[2,] 0.73394804 0.532103916 0.266051958
[3,] 0.63740794 0.725184121 0.362592060
[4,] 0.58520277 0.829594467 0.414797234
[5,] 0.80070896 0.398582084 0.199291042
[6,] 0.72772006 0.544559883 0.272279942
[7,] 0.64886446 0.702271078 0.351135539
[8,] 0.55549229 0.889015425 0.444507712
[9,] 0.51261247 0.974775055 0.487387527
[10,] 0.43282696 0.865653916 0.567173042
[11,] 0.41312677 0.826253534 0.586873233
[12,] 0.38637051 0.772741014 0.613629493
[13,] 0.33131591 0.662631813 0.668684093
[14,] 0.29355365 0.587107304 0.706446348
[15,] 0.25298364 0.505967281 0.747016360
[16,] 0.21362114 0.427242282 0.786378859
[17,] 0.29933220 0.598664403 0.700667798
[18,] 0.35026174 0.700523481 0.649738259
[19,] 0.44610368 0.892207351 0.553896324
[20,] 0.99926043 0.001479144 0.000739572
[21,] 0.99888502 0.002229960 0.001114980
[22,] 0.99827066 0.003458675 0.001729337
[23,] 0.99770702 0.004585966 0.002292983
[24,] 0.99777570 0.004448602 0.002224301
[25,] 0.99668618 0.006627640 0.003313820
[26,] 0.99516026 0.009679485 0.004839742
[27,] 0.99383256 0.012334873 0.006167436
[28,] 0.99325564 0.013488726 0.006744363
[29,] 0.99087746 0.018245071 0.009122536
[30,] 0.98893145 0.022137107 0.011068554
[31,] 0.99097983 0.018040332 0.009020166
[32,] 0.98794825 0.024103510 0.012051755
[33,] 0.99024479 0.019510412 0.009755206
[34,] 0.98950033 0.020999347 0.010499673
[35,] 0.99265417 0.014691667 0.007345833
[36,] 0.99494635 0.010107301 0.005053651
[37,] 0.99391736 0.012165288 0.006082644
[38,] 0.99176228 0.016475440 0.008237720
[39,] 0.99229012 0.015419754 0.007709877
[40,] 0.99010219 0.019795613 0.009897806
[41,] 0.98669387 0.026612254 0.013306127
[42,] 0.98389716 0.032205678 0.016102839
[43,] 0.97819343 0.043613142 0.021806571
[44,] 0.98057120 0.038857598 0.019428799
[45,] 0.97503923 0.049921546 0.024960773
[46,] 0.97426640 0.051467204 0.025733602
[47,] 0.96686991 0.066260181 0.033130091
[48,] 0.96417818 0.071643642 0.035821821
[49,] 0.95535648 0.089287040 0.044643520
[50,] 0.95966886 0.080662288 0.040331144
[51,] 0.95493554 0.090128914 0.045064457
[52,] 0.95171993 0.096560130 0.048280065
[53,] 0.94186623 0.116267539 0.058133769
[54,] 0.92855711 0.142885778 0.071442889
[55,] 0.91756985 0.164860310 0.082430155
[56,] 0.90112803 0.197743942 0.098871971
[57,] 0.89317777 0.213644463 0.106822231
[58,] 0.88499467 0.230010658 0.115005329
[59,] 0.86019964 0.279600717 0.139800359
[60,] 0.84248349 0.315033013 0.157516506
[61,] 0.84378168 0.312436645 0.156218322
[62,] 0.91600439 0.167991215 0.083995607
[63,] 0.90614740 0.187705199 0.093852599
[64,] 0.89855758 0.202884833 0.101442417
[65,] 0.87815886 0.243682271 0.121841135
[66,] 0.85631534 0.287369319 0.143684660
[67,] 0.82832265 0.343354704 0.171677352
[68,] 0.81362173 0.372756536 0.186378268
[69,] 0.86113034 0.277739314 0.138869657
[70,] 0.84071174 0.318576525 0.159288263
[71,] 0.87255981 0.254880371 0.127440185
[72,] 0.85288713 0.294225732 0.147112866
[73,] 0.83030866 0.339382687 0.169691343
[74,] 0.83014061 0.339718785 0.169859392
[75,] 0.85878900 0.282422000 0.141211000
[76,] 0.83992146 0.320157079 0.160078540
[77,] 0.82639908 0.347201834 0.173600917
[78,] 0.81649160 0.367016798 0.183508399
[79,] 0.83972198 0.320556048 0.160278024
[80,] 0.81330990 0.373380194 0.186690097
[81,] 0.80194438 0.396111241 0.198055620
[82,] 0.76772578 0.464548430 0.232274215
[83,] 0.82384677 0.352306460 0.176153230
[84,] 0.80520619 0.389587629 0.194793815
[85,] 0.76939644 0.461207123 0.230603562
[86,] 0.73392589 0.532148215 0.266074108
[87,] 0.76108058 0.477838848 0.238919424
[88,] 0.74264267 0.514714663 0.257357331
[89,] 0.82519590 0.349608196 0.174804098
[90,] 0.79024213 0.419515737 0.209757868
[91,] 0.77287157 0.454256861 0.227128431
[92,] 0.82737191 0.345256182 0.172628091
[93,] 0.83099169 0.338016612 0.169008306
[94,] 0.80591779 0.388164426 0.194082213
[95,] 0.79893464 0.402130718 0.201065359
[96,] 0.78977000 0.420459993 0.210229996
[97,] 0.75129692 0.497406170 0.248703085
[98,] 0.72637473 0.547250533 0.273625266
[99,] 0.69612252 0.607754952 0.303877476
[100,] 0.67397005 0.652059890 0.326029945
[101,] 0.65259218 0.694815646 0.347407823
[102,] 0.59931930 0.801361409 0.400680704
[103,] 0.56435481 0.871290382 0.435645191
[104,] 0.52071554 0.958568912 0.479284456
[105,] 0.56073695 0.878526101 0.439263051
[106,] 0.50452150 0.990957010 0.495478505
[107,] 0.45391806 0.907836117 0.546081941
[108,] 0.39629044 0.792580884 0.603709558
[109,] 0.36605876 0.732117511 0.633941245
[110,] 0.43363315 0.867266296 0.566366852
[111,] 0.37650130 0.753002606 0.623498697
[112,] 0.36515409 0.730308187 0.634845906
[113,] 0.30799982 0.615999642 0.692000179
[114,] 0.27653520 0.553070392 0.723464804
[115,] 0.24126398 0.482527958 0.758736021
[116,] 0.20917943 0.418358865 0.790820567
[117,] 0.26869741 0.537394824 0.731302588
[118,] 0.25798389 0.515967776 0.742016112
[119,] 0.24016617 0.480332343 0.759833829
[120,] 0.18866480 0.377329606 0.811335197
[121,] 0.17650207 0.353004148 0.823497926
[122,] 0.29869017 0.597380336 0.701309832
[123,] 0.37102037 0.742040739 0.628979630
[124,] 0.40360620 0.807212405 0.596393797
[125,] 0.32462560 0.649251199 0.675374401
[126,] 0.51813512 0.963729760 0.481864880
[127,] 0.51260380 0.974792409 0.487396204
[128,] 0.41153931 0.823078613 0.588460694
[129,] 0.36773971 0.735479421 0.632260289
[130,] 0.27732674 0.554653476 0.722673262
[131,] 0.20818049 0.416360986 0.791819507
[132,] 0.14326164 0.286523276 0.856738362
[133,] 0.08228316 0.164566319 0.917716841
> postscript(file="/var/www/html/rcomp/tmp/1p2cn1291375857.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/2itt81291375857.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/3itt81291375857.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/4bkaa1291375857.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/5bkaa1291375857.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 = 152
Frequency = 1
1 2 3 4 5 6
0.03164538 0.36143219 0.93605365 -0.03752181 -0.83533980 1.45654206
7 8 9 10 11 12
0.78082961 -1.40321137 0.34606211 1.55869752 0.74391068 -0.74880109
13 14 15 16 17 18
1.25509941 -0.01665246 0.28651906 0.31819621 0.05806992 0.26034119
19 20 21 22 23 24
-0.61677229 0.41378794 -0.20204554 -0.28810239 0.71773281 0.48903700
25 26 27 28 29 30
0.26034119 0.67034966 1.26034119 -0.18191555 -2.73965881 0.50971559
31 32 33 34 35 36
0.31269693 -0.18191555 -0.49028441 0.13307231 0.26034119 0.20629741
37 38 39 40 41 42
-0.39517454 0.31269693 -0.32026140 0.50508656 -0.27702542 0.53295247
43 44 45 46 47 48
0.47365608 -0.66027342 -0.84074982 0.53534487 -0.03776848 -0.68730307
49 50 51 52 53 54
-0.35193855 0.25865316 0.36674071 -0.04133306 -0.78869601 0.26034119
55 56 57 58 59 60
0.59162527 -0.10550514 -0.58536029 0.26034119 -0.73965881 -0.52109131
61 62 63 64 65 66
0.53295247 0.23198259 0.20629741 -0.41061136 0.23247528 -0.43098802
67 68 69 70 71 72
0.53126444 -0.04302109 0.36556853 -0.68561504 1.32020933 0.44048166
73 74 75 76 77 78
-0.45278289 0.15756215 0.09412943 -0.06394635 0.48786482 0.89879880
79 80 81 82 83 84
-0.30421184 -0.94193008 -0.31394434 -0.34643927 0.64343242 0.85057939
85 86 87 88 89 90
-0.40456348 -0.28825916 0.54234141 0.92067273 0.27460583 0.53126444
91 92 93 94 95 96
-0.18191555 -1.05431074 -0.46241850 -0.09537684 0.17486693 0.71223353
97 98 99 100 101 102
0.28270781 1.03746974 -0.05431074 0.26733773 0.87675726 0.44081759
103 104 105 106 107 108
0.21160592 -0.70409200 0.40249829 -0.06563439 -0.54895721 -0.49028441
109 110 111 112 113 114
-0.46873556 -0.41469179 -0.01549111 -0.55918241 0.45172227 -0.74015151
115 116 117 118 119 120
-0.18191555 -0.35193855 -0.12324274 0.22784625 0.83487338 0.06745886
121 122 123 124 125 126
0.34056284 -0.02846879 -0.54895721 -0.44753028 0.29351560 -1.04451836
127 128 129 130 131 132
0.49842594 -0.46873556 -0.01052616 0.24463518 0.78082961 0.34056284
133 134 135 136 137 138
-0.23727643 -0.21402551 0.26034119 -1.63157126 -0.32026140 0.37781768
139 140 141 142 143 144
-0.21135607 -0.01134394 -0.35656758 -0.54264015 0.26034119 -0.68730307
145 146 147 148 149 150
-0.56813854 -0.98584555 -1.73965881 -0.09074781 0.36674071 -0.26621763
151 152
0.42317688 -1.45716589
> postscript(file="/var/www/html/rcomp/tmp/6bkaa1291375857.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 = 152
Frequency = 1
lag(myerror, k = 1) myerror
0 0.03164538 NA
1 0.36143219 0.03164538
2 0.93605365 0.36143219
3 -0.03752181 0.93605365
4 -0.83533980 -0.03752181
5 1.45654206 -0.83533980
6 0.78082961 1.45654206
7 -1.40321137 0.78082961
8 0.34606211 -1.40321137
9 1.55869752 0.34606211
10 0.74391068 1.55869752
11 -0.74880109 0.74391068
12 1.25509941 -0.74880109
13 -0.01665246 1.25509941
14 0.28651906 -0.01665246
15 0.31819621 0.28651906
16 0.05806992 0.31819621
17 0.26034119 0.05806992
18 -0.61677229 0.26034119
19 0.41378794 -0.61677229
20 -0.20204554 0.41378794
21 -0.28810239 -0.20204554
22 0.71773281 -0.28810239
23 0.48903700 0.71773281
24 0.26034119 0.48903700
25 0.67034966 0.26034119
26 1.26034119 0.67034966
27 -0.18191555 1.26034119
28 -2.73965881 -0.18191555
29 0.50971559 -2.73965881
30 0.31269693 0.50971559
31 -0.18191555 0.31269693
32 -0.49028441 -0.18191555
33 0.13307231 -0.49028441
34 0.26034119 0.13307231
35 0.20629741 0.26034119
36 -0.39517454 0.20629741
37 0.31269693 -0.39517454
38 -0.32026140 0.31269693
39 0.50508656 -0.32026140
40 -0.27702542 0.50508656
41 0.53295247 -0.27702542
42 0.47365608 0.53295247
43 -0.66027342 0.47365608
44 -0.84074982 -0.66027342
45 0.53534487 -0.84074982
46 -0.03776848 0.53534487
47 -0.68730307 -0.03776848
48 -0.35193855 -0.68730307
49 0.25865316 -0.35193855
50 0.36674071 0.25865316
51 -0.04133306 0.36674071
52 -0.78869601 -0.04133306
53 0.26034119 -0.78869601
54 0.59162527 0.26034119
55 -0.10550514 0.59162527
56 -0.58536029 -0.10550514
57 0.26034119 -0.58536029
58 -0.73965881 0.26034119
59 -0.52109131 -0.73965881
60 0.53295247 -0.52109131
61 0.23198259 0.53295247
62 0.20629741 0.23198259
63 -0.41061136 0.20629741
64 0.23247528 -0.41061136
65 -0.43098802 0.23247528
66 0.53126444 -0.43098802
67 -0.04302109 0.53126444
68 0.36556853 -0.04302109
69 -0.68561504 0.36556853
70 1.32020933 -0.68561504
71 0.44048166 1.32020933
72 -0.45278289 0.44048166
73 0.15756215 -0.45278289
74 0.09412943 0.15756215
75 -0.06394635 0.09412943
76 0.48786482 -0.06394635
77 0.89879880 0.48786482
78 -0.30421184 0.89879880
79 -0.94193008 -0.30421184
80 -0.31394434 -0.94193008
81 -0.34643927 -0.31394434
82 0.64343242 -0.34643927
83 0.85057939 0.64343242
84 -0.40456348 0.85057939
85 -0.28825916 -0.40456348
86 0.54234141 -0.28825916
87 0.92067273 0.54234141
88 0.27460583 0.92067273
89 0.53126444 0.27460583
90 -0.18191555 0.53126444
91 -1.05431074 -0.18191555
92 -0.46241850 -1.05431074
93 -0.09537684 -0.46241850
94 0.17486693 -0.09537684
95 0.71223353 0.17486693
96 0.28270781 0.71223353
97 1.03746974 0.28270781
98 -0.05431074 1.03746974
99 0.26733773 -0.05431074
100 0.87675726 0.26733773
101 0.44081759 0.87675726
102 0.21160592 0.44081759
103 -0.70409200 0.21160592
104 0.40249829 -0.70409200
105 -0.06563439 0.40249829
106 -0.54895721 -0.06563439
107 -0.49028441 -0.54895721
108 -0.46873556 -0.49028441
109 -0.41469179 -0.46873556
110 -0.01549111 -0.41469179
111 -0.55918241 -0.01549111
112 0.45172227 -0.55918241
113 -0.74015151 0.45172227
114 -0.18191555 -0.74015151
115 -0.35193855 -0.18191555
116 -0.12324274 -0.35193855
117 0.22784625 -0.12324274
118 0.83487338 0.22784625
119 0.06745886 0.83487338
120 0.34056284 0.06745886
121 -0.02846879 0.34056284
122 -0.54895721 -0.02846879
123 -0.44753028 -0.54895721
124 0.29351560 -0.44753028
125 -1.04451836 0.29351560
126 0.49842594 -1.04451836
127 -0.46873556 0.49842594
128 -0.01052616 -0.46873556
129 0.24463518 -0.01052616
130 0.78082961 0.24463518
131 0.34056284 0.78082961
132 -0.23727643 0.34056284
133 -0.21402551 -0.23727643
134 0.26034119 -0.21402551
135 -1.63157126 0.26034119
136 -0.32026140 -1.63157126
137 0.37781768 -0.32026140
138 -0.21135607 0.37781768
139 -0.01134394 -0.21135607
140 -0.35656758 -0.01134394
141 -0.54264015 -0.35656758
142 0.26034119 -0.54264015
143 -0.68730307 0.26034119
144 -0.56813854 -0.68730307
145 -0.98584555 -0.56813854
146 -1.73965881 -0.98584555
147 -0.09074781 -1.73965881
148 0.36674071 -0.09074781
149 -0.26621763 0.36674071
150 0.42317688 -0.26621763
151 -1.45716589 0.42317688
152 NA -1.45716589
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.36143219 0.03164538
[2,] 0.93605365 0.36143219
[3,] -0.03752181 0.93605365
[4,] -0.83533980 -0.03752181
[5,] 1.45654206 -0.83533980
[6,] 0.78082961 1.45654206
[7,] -1.40321137 0.78082961
[8,] 0.34606211 -1.40321137
[9,] 1.55869752 0.34606211
[10,] 0.74391068 1.55869752
[11,] -0.74880109 0.74391068
[12,] 1.25509941 -0.74880109
[13,] -0.01665246 1.25509941
[14,] 0.28651906 -0.01665246
[15,] 0.31819621 0.28651906
[16,] 0.05806992 0.31819621
[17,] 0.26034119 0.05806992
[18,] -0.61677229 0.26034119
[19,] 0.41378794 -0.61677229
[20,] -0.20204554 0.41378794
[21,] -0.28810239 -0.20204554
[22,] 0.71773281 -0.28810239
[23,] 0.48903700 0.71773281
[24,] 0.26034119 0.48903700
[25,] 0.67034966 0.26034119
[26,] 1.26034119 0.67034966
[27,] -0.18191555 1.26034119
[28,] -2.73965881 -0.18191555
[29,] 0.50971559 -2.73965881
[30,] 0.31269693 0.50971559
[31,] -0.18191555 0.31269693
[32,] -0.49028441 -0.18191555
[33,] 0.13307231 -0.49028441
[34,] 0.26034119 0.13307231
[35,] 0.20629741 0.26034119
[36,] -0.39517454 0.20629741
[37,] 0.31269693 -0.39517454
[38,] -0.32026140 0.31269693
[39,] 0.50508656 -0.32026140
[40,] -0.27702542 0.50508656
[41,] 0.53295247 -0.27702542
[42,] 0.47365608 0.53295247
[43,] -0.66027342 0.47365608
[44,] -0.84074982 -0.66027342
[45,] 0.53534487 -0.84074982
[46,] -0.03776848 0.53534487
[47,] -0.68730307 -0.03776848
[48,] -0.35193855 -0.68730307
[49,] 0.25865316 -0.35193855
[50,] 0.36674071 0.25865316
[51,] -0.04133306 0.36674071
[52,] -0.78869601 -0.04133306
[53,] 0.26034119 -0.78869601
[54,] 0.59162527 0.26034119
[55,] -0.10550514 0.59162527
[56,] -0.58536029 -0.10550514
[57,] 0.26034119 -0.58536029
[58,] -0.73965881 0.26034119
[59,] -0.52109131 -0.73965881
[60,] 0.53295247 -0.52109131
[61,] 0.23198259 0.53295247
[62,] 0.20629741 0.23198259
[63,] -0.41061136 0.20629741
[64,] 0.23247528 -0.41061136
[65,] -0.43098802 0.23247528
[66,] 0.53126444 -0.43098802
[67,] -0.04302109 0.53126444
[68,] 0.36556853 -0.04302109
[69,] -0.68561504 0.36556853
[70,] 1.32020933 -0.68561504
[71,] 0.44048166 1.32020933
[72,] -0.45278289 0.44048166
[73,] 0.15756215 -0.45278289
[74,] 0.09412943 0.15756215
[75,] -0.06394635 0.09412943
[76,] 0.48786482 -0.06394635
[77,] 0.89879880 0.48786482
[78,] -0.30421184 0.89879880
[79,] -0.94193008 -0.30421184
[80,] -0.31394434 -0.94193008
[81,] -0.34643927 -0.31394434
[82,] 0.64343242 -0.34643927
[83,] 0.85057939 0.64343242
[84,] -0.40456348 0.85057939
[85,] -0.28825916 -0.40456348
[86,] 0.54234141 -0.28825916
[87,] 0.92067273 0.54234141
[88,] 0.27460583 0.92067273
[89,] 0.53126444 0.27460583
[90,] -0.18191555 0.53126444
[91,] -1.05431074 -0.18191555
[92,] -0.46241850 -1.05431074
[93,] -0.09537684 -0.46241850
[94,] 0.17486693 -0.09537684
[95,] 0.71223353 0.17486693
[96,] 0.28270781 0.71223353
[97,] 1.03746974 0.28270781
[98,] -0.05431074 1.03746974
[99,] 0.26733773 -0.05431074
[100,] 0.87675726 0.26733773
[101,] 0.44081759 0.87675726
[102,] 0.21160592 0.44081759
[103,] -0.70409200 0.21160592
[104,] 0.40249829 -0.70409200
[105,] -0.06563439 0.40249829
[106,] -0.54895721 -0.06563439
[107,] -0.49028441 -0.54895721
[108,] -0.46873556 -0.49028441
[109,] -0.41469179 -0.46873556
[110,] -0.01549111 -0.41469179
[111,] -0.55918241 -0.01549111
[112,] 0.45172227 -0.55918241
[113,] -0.74015151 0.45172227
[114,] -0.18191555 -0.74015151
[115,] -0.35193855 -0.18191555
[116,] -0.12324274 -0.35193855
[117,] 0.22784625 -0.12324274
[118,] 0.83487338 0.22784625
[119,] 0.06745886 0.83487338
[120,] 0.34056284 0.06745886
[121,] -0.02846879 0.34056284
[122,] -0.54895721 -0.02846879
[123,] -0.44753028 -0.54895721
[124,] 0.29351560 -0.44753028
[125,] -1.04451836 0.29351560
[126,] 0.49842594 -1.04451836
[127,] -0.46873556 0.49842594
[128,] -0.01052616 -0.46873556
[129,] 0.24463518 -0.01052616
[130,] 0.78082961 0.24463518
[131,] 0.34056284 0.78082961
[132,] -0.23727643 0.34056284
[133,] -0.21402551 -0.23727643
[134,] 0.26034119 -0.21402551
[135,] -1.63157126 0.26034119
[136,] -0.32026140 -1.63157126
[137,] 0.37781768 -0.32026140
[138,] -0.21135607 0.37781768
[139,] -0.01134394 -0.21135607
[140,] -0.35656758 -0.01134394
[141,] -0.54264015 -0.35656758
[142,] 0.26034119 -0.54264015
[143,] -0.68730307 0.26034119
[144,] -0.56813854 -0.68730307
[145,] -0.98584555 -0.56813854
[146,] -1.73965881 -0.98584555
[147,] -0.09074781 -1.73965881
[148,] 0.36674071 -0.09074781
[149,] -0.26621763 0.36674071
[150,] 0.42317688 -0.26621763
[151,] -1.45716589 0.42317688
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.36143219 0.03164538
2 0.93605365 0.36143219
3 -0.03752181 0.93605365
4 -0.83533980 -0.03752181
5 1.45654206 -0.83533980
6 0.78082961 1.45654206
7 -1.40321137 0.78082961
8 0.34606211 -1.40321137
9 1.55869752 0.34606211
10 0.74391068 1.55869752
11 -0.74880109 0.74391068
12 1.25509941 -0.74880109
13 -0.01665246 1.25509941
14 0.28651906 -0.01665246
15 0.31819621 0.28651906
16 0.05806992 0.31819621
17 0.26034119 0.05806992
18 -0.61677229 0.26034119
19 0.41378794 -0.61677229
20 -0.20204554 0.41378794
21 -0.28810239 -0.20204554
22 0.71773281 -0.28810239
23 0.48903700 0.71773281
24 0.26034119 0.48903700
25 0.67034966 0.26034119
26 1.26034119 0.67034966
27 -0.18191555 1.26034119
28 -2.73965881 -0.18191555
29 0.50971559 -2.73965881
30 0.31269693 0.50971559
31 -0.18191555 0.31269693
32 -0.49028441 -0.18191555
33 0.13307231 -0.49028441
34 0.26034119 0.13307231
35 0.20629741 0.26034119
36 -0.39517454 0.20629741
37 0.31269693 -0.39517454
38 -0.32026140 0.31269693
39 0.50508656 -0.32026140
40 -0.27702542 0.50508656
41 0.53295247 -0.27702542
42 0.47365608 0.53295247
43 -0.66027342 0.47365608
44 -0.84074982 -0.66027342
45 0.53534487 -0.84074982
46 -0.03776848 0.53534487
47 -0.68730307 -0.03776848
48 -0.35193855 -0.68730307
49 0.25865316 -0.35193855
50 0.36674071 0.25865316
51 -0.04133306 0.36674071
52 -0.78869601 -0.04133306
53 0.26034119 -0.78869601
54 0.59162527 0.26034119
55 -0.10550514 0.59162527
56 -0.58536029 -0.10550514
57 0.26034119 -0.58536029
58 -0.73965881 0.26034119
59 -0.52109131 -0.73965881
60 0.53295247 -0.52109131
61 0.23198259 0.53295247
62 0.20629741 0.23198259
63 -0.41061136 0.20629741
64 0.23247528 -0.41061136
65 -0.43098802 0.23247528
66 0.53126444 -0.43098802
67 -0.04302109 0.53126444
68 0.36556853 -0.04302109
69 -0.68561504 0.36556853
70 1.32020933 -0.68561504
71 0.44048166 1.32020933
72 -0.45278289 0.44048166
73 0.15756215 -0.45278289
74 0.09412943 0.15756215
75 -0.06394635 0.09412943
76 0.48786482 -0.06394635
77 0.89879880 0.48786482
78 -0.30421184 0.89879880
79 -0.94193008 -0.30421184
80 -0.31394434 -0.94193008
81 -0.34643927 -0.31394434
82 0.64343242 -0.34643927
83 0.85057939 0.64343242
84 -0.40456348 0.85057939
85 -0.28825916 -0.40456348
86 0.54234141 -0.28825916
87 0.92067273 0.54234141
88 0.27460583 0.92067273
89 0.53126444 0.27460583
90 -0.18191555 0.53126444
91 -1.05431074 -0.18191555
92 -0.46241850 -1.05431074
93 -0.09537684 -0.46241850
94 0.17486693 -0.09537684
95 0.71223353 0.17486693
96 0.28270781 0.71223353
97 1.03746974 0.28270781
98 -0.05431074 1.03746974
99 0.26733773 -0.05431074
100 0.87675726 0.26733773
101 0.44081759 0.87675726
102 0.21160592 0.44081759
103 -0.70409200 0.21160592
104 0.40249829 -0.70409200
105 -0.06563439 0.40249829
106 -0.54895721 -0.06563439
107 -0.49028441 -0.54895721
108 -0.46873556 -0.49028441
109 -0.41469179 -0.46873556
110 -0.01549111 -0.41469179
111 -0.55918241 -0.01549111
112 0.45172227 -0.55918241
113 -0.74015151 0.45172227
114 -0.18191555 -0.74015151
115 -0.35193855 -0.18191555
116 -0.12324274 -0.35193855
117 0.22784625 -0.12324274
118 0.83487338 0.22784625
119 0.06745886 0.83487338
120 0.34056284 0.06745886
121 -0.02846879 0.34056284
122 -0.54895721 -0.02846879
123 -0.44753028 -0.54895721
124 0.29351560 -0.44753028
125 -1.04451836 0.29351560
126 0.49842594 -1.04451836
127 -0.46873556 0.49842594
128 -0.01052616 -0.46873556
129 0.24463518 -0.01052616
130 0.78082961 0.24463518
131 0.34056284 0.78082961
132 -0.23727643 0.34056284
133 -0.21402551 -0.23727643
134 0.26034119 -0.21402551
135 -1.63157126 0.26034119
136 -0.32026140 -1.63157126
137 0.37781768 -0.32026140
138 -0.21135607 0.37781768
139 -0.01134394 -0.21135607
140 -0.35656758 -0.01134394
141 -0.54264015 -0.35656758
142 0.26034119 -0.54264015
143 -0.68730307 0.26034119
144 -0.56813854 -0.68730307
145 -0.98584555 -0.56813854
146 -1.73965881 -0.98584555
147 -0.09074781 -1.73965881
148 0.36674071 -0.09074781
149 -0.26621763 0.36674071
150 0.42317688 -0.26621763
151 -1.45716589 0.42317688
> 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/73uaw1291375857.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/8e39z1291375857.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/9e39z1291375857.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/10e39z1291375857.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/11i3q51291375857.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/12lmoa1291375857.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/13anlm1291375857.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/14vo2a1291375857.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/15of1v1291375857.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/16kphm1291375857.tab")
+ }
>
> try(system("convert tmp/1p2cn1291375857.ps tmp/1p2cn1291375857.png",intern=TRUE))
character(0)
> try(system("convert tmp/2itt81291375857.ps tmp/2itt81291375857.png",intern=TRUE))
character(0)
> try(system("convert tmp/3itt81291375857.ps tmp/3itt81291375857.png",intern=TRUE))
character(0)
> try(system("convert tmp/4bkaa1291375857.ps tmp/4bkaa1291375857.png",intern=TRUE))
character(0)
> try(system("convert tmp/5bkaa1291375857.ps tmp/5bkaa1291375857.png",intern=TRUE))
character(0)
> try(system("convert tmp/6bkaa1291375857.ps tmp/6bkaa1291375857.png",intern=TRUE))
character(0)
> try(system("convert tmp/73uaw1291375857.ps tmp/73uaw1291375857.png",intern=TRUE))
character(0)
> try(system("convert tmp/8e39z1291375857.ps tmp/8e39z1291375857.png",intern=TRUE))
character(0)
> try(system("convert tmp/9e39z1291375857.ps tmp/9e39z1291375857.png",intern=TRUE))
character(0)
> try(system("convert tmp/10e39z1291375857.ps tmp/10e39z1291375857.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.916 1.673 15.560