R version 2.8.0 (2008-10-20)
Copyright (C) 2008 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.
Natural language support but running in an English locale
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(9
+ ,4
+ ,2
+ ,5
+ ,4
+ ,3
+ ,9
+ ,4
+ ,2
+ ,4
+ ,3
+ ,2
+ ,9
+ ,5
+ ,4
+ ,4
+ ,2
+ ,2
+ ,9
+ ,3
+ ,2
+ ,4
+ ,2
+ ,2
+ ,9
+ ,4
+ ,3
+ ,2
+ ,2
+ ,2
+ ,9
+ ,3
+ ,4
+ ,5
+ ,2
+ ,2
+ ,10
+ ,4
+ ,3
+ ,5
+ ,3
+ ,2
+ ,10
+ ,3
+ ,3
+ ,4
+ ,2
+ ,1
+ ,10
+ ,2
+ ,3
+ ,3
+ ,1
+ ,2
+ ,10
+ ,4
+ ,2
+ ,4
+ ,2
+ ,2
+ ,10
+ ,2
+ ,4
+ ,4
+ ,2
+ ,2
+ ,10
+ ,2
+ ,3
+ ,3
+ ,2
+ ,2
+ ,10
+ ,1
+ ,3
+ ,3
+ ,2
+ ,2
+ ,10
+ ,4
+ ,4
+ ,4
+ ,2
+ ,2
+ ,10
+ ,4
+ ,4
+ ,5
+ ,1
+ ,1
+ ,10
+ ,2
+ ,3
+ ,4
+ ,2
+ ,2
+ ,10
+ ,2
+ ,3
+ ,2
+ ,2
+ ,1
+ ,10
+ ,3
+ ,3
+ ,4
+ ,3
+ ,2
+ ,10
+ ,3
+ ,4
+ ,4
+ ,4
+ ,2
+ ,10
+ ,3
+ ,2
+ ,4
+ ,4
+ ,2
+ ,10
+ ,4
+ ,5
+ ,4
+ ,4
+ ,4
+ ,10
+ ,3
+ ,4
+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seasonal Dummies'
> par1 = '2'
> #'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
YT T1 X1 X2 X3 X4
1 4 9 2 5 4 3
2 4 9 2 4 3 2
3 5 9 4 4 2 2
4 3 9 2 4 2 2
5 4 9 3 2 2 2
6 3 9 4 5 2 2
7 4 10 3 5 3 2
8 3 10 3 4 2 1
9 2 10 3 3 1 2
10 4 10 2 4 2 2
11 2 10 4 4 2 2
12 2 10 3 3 2 2
13 1 10 3 3 2 2
14 4 10 4 4 2 2
15 4 10 4 5 1 1
16 2 10 3 4 2 2
17 2 10 3 2 2 1
18 3 10 3 4 3 2
19 3 10 4 4 4 2
20 3 10 2 4 4 2
21 4 10 5 4 4 4
22 3 10 4 4 4 2
23 2 10 2 4 4 4
24 2 10 3 5 2 2
25 4 10 4 4 2 2
26 4 10 4 4 4 2
27 3 10 3 4 2 2
28 4 10 4 4 3 2
29 2 10 4 4 2 2
30 4 10 1 4 4 2
31 4 10 4 4 3 3
32 5 10 5 2 4 2
33 5 10 2 4 2 2
34 4 10 4 4 2 2
35 4 10 3 5 4 3
36 4 10 2 5 5 4
37 2 10 4 4 2 1
38 4 10 5 3 4 2
39 4 10 4 4 4 3
40 4 10 4 5 5 3
41 3 10 4 4 3 2
42 2 10 3 4 2 2
43 3 10 4 5 3 2
44 4 10 2 4 2 2
45 3 10 2 5 1 2
46 2 10 4 4 2 2
47 4 10 2 4 4 4
48 4 10 4 4 4 4
49 3 10 4 3 4 2
50 4 10 1 4 4 3
51 3 10 4 4 2 2
52 4 10 2 4 2 2
53 2 10 1 2 1 1
54 4 10 4 3 4 3
55 4 10 3 5 2 4
56 4 10 2 4 4 2
57 4 10 4 4 2 2
58 3 10 3 5 2 1
59 1 10 2 3 1 2
60 3 10 2 5 2 2
61 3 10 3 4 2 2
62 4 10 2 5 2 2
63 2 10 1 4 2 2
64 3 10 3 4 1 1
65 5 10 2 5 5 2
66 4 10 3 4 3 3
67 4 10 3 4 2 2
68 3 10 3 5 1 1
69 4 10 2 4 2 2
70 2 10 3 3 4 4
71 3 10 2 4 2 2
72 4 10 4 5 5 3
73 3 10 4 5 4 4
74 4 10 4 5 3 2
75 4 10 2 4 2 4
76 3 10 3 4 2 1
77 3 10 4 5 2 2
78 2 10 3 5 2 2
79 4 10 4 4 4 4
80 3 10 2 5 2 3
81 2 10 3 3 2 2
82 2 10 3 4 4 2
83 3 10 4 4 4 2
84 2 10 2 4 2 3
85 2 10 4 4 2 2
86 4 10 2 4 3 2
87 4 10 2 5 2 1
88 4 10 4 4 4 2
89 2 10 3 4 2 2
90 2 10 4 4 4 4
91 4 10 2 5 1 1
92 2 10 2 3 2 2
93 3 10 3 3 3 2
94 3 10 3 5 2 2
95 5 10 5 5 4 4
96 3 10 2 4 2 4
97 4 10 3 4 3 3
98 3 10 4 4 2 2
99 2 10 3 4 2 3
100 4 10 4 4 2 2
101 3 10 3 4 2 1
102 3 10 3 4 2 2
103 3 10 2 4 2 2
104 4 10 3 5 3 2
105 1 10 2 2 2 4
106 3 10 3 4 2 2
107 2 10 2 2 4 3
108 3 10 4 4 3 3
109 2 10 2 5 2 2
110 2 10 4 3 1 1
111 2 10 4 4 2 4
112 4 10 1 3 2 2
113 5 10 5 4 5 2
114 5 10 2 4 1 1
115 3 10 3 4 2 2
116 4 10 4 2 2 2
117 4 10 1 1 2 2
118 3 10 5 4 2 3
119 2 10 3 3 2 1
120 4 10 3 4 5 3
121 2 10 3 3 2 2
122 3 10 3 3 2 3
123 2 10 2 5 2 1
124 2 10 2 4 2 2
125 2 10 4 3 2 3
126 4 10 4 4 2 1
127 4 10 3 4 3 2
128 4 10 3 4 2 2
129 4 10 3 4 4 3
130 3 10 4 3 4 2
131 2 10 3 4 2 2
132 4 10 4 4 4 2
133 3 10 4 4 4 2
134 2 10 2 4 2 2
135 4 10 4 4 4 2
136 3 10 2 3 3 3
137 3 10 4 4 2 2
138 3 10 3 4 2 2
139 3 10 3 2 3 3
140 3 10 2 2 4 2
141 4 10 2 4 4 2
142 5 10 5 2 5 1
143 2 10 2 4 2 1
144 4 10 3 4 3 4
145 3 10 3 3 5 3
146 3 10 3 2 2 3
147 1 10 3 2 2 2
148 2 10 4 4 2 2
149 4 10 4 3 2 2
150 4 10 4 4 2 4
151 5 10 4 4 5 3
152 2 10 4 2 3 3
153 4 10 5 5 2 2
154 3 10 3 4 2 2
155 2 10 3 4 3 2
156 4 10 4 4 3 3
157 2 10 4 3 2 5
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) T1 X1 X2 X3 X4
8.33389 -0.70792 0.07655 0.24751 0.36568 -0.11558
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.72708 -0.72708 0.02541 0.65972 2.35206
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 8.33389 3.58747 2.323 0.02151 *
T1 -0.70792 0.35828 -1.976 0.04999 *
X1 0.07655 0.07303 1.048 0.29619
X2 0.24751 0.08187 3.023 0.00294 **
X3 0.36568 0.07177 5.095 1.03e-06 ***
X4 -0.11558 0.08895 -1.299 0.19578
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.8584 on 151 degrees of freedom
Multiple R-squared: 0.2287, Adjusted R-squared: 0.2032
F-statistic: 8.955 on 5 and 151 DF, p-value: 1.805e-07
> 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.47851681 0.9570336 0.52148319
[2,] 0.69957205 0.6008559 0.30042795
[3,] 0.78056089 0.4388782 0.21943911
[4,] 0.76824433 0.4635113 0.23175567
[5,] 0.87527196 0.2494561 0.12472804
[6,] 0.90977637 0.1804473 0.09022363
[7,] 0.88834617 0.2233077 0.11165383
[8,] 0.87049280 0.2590144 0.12950720
[9,] 0.83951669 0.3209666 0.16048331
[10,] 0.78325431 0.4334914 0.21674569
[11,] 0.72665641 0.5466872 0.27334359
[12,] 0.66021185 0.6795763 0.33978815
[13,] 0.66084759 0.6783048 0.33915241
[14,] 0.60648124 0.7870375 0.39351876
[15,] 0.59011528 0.8197694 0.40988472
[16,] 0.61994932 0.7601014 0.38005068
[17,] 0.64219216 0.7156157 0.35780784
[18,] 0.59493961 0.8101208 0.40506039
[19,] 0.53523546 0.9295291 0.46476454
[20,] 0.50621637 0.9875673 0.49378363
[21,] 0.53706915 0.9258617 0.46293085
[22,] 0.57351051 0.8529790 0.42648949
[23,] 0.58069058 0.8386188 0.41930942
[24,] 0.65798057 0.6840389 0.34201943
[25,] 0.90865086 0.1826983 0.09134914
[26,] 0.90826608 0.1834678 0.09173392
[27,] 0.88678073 0.2264385 0.11321927
[28,] 0.86264142 0.2747172 0.13735858
[29,] 0.88684290 0.2263142 0.11315710
[30,] 0.86043652 0.2791270 0.13956348
[31,] 0.83074004 0.3385199 0.16925996
[32,] 0.79771761 0.4045648 0.20228239
[33,] 0.76700145 0.4659971 0.23299855
[34,] 0.76688091 0.4662382 0.23311909
[35,] 0.74326116 0.5134777 0.25673884
[36,] 0.78116408 0.4376718 0.21883592
[37,] 0.74790485 0.5041903 0.25209515
[38,] 0.76266115 0.4746777 0.23733885
[39,] 0.73908514 0.5218297 0.26091486
[40,] 0.70263236 0.5947353 0.29736764
[41,] 0.67481217 0.6503757 0.32518783
[42,] 0.64677725 0.7064455 0.35322275
[43,] 0.59848375 0.8030325 0.40151625
[44,] 0.62539146 0.7492171 0.37460854
[45,] 0.57983033 0.8403393 0.42016967
[46,] 0.54566946 0.9086611 0.45433054
[47,] 0.54221234 0.9155753 0.45778766
[48,] 0.50598769 0.9880246 0.49401231
[49,] 0.51225637 0.9754873 0.48774363
[50,] 0.46683707 0.9336741 0.53316293
[51,] 0.54197410 0.9160518 0.45802590
[52,] 0.49397202 0.9879440 0.50602798
[53,] 0.44547769 0.8909554 0.55452231
[54,] 0.44761884 0.8952377 0.55238116
[55,] 0.44083104 0.8816621 0.55916896
[56,] 0.40088222 0.8017644 0.59911778
[57,] 0.39755904 0.7951181 0.60244096
[58,] 0.38345915 0.7669183 0.61654085
[59,] 0.39925120 0.7985024 0.60074880
[60,] 0.35446438 0.7089288 0.64553562
[61,] 0.37985019 0.7597004 0.62014981
[62,] 0.43790520 0.8758104 0.56209480
[63,] 0.39229932 0.7845986 0.60770068
[64,] 0.35229397 0.7045879 0.64770603
[65,] 0.34712514 0.6942503 0.65287486
[66,] 0.31078158 0.6215632 0.68921842
[67,] 0.36237845 0.7247569 0.63762155
[68,] 0.31935681 0.6387136 0.68064319
[69,] 0.28330041 0.5666008 0.71669959
[70,] 0.32185142 0.6437028 0.67814858
[71,] 0.29105978 0.5821196 0.70894022
[72,] 0.25327502 0.5065500 0.74672498
[73,] 0.24435173 0.4887035 0.75564827
[74,] 0.35122413 0.7024483 0.64877587
[75,] 0.34163765 0.6832753 0.65836235
[76,] 0.33570115 0.6714023 0.66429885
[77,] 0.35811474 0.7162295 0.64188526
[78,] 0.34721149 0.6944230 0.65278851
[79,] 0.33707324 0.6741465 0.66292676
[80,] 0.29816669 0.5963334 0.70183331
[81,] 0.30852527 0.6170505 0.69147473
[82,] 0.40313673 0.8062735 0.59686327
[83,] 0.43630440 0.8726088 0.56369560
[84,] 0.41223890 0.8244778 0.58776110
[85,] 0.36711381 0.7342276 0.63288619
[86,] 0.32525437 0.6505087 0.67474563
[87,] 0.34955882 0.6991176 0.65044118
[88,] 0.31792796 0.6358559 0.68207204
[89,] 0.31310622 0.6262124 0.68689378
[90,] 0.27171918 0.5434384 0.72828082
[91,] 0.26563369 0.5312674 0.73436631
[92,] 0.27000274 0.5400055 0.72999726
[93,] 0.23144393 0.4628879 0.76855607
[94,] 0.19567847 0.3913569 0.80432153
[95,] 0.16465239 0.3293048 0.83534761
[96,] 0.14412992 0.2882598 0.85587008
[97,] 0.16257364 0.3251473 0.83742636
[98,] 0.13379188 0.2675838 0.86620812
[99,] 0.14859957 0.2971991 0.85140043
[100,] 0.12365780 0.2473156 0.87634220
[101,] 0.13411066 0.2682213 0.86588934
[102,] 0.11999586 0.2399917 0.88000414
[103,] 0.11616172 0.2323234 0.88383828
[104,] 0.16449478 0.3289896 0.83550522
[105,] 0.15300633 0.3060127 0.84699367
[106,] 0.49040440 0.9808088 0.50959560
[107,] 0.43938148 0.8787630 0.56061852
[108,] 0.51332361 0.9733528 0.48667639
[109,] 0.83886389 0.3222722 0.16113611
[110,] 0.81280530 0.3743894 0.18719470
[111,] 0.78681916 0.4263617 0.21318084
[112,] 0.74455038 0.5108992 0.25544962
[113,] 0.71150907 0.5769819 0.28849093
[114,] 0.68105368 0.6378926 0.31894632
[115,] 0.68436680 0.6312664 0.31563320
[116,] 0.65495541 0.6900892 0.34504459
[117,] 0.64431084 0.7113783 0.35568916
[118,] 0.65138001 0.6972400 0.34861999
[119,] 0.63828980 0.7234204 0.36171020
[120,] 0.71668418 0.5666316 0.28331582
[121,] 0.66431782 0.6713644 0.33568218
[122,] 0.64226639 0.7154672 0.35773361
[123,] 0.62108887 0.7578223 0.37891113
[124,] 0.55317634 0.8936473 0.44682366
[125,] 0.59714955 0.8057009 0.40285045
[126,] 0.54457558 0.9108488 0.45542442
[127,] 0.47431672 0.9486334 0.52568328
[128,] 0.41534652 0.8306930 0.58465348
[129,] 0.34227458 0.6845492 0.65772542
[130,] 0.27734719 0.5546944 0.72265281
[131,] 0.22848833 0.4569767 0.77151167
[132,] 0.18486191 0.3697238 0.81513809
[133,] 0.17697452 0.3539490 0.82302548
[134,] 0.18259723 0.3651945 0.81740277
[135,] 0.13154437 0.2630887 0.86845563
[136,] 0.10994317 0.2198863 0.89005683
[137,] 0.07419429 0.1483886 0.92580571
[138,] 0.12355296 0.2471059 0.87644704
[139,] 0.07764915 0.1552983 0.92235085
[140,] 0.09882864 0.1976573 0.90117136
> postscript(file="/var/www/html/freestat/rcomp/tmp/1x4pt1290528147.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/freestat/rcomp/tmp/28v6w1290528147.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/freestat/rcomp/tmp/38v6w1290528147.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/freestat/rcomp/tmp/48v6w1290528147.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/freestat/rcomp/tmp/58v6w1290528147.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 = 157
Frequency = 1
1 2 3 4 5 6
-0.46926005 0.02835562 1.24093308 -0.60596117 0.81251289 -1.00658038
7 8 9 10 11 12
0.41221080 -0.09017352 -0.36139585 1.10196035 -1.05114540 -0.72707906
13 14 15 16 17 18
-1.72707906 0.94885460 0.95144335 -0.97459253 -0.59514659 -0.34027574
19 20 21 22 23 24
-0.78251182 -0.62940607 0.37209730 -0.78251182 -1.39824408 -1.22210599
25 26 27 28 29 30
0.94885460 0.21748818 0.02540747 0.58317139 -1.05114540 0.44714680
31 32 33 34 35 36
0.69875239 1.63596224 2.10196035 0.94885460 0.16210858 -0.01144075
37 38 39 40 41 42
-1.16672640 0.38844877 0.33306918 -0.28012750 -0.41682861 -0.97459253
43 44 45 46 47 48
-0.66434208 1.10196035 0.22013009 -1.05114540 0.60175592 0.44865017
49 50 51 52 53 54
-0.53499835 0.56272780 -0.05114540 1.10196035 -0.07635763 0.58058264
55 56 57 58 59 60
1.00905600 0.37059393 0.94885460 -0.33768699 -1.28484297 -0.14555312
61 62 63 64 65 66
0.02540747 0.85444688 -0.82148678 0.27550969 0.75739725 0.77530526
67 68 69 70 71 72
1.02540747 0.02799622 1.10196035 -1.22728349 0.10196035 -0.28012750
73 74 75 76 77 78
-0.79886329 0.33565792 1.33312234 -0.09017352 -0.29865887 -1.22210599
79 80 81 82 83 84
0.44865017 -0.02997212 -0.72707906 -1.70595895 -0.78251182 -0.78245865
85 86 87 88 89 90
-1.05114540 0.73627714 0.73886589 0.21748818 -0.97459253 -1.55134983
91 92 93 94 95 96
1.10454910 -0.65052618 -0.09276227 -0.22210599 1.12458383 0.33312234
97 98 99 100 101 102
0.77530526 -0.05114540 -0.85901153 0.94885460 -0.09017352 0.02540747
103 104 105 106 107 108
0.10196035 0.41221080 -1.17185072 0.02540747 -1.01879814 -0.30124761
109 110 111 112 113 114
-1.14555312 -0.55352972 -0.81998341 1.42602669 0.77525209 2.35206256
115 116 117 118 119 120
0.02540747 1.44388153 1.92105362 -0.01211728 -0.84266006 0.04393884
121 122 123 124 125 126
-0.72707906 0.38850194 -1.26113411 -0.89803965 -0.68805094 0.83327360
127 128 129 130 131 132
0.65972426 1.02540747 0.40962205 -0.53499835 -0.97459253 0.21748818
133 134 135 136 137 138
-0.78251182 -0.89803965 0.21748818 0.09937160 -0.05114540 0.02540747
139 140 141 142 143 144
0.27033219 -0.13437914 0.37059393 1.15469803 -1.01362065 0.89088626
145 146 147 148 149 150
-0.70854769 0.63601540 -1.47956559 -1.05114540 1.19636807 1.18001659
151 152 153 154 155 156
0.96738597 -0.80622068 0.62478826 0.02540747 -1.34027574 0.69875239
157
-0.45688894
> postscript(file="/var/www/html/freestat/rcomp/tmp/6145h1290528147.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 = 157
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.46926005 NA
1 0.02835562 -0.46926005
2 1.24093308 0.02835562
3 -0.60596117 1.24093308
4 0.81251289 -0.60596117
5 -1.00658038 0.81251289
6 0.41221080 -1.00658038
7 -0.09017352 0.41221080
8 -0.36139585 -0.09017352
9 1.10196035 -0.36139585
10 -1.05114540 1.10196035
11 -0.72707906 -1.05114540
12 -1.72707906 -0.72707906
13 0.94885460 -1.72707906
14 0.95144335 0.94885460
15 -0.97459253 0.95144335
16 -0.59514659 -0.97459253
17 -0.34027574 -0.59514659
18 -0.78251182 -0.34027574
19 -0.62940607 -0.78251182
20 0.37209730 -0.62940607
21 -0.78251182 0.37209730
22 -1.39824408 -0.78251182
23 -1.22210599 -1.39824408
24 0.94885460 -1.22210599
25 0.21748818 0.94885460
26 0.02540747 0.21748818
27 0.58317139 0.02540747
28 -1.05114540 0.58317139
29 0.44714680 -1.05114540
30 0.69875239 0.44714680
31 1.63596224 0.69875239
32 2.10196035 1.63596224
33 0.94885460 2.10196035
34 0.16210858 0.94885460
35 -0.01144075 0.16210858
36 -1.16672640 -0.01144075
37 0.38844877 -1.16672640
38 0.33306918 0.38844877
39 -0.28012750 0.33306918
40 -0.41682861 -0.28012750
41 -0.97459253 -0.41682861
42 -0.66434208 -0.97459253
43 1.10196035 -0.66434208
44 0.22013009 1.10196035
45 -1.05114540 0.22013009
46 0.60175592 -1.05114540
47 0.44865017 0.60175592
48 -0.53499835 0.44865017
49 0.56272780 -0.53499835
50 -0.05114540 0.56272780
51 1.10196035 -0.05114540
52 -0.07635763 1.10196035
53 0.58058264 -0.07635763
54 1.00905600 0.58058264
55 0.37059393 1.00905600
56 0.94885460 0.37059393
57 -0.33768699 0.94885460
58 -1.28484297 -0.33768699
59 -0.14555312 -1.28484297
60 0.02540747 -0.14555312
61 0.85444688 0.02540747
62 -0.82148678 0.85444688
63 0.27550969 -0.82148678
64 0.75739725 0.27550969
65 0.77530526 0.75739725
66 1.02540747 0.77530526
67 0.02799622 1.02540747
68 1.10196035 0.02799622
69 -1.22728349 1.10196035
70 0.10196035 -1.22728349
71 -0.28012750 0.10196035
72 -0.79886329 -0.28012750
73 0.33565792 -0.79886329
74 1.33312234 0.33565792
75 -0.09017352 1.33312234
76 -0.29865887 -0.09017352
77 -1.22210599 -0.29865887
78 0.44865017 -1.22210599
79 -0.02997212 0.44865017
80 -0.72707906 -0.02997212
81 -1.70595895 -0.72707906
82 -0.78251182 -1.70595895
83 -0.78245865 -0.78251182
84 -1.05114540 -0.78245865
85 0.73627714 -1.05114540
86 0.73886589 0.73627714
87 0.21748818 0.73886589
88 -0.97459253 0.21748818
89 -1.55134983 -0.97459253
90 1.10454910 -1.55134983
91 -0.65052618 1.10454910
92 -0.09276227 -0.65052618
93 -0.22210599 -0.09276227
94 1.12458383 -0.22210599
95 0.33312234 1.12458383
96 0.77530526 0.33312234
97 -0.05114540 0.77530526
98 -0.85901153 -0.05114540
99 0.94885460 -0.85901153
100 -0.09017352 0.94885460
101 0.02540747 -0.09017352
102 0.10196035 0.02540747
103 0.41221080 0.10196035
104 -1.17185072 0.41221080
105 0.02540747 -1.17185072
106 -1.01879814 0.02540747
107 -0.30124761 -1.01879814
108 -1.14555312 -0.30124761
109 -0.55352972 -1.14555312
110 -0.81998341 -0.55352972
111 1.42602669 -0.81998341
112 0.77525209 1.42602669
113 2.35206256 0.77525209
114 0.02540747 2.35206256
115 1.44388153 0.02540747
116 1.92105362 1.44388153
117 -0.01211728 1.92105362
118 -0.84266006 -0.01211728
119 0.04393884 -0.84266006
120 -0.72707906 0.04393884
121 0.38850194 -0.72707906
122 -1.26113411 0.38850194
123 -0.89803965 -1.26113411
124 -0.68805094 -0.89803965
125 0.83327360 -0.68805094
126 0.65972426 0.83327360
127 1.02540747 0.65972426
128 0.40962205 1.02540747
129 -0.53499835 0.40962205
130 -0.97459253 -0.53499835
131 0.21748818 -0.97459253
132 -0.78251182 0.21748818
133 -0.89803965 -0.78251182
134 0.21748818 -0.89803965
135 0.09937160 0.21748818
136 -0.05114540 0.09937160
137 0.02540747 -0.05114540
138 0.27033219 0.02540747
139 -0.13437914 0.27033219
140 0.37059393 -0.13437914
141 1.15469803 0.37059393
142 -1.01362065 1.15469803
143 0.89088626 -1.01362065
144 -0.70854769 0.89088626
145 0.63601540 -0.70854769
146 -1.47956559 0.63601540
147 -1.05114540 -1.47956559
148 1.19636807 -1.05114540
149 1.18001659 1.19636807
150 0.96738597 1.18001659
151 -0.80622068 0.96738597
152 0.62478826 -0.80622068
153 0.02540747 0.62478826
154 -1.34027574 0.02540747
155 0.69875239 -1.34027574
156 -0.45688894 0.69875239
157 NA -0.45688894
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.02835562 -0.46926005
[2,] 1.24093308 0.02835562
[3,] -0.60596117 1.24093308
[4,] 0.81251289 -0.60596117
[5,] -1.00658038 0.81251289
[6,] 0.41221080 -1.00658038
[7,] -0.09017352 0.41221080
[8,] -0.36139585 -0.09017352
[9,] 1.10196035 -0.36139585
[10,] -1.05114540 1.10196035
[11,] -0.72707906 -1.05114540
[12,] -1.72707906 -0.72707906
[13,] 0.94885460 -1.72707906
[14,] 0.95144335 0.94885460
[15,] -0.97459253 0.95144335
[16,] -0.59514659 -0.97459253
[17,] -0.34027574 -0.59514659
[18,] -0.78251182 -0.34027574
[19,] -0.62940607 -0.78251182
[20,] 0.37209730 -0.62940607
[21,] -0.78251182 0.37209730
[22,] -1.39824408 -0.78251182
[23,] -1.22210599 -1.39824408
[24,] 0.94885460 -1.22210599
[25,] 0.21748818 0.94885460
[26,] 0.02540747 0.21748818
[27,] 0.58317139 0.02540747
[28,] -1.05114540 0.58317139
[29,] 0.44714680 -1.05114540
[30,] 0.69875239 0.44714680
[31,] 1.63596224 0.69875239
[32,] 2.10196035 1.63596224
[33,] 0.94885460 2.10196035
[34,] 0.16210858 0.94885460
[35,] -0.01144075 0.16210858
[36,] -1.16672640 -0.01144075
[37,] 0.38844877 -1.16672640
[38,] 0.33306918 0.38844877
[39,] -0.28012750 0.33306918
[40,] -0.41682861 -0.28012750
[41,] -0.97459253 -0.41682861
[42,] -0.66434208 -0.97459253
[43,] 1.10196035 -0.66434208
[44,] 0.22013009 1.10196035
[45,] -1.05114540 0.22013009
[46,] 0.60175592 -1.05114540
[47,] 0.44865017 0.60175592
[48,] -0.53499835 0.44865017
[49,] 0.56272780 -0.53499835
[50,] -0.05114540 0.56272780
[51,] 1.10196035 -0.05114540
[52,] -0.07635763 1.10196035
[53,] 0.58058264 -0.07635763
[54,] 1.00905600 0.58058264
[55,] 0.37059393 1.00905600
[56,] 0.94885460 0.37059393
[57,] -0.33768699 0.94885460
[58,] -1.28484297 -0.33768699
[59,] -0.14555312 -1.28484297
[60,] 0.02540747 -0.14555312
[61,] 0.85444688 0.02540747
[62,] -0.82148678 0.85444688
[63,] 0.27550969 -0.82148678
[64,] 0.75739725 0.27550969
[65,] 0.77530526 0.75739725
[66,] 1.02540747 0.77530526
[67,] 0.02799622 1.02540747
[68,] 1.10196035 0.02799622
[69,] -1.22728349 1.10196035
[70,] 0.10196035 -1.22728349
[71,] -0.28012750 0.10196035
[72,] -0.79886329 -0.28012750
[73,] 0.33565792 -0.79886329
[74,] 1.33312234 0.33565792
[75,] -0.09017352 1.33312234
[76,] -0.29865887 -0.09017352
[77,] -1.22210599 -0.29865887
[78,] 0.44865017 -1.22210599
[79,] -0.02997212 0.44865017
[80,] -0.72707906 -0.02997212
[81,] -1.70595895 -0.72707906
[82,] -0.78251182 -1.70595895
[83,] -0.78245865 -0.78251182
[84,] -1.05114540 -0.78245865
[85,] 0.73627714 -1.05114540
[86,] 0.73886589 0.73627714
[87,] 0.21748818 0.73886589
[88,] -0.97459253 0.21748818
[89,] -1.55134983 -0.97459253
[90,] 1.10454910 -1.55134983
[91,] -0.65052618 1.10454910
[92,] -0.09276227 -0.65052618
[93,] -0.22210599 -0.09276227
[94,] 1.12458383 -0.22210599
[95,] 0.33312234 1.12458383
[96,] 0.77530526 0.33312234
[97,] -0.05114540 0.77530526
[98,] -0.85901153 -0.05114540
[99,] 0.94885460 -0.85901153
[100,] -0.09017352 0.94885460
[101,] 0.02540747 -0.09017352
[102,] 0.10196035 0.02540747
[103,] 0.41221080 0.10196035
[104,] -1.17185072 0.41221080
[105,] 0.02540747 -1.17185072
[106,] -1.01879814 0.02540747
[107,] -0.30124761 -1.01879814
[108,] -1.14555312 -0.30124761
[109,] -0.55352972 -1.14555312
[110,] -0.81998341 -0.55352972
[111,] 1.42602669 -0.81998341
[112,] 0.77525209 1.42602669
[113,] 2.35206256 0.77525209
[114,] 0.02540747 2.35206256
[115,] 1.44388153 0.02540747
[116,] 1.92105362 1.44388153
[117,] -0.01211728 1.92105362
[118,] -0.84266006 -0.01211728
[119,] 0.04393884 -0.84266006
[120,] -0.72707906 0.04393884
[121,] 0.38850194 -0.72707906
[122,] -1.26113411 0.38850194
[123,] -0.89803965 -1.26113411
[124,] -0.68805094 -0.89803965
[125,] 0.83327360 -0.68805094
[126,] 0.65972426 0.83327360
[127,] 1.02540747 0.65972426
[128,] 0.40962205 1.02540747
[129,] -0.53499835 0.40962205
[130,] -0.97459253 -0.53499835
[131,] 0.21748818 -0.97459253
[132,] -0.78251182 0.21748818
[133,] -0.89803965 -0.78251182
[134,] 0.21748818 -0.89803965
[135,] 0.09937160 0.21748818
[136,] -0.05114540 0.09937160
[137,] 0.02540747 -0.05114540
[138,] 0.27033219 0.02540747
[139,] -0.13437914 0.27033219
[140,] 0.37059393 -0.13437914
[141,] 1.15469803 0.37059393
[142,] -1.01362065 1.15469803
[143,] 0.89088626 -1.01362065
[144,] -0.70854769 0.89088626
[145,] 0.63601540 -0.70854769
[146,] -1.47956559 0.63601540
[147,] -1.05114540 -1.47956559
[148,] 1.19636807 -1.05114540
[149,] 1.18001659 1.19636807
[150,] 0.96738597 1.18001659
[151,] -0.80622068 0.96738597
[152,] 0.62478826 -0.80622068
[153,] 0.02540747 0.62478826
[154,] -1.34027574 0.02540747
[155,] 0.69875239 -1.34027574
[156,] -0.45688894 0.69875239
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.02835562 -0.46926005
2 1.24093308 0.02835562
3 -0.60596117 1.24093308
4 0.81251289 -0.60596117
5 -1.00658038 0.81251289
6 0.41221080 -1.00658038
7 -0.09017352 0.41221080
8 -0.36139585 -0.09017352
9 1.10196035 -0.36139585
10 -1.05114540 1.10196035
11 -0.72707906 -1.05114540
12 -1.72707906 -0.72707906
13 0.94885460 -1.72707906
14 0.95144335 0.94885460
15 -0.97459253 0.95144335
16 -0.59514659 -0.97459253
17 -0.34027574 -0.59514659
18 -0.78251182 -0.34027574
19 -0.62940607 -0.78251182
20 0.37209730 -0.62940607
21 -0.78251182 0.37209730
22 -1.39824408 -0.78251182
23 -1.22210599 -1.39824408
24 0.94885460 -1.22210599
25 0.21748818 0.94885460
26 0.02540747 0.21748818
27 0.58317139 0.02540747
28 -1.05114540 0.58317139
29 0.44714680 -1.05114540
30 0.69875239 0.44714680
31 1.63596224 0.69875239
32 2.10196035 1.63596224
33 0.94885460 2.10196035
34 0.16210858 0.94885460
35 -0.01144075 0.16210858
36 -1.16672640 -0.01144075
37 0.38844877 -1.16672640
38 0.33306918 0.38844877
39 -0.28012750 0.33306918
40 -0.41682861 -0.28012750
41 -0.97459253 -0.41682861
42 -0.66434208 -0.97459253
43 1.10196035 -0.66434208
44 0.22013009 1.10196035
45 -1.05114540 0.22013009
46 0.60175592 -1.05114540
47 0.44865017 0.60175592
48 -0.53499835 0.44865017
49 0.56272780 -0.53499835
50 -0.05114540 0.56272780
51 1.10196035 -0.05114540
52 -0.07635763 1.10196035
53 0.58058264 -0.07635763
54 1.00905600 0.58058264
55 0.37059393 1.00905600
56 0.94885460 0.37059393
57 -0.33768699 0.94885460
58 -1.28484297 -0.33768699
59 -0.14555312 -1.28484297
60 0.02540747 -0.14555312
61 0.85444688 0.02540747
62 -0.82148678 0.85444688
63 0.27550969 -0.82148678
64 0.75739725 0.27550969
65 0.77530526 0.75739725
66 1.02540747 0.77530526
67 0.02799622 1.02540747
68 1.10196035 0.02799622
69 -1.22728349 1.10196035
70 0.10196035 -1.22728349
71 -0.28012750 0.10196035
72 -0.79886329 -0.28012750
73 0.33565792 -0.79886329
74 1.33312234 0.33565792
75 -0.09017352 1.33312234
76 -0.29865887 -0.09017352
77 -1.22210599 -0.29865887
78 0.44865017 -1.22210599
79 -0.02997212 0.44865017
80 -0.72707906 -0.02997212
81 -1.70595895 -0.72707906
82 -0.78251182 -1.70595895
83 -0.78245865 -0.78251182
84 -1.05114540 -0.78245865
85 0.73627714 -1.05114540
86 0.73886589 0.73627714
87 0.21748818 0.73886589
88 -0.97459253 0.21748818
89 -1.55134983 -0.97459253
90 1.10454910 -1.55134983
91 -0.65052618 1.10454910
92 -0.09276227 -0.65052618
93 -0.22210599 -0.09276227
94 1.12458383 -0.22210599
95 0.33312234 1.12458383
96 0.77530526 0.33312234
97 -0.05114540 0.77530526
98 -0.85901153 -0.05114540
99 0.94885460 -0.85901153
100 -0.09017352 0.94885460
101 0.02540747 -0.09017352
102 0.10196035 0.02540747
103 0.41221080 0.10196035
104 -1.17185072 0.41221080
105 0.02540747 -1.17185072
106 -1.01879814 0.02540747
107 -0.30124761 -1.01879814
108 -1.14555312 -0.30124761
109 -0.55352972 -1.14555312
110 -0.81998341 -0.55352972
111 1.42602669 -0.81998341
112 0.77525209 1.42602669
113 2.35206256 0.77525209
114 0.02540747 2.35206256
115 1.44388153 0.02540747
116 1.92105362 1.44388153
117 -0.01211728 1.92105362
118 -0.84266006 -0.01211728
119 0.04393884 -0.84266006
120 -0.72707906 0.04393884
121 0.38850194 -0.72707906
122 -1.26113411 0.38850194
123 -0.89803965 -1.26113411
124 -0.68805094 -0.89803965
125 0.83327360 -0.68805094
126 0.65972426 0.83327360
127 1.02540747 0.65972426
128 0.40962205 1.02540747
129 -0.53499835 0.40962205
130 -0.97459253 -0.53499835
131 0.21748818 -0.97459253
132 -0.78251182 0.21748818
133 -0.89803965 -0.78251182
134 0.21748818 -0.89803965
135 0.09937160 0.21748818
136 -0.05114540 0.09937160
137 0.02540747 -0.05114540
138 0.27033219 0.02540747
139 -0.13437914 0.27033219
140 0.37059393 -0.13437914
141 1.15469803 0.37059393
142 -1.01362065 1.15469803
143 0.89088626 -1.01362065
144 -0.70854769 0.89088626
145 0.63601540 -0.70854769
146 -1.47956559 0.63601540
147 -1.05114540 -1.47956559
148 1.19636807 -1.05114540
149 1.18001659 1.19636807
150 0.96738597 1.18001659
151 -0.80622068 0.96738597
152 0.62478826 -0.80622068
153 0.02540747 0.62478826
154 -1.34027574 0.02540747
155 0.69875239 -1.34027574
156 -0.45688894 0.69875239
> 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/freestat/rcomp/tmp/7td421290528147.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/freestat/rcomp/tmp/8td421290528147.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/freestat/rcomp/tmp/9td421290528147.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/freestat/rcomp/tmp/1045m51290528147.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/11pn2t1290528147.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/freestat/rcomp/tmp/12t6ih1290528147.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/freestat/rcomp/tmp/137gz81290528147.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/freestat/rcomp/tmp/14syxe1290528147.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/freestat/rcomp/tmp/1537eg1290528147.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/freestat/rcomp/tmp/16hhc71290528147.tab")
+ }
> try(system("convert tmp/1x4pt1290528147.ps tmp/1x4pt1290528147.png",intern=TRUE))
character(0)
> try(system("convert tmp/28v6w1290528147.ps tmp/28v6w1290528147.png",intern=TRUE))
character(0)
> try(system("convert tmp/38v6w1290528147.ps tmp/38v6w1290528147.png",intern=TRUE))
character(0)
> try(system("convert tmp/48v6w1290528147.ps tmp/48v6w1290528147.png",intern=TRUE))
character(0)
> try(system("convert tmp/58v6w1290528147.ps tmp/58v6w1290528147.png",intern=TRUE))
character(0)
> try(system("convert tmp/6145h1290528147.ps tmp/6145h1290528147.png",intern=TRUE))
character(0)
> try(system("convert tmp/7td421290528147.ps tmp/7td421290528147.png",intern=TRUE))
character(0)
> try(system("convert tmp/8td421290528147.ps tmp/8td421290528147.png",intern=TRUE))
character(0)
> try(system("convert tmp/9td421290528147.ps tmp/9td421290528147.png",intern=TRUE))
character(0)
> try(system("convert tmp/1045m51290528147.ps tmp/1045m51290528147.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
5.726 2.705 16.479