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(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 = '3'
> 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
Belonging Happiness Age
1 53 14 7
2 86 18 5
3 66 11 5
4 67 12 5
5 76 16 8
6 78 18 6
7 53 14 5
8 80 14 6
9 74 15 5
10 76 15 4
11 79 17 6
12 54 19 5
13 67 10 5
14 54 16 6
15 87 18 7
16 58 14 6
17 75 14 7
18 88 17 6
19 64 14 8
20 57 16 7
21 66 18 5
22 68 11 5
23 54 14 7
24 56 12 7
25 86 17 5
26 80 9 4
27 76 16 10
28 69 14 6
29 78 15 5
30 67 11 5
31 80 16 5
32 54 13 5
33 71 17 6
34 84 15 5
35 74 14 5
36 71 16 5
37 63 9 5
38 71 15 5
39 76 17 5
40 69 13 5
41 74 15 5
42 75 16 7
43 54 16 5
44 52 12 6
45 69 12 7
46 68 11 7
47 65 15 5
48 75 15 5
49 74 17 4
50 75 13 5
51 72 16 4
52 67 14 5
53 63 11 5
54 62 12 7
55 63 12 5
56 76 15 5
57 74 16 6
58 67 15 4
59 73 12 6
60 70 12 6
61 53 8 5
62 77 13 7
63 77 11 6
64 52 14 8
65 54 15 7
66 80 10 5
67 66 11 6
68 73 12 6
69 63 15 5
70 69 15 5
71 67 14 5
72 54 16 5
73 81 15 4
74 69 15 6
75 84 13 6
76 80 12 6
77 70 17 6
78 69 13 7
79 77 15 5
80 54 13 7
81 79 15 6
82 30 16 5
83 71 15 5
84 73 16 4
85 72 15 8
86 77 14 8
87 75 15 5
88 69 14 5
89 54 13 6
90 70 7 4
91 73 17 5
92 54 13 5
93 77 15 5
94 82 14 5
95 80 13 6
96 80 16 6
97 69 12 5
98 78 14 6
99 81 17 5
100 76 15 7
101 76 17 5
102 73 12 6
103 85 16 6
104 66 11 6
105 79 15 4
106 68 9 5
107 76 16 5
108 71 15 7
109 54 10 6
110 46 10 9
111 82 15 6
112 74 11 6
113 88 13 5
114 38 14 6
115 76 18 5
116 86 16 8
117 54 14 7
118 70 14 5
119 69 14 7
120 90 14 6
121 54 12 6
122 76 14 9
123 89 15 7
124 76 15 6
125 73 15 5
126 79 13 5
127 90 17 6
128 74 17 6
129 81 19 7
130 72 15 5
131 71 13 5
132 66 9 5
133 77 15 6
134 65 15 4
135 74 15 5
136 82 16 7
137 54 11 5
138 63 14 7
139 54 11 7
140 64 15 6
141 69 13 5
142 54 15 8
143 84 16 5
144 86 14 5
145 77 15 5
146 89 16 6
147 76 16 4
148 60 11 5
149 75 12 5
150 73 9 7
151 85 16 6
152 79 13 7
153 71 16 10
154 72 12 6
155 69 9 8
156 78 13 4
157 54 13 5
158 69 14 6
159 81 19 7
160 84 13 7
161 84 12 6
162 69 13 6
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Happiness Age
56.1225 1.3158 -0.6705
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-43.823 -4.230 1.256 6.430 19.480
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 56.1225 6.3450 8.845 1.66e-15 ***
Happiness 1.3158 0.3477 3.784 0.000218 ***
Age -0.6705 0.7003 -0.958 0.339764
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 10.31 on 159 degrees of freedom
Multiple R-squared: 0.08685, Adjusted R-squared: 0.07536
F-statistic: 7.561 on 2 and 159 DF, p-value: 0.0007297
> 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.46388985 0.9277797 0.5361102
[2,] 0.69446131 0.6110774 0.3055387
[3,] 0.73131493 0.5373701 0.2686851
[4,] 0.62074140 0.7585172 0.3792586
[5,] 0.50664307 0.9867139 0.4933569
[6,] 0.39971062 0.7994212 0.6002894
[7,] 0.81741239 0.3651752 0.1825876
[8,] 0.75300037 0.4939993 0.2469996
[9,] 0.82864229 0.3427154 0.1713577
[10,] 0.85611657 0.2877669 0.1438834
[11,] 0.85093502 0.2981300 0.1490650
[12,] 0.81613173 0.3677365 0.1838683
[13,] 0.85172662 0.2965468 0.1482734
[14,] 0.81851528 0.3629694 0.1814847
[15,] 0.84996235 0.3000753 0.1500376
[16,] 0.83199708 0.3360058 0.1680029
[17,] 0.79043636 0.4191273 0.2095636
[18,] 0.81727486 0.3654503 0.1827251
[19,] 0.79712758 0.4057448 0.2028724
[20,] 0.81098048 0.3780390 0.1890195
[21,] 0.85117383 0.2976523 0.1488262
[22,] 0.85174039 0.2965192 0.1482596
[23,] 0.81391300 0.3721740 0.1860870
[24,] 0.78706822 0.4258636 0.2129318
[25,] 0.74126654 0.5174669 0.2587335
[26,] 0.71273388 0.5745322 0.2872661
[27,] 0.75979282 0.4804144 0.2402072
[28,] 0.71549728 0.5690054 0.2845027
[29,] 0.73116728 0.5376654 0.2688327
[30,] 0.68807304 0.6238539 0.3119270
[31,] 0.63999763 0.7200047 0.3600024
[32,] 0.58747301 0.8250540 0.4125270
[33,] 0.53397062 0.9320588 0.4660294
[34,] 0.48054425 0.9610885 0.5194557
[35,] 0.42707049 0.8541410 0.5729295
[36,] 0.37705093 0.7541019 0.6229491
[37,] 0.33558928 0.6711786 0.6644107
[38,] 0.46173545 0.9234709 0.5382646
[39,] 0.51150644 0.9769871 0.4884936
[40,] 0.46767828 0.9353566 0.5323217
[41,] 0.42445891 0.8489178 0.5755411
[42,] 0.39524587 0.7904917 0.6047541
[43,] 0.35314606 0.7062921 0.6468539
[44,] 0.30834379 0.6166876 0.6916562
[45,] 0.28040798 0.5608160 0.7195920
[46,] 0.24149875 0.4829975 0.7585012
[47,] 0.20851340 0.4170268 0.7914866
[48,] 0.17834414 0.3566883 0.8216559
[49,] 0.15242052 0.3048410 0.8475795
[50,] 0.13071511 0.2614302 0.8692849
[51,] 0.11109565 0.2221913 0.8889043
[52,] 0.09069665 0.1813933 0.9093034
[53,] 0.07794257 0.1558851 0.9220574
[54,] 0.06803559 0.1360712 0.9319644
[55,] 0.05503032 0.1100606 0.9449697
[56,] 0.05314085 0.1062817 0.9468592
[57,] 0.05233266 0.1046653 0.9476673
[58,] 0.05605226 0.1121045 0.9439477
[59,] 0.08081445 0.1616289 0.9191856
[60,] 0.11177601 0.2235520 0.8882240
[61,] 0.13759720 0.2751944 0.8624028
[62,] 0.11365785 0.2273157 0.8863421
[63,] 0.09935828 0.1987166 0.9006417
[64,] 0.09536214 0.1907243 0.9046379
[65,] 0.07888896 0.1577779 0.9211110
[66,] 0.06536053 0.1307211 0.9346395
[67,] 0.11407017 0.2281403 0.8859298
[68,] 0.10669520 0.2133904 0.8933048
[69,] 0.08857756 0.1771551 0.9114224
[70,] 0.11499150 0.2299830 0.8850085
[71,] 0.12636459 0.2527292 0.8736354
[72,] 0.10869043 0.2173809 0.8913096
[73,] 0.08931116 0.1786223 0.9106888
[74,] 0.07608615 0.1521723 0.9239139
[75,] 0.09221884 0.1844377 0.9077812
[76,] 0.08462039 0.1692408 0.9153796
[77,] 0.73772524 0.5245495 0.2622748
[78,] 0.70336083 0.5932783 0.2966392
[79,] 0.66911939 0.6617612 0.3308806
[80,] 0.63102033 0.7379593 0.3689797
[81,] 0.61489337 0.7702133 0.3851066
[82,] 0.57507390 0.8498522 0.4249261
[83,] 0.53520944 0.9295811 0.4647906
[84,] 0.59714465 0.8057107 0.4028553
[85,] 0.58094428 0.8381114 0.4190557
[86,] 0.54926208 0.9014758 0.4507379
[87,] 0.62599695 0.7480061 0.3740031
[88,] 0.59031879 0.8193624 0.4096812
[89,] 0.59004647 0.8199071 0.4099535
[90,] 0.59276973 0.8144605 0.4072303
[91,] 0.56536610 0.8692678 0.4346339
[92,] 0.51944677 0.9611065 0.4805532
[93,] 0.49448196 0.9889639 0.5055180
[94,] 0.46123468 0.9224694 0.5387653
[95,] 0.42397911 0.8479582 0.5760209
[96,] 0.38529674 0.7705935 0.6147033
[97,] 0.35118145 0.7023629 0.6488186
[98,] 0.35409238 0.7081848 0.6459076
[99,] 0.31120458 0.6224092 0.6887954
[100,] 0.27878371 0.5575674 0.7212163
[101,] 0.24729028 0.4945806 0.7527097
[102,] 0.21361880 0.4272376 0.7863812
[103,] 0.18212147 0.3642429 0.8178785
[104,] 0.18339513 0.3667903 0.8166049
[105,] 0.23823501 0.4764700 0.7617650
[106,] 0.22898573 0.4579715 0.7710143
[107,] 0.20996003 0.4199201 0.7900400
[108,] 0.28100543 0.5620109 0.7189946
[109,] 0.74610927 0.5077815 0.2538907
[110,] 0.71267748 0.5746450 0.2873225
[111,] 0.72863937 0.5427213 0.2713606
[112,] 0.81561299 0.3687740 0.1843870
[113,] 0.78260392 0.4347922 0.2173961
[114,] 0.74836260 0.5032748 0.2516374
[115,] 0.82920430 0.3415914 0.1707957
[116,] 0.87251365 0.2549727 0.1274863
[117,] 0.85021005 0.2995799 0.1497899
[118,] 0.89131408 0.2173718 0.1086859
[119,] 0.86456931 0.2708614 0.1354307
[120,] 0.83322502 0.3335500 0.1667750
[121,] 0.81859670 0.3628066 0.1814033
[122,] 0.84361106 0.3127779 0.1563889
[123,] 0.81056433 0.3788713 0.1894357
[124,] 0.77019453 0.4596109 0.2298055
[125,] 0.72603301 0.5479340 0.2739670
[126,] 0.67400167 0.6519967 0.3259983
[127,] 0.61847419 0.7630516 0.3815258
[128,] 0.56455891 0.8708822 0.4354411
[129,] 0.56879932 0.8624014 0.4312007
[130,] 0.50831148 0.9833770 0.4916885
[131,] 0.47307800 0.9461560 0.5269220
[132,] 0.55033171 0.8993366 0.4496683
[133,] 0.53472329 0.9305534 0.4652767
[134,] 0.60531068 0.7893786 0.3946893
[135,] 0.62496659 0.7500668 0.3750334
[136,] 0.57611729 0.8477654 0.4238827
[137,] 0.81726751 0.3654650 0.1827325
[138,] 0.78066240 0.4386752 0.2193376
[139,] 0.79843021 0.4031396 0.2015698
[140,] 0.73630582 0.5273884 0.2636942
[141,] 0.77269241 0.4546152 0.2273076
[142,] 0.70029112 0.5994178 0.2997089
[143,] 0.72981463 0.5403707 0.2701854
[144,] 0.64917316 0.7016537 0.3508268
[145,] 0.56427389 0.8714522 0.4357261
[146,] 0.54391531 0.9121694 0.4560847
[147,] 0.47097861 0.9419572 0.5290214
[148,] 0.41518784 0.8303757 0.5848122
[149,] 0.29809529 0.5961906 0.7019047
[150,] 0.23770169 0.4754034 0.7622983
[151,] 0.71219110 0.5756178 0.2878089
> postscript(file="/var/wessaorg/rcomp/tmp/1zl9u1321796967.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/2cudf1321796967.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/3e3sp1321796967.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/4wrmq1321796967.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/5jpzg1321796967.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
-16.8498739 9.5458628 -1.2435630 -1.5593593 4.1890725 2.2164018
7 8 9 10 11 12
-18.1909519 9.4795871 1.4932517 2.8227127 4.5321981 -23.7699335
13 14 15 16 17 18
1.0722333 -19.1520056 11.8869408 -12.5204129 5.1501261 13.5321981
19 20 21 22 23 24
-5.1793349 -15.4814666 -10.4541372 0.7564370 -15.8498739 -11.2182813
25 26 27 28 29 30
10.8616591 14.7174906 5.5301505 -1.5204129 5.4932517 -0.2435630
31 32 33 34 35 36
6.1774554 -15.8751556 -3.4678019 11.4932517 2.8090481 -2.8225446
37 38 39 40 41 42
-1.6119704 -1.5067483 0.8616591 -0.8751556 1.4932517 2.5185334
43 44 45 46 47 48
-19.8225446 -15.8888203 1.7817187 2.0975150 -7.5067483 2.4932517
49 50 51 52 53 54
-1.8088799 5.1248444 -2.4930836 -4.1909519 -4.2435630 -5.2182813
55 56 57 58 59 60
-5.5593593 3.4932517 0.8479944 -6.1772873 5.1111797 2.1111797
61 62 63 64 65 66
-10.2961741 8.4659224 10.4269760 -17.1793349 -17.1656702 14.0722333
67 68 69 70 71 72
-0.5730240 5.1111797 -9.5067483 -3.5067483 -4.1909519 -19.8225446
73 74 75 76 77 78
7.8227127 -2.8362093 14.7953834 12.1111797 -4.4678019 0.4659224
79 80 81 82 83 84
4.4932517 -14.5340776 7.1637907 -43.8225446 -1.5067483 -1.4930836
85 86 87 88 89 90
1.5048688 7.8206651 2.4932517 -2.1909519 -15.2046166 7.3490832
91 92 93 94 95 96
-2.1383409 -15.8751556 4.4932517 10.8090481 10.7953834 6.8479944
97 98 99 100 101 102
0.4406407 7.4795871 5.8616591 4.8343298 0.8616591 5.1111797
103 104 105 106 107 108
11.8479944 -0.5730240 5.8227127 3.3880296 2.1774554 -0.1656702
109 110 111 112 113 114
-11.2572277 -17.2456107 10.1637907 7.4269760 18.1248444 -32.5204129
115 116 117 118 119 120
-0.4541372 14.1890725 -15.8498739 -1.1909519 -0.8498739 19.4795871
121 122 123 124 125 126
-13.8888203 7.4912041 17.8343298 4.1637907 0.4932517 9.1248444
127 128 129 130 131 132
15.5321981 -0.4678019 4.5711445 -0.5067483 1.1248444 1.3880296
133 134 135 136 137 138
5.1637907 -8.1772873 1.4932517 9.5185334 -13.2435630 -6.8498739
139 140 141 142 143 144
-11.9024850 -7.8362093 -0.8751556 -16.4951312 10.1774554 14.8090481
145 146 147 148 149 150
4.4932517 15.8479944 1.5069164 -7.2435630 6.4406407 9.7291076
151 152 153 154 155 156
11.8479944 10.4659224 0.5301505 4.1111797 6.3996467 7.4543054
157 158 159 160 161 162
-15.8751556 -1.5204129 4.5711445 15.4659224 16.1111797 -0.2046166
> postscript(file="/var/wessaorg/rcomp/tmp/6os751321796967.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 -16.8498739 NA
1 9.5458628 -16.8498739
2 -1.2435630 9.5458628
3 -1.5593593 -1.2435630
4 4.1890725 -1.5593593
5 2.2164018 4.1890725
6 -18.1909519 2.2164018
7 9.4795871 -18.1909519
8 1.4932517 9.4795871
9 2.8227127 1.4932517
10 4.5321981 2.8227127
11 -23.7699335 4.5321981
12 1.0722333 -23.7699335
13 -19.1520056 1.0722333
14 11.8869408 -19.1520056
15 -12.5204129 11.8869408
16 5.1501261 -12.5204129
17 13.5321981 5.1501261
18 -5.1793349 13.5321981
19 -15.4814666 -5.1793349
20 -10.4541372 -15.4814666
21 0.7564370 -10.4541372
22 -15.8498739 0.7564370
23 -11.2182813 -15.8498739
24 10.8616591 -11.2182813
25 14.7174906 10.8616591
26 5.5301505 14.7174906
27 -1.5204129 5.5301505
28 5.4932517 -1.5204129
29 -0.2435630 5.4932517
30 6.1774554 -0.2435630
31 -15.8751556 6.1774554
32 -3.4678019 -15.8751556
33 11.4932517 -3.4678019
34 2.8090481 11.4932517
35 -2.8225446 2.8090481
36 -1.6119704 -2.8225446
37 -1.5067483 -1.6119704
38 0.8616591 -1.5067483
39 -0.8751556 0.8616591
40 1.4932517 -0.8751556
41 2.5185334 1.4932517
42 -19.8225446 2.5185334
43 -15.8888203 -19.8225446
44 1.7817187 -15.8888203
45 2.0975150 1.7817187
46 -7.5067483 2.0975150
47 2.4932517 -7.5067483
48 -1.8088799 2.4932517
49 5.1248444 -1.8088799
50 -2.4930836 5.1248444
51 -4.1909519 -2.4930836
52 -4.2435630 -4.1909519
53 -5.2182813 -4.2435630
54 -5.5593593 -5.2182813
55 3.4932517 -5.5593593
56 0.8479944 3.4932517
57 -6.1772873 0.8479944
58 5.1111797 -6.1772873
59 2.1111797 5.1111797
60 -10.2961741 2.1111797
61 8.4659224 -10.2961741
62 10.4269760 8.4659224
63 -17.1793349 10.4269760
64 -17.1656702 -17.1793349
65 14.0722333 -17.1656702
66 -0.5730240 14.0722333
67 5.1111797 -0.5730240
68 -9.5067483 5.1111797
69 -3.5067483 -9.5067483
70 -4.1909519 -3.5067483
71 -19.8225446 -4.1909519
72 7.8227127 -19.8225446
73 -2.8362093 7.8227127
74 14.7953834 -2.8362093
75 12.1111797 14.7953834
76 -4.4678019 12.1111797
77 0.4659224 -4.4678019
78 4.4932517 0.4659224
79 -14.5340776 4.4932517
80 7.1637907 -14.5340776
81 -43.8225446 7.1637907
82 -1.5067483 -43.8225446
83 -1.4930836 -1.5067483
84 1.5048688 -1.4930836
85 7.8206651 1.5048688
86 2.4932517 7.8206651
87 -2.1909519 2.4932517
88 -15.2046166 -2.1909519
89 7.3490832 -15.2046166
90 -2.1383409 7.3490832
91 -15.8751556 -2.1383409
92 4.4932517 -15.8751556
93 10.8090481 4.4932517
94 10.7953834 10.8090481
95 6.8479944 10.7953834
96 0.4406407 6.8479944
97 7.4795871 0.4406407
98 5.8616591 7.4795871
99 4.8343298 5.8616591
100 0.8616591 4.8343298
101 5.1111797 0.8616591
102 11.8479944 5.1111797
103 -0.5730240 11.8479944
104 5.8227127 -0.5730240
105 3.3880296 5.8227127
106 2.1774554 3.3880296
107 -0.1656702 2.1774554
108 -11.2572277 -0.1656702
109 -17.2456107 -11.2572277
110 10.1637907 -17.2456107
111 7.4269760 10.1637907
112 18.1248444 7.4269760
113 -32.5204129 18.1248444
114 -0.4541372 -32.5204129
115 14.1890725 -0.4541372
116 -15.8498739 14.1890725
117 -1.1909519 -15.8498739
118 -0.8498739 -1.1909519
119 19.4795871 -0.8498739
120 -13.8888203 19.4795871
121 7.4912041 -13.8888203
122 17.8343298 7.4912041
123 4.1637907 17.8343298
124 0.4932517 4.1637907
125 9.1248444 0.4932517
126 15.5321981 9.1248444
127 -0.4678019 15.5321981
128 4.5711445 -0.4678019
129 -0.5067483 4.5711445
130 1.1248444 -0.5067483
131 1.3880296 1.1248444
132 5.1637907 1.3880296
133 -8.1772873 5.1637907
134 1.4932517 -8.1772873
135 9.5185334 1.4932517
136 -13.2435630 9.5185334
137 -6.8498739 -13.2435630
138 -11.9024850 -6.8498739
139 -7.8362093 -11.9024850
140 -0.8751556 -7.8362093
141 -16.4951312 -0.8751556
142 10.1774554 -16.4951312
143 14.8090481 10.1774554
144 4.4932517 14.8090481
145 15.8479944 4.4932517
146 1.5069164 15.8479944
147 -7.2435630 1.5069164
148 6.4406407 -7.2435630
149 9.7291076 6.4406407
150 11.8479944 9.7291076
151 10.4659224 11.8479944
152 0.5301505 10.4659224
153 4.1111797 0.5301505
154 6.3996467 4.1111797
155 7.4543054 6.3996467
156 -15.8751556 7.4543054
157 -1.5204129 -15.8751556
158 4.5711445 -1.5204129
159 15.4659224 4.5711445
160 16.1111797 15.4659224
161 -0.2046166 16.1111797
162 NA -0.2046166
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 9.5458628 -16.8498739
[2,] -1.2435630 9.5458628
[3,] -1.5593593 -1.2435630
[4,] 4.1890725 -1.5593593
[5,] 2.2164018 4.1890725
[6,] -18.1909519 2.2164018
[7,] 9.4795871 -18.1909519
[8,] 1.4932517 9.4795871
[9,] 2.8227127 1.4932517
[10,] 4.5321981 2.8227127
[11,] -23.7699335 4.5321981
[12,] 1.0722333 -23.7699335
[13,] -19.1520056 1.0722333
[14,] 11.8869408 -19.1520056
[15,] -12.5204129 11.8869408
[16,] 5.1501261 -12.5204129
[17,] 13.5321981 5.1501261
[18,] -5.1793349 13.5321981
[19,] -15.4814666 -5.1793349
[20,] -10.4541372 -15.4814666
[21,] 0.7564370 -10.4541372
[22,] -15.8498739 0.7564370
[23,] -11.2182813 -15.8498739
[24,] 10.8616591 -11.2182813
[25,] 14.7174906 10.8616591
[26,] 5.5301505 14.7174906
[27,] -1.5204129 5.5301505
[28,] 5.4932517 -1.5204129
[29,] -0.2435630 5.4932517
[30,] 6.1774554 -0.2435630
[31,] -15.8751556 6.1774554
[32,] -3.4678019 -15.8751556
[33,] 11.4932517 -3.4678019
[34,] 2.8090481 11.4932517
[35,] -2.8225446 2.8090481
[36,] -1.6119704 -2.8225446
[37,] -1.5067483 -1.6119704
[38,] 0.8616591 -1.5067483
[39,] -0.8751556 0.8616591
[40,] 1.4932517 -0.8751556
[41,] 2.5185334 1.4932517
[42,] -19.8225446 2.5185334
[43,] -15.8888203 -19.8225446
[44,] 1.7817187 -15.8888203
[45,] 2.0975150 1.7817187
[46,] -7.5067483 2.0975150
[47,] 2.4932517 -7.5067483
[48,] -1.8088799 2.4932517
[49,] 5.1248444 -1.8088799
[50,] -2.4930836 5.1248444
[51,] -4.1909519 -2.4930836
[52,] -4.2435630 -4.1909519
[53,] -5.2182813 -4.2435630
[54,] -5.5593593 -5.2182813
[55,] 3.4932517 -5.5593593
[56,] 0.8479944 3.4932517
[57,] -6.1772873 0.8479944
[58,] 5.1111797 -6.1772873
[59,] 2.1111797 5.1111797
[60,] -10.2961741 2.1111797
[61,] 8.4659224 -10.2961741
[62,] 10.4269760 8.4659224
[63,] -17.1793349 10.4269760
[64,] -17.1656702 -17.1793349
[65,] 14.0722333 -17.1656702
[66,] -0.5730240 14.0722333
[67,] 5.1111797 -0.5730240
[68,] -9.5067483 5.1111797
[69,] -3.5067483 -9.5067483
[70,] -4.1909519 -3.5067483
[71,] -19.8225446 -4.1909519
[72,] 7.8227127 -19.8225446
[73,] -2.8362093 7.8227127
[74,] 14.7953834 -2.8362093
[75,] 12.1111797 14.7953834
[76,] -4.4678019 12.1111797
[77,] 0.4659224 -4.4678019
[78,] 4.4932517 0.4659224
[79,] -14.5340776 4.4932517
[80,] 7.1637907 -14.5340776
[81,] -43.8225446 7.1637907
[82,] -1.5067483 -43.8225446
[83,] -1.4930836 -1.5067483
[84,] 1.5048688 -1.4930836
[85,] 7.8206651 1.5048688
[86,] 2.4932517 7.8206651
[87,] -2.1909519 2.4932517
[88,] -15.2046166 -2.1909519
[89,] 7.3490832 -15.2046166
[90,] -2.1383409 7.3490832
[91,] -15.8751556 -2.1383409
[92,] 4.4932517 -15.8751556
[93,] 10.8090481 4.4932517
[94,] 10.7953834 10.8090481
[95,] 6.8479944 10.7953834
[96,] 0.4406407 6.8479944
[97,] 7.4795871 0.4406407
[98,] 5.8616591 7.4795871
[99,] 4.8343298 5.8616591
[100,] 0.8616591 4.8343298
[101,] 5.1111797 0.8616591
[102,] 11.8479944 5.1111797
[103,] -0.5730240 11.8479944
[104,] 5.8227127 -0.5730240
[105,] 3.3880296 5.8227127
[106,] 2.1774554 3.3880296
[107,] -0.1656702 2.1774554
[108,] -11.2572277 -0.1656702
[109,] -17.2456107 -11.2572277
[110,] 10.1637907 -17.2456107
[111,] 7.4269760 10.1637907
[112,] 18.1248444 7.4269760
[113,] -32.5204129 18.1248444
[114,] -0.4541372 -32.5204129
[115,] 14.1890725 -0.4541372
[116,] -15.8498739 14.1890725
[117,] -1.1909519 -15.8498739
[118,] -0.8498739 -1.1909519
[119,] 19.4795871 -0.8498739
[120,] -13.8888203 19.4795871
[121,] 7.4912041 -13.8888203
[122,] 17.8343298 7.4912041
[123,] 4.1637907 17.8343298
[124,] 0.4932517 4.1637907
[125,] 9.1248444 0.4932517
[126,] 15.5321981 9.1248444
[127,] -0.4678019 15.5321981
[128,] 4.5711445 -0.4678019
[129,] -0.5067483 4.5711445
[130,] 1.1248444 -0.5067483
[131,] 1.3880296 1.1248444
[132,] 5.1637907 1.3880296
[133,] -8.1772873 5.1637907
[134,] 1.4932517 -8.1772873
[135,] 9.5185334 1.4932517
[136,] -13.2435630 9.5185334
[137,] -6.8498739 -13.2435630
[138,] -11.9024850 -6.8498739
[139,] -7.8362093 -11.9024850
[140,] -0.8751556 -7.8362093
[141,] -16.4951312 -0.8751556
[142,] 10.1774554 -16.4951312
[143,] 14.8090481 10.1774554
[144,] 4.4932517 14.8090481
[145,] 15.8479944 4.4932517
[146,] 1.5069164 15.8479944
[147,] -7.2435630 1.5069164
[148,] 6.4406407 -7.2435630
[149,] 9.7291076 6.4406407
[150,] 11.8479944 9.7291076
[151,] 10.4659224 11.8479944
[152,] 0.5301505 10.4659224
[153,] 4.1111797 0.5301505
[154,] 6.3996467 4.1111797
[155,] 7.4543054 6.3996467
[156,] -15.8751556 7.4543054
[157,] -1.5204129 -15.8751556
[158,] 4.5711445 -1.5204129
[159,] 15.4659224 4.5711445
[160,] 16.1111797 15.4659224
[161,] -0.2046166 16.1111797
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 9.5458628 -16.8498739
2 -1.2435630 9.5458628
3 -1.5593593 -1.2435630
4 4.1890725 -1.5593593
5 2.2164018 4.1890725
6 -18.1909519 2.2164018
7 9.4795871 -18.1909519
8 1.4932517 9.4795871
9 2.8227127 1.4932517
10 4.5321981 2.8227127
11 -23.7699335 4.5321981
12 1.0722333 -23.7699335
13 -19.1520056 1.0722333
14 11.8869408 -19.1520056
15 -12.5204129 11.8869408
16 5.1501261 -12.5204129
17 13.5321981 5.1501261
18 -5.1793349 13.5321981
19 -15.4814666 -5.1793349
20 -10.4541372 -15.4814666
21 0.7564370 -10.4541372
22 -15.8498739 0.7564370
23 -11.2182813 -15.8498739
24 10.8616591 -11.2182813
25 14.7174906 10.8616591
26 5.5301505 14.7174906
27 -1.5204129 5.5301505
28 5.4932517 -1.5204129
29 -0.2435630 5.4932517
30 6.1774554 -0.2435630
31 -15.8751556 6.1774554
32 -3.4678019 -15.8751556
33 11.4932517 -3.4678019
34 2.8090481 11.4932517
35 -2.8225446 2.8090481
36 -1.6119704 -2.8225446
37 -1.5067483 -1.6119704
38 0.8616591 -1.5067483
39 -0.8751556 0.8616591
40 1.4932517 -0.8751556
41 2.5185334 1.4932517
42 -19.8225446 2.5185334
43 -15.8888203 -19.8225446
44 1.7817187 -15.8888203
45 2.0975150 1.7817187
46 -7.5067483 2.0975150
47 2.4932517 -7.5067483
48 -1.8088799 2.4932517
49 5.1248444 -1.8088799
50 -2.4930836 5.1248444
51 -4.1909519 -2.4930836
52 -4.2435630 -4.1909519
53 -5.2182813 -4.2435630
54 -5.5593593 -5.2182813
55 3.4932517 -5.5593593
56 0.8479944 3.4932517
57 -6.1772873 0.8479944
58 5.1111797 -6.1772873
59 2.1111797 5.1111797
60 -10.2961741 2.1111797
61 8.4659224 -10.2961741
62 10.4269760 8.4659224
63 -17.1793349 10.4269760
64 -17.1656702 -17.1793349
65 14.0722333 -17.1656702
66 -0.5730240 14.0722333
67 5.1111797 -0.5730240
68 -9.5067483 5.1111797
69 -3.5067483 -9.5067483
70 -4.1909519 -3.5067483
71 -19.8225446 -4.1909519
72 7.8227127 -19.8225446
73 -2.8362093 7.8227127
74 14.7953834 -2.8362093
75 12.1111797 14.7953834
76 -4.4678019 12.1111797
77 0.4659224 -4.4678019
78 4.4932517 0.4659224
79 -14.5340776 4.4932517
80 7.1637907 -14.5340776
81 -43.8225446 7.1637907
82 -1.5067483 -43.8225446
83 -1.4930836 -1.5067483
84 1.5048688 -1.4930836
85 7.8206651 1.5048688
86 2.4932517 7.8206651
87 -2.1909519 2.4932517
88 -15.2046166 -2.1909519
89 7.3490832 -15.2046166
90 -2.1383409 7.3490832
91 -15.8751556 -2.1383409
92 4.4932517 -15.8751556
93 10.8090481 4.4932517
94 10.7953834 10.8090481
95 6.8479944 10.7953834
96 0.4406407 6.8479944
97 7.4795871 0.4406407
98 5.8616591 7.4795871
99 4.8343298 5.8616591
100 0.8616591 4.8343298
101 5.1111797 0.8616591
102 11.8479944 5.1111797
103 -0.5730240 11.8479944
104 5.8227127 -0.5730240
105 3.3880296 5.8227127
106 2.1774554 3.3880296
107 -0.1656702 2.1774554
108 -11.2572277 -0.1656702
109 -17.2456107 -11.2572277
110 10.1637907 -17.2456107
111 7.4269760 10.1637907
112 18.1248444 7.4269760
113 -32.5204129 18.1248444
114 -0.4541372 -32.5204129
115 14.1890725 -0.4541372
116 -15.8498739 14.1890725
117 -1.1909519 -15.8498739
118 -0.8498739 -1.1909519
119 19.4795871 -0.8498739
120 -13.8888203 19.4795871
121 7.4912041 -13.8888203
122 17.8343298 7.4912041
123 4.1637907 17.8343298
124 0.4932517 4.1637907
125 9.1248444 0.4932517
126 15.5321981 9.1248444
127 -0.4678019 15.5321981
128 4.5711445 -0.4678019
129 -0.5067483 4.5711445
130 1.1248444 -0.5067483
131 1.3880296 1.1248444
132 5.1637907 1.3880296
133 -8.1772873 5.1637907
134 1.4932517 -8.1772873
135 9.5185334 1.4932517
136 -13.2435630 9.5185334
137 -6.8498739 -13.2435630
138 -11.9024850 -6.8498739
139 -7.8362093 -11.9024850
140 -0.8751556 -7.8362093
141 -16.4951312 -0.8751556
142 10.1774554 -16.4951312
143 14.8090481 10.1774554
144 4.4932517 14.8090481
145 15.8479944 4.4932517
146 1.5069164 15.8479944
147 -7.2435630 1.5069164
148 6.4406407 -7.2435630
149 9.7291076 6.4406407
150 11.8479944 9.7291076
151 10.4659224 11.8479944
152 0.5301505 10.4659224
153 4.1111797 0.5301505
154 6.3996467 4.1111797
155 7.4543054 6.3996467
156 -15.8751556 7.4543054
157 -1.5204129 -15.8751556
158 4.5711445 -1.5204129
159 15.4659224 4.5711445
160 16.1111797 15.4659224
161 -0.2046166 16.1111797
> 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/7bkmb1321796967.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/8xnxw1321796967.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/987rl1321796967.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/10140g1321796967.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/118t541321796967.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/12ksv41321796967.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/13iuk61321796967.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/14nrcz1321796967.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/15bzb91321796967.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/16m85v1321796967.tab")
+ }
>
> try(system("convert tmp/1zl9u1321796967.ps tmp/1zl9u1321796967.png",intern=TRUE))
character(0)
> try(system("convert tmp/2cudf1321796967.ps tmp/2cudf1321796967.png",intern=TRUE))
character(0)
> try(system("convert tmp/3e3sp1321796967.ps tmp/3e3sp1321796967.png",intern=TRUE))
character(0)
> try(system("convert tmp/4wrmq1321796967.ps tmp/4wrmq1321796967.png",intern=TRUE))
character(0)
> try(system("convert tmp/5jpzg1321796967.ps tmp/5jpzg1321796967.png",intern=TRUE))
character(0)
> try(system("convert tmp/6os751321796967.ps tmp/6os751321796967.png",intern=TRUE))
character(0)
> try(system("convert tmp/7bkmb1321796967.ps tmp/7bkmb1321796967.png",intern=TRUE))
character(0)
> try(system("convert tmp/8xnxw1321796967.ps tmp/8xnxw1321796967.png",intern=TRUE))
character(0)
> try(system("convert tmp/987rl1321796967.ps tmp/987rl1321796967.png",intern=TRUE))
character(0)
> try(system("convert tmp/10140g1321796967.ps tmp/10140g1321796967.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.639 0.553 5.326