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
+ ,5.5
+ ,6
+ ,5.33
+ ,12
+ ,9
+ ,3.5
+ ,4
+ ,5.56
+ ,11
+ ,9
+ ,8.5
+ ,4
+ ,3.78
+ ,14
+ ,9
+ ,5
+ ,4
+ ,4.00
+ ,12
+ ,9
+ ,6
+ ,4.5
+ ,4.00
+ ,21
+ ,9
+ ,6
+ ,3.5
+ ,3.56
+ ,12
+ ,9
+ ,5.5
+ ,2
+ ,4.44
+ ,22
+ ,9
+ ,5.5
+ ,5.5
+ ,3.56
+ ,11
+ ,9
+ ,6
+ ,3.5
+ ,4.00
+ ,10
+ ,9
+ ,6.5
+ ,3.5
+ ,3.78
+ ,13
+ ,9
+ ,7
+ ,6
+ ,5.11
+ ,10
+ ,9
+ ,8
+ ,5
+ ,6.67
+ ,8
+ ,9
+ ,5.5
+ ,5
+ ,5.11
+ ,15
+ ,9
+ ,5
+ ,4
+ ,4.00
+ ,14
+ ,9
+ ,5.5
+ ,4
+ ,3.33
+ ,10
+ ,9
+ ,7.5
+ ,2
+ ,2.67
+ ,14
+ ,9
+ ,4.5
+ ,4.5
+ ,4.67
+ ,14
+ ,9
+ ,5.5
+ ,4
+ ,3.33
+ ,11
+ ,9
+ ,8.5
+ ,3.5
+ ,4.44
+ ,10
+ ,9
+ ,8.5
+ ,5.5
+ ,6.89
+ ,13
+ ,9
+ ,5.5
+ ,4.5
+ ,6.00
+ ,7
+ ,9
+ ,9
+ ,5.5
+ ,7.56
+ ,14
+ ,9
+ ,7
+ ,6.5
+ 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,12
+ ,11
+ ,8.5
+ ,5.5
+ ,4.67
+ ,12
+ ,11
+ ,5.5
+ ,3
+ ,6.44
+ ,11
+ ,11
+ ,8.5
+ ,4.5
+ ,6.89
+ ,12
+ ,11
+ ,5.5
+ ,3.5
+ ,4.44
+ ,13
+ ,11
+ ,6
+ ,4.5
+ ,3.56
+ ,11
+ ,11
+ ,7
+ ,5
+ ,4.89
+ ,19
+ ,11
+ ,5.5
+ ,4.5
+ ,4.44
+ ,12
+ ,11
+ ,8
+ ,4
+ ,6.22
+ ,17
+ ,11
+ ,10.5
+ ,3.5
+ ,8.44
+ ,9
+ ,11
+ ,7
+ ,3
+ ,4.89
+ ,12
+ ,11
+ ,10
+ ,6.5
+ ,4.44
+ ,19
+ ,11
+ ,6.5
+ ,3
+ ,3.78
+ ,18
+ ,11
+ ,5.5
+ ,4
+ ,6.22
+ ,15
+ ,11
+ ,7.5
+ ,5
+ ,4.89
+ ,14
+ ,11
+ ,9.5
+ ,8
+ ,6.89
+ ,11)
+ ,dim=c(5
+ ,159)
+ ,dimnames=list(c('Month'
+ ,'Expect'
+ ,'Criticism'
+ ,'Concerns'
+ ,'Depression')
+ ,1:159))
> y <- array(NA,dim=c(5,159),dimnames=list(c('Month','Expect','Criticism','Concerns','Depression'),1:159))
> 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 = '5'
> #'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
Depression Month Expect Criticism Concerns
1 12 9 5.5 6.0 5.33
2 11 9 3.5 4.0 5.56
3 14 9 8.5 4.0 3.78
4 12 9 5.0 4.0 4.00
5 21 9 6.0 4.5 4.00
6 12 9 6.0 3.5 3.56
7 22 9 5.5 2.0 4.44
8 11 9 5.5 5.5 3.56
9 10 9 6.0 3.5 4.00
10 13 9 6.5 3.5 3.78
11 10 9 7.0 6.0 5.11
12 8 9 8.0 5.0 6.67
13 15 9 5.5 5.0 5.11
14 14 9 5.0 4.0 4.00
15 10 9 5.5 4.0 3.33
16 14 9 7.5 2.0 2.67
17 14 9 4.5 4.5 4.67
18 11 9 5.5 4.0 3.33
19 10 9 8.5 3.5 4.44
20 13 9 8.5 5.5 6.89
21 7 9 5.5 4.5 6.00
22 14 9 9.0 5.5 7.56
23 12 9 7.0 6.5 4.67
24 14 9 5.0 4.0 6.89
25 11 9 5.5 4.0 4.22
26 9 9 7.5 4.5 3.56
27 11 9 7.5 3.0 4.44
28 15 9 6.5 4.5 4.67
29 14 9 8.0 4.5 4.89
30 13 9 6.5 3.0 3.78
31 9 9 4.5 3.0 5.33
32 15 9 9.0 8.0 5.56
33 10 9 9.0 2.5 5.78
34 11 9 6.0 3.5 5.56
35 13 9 8.5 4.5 3.78
36 8 9 4.5 3.0 7.11
37 20 9 4.5 3.0 7.33
38 12 9 6.0 2.5 2.89
39 10 9 9.0 6.0 7.11
40 10 9 6.0 3.5 5.56
41 9 9 9.0 5.0 6.44
42 14 9 7.0 4.5 4.89
43 8 9 7.5 4.0 4.00
44 14 9 8.0 2.5 3.78
45 11 9 5.0 4.0 4.44
46 13 9 5.5 4.0 3.33
47 9 9 7.0 5.0 4.44
48 11 9 4.5 3.0 7.33
49 15 9 6.0 4.0 6.44
50 11 9 8.5 3.5 5.11
51 10 9 2.5 2.0 5.78
52 14 9 6.0 4.0 4.00
53 18 9 6.0 4.0 4.44
54 14 10 3.0 2.0 2.44
55 11 10 12.0 10.0 6.22
56 12 10 6.0 4.0 5.78
57 13 10 6.0 4.0 4.89
58 9 10 7.0 3.0 3.78
59 10 10 3.5 2.0 2.67
60 15 10 6.5 4.0 3.11
61 20 10 6.0 4.5 3.78
62 12 10 6.5 3.0 4.67
63 12 10 7.0 3.5 4.22
64 14 10 4.0 4.5 4.00
65 13 10 5.5 2.5 2.22
66 11 10 4.5 2.5 6.44
67 17 10 5.5 4.0 6.89
68 12 10 6.5 4.0 4.22
69 13 10 5.0 3.0 2.00
70 14 10 5.5 4.0 4.44
71 13 10 6.0 3.5 6.22
72 15 10 4.5 3.5 4.22
73 13 10 7.5 4.5 6.67
74 10 10 9.0 5.5 6.44
75 11 10 7.5 3.0 5.78
76 19 10 6.0 4.0 5.11
77 13 10 6.5 3.0 2.89
78 17 10 7.0 4.5 4.67
79 13 10 5.0 4.0 4.22
80 9 10 6.5 3.0 6.22
81 11 10 6.5 5.0 5.11
82 10 10 5.5 4.0 4.00
83 9 10 6.5 4.0 4.67
84 12 10 8.0 5.0 4.44
85 12 10 4.0 2.5 5.11
86 13 10 8.0 3.5 4.67
87 13 10 5.5 2.5 4.67
88 12 10 4.5 4.0 3.33
89 15 10 8.0 7.0 6.22
90 22 10 6.0 3.5 4.22
91 13 10 7.0 4.0 5.78
92 15 10 4.0 3.0 2.22
93 13 10 4.5 2.5 3.56
94 15 10 7.5 3.0 4.89
95 10 10 5.5 5.0 4.22
96 11 10 10.5 6.0 6.89
97 16 10 7.0 4.5 6.89
98 11 10 9.0 6.0 6.44
99 11 10 6.0 3.5 4.22
100 10 10 6.5 4.0 4.89
101 10 10 7.5 5.0 5.11
102 16 10 6.0 3.0 3.33
103 12 10 9.5 5.0 4.44
104 11 10 7.5 5.0 4.00
105 16 10 5.5 5.0 5.11
106 19 10 5.5 2.5 5.56
107 11 10 5.0 3.5 4.67
108 16 10 6.5 5.0 5.33
109 15 11 7.5 5.5 5.56
110 24 11 6.0 3.0 3.78
111 14 11 6.0 3.5 2.89
112 15 11 8.0 6.0 6.22
113 11 11 4.5 5.5 4.67
114 15 11 9.0 5.5 5.56
115 12 11 4.0 5.5 2.00
116 10 11 6.5 2.5 3.56
117 14 11 8.5 4.0 4.22
118 13 11 4.5 3.0 3.78
119 9 11 7.5 4.5 5.56
120 15 11 4.0 2.0 4.44
121 15 11 3.5 2.0 6.44
122 14 11 6.0 3.5 3.11
123 11 11 7.0 5.5 4.89
124 8 11 3.0 3.0 3.33
125 11 11 4.0 3.5 4.22
126 11 11 8.5 4.0 4.44
127 8 11 5.0 2.0 3.33
128 10 11 5.5 4.0 4.44
129 11 11 7.0 4.5 4.00
130 13 11 5.5 4.0 7.33
131 11 11 6.5 5.5 4.89
132 20 11 6.0 4.0 3.56
133 10 11 5.5 2.5 3.78
134 15 11 4.5 2.0 3.56
135 12 11 6.0 4.0 4.67
136 14 11 10.0 5.0 5.78
137 23 11 6.0 3.0 4.00
138 14 11 6.5 4.5 4.00
139 16 11 6.0 4.5 3.78
140 11 11 6.0 6.5 4.89
141 12 11 4.5 4.5 6.67
142 10 11 7.5 5.0 6.67
143 14 11 12.0 10.0 5.33
144 12 11 3.5 2.5 4.67
145 12 11 8.5 5.5 4.67
146 11 11 5.5 3.0 6.44
147 12 11 8.5 4.5 6.89
148 13 11 5.5 3.5 4.44
149 11 11 6.0 4.5 3.56
150 19 11 7.0 5.0 4.89
151 12 11 5.5 4.5 4.44
152 17 11 8.0 4.0 6.22
153 9 11 10.5 3.5 8.44
154 12 11 7.0 3.0 4.89
155 19 11 10.0 6.5 4.44
156 18 11 6.5 3.0 3.78
157 15 11 5.5 4.0 6.22
158 14 11 7.5 5.0 4.89
159 11 11 9.5 8.0 6.89
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Month Expect Criticism Concerns
9.243556 0.493286 -0.002602 -0.055748 -0.214966
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-5.8294 -2.1679 -0.6782 1.5309 10.3257
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.243556 3.305874 2.796 0.00583 **
Month 0.493286 0.309080 1.596 0.11254
Expect -0.002602 0.183669 -0.014 0.98871
Criticism -0.055748 0.232612 -0.240 0.81091
Concerns -0.214966 0.210983 -1.019 0.30986
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 3.144 on 154 degrees of freedom
Multiple R-squared: 0.02605, Adjusted R-squared: 0.000749
F-statistic: 1.03 on 4 and 154 DF, p-value: 0.3939
> 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.98077164 0.03845672 0.01922836
[2,] 0.98769518 0.02460964 0.01230482
[3,] 0.97780161 0.04439678 0.02219839
[4,] 0.96356999 0.07286001 0.03643001
[5,] 0.95998434 0.08003132 0.04001566
[6,] 0.95457002 0.09085996 0.04542998
[7,] 0.92825245 0.14349510 0.07174755
[8,] 0.93566213 0.12867573 0.06433787
[9,] 0.91513091 0.16973818 0.08486909
[10,] 0.88139966 0.23720069 0.11860034
[11,] 0.85822843 0.28354313 0.14177157
[12,] 0.83905981 0.32188038 0.16094019
[13,] 0.81414015 0.37171969 0.18585985
[14,] 0.88537112 0.22925776 0.11462888
[15,] 0.87905136 0.24189728 0.12094864
[16,] 0.84758789 0.30482422 0.15241211
[17,] 0.80876711 0.38246578 0.19123289
[18,] 0.77585304 0.44829391 0.22414696
[19,] 0.77103776 0.45792448 0.22896224
[20,] 0.74410555 0.51178891 0.25589445
[21,] 0.72725128 0.54549744 0.27274872
[22,] 0.69023973 0.61952054 0.30976027
[23,] 0.63435344 0.73129313 0.36564656
[24,] 0.67944896 0.64110208 0.32055104
[25,] 0.69307077 0.61385847 0.30692923
[26,] 0.67300436 0.65399128 0.32699564
[27,] 0.62658721 0.74682558 0.37341279
[28,] 0.57081373 0.85837254 0.42918627
[29,] 0.58008305 0.83983389 0.41991695
[30,] 0.82678611 0.34642778 0.17321389
[31,] 0.79145992 0.41708016 0.20854008
[32,] 0.76316466 0.47367067 0.23683534
[33,] 0.74331705 0.51336590 0.25668295
[34,] 0.73184018 0.53631965 0.26815982
[35,] 0.69885887 0.60228227 0.30114113
[36,] 0.73717711 0.52564577 0.26282289
[37,] 0.70236960 0.59526080 0.29763040
[38,] 0.66765972 0.66468056 0.33234028
[39,] 0.61960489 0.76079022 0.38039511
[40,] 0.62415913 0.75168175 0.37584087
[41,] 0.58315295 0.83369410 0.41684705
[42,] 0.57033286 0.85933429 0.42966714
[43,] 0.53002577 0.93994846 0.46997423
[44,] 0.51848202 0.96303596 0.48151798
[45,] 0.47777771 0.95555543 0.52222229
[46,] 0.56877251 0.86245498 0.43122749
[47,] 0.51981592 0.96036816 0.48018408
[48,] 0.47625705 0.95251410 0.52374295
[49,] 0.42915448 0.85830896 0.57084552
[50,] 0.38196961 0.76393921 0.61803039
[51,] 0.40206097 0.80412193 0.59793903
[52,] 0.39479481 0.78958963 0.60520519
[53,] 0.37923591 0.75847182 0.62076409
[54,] 0.56724741 0.86550518 0.43275259
[55,] 0.52413413 0.95173174 0.47586587
[56,] 0.48150293 0.96300587 0.51849707
[57,] 0.43744827 0.87489654 0.56255173
[58,] 0.39302524 0.78605048 0.60697476
[59,] 0.35822968 0.71645935 0.64177032
[60,] 0.40638584 0.81277168 0.59361416
[61,] 0.36682762 0.73365524 0.63317238
[62,] 0.32590318 0.65180637 0.67409682
[63,] 0.28786549 0.57573098 0.71213451
[64,] 0.24947245 0.49894490 0.75052755
[65,] 0.22468739 0.44937477 0.77531261
[66,] 0.19179343 0.38358686 0.80820657
[67,] 0.17974894 0.35949788 0.82025106
[68,] 0.15974211 0.31948421 0.84025789
[69,] 0.24650743 0.49301486 0.75349257
[70,] 0.21300759 0.42601517 0.78699241
[71,] 0.23120219 0.46240439 0.76879781
[72,] 0.19818610 0.39637219 0.80181390
[73,] 0.21105638 0.42211276 0.78894362
[74,] 0.19050843 0.38101686 0.80949157
[75,] 0.19208519 0.38417038 0.80791481
[76,] 0.21370141 0.42740283 0.78629859
[77,] 0.18615217 0.37230435 0.81384783
[78,] 0.15981483 0.31962967 0.84018517
[79,] 0.13565405 0.27130810 0.86434595
[80,] 0.11275593 0.22551187 0.88724407
[81,] 0.09649274 0.19298548 0.90350726
[82,] 0.08864494 0.17728988 0.91135506
[83,] 0.27519074 0.55038149 0.72480926
[84,] 0.23758523 0.47517046 0.76241477
[85,] 0.20826411 0.41652822 0.79173589
[86,] 0.17666162 0.35332325 0.82333838
[87,] 0.15728896 0.31457793 0.84271104
[88,] 0.15447660 0.30895320 0.84552340
[89,] 0.13499530 0.26999060 0.86500470
[90,] 0.13955612 0.27911224 0.86044388
[91,] 0.12041402 0.24082803 0.87958598
[92,] 0.10962971 0.21925941 0.89037029
[93,] 0.11115866 0.22231732 0.88884134
[94,] 0.11579476 0.23158953 0.88420524
[95,] 0.10201804 0.20403609 0.89798196
[96,] 0.09556489 0.19112979 0.90443511
[97,] 0.10746280 0.21492560 0.89253720
[98,] 0.09413348 0.18826696 0.90586652
[99,] 0.12817094 0.25634187 0.87182906
[100,] 0.12740854 0.25481708 0.87259146
[101,] 0.11083656 0.22167312 0.88916344
[102,] 0.09570103 0.19140207 0.90429897
[103,] 0.41698275 0.83396550 0.58301725
[104,] 0.36942463 0.73884926 0.63057537
[105,] 0.34076766 0.68153531 0.65923234
[106,] 0.31843103 0.63686206 0.68156897
[107,] 0.28348452 0.56696904 0.71651548
[108,] 0.25580271 0.51160542 0.74419729
[109,] 0.28447194 0.56894389 0.71552806
[110,] 0.24145616 0.48291232 0.75854384
[111,] 0.20414972 0.40829943 0.79585028
[112,] 0.23211470 0.46422940 0.76788530
[113,] 0.20521856 0.41043711 0.79478144
[114,] 0.21033927 0.42067854 0.78966073
[115,] 0.17273256 0.34546513 0.82726744
[116,] 0.15452130 0.30904260 0.84547870
[117,] 0.21481487 0.42962973 0.78518513
[118,] 0.19269944 0.38539889 0.80730056
[119,] 0.19235188 0.38470375 0.80764812
[120,] 0.35004081 0.70008163 0.64995919
[121,] 0.37059897 0.74119794 0.62940103
[122,] 0.39682937 0.79365873 0.60317063
[123,] 0.37835972 0.75671944 0.62164028
[124,] 0.35158521 0.70317042 0.64841479
[125,] 0.43912155 0.87824310 0.56087845
[126,] 0.56341002 0.87317995 0.43658998
[127,] 0.50348374 0.99303252 0.49651626
[128,] 0.46846803 0.93693606 0.53153197
[129,] 0.40265859 0.80531717 0.59734141
[130,] 0.76845812 0.46308376 0.23154188
[131,] 0.70973084 0.58053831 0.29026916
[132,] 0.65310130 0.69379740 0.34689870
[133,] 0.61007188 0.77985623 0.38992812
[134,] 0.54630847 0.90738307 0.45369153
[135,] 0.49202708 0.98405417 0.50797292
[136,] 0.41813252 0.83626505 0.58186748
[137,] 0.33727677 0.67455355 0.66272323
[138,] 0.33035271 0.66070542 0.66964729
[139,] 0.24839722 0.49679443 0.75160278
[140,] 0.17501564 0.35003128 0.82498436
[141,] 0.12074728 0.24149456 0.87925272
[142,] 0.22532765 0.45065530 0.77467235
[143,] 0.25082176 0.50164353 0.74917824
[144,] 0.25702097 0.51404193 0.74297903
> postscript(file="/var/www/html/freestat/rcomp/tmp/1wipt1290471139.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/2orpw1290471139.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/3orpw1290471139.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/4orpw1290471139.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/5z1oz1290471139.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 = 159
Frequency = 1
1 2 3 4 5 6
-0.18856767 -1.25582536 1.37454613 -0.58726867 8.44320731 -0.70712540
7 8 9 10 11 12
9.39712160 -1.59693078 -2.61254051 0.34146808 -2.23195701 -3.94975635
13 14 15 16 17 18
2.70839206 1.41273133 -2.72999462 1.02183654 1.58333119 -1.72999462
19 20 21 22 23 24
-2.51145045 1.12671104 -5.12816242 2.27203906 -0.29866798 2.03398205
25 26 27 28 29 30
-1.53867519 -3.64747446 -1.54192643 2.58853533 1.63973088 0.31359417
31 32 33 34 35 36
-3.35841322 2.98147733 -2.27784327 -1.27719410 0.40242005 -3.97577437
37 38 39 40 41 42
8.07151808 -0.90690021 -1.79682157 -2.27719410 -2.99659638 1.63712881
43 44 45 46 47 48
-4.58076349 1.28962336 -1.49268378 0.27000538 -3.43173182 -0.92848192
49 50 51 52 53 54
2.93984958 -1.36742347 -2.32263064 1.41533340 5.50991829 0.46739875
55 56 57 58 59 60
-1.25062986 -0.69531412 0.11336645 -4.17839118 -3.48185812 1.73202863
61 62 63 64 65 66
6.90262849 -0.98837278 -1.05593238 0.94471680 -0.54551460 -1.64096164
67 68 69 70 71 72
4.54199671 -1.02935950 -0.56623417 1.01533087 0.37139685 1.93756245
73 74 75 76 77 78
0.52778232 -2.46200885 -1.74715885 6.16065889 -0.37101164 4.09654999
79 80 81 82 83 84
-0.03326260 -3.65517603 -1.78229225 -3.07925401 -3.93262496 -0.92241613
85 86 87 88 89 90
-0.92816699 0.04340423 -0.01884877 -1.22588307 2.57171838 8.94146555
91 92 93 94 95 96
0.30728795 1.47845620 -0.26006271 2.06152173 -2.97621374 -1.33349729
97 98 99 100 101 102
3.57377373 -1.43413493 -2.05853445 -2.88533252 -2.77969018 2.72227221
103 104 105 106 107 108
-0.91851302 -2.01830205 3.21510568 6.17247066 -1.96440198 3.26500020
109 110 111 112 113 114
1.85163190 10.32572038 0.16227486 2.02268417 -2.34749374 1.85553500
115 116 117 118 119 120
-1.92275305 -3.74814495 0.48255826 -0.67818273 -4.20411593 1.40664574
121 122 123 124 125 126
1.83527600 0.20956730 -2.29369612 -5.77882038 -2.55702497 -2.47014930
127 128 129 130 131 132
-5.82936406 -3.47795551 -2.54076337 0.14329522 -2.29499715 6.33417576
133 134 135 136 137 138
-3.70345457 1.21877700 -1.42721237 0.87755560 9.37301282 0.45793559
139 140 141 142 143 144
2.40934211 -2.24055036 -0.97331027 -2.93763014 1.06476433 -1.51733929
145 146 147 148 149 150
-1.33708546 -2.10377204 -0.91560955 -0.50582942 -2.63795033 5.67842997
151 152 153 154 155 156
-1.45008159 3.91118852 -3.63295648 -1.43306569 5.67312338 4.32702141
157 158 159
1.90468335 0.67973100 -1.71789008
> postscript(file="/var/www/html/freestat/rcomp/tmp/6z1oz1290471139.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 = 159
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.18856767 NA
1 -1.25582536 -0.18856767
2 1.37454613 -1.25582536
3 -0.58726867 1.37454613
4 8.44320731 -0.58726867
5 -0.70712540 8.44320731
6 9.39712160 -0.70712540
7 -1.59693078 9.39712160
8 -2.61254051 -1.59693078
9 0.34146808 -2.61254051
10 -2.23195701 0.34146808
11 -3.94975635 -2.23195701
12 2.70839206 -3.94975635
13 1.41273133 2.70839206
14 -2.72999462 1.41273133
15 1.02183654 -2.72999462
16 1.58333119 1.02183654
17 -1.72999462 1.58333119
18 -2.51145045 -1.72999462
19 1.12671104 -2.51145045
20 -5.12816242 1.12671104
21 2.27203906 -5.12816242
22 -0.29866798 2.27203906
23 2.03398205 -0.29866798
24 -1.53867519 2.03398205
25 -3.64747446 -1.53867519
26 -1.54192643 -3.64747446
27 2.58853533 -1.54192643
28 1.63973088 2.58853533
29 0.31359417 1.63973088
30 -3.35841322 0.31359417
31 2.98147733 -3.35841322
32 -2.27784327 2.98147733
33 -1.27719410 -2.27784327
34 0.40242005 -1.27719410
35 -3.97577437 0.40242005
36 8.07151808 -3.97577437
37 -0.90690021 8.07151808
38 -1.79682157 -0.90690021
39 -2.27719410 -1.79682157
40 -2.99659638 -2.27719410
41 1.63712881 -2.99659638
42 -4.58076349 1.63712881
43 1.28962336 -4.58076349
44 -1.49268378 1.28962336
45 0.27000538 -1.49268378
46 -3.43173182 0.27000538
47 -0.92848192 -3.43173182
48 2.93984958 -0.92848192
49 -1.36742347 2.93984958
50 -2.32263064 -1.36742347
51 1.41533340 -2.32263064
52 5.50991829 1.41533340
53 0.46739875 5.50991829
54 -1.25062986 0.46739875
55 -0.69531412 -1.25062986
56 0.11336645 -0.69531412
57 -4.17839118 0.11336645
58 -3.48185812 -4.17839118
59 1.73202863 -3.48185812
60 6.90262849 1.73202863
61 -0.98837278 6.90262849
62 -1.05593238 -0.98837278
63 0.94471680 -1.05593238
64 -0.54551460 0.94471680
65 -1.64096164 -0.54551460
66 4.54199671 -1.64096164
67 -1.02935950 4.54199671
68 -0.56623417 -1.02935950
69 1.01533087 -0.56623417
70 0.37139685 1.01533087
71 1.93756245 0.37139685
72 0.52778232 1.93756245
73 -2.46200885 0.52778232
74 -1.74715885 -2.46200885
75 6.16065889 -1.74715885
76 -0.37101164 6.16065889
77 4.09654999 -0.37101164
78 -0.03326260 4.09654999
79 -3.65517603 -0.03326260
80 -1.78229225 -3.65517603
81 -3.07925401 -1.78229225
82 -3.93262496 -3.07925401
83 -0.92241613 -3.93262496
84 -0.92816699 -0.92241613
85 0.04340423 -0.92816699
86 -0.01884877 0.04340423
87 -1.22588307 -0.01884877
88 2.57171838 -1.22588307
89 8.94146555 2.57171838
90 0.30728795 8.94146555
91 1.47845620 0.30728795
92 -0.26006271 1.47845620
93 2.06152173 -0.26006271
94 -2.97621374 2.06152173
95 -1.33349729 -2.97621374
96 3.57377373 -1.33349729
97 -1.43413493 3.57377373
98 -2.05853445 -1.43413493
99 -2.88533252 -2.05853445
100 -2.77969018 -2.88533252
101 2.72227221 -2.77969018
102 -0.91851302 2.72227221
103 -2.01830205 -0.91851302
104 3.21510568 -2.01830205
105 6.17247066 3.21510568
106 -1.96440198 6.17247066
107 3.26500020 -1.96440198
108 1.85163190 3.26500020
109 10.32572038 1.85163190
110 0.16227486 10.32572038
111 2.02268417 0.16227486
112 -2.34749374 2.02268417
113 1.85553500 -2.34749374
114 -1.92275305 1.85553500
115 -3.74814495 -1.92275305
116 0.48255826 -3.74814495
117 -0.67818273 0.48255826
118 -4.20411593 -0.67818273
119 1.40664574 -4.20411593
120 1.83527600 1.40664574
121 0.20956730 1.83527600
122 -2.29369612 0.20956730
123 -5.77882038 -2.29369612
124 -2.55702497 -5.77882038
125 -2.47014930 -2.55702497
126 -5.82936406 -2.47014930
127 -3.47795551 -5.82936406
128 -2.54076337 -3.47795551
129 0.14329522 -2.54076337
130 -2.29499715 0.14329522
131 6.33417576 -2.29499715
132 -3.70345457 6.33417576
133 1.21877700 -3.70345457
134 -1.42721237 1.21877700
135 0.87755560 -1.42721237
136 9.37301282 0.87755560
137 0.45793559 9.37301282
138 2.40934211 0.45793559
139 -2.24055036 2.40934211
140 -0.97331027 -2.24055036
141 -2.93763014 -0.97331027
142 1.06476433 -2.93763014
143 -1.51733929 1.06476433
144 -1.33708546 -1.51733929
145 -2.10377204 -1.33708546
146 -0.91560955 -2.10377204
147 -0.50582942 -0.91560955
148 -2.63795033 -0.50582942
149 5.67842997 -2.63795033
150 -1.45008159 5.67842997
151 3.91118852 -1.45008159
152 -3.63295648 3.91118852
153 -1.43306569 -3.63295648
154 5.67312338 -1.43306569
155 4.32702141 5.67312338
156 1.90468335 4.32702141
157 0.67973100 1.90468335
158 -1.71789008 0.67973100
159 NA -1.71789008
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.25582536 -0.18856767
[2,] 1.37454613 -1.25582536
[3,] -0.58726867 1.37454613
[4,] 8.44320731 -0.58726867
[5,] -0.70712540 8.44320731
[6,] 9.39712160 -0.70712540
[7,] -1.59693078 9.39712160
[8,] -2.61254051 -1.59693078
[9,] 0.34146808 -2.61254051
[10,] -2.23195701 0.34146808
[11,] -3.94975635 -2.23195701
[12,] 2.70839206 -3.94975635
[13,] 1.41273133 2.70839206
[14,] -2.72999462 1.41273133
[15,] 1.02183654 -2.72999462
[16,] 1.58333119 1.02183654
[17,] -1.72999462 1.58333119
[18,] -2.51145045 -1.72999462
[19,] 1.12671104 -2.51145045
[20,] -5.12816242 1.12671104
[21,] 2.27203906 -5.12816242
[22,] -0.29866798 2.27203906
[23,] 2.03398205 -0.29866798
[24,] -1.53867519 2.03398205
[25,] -3.64747446 -1.53867519
[26,] -1.54192643 -3.64747446
[27,] 2.58853533 -1.54192643
[28,] 1.63973088 2.58853533
[29,] 0.31359417 1.63973088
[30,] -3.35841322 0.31359417
[31,] 2.98147733 -3.35841322
[32,] -2.27784327 2.98147733
[33,] -1.27719410 -2.27784327
[34,] 0.40242005 -1.27719410
[35,] -3.97577437 0.40242005
[36,] 8.07151808 -3.97577437
[37,] -0.90690021 8.07151808
[38,] -1.79682157 -0.90690021
[39,] -2.27719410 -1.79682157
[40,] -2.99659638 -2.27719410
[41,] 1.63712881 -2.99659638
[42,] -4.58076349 1.63712881
[43,] 1.28962336 -4.58076349
[44,] -1.49268378 1.28962336
[45,] 0.27000538 -1.49268378
[46,] -3.43173182 0.27000538
[47,] -0.92848192 -3.43173182
[48,] 2.93984958 -0.92848192
[49,] -1.36742347 2.93984958
[50,] -2.32263064 -1.36742347
[51,] 1.41533340 -2.32263064
[52,] 5.50991829 1.41533340
[53,] 0.46739875 5.50991829
[54,] -1.25062986 0.46739875
[55,] -0.69531412 -1.25062986
[56,] 0.11336645 -0.69531412
[57,] -4.17839118 0.11336645
[58,] -3.48185812 -4.17839118
[59,] 1.73202863 -3.48185812
[60,] 6.90262849 1.73202863
[61,] -0.98837278 6.90262849
[62,] -1.05593238 -0.98837278
[63,] 0.94471680 -1.05593238
[64,] -0.54551460 0.94471680
[65,] -1.64096164 -0.54551460
[66,] 4.54199671 -1.64096164
[67,] -1.02935950 4.54199671
[68,] -0.56623417 -1.02935950
[69,] 1.01533087 -0.56623417
[70,] 0.37139685 1.01533087
[71,] 1.93756245 0.37139685
[72,] 0.52778232 1.93756245
[73,] -2.46200885 0.52778232
[74,] -1.74715885 -2.46200885
[75,] 6.16065889 -1.74715885
[76,] -0.37101164 6.16065889
[77,] 4.09654999 -0.37101164
[78,] -0.03326260 4.09654999
[79,] -3.65517603 -0.03326260
[80,] -1.78229225 -3.65517603
[81,] -3.07925401 -1.78229225
[82,] -3.93262496 -3.07925401
[83,] -0.92241613 -3.93262496
[84,] -0.92816699 -0.92241613
[85,] 0.04340423 -0.92816699
[86,] -0.01884877 0.04340423
[87,] -1.22588307 -0.01884877
[88,] 2.57171838 -1.22588307
[89,] 8.94146555 2.57171838
[90,] 0.30728795 8.94146555
[91,] 1.47845620 0.30728795
[92,] -0.26006271 1.47845620
[93,] 2.06152173 -0.26006271
[94,] -2.97621374 2.06152173
[95,] -1.33349729 -2.97621374
[96,] 3.57377373 -1.33349729
[97,] -1.43413493 3.57377373
[98,] -2.05853445 -1.43413493
[99,] -2.88533252 -2.05853445
[100,] -2.77969018 -2.88533252
[101,] 2.72227221 -2.77969018
[102,] -0.91851302 2.72227221
[103,] -2.01830205 -0.91851302
[104,] 3.21510568 -2.01830205
[105,] 6.17247066 3.21510568
[106,] -1.96440198 6.17247066
[107,] 3.26500020 -1.96440198
[108,] 1.85163190 3.26500020
[109,] 10.32572038 1.85163190
[110,] 0.16227486 10.32572038
[111,] 2.02268417 0.16227486
[112,] -2.34749374 2.02268417
[113,] 1.85553500 -2.34749374
[114,] -1.92275305 1.85553500
[115,] -3.74814495 -1.92275305
[116,] 0.48255826 -3.74814495
[117,] -0.67818273 0.48255826
[118,] -4.20411593 -0.67818273
[119,] 1.40664574 -4.20411593
[120,] 1.83527600 1.40664574
[121,] 0.20956730 1.83527600
[122,] -2.29369612 0.20956730
[123,] -5.77882038 -2.29369612
[124,] -2.55702497 -5.77882038
[125,] -2.47014930 -2.55702497
[126,] -5.82936406 -2.47014930
[127,] -3.47795551 -5.82936406
[128,] -2.54076337 -3.47795551
[129,] 0.14329522 -2.54076337
[130,] -2.29499715 0.14329522
[131,] 6.33417576 -2.29499715
[132,] -3.70345457 6.33417576
[133,] 1.21877700 -3.70345457
[134,] -1.42721237 1.21877700
[135,] 0.87755560 -1.42721237
[136,] 9.37301282 0.87755560
[137,] 0.45793559 9.37301282
[138,] 2.40934211 0.45793559
[139,] -2.24055036 2.40934211
[140,] -0.97331027 -2.24055036
[141,] -2.93763014 -0.97331027
[142,] 1.06476433 -2.93763014
[143,] -1.51733929 1.06476433
[144,] -1.33708546 -1.51733929
[145,] -2.10377204 -1.33708546
[146,] -0.91560955 -2.10377204
[147,] -0.50582942 -0.91560955
[148,] -2.63795033 -0.50582942
[149,] 5.67842997 -2.63795033
[150,] -1.45008159 5.67842997
[151,] 3.91118852 -1.45008159
[152,] -3.63295648 3.91118852
[153,] -1.43306569 -3.63295648
[154,] 5.67312338 -1.43306569
[155,] 4.32702141 5.67312338
[156,] 1.90468335 4.32702141
[157,] 0.67973100 1.90468335
[158,] -1.71789008 0.67973100
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.25582536 -0.18856767
2 1.37454613 -1.25582536
3 -0.58726867 1.37454613
4 8.44320731 -0.58726867
5 -0.70712540 8.44320731
6 9.39712160 -0.70712540
7 -1.59693078 9.39712160
8 -2.61254051 -1.59693078
9 0.34146808 -2.61254051
10 -2.23195701 0.34146808
11 -3.94975635 -2.23195701
12 2.70839206 -3.94975635
13 1.41273133 2.70839206
14 -2.72999462 1.41273133
15 1.02183654 -2.72999462
16 1.58333119 1.02183654
17 -1.72999462 1.58333119
18 -2.51145045 -1.72999462
19 1.12671104 -2.51145045
20 -5.12816242 1.12671104
21 2.27203906 -5.12816242
22 -0.29866798 2.27203906
23 2.03398205 -0.29866798
24 -1.53867519 2.03398205
25 -3.64747446 -1.53867519
26 -1.54192643 -3.64747446
27 2.58853533 -1.54192643
28 1.63973088 2.58853533
29 0.31359417 1.63973088
30 -3.35841322 0.31359417
31 2.98147733 -3.35841322
32 -2.27784327 2.98147733
33 -1.27719410 -2.27784327
34 0.40242005 -1.27719410
35 -3.97577437 0.40242005
36 8.07151808 -3.97577437
37 -0.90690021 8.07151808
38 -1.79682157 -0.90690021
39 -2.27719410 -1.79682157
40 -2.99659638 -2.27719410
41 1.63712881 -2.99659638
42 -4.58076349 1.63712881
43 1.28962336 -4.58076349
44 -1.49268378 1.28962336
45 0.27000538 -1.49268378
46 -3.43173182 0.27000538
47 -0.92848192 -3.43173182
48 2.93984958 -0.92848192
49 -1.36742347 2.93984958
50 -2.32263064 -1.36742347
51 1.41533340 -2.32263064
52 5.50991829 1.41533340
53 0.46739875 5.50991829
54 -1.25062986 0.46739875
55 -0.69531412 -1.25062986
56 0.11336645 -0.69531412
57 -4.17839118 0.11336645
58 -3.48185812 -4.17839118
59 1.73202863 -3.48185812
60 6.90262849 1.73202863
61 -0.98837278 6.90262849
62 -1.05593238 -0.98837278
63 0.94471680 -1.05593238
64 -0.54551460 0.94471680
65 -1.64096164 -0.54551460
66 4.54199671 -1.64096164
67 -1.02935950 4.54199671
68 -0.56623417 -1.02935950
69 1.01533087 -0.56623417
70 0.37139685 1.01533087
71 1.93756245 0.37139685
72 0.52778232 1.93756245
73 -2.46200885 0.52778232
74 -1.74715885 -2.46200885
75 6.16065889 -1.74715885
76 -0.37101164 6.16065889
77 4.09654999 -0.37101164
78 -0.03326260 4.09654999
79 -3.65517603 -0.03326260
80 -1.78229225 -3.65517603
81 -3.07925401 -1.78229225
82 -3.93262496 -3.07925401
83 -0.92241613 -3.93262496
84 -0.92816699 -0.92241613
85 0.04340423 -0.92816699
86 -0.01884877 0.04340423
87 -1.22588307 -0.01884877
88 2.57171838 -1.22588307
89 8.94146555 2.57171838
90 0.30728795 8.94146555
91 1.47845620 0.30728795
92 -0.26006271 1.47845620
93 2.06152173 -0.26006271
94 -2.97621374 2.06152173
95 -1.33349729 -2.97621374
96 3.57377373 -1.33349729
97 -1.43413493 3.57377373
98 -2.05853445 -1.43413493
99 -2.88533252 -2.05853445
100 -2.77969018 -2.88533252
101 2.72227221 -2.77969018
102 -0.91851302 2.72227221
103 -2.01830205 -0.91851302
104 3.21510568 -2.01830205
105 6.17247066 3.21510568
106 -1.96440198 6.17247066
107 3.26500020 -1.96440198
108 1.85163190 3.26500020
109 10.32572038 1.85163190
110 0.16227486 10.32572038
111 2.02268417 0.16227486
112 -2.34749374 2.02268417
113 1.85553500 -2.34749374
114 -1.92275305 1.85553500
115 -3.74814495 -1.92275305
116 0.48255826 -3.74814495
117 -0.67818273 0.48255826
118 -4.20411593 -0.67818273
119 1.40664574 -4.20411593
120 1.83527600 1.40664574
121 0.20956730 1.83527600
122 -2.29369612 0.20956730
123 -5.77882038 -2.29369612
124 -2.55702497 -5.77882038
125 -2.47014930 -2.55702497
126 -5.82936406 -2.47014930
127 -3.47795551 -5.82936406
128 -2.54076337 -3.47795551
129 0.14329522 -2.54076337
130 -2.29499715 0.14329522
131 6.33417576 -2.29499715
132 -3.70345457 6.33417576
133 1.21877700 -3.70345457
134 -1.42721237 1.21877700
135 0.87755560 -1.42721237
136 9.37301282 0.87755560
137 0.45793559 9.37301282
138 2.40934211 0.45793559
139 -2.24055036 2.40934211
140 -0.97331027 -2.24055036
141 -2.93763014 -0.97331027
142 1.06476433 -2.93763014
143 -1.51733929 1.06476433
144 -1.33708546 -1.51733929
145 -2.10377204 -1.33708546
146 -0.91560955 -2.10377204
147 -0.50582942 -0.91560955
148 -2.63795033 -0.50582942
149 5.67842997 -2.63795033
150 -1.45008159 5.67842997
151 3.91118852 -1.45008159
152 -3.63295648 3.91118852
153 -1.43306569 -3.63295648
154 5.67312338 -1.43306569
155 4.32702141 5.67312338
156 1.90468335 4.32702141
157 0.67973100 1.90468335
158 -1.71789008 0.67973100
> 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/7asnk1290471139.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/8asnk1290471139.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/92jn51290471139.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/102jn51290471139.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/11623t1290471139.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/12r2kg1290471139.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/13qdjn1290471140.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/1414i81290471140.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/15mnhe1290471140.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/160fx51290471140.tab")
+ }
>
> try(system("convert tmp/1wipt1290471139.ps tmp/1wipt1290471139.png",intern=TRUE))
character(0)
> try(system("convert tmp/2orpw1290471139.ps tmp/2orpw1290471139.png",intern=TRUE))
character(0)
> try(system("convert tmp/3orpw1290471139.ps tmp/3orpw1290471139.png",intern=TRUE))
character(0)
> try(system("convert tmp/4orpw1290471139.ps tmp/4orpw1290471139.png",intern=TRUE))
character(0)
> try(system("convert tmp/5z1oz1290471139.ps tmp/5z1oz1290471139.png",intern=TRUE))
character(0)
> try(system("convert tmp/6z1oz1290471139.ps tmp/6z1oz1290471139.png",intern=TRUE))
character(0)
> try(system("convert tmp/7asnk1290471139.ps tmp/7asnk1290471139.png",intern=TRUE))
character(0)
> try(system("convert tmp/8asnk1290471139.ps tmp/8asnk1290471139.png",intern=TRUE))
character(0)
> try(system("convert tmp/92jn51290471139.ps tmp/92jn51290471139.png",intern=TRUE))
character(0)
> try(system("convert tmp/102jn51290471139.ps tmp/102jn51290471139.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
5.521 2.614 5.863