R version 2.11.1 (2010-05-31)
Copyright (C) 2010 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(14
+ ,11
+ ,12
+ ,12
+ ,11
+ ,7
+ ,8
+ ,11
+ ,6
+ ,17
+ ,8
+ ,14
+ ,12
+ ,10
+ ,8
+ ,12
+ ,8
+ ,12
+ ,9
+ ,21
+ ,10
+ ,12
+ ,7
+ ,12
+ ,10
+ ,11
+ ,4
+ ,22
+ ,11
+ ,11
+ ,11
+ ,11
+ ,16
+ ,12
+ ,7
+ ,10
+ ,11
+ ,13
+ ,7
+ ,13
+ ,13
+ ,14
+ ,12
+ ,10
+ ,12
+ ,16
+ ,10
+ ,8
+ ,8
+ ,11
+ ,10
+ ,15
+ ,12
+ ,10
+ ,8
+ ,14
+ ,11
+ ,11
+ ,8
+ ,10
+ ,4
+ ,15
+ ,4
+ ,14
+ ,9
+ ,9
+ ,9
+ ,14
+ ,8
+ ,11
+ ,8
+ ,11
+ ,8
+ ,17
+ ,7
+ ,10
+ ,14
+ ,17
+ ,11
+ ,13
+ ,15
+ ,11
+ ,9
+ ,7
+ ,16
+ ,18
+ ,11
+ ,14
+ ,9
+ ,14
+ ,13
+ ,12
+ ,14
+ ,10
+ ,8
+ ,14
+ ,11
+ ,11
+ ,8
+ ,11
+ ,8
+ ,15
+ ,9
+ ,9
+ ,9
+ ,15
+ ,6
+ ,11
+ ,9
+ ,13
+ ,9
+ ,15
+ ,9
+ ,16
+ ,9
+ ,14
+ ,9
+ ,13
+ ,6
+ ,13
+ ,10
+ ,9
+ ,6
+ ,9
+ ,16
+ ,18
+ ,16
+ ,15
+ ,11
+ ,18
+ ,5
+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ames=list(c('Concerns'
+ ,'Expectations'
+ ,'Criticism'
+ ,'Depression')
+ ,1:162))
> y <- array(NA,dim=c(4,162),dimnames=list(c('Concerns','Expectations','Criticism','Depression'),1:162))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '4'
> #'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
> 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
Depression Concerns Expectations Criticism
1 12 14 11 12
2 11 11 7 8
3 14 6 17 8
4 12 12 10 8
5 21 8 12 9
6 12 10 12 7
7 22 10 11 4
8 11 11 11 11
9 10 16 12 7
10 13 11 13 7
11 10 13 14 12
12 8 12 16 10
13 15 8 11 10
14 14 12 10 8
15 10 11 11 8
16 14 4 15 4
17 14 9 9 9
18 11 8 11 8
19 10 8 17 7
20 13 14 17 11
21 7 15 11 9
22 14 16 18 11
23 12 9 14 13
24 14 14 10 8
25 11 11 11 8
26 9 8 15 9
27 11 9 15 6
28 15 9 13 9
29 14 9 16 9
30 13 9 13 6
31 9 10 9 6
32 15 16 18 16
33 10 11 18 5
34 11 8 12 7
35 13 9 17 9
36 8 16 9 6
37 20 11 9 6
38 12 16 12 5
39 10 12 18 12
40 10 12 12 7
41 9 14 18 10
42 14 9 14 9
43 8 10 15 8
44 14 9 16 5
45 11 10 10 8
46 13 12 11 8
47 9 14 14 10
48 11 14 9 6
49 15 10 12 8
50 11 14 17 7
51 10 16 5 4
52 14 9 12 8
53 18 10 12 8
54 14 6 6 4
55 11 8 24 20
56 12 13 12 8
57 13 10 12 8
58 9 8 14 6
59 10 7 7 4
60 15 15 13 8
61 20 9 12 9
62 12 10 13 6
63 12 12 14 7
64 14 13 8 9
65 13 10 11 5
66 11 11 9 5
67 17 8 11 8
68 12 9 13 8
69 13 13 10 6
70 14 11 11 8
71 13 8 12 7
72 15 9 9 7
73 13 9 15 9
74 10 15 18 11
75 11 9 15 6
76 19 10 12 8
77 13 14 13 6
78 17 12 14 9
79 13 12 10 8
80 9 11 13 6
81 11 14 13 10
82 10 6 11 8
83 9 12 13 8
84 12 8 16 10
85 12 14 8 5
86 13 11 16 7
87 13 10 11 5
88 12 14 9 8
89 15 12 16 14
90 22 10 12 7
91 13 14 14 8
92 15 5 8 6
93 13 11 9 5
94 15 10 15 6
95 10 9 11 10
96 11 10 21 12
97 16 16 14 9
98 11 13 18 12
99 11 9 12 7
100 10 10 13 8
101 10 10 15 10
102 16 7 12 6
103 12 9 19 10
104 11 8 15 10
105 16 14 11 10
106 19 14 11 5
107 11 8 10 7
108 16 9 13 10
109 15 14 15 11
110 24 14 12 6
111 14 8 12 7
112 15 8 16 12
113 11 8 9 11
114 15 7 18 11
115 12 6 8 11
116 10 8 13 5
117 14 6 17 8
118 13 11 9 6
119 9 14 15 9
120 15 11 8 4
121 15 11 7 4
122 14 11 12 7
123 11 14 14 11
124 8 8 6 6
125 11 20 8 7
126 11 11 17 8
127 8 8 10 4
128 10 11 11 8
129 11 10 14 9
130 13 14 11 8
131 11 11 13 11
132 20 9 12 8
133 10 9 11 5
134 15 8 9 4
135 12 10 12 8
136 14 13 20 10
137 23 13 12 6
138 14 12 13 9
139 16 8 12 9
140 11 13 12 13
141 12 14 9 9
142 10 12 15 10
143 14 14 24 20
144 12 15 7 5
145 12 13 17 11
146 11 16 11 6
147 12 9 17 9
148 13 9 11 7
149 11 9 12 9
150 19 8 14 10
151 12 7 11 9
152 17 16 16 8
153 9 11 21 7
154 12 9 14 6
155 19 11 20 13
156 18 9 13 6
157 15 14 11 8
158 14 13 15 10
159 11 16 19 16
160 14 9 18 16
161 11 11 12 12
162 6 7 8 11
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Concerns Expectations Criticism
13.79095 -0.05521 0.01746 -0.06857
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-6.7899 -1.9775 -0.6211 1.4677 11.1840
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 13.79095 1.35913 10.147 <2e-16 ***
Concerns -0.05521 0.09077 -0.608 0.544
Expectations 0.01746 0.08936 0.195 0.845
Criticism -0.06857 0.11230 -0.611 0.542
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.188 on 158 degrees of freedom
Multiple R-squared: 0.005704, Adjusted R-squared: -0.01317
F-statistic: 0.3022 on 3 and 158 DF, p-value: 0.8238
> 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.97465126 0.05069748 0.02534874
[2,] 0.94851288 0.10297424 0.05148712
[3,] 0.91471667 0.17056666 0.08528333
[4,] 0.86616092 0.26767815 0.13383908
[5,] 0.80193067 0.39613867 0.19806933
[6,] 0.77599973 0.44800054 0.22400027
[7,] 0.69763002 0.60473997 0.30236998
[8,] 0.61301139 0.77397722 0.38698861
[9,] 0.63955322 0.72089357 0.36044678
[10,] 0.70817863 0.58364274 0.29182137
[11,] 0.63869928 0.72260143 0.36130072
[12,] 0.65480382 0.69039236 0.34519618
[13,] 0.63094502 0.73810995 0.36905498
[14,] 0.66303665 0.67392671 0.33696335
[15,] 0.70570199 0.58859601 0.29429801
[16,] 0.75851170 0.48297661 0.24148830
[17,] 0.70155318 0.59689364 0.29844682
[18,] 0.65997221 0.68005557 0.34002779
[19,] 0.61830686 0.76338629 0.38169314
[20,] 0.64759413 0.70481175 0.35240587
[21,] 0.61590879 0.76818242 0.38409121
[22,] 0.58344386 0.83311227 0.41655614
[23,] 0.53437385 0.93125231 0.46562615
[24,] 0.47393975 0.94787949 0.52606025
[25,] 0.52494846 0.95010308 0.47505154
[26,] 0.56101693 0.87796613 0.43898307
[27,] 0.53504282 0.92991437 0.46495718
[28,] 0.49974555 0.99949111 0.50025445
[29,] 0.44250489 0.88500977 0.55749511
[30,] 0.44515633 0.89031266 0.55484367
[31,] 0.68769411 0.62461178 0.31230589
[32,] 0.64306447 0.71387105 0.35693553
[33,] 0.61316827 0.77366345 0.38683173
[34,] 0.58993988 0.82012025 0.41006012
[35,] 0.57356846 0.85286308 0.42643154
[36,] 0.52740835 0.94518329 0.47259165
[37,] 0.57962746 0.84074508 0.42037254
[38,] 0.53955125 0.92089749 0.46044875
[39,] 0.50612427 0.98775147 0.49387573
[40,] 0.45705924 0.91411848 0.54294076
[41,] 0.44758823 0.89517645 0.55241177
[42,] 0.40605097 0.81210195 0.59394903
[43,] 0.38210335 0.76420671 0.61789665
[44,] 0.34488482 0.68976964 0.65511518
[45,] 0.32115432 0.64230863 0.67884568
[46,] 0.28199949 0.56399897 0.71800051
[47,] 0.35955589 0.71911178 0.64044411
[48,] 0.31812312 0.63624625 0.68187688
[49,] 0.28375463 0.56750927 0.71624537
[50,] 0.24592598 0.49185197 0.75407402
[51,] 0.20923697 0.41847394 0.79076303
[52,] 0.23659701 0.47319401 0.76340299
[53,] 0.25124719 0.50249439 0.74875281
[54,] 0.25538666 0.51077333 0.74461334
[55,] 0.42968131 0.85936262 0.57031869
[56,] 0.38761452 0.77522904 0.61238548
[57,] 0.34703974 0.69407947 0.65296026
[58,] 0.31275937 0.62551874 0.68724063
[59,] 0.27290639 0.54581277 0.72709361
[60,] 0.24904572 0.49809144 0.75095428
[61,] 0.26629054 0.53258107 0.73370946
[62,] 0.23289698 0.46579397 0.76710302
[63,] 0.20099953 0.40199905 0.79900047
[64,] 0.17427192 0.34854384 0.82572808
[65,] 0.14614393 0.29228787 0.85385607
[66,] 0.12919825 0.25839650 0.87080175
[67,] 0.10641220 0.21282440 0.89358780
[68,] 0.09761406 0.19522813 0.90238594
[69,] 0.08673199 0.17346398 0.91326801
[70,] 0.15020970 0.30041941 0.84979030
[71,] 0.13024958 0.26049916 0.86975042
[72,] 0.15628108 0.31256215 0.84371892
[73,] 0.13044516 0.26089031 0.86955484
[74,] 0.14537159 0.29074318 0.85462841
[75,] 0.12658699 0.25317398 0.87341301
[76,] 0.13312070 0.26624140 0.86687930
[77,] 0.14503464 0.29006927 0.85496536
[78,] 0.12274027 0.24548054 0.87725973
[79,] 0.10360771 0.20721543 0.89639229
[80,] 0.08712754 0.17425508 0.91287246
[81,] 0.07085661 0.14171322 0.92914339
[82,] 0.05743974 0.11487947 0.94256026
[83,] 0.05335614 0.10671229 0.94664386
[84,] 0.21228206 0.42456413 0.78771794
[85,] 0.18476754 0.36953507 0.81523246
[86,] 0.16850549 0.33701099 0.83149451
[87,] 0.14129425 0.28258851 0.85870575
[88,] 0.12637024 0.25274049 0.87362976
[89,] 0.12244985 0.24489970 0.87755015
[90,] 0.10893709 0.21787418 0.89106291
[91,] 0.11381316 0.22762632 0.88618684
[92,] 0.10053099 0.20106199 0.89946901
[93,] 0.08942573 0.17885146 0.91057427
[94,] 0.08783644 0.17567288 0.91216356
[95,] 0.08531742 0.17063484 0.91468258
[96,] 0.08037208 0.16074416 0.91962792
[97,] 0.06744774 0.13489548 0.93255226
[98,] 0.05872803 0.11745605 0.94127197
[99,] 0.06034882 0.12069765 0.93965118
[100,] 0.10116125 0.20232250 0.89883875
[101,] 0.08898557 0.17797113 0.91101443
[102,] 0.08803005 0.17606009 0.91196995
[103,] 0.07885511 0.15771022 0.92114489
[104,] 0.44589710 0.89179420 0.55410290
[105,] 0.40169787 0.80339574 0.59830213
[106,] 0.37444088 0.74888175 0.62555912
[107,] 0.33794316 0.67588632 0.66205684
[108,] 0.30731092 0.61462185 0.69268908
[109,] 0.26947734 0.53895467 0.73052266
[110,] 0.27344292 0.54688584 0.72655708
[111,] 0.23395518 0.46791036 0.76604482
[112,] 0.19701516 0.39403033 0.80298484
[113,] 0.21807966 0.43615932 0.78192034
[114,] 0.19671934 0.39343868 0.80328066
[115,] 0.18172160 0.36344319 0.81827840
[116,] 0.15248355 0.30496710 0.84751645
[117,] 0.13015476 0.26030952 0.86984524
[118,] 0.14874580 0.29749161 0.85125420
[119,] 0.12471852 0.24943703 0.87528148
[120,] 0.11576332 0.23152663 0.88423668
[121,] 0.16592004 0.33184008 0.83407996
[122,] 0.15873383 0.31746767 0.84126617
[123,] 0.14240707 0.28481413 0.85759293
[124,] 0.11270223 0.22540446 0.88729777
[125,] 0.09398130 0.18796259 0.90601870
[126,] 0.19607695 0.39215390 0.80392305
[127,] 0.20496716 0.40993431 0.79503284
[128,] 0.17111210 0.34222419 0.82888790
[129,] 0.13901286 0.27802572 0.86098714
[130,] 0.11095138 0.22190276 0.88904862
[131,] 0.48818328 0.97636656 0.51181672
[132,] 0.42996546 0.85993093 0.57003454
[133,] 0.43555913 0.87111825 0.56444087
[134,] 0.37234997 0.74469995 0.62765003
[135,] 0.30749409 0.61498819 0.69250591
[136,] 0.29785303 0.59570605 0.70214697
[137,] 0.24034770 0.48069539 0.75965230
[138,] 0.18524649 0.37049298 0.81475351
[139,] 0.14734735 0.29469470 0.85265265
[140,] 0.12349418 0.24698835 0.87650582
[141,] 0.09539654 0.19079307 0.90460346
[142,] 0.06393226 0.12786453 0.93606774
[143,] 0.04568577 0.09137154 0.95431423
[144,] 0.10891074 0.21782148 0.89108926
[145,] 0.07048021 0.14096042 0.92951979
[146,] 0.05112364 0.10224729 0.94887636
[147,] 0.42019807 0.84039613 0.57980193
[148,] 0.84053407 0.31893187 0.15946593
[149,] 0.72918209 0.54163581 0.27081791
> postscript(file="/var/www/rcomp/tmp/1zq301290546294.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/rcomp/tmp/2rz2l1290546294.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/rcomp/tmp/3rz2l1290546294.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/rcomp/tmp/4rz2l1290546294.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/rcomp/tmp/5k91o1290546294.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 = 162
Frequency = 1
1 2 3 4 5 6
-0.387177951 -1.757259242 0.792078894 -0.754421456 8.058370893 -0.968336703
7 8 9 10 11 12
8.843417206 -1.621389902 -2.637049472 0.069418918 -2.494769241 -4.722038286
13 14 15 16 17 18
2.144398146 1.245578544 -2.827094911 0.442294306 1.165962183 -1.992738526
19 20 21 22 23 24
-3.166060366 0.439500210 -5.537668421 1.532470369 -0.647059058 1.356007621
25 26 27 28 29 30
-1.827094911 -3.994005859 -2.144496329 2.096126514 1.043749762 -0.109578495
31 32 33 34 35 36
-3.984528288 2.875312050 -3.155012340 -2.078765780 0.026290845 -4.653241057
37 38 39 40 41 42
7.070686251 -0.774186145 -2.619819448 -2.857907626 -3.646527044 1.078667597
43 44 45 46 47 48
-4.952145118 0.769476417 -1.864850532 0.228119627 -3.576691375 -1.763670134
49 50 51 52 53 54
2.100231633 -1.834773135 -2.720542061 1.045017095 5.100231633 0.709853638
55 56 57 58 59 60
-1.396884415 -0.734124752 0.100231633 -4.182251950 -3.252390741 2.358845408
61 62 63 64 65 66
7.113585431 -1.054363956 -0.892825461 1.404279254 -0.088014458 -1.997882085
67 68 69 70 71 72
4.007261474 -0.972441822 0.163656410 1.172905089 -0.078765780 2.028825510
73 74 75 76 77 78
0.061208679 -2.522744169 -2.144496329 6.100231633 0.166494197 4.244311212
79 80 81 82 83 84
0.245578544 -3.999149418 -1.559232458 -3.103167603 -3.806798207 -0.942896440
85 86 87 88 89 90
-0.814779553 0.017042167 -0.088014458 -0.626533461 2.552235059 9.031663297
91 92 93 94 95 96
0.286171953 1.756857938 0.002117915 1.910718209 -2.800387316 -1.782625277
97 98 99 100 101 102
3.465169366 -1.564604910 -2.023551241 -2.917227284 -2.815008446 2.797451346
103 104 105 106 107 108
-0.940058653 -1.925437523 3.475685377 6.132843695 -2.043847945 3.164694850
109 110 111 112 113 114
2.474418044 11.183953114 0.921234220 2.194240232 -1.752115683 2.035539523
115 116 117 118 119 120
-0.845085843 -3.233361369 0.792078894 0.070686251 -3.662718628 1.951008496
121 122 123 124 125 126
1.968467413 1.086877835 -1.508123039 -5.042580613 -1.346355650 -1.931848414
127 128 129 130 131 132
-5.249552954 -2.827094911 -1.866117865 0.338548704 -1.656307737 7.045017095
133 134 135 136 137 138
-3.143228997 1.767905963 -0.899768367 1.263340583 10.128738576 1.261770129
139 140 141 142 143 144
3.058370893 -1.391283070 -0.557965125 -2.704579369 1.934402815 -0.742106097
145 146 147 148 149 150
-0.615714329 -1.688158891 -0.973709155 -0.006092324 -1.886414569 6.092021394
151 152 153 154 155 156
-0.979384729 4.361683195 -4.070252419 -1.127037412 6.358616515 4.890421505
157 158 159 160 161 162
2.338548704 1.350635169 -1.142146867 1.488810281 -1.570280483 -6.789871305
> postscript(file="/var/www/rcomp/tmp/6k91o1290546294.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 = 162
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.387177951 NA
1 -1.757259242 -0.387177951
2 0.792078894 -1.757259242
3 -0.754421456 0.792078894
4 8.058370893 -0.754421456
5 -0.968336703 8.058370893
6 8.843417206 -0.968336703
7 -1.621389902 8.843417206
8 -2.637049472 -1.621389902
9 0.069418918 -2.637049472
10 -2.494769241 0.069418918
11 -4.722038286 -2.494769241
12 2.144398146 -4.722038286
13 1.245578544 2.144398146
14 -2.827094911 1.245578544
15 0.442294306 -2.827094911
16 1.165962183 0.442294306
17 -1.992738526 1.165962183
18 -3.166060366 -1.992738526
19 0.439500210 -3.166060366
20 -5.537668421 0.439500210
21 1.532470369 -5.537668421
22 -0.647059058 1.532470369
23 1.356007621 -0.647059058
24 -1.827094911 1.356007621
25 -3.994005859 -1.827094911
26 -2.144496329 -3.994005859
27 2.096126514 -2.144496329
28 1.043749762 2.096126514
29 -0.109578495 1.043749762
30 -3.984528288 -0.109578495
31 2.875312050 -3.984528288
32 -3.155012340 2.875312050
33 -2.078765780 -3.155012340
34 0.026290845 -2.078765780
35 -4.653241057 0.026290845
36 7.070686251 -4.653241057
37 -0.774186145 7.070686251
38 -2.619819448 -0.774186145
39 -2.857907626 -2.619819448
40 -3.646527044 -2.857907626
41 1.078667597 -3.646527044
42 -4.952145118 1.078667597
43 0.769476417 -4.952145118
44 -1.864850532 0.769476417
45 0.228119627 -1.864850532
46 -3.576691375 0.228119627
47 -1.763670134 -3.576691375
48 2.100231633 -1.763670134
49 -1.834773135 2.100231633
50 -2.720542061 -1.834773135
51 1.045017095 -2.720542061
52 5.100231633 1.045017095
53 0.709853638 5.100231633
54 -1.396884415 0.709853638
55 -0.734124752 -1.396884415
56 0.100231633 -0.734124752
57 -4.182251950 0.100231633
58 -3.252390741 -4.182251950
59 2.358845408 -3.252390741
60 7.113585431 2.358845408
61 -1.054363956 7.113585431
62 -0.892825461 -1.054363956
63 1.404279254 -0.892825461
64 -0.088014458 1.404279254
65 -1.997882085 -0.088014458
66 4.007261474 -1.997882085
67 -0.972441822 4.007261474
68 0.163656410 -0.972441822
69 1.172905089 0.163656410
70 -0.078765780 1.172905089
71 2.028825510 -0.078765780
72 0.061208679 2.028825510
73 -2.522744169 0.061208679
74 -2.144496329 -2.522744169
75 6.100231633 -2.144496329
76 0.166494197 6.100231633
77 4.244311212 0.166494197
78 0.245578544 4.244311212
79 -3.999149418 0.245578544
80 -1.559232458 -3.999149418
81 -3.103167603 -1.559232458
82 -3.806798207 -3.103167603
83 -0.942896440 -3.806798207
84 -0.814779553 -0.942896440
85 0.017042167 -0.814779553
86 -0.088014458 0.017042167
87 -0.626533461 -0.088014458
88 2.552235059 -0.626533461
89 9.031663297 2.552235059
90 0.286171953 9.031663297
91 1.756857938 0.286171953
92 0.002117915 1.756857938
93 1.910718209 0.002117915
94 -2.800387316 1.910718209
95 -1.782625277 -2.800387316
96 3.465169366 -1.782625277
97 -1.564604910 3.465169366
98 -2.023551241 -1.564604910
99 -2.917227284 -2.023551241
100 -2.815008446 -2.917227284
101 2.797451346 -2.815008446
102 -0.940058653 2.797451346
103 -1.925437523 -0.940058653
104 3.475685377 -1.925437523
105 6.132843695 3.475685377
106 -2.043847945 6.132843695
107 3.164694850 -2.043847945
108 2.474418044 3.164694850
109 11.183953114 2.474418044
110 0.921234220 11.183953114
111 2.194240232 0.921234220
112 -1.752115683 2.194240232
113 2.035539523 -1.752115683
114 -0.845085843 2.035539523
115 -3.233361369 -0.845085843
116 0.792078894 -3.233361369
117 0.070686251 0.792078894
118 -3.662718628 0.070686251
119 1.951008496 -3.662718628
120 1.968467413 1.951008496
121 1.086877835 1.968467413
122 -1.508123039 1.086877835
123 -5.042580613 -1.508123039
124 -1.346355650 -5.042580613
125 -1.931848414 -1.346355650
126 -5.249552954 -1.931848414
127 -2.827094911 -5.249552954
128 -1.866117865 -2.827094911
129 0.338548704 -1.866117865
130 -1.656307737 0.338548704
131 7.045017095 -1.656307737
132 -3.143228997 7.045017095
133 1.767905963 -3.143228997
134 -0.899768367 1.767905963
135 1.263340583 -0.899768367
136 10.128738576 1.263340583
137 1.261770129 10.128738576
138 3.058370893 1.261770129
139 -1.391283070 3.058370893
140 -0.557965125 -1.391283070
141 -2.704579369 -0.557965125
142 1.934402815 -2.704579369
143 -0.742106097 1.934402815
144 -0.615714329 -0.742106097
145 -1.688158891 -0.615714329
146 -0.973709155 -1.688158891
147 -0.006092324 -0.973709155
148 -1.886414569 -0.006092324
149 6.092021394 -1.886414569
150 -0.979384729 6.092021394
151 4.361683195 -0.979384729
152 -4.070252419 4.361683195
153 -1.127037412 -4.070252419
154 6.358616515 -1.127037412
155 4.890421505 6.358616515
156 2.338548704 4.890421505
157 1.350635169 2.338548704
158 -1.142146867 1.350635169
159 1.488810281 -1.142146867
160 -1.570280483 1.488810281
161 -6.789871305 -1.570280483
162 NA -6.789871305
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.757259242 -0.387177951
[2,] 0.792078894 -1.757259242
[3,] -0.754421456 0.792078894
[4,] 8.058370893 -0.754421456
[5,] -0.968336703 8.058370893
[6,] 8.843417206 -0.968336703
[7,] -1.621389902 8.843417206
[8,] -2.637049472 -1.621389902
[9,] 0.069418918 -2.637049472
[10,] -2.494769241 0.069418918
[11,] -4.722038286 -2.494769241
[12,] 2.144398146 -4.722038286
[13,] 1.245578544 2.144398146
[14,] -2.827094911 1.245578544
[15,] 0.442294306 -2.827094911
[16,] 1.165962183 0.442294306
[17,] -1.992738526 1.165962183
[18,] -3.166060366 -1.992738526
[19,] 0.439500210 -3.166060366
[20,] -5.537668421 0.439500210
[21,] 1.532470369 -5.537668421
[22,] -0.647059058 1.532470369
[23,] 1.356007621 -0.647059058
[24,] -1.827094911 1.356007621
[25,] -3.994005859 -1.827094911
[26,] -2.144496329 -3.994005859
[27,] 2.096126514 -2.144496329
[28,] 1.043749762 2.096126514
[29,] -0.109578495 1.043749762
[30,] -3.984528288 -0.109578495
[31,] 2.875312050 -3.984528288
[32,] -3.155012340 2.875312050
[33,] -2.078765780 -3.155012340
[34,] 0.026290845 -2.078765780
[35,] -4.653241057 0.026290845
[36,] 7.070686251 -4.653241057
[37,] -0.774186145 7.070686251
[38,] -2.619819448 -0.774186145
[39,] -2.857907626 -2.619819448
[40,] -3.646527044 -2.857907626
[41,] 1.078667597 -3.646527044
[42,] -4.952145118 1.078667597
[43,] 0.769476417 -4.952145118
[44,] -1.864850532 0.769476417
[45,] 0.228119627 -1.864850532
[46,] -3.576691375 0.228119627
[47,] -1.763670134 -3.576691375
[48,] 2.100231633 -1.763670134
[49,] -1.834773135 2.100231633
[50,] -2.720542061 -1.834773135
[51,] 1.045017095 -2.720542061
[52,] 5.100231633 1.045017095
[53,] 0.709853638 5.100231633
[54,] -1.396884415 0.709853638
[55,] -0.734124752 -1.396884415
[56,] 0.100231633 -0.734124752
[57,] -4.182251950 0.100231633
[58,] -3.252390741 -4.182251950
[59,] 2.358845408 -3.252390741
[60,] 7.113585431 2.358845408
[61,] -1.054363956 7.113585431
[62,] -0.892825461 -1.054363956
[63,] 1.404279254 -0.892825461
[64,] -0.088014458 1.404279254
[65,] -1.997882085 -0.088014458
[66,] 4.007261474 -1.997882085
[67,] -0.972441822 4.007261474
[68,] 0.163656410 -0.972441822
[69,] 1.172905089 0.163656410
[70,] -0.078765780 1.172905089
[71,] 2.028825510 -0.078765780
[72,] 0.061208679 2.028825510
[73,] -2.522744169 0.061208679
[74,] -2.144496329 -2.522744169
[75,] 6.100231633 -2.144496329
[76,] 0.166494197 6.100231633
[77,] 4.244311212 0.166494197
[78,] 0.245578544 4.244311212
[79,] -3.999149418 0.245578544
[80,] -1.559232458 -3.999149418
[81,] -3.103167603 -1.559232458
[82,] -3.806798207 -3.103167603
[83,] -0.942896440 -3.806798207
[84,] -0.814779553 -0.942896440
[85,] 0.017042167 -0.814779553
[86,] -0.088014458 0.017042167
[87,] -0.626533461 -0.088014458
[88,] 2.552235059 -0.626533461
[89,] 9.031663297 2.552235059
[90,] 0.286171953 9.031663297
[91,] 1.756857938 0.286171953
[92,] 0.002117915 1.756857938
[93,] 1.910718209 0.002117915
[94,] -2.800387316 1.910718209
[95,] -1.782625277 -2.800387316
[96,] 3.465169366 -1.782625277
[97,] -1.564604910 3.465169366
[98,] -2.023551241 -1.564604910
[99,] -2.917227284 -2.023551241
[100,] -2.815008446 -2.917227284
[101,] 2.797451346 -2.815008446
[102,] -0.940058653 2.797451346
[103,] -1.925437523 -0.940058653
[104,] 3.475685377 -1.925437523
[105,] 6.132843695 3.475685377
[106,] -2.043847945 6.132843695
[107,] 3.164694850 -2.043847945
[108,] 2.474418044 3.164694850
[109,] 11.183953114 2.474418044
[110,] 0.921234220 11.183953114
[111,] 2.194240232 0.921234220
[112,] -1.752115683 2.194240232
[113,] 2.035539523 -1.752115683
[114,] -0.845085843 2.035539523
[115,] -3.233361369 -0.845085843
[116,] 0.792078894 -3.233361369
[117,] 0.070686251 0.792078894
[118,] -3.662718628 0.070686251
[119,] 1.951008496 -3.662718628
[120,] 1.968467413 1.951008496
[121,] 1.086877835 1.968467413
[122,] -1.508123039 1.086877835
[123,] -5.042580613 -1.508123039
[124,] -1.346355650 -5.042580613
[125,] -1.931848414 -1.346355650
[126,] -5.249552954 -1.931848414
[127,] -2.827094911 -5.249552954
[128,] -1.866117865 -2.827094911
[129,] 0.338548704 -1.866117865
[130,] -1.656307737 0.338548704
[131,] 7.045017095 -1.656307737
[132,] -3.143228997 7.045017095
[133,] 1.767905963 -3.143228997
[134,] -0.899768367 1.767905963
[135,] 1.263340583 -0.899768367
[136,] 10.128738576 1.263340583
[137,] 1.261770129 10.128738576
[138,] 3.058370893 1.261770129
[139,] -1.391283070 3.058370893
[140,] -0.557965125 -1.391283070
[141,] -2.704579369 -0.557965125
[142,] 1.934402815 -2.704579369
[143,] -0.742106097 1.934402815
[144,] -0.615714329 -0.742106097
[145,] -1.688158891 -0.615714329
[146,] -0.973709155 -1.688158891
[147,] -0.006092324 -0.973709155
[148,] -1.886414569 -0.006092324
[149,] 6.092021394 -1.886414569
[150,] -0.979384729 6.092021394
[151,] 4.361683195 -0.979384729
[152,] -4.070252419 4.361683195
[153,] -1.127037412 -4.070252419
[154,] 6.358616515 -1.127037412
[155,] 4.890421505 6.358616515
[156,] 2.338548704 4.890421505
[157,] 1.350635169 2.338548704
[158,] -1.142146867 1.350635169
[159,] 1.488810281 -1.142146867
[160,] -1.570280483 1.488810281
[161,] -6.789871305 -1.570280483
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.757259242 -0.387177951
2 0.792078894 -1.757259242
3 -0.754421456 0.792078894
4 8.058370893 -0.754421456
5 -0.968336703 8.058370893
6 8.843417206 -0.968336703
7 -1.621389902 8.843417206
8 -2.637049472 -1.621389902
9 0.069418918 -2.637049472
10 -2.494769241 0.069418918
11 -4.722038286 -2.494769241
12 2.144398146 -4.722038286
13 1.245578544 2.144398146
14 -2.827094911 1.245578544
15 0.442294306 -2.827094911
16 1.165962183 0.442294306
17 -1.992738526 1.165962183
18 -3.166060366 -1.992738526
19 0.439500210 -3.166060366
20 -5.537668421 0.439500210
21 1.532470369 -5.537668421
22 -0.647059058 1.532470369
23 1.356007621 -0.647059058
24 -1.827094911 1.356007621
25 -3.994005859 -1.827094911
26 -2.144496329 -3.994005859
27 2.096126514 -2.144496329
28 1.043749762 2.096126514
29 -0.109578495 1.043749762
30 -3.984528288 -0.109578495
31 2.875312050 -3.984528288
32 -3.155012340 2.875312050
33 -2.078765780 -3.155012340
34 0.026290845 -2.078765780
35 -4.653241057 0.026290845
36 7.070686251 -4.653241057
37 -0.774186145 7.070686251
38 -2.619819448 -0.774186145
39 -2.857907626 -2.619819448
40 -3.646527044 -2.857907626
41 1.078667597 -3.646527044
42 -4.952145118 1.078667597
43 0.769476417 -4.952145118
44 -1.864850532 0.769476417
45 0.228119627 -1.864850532
46 -3.576691375 0.228119627
47 -1.763670134 -3.576691375
48 2.100231633 -1.763670134
49 -1.834773135 2.100231633
50 -2.720542061 -1.834773135
51 1.045017095 -2.720542061
52 5.100231633 1.045017095
53 0.709853638 5.100231633
54 -1.396884415 0.709853638
55 -0.734124752 -1.396884415
56 0.100231633 -0.734124752
57 -4.182251950 0.100231633
58 -3.252390741 -4.182251950
59 2.358845408 -3.252390741
60 7.113585431 2.358845408
61 -1.054363956 7.113585431
62 -0.892825461 -1.054363956
63 1.404279254 -0.892825461
64 -0.088014458 1.404279254
65 -1.997882085 -0.088014458
66 4.007261474 -1.997882085
67 -0.972441822 4.007261474
68 0.163656410 -0.972441822
69 1.172905089 0.163656410
70 -0.078765780 1.172905089
71 2.028825510 -0.078765780
72 0.061208679 2.028825510
73 -2.522744169 0.061208679
74 -2.144496329 -2.522744169
75 6.100231633 -2.144496329
76 0.166494197 6.100231633
77 4.244311212 0.166494197
78 0.245578544 4.244311212
79 -3.999149418 0.245578544
80 -1.559232458 -3.999149418
81 -3.103167603 -1.559232458
82 -3.806798207 -3.103167603
83 -0.942896440 -3.806798207
84 -0.814779553 -0.942896440
85 0.017042167 -0.814779553
86 -0.088014458 0.017042167
87 -0.626533461 -0.088014458
88 2.552235059 -0.626533461
89 9.031663297 2.552235059
90 0.286171953 9.031663297
91 1.756857938 0.286171953
92 0.002117915 1.756857938
93 1.910718209 0.002117915
94 -2.800387316 1.910718209
95 -1.782625277 -2.800387316
96 3.465169366 -1.782625277
97 -1.564604910 3.465169366
98 -2.023551241 -1.564604910
99 -2.917227284 -2.023551241
100 -2.815008446 -2.917227284
101 2.797451346 -2.815008446
102 -0.940058653 2.797451346
103 -1.925437523 -0.940058653
104 3.475685377 -1.925437523
105 6.132843695 3.475685377
106 -2.043847945 6.132843695
107 3.164694850 -2.043847945
108 2.474418044 3.164694850
109 11.183953114 2.474418044
110 0.921234220 11.183953114
111 2.194240232 0.921234220
112 -1.752115683 2.194240232
113 2.035539523 -1.752115683
114 -0.845085843 2.035539523
115 -3.233361369 -0.845085843
116 0.792078894 -3.233361369
117 0.070686251 0.792078894
118 -3.662718628 0.070686251
119 1.951008496 -3.662718628
120 1.968467413 1.951008496
121 1.086877835 1.968467413
122 -1.508123039 1.086877835
123 -5.042580613 -1.508123039
124 -1.346355650 -5.042580613
125 -1.931848414 -1.346355650
126 -5.249552954 -1.931848414
127 -2.827094911 -5.249552954
128 -1.866117865 -2.827094911
129 0.338548704 -1.866117865
130 -1.656307737 0.338548704
131 7.045017095 -1.656307737
132 -3.143228997 7.045017095
133 1.767905963 -3.143228997
134 -0.899768367 1.767905963
135 1.263340583 -0.899768367
136 10.128738576 1.263340583
137 1.261770129 10.128738576
138 3.058370893 1.261770129
139 -1.391283070 3.058370893
140 -0.557965125 -1.391283070
141 -2.704579369 -0.557965125
142 1.934402815 -2.704579369
143 -0.742106097 1.934402815
144 -0.615714329 -0.742106097
145 -1.688158891 -0.615714329
146 -0.973709155 -1.688158891
147 -0.006092324 -0.973709155
148 -1.886414569 -0.006092324
149 6.092021394 -1.886414569
150 -0.979384729 6.092021394
151 4.361683195 -0.979384729
152 -4.070252419 4.361683195
153 -1.127037412 -4.070252419
154 6.358616515 -1.127037412
155 4.890421505 6.358616515
156 2.338548704 4.890421505
157 1.350635169 2.338548704
158 -1.142146867 1.350635169
159 1.488810281 -1.142146867
160 -1.570280483 1.488810281
161 -6.789871305 -1.570280483
> 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/rcomp/tmp/7d0191290546294.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/rcomp/tmp/8d0191290546294.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/rcomp/tmp/9590u1290546294.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/rcomp/tmp/10590u1290546294.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/rcomp/tmp/119ay01290546294.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/rcomp/tmp/12usfn1290546294.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/rcomp/tmp/13jbcz1290546294.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/rcomp/tmp/14b2bk1290546294.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/rcomp/tmp/15xls81290546294.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/rcomp/tmp/16tdpz1290546294.tab")
+ }
>
> try(system("convert tmp/1zq301290546294.ps tmp/1zq301290546294.png",intern=TRUE))
character(0)
> try(system("convert tmp/2rz2l1290546294.ps tmp/2rz2l1290546294.png",intern=TRUE))
character(0)
> try(system("convert tmp/3rz2l1290546294.ps tmp/3rz2l1290546294.png",intern=TRUE))
character(0)
> try(system("convert tmp/4rz2l1290546294.ps tmp/4rz2l1290546294.png",intern=TRUE))
character(0)
> try(system("convert tmp/5k91o1290546294.ps tmp/5k91o1290546294.png",intern=TRUE))
character(0)
> try(system("convert tmp/6k91o1290546294.ps tmp/6k91o1290546294.png",intern=TRUE))
character(0)
> try(system("convert tmp/7d0191290546294.ps tmp/7d0191290546294.png",intern=TRUE))
character(0)
> try(system("convert tmp/8d0191290546294.ps tmp/8d0191290546294.png",intern=TRUE))
character(0)
> try(system("convert tmp/9590u1290546294.ps tmp/9590u1290546294.png",intern=TRUE))
character(0)
> try(system("convert tmp/10590u1290546294.ps tmp/10590u1290546294.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
5.650 2.470 8.214