R version 2.12.0 (2010-10-15)
Copyright (C) 2010 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(14
+ ,7
+ ,53
+ ,18
+ ,5
+ ,86
+ ,11
+ ,5
+ ,66
+ ,12
+ ,5
+ ,67
+ ,16
+ ,8
+ ,76
+ ,18
+ ,6
+ ,78
+ ,14
+ ,5
+ ,53
+ ,14
+ ,6
+ ,80
+ ,15
+ ,5
+ ,74
+ ,15
+ ,4
+ ,76
+ ,17
+ ,6
+ ,79
+ ,19
+ ,5
+ ,54
+ ,10
+ ,5
+ ,67
+ ,16
+ ,6
+ ,54
+ ,18
+ ,7
+ ,87
+ ,14
+ ,6
+ ,58
+ ,14
+ ,7
+ ,75
+ ,17
+ ,6
+ ,88
+ ,14
+ ,8
+ ,64
+ ,16
+ ,7
+ ,57
+ ,18
+ ,5
+ ,66
+ ,11
+ ,5
+ ,68
+ ,14
+ ,7
+ ,54
+ ,12
+ ,7
+ ,56
+ ,17
+ ,5
+ ,86
+ ,9
+ ,4
+ ,80
+ ,16
+ ,10
+ ,76
+ ,14
+ ,6
+ ,69
+ ,15
+ ,5
+ ,78
+ ,11
+ ,5
+ ,67
+ ,16
+ ,5
+ ,80
+ ,13
+ ,5
+ ,54
+ ,17
+ ,6
+ ,71
+ ,15
+ ,5
+ ,84
+ ,14
+ ,5
+ ,74
+ ,16
+ ,5
+ ,71
+ ,9
+ ,5
+ ,63
+ ,15
+ ,5
+ ,71
+ ,17
+ ,5
+ ,76
+ ,13
+ ,5
+ ,69
+ ,15
+ ,5
+ ,74
+ ,16
+ ,7
+ ,75
+ ,16
+ ,5
+ ,54
+ ,12
+ ,6
+ ,52
+ ,12
+ ,7
+ ,69
+ ,11
+ ,7
+ ,68
+ ,15
+ ,5
+ ,65
+ ,15
+ ,5
+ ,75
+ ,17
+ ,4
+ ,74
+ ,13
+ ,5
+ ,75
+ ,16
+ ,4
+ ,72
+ ,14
+ ,5
+ ,67
+ ,11
+ ,5
+ ,63
+ ,12
+ ,7
+ ,62
+ ,12
+ ,5
+ ,63
+ ,15
+ ,5
+ ,76
+ ,16
+ ,6
+ ,74
+ ,15
+ ,4
+ ,67
+ ,12
+ ,6
+ ,73
+ ,12
+ ,6
+ ,70
+ ,8
+ ,5
+ ,53
+ ,13
+ ,7
+ ,77
+ ,11
+ ,6
+ ,77
+ ,14
+ ,8
+ ,52
+ ,15
+ ,7
+ ,54
+ ,10
+ ,5
+ ,80
+ ,11
+ ,6
+ ,66
+ ,12
+ ,6
+ ,73
+ ,15
+ ,5
+ ,63
+ ,15
+ ,5
+ ,69
+ ,14
+ ,5
+ ,67
+ ,16
+ ,5
+ ,54
+ ,15
+ ,4
+ ,81
+ ,15
+ ,6
+ ,69
+ ,13
+ ,6
+ ,84
+ ,12
+ ,6
+ ,80
+ ,17
+ ,6
+ ,70
+ ,13
+ ,7
+ ,69
+ ,15
+ ,5
+ ,77
+ ,13
+ ,7
+ ,54
+ ,15
+ ,6
+ ,79
+ ,16
+ ,5
+ ,30
+ ,15
+ ,5
+ ,71
+ ,16
+ ,4
+ ,73
+ ,15
+ ,8
+ ,72
+ ,14
+ ,8
+ ,77
+ ,15
+ ,5
+ ,75
+ ,14
+ ,5
+ ,69
+ ,13
+ ,6
+ ,54
+ ,7
+ ,4
+ ,70
+ ,17
+ ,5
+ ,73
+ ,13
+ ,5
+ ,54
+ ,15
+ ,5
+ ,77
+ ,14
+ ,5
+ ,82
+ ,13
+ ,6
+ ,80
+ ,16
+ ,6
+ ,80
+ ,12
+ ,5
+ ,69
+ ,14
+ ,6
+ ,78
+ ,17
+ ,5
+ ,81
+ ,15
+ ,7
+ ,76
+ ,17
+ ,5
+ ,76
+ ,12
+ ,6
+ ,73
+ ,16
+ ,6
+ ,85
+ ,11
+ ,6
+ ,66
+ ,15
+ ,4
+ ,79
+ ,9
+ ,5
+ ,68
+ ,16
+ ,5
+ ,76
+ ,15
+ ,7
+ ,71
+ ,10
+ ,6
+ ,54
+ ,10
+ ,9
+ ,46
+ ,15
+ ,6
+ ,82
+ ,11
+ ,6
+ ,74
+ ,13
+ ,5
+ ,88
+ ,14
+ ,6
+ ,38
+ ,18
+ ,5
+ ,76
+ ,16
+ ,8
+ ,86
+ ,14
+ ,7
+ ,54
+ ,14
+ ,5
+ ,70
+ ,14
+ ,7
+ ,69
+ ,14
+ ,6
+ ,90
+ ,12
+ ,6
+ ,54
+ ,14
+ ,9
+ ,76
+ ,15
+ ,7
+ ,89
+ ,15
+ ,6
+ ,76
+ ,15
+ ,5
+ ,73
+ ,13
+ ,5
+ ,79
+ ,17
+ ,6
+ ,90
+ ,17
+ ,6
+ ,74
+ ,19
+ ,7
+ ,81
+ ,15
+ ,5
+ ,72
+ ,13
+ ,5
+ ,71
+ ,9
+ ,5
+ ,66
+ ,15
+ ,6
+ ,77
+ ,15
+ ,4
+ ,65
+ ,15
+ ,5
+ ,74
+ ,16
+ ,7
+ ,82
+ ,11
+ ,5
+ ,54
+ ,14
+ ,7
+ ,63
+ ,11
+ ,7
+ ,54
+ ,15
+ ,6
+ ,64
+ ,13
+ ,5
+ ,69
+ ,15
+ ,8
+ ,54
+ ,16
+ ,5
+ ,84
+ ,14
+ ,5
+ ,86
+ ,15
+ ,5
+ ,77
+ ,16
+ ,6
+ ,89
+ ,16
+ ,4
+ ,76
+ ,11
+ ,5
+ ,60
+ ,12
+ ,5
+ ,75
+ ,9
+ ,7
+ ,73
+ ,16
+ ,6
+ ,85
+ ,13
+ ,7
+ ,79
+ ,16
+ ,10
+ ,71
+ ,12
+ ,6
+ ,72
+ ,9
+ ,8
+ ,69
+ ,13
+ ,4
+ ,78
+ ,13
+ ,5
+ ,54
+ ,14
+ ,6
+ ,69
+ ,19
+ ,7
+ ,81
+ ,13
+ ,7
+ ,84
+ ,12
+ ,6
+ ,84
+ ,13
+ ,6
+ ,69)
+ ,dim=c(3
+ ,162)
+ ,dimnames=list(c('Happiness'
+ ,'Age'
+ ,'Belonging')
+ ,1:162))
> y <- array(NA,dim=c(3,162),dimnames=list(c('Happiness','Age','Belonging'),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 = '1'
> 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 Age Belonging
1 14 7 53
2 18 5 86
3 11 5 66
4 12 5 67
5 16 8 76
6 18 6 78
7 14 5 53
8 14 6 80
9 15 5 74
10 15 4 76
11 17 6 79
12 19 5 54
13 10 5 67
14 16 6 54
15 18 7 87
16 14 6 58
17 14 7 75
18 17 6 88
19 14 8 64
20 16 7 57
21 18 5 66
22 11 5 68
23 14 7 54
24 12 7 56
25 17 5 86
26 9 4 80
27 16 10 76
28 14 6 69
29 15 5 78
30 11 5 67
31 16 5 80
32 13 5 54
33 17 6 71
34 15 5 84
35 14 5 74
36 16 5 71
37 9 5 63
38 15 5 71
39 17 5 76
40 13 5 69
41 15 5 74
42 16 7 75
43 16 5 54
44 12 6 52
45 12 7 69
46 11 7 68
47 15 5 65
48 15 5 75
49 17 4 74
50 13 5 75
51 16 4 72
52 14 5 67
53 11 5 63
54 12 7 62
55 12 5 63
56 15 5 76
57 16 6 74
58 15 4 67
59 12 6 73
60 12 6 70
61 8 5 53
62 13 7 77
63 11 6 77
64 14 8 52
65 15 7 54
66 10 5 80
67 11 6 66
68 12 6 73
69 15 5 63
70 15 5 69
71 14 5 67
72 16 5 54
73 15 4 81
74 15 6 69
75 13 6 84
76 12 6 80
77 17 6 70
78 13 7 69
79 15 5 77
80 13 7 54
81 15 6 79
82 16 5 30
83 15 5 71
84 16 4 73
85 15 8 72
86 14 8 77
87 15 5 75
88 14 5 69
89 13 6 54
90 7 4 70
91 17 5 73
92 13 5 54
93 15 5 77
94 14 5 82
95 13 6 80
96 16 6 80
97 12 5 69
98 14 6 78
99 17 5 81
100 15 7 76
101 17 5 76
102 12 6 73
103 16 6 85
104 11 6 66
105 15 4 79
106 9 5 68
107 16 5 76
108 15 7 71
109 10 6 54
110 10 9 46
111 15 6 82
112 11 6 74
113 13 5 88
114 14 6 38
115 18 5 76
116 16 8 86
117 14 7 54
118 14 5 70
119 14 7 69
120 14 6 90
121 12 6 54
122 14 9 76
123 15 7 89
124 15 6 76
125 15 5 73
126 13 5 79
127 17 6 90
128 17 6 74
129 19 7 81
130 15 5 72
131 13 5 71
132 9 5 66
133 15 6 77
134 15 4 65
135 15 5 74
136 16 7 82
137 11 5 54
138 14 7 63
139 11 7 54
140 15 6 64
141 13 5 69
142 15 8 54
143 16 5 84
144 14 5 86
145 15 5 77
146 16 6 89
147 16 4 76
148 11 5 60
149 12 5 75
150 9 7 73
151 16 6 85
152 13 7 79
153 16 10 71
154 12 6 72
155 9 8 69
156 13 4 78
157 13 5 54
158 14 6 69
159 19 7 81
160 13 7 84
161 12 6 84
162 13 6 69
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Age Belonging
9.17485 0.07282 0.06280
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-6.8621 -1.5637 0.4371 1.3766 6.0699
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.17485 1.52889 6.001 1.28e-08 ***
Age 0.07282 0.15332 0.475 0.635489
Belonging 0.06280 0.01659 3.784 0.000218 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.253 on 159 degrees of freedom
Multiple R-squared: 0.08289, Adjusted R-squared: 0.07135
F-statistic: 7.185 on 2 and 159 DF, p-value: 0.001030
> 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.61323502 0.7735300 0.38676498
[2,] 0.65712851 0.6857430 0.34287149
[3,] 0.62753607 0.7449279 0.37246393
[4,] 0.50424415 0.9915117 0.49575585
[5,] 0.39171800 0.7834360 0.60828200
[6,] 0.31420736 0.6284147 0.68579264
[7,] 0.79614273 0.4077145 0.20385727
[8,] 0.91460257 0.1707949 0.08539743
[9,] 0.89997399 0.2000520 0.10002601
[10,] 0.87571974 0.2485605 0.12428026
[11,] 0.83274271 0.3345146 0.16725729
[12,] 0.81335444 0.3732911 0.18664556
[13,] 0.76759819 0.4648036 0.23240181
[14,] 0.72680180 0.5463964 0.27319820
[15,] 0.69723524 0.6055295 0.30276476
[16,] 0.76909065 0.4618187 0.23090935
[17,] 0.83638985 0.3272203 0.16361015
[18,] 0.79529201 0.4094160 0.20470799
[19,] 0.79105439 0.4178912 0.20894561
[20,] 0.75683713 0.4863257 0.24316287
[21,] 0.93041435 0.1391713 0.06958565
[22,] 0.91551279 0.1689744 0.08448721
[23,] 0.89179236 0.2164153 0.10820764
[24,] 0.86203337 0.2759333 0.13796663
[25,] 0.88129207 0.2374159 0.11870793
[26,] 0.85891515 0.2821697 0.14108485
[27,] 0.82441447 0.3511711 0.17558553
[28,] 0.82800424 0.3439915 0.17199576
[29,] 0.79013011 0.4197398 0.20986989
[30,] 0.74956749 0.5008650 0.25043251
[31,] 0.73103659 0.5379268 0.26896341
[32,] 0.85061526 0.2987695 0.14938474
[33,] 0.82201000 0.3559800 0.17799000
[34,] 0.82686268 0.3462746 0.17313732
[35,] 0.79896415 0.4020717 0.20103585
[36,] 0.76309052 0.4738190 0.23690948
[37,] 0.73100393 0.5379921 0.26899607
[38,] 0.76079052 0.4784190 0.23920948
[39,] 0.73354154 0.5329169 0.26645846
[40,] 0.75266713 0.4946657 0.24733287
[41,] 0.80401628 0.3919674 0.19598372
[42,] 0.77863196 0.4427361 0.22136804
[43,] 0.74245017 0.5150997 0.25754983
[44,] 0.76063929 0.4787214 0.23936071
[45,] 0.73959358 0.5208128 0.26040642
[46,] 0.72689785 0.5462043 0.27310215
[47,] 0.68574383 0.6285123 0.31425617
[48,] 0.70175897 0.5964821 0.29824103
[49,] 0.68941943 0.6211611 0.31058057
[50,] 0.66759215 0.6648157 0.33240785
[51,] 0.62578136 0.7484373 0.37421864
[52,] 0.60013296 0.7997341 0.39986704
[53,] 0.56899202 0.8620160 0.43100798
[54,] 0.57948736 0.8410253 0.42051264
[55,] 0.57854340 0.8429132 0.42145660
[56,] 0.72434099 0.5513180 0.27565901
[57,] 0.71245705 0.5750859 0.28754295
[58,] 0.77167369 0.4566526 0.22832631
[59,] 0.74181667 0.5163667 0.25818333
[60,] 0.73055740 0.5388852 0.26944260
[61,] 0.83657418 0.3268516 0.16342582
[62,] 0.85045331 0.2990934 0.14954669
[63,] 0.84989023 0.3002195 0.15010977
[64,] 0.83451079 0.3309784 0.16548921
[65,] 0.81198064 0.3760387 0.18801936
[66,] 0.77999900 0.4400020 0.22000100
[67,] 0.80782731 0.3843454 0.19217269
[68,] 0.77642642 0.4471472 0.22357358
[69,] 0.74859933 0.5028013 0.25140067
[70,] 0.73855202 0.5228960 0.26144798
[71,] 0.75162497 0.4967501 0.24837503
[72,] 0.77710290 0.4457942 0.22289710
[73,] 0.74966498 0.5006700 0.25033502
[74,] 0.71523704 0.5695259 0.28476296
[75,] 0.67636011 0.6472798 0.32363989
[76,] 0.63606650 0.7278670 0.36393350
[77,] 0.77523831 0.4495234 0.22476169
[78,] 0.74883827 0.5023235 0.25116173
[79,] 0.74398030 0.5120394 0.25601970
[80,] 0.71043858 0.5791228 0.28956142
[81,] 0.67318749 0.6536250 0.32681251
[82,] 0.63742740 0.7251452 0.36257260
[83,] 0.59568450 0.8086310 0.40431550
[84,] 0.55656944 0.8868611 0.44343056
[85,] 0.85459043 0.2908191 0.14540957
[86,] 0.87475609 0.2504878 0.12524391
[87,] 0.85275074 0.2944985 0.14724926
[88,] 0.82753033 0.3449393 0.17246967
[89,] 0.79926987 0.4014603 0.20073013
[90,] 0.78361933 0.4327613 0.21638067
[91,] 0.76191195 0.4761761 0.23808805
[92,] 0.74646413 0.5070717 0.25353587
[93,] 0.70935209 0.5812958 0.29064791
[94,] 0.71552744 0.5689451 0.28447256
[95,] 0.67752495 0.6449501 0.32247505
[96,] 0.70238651 0.5952270 0.29761349
[97,] 0.69610479 0.6077904 0.30389521
[98,] 0.66255689 0.6748862 0.33744311
[99,] 0.67484537 0.6503093 0.32515463
[100,] 0.63511662 0.7297668 0.36488338
[101,] 0.76831736 0.4633653 0.23168264
[102,] 0.75504479 0.4899104 0.24495521
[103,] 0.72380505 0.5523899 0.27619495
[104,] 0.74146134 0.5170773 0.25853866
[105,] 0.75016054 0.4996789 0.24983946
[106,] 0.70984620 0.5803076 0.29015380
[107,] 0.75088381 0.4982324 0.24911619
[108,] 0.74507232 0.5098554 0.25492768
[109,] 0.76196290 0.4760742 0.23803710
[110,] 0.83230954 0.3353809 0.16769046
[111,] 0.80095149 0.3980970 0.19904851
[112,] 0.78215076 0.4356985 0.21784924
[113,] 0.74338087 0.5132383 0.25661913
[114,] 0.70009472 0.5998106 0.29990528
[115,] 0.67633309 0.6473338 0.32366691
[116,] 0.63052361 0.7389528 0.36947639
[117,] 0.58332218 0.8333556 0.41667782
[118,] 0.53617751 0.9276450 0.46382249
[119,] 0.48675409 0.9735082 0.51324591
[120,] 0.44638046 0.8927609 0.55361954
[121,] 0.41385085 0.8277017 0.58614915
[122,] 0.37902563 0.7580513 0.62097437
[123,] 0.41458010 0.8291602 0.58541990
[124,] 0.56201396 0.8759721 0.43798604
[125,] 0.52678521 0.9464296 0.47321479
[126,] 0.47156922 0.9431384 0.52843078
[127,] 0.61658734 0.7668253 0.38341266
[128,] 0.56523202 0.8695360 0.43476798
[129,] 0.55221142 0.8955772 0.44778858
[130,] 0.51027044 0.9794591 0.48972956
[131,] 0.47221887 0.9444377 0.52778113
[132,] 0.42558375 0.8511675 0.57441625
[133,] 0.37482055 0.7496411 0.62517945
[134,] 0.33553612 0.6710722 0.66446388
[135,] 0.31942920 0.6388584 0.68057080
[136,] 0.26131904 0.5226381 0.73868096
[137,] 0.31683146 0.6336629 0.68316854
[138,] 0.27616221 0.5523244 0.72383779
[139,] 0.22345241 0.4469048 0.77654759
[140,] 0.18368991 0.3673798 0.81631009
[141,] 0.14483883 0.2896777 0.85516117
[142,] 0.16115632 0.3223126 0.83884368
[143,] 0.12121886 0.2424377 0.87878114
[144,] 0.09059307 0.1811861 0.90940693
[145,] 0.20192908 0.4038582 0.79807092
[146,] 0.17561507 0.3512301 0.82438493
[147,] 0.12382739 0.2476548 0.87617261
[148,] 0.12532990 0.2506598 0.87467010
[149,] 0.08364022 0.1672804 0.91635978
[150,] 0.28191093 0.5638219 0.71808907
[151,] 0.35277717 0.7055543 0.64722283
> postscript(file="/var/www/rcomp/tmp/1otoz1321797284.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/www/rcomp/tmp/2nuk51321797284.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/www/rcomp/tmp/3htlo1321797284.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/www/rcomp/tmp/4zx8j1321797284.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/www/rcomp/tmp/5qh5f1321797284.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
0.987038094 3.060282301 -2.683723371 -1.746523087 1.469827192 3.489862608
7 8 9 10 11 12
1.132672943 -0.635736825 0.813878898 0.761096890 2.427062891 6.069873227
13 14 15 16 17 18
-3.746523087 2.997055802 2.851847735 0.745856936 -0.394555667 1.861865444
19 20 21 22 23 24
0.223423789 2.735839228 4.316276629 -2.809322803 0.924238378 -1.201361055
25 26 27 28 29 30
2.060282301 -5.490101976 1.324192343 0.055060056 0.562680032 -2.746523087
31 32 33 34 35 36
1.437080599 0.069873227 2.929460623 0.185881734 -0.186121102 2.002278047
37 38 39 40 41 42
-4.495324221 1.002278047 2.688279465 -0.872122520 0.813878898 1.605444333
43 44 45 46 47 48
3.069873227 -0.877344765 -2.017757369 -2.954957652 1.379076346 0.751079182
49 50 51 52 53 54
2.886696323 -1.248920818 2.012295755 0.253476913 -2.495324221 -1.578159354
55 56 57 58 59 60
-1.495324221 0.688279465 1.741061474 1.326294338 -2.196138810 -2.007739661
61 62 63 64 65 66
-4.867327057 -1.520155100 -3.447337676 0.977020386 1.924238378 -4.562919401
67 68 69 70 71 72
-2.756540795 -2.196138810 1.504675779 1.127877480 0.253476913 3.069873227
73 74 75 76 77 78
0.447098308 1.055060056 -1.886935691 -2.635736825 2.992260339 -1.017757369
79 80 81 82 83 84
0.625479749 -0.075761622 0.427062891 4.577066421 1.002278047 1.949496039
85 86 87 88 89 90
0.721026057 -0.592972525 0.751079182 0.127877480 -0.002944198 -6.862104812
91 92 93 94 95 96
2.876678614 0.069873227 0.625479749 -0.688518833 -1.635736825 1.364263175
97 98 99 100 101 102
-1.872122520 -0.510137392 2.374280883 0.542644616 2.688279465 -2.196138810
103 104 105 106 107 108
1.050264593 -2.756540795 0.572697740 -4.809322803 1.688279465 0.856643198
109 110 111 112 113 114
-3.002944198 -2.718998740 0.238663742 -3.258938526 -2.065317132 2.001851265
115 116 117 118 119 120
3.688279465 0.841830027 0.924238378 0.065077764 -0.017757369 -1.263733989
121 122 123 124 125 126
-1.002944198 -0.602990233 -0.273751697 0.615462041 0.876678614 -1.500119684
127 128 129 130 131 132
1.736266011 2.741061474 4.228646034 0.939478331 -0.997721953 -4.683723371
133 134 135 136 137 138
0.552662324 1.451893770 0.813878898 1.165846318 -1.930126773 0.359040930
139 140 141 142 143 144
-2.075761622 1.369058638 -0.872122520 1.851420953 1.185881734 -0.939717699
145 146 147 148 149 150
0.625479749 0.799065727 1.761096890 -2.306925072 -2.248920818 -5.268956235
151 152 153 154 155 156
1.050264593 -1.645754533 1.638190925 -2.133339094 -5.090574793 -1.364502543
157 158 159 160 161 162
0.069873227 0.055060056 4.228646034 -1.959753115 -2.886935691 -0.944939944
> postscript(file="/var/www/rcomp/tmp/68lhm1321797284.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.987038094 NA
1 3.060282301 0.987038094
2 -2.683723371 3.060282301
3 -1.746523087 -2.683723371
4 1.469827192 -1.746523087
5 3.489862608 1.469827192
6 1.132672943 3.489862608
7 -0.635736825 1.132672943
8 0.813878898 -0.635736825
9 0.761096890 0.813878898
10 2.427062891 0.761096890
11 6.069873227 2.427062891
12 -3.746523087 6.069873227
13 2.997055802 -3.746523087
14 2.851847735 2.997055802
15 0.745856936 2.851847735
16 -0.394555667 0.745856936
17 1.861865444 -0.394555667
18 0.223423789 1.861865444
19 2.735839228 0.223423789
20 4.316276629 2.735839228
21 -2.809322803 4.316276629
22 0.924238378 -2.809322803
23 -1.201361055 0.924238378
24 2.060282301 -1.201361055
25 -5.490101976 2.060282301
26 1.324192343 -5.490101976
27 0.055060056 1.324192343
28 0.562680032 0.055060056
29 -2.746523087 0.562680032
30 1.437080599 -2.746523087
31 0.069873227 1.437080599
32 2.929460623 0.069873227
33 0.185881734 2.929460623
34 -0.186121102 0.185881734
35 2.002278047 -0.186121102
36 -4.495324221 2.002278047
37 1.002278047 -4.495324221
38 2.688279465 1.002278047
39 -0.872122520 2.688279465
40 0.813878898 -0.872122520
41 1.605444333 0.813878898
42 3.069873227 1.605444333
43 -0.877344765 3.069873227
44 -2.017757369 -0.877344765
45 -2.954957652 -2.017757369
46 1.379076346 -2.954957652
47 0.751079182 1.379076346
48 2.886696323 0.751079182
49 -1.248920818 2.886696323
50 2.012295755 -1.248920818
51 0.253476913 2.012295755
52 -2.495324221 0.253476913
53 -1.578159354 -2.495324221
54 -1.495324221 -1.578159354
55 0.688279465 -1.495324221
56 1.741061474 0.688279465
57 1.326294338 1.741061474
58 -2.196138810 1.326294338
59 -2.007739661 -2.196138810
60 -4.867327057 -2.007739661
61 -1.520155100 -4.867327057
62 -3.447337676 -1.520155100
63 0.977020386 -3.447337676
64 1.924238378 0.977020386
65 -4.562919401 1.924238378
66 -2.756540795 -4.562919401
67 -2.196138810 -2.756540795
68 1.504675779 -2.196138810
69 1.127877480 1.504675779
70 0.253476913 1.127877480
71 3.069873227 0.253476913
72 0.447098308 3.069873227
73 1.055060056 0.447098308
74 -1.886935691 1.055060056
75 -2.635736825 -1.886935691
76 2.992260339 -2.635736825
77 -1.017757369 2.992260339
78 0.625479749 -1.017757369
79 -0.075761622 0.625479749
80 0.427062891 -0.075761622
81 4.577066421 0.427062891
82 1.002278047 4.577066421
83 1.949496039 1.002278047
84 0.721026057 1.949496039
85 -0.592972525 0.721026057
86 0.751079182 -0.592972525
87 0.127877480 0.751079182
88 -0.002944198 0.127877480
89 -6.862104812 -0.002944198
90 2.876678614 -6.862104812
91 0.069873227 2.876678614
92 0.625479749 0.069873227
93 -0.688518833 0.625479749
94 -1.635736825 -0.688518833
95 1.364263175 -1.635736825
96 -1.872122520 1.364263175
97 -0.510137392 -1.872122520
98 2.374280883 -0.510137392
99 0.542644616 2.374280883
100 2.688279465 0.542644616
101 -2.196138810 2.688279465
102 1.050264593 -2.196138810
103 -2.756540795 1.050264593
104 0.572697740 -2.756540795
105 -4.809322803 0.572697740
106 1.688279465 -4.809322803
107 0.856643198 1.688279465
108 -3.002944198 0.856643198
109 -2.718998740 -3.002944198
110 0.238663742 -2.718998740
111 -3.258938526 0.238663742
112 -2.065317132 -3.258938526
113 2.001851265 -2.065317132
114 3.688279465 2.001851265
115 0.841830027 3.688279465
116 0.924238378 0.841830027
117 0.065077764 0.924238378
118 -0.017757369 0.065077764
119 -1.263733989 -0.017757369
120 -1.002944198 -1.263733989
121 -0.602990233 -1.002944198
122 -0.273751697 -0.602990233
123 0.615462041 -0.273751697
124 0.876678614 0.615462041
125 -1.500119684 0.876678614
126 1.736266011 -1.500119684
127 2.741061474 1.736266011
128 4.228646034 2.741061474
129 0.939478331 4.228646034
130 -0.997721953 0.939478331
131 -4.683723371 -0.997721953
132 0.552662324 -4.683723371
133 1.451893770 0.552662324
134 0.813878898 1.451893770
135 1.165846318 0.813878898
136 -1.930126773 1.165846318
137 0.359040930 -1.930126773
138 -2.075761622 0.359040930
139 1.369058638 -2.075761622
140 -0.872122520 1.369058638
141 1.851420953 -0.872122520
142 1.185881734 1.851420953
143 -0.939717699 1.185881734
144 0.625479749 -0.939717699
145 0.799065727 0.625479749
146 1.761096890 0.799065727
147 -2.306925072 1.761096890
148 -2.248920818 -2.306925072
149 -5.268956235 -2.248920818
150 1.050264593 -5.268956235
151 -1.645754533 1.050264593
152 1.638190925 -1.645754533
153 -2.133339094 1.638190925
154 -5.090574793 -2.133339094
155 -1.364502543 -5.090574793
156 0.069873227 -1.364502543
157 0.055060056 0.069873227
158 4.228646034 0.055060056
159 -1.959753115 4.228646034
160 -2.886935691 -1.959753115
161 -0.944939944 -2.886935691
162 NA -0.944939944
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 3.060282301 0.987038094
[2,] -2.683723371 3.060282301
[3,] -1.746523087 -2.683723371
[4,] 1.469827192 -1.746523087
[5,] 3.489862608 1.469827192
[6,] 1.132672943 3.489862608
[7,] -0.635736825 1.132672943
[8,] 0.813878898 -0.635736825
[9,] 0.761096890 0.813878898
[10,] 2.427062891 0.761096890
[11,] 6.069873227 2.427062891
[12,] -3.746523087 6.069873227
[13,] 2.997055802 -3.746523087
[14,] 2.851847735 2.997055802
[15,] 0.745856936 2.851847735
[16,] -0.394555667 0.745856936
[17,] 1.861865444 -0.394555667
[18,] 0.223423789 1.861865444
[19,] 2.735839228 0.223423789
[20,] 4.316276629 2.735839228
[21,] -2.809322803 4.316276629
[22,] 0.924238378 -2.809322803
[23,] -1.201361055 0.924238378
[24,] 2.060282301 -1.201361055
[25,] -5.490101976 2.060282301
[26,] 1.324192343 -5.490101976
[27,] 0.055060056 1.324192343
[28,] 0.562680032 0.055060056
[29,] -2.746523087 0.562680032
[30,] 1.437080599 -2.746523087
[31,] 0.069873227 1.437080599
[32,] 2.929460623 0.069873227
[33,] 0.185881734 2.929460623
[34,] -0.186121102 0.185881734
[35,] 2.002278047 -0.186121102
[36,] -4.495324221 2.002278047
[37,] 1.002278047 -4.495324221
[38,] 2.688279465 1.002278047
[39,] -0.872122520 2.688279465
[40,] 0.813878898 -0.872122520
[41,] 1.605444333 0.813878898
[42,] 3.069873227 1.605444333
[43,] -0.877344765 3.069873227
[44,] -2.017757369 -0.877344765
[45,] -2.954957652 -2.017757369
[46,] 1.379076346 -2.954957652
[47,] 0.751079182 1.379076346
[48,] 2.886696323 0.751079182
[49,] -1.248920818 2.886696323
[50,] 2.012295755 -1.248920818
[51,] 0.253476913 2.012295755
[52,] -2.495324221 0.253476913
[53,] -1.578159354 -2.495324221
[54,] -1.495324221 -1.578159354
[55,] 0.688279465 -1.495324221
[56,] 1.741061474 0.688279465
[57,] 1.326294338 1.741061474
[58,] -2.196138810 1.326294338
[59,] -2.007739661 -2.196138810
[60,] -4.867327057 -2.007739661
[61,] -1.520155100 -4.867327057
[62,] -3.447337676 -1.520155100
[63,] 0.977020386 -3.447337676
[64,] 1.924238378 0.977020386
[65,] -4.562919401 1.924238378
[66,] -2.756540795 -4.562919401
[67,] -2.196138810 -2.756540795
[68,] 1.504675779 -2.196138810
[69,] 1.127877480 1.504675779
[70,] 0.253476913 1.127877480
[71,] 3.069873227 0.253476913
[72,] 0.447098308 3.069873227
[73,] 1.055060056 0.447098308
[74,] -1.886935691 1.055060056
[75,] -2.635736825 -1.886935691
[76,] 2.992260339 -2.635736825
[77,] -1.017757369 2.992260339
[78,] 0.625479749 -1.017757369
[79,] -0.075761622 0.625479749
[80,] 0.427062891 -0.075761622
[81,] 4.577066421 0.427062891
[82,] 1.002278047 4.577066421
[83,] 1.949496039 1.002278047
[84,] 0.721026057 1.949496039
[85,] -0.592972525 0.721026057
[86,] 0.751079182 -0.592972525
[87,] 0.127877480 0.751079182
[88,] -0.002944198 0.127877480
[89,] -6.862104812 -0.002944198
[90,] 2.876678614 -6.862104812
[91,] 0.069873227 2.876678614
[92,] 0.625479749 0.069873227
[93,] -0.688518833 0.625479749
[94,] -1.635736825 -0.688518833
[95,] 1.364263175 -1.635736825
[96,] -1.872122520 1.364263175
[97,] -0.510137392 -1.872122520
[98,] 2.374280883 -0.510137392
[99,] 0.542644616 2.374280883
[100,] 2.688279465 0.542644616
[101,] -2.196138810 2.688279465
[102,] 1.050264593 -2.196138810
[103,] -2.756540795 1.050264593
[104,] 0.572697740 -2.756540795
[105,] -4.809322803 0.572697740
[106,] 1.688279465 -4.809322803
[107,] 0.856643198 1.688279465
[108,] -3.002944198 0.856643198
[109,] -2.718998740 -3.002944198
[110,] 0.238663742 -2.718998740
[111,] -3.258938526 0.238663742
[112,] -2.065317132 -3.258938526
[113,] 2.001851265 -2.065317132
[114,] 3.688279465 2.001851265
[115,] 0.841830027 3.688279465
[116,] 0.924238378 0.841830027
[117,] 0.065077764 0.924238378
[118,] -0.017757369 0.065077764
[119,] -1.263733989 -0.017757369
[120,] -1.002944198 -1.263733989
[121,] -0.602990233 -1.002944198
[122,] -0.273751697 -0.602990233
[123,] 0.615462041 -0.273751697
[124,] 0.876678614 0.615462041
[125,] -1.500119684 0.876678614
[126,] 1.736266011 -1.500119684
[127,] 2.741061474 1.736266011
[128,] 4.228646034 2.741061474
[129,] 0.939478331 4.228646034
[130,] -0.997721953 0.939478331
[131,] -4.683723371 -0.997721953
[132,] 0.552662324 -4.683723371
[133,] 1.451893770 0.552662324
[134,] 0.813878898 1.451893770
[135,] 1.165846318 0.813878898
[136,] -1.930126773 1.165846318
[137,] 0.359040930 -1.930126773
[138,] -2.075761622 0.359040930
[139,] 1.369058638 -2.075761622
[140,] -0.872122520 1.369058638
[141,] 1.851420953 -0.872122520
[142,] 1.185881734 1.851420953
[143,] -0.939717699 1.185881734
[144,] 0.625479749 -0.939717699
[145,] 0.799065727 0.625479749
[146,] 1.761096890 0.799065727
[147,] -2.306925072 1.761096890
[148,] -2.248920818 -2.306925072
[149,] -5.268956235 -2.248920818
[150,] 1.050264593 -5.268956235
[151,] -1.645754533 1.050264593
[152,] 1.638190925 -1.645754533
[153,] -2.133339094 1.638190925
[154,] -5.090574793 -2.133339094
[155,] -1.364502543 -5.090574793
[156,] 0.069873227 -1.364502543
[157,] 0.055060056 0.069873227
[158,] 4.228646034 0.055060056
[159,] -1.959753115 4.228646034
[160,] -2.886935691 -1.959753115
[161,] -0.944939944 -2.886935691
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 3.060282301 0.987038094
2 -2.683723371 3.060282301
3 -1.746523087 -2.683723371
4 1.469827192 -1.746523087
5 3.489862608 1.469827192
6 1.132672943 3.489862608
7 -0.635736825 1.132672943
8 0.813878898 -0.635736825
9 0.761096890 0.813878898
10 2.427062891 0.761096890
11 6.069873227 2.427062891
12 -3.746523087 6.069873227
13 2.997055802 -3.746523087
14 2.851847735 2.997055802
15 0.745856936 2.851847735
16 -0.394555667 0.745856936
17 1.861865444 -0.394555667
18 0.223423789 1.861865444
19 2.735839228 0.223423789
20 4.316276629 2.735839228
21 -2.809322803 4.316276629
22 0.924238378 -2.809322803
23 -1.201361055 0.924238378
24 2.060282301 -1.201361055
25 -5.490101976 2.060282301
26 1.324192343 -5.490101976
27 0.055060056 1.324192343
28 0.562680032 0.055060056
29 -2.746523087 0.562680032
30 1.437080599 -2.746523087
31 0.069873227 1.437080599
32 2.929460623 0.069873227
33 0.185881734 2.929460623
34 -0.186121102 0.185881734
35 2.002278047 -0.186121102
36 -4.495324221 2.002278047
37 1.002278047 -4.495324221
38 2.688279465 1.002278047
39 -0.872122520 2.688279465
40 0.813878898 -0.872122520
41 1.605444333 0.813878898
42 3.069873227 1.605444333
43 -0.877344765 3.069873227
44 -2.017757369 -0.877344765
45 -2.954957652 -2.017757369
46 1.379076346 -2.954957652
47 0.751079182 1.379076346
48 2.886696323 0.751079182
49 -1.248920818 2.886696323
50 2.012295755 -1.248920818
51 0.253476913 2.012295755
52 -2.495324221 0.253476913
53 -1.578159354 -2.495324221
54 -1.495324221 -1.578159354
55 0.688279465 -1.495324221
56 1.741061474 0.688279465
57 1.326294338 1.741061474
58 -2.196138810 1.326294338
59 -2.007739661 -2.196138810
60 -4.867327057 -2.007739661
61 -1.520155100 -4.867327057
62 -3.447337676 -1.520155100
63 0.977020386 -3.447337676
64 1.924238378 0.977020386
65 -4.562919401 1.924238378
66 -2.756540795 -4.562919401
67 -2.196138810 -2.756540795
68 1.504675779 -2.196138810
69 1.127877480 1.504675779
70 0.253476913 1.127877480
71 3.069873227 0.253476913
72 0.447098308 3.069873227
73 1.055060056 0.447098308
74 -1.886935691 1.055060056
75 -2.635736825 -1.886935691
76 2.992260339 -2.635736825
77 -1.017757369 2.992260339
78 0.625479749 -1.017757369
79 -0.075761622 0.625479749
80 0.427062891 -0.075761622
81 4.577066421 0.427062891
82 1.002278047 4.577066421
83 1.949496039 1.002278047
84 0.721026057 1.949496039
85 -0.592972525 0.721026057
86 0.751079182 -0.592972525
87 0.127877480 0.751079182
88 -0.002944198 0.127877480
89 -6.862104812 -0.002944198
90 2.876678614 -6.862104812
91 0.069873227 2.876678614
92 0.625479749 0.069873227
93 -0.688518833 0.625479749
94 -1.635736825 -0.688518833
95 1.364263175 -1.635736825
96 -1.872122520 1.364263175
97 -0.510137392 -1.872122520
98 2.374280883 -0.510137392
99 0.542644616 2.374280883
100 2.688279465 0.542644616
101 -2.196138810 2.688279465
102 1.050264593 -2.196138810
103 -2.756540795 1.050264593
104 0.572697740 -2.756540795
105 -4.809322803 0.572697740
106 1.688279465 -4.809322803
107 0.856643198 1.688279465
108 -3.002944198 0.856643198
109 -2.718998740 -3.002944198
110 0.238663742 -2.718998740
111 -3.258938526 0.238663742
112 -2.065317132 -3.258938526
113 2.001851265 -2.065317132
114 3.688279465 2.001851265
115 0.841830027 3.688279465
116 0.924238378 0.841830027
117 0.065077764 0.924238378
118 -0.017757369 0.065077764
119 -1.263733989 -0.017757369
120 -1.002944198 -1.263733989
121 -0.602990233 -1.002944198
122 -0.273751697 -0.602990233
123 0.615462041 -0.273751697
124 0.876678614 0.615462041
125 -1.500119684 0.876678614
126 1.736266011 -1.500119684
127 2.741061474 1.736266011
128 4.228646034 2.741061474
129 0.939478331 4.228646034
130 -0.997721953 0.939478331
131 -4.683723371 -0.997721953
132 0.552662324 -4.683723371
133 1.451893770 0.552662324
134 0.813878898 1.451893770
135 1.165846318 0.813878898
136 -1.930126773 1.165846318
137 0.359040930 -1.930126773
138 -2.075761622 0.359040930
139 1.369058638 -2.075761622
140 -0.872122520 1.369058638
141 1.851420953 -0.872122520
142 1.185881734 1.851420953
143 -0.939717699 1.185881734
144 0.625479749 -0.939717699
145 0.799065727 0.625479749
146 1.761096890 0.799065727
147 -2.306925072 1.761096890
148 -2.248920818 -2.306925072
149 -5.268956235 -2.248920818
150 1.050264593 -5.268956235
151 -1.645754533 1.050264593
152 1.638190925 -1.645754533
153 -2.133339094 1.638190925
154 -5.090574793 -2.133339094
155 -1.364502543 -5.090574793
156 0.069873227 -1.364502543
157 0.055060056 0.069873227
158 4.228646034 0.055060056
159 -1.959753115 4.228646034
160 -2.886935691 -1.959753115
161 -0.944939944 -2.886935691
> 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/79wrj1321797284.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/www/rcomp/tmp/8sumh1321797284.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/www/rcomp/tmp/9nagb1321797284.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/www/rcomp/tmp/1040hm1321797284.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/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/11u3at1321797284.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/120icr1321797284.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/130i691321797284.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/143ovd1321797284.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/15lmwd1321797284.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/16hiu51321797284.tab")
+ }
>
> try(system("convert tmp/1otoz1321797284.ps tmp/1otoz1321797284.png",intern=TRUE))
character(0)
> try(system("convert tmp/2nuk51321797284.ps tmp/2nuk51321797284.png",intern=TRUE))
character(0)
> try(system("convert tmp/3htlo1321797284.ps tmp/3htlo1321797284.png",intern=TRUE))
character(0)
> try(system("convert tmp/4zx8j1321797284.ps tmp/4zx8j1321797284.png",intern=TRUE))
character(0)
> try(system("convert tmp/5qh5f1321797284.ps tmp/5qh5f1321797284.png",intern=TRUE))
character(0)
> try(system("convert tmp/68lhm1321797284.ps tmp/68lhm1321797284.png",intern=TRUE))
character(0)
> try(system("convert tmp/79wrj1321797284.ps tmp/79wrj1321797284.png",intern=TRUE))
character(0)
> try(system("convert tmp/8sumh1321797284.ps tmp/8sumh1321797284.png",intern=TRUE))
character(0)
> try(system("convert tmp/9nagb1321797284.ps tmp/9nagb1321797284.png",intern=TRUE))
character(0)
> try(system("convert tmp/1040hm1321797284.ps tmp/1040hm1321797284.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
5.500 0.380 5.872