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(1
+ ,3
+ ,1
+ ,3
+ ,4
+ ,2
+ ,1
+ ,1
+ ,1
+ ,3
+ ,3
+ ,3
+ ,1
+ ,2
+ ,2
+ ,3
+ ,3
+ ,4
+ ,2
+ ,4
+ ,1
+ ,3
+ ,5
+ ,3
+ ,2
+ ,1
+ ,1
+ ,3
+ ,4
+ ,2
+ ,2
+ ,4
+ ,1
+ ,3
+ ,1
+ ,2
+ ,3
+ ,1
+ ,3
+ ,5
+ ,3
+ ,1
+ ,1
+ ,1
+ ,1
+ ,5
+ ,2
+ ,1
+ ,1
+ ,1
+ ,3
+ ,2
+ ,3
+ ,1
+ ,2
+ ,4
+ ,2
+ ,2
+ ,5
+ ,2
+ ,3
+ ,5
+ ,3
+ ,1
+ ,3
+ ,1
+ ,3
+ ,3
+ ,2
+ ,1
+ ,1
+ ,1
+ ,2
+ ,4
+ ,4
+ ,1
+ ,2
+ ,1
+ ,3
+ ,4
+ ,1
+ ,1
+ ,2
+ ,1
+ ,3
+ ,4
+ ,2
+ ,2
+ ,5
+ ,2
+ ,3
+ ,4
+ ,4
+ ,2
+ ,2
+ ,1
+ ,3
+ ,5
+ ,2
+ ,1
+ ,2
+ ,1
+ ,3
+ ,3
+ ,3
+ ,2
+ ,2
+ ,1
+ ,3
+ ,5
+ ,3
+ ,1
+ ,2
+ ,1
+ ,3
+ ,3
+ ,3
+ ,2
+ ,3
+ ,1
+ ,3
+ ,4
+ ,1
+ ,1
+ ,3
+ ,1
+ ,3
+ ,4
+ ,3
+ ,2
+ ,3
+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: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)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1
71 2 5 2 1 4 1
72 2 4 3 2 3 1
73 3 4 1 1 2 1
74 2 4 3 1 1 1
75 3 4 2 1 1 1
76 3 4 2 2 3 1
77 3 3 4 2 2 1
78 3 4 2 1 1 1
79 3 3 3 1 3 1
80 3 4 2 1 3 1
81 3 5 4 1 1 1
82 3 4 2 1 2 1
83 3 3 3 1 1 2
84 2 4 3 2 2 1
85 3 4 1 1 2 1
86 3 4 2 1 2 1
87 3 5 2 1 1 1
88 3 4 3 2 2 1
89 3 5 1 1 1 3
90 2 4 2 1 1 1
91 3 2 3 2 3 1
92 3 5 3 2 2 1
93 3 5 3 2 3 2
94 3 5 2 1 3 1
95 3 4 3 1 4 1
96 1 5 4 2 1 1
97 3 5 3 1 4 1
98 1 4 3 1 1 1
99 3 4 3 1 1 1
100 3 5 2 2 3 1
101 3 4 3 1 3 1
102 3 5 3 1 3 2
103 2 5 3 1 4 3
104 3 4 3 2 2 1
105 3 4 3 2 1 1
106 2 5 2 1 2 1
107 3 4 2 1 1 1
108 3 4 4 1 2 1
109 3 2 2 1 3 1
110 2 3 2 5 1 3
111 4 1 1 2 1 2
112 4 3 2 1 1 2
113 2 3 1 1 1 3
114 5 2 2 2 1 3
115 4 1 1 3 1 3
116 4 3 1 1 1 3
117 4 2 1 3 3 2
118 4 2 1 1 1 3
119 5 3 1 1 1 2
120 3 3 1 1 1 3
121 1 1 1 1 1 3
122 5 2 1 3 3 3
123 3 3 1 3 2 3
124 5 1 1 1 1 3
125 3 3 2 3 1 3
126 4 2 1 2 1 1
127 4 4 2 3 1 3
128 4 3 2 2 1 2
129 4 3 2 2 2 3
130 4 2 2 5 3 3
131 5 2 2 4 1 3
132 4 3 1 1 1 2
133 5 2 1 1 1 3
134 3 2 1 3 3 2
135 4 4 2 3 1 3
136 4 2 1 2 2 2
137 4 4 1 1 1 3
138 4 3 1 1 1 2
139 4 2 2 4 1 3
140 5 4 1 3 1 3
141 5 1 1 3 1 3
142 5 3 2 3 1 3
143 5 1 2 3 1 3
144 5 2 1 3 1 3
145 4 4 1 2 3 3
146 4 3 1 1 2 3
147 4 2 2 2 1 3
148 4 1 2 1 1 3
149 5 2 2 2 1 3
150 4 3 1 1 1 2
151 5 2 1 4 1 3
152 4 3 1 1 2 2
153 5 3 1 1 1 2
154 5 3 1 1 1 3
155 5 3 2 3 1 3
156 4 3 2 2 1 3
157 4 3 1 1 1 3
158 4 1 1 1 2 3
159 5 3 1 3 1 2
160 4 4 1 3 1 3
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Weight Drugs Sports Vegetables
3.78656 -0.10205 -0.17466 -0.02077 -0.20747
`Alcohol\r\r`
0.27079
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-3.0940 -0.2891 0.2043 0.4389 1.4645
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.78656 0.44159 8.575 9.87e-15 ***
Weight -0.10205 0.06926 -1.473 0.14271
Drugs -0.17466 0.08556 -2.041 0.04292 *
Sports -0.02077 0.08179 -0.254 0.79992
Vegetables -0.20747 0.06821 -3.042 0.00277 **
`Alcohol\r\r` 0.27079 0.09870 2.743 0.00680 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.8616 on 154 degrees of freedom
Multiple R-squared: 0.2633, Adjusted R-squared: 0.2394
F-statistic: 11.01 on 5 and 154 DF, p-value: 4.475e-09
> 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,] 8.168729e-01 3.662542e-01 0.1831270837
[2,] 7.040719e-01 5.918562e-01 0.2959281153
[3,] 6.521301e-01 6.957399e-01 0.3478699312
[4,] 7.515858e-01 4.968283e-01 0.2484141667
[5,] 7.518959e-01 4.962082e-01 0.2481041009
[6,] 7.177982e-01 5.644036e-01 0.2822018103
[7,] 7.109814e-01 5.780371e-01 0.2890185614
[8,] 6.393890e-01 7.212221e-01 0.3606110390
[9,] 5.530653e-01 8.938694e-01 0.4469346907
[10,] 5.115302e-01 9.769396e-01 0.4884697895
[11,] 4.306619e-01 8.613238e-01 0.5693381202
[12,] 3.823221e-01 7.646443e-01 0.6176778632
[13,] 3.218816e-01 6.437632e-01 0.6781184083
[14,] 2.929849e-01 5.859699e-01 0.7070150610
[15,] 2.337483e-01 4.674967e-01 0.7662516682
[16,] 2.553166e-01 5.106332e-01 0.7446834015
[17,] 2.003299e-01 4.006598e-01 0.7996700827
[18,] 1.814145e-01 3.628290e-01 0.8185855247
[19,] 1.400154e-01 2.800308e-01 0.8599846183
[20,] 1.158855e-01 2.317709e-01 0.8841145488
[21,] 1.616567e-01 3.233134e-01 0.8383432897
[22,] 1.353030e-01 2.706059e-01 0.8646970251
[23,] 1.036511e-01 2.073021e-01 0.8963489258
[24,] 7.876020e-02 1.575204e-01 0.9212398022
[25,] 5.856028e-02 1.171206e-01 0.9414397218
[26,] 6.356506e-02 1.271301e-01 0.9364349395
[27,] 5.258826e-02 1.051765e-01 0.9474117436
[28,] 3.935670e-02 7.871340e-02 0.9606432978
[29,] 2.830197e-02 5.660394e-02 0.9716980300
[30,] 2.041349e-02 4.082697e-02 0.9795865138
[31,] 1.621569e-01 3.243138e-01 0.8378430820
[32,] 1.348773e-01 2.697546e-01 0.8651226965
[33,] 1.607756e-01 3.215513e-01 0.8392243686
[34,] 1.324936e-01 2.649872e-01 0.8675064224
[35,] 1.071437e-01 2.142875e-01 0.8928562721
[36,] 8.672651e-02 1.734530e-01 0.9132734916
[37,] 8.835278e-02 1.767056e-01 0.9116472200
[38,] 8.604094e-02 1.720819e-01 0.9139590604
[39,] 6.854730e-02 1.370946e-01 0.9314527035
[40,] 5.551038e-02 1.110208e-01 0.9444896193
[41,] 4.431286e-02 8.862571e-02 0.9556871436
[42,] 3.812155e-02 7.624311e-02 0.9618784456
[43,] 3.972605e-02 7.945211e-02 0.9602739466
[44,] 4.291538e-02 8.583075e-02 0.9570846238
[45,] 3.314457e-02 6.628914e-02 0.9668554275
[46,] 4.672942e-02 9.345885e-02 0.9532705766
[47,] 3.951124e-02 7.902249e-02 0.9604887571
[48,] 3.161008e-02 6.322017e-02 0.9683899152
[49,] 2.458489e-02 4.916979e-02 0.9754151058
[50,] 2.585387e-02 5.170774e-02 0.9741461302
[51,] 2.028861e-02 4.057721e-02 0.9797113926
[52,] 1.542581e-02 3.085163e-02 0.9845741860
[53,] 1.286342e-02 2.572684e-02 0.9871365781
[54,] 1.023075e-02 2.046150e-02 0.9897692520
[55,] 7.589352e-03 1.517870e-02 0.9924106484
[56,] 8.279392e-03 1.655878e-02 0.9917206077
[57,] 6.323258e-03 1.264652e-02 0.9936767424
[58,] 4.700425e-03 9.400851e-03 0.9952995746
[59,] 5.379375e-03 1.075875e-02 0.9946206255
[60,] 3.947627e-03 7.895255e-03 0.9960523726
[61,] 3.242394e-03 6.484788e-03 0.9967576060
[62,] 2.574849e-03 5.149697e-03 0.9974251513
[63,] 3.285627e-03 6.571255e-03 0.9967143726
[64,] 3.337768e-03 6.675537e-03 0.9966622315
[65,] 2.438592e-03 4.877185e-03 0.9975614076
[66,] 2.812229e-03 5.624459e-03 0.9971877706
[67,] 2.004905e-03 4.009809e-03 0.9979950953
[68,] 1.491224e-03 2.982448e-03 0.9985087759
[69,] 1.137251e-03 2.274502e-03 0.9988627491
[70,] 7.865712e-04 1.573142e-03 0.9992134288
[71,] 5.422515e-04 1.084503e-03 0.9994577485
[72,] 3.625497e-04 7.250994e-04 0.9996374503
[73,] 2.802744e-04 5.605489e-04 0.9997197256
[74,] 1.844159e-04 3.688318e-04 0.9998155841
[75,] 1.433767e-04 2.867535e-04 0.9998566233
[76,] 1.487440e-04 2.974880e-04 0.9998512560
[77,] 1.005737e-04 2.011474e-04 0.9998994263
[78,] 6.412775e-05 1.282555e-04 0.9999358723
[79,] 4.014554e-05 8.029108e-05 0.9999598545
[80,] 2.721197e-05 5.442393e-05 0.9999727880
[81,] 2.861788e-05 5.723575e-05 0.9999713821
[82,] 4.510705e-05 9.021410e-05 0.9999548929
[83,] 3.246126e-05 6.492253e-05 0.9999675387
[84,] 2.165433e-05 4.330866e-05 0.9999783457
[85,] 1.600081e-05 3.200162e-05 0.9999839992
[86,] 9.659549e-06 1.931910e-05 0.9999903405
[87,] 6.384512e-06 1.276902e-05 0.9999936155
[88,] 6.652213e-05 1.330443e-04 0.9999334779
[89,] 5.039578e-05 1.007916e-04 0.9999496042
[90,] 8.994367e-04 1.798873e-03 0.9991005633
[91,] 6.259942e-04 1.251988e-03 0.9993740058
[92,] 4.302893e-04 8.605786e-04 0.9995697107
[93,] 2.934871e-04 5.869741e-04 0.9997065129
[94,] 2.095811e-04 4.191623e-04 0.9997904189
[95,] 1.695853e-04 3.391707e-04 0.9998304147
[96,] 1.162465e-04 2.324929e-04 0.9998837535
[97,] 8.426852e-05 1.685370e-04 0.9999157315
[98,] 1.484984e-04 2.969968e-04 0.9998515016
[99,] 1.209106e-04 2.418212e-04 0.9998790894
[100,] 8.006869e-05 1.601374e-04 0.9999199313
[101,] 6.329445e-05 1.265889e-04 0.9999367056
[102,] 1.064140e-03 2.128279e-03 0.9989358604
[103,] 2.374888e-03 4.749777e-03 0.9976251117
[104,] 3.147094e-03 6.294188e-03 0.9968529062
[105,] 1.354430e-02 2.708860e-02 0.9864557022
[106,] 6.219397e-02 1.243879e-01 0.9378060267
[107,] 8.164209e-02 1.632842e-01 0.9183579120
[108,] 7.975010e-02 1.595002e-01 0.9202499035
[109,] 8.651860e-02 1.730372e-01 0.9134813953
[110,] 7.791918e-02 1.558384e-01 0.9220808248
[111,] 1.217152e-01 2.434304e-01 0.8782848036
[112,] 1.402607e-01 2.805215e-01 0.8597392610
[113,] 9.668933e-01 6.621344e-02 0.0331067201
[114,] 9.906081e-01 1.878376e-02 0.0093918803
[115,] 9.969541e-01 6.091735e-03 0.0030458674
[116,] 9.968506e-01 6.298812e-03 0.0031494061
[117,] 9.996778e-01 6.443895e-04 0.0003221947
[118,] 9.995077e-01 9.845221e-04 0.0004922610
[119,] 9.994515e-01 1.096988e-03 0.0005484941
[120,] 9.991486e-01 1.702834e-03 0.0008514170
[121,] 9.987190e-01 2.562061e-03 0.0012810303
[122,] 9.982638e-01 3.472420e-03 0.0017362101
[123,] 9.982024e-01 3.595197e-03 0.0017975987
[124,] 9.973748e-01 5.250377e-03 0.0026251886
[125,] 9.969938e-01 6.012488e-03 0.0030062439
[126,] 9.980992e-01 3.801693e-03 0.0019008467
[127,] 9.975986e-01 4.802818e-03 0.0024014088
[128,] 9.963420e-01 7.316096e-03 0.0036580482
[129,] 9.941833e-01 1.163336e-02 0.0058166812
[130,] 9.922663e-01 1.546733e-02 0.0077336637
[131,] 9.966602e-01 6.679536e-03 0.0033397678
[132,] 9.952197e-01 9.560653e-03 0.0047803267
[133,] 9.915826e-01 1.683488e-02 0.0084174404
[134,] 9.883942e-01 2.321167e-02 0.0116058354
[135,] 9.810956e-01 3.780871e-02 0.0189043563
[136,] 9.691486e-01 6.170280e-02 0.0308514019
[137,] 9.491990e-01 1.016020e-01 0.0508010002
[138,] 9.146510e-01 1.706979e-01 0.0853489639
[139,] 8.862601e-01 2.274799e-01 0.1137399497
[140,] 8.903859e-01 2.192282e-01 0.1096140774
[141,] 8.196794e-01 3.606412e-01 0.1803205852
[142,] 8.455365e-01 3.089270e-01 0.1544634762
[143,] 7.115095e-01 5.769810e-01 0.2884904754
> postscript(file="/var/www/html/rcomp/tmp/1z78h1290558334.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/2z78h1290558334.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/3z78h1290558334.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/4k9sx1290558335.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/5k9sx1290558335.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 160
Frequency = 1
1 2 3 4 5 6
-1.955167675 -2.637522611 -2.631610493 -0.916444287 -1.159258297 -1.475535952
7 8 9 10 11 12
0.294914318 -2.261876730 -1.767381941 -0.491756662 0.620033883 -0.173659057
13 14 15 16 17 18
-0.514822697 -0.038802477 0.508243338 0.505942723 0.237902761 0.229237485
19 20 21 22 23 24
0.412562687 0.436708681 0.168668719 0.267960873 0.123811600 -0.444452175
25 26 27 28 29 30
0.673610572 -1.883993102 0.445373957 0.281086681 -0.774143089 -0.018037057
31 32 33 34 35 36
0.051196985 -0.038802477 0.225856911 -1.173659057 -0.348318983 0.123811600
37 38 39 40 41 42
0.343328646 0.640799303 -2.144228361 0.436708681 -0.794908509 0.258668181
43 44 45 46 47 48
0.517988572 0.412562687 -1.519819948 -1.167746938 0.205091491 0.001000870
49 50 51 52 53 54
0.051196985 0.072535527 -0.770762515 -0.915991746 0.310517376 -0.172494921
55 56 57 58 59 60
0.066623408 0.291479450 0.168668719 -0.599483162 0.538753992 -0.144228361
61 62 63 64 65 66
-0.240361554 0.400516838 0.103046181 -0.359200697 0.364094065 0.205091491
67 68 69 70 71 72
-0.896953819 0.208472065 -0.134935669 0.021766289 -0.347154848 -0.461246008
73 74 75 76 77 78
-0.038802477 -0.896953819 -0.071613746 0.364094065 0.403897412 -0.071613746
79 80 81 82 83 84
0.415943261 0.343328646 0.379751418 0.135857450 -0.269792249 -0.668717204
85 86 87 88 89 90
-0.038802477 0.135857450 0.030431565 0.331282796 -0.685814599 -1.071613746
91 92 93 94 95 96
0.334663370 0.433328107 0.370006184 0.445373957 0.725459768 -1.599483162
97 98 99 100 101 102
0.827505079 -1.896953819 0.103046181 0.466139376 0.517988572 0.349240764
103 104 105 106 107 108
-0.714081159 0.331282796 0.123811600 -0.762097239 -0.071613746 0.485177303
109 110 111 112 113 114
0.139238024 -1.632183615 0.197562696 0.555547825 -1.889905221 1.203474815
115 116 117 118 119 120
-0.052465003 0.110094779 0.735315818 0.008049468 1.380887898 -0.889905221
121 122 123 124 125 126
-3.093995842 1.464522699 -0.640903185 0.906004158 -0.673714455 0.570401126
127 128 129 130 131 132
0.428330856 0.576313244 0.512991321 0.680713465 1.245005654 0.380887898
133 134 135 136 137 138
1.008049468 -0.264684182 0.428330856 0.507079203 0.212140090 0.380887898
139 140 141 142 143 144
0.245005654 1.253670930 0.947534997 1.326285545 1.122194923 1.049580308
145 146 147 148 149 150
0.647847901 0.317565975 0.203474815 0.080664084 1.203474815 0.380887898
151 152 153 154 155 156
1.070345728 0.588359094 1.380887898 1.110094779 1.326285545 0.305520126
157 158 159 160
0.110094779 0.113475353 1.422418738 0.253670930
> postscript(file="/var/www/html/rcomp/tmp/6k9sx1290558335.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 160
Frequency = 1
lag(myerror, k = 1) myerror
0 -1.955167675 NA
1 -2.637522611 -1.955167675
2 -2.631610493 -2.637522611
3 -0.916444287 -2.631610493
4 -1.159258297 -0.916444287
5 -1.475535952 -1.159258297
6 0.294914318 -1.475535952
7 -2.261876730 0.294914318
8 -1.767381941 -2.261876730
9 -0.491756662 -1.767381941
10 0.620033883 -0.491756662
11 -0.173659057 0.620033883
12 -0.514822697 -0.173659057
13 -0.038802477 -0.514822697
14 0.508243338 -0.038802477
15 0.505942723 0.508243338
16 0.237902761 0.505942723
17 0.229237485 0.237902761
18 0.412562687 0.229237485
19 0.436708681 0.412562687
20 0.168668719 0.436708681
21 0.267960873 0.168668719
22 0.123811600 0.267960873
23 -0.444452175 0.123811600
24 0.673610572 -0.444452175
25 -1.883993102 0.673610572
26 0.445373957 -1.883993102
27 0.281086681 0.445373957
28 -0.774143089 0.281086681
29 -0.018037057 -0.774143089
30 0.051196985 -0.018037057
31 -0.038802477 0.051196985
32 0.225856911 -0.038802477
33 -1.173659057 0.225856911
34 -0.348318983 -1.173659057
35 0.123811600 -0.348318983
36 0.343328646 0.123811600
37 0.640799303 0.343328646
38 -2.144228361 0.640799303
39 0.436708681 -2.144228361
40 -0.794908509 0.436708681
41 0.258668181 -0.794908509
42 0.517988572 0.258668181
43 0.412562687 0.517988572
44 -1.519819948 0.412562687
45 -1.167746938 -1.519819948
46 0.205091491 -1.167746938
47 0.001000870 0.205091491
48 0.051196985 0.001000870
49 0.072535527 0.051196985
50 -0.770762515 0.072535527
51 -0.915991746 -0.770762515
52 0.310517376 -0.915991746
53 -0.172494921 0.310517376
54 0.066623408 -0.172494921
55 0.291479450 0.066623408
56 0.168668719 0.291479450
57 -0.599483162 0.168668719
58 0.538753992 -0.599483162
59 -0.144228361 0.538753992
60 -0.240361554 -0.144228361
61 0.400516838 -0.240361554
62 0.103046181 0.400516838
63 -0.359200697 0.103046181
64 0.364094065 -0.359200697
65 0.205091491 0.364094065
66 -0.896953819 0.205091491
67 0.208472065 -0.896953819
68 -0.134935669 0.208472065
69 0.021766289 -0.134935669
70 -0.347154848 0.021766289
71 -0.461246008 -0.347154848
72 -0.038802477 -0.461246008
73 -0.896953819 -0.038802477
74 -0.071613746 -0.896953819
75 0.364094065 -0.071613746
76 0.403897412 0.364094065
77 -0.071613746 0.403897412
78 0.415943261 -0.071613746
79 0.343328646 0.415943261
80 0.379751418 0.343328646
81 0.135857450 0.379751418
82 -0.269792249 0.135857450
83 -0.668717204 -0.269792249
84 -0.038802477 -0.668717204
85 0.135857450 -0.038802477
86 0.030431565 0.135857450
87 0.331282796 0.030431565
88 -0.685814599 0.331282796
89 -1.071613746 -0.685814599
90 0.334663370 -1.071613746
91 0.433328107 0.334663370
92 0.370006184 0.433328107
93 0.445373957 0.370006184
94 0.725459768 0.445373957
95 -1.599483162 0.725459768
96 0.827505079 -1.599483162
97 -1.896953819 0.827505079
98 0.103046181 -1.896953819
99 0.466139376 0.103046181
100 0.517988572 0.466139376
101 0.349240764 0.517988572
102 -0.714081159 0.349240764
103 0.331282796 -0.714081159
104 0.123811600 0.331282796
105 -0.762097239 0.123811600
106 -0.071613746 -0.762097239
107 0.485177303 -0.071613746
108 0.139238024 0.485177303
109 -1.632183615 0.139238024
110 0.197562696 -1.632183615
111 0.555547825 0.197562696
112 -1.889905221 0.555547825
113 1.203474815 -1.889905221
114 -0.052465003 1.203474815
115 0.110094779 -0.052465003
116 0.735315818 0.110094779
117 0.008049468 0.735315818
118 1.380887898 0.008049468
119 -0.889905221 1.380887898
120 -3.093995842 -0.889905221
121 1.464522699 -3.093995842
122 -0.640903185 1.464522699
123 0.906004158 -0.640903185
124 -0.673714455 0.906004158
125 0.570401126 -0.673714455
126 0.428330856 0.570401126
127 0.576313244 0.428330856
128 0.512991321 0.576313244
129 0.680713465 0.512991321
130 1.245005654 0.680713465
131 0.380887898 1.245005654
132 1.008049468 0.380887898
133 -0.264684182 1.008049468
134 0.428330856 -0.264684182
135 0.507079203 0.428330856
136 0.212140090 0.507079203
137 0.380887898 0.212140090
138 0.245005654 0.380887898
139 1.253670930 0.245005654
140 0.947534997 1.253670930
141 1.326285545 0.947534997
142 1.122194923 1.326285545
143 1.049580308 1.122194923
144 0.647847901 1.049580308
145 0.317565975 0.647847901
146 0.203474815 0.317565975
147 0.080664084 0.203474815
148 1.203474815 0.080664084
149 0.380887898 1.203474815
150 1.070345728 0.380887898
151 0.588359094 1.070345728
152 1.380887898 0.588359094
153 1.110094779 1.380887898
154 1.326285545 1.110094779
155 0.305520126 1.326285545
156 0.110094779 0.305520126
157 0.113475353 0.110094779
158 1.422418738 0.113475353
159 0.253670930 1.422418738
160 NA 0.253670930
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -2.637522611 -1.955167675
[2,] -2.631610493 -2.637522611
[3,] -0.916444287 -2.631610493
[4,] -1.159258297 -0.916444287
[5,] -1.475535952 -1.159258297
[6,] 0.294914318 -1.475535952
[7,] -2.261876730 0.294914318
[8,] -1.767381941 -2.261876730
[9,] -0.491756662 -1.767381941
[10,] 0.620033883 -0.491756662
[11,] -0.173659057 0.620033883
[12,] -0.514822697 -0.173659057
[13,] -0.038802477 -0.514822697
[14,] 0.508243338 -0.038802477
[15,] 0.505942723 0.508243338
[16,] 0.237902761 0.505942723
[17,] 0.229237485 0.237902761
[18,] 0.412562687 0.229237485
[19,] 0.436708681 0.412562687
[20,] 0.168668719 0.436708681
[21,] 0.267960873 0.168668719
[22,] 0.123811600 0.267960873
[23,] -0.444452175 0.123811600
[24,] 0.673610572 -0.444452175
[25,] -1.883993102 0.673610572
[26,] 0.445373957 -1.883993102
[27,] 0.281086681 0.445373957
[28,] -0.774143089 0.281086681
[29,] -0.018037057 -0.774143089
[30,] 0.051196985 -0.018037057
[31,] -0.038802477 0.051196985
[32,] 0.225856911 -0.038802477
[33,] -1.173659057 0.225856911
[34,] -0.348318983 -1.173659057
[35,] 0.123811600 -0.348318983
[36,] 0.343328646 0.123811600
[37,] 0.640799303 0.343328646
[38,] -2.144228361 0.640799303
[39,] 0.436708681 -2.144228361
[40,] -0.794908509 0.436708681
[41,] 0.258668181 -0.794908509
[42,] 0.517988572 0.258668181
[43,] 0.412562687 0.517988572
[44,] -1.519819948 0.412562687
[45,] -1.167746938 -1.519819948
[46,] 0.205091491 -1.167746938
[47,] 0.001000870 0.205091491
[48,] 0.051196985 0.001000870
[49,] 0.072535527 0.051196985
[50,] -0.770762515 0.072535527
[51,] -0.915991746 -0.770762515
[52,] 0.310517376 -0.915991746
[53,] -0.172494921 0.310517376
[54,] 0.066623408 -0.172494921
[55,] 0.291479450 0.066623408
[56,] 0.168668719 0.291479450
[57,] -0.599483162 0.168668719
[58,] 0.538753992 -0.599483162
[59,] -0.144228361 0.538753992
[60,] -0.240361554 -0.144228361
[61,] 0.400516838 -0.240361554
[62,] 0.103046181 0.400516838
[63,] -0.359200697 0.103046181
[64,] 0.364094065 -0.359200697
[65,] 0.205091491 0.364094065
[66,] -0.896953819 0.205091491
[67,] 0.208472065 -0.896953819
[68,] -0.134935669 0.208472065
[69,] 0.021766289 -0.134935669
[70,] -0.347154848 0.021766289
[71,] -0.461246008 -0.347154848
[72,] -0.038802477 -0.461246008
[73,] -0.896953819 -0.038802477
[74,] -0.071613746 -0.896953819
[75,] 0.364094065 -0.071613746
[76,] 0.403897412 0.364094065
[77,] -0.071613746 0.403897412
[78,] 0.415943261 -0.071613746
[79,] 0.343328646 0.415943261
[80,] 0.379751418 0.343328646
[81,] 0.135857450 0.379751418
[82,] -0.269792249 0.135857450
[83,] -0.668717204 -0.269792249
[84,] -0.038802477 -0.668717204
[85,] 0.135857450 -0.038802477
[86,] 0.030431565 0.135857450
[87,] 0.331282796 0.030431565
[88,] -0.685814599 0.331282796
[89,] -1.071613746 -0.685814599
[90,] 0.334663370 -1.071613746
[91,] 0.433328107 0.334663370
[92,] 0.370006184 0.433328107
[93,] 0.445373957 0.370006184
[94,] 0.725459768 0.445373957
[95,] -1.599483162 0.725459768
[96,] 0.827505079 -1.599483162
[97,] -1.896953819 0.827505079
[98,] 0.103046181 -1.896953819
[99,] 0.466139376 0.103046181
[100,] 0.517988572 0.466139376
[101,] 0.349240764 0.517988572
[102,] -0.714081159 0.349240764
[103,] 0.331282796 -0.714081159
[104,] 0.123811600 0.331282796
[105,] -0.762097239 0.123811600
[106,] -0.071613746 -0.762097239
[107,] 0.485177303 -0.071613746
[108,] 0.139238024 0.485177303
[109,] -1.632183615 0.139238024
[110,] 0.197562696 -1.632183615
[111,] 0.555547825 0.197562696
[112,] -1.889905221 0.555547825
[113,] 1.203474815 -1.889905221
[114,] -0.052465003 1.203474815
[115,] 0.110094779 -0.052465003
[116,] 0.735315818 0.110094779
[117,] 0.008049468 0.735315818
[118,] 1.380887898 0.008049468
[119,] -0.889905221 1.380887898
[120,] -3.093995842 -0.889905221
[121,] 1.464522699 -3.093995842
[122,] -0.640903185 1.464522699
[123,] 0.906004158 -0.640903185
[124,] -0.673714455 0.906004158
[125,] 0.570401126 -0.673714455
[126,] 0.428330856 0.570401126
[127,] 0.576313244 0.428330856
[128,] 0.512991321 0.576313244
[129,] 0.680713465 0.512991321
[130,] 1.245005654 0.680713465
[131,] 0.380887898 1.245005654
[132,] 1.008049468 0.380887898
[133,] -0.264684182 1.008049468
[134,] 0.428330856 -0.264684182
[135,] 0.507079203 0.428330856
[136,] 0.212140090 0.507079203
[137,] 0.380887898 0.212140090
[138,] 0.245005654 0.380887898
[139,] 1.253670930 0.245005654
[140,] 0.947534997 1.253670930
[141,] 1.326285545 0.947534997
[142,] 1.122194923 1.326285545
[143,] 1.049580308 1.122194923
[144,] 0.647847901 1.049580308
[145,] 0.317565975 0.647847901
[146,] 0.203474815 0.317565975
[147,] 0.080664084 0.203474815
[148,] 1.203474815 0.080664084
[149,] 0.380887898 1.203474815
[150,] 1.070345728 0.380887898
[151,] 0.588359094 1.070345728
[152,] 1.380887898 0.588359094
[153,] 1.110094779 1.380887898
[154,] 1.326285545 1.110094779
[155,] 0.305520126 1.326285545
[156,] 0.110094779 0.305520126
[157,] 0.113475353 0.110094779
[158,] 1.422418738 0.113475353
[159,] 0.253670930 1.422418738
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -2.637522611 -1.955167675
2 -2.631610493 -2.637522611
3 -0.916444287 -2.631610493
4 -1.159258297 -0.916444287
5 -1.475535952 -1.159258297
6 0.294914318 -1.475535952
7 -2.261876730 0.294914318
8 -1.767381941 -2.261876730
9 -0.491756662 -1.767381941
10 0.620033883 -0.491756662
11 -0.173659057 0.620033883
12 -0.514822697 -0.173659057
13 -0.038802477 -0.514822697
14 0.508243338 -0.038802477
15 0.505942723 0.508243338
16 0.237902761 0.505942723
17 0.229237485 0.237902761
18 0.412562687 0.229237485
19 0.436708681 0.412562687
20 0.168668719 0.436708681
21 0.267960873 0.168668719
22 0.123811600 0.267960873
23 -0.444452175 0.123811600
24 0.673610572 -0.444452175
25 -1.883993102 0.673610572
26 0.445373957 -1.883993102
27 0.281086681 0.445373957
28 -0.774143089 0.281086681
29 -0.018037057 -0.774143089
30 0.051196985 -0.018037057
31 -0.038802477 0.051196985
32 0.225856911 -0.038802477
33 -1.173659057 0.225856911
34 -0.348318983 -1.173659057
35 0.123811600 -0.348318983
36 0.343328646 0.123811600
37 0.640799303 0.343328646
38 -2.144228361 0.640799303
39 0.436708681 -2.144228361
40 -0.794908509 0.436708681
41 0.258668181 -0.794908509
42 0.517988572 0.258668181
43 0.412562687 0.517988572
44 -1.519819948 0.412562687
45 -1.167746938 -1.519819948
46 0.205091491 -1.167746938
47 0.001000870 0.205091491
48 0.051196985 0.001000870
49 0.072535527 0.051196985
50 -0.770762515 0.072535527
51 -0.915991746 -0.770762515
52 0.310517376 -0.915991746
53 -0.172494921 0.310517376
54 0.066623408 -0.172494921
55 0.291479450 0.066623408
56 0.168668719 0.291479450
57 -0.599483162 0.168668719
58 0.538753992 -0.599483162
59 -0.144228361 0.538753992
60 -0.240361554 -0.144228361
61 0.400516838 -0.240361554
62 0.103046181 0.400516838
63 -0.359200697 0.103046181
64 0.364094065 -0.359200697
65 0.205091491 0.364094065
66 -0.896953819 0.205091491
67 0.208472065 -0.896953819
68 -0.134935669 0.208472065
69 0.021766289 -0.134935669
70 -0.347154848 0.021766289
71 -0.461246008 -0.347154848
72 -0.038802477 -0.461246008
73 -0.896953819 -0.038802477
74 -0.071613746 -0.896953819
75 0.364094065 -0.071613746
76 0.403897412 0.364094065
77 -0.071613746 0.403897412
78 0.415943261 -0.071613746
79 0.343328646 0.415943261
80 0.379751418 0.343328646
81 0.135857450 0.379751418
82 -0.269792249 0.135857450
83 -0.668717204 -0.269792249
84 -0.038802477 -0.668717204
85 0.135857450 -0.038802477
86 0.030431565 0.135857450
87 0.331282796 0.030431565
88 -0.685814599 0.331282796
89 -1.071613746 -0.685814599
90 0.334663370 -1.071613746
91 0.433328107 0.334663370
92 0.370006184 0.433328107
93 0.445373957 0.370006184
94 0.725459768 0.445373957
95 -1.599483162 0.725459768
96 0.827505079 -1.599483162
97 -1.896953819 0.827505079
98 0.103046181 -1.896953819
99 0.466139376 0.103046181
100 0.517988572 0.466139376
101 0.349240764 0.517988572
102 -0.714081159 0.349240764
103 0.331282796 -0.714081159
104 0.123811600 0.331282796
105 -0.762097239 0.123811600
106 -0.071613746 -0.762097239
107 0.485177303 -0.071613746
108 0.139238024 0.485177303
109 -1.632183615 0.139238024
110 0.197562696 -1.632183615
111 0.555547825 0.197562696
112 -1.889905221 0.555547825
113 1.203474815 -1.889905221
114 -0.052465003 1.203474815
115 0.110094779 -0.052465003
116 0.735315818 0.110094779
117 0.008049468 0.735315818
118 1.380887898 0.008049468
119 -0.889905221 1.380887898
120 -3.093995842 -0.889905221
121 1.464522699 -3.093995842
122 -0.640903185 1.464522699
123 0.906004158 -0.640903185
124 -0.673714455 0.906004158
125 0.570401126 -0.673714455
126 0.428330856 0.570401126
127 0.576313244 0.428330856
128 0.512991321 0.576313244
129 0.680713465 0.512991321
130 1.245005654 0.680713465
131 0.380887898 1.245005654
132 1.008049468 0.380887898
133 -0.264684182 1.008049468
134 0.428330856 -0.264684182
135 0.507079203 0.428330856
136 0.212140090 0.507079203
137 0.380887898 0.212140090
138 0.245005654 0.380887898
139 1.253670930 0.245005654
140 0.947534997 1.253670930
141 1.326285545 0.947534997
142 1.122194923 1.326285545
143 1.049580308 1.122194923
144 0.647847901 1.049580308
145 0.317565975 0.647847901
146 0.203474815 0.317565975
147 0.080664084 0.203474815
148 1.203474815 0.080664084
149 0.380887898 1.203474815
150 1.070345728 0.380887898
151 0.588359094 1.070345728
152 1.380887898 0.588359094
153 1.110094779 1.380887898
154 1.326285545 1.110094779
155 0.305520126 1.326285545
156 0.110094779 0.305520126
157 0.113475353 0.110094779
158 1.422418738 0.113475353
159 0.253670930 1.422418738
> 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/7visi1290558335.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/8n9r31290558335.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/rcomp/tmp/9n9r31290558335.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/www/html/rcomp/tmp/10n9r31290558335.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/www/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/11jj6b1290558335.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/12uaof1290558335.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/131t3q1290558335.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/144uje1290558335.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/15qu021290558335.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/16bvgq1290558335.tab")
+ }
>
> try(system("convert tmp/1z78h1290558334.ps tmp/1z78h1290558334.png",intern=TRUE))
character(0)
> try(system("convert tmp/2z78h1290558334.ps tmp/2z78h1290558334.png",intern=TRUE))
character(0)
> try(system("convert tmp/3z78h1290558334.ps tmp/3z78h1290558334.png",intern=TRUE))
character(0)
> try(system("convert tmp/4k9sx1290558335.ps tmp/4k9sx1290558335.png",intern=TRUE))
character(0)
> try(system("convert tmp/5k9sx1290558335.ps tmp/5k9sx1290558335.png",intern=TRUE))
character(0)
> try(system("convert tmp/6k9sx1290558335.ps tmp/6k9sx1290558335.png",intern=TRUE))
character(0)
> try(system("convert tmp/7visi1290558335.ps tmp/7visi1290558335.png",intern=TRUE))
character(0)
> try(system("convert tmp/8n9r31290558335.ps tmp/8n9r31290558335.png",intern=TRUE))
character(0)
> try(system("convert tmp/9n9r31290558335.ps tmp/9n9r31290558335.png",intern=TRUE))
character(0)
> try(system("convert tmp/10n9r31290558335.ps tmp/10n9r31290558335.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.045 1.731 10.642