R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-pc-linux-gnu (32-bit)
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(2
+ ,7
+ ,14
+ ,2
+ ,5
+ ,18
+ ,2
+ ,5
+ ,11
+ ,1
+ ,5
+ ,12
+ ,2
+ ,8
+ ,16
+ ,2
+ ,6
+ ,18
+ ,2
+ ,5
+ ,14
+ ,2
+ ,6
+ ,14
+ ,2
+ ,5
+ ,15
+ ,2
+ ,4
+ ,15
+ ,1
+ ,6
+ ,17
+ ,2
+ ,5
+ ,19
+ ,1
+ ,5
+ ,10
+ ,2
+ ,6
+ ,16
+ ,2
+ ,7
+ ,18
+ ,1
+ ,6
+ ,14
+ ,1
+ ,7
+ ,14
+ ,2
+ ,6
+ ,17
+ ,1
+ ,8
+ ,14
+ ,2
+ ,7
+ ,16
+ ,1
+ ,5
+ ,18
+ ,2
+ ,5
+ ,11
+ ,2
+ ,7
+ ,14
+ ,2
+ ,7
+ ,12
+ ,1
+ ,5
+ ,17
+ ,2
+ ,4
+ ,9
+ ,1
+ ,10
+ ,16
+ ,2
+ ,6
+ ,14
+ ,2
+ ,5
+ ,15
+ ,1
+ ,5
+ ,11
+ ,2
+ ,5
+ ,16
+ ,1
+ ,5
+ ,13
+ ,2
+ ,6
+ ,17
+ ,2
+ ,5
+ ,15
+ ,1
+ ,5
+ ,14
+ ,1
+ ,5
+ ,16
+ ,1
+ ,5
+ ,9
+ ,1
+ ,5
+ ,15
+ ,2
+ ,5
+ ,17
+ ,1
+ ,5
+ ,13
+ ,1
+ ,5
+ ,15
+ ,2
+ ,7
+ ,16
+ ,1
+ ,5
+ ,16
+ ,1
+ ,6
+ ,12
+ ,2
+ ,7
+ ,12
+ ,2
+ ,7
+ ,11
+ ,2
+ ,5
+ ,15
+ ,2
+ ,5
+ ,15
+ ,2
+ ,4
+ ,17
+ ,1
+ ,5
+ ,13
+ ,2
+ ,4
+ ,16
+ ,1
+ ,5
+ ,14
+ ,1
+ ,5
+ ,11
+ ,2
+ ,7
+ ,12
+ ,1
+ ,5
+ ,12
+ ,2
+ ,5
+ ,15
+ ,2
+ ,6
+ ,16
+ ,2
+ ,4
+ ,15
+ ,1
+ ,6
+ ,12
+ ,2
+ ,6
+ ,12
+ ,1
+ ,5
+ ,8
+ ,1
+ ,7
+ ,13
+ ,2
+ ,6
+ ,11
+ ,2
+ ,8
+ ,14
+ ,2
+ ,7
+ ,15
+ ,1
+ ,5
+ ,10
+ ,2
+ ,6
+ ,11
+ ,1
+ ,6
+ ,12
+ ,2
+ ,5
+ ,15
+ ,1
+ ,5
+ ,15
+ ,1
+ ,5
+ ,14
+ ,2
+ ,5
+ ,16
+ ,2
+ ,4
+ ,15
+ ,1
+ ,6
+ ,15
+ ,1
+ ,6
+ ,13
+ ,2
+ ,6
+ ,12
+ ,2
+ ,6
+ ,17
+ ,2
+ ,7
+ ,13
+ ,1
+ ,5
+ ,15
+ ,1
+ ,7
+ ,13
+ ,1
+ ,6
+ ,15
+ ,1
+ ,5
+ ,16
+ ,2
+ ,5
+ ,15
+ ,1
+ ,4
+ ,16
+ ,2
+ ,8
+ ,15
+ ,2
+ ,8
+ ,14
+ ,1
+ ,5
+ ,15
+ ,2
+ ,5
+ ,14
+ ,2
+ ,6
+ ,13
+ ,2
+ ,4
+ ,7
+ ,2
+ ,5
+ ,17
+ ,2
+ ,5
+ ,13
+ ,2
+ ,5
+ ,15
+ ,2
+ ,5
+ ,14
+ ,2
+ ,6
+ ,13
+ ,2
+ ,6
+ ,16
+ ,2
+ ,5
+ ,12
+ ,2
+ ,6
+ ,14
+ ,1
+ ,5
+ ,17
+ ,1
+ ,7
+ ,15
+ ,2
+ ,5
+ ,17
+ ,1
+ ,6
+ ,12
+ ,2
+ ,6
+ ,16
+ ,1
+ ,6
+ ,11
+ ,2
+ ,4
+ ,15
+ ,1
+ ,5
+ ,9
+ ,2
+ ,5
+ ,16
+ ,1
+ ,7
+ ,15
+ ,1
+ ,6
+ ,10
+ ,2
+ ,9
+ ,10
+ ,2
+ ,6
+ ,15
+ ,2
+ ,6
+ ,11
+ ,2
+ ,5
+ ,13
+ ,1
+ ,6
+ ,14
+ ,2
+ ,5
+ ,18
+ ,1
+ ,8
+ ,16
+ ,2
+ ,7
+ ,14
+ ,2
+ ,5
+ ,14
+ ,2
+ ,7
+ ,14
+ ,2
+ ,6
+ ,14
+ ,2
+ ,6
+ ,12
+ ,2
+ ,9
+ ,14
+ ,2
+ ,7
+ ,15
+ ,2
+ ,6
+ ,15
+ ,2
+ ,5
+ ,15
+ ,2
+ ,5
+ ,13
+ ,1
+ ,6
+ ,17
+ ,2
+ ,6
+ ,17
+ ,2
+ ,7
+ ,19
+ ,2
+ ,5
+ ,15
+ ,1
+ ,5
+ ,13
+ ,1
+ ,5
+ ,9
+ ,2
+ ,6
+ ,15
+ ,1
+ ,4
+ ,15
+ ,1
+ ,5
+ ,15
+ ,2
+ ,7
+ ,16
+ ,1
+ ,5
+ ,11
+ ,1
+ ,7
+ ,14
+ ,2
+ ,7
+ ,11
+ ,2
+ ,6
+ ,15
+ ,1
+ ,5
+ ,13
+ ,2
+ ,8
+ ,15
+ ,1
+ ,5
+ ,16
+ ,2
+ ,5
+ ,14
+ ,1
+ ,5
+ ,15
+ ,2
+ ,6
+ ,16
+ ,2
+ ,4
+ ,16
+ ,1
+ ,5
+ ,11
+ ,1
+ ,5
+ ,12
+ ,1
+ ,7
+ ,9
+ ,2
+ ,6
+ ,16
+ ,2
+ ,7
+ ,13
+ ,1
+ ,10
+ ,16
+ ,2
+ ,6
+ ,12
+ ,2
+ ,8
+ ,9
+ ,2
+ ,4
+ ,13
+ ,2
+ ,5
+ ,13
+ ,2
+ ,6
+ ,14
+ ,2
+ ,7
+ ,19
+ ,2
+ ,7
+ ,13
+ ,2
+ ,6
+ ,12
+ ,2
+ ,6
+ ,13)
+ ,dim=c(3
+ ,162)
+ ,dimnames=list(c('Geslacht'
+ ,'Leeftijd'
+ ,'Happiness')
+ ,1:162))
> y <- array(NA,dim=c(3,162),dimnames=list(c('Geslacht','Leeftijd','Happiness'),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 = '3'
> #'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
Happiness Geslacht Leeftijd
1 14 2 7
2 18 2 5
3 11 2 5
4 12 1 5
5 16 2 8
6 18 2 6
7 14 2 5
8 14 2 6
9 15 2 5
10 15 2 4
11 17 1 6
12 19 2 5
13 10 1 5
14 16 2 6
15 18 2 7
16 14 1 6
17 14 1 7
18 17 2 6
19 14 1 8
20 16 2 7
21 18 1 5
22 11 2 5
23 14 2 7
24 12 2 7
25 17 1 5
26 9 2 4
27 16 1 10
28 14 2 6
29 15 2 5
30 11 1 5
31 16 2 5
32 13 1 5
33 17 2 6
34 15 2 5
35 14 1 5
36 16 1 5
37 9 1 5
38 15 1 5
39 17 2 5
40 13 1 5
41 15 1 5
42 16 2 7
43 16 1 5
44 12 1 6
45 12 2 7
46 11 2 7
47 15 2 5
48 15 2 5
49 17 2 4
50 13 1 5
51 16 2 4
52 14 1 5
53 11 1 5
54 12 2 7
55 12 1 5
56 15 2 5
57 16 2 6
58 15 2 4
59 12 1 6
60 12 2 6
61 8 1 5
62 13 1 7
63 11 2 6
64 14 2 8
65 15 2 7
66 10 1 5
67 11 2 6
68 12 1 6
69 15 2 5
70 15 1 5
71 14 1 5
72 16 2 5
73 15 2 4
74 15 1 6
75 13 1 6
76 12 2 6
77 17 2 6
78 13 2 7
79 15 1 5
80 13 1 7
81 15 1 6
82 16 1 5
83 15 2 5
84 16 1 4
85 15 2 8
86 14 2 8
87 15 1 5
88 14 2 5
89 13 2 6
90 7 2 4
91 17 2 5
92 13 2 5
93 15 2 5
94 14 2 5
95 13 2 6
96 16 2 6
97 12 2 5
98 14 2 6
99 17 1 5
100 15 1 7
101 17 2 5
102 12 1 6
103 16 2 6
104 11 1 6
105 15 2 4
106 9 1 5
107 16 2 5
108 15 1 7
109 10 1 6
110 10 2 9
111 15 2 6
112 11 2 6
113 13 2 5
114 14 1 6
115 18 2 5
116 16 1 8
117 14 2 7
118 14 2 5
119 14 2 7
120 14 2 6
121 12 2 6
122 14 2 9
123 15 2 7
124 15 2 6
125 15 2 5
126 13 2 5
127 17 1 6
128 17 2 6
129 19 2 7
130 15 2 5
131 13 1 5
132 9 1 5
133 15 2 6
134 15 1 4
135 15 1 5
136 16 2 7
137 11 1 5
138 14 1 7
139 11 2 7
140 15 2 6
141 13 1 5
142 15 2 8
143 16 1 5
144 14 2 5
145 15 1 5
146 16 2 6
147 16 2 4
148 11 1 5
149 12 1 5
150 9 1 7
151 16 2 6
152 13 2 7
153 16 1 10
154 12 2 6
155 9 2 8
156 13 2 4
157 13 2 5
158 14 2 6
159 19 2 7
160 13 2 7
161 12 2 6
162 13 2 6
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Geslacht Leeftijd
12.592724 0.873686 0.004477
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-7.358 -1.371 0.509 1.629 4.638
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 12.592724 1.072451 11.742 <2e-16 ***
Geslacht 0.873686 0.376259 2.322 0.0215 *
Leeftijd 0.004477 0.157565 0.028 0.9774
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.313 on 159 degrees of freedom
Multiple R-squared: 0.03307, Adjusted R-squared: 0.0209
F-statistic: 2.719 on 2 and 159 DF, p-value: 0.06903
> 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.90956219 0.1808756 0.09043781
[2,] 0.84265384 0.3146923 0.15734616
[3,] 0.76487888 0.4702422 0.23512112
[4,] 0.66137777 0.6772445 0.33862223
[5,] 0.55427850 0.8914430 0.44572150
[6,] 0.64703487 0.7059303 0.35296513
[7,] 0.78744612 0.4251078 0.21255388
[8,] 0.84602352 0.3079530 0.15397648
[9,] 0.79232933 0.4153413 0.20767067
[10,] 0.77531159 0.4493768 0.22468841
[11,] 0.71227339 0.5754532 0.28772661
[12,] 0.64038202 0.7192360 0.35961798
[13,] 0.59207592 0.8158482 0.40792408
[14,] 0.52029926 0.9594015 0.47970074
[15,] 0.45228481 0.9045696 0.54771519
[16,] 0.65850970 0.6829806 0.34149030
[17,] 0.77994487 0.4401103 0.22005513
[18,] 0.75458391 0.4908322 0.24541609
[19,] 0.80123664 0.3975267 0.19876336
[20,] 0.82224239 0.3555152 0.17775761
[21,] 0.93778683 0.1244263 0.06221317
[22,] 0.92511033 0.1497793 0.07488967
[23,] 0.90408341 0.1918332 0.09591659
[24,] 0.87776687 0.2444663 0.12223313
[25,] 0.88768307 0.2246339 0.11231693
[26,] 0.87056584 0.2588683 0.12943416
[27,] 0.84035459 0.3192908 0.15964541
[28,] 0.83486656 0.3302669 0.16513344
[29,] 0.79913453 0.4017309 0.20086547
[30,] 0.75892163 0.4821567 0.24107837
[31,] 0.75685070 0.4862986 0.24314930
[32,] 0.85951447 0.2809711 0.14048553
[33,] 0.84028025 0.3194395 0.15971975
[34,] 0.84220929 0.3155814 0.15779071
[35,] 0.81029239 0.3794152 0.18970761
[36,] 0.78703247 0.4259351 0.21296753
[37,] 0.75652778 0.4869444 0.24347222
[38,] 0.75755872 0.4848826 0.24244128
[39,] 0.74540277 0.5091945 0.25459723
[40,] 0.77567350 0.4486530 0.22432650
[41,] 0.83573472 0.3285306 0.16426528
[42,] 0.80456755 0.3908649 0.19543245
[43,] 0.77020880 0.4595824 0.22979120
[44,] 0.77771528 0.4445694 0.22228472
[45,] 0.74299516 0.5140097 0.25700484
[46,] 0.71970674 0.5605865 0.28029326
[47,] 0.67866359 0.6426728 0.32133641
[48,] 0.69012214 0.6197557 0.30987786
[49,] 0.70730001 0.5854000 0.29269999
[50,] 0.68440421 0.6311916 0.31559579
[51,] 0.64296672 0.7140666 0.35703328
[52,] 0.61468316 0.7706337 0.38531684
[53,] 0.57136846 0.8572631 0.42863154
[54,] 0.54730518 0.9053896 0.45269482
[55,] 0.55992402 0.8801520 0.44007598
[56,] 0.75081226 0.4983755 0.24918774
[57,] 0.71470714 0.5705857 0.28529286
[58,] 0.76296505 0.4740699 0.23703495
[59,] 0.72924585 0.5415083 0.27075415
[60,] 0.69209269 0.6158146 0.30790731
[61,] 0.73753553 0.5249289 0.26246447
[62,] 0.77986617 0.4402677 0.22013383
[63,] 0.75879670 0.4824066 0.24120330
[64,] 0.72417826 0.5516435 0.27582174
[65,] 0.70269628 0.5946074 0.29730372
[66,] 0.66439025 0.6712195 0.33560975
[67,] 0.64192328 0.7161534 0.35807672
[68,] 0.60168567 0.7966287 0.39831433
[69,] 0.57575940 0.8484812 0.42424060
[70,] 0.53280128 0.9343974 0.46719872
[71,] 0.53657672 0.9268466 0.46342328
[72,] 0.54722262 0.9055548 0.45277738
[73,] 0.51951291 0.9609742 0.48048709
[74,] 0.49326782 0.9865356 0.50673218
[75,] 0.45025879 0.9005176 0.54974121
[76,] 0.42379253 0.8475851 0.57620747
[77,] 0.43102520 0.8620504 0.56897480
[78,] 0.39042166 0.7808433 0.60957834
[79,] 0.39940285 0.7988057 0.60059715
[80,] 0.35898960 0.7179792 0.64101040
[81,] 0.31878384 0.6375677 0.68121616
[82,] 0.29697308 0.5939462 0.70302692
[83,] 0.26009870 0.5201974 0.73990130
[84,] 0.23651558 0.4730312 0.76348442
[85,] 0.61431127 0.7713775 0.38568873
[86,] 0.62678799 0.7464240 0.37321201
[87,] 0.59743335 0.8051333 0.40256665
[88,] 0.55583711 0.8883258 0.44416289
[89,] 0.51100355 0.9779929 0.48899645
[90,] 0.48039087 0.9607817 0.51960913
[91,] 0.45722256 0.9144451 0.54277744
[92,] 0.45772576 0.9154515 0.54227424
[93,] 0.41305987 0.8261197 0.58694013
[94,] 0.47697367 0.9539473 0.52302633
[95,] 0.45594654 0.9118931 0.54405346
[96,] 0.46952877 0.9390575 0.53047123
[97,] 0.43825603 0.8765121 0.56174397
[98,] 0.41582531 0.8316506 0.58417469
[99,] 0.41558439 0.8311688 0.58441561
[100,] 0.37406700 0.7481340 0.62593300
[101,] 0.49118716 0.9823743 0.50881284
[102,] 0.46905156 0.9381031 0.53094844
[103,] 0.44314444 0.8862889 0.55685556
[104,] 0.49932006 0.9986401 0.50067994
[105,] 0.61927009 0.7614598 0.38072991
[106,] 0.57603243 0.8479351 0.42396757
[107,] 0.62476387 0.7504723 0.37523613
[108,] 0.59131891 0.8173622 0.40868109
[109,] 0.54418256 0.9116349 0.45581744
[110,] 0.62369092 0.7526182 0.37630908
[111,] 0.62800199 0.7439960 0.37199801
[112,] 0.57942842 0.8411432 0.42057158
[113,] 0.52891399 0.9421720 0.47108601
[114,] 0.47812296 0.9562459 0.52187704
[115,] 0.42714737 0.8542947 0.57285263
[116,] 0.42593487 0.8518697 0.57406513
[117,] 0.37736859 0.7547372 0.62263141
[118,] 0.33056302 0.6611260 0.66943698
[119,] 0.28671107 0.5734221 0.71328893
[120,] 0.24647951 0.4929590 0.75352049
[121,] 0.21651234 0.4330247 0.78348766
[122,] 0.27829834 0.5565967 0.72170166
[123,] 0.29075570 0.5815114 0.70924430
[124,] 0.45736307 0.9147261 0.54263693
[125,] 0.40939479 0.8187896 0.59060521
[126,] 0.35413725 0.7082745 0.64586275
[127,] 0.48564451 0.9712890 0.51435549
[128,] 0.43619269 0.8723854 0.56380731
[129,] 0.40549782 0.8109956 0.59450218
[130,] 0.38228932 0.7645786 0.61771068
[131,] 0.36721245 0.7344249 0.63278755
[132,] 0.35857347 0.7171469 0.64142653
[133,] 0.30565152 0.6113030 0.69434848
[134,] 0.33510564 0.6702113 0.66489436
[135,] 0.28605375 0.5721075 0.71394625
[136,] 0.23063176 0.4612635 0.76936824
[137,] 0.19103966 0.3820793 0.80896034
[138,] 0.21629211 0.4325842 0.78370789
[139,] 0.16660285 0.3332057 0.83339715
[140,] 0.17623751 0.3524750 0.82376249
[141,] 0.16674849 0.3334970 0.83325151
[142,] 0.19033519 0.3806704 0.80966481
[143,] 0.14435996 0.2887199 0.85564004
[144,] 0.10523886 0.2104777 0.89476114
[145,] 0.23405915 0.4681183 0.76594085
[146,] 0.24453507 0.4890701 0.75546493
[147,] 0.17183374 0.3436675 0.82816626
[148,] 0.11411278 0.2282256 0.88588722
[149,] 0.07654575 0.1530915 0.92345425
[150,] 0.30839738 0.6167948 0.69160262
[151,] 0.23183255 0.4636651 0.76816745
> postscript(file="/var/wessaorg/rcomp/tmp/1l8ui1321714469.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/2p7k11321714469.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/3rzk11321714469.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/4h30t1321714469.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/53laq1321714469.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 162
Frequency = 1
1 2 3 4 5 6 7
-0.3714341 3.6375197 -3.3624803 -1.4887942 1.6240890 3.6330428 -0.3624803
8 9 10 11 12 13 14
-0.3669572 0.6375197 0.6419966 3.5067289 4.6375197 -3.4887942 1.6330428
15 16 17 18 19 20 21
3.6285659 0.5067289 0.5022520 2.6330428 0.4977751 1.6285659 4.5112058
22 23 24 25 26 27 28
-3.3624803 -0.3714341 -2.3714341 3.5112058 -5.3580034 2.4888213 -0.3669572
29 30 31 32 33 34 35
0.6375197 -2.4887942 1.6375197 -0.4887942 2.6330428 0.6375197 0.5112058
36 37 38 39 40 41 42
2.5112058 -4.4887942 1.5112058 2.6375197 -0.4887942 1.5112058 1.6285659
43 44 45 46 47 48 49
2.5112058 -1.4932711 -2.3714341 -3.3714341 0.6375197 0.6375197 2.6419966
50 51 52 53 54 55 56
-0.4887942 1.6419966 0.5112058 -2.4887942 -2.3714341 -1.4887942 0.6375197
57 58 59 60 61 62 63
1.6330428 0.6419966 -1.4932711 -2.3669572 -5.4887942 -0.4977480 -3.3669572
64 65 66 67 68 69 70
-0.3759110 0.6285659 -3.4887942 -3.3669572 -1.4932711 0.6375197 1.5112058
71 72 73 74 75 76 77
0.5112058 1.6375197 0.6419966 1.5067289 -0.4932711 -2.3669572 2.6330428
78 79 80 81 82 83 84
-1.3714341 1.5112058 -0.4977480 1.5067289 2.5112058 0.6375197 2.5156827
85 86 87 88 89 90 91
0.6240890 -0.3759110 1.5112058 -0.3624803 -1.3669572 -7.3580034 2.6375197
92 93 94 95 96 97 98
-1.3624803 0.6375197 -0.3624803 -1.3669572 1.6330428 -2.3624803 -0.3669572
99 100 101 102 103 104 105
3.5112058 1.5022520 2.6375197 -1.4932711 1.6330428 -2.4932711 0.6419966
106 107 108 109 110 111 112
-4.4887942 1.6375197 1.5022520 -3.4932711 -4.3803879 0.6330428 -3.3669572
113 114 115 116 117 118 119
-1.3624803 0.5067289 3.6375197 2.4977751 -0.3714341 -0.3624803 -0.3714341
120 121 122 123 124 125 126
-0.3669572 -2.3669572 -0.3803879 0.6285659 0.6330428 0.6375197 -1.3624803
127 128 129 130 131 132 133
3.5067289 2.6330428 4.6285659 0.6375197 -0.4887942 -4.4887942 0.6330428
134 135 136 137 138 139 140
1.5156827 1.5112058 1.6285659 -2.4887942 0.5022520 -3.3714341 0.6330428
141 142 143 144 145 146 147
-0.4887942 0.6240890 2.5112058 -0.3624803 1.5112058 1.6330428 1.6419966
148 149 150 151 152 153 154
-2.4887942 -1.4887942 -4.4977480 1.6330428 -1.3714341 2.4888213 -2.3669572
155 156 157 158 159 160 161
-5.3759110 -1.3580034 -1.3624803 -0.3669572 4.6285659 -1.3714341 -2.3669572
162
-1.3669572
> postscript(file="/var/wessaorg/rcomp/tmp/6ll951321714469.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 162
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.3714341 NA
1 3.6375197 -0.3714341
2 -3.3624803 3.6375197
3 -1.4887942 -3.3624803
4 1.6240890 -1.4887942
5 3.6330428 1.6240890
6 -0.3624803 3.6330428
7 -0.3669572 -0.3624803
8 0.6375197 -0.3669572
9 0.6419966 0.6375197
10 3.5067289 0.6419966
11 4.6375197 3.5067289
12 -3.4887942 4.6375197
13 1.6330428 -3.4887942
14 3.6285659 1.6330428
15 0.5067289 3.6285659
16 0.5022520 0.5067289
17 2.6330428 0.5022520
18 0.4977751 2.6330428
19 1.6285659 0.4977751
20 4.5112058 1.6285659
21 -3.3624803 4.5112058
22 -0.3714341 -3.3624803
23 -2.3714341 -0.3714341
24 3.5112058 -2.3714341
25 -5.3580034 3.5112058
26 2.4888213 -5.3580034
27 -0.3669572 2.4888213
28 0.6375197 -0.3669572
29 -2.4887942 0.6375197
30 1.6375197 -2.4887942
31 -0.4887942 1.6375197
32 2.6330428 -0.4887942
33 0.6375197 2.6330428
34 0.5112058 0.6375197
35 2.5112058 0.5112058
36 -4.4887942 2.5112058
37 1.5112058 -4.4887942
38 2.6375197 1.5112058
39 -0.4887942 2.6375197
40 1.5112058 -0.4887942
41 1.6285659 1.5112058
42 2.5112058 1.6285659
43 -1.4932711 2.5112058
44 -2.3714341 -1.4932711
45 -3.3714341 -2.3714341
46 0.6375197 -3.3714341
47 0.6375197 0.6375197
48 2.6419966 0.6375197
49 -0.4887942 2.6419966
50 1.6419966 -0.4887942
51 0.5112058 1.6419966
52 -2.4887942 0.5112058
53 -2.3714341 -2.4887942
54 -1.4887942 -2.3714341
55 0.6375197 -1.4887942
56 1.6330428 0.6375197
57 0.6419966 1.6330428
58 -1.4932711 0.6419966
59 -2.3669572 -1.4932711
60 -5.4887942 -2.3669572
61 -0.4977480 -5.4887942
62 -3.3669572 -0.4977480
63 -0.3759110 -3.3669572
64 0.6285659 -0.3759110
65 -3.4887942 0.6285659
66 -3.3669572 -3.4887942
67 -1.4932711 -3.3669572
68 0.6375197 -1.4932711
69 1.5112058 0.6375197
70 0.5112058 1.5112058
71 1.6375197 0.5112058
72 0.6419966 1.6375197
73 1.5067289 0.6419966
74 -0.4932711 1.5067289
75 -2.3669572 -0.4932711
76 2.6330428 -2.3669572
77 -1.3714341 2.6330428
78 1.5112058 -1.3714341
79 -0.4977480 1.5112058
80 1.5067289 -0.4977480
81 2.5112058 1.5067289
82 0.6375197 2.5112058
83 2.5156827 0.6375197
84 0.6240890 2.5156827
85 -0.3759110 0.6240890
86 1.5112058 -0.3759110
87 -0.3624803 1.5112058
88 -1.3669572 -0.3624803
89 -7.3580034 -1.3669572
90 2.6375197 -7.3580034
91 -1.3624803 2.6375197
92 0.6375197 -1.3624803
93 -0.3624803 0.6375197
94 -1.3669572 -0.3624803
95 1.6330428 -1.3669572
96 -2.3624803 1.6330428
97 -0.3669572 -2.3624803
98 3.5112058 -0.3669572
99 1.5022520 3.5112058
100 2.6375197 1.5022520
101 -1.4932711 2.6375197
102 1.6330428 -1.4932711
103 -2.4932711 1.6330428
104 0.6419966 -2.4932711
105 -4.4887942 0.6419966
106 1.6375197 -4.4887942
107 1.5022520 1.6375197
108 -3.4932711 1.5022520
109 -4.3803879 -3.4932711
110 0.6330428 -4.3803879
111 -3.3669572 0.6330428
112 -1.3624803 -3.3669572
113 0.5067289 -1.3624803
114 3.6375197 0.5067289
115 2.4977751 3.6375197
116 -0.3714341 2.4977751
117 -0.3624803 -0.3714341
118 -0.3714341 -0.3624803
119 -0.3669572 -0.3714341
120 -2.3669572 -0.3669572
121 -0.3803879 -2.3669572
122 0.6285659 -0.3803879
123 0.6330428 0.6285659
124 0.6375197 0.6330428
125 -1.3624803 0.6375197
126 3.5067289 -1.3624803
127 2.6330428 3.5067289
128 4.6285659 2.6330428
129 0.6375197 4.6285659
130 -0.4887942 0.6375197
131 -4.4887942 -0.4887942
132 0.6330428 -4.4887942
133 1.5156827 0.6330428
134 1.5112058 1.5156827
135 1.6285659 1.5112058
136 -2.4887942 1.6285659
137 0.5022520 -2.4887942
138 -3.3714341 0.5022520
139 0.6330428 -3.3714341
140 -0.4887942 0.6330428
141 0.6240890 -0.4887942
142 2.5112058 0.6240890
143 -0.3624803 2.5112058
144 1.5112058 -0.3624803
145 1.6330428 1.5112058
146 1.6419966 1.6330428
147 -2.4887942 1.6419966
148 -1.4887942 -2.4887942
149 -4.4977480 -1.4887942
150 1.6330428 -4.4977480
151 -1.3714341 1.6330428
152 2.4888213 -1.3714341
153 -2.3669572 2.4888213
154 -5.3759110 -2.3669572
155 -1.3580034 -5.3759110
156 -1.3624803 -1.3580034
157 -0.3669572 -1.3624803
158 4.6285659 -0.3669572
159 -1.3714341 4.6285659
160 -2.3669572 -1.3714341
161 -1.3669572 -2.3669572
162 NA -1.3669572
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 3.6375197 -0.3714341
[2,] -3.3624803 3.6375197
[3,] -1.4887942 -3.3624803
[4,] 1.6240890 -1.4887942
[5,] 3.6330428 1.6240890
[6,] -0.3624803 3.6330428
[7,] -0.3669572 -0.3624803
[8,] 0.6375197 -0.3669572
[9,] 0.6419966 0.6375197
[10,] 3.5067289 0.6419966
[11,] 4.6375197 3.5067289
[12,] -3.4887942 4.6375197
[13,] 1.6330428 -3.4887942
[14,] 3.6285659 1.6330428
[15,] 0.5067289 3.6285659
[16,] 0.5022520 0.5067289
[17,] 2.6330428 0.5022520
[18,] 0.4977751 2.6330428
[19,] 1.6285659 0.4977751
[20,] 4.5112058 1.6285659
[21,] -3.3624803 4.5112058
[22,] -0.3714341 -3.3624803
[23,] -2.3714341 -0.3714341
[24,] 3.5112058 -2.3714341
[25,] -5.3580034 3.5112058
[26,] 2.4888213 -5.3580034
[27,] -0.3669572 2.4888213
[28,] 0.6375197 -0.3669572
[29,] -2.4887942 0.6375197
[30,] 1.6375197 -2.4887942
[31,] -0.4887942 1.6375197
[32,] 2.6330428 -0.4887942
[33,] 0.6375197 2.6330428
[34,] 0.5112058 0.6375197
[35,] 2.5112058 0.5112058
[36,] -4.4887942 2.5112058
[37,] 1.5112058 -4.4887942
[38,] 2.6375197 1.5112058
[39,] -0.4887942 2.6375197
[40,] 1.5112058 -0.4887942
[41,] 1.6285659 1.5112058
[42,] 2.5112058 1.6285659
[43,] -1.4932711 2.5112058
[44,] -2.3714341 -1.4932711
[45,] -3.3714341 -2.3714341
[46,] 0.6375197 -3.3714341
[47,] 0.6375197 0.6375197
[48,] 2.6419966 0.6375197
[49,] -0.4887942 2.6419966
[50,] 1.6419966 -0.4887942
[51,] 0.5112058 1.6419966
[52,] -2.4887942 0.5112058
[53,] -2.3714341 -2.4887942
[54,] -1.4887942 -2.3714341
[55,] 0.6375197 -1.4887942
[56,] 1.6330428 0.6375197
[57,] 0.6419966 1.6330428
[58,] -1.4932711 0.6419966
[59,] -2.3669572 -1.4932711
[60,] -5.4887942 -2.3669572
[61,] -0.4977480 -5.4887942
[62,] -3.3669572 -0.4977480
[63,] -0.3759110 -3.3669572
[64,] 0.6285659 -0.3759110
[65,] -3.4887942 0.6285659
[66,] -3.3669572 -3.4887942
[67,] -1.4932711 -3.3669572
[68,] 0.6375197 -1.4932711
[69,] 1.5112058 0.6375197
[70,] 0.5112058 1.5112058
[71,] 1.6375197 0.5112058
[72,] 0.6419966 1.6375197
[73,] 1.5067289 0.6419966
[74,] -0.4932711 1.5067289
[75,] -2.3669572 -0.4932711
[76,] 2.6330428 -2.3669572
[77,] -1.3714341 2.6330428
[78,] 1.5112058 -1.3714341
[79,] -0.4977480 1.5112058
[80,] 1.5067289 -0.4977480
[81,] 2.5112058 1.5067289
[82,] 0.6375197 2.5112058
[83,] 2.5156827 0.6375197
[84,] 0.6240890 2.5156827
[85,] -0.3759110 0.6240890
[86,] 1.5112058 -0.3759110
[87,] -0.3624803 1.5112058
[88,] -1.3669572 -0.3624803
[89,] -7.3580034 -1.3669572
[90,] 2.6375197 -7.3580034
[91,] -1.3624803 2.6375197
[92,] 0.6375197 -1.3624803
[93,] -0.3624803 0.6375197
[94,] -1.3669572 -0.3624803
[95,] 1.6330428 -1.3669572
[96,] -2.3624803 1.6330428
[97,] -0.3669572 -2.3624803
[98,] 3.5112058 -0.3669572
[99,] 1.5022520 3.5112058
[100,] 2.6375197 1.5022520
[101,] -1.4932711 2.6375197
[102,] 1.6330428 -1.4932711
[103,] -2.4932711 1.6330428
[104,] 0.6419966 -2.4932711
[105,] -4.4887942 0.6419966
[106,] 1.6375197 -4.4887942
[107,] 1.5022520 1.6375197
[108,] -3.4932711 1.5022520
[109,] -4.3803879 -3.4932711
[110,] 0.6330428 -4.3803879
[111,] -3.3669572 0.6330428
[112,] -1.3624803 -3.3669572
[113,] 0.5067289 -1.3624803
[114,] 3.6375197 0.5067289
[115,] 2.4977751 3.6375197
[116,] -0.3714341 2.4977751
[117,] -0.3624803 -0.3714341
[118,] -0.3714341 -0.3624803
[119,] -0.3669572 -0.3714341
[120,] -2.3669572 -0.3669572
[121,] -0.3803879 -2.3669572
[122,] 0.6285659 -0.3803879
[123,] 0.6330428 0.6285659
[124,] 0.6375197 0.6330428
[125,] -1.3624803 0.6375197
[126,] 3.5067289 -1.3624803
[127,] 2.6330428 3.5067289
[128,] 4.6285659 2.6330428
[129,] 0.6375197 4.6285659
[130,] -0.4887942 0.6375197
[131,] -4.4887942 -0.4887942
[132,] 0.6330428 -4.4887942
[133,] 1.5156827 0.6330428
[134,] 1.5112058 1.5156827
[135,] 1.6285659 1.5112058
[136,] -2.4887942 1.6285659
[137,] 0.5022520 -2.4887942
[138,] -3.3714341 0.5022520
[139,] 0.6330428 -3.3714341
[140,] -0.4887942 0.6330428
[141,] 0.6240890 -0.4887942
[142,] 2.5112058 0.6240890
[143,] -0.3624803 2.5112058
[144,] 1.5112058 -0.3624803
[145,] 1.6330428 1.5112058
[146,] 1.6419966 1.6330428
[147,] -2.4887942 1.6419966
[148,] -1.4887942 -2.4887942
[149,] -4.4977480 -1.4887942
[150,] 1.6330428 -4.4977480
[151,] -1.3714341 1.6330428
[152,] 2.4888213 -1.3714341
[153,] -2.3669572 2.4888213
[154,] -5.3759110 -2.3669572
[155,] -1.3580034 -5.3759110
[156,] -1.3624803 -1.3580034
[157,] -0.3669572 -1.3624803
[158,] 4.6285659 -0.3669572
[159,] -1.3714341 4.6285659
[160,] -2.3669572 -1.3714341
[161,] -1.3669572 -2.3669572
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 3.6375197 -0.3714341
2 -3.3624803 3.6375197
3 -1.4887942 -3.3624803
4 1.6240890 -1.4887942
5 3.6330428 1.6240890
6 -0.3624803 3.6330428
7 -0.3669572 -0.3624803
8 0.6375197 -0.3669572
9 0.6419966 0.6375197
10 3.5067289 0.6419966
11 4.6375197 3.5067289
12 -3.4887942 4.6375197
13 1.6330428 -3.4887942
14 3.6285659 1.6330428
15 0.5067289 3.6285659
16 0.5022520 0.5067289
17 2.6330428 0.5022520
18 0.4977751 2.6330428
19 1.6285659 0.4977751
20 4.5112058 1.6285659
21 -3.3624803 4.5112058
22 -0.3714341 -3.3624803
23 -2.3714341 -0.3714341
24 3.5112058 -2.3714341
25 -5.3580034 3.5112058
26 2.4888213 -5.3580034
27 -0.3669572 2.4888213
28 0.6375197 -0.3669572
29 -2.4887942 0.6375197
30 1.6375197 -2.4887942
31 -0.4887942 1.6375197
32 2.6330428 -0.4887942
33 0.6375197 2.6330428
34 0.5112058 0.6375197
35 2.5112058 0.5112058
36 -4.4887942 2.5112058
37 1.5112058 -4.4887942
38 2.6375197 1.5112058
39 -0.4887942 2.6375197
40 1.5112058 -0.4887942
41 1.6285659 1.5112058
42 2.5112058 1.6285659
43 -1.4932711 2.5112058
44 -2.3714341 -1.4932711
45 -3.3714341 -2.3714341
46 0.6375197 -3.3714341
47 0.6375197 0.6375197
48 2.6419966 0.6375197
49 -0.4887942 2.6419966
50 1.6419966 -0.4887942
51 0.5112058 1.6419966
52 -2.4887942 0.5112058
53 -2.3714341 -2.4887942
54 -1.4887942 -2.3714341
55 0.6375197 -1.4887942
56 1.6330428 0.6375197
57 0.6419966 1.6330428
58 -1.4932711 0.6419966
59 -2.3669572 -1.4932711
60 -5.4887942 -2.3669572
61 -0.4977480 -5.4887942
62 -3.3669572 -0.4977480
63 -0.3759110 -3.3669572
64 0.6285659 -0.3759110
65 -3.4887942 0.6285659
66 -3.3669572 -3.4887942
67 -1.4932711 -3.3669572
68 0.6375197 -1.4932711
69 1.5112058 0.6375197
70 0.5112058 1.5112058
71 1.6375197 0.5112058
72 0.6419966 1.6375197
73 1.5067289 0.6419966
74 -0.4932711 1.5067289
75 -2.3669572 -0.4932711
76 2.6330428 -2.3669572
77 -1.3714341 2.6330428
78 1.5112058 -1.3714341
79 -0.4977480 1.5112058
80 1.5067289 -0.4977480
81 2.5112058 1.5067289
82 0.6375197 2.5112058
83 2.5156827 0.6375197
84 0.6240890 2.5156827
85 -0.3759110 0.6240890
86 1.5112058 -0.3759110
87 -0.3624803 1.5112058
88 -1.3669572 -0.3624803
89 -7.3580034 -1.3669572
90 2.6375197 -7.3580034
91 -1.3624803 2.6375197
92 0.6375197 -1.3624803
93 -0.3624803 0.6375197
94 -1.3669572 -0.3624803
95 1.6330428 -1.3669572
96 -2.3624803 1.6330428
97 -0.3669572 -2.3624803
98 3.5112058 -0.3669572
99 1.5022520 3.5112058
100 2.6375197 1.5022520
101 -1.4932711 2.6375197
102 1.6330428 -1.4932711
103 -2.4932711 1.6330428
104 0.6419966 -2.4932711
105 -4.4887942 0.6419966
106 1.6375197 -4.4887942
107 1.5022520 1.6375197
108 -3.4932711 1.5022520
109 -4.3803879 -3.4932711
110 0.6330428 -4.3803879
111 -3.3669572 0.6330428
112 -1.3624803 -3.3669572
113 0.5067289 -1.3624803
114 3.6375197 0.5067289
115 2.4977751 3.6375197
116 -0.3714341 2.4977751
117 -0.3624803 -0.3714341
118 -0.3714341 -0.3624803
119 -0.3669572 -0.3714341
120 -2.3669572 -0.3669572
121 -0.3803879 -2.3669572
122 0.6285659 -0.3803879
123 0.6330428 0.6285659
124 0.6375197 0.6330428
125 -1.3624803 0.6375197
126 3.5067289 -1.3624803
127 2.6330428 3.5067289
128 4.6285659 2.6330428
129 0.6375197 4.6285659
130 -0.4887942 0.6375197
131 -4.4887942 -0.4887942
132 0.6330428 -4.4887942
133 1.5156827 0.6330428
134 1.5112058 1.5156827
135 1.6285659 1.5112058
136 -2.4887942 1.6285659
137 0.5022520 -2.4887942
138 -3.3714341 0.5022520
139 0.6330428 -3.3714341
140 -0.4887942 0.6330428
141 0.6240890 -0.4887942
142 2.5112058 0.6240890
143 -0.3624803 2.5112058
144 1.5112058 -0.3624803
145 1.6330428 1.5112058
146 1.6419966 1.6330428
147 -2.4887942 1.6419966
148 -1.4887942 -2.4887942
149 -4.4977480 -1.4887942
150 1.6330428 -4.4977480
151 -1.3714341 1.6330428
152 2.4888213 -1.3714341
153 -2.3669572 2.4888213
154 -5.3759110 -2.3669572
155 -1.3580034 -5.3759110
156 -1.3624803 -1.3580034
157 -0.3669572 -1.3624803
158 4.6285659 -0.3669572
159 -1.3714341 4.6285659
160 -2.3669572 -1.3714341
161 -1.3669572 -2.3669572
> 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/wessaorg/rcomp/tmp/7n59c1321714469.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/83q8p1321714469.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/wessaorg/rcomp/tmp/9z27o1321714469.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/wessaorg/rcomp/tmp/109rq11321714469.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/11ra281321714469.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/wessaorg/rcomp/tmp/12e32i1321714469.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/wessaorg/rcomp/tmp/13pc8a1321714470.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/wessaorg/rcomp/tmp/14yhgm1321714470.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/wessaorg/rcomp/tmp/15npzr1321714470.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/wessaorg/rcomp/tmp/16g7gf1321714470.tab")
+ }
>
> try(system("convert tmp/1l8ui1321714469.ps tmp/1l8ui1321714469.png",intern=TRUE))
character(0)
> try(system("convert tmp/2p7k11321714469.ps tmp/2p7k11321714469.png",intern=TRUE))
character(0)
> try(system("convert tmp/3rzk11321714469.ps tmp/3rzk11321714469.png",intern=TRUE))
character(0)
> try(system("convert tmp/4h30t1321714469.ps tmp/4h30t1321714469.png",intern=TRUE))
character(0)
> try(system("convert tmp/53laq1321714469.ps tmp/53laq1321714469.png",intern=TRUE))
character(0)
> try(system("convert tmp/6ll951321714469.ps tmp/6ll951321714469.png",intern=TRUE))
character(0)
> try(system("convert tmp/7n59c1321714469.ps tmp/7n59c1321714469.png",intern=TRUE))
character(0)
> try(system("convert tmp/83q8p1321714469.ps tmp/83q8p1321714469.png",intern=TRUE))
character(0)
> try(system("convert tmp/9z27o1321714469.ps tmp/9z27o1321714469.png",intern=TRUE))
character(0)
> try(system("convert tmp/109rq11321714469.ps tmp/109rq11321714469.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.472 0.494 5.081