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
+ ,41
+ ,38
+ ,14
+ ,12
+ ,2
+ ,39
+ ,32
+ ,18
+ ,11
+ ,2
+ ,30
+ ,35
+ ,11
+ ,14
+ ,1
+ ,31
+ ,33
+ ,12
+ ,12
+ ,2
+ ,34
+ ,37
+ ,16
+ ,21
+ ,2
+ ,35
+ ,29
+ ,18
+ ,12
+ ,2
+ ,39
+ ,31
+ ,14
+ ,22
+ ,2
+ ,34
+ ,36
+ ,14
+ ,11
+ ,2
+ ,36
+ ,35
+ ,15
+ ,10
+ ,2
+ ,37
+ ,38
+ ,15
+ ,13
+ ,1
+ ,38
+ ,31
+ ,17
+ ,10
+ ,2
+ ,36
+ ,34
+ ,19
+ ,8
+ ,1
+ ,38
+ ,35
+ ,10
+ ,15
+ ,2
+ ,39
+ ,38
+ ,16
+ ,14
+ ,2
+ ,33
+ ,37
+ ,18
+ ,10
+ ,1
+ ,32
+ ,33
+ ,14
+ ,14
+ ,1
+ ,36
+ ,32
+ ,14
+ ,14
+ ,2
+ ,38
+ ,38
+ ,17
+ ,11
+ ,1
+ ,39
+ ,38
+ ,14
+ ,10
+ ,2
+ ,32
+ ,32
+ ,16
+ ,13
+ ,1
+ ,32
+ ,33
+ ,18
+ ,7
+ ,2
+ ,31
+ ,31
+ ,11
+ ,14
+ ,2
+ ,39
+ ,38
+ ,14
+ ,12
+ ,2
+ ,37
+ ,39
+ ,12
+ ,14
+ ,1
+ ,39
+ ,32
+ ,17
+ ,11
+ ,2
+ ,41
+ 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+ ,dim=c(5
+ ,162)
+ ,dimnames=list(c('Gender'
+ ,'Connected'
+ ,'Separate'
+ ,'Happiness'
+ ,'Depression')
+ ,1:162))
> y <- array(NA,dim=c(5,162),dimnames=list(c('Gender','Connected','Separate','Happiness','Depression'),1:162))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '4'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
Happiness Gender Connected Separate Depression
1 14 2 41 38 12
2 18 2 39 32 11
3 11 2 30 35 14
4 12 1 31 33 12
5 16 2 34 37 21
6 18 2 35 29 12
7 14 2 39 31 22
8 14 2 34 36 11
9 15 2 36 35 10
10 15 2 37 38 13
11 17 1 38 31 10
12 19 2 36 34 8
13 10 1 38 35 15
14 16 2 39 38 14
15 18 2 33 37 10
16 14 1 32 33 14
17 14 1 36 32 14
18 17 2 38 38 11
19 14 1 39 38 10
20 16 2 32 32 13
21 18 1 32 33 7
22 11 2 31 31 14
23 14 2 39 38 12
24 12 2 37 39 14
25 17 1 39 32 11
26 9 2 41 32 9
27 16 1 36 35 11
28 14 2 33 37 15
29 15 2 33 33 14
30 11 1 34 33 13
31 16 2 31 28 9
32 13 1 27 32 15
33 17 2 37 31 10
34 15 2 34 37 11
35 14 1 34 30 13
36 16 1 32 33 8
37 9 1 29 31 20
38 15 1 36 33 12
39 17 2 29 31 10
40 13 1 35 33 10
41 15 1 37 32 9
42 16 2 34 33 14
43 16 1 38 32 8
44 12 1 35 33 14
45 12 2 38 28 11
46 11 2 37 35 13
47 15 2 38 39 9
48 15 2 33 34 11
49 17 2 36 38 15
50 13 1 38 32 11
51 16 2 32 38 10
52 14 1 32 30 14
53 11 1 32 33 18
54 12 2 34 38 14
55 12 1 32 32 11
56 15 2 37 32 12
57 16 2 39 34 13
58 15 2 29 34 9
59 12 1 37 36 10
60 12 2 35 34 15
61 8 1 30 28 20
62 13 1 38 34 12
63 11 2 34 35 12
64 14 2 31 35 14
65 15 2 34 31 13
66 10 1 35 37 11
67 11 2 36 35 17
68 12 1 30 27 12
69 15 2 39 40 13
70 15 1 35 37 14
71 14 1 38 36 13
72 16 2 31 38 15
73 15 2 34 39 13
74 15 1 38 41 10
75 13 1 34 27 11
76 12 2 39 30 19
77 17 2 37 37 13
78 13 2 34 31 17
79 15 1 28 31 13
80 13 1 37 27 9
81 15 1 33 36 11
82 16 1 37 38 10
83 15 2 35 37 9
84 16 1 37 33 12
85 15 2 32 34 12
86 14 2 33 31 13
87 15 1 38 39 13
88 14 2 33 34 12
89 13 2 29 32 15
90 7 2 33 33 22
91 17 2 31 36 13
92 13 2 36 32 15
93 15 2 35 41 13
94 14 2 32 28 15
95 13 2 29 30 10
96 16 2 39 36 11
97 12 2 37 35 16
98 14 2 35 31 11
99 17 1 37 34 11
100 15 1 32 36 10
101 17 2 38 36 10
102 12 1 37 35 16
103 16 2 36 37 12
104 11 1 32 28 11
105 15 2 33 39 16
106 9 1 40 32 19
107 16 2 38 35 11
108 15 1 41 39 16
109 10 1 36 35 15
110 10 2 43 42 24
111 15 2 30 34 14
112 11 2 31 33 15
113 13 2 32 41 11
114 14 1 32 33 15
115 18 2 37 34 12
116 16 1 37 32 10
117 14 2 33 40 14
118 14 2 34 40 13
119 14 2 33 35 9
120 14 2 38 36 15
121 12 2 33 37 15
122 14 2 31 27 14
123 15 2 38 39 11
124 15 2 37 38 8
125 15 2 33 31 11
126 13 2 31 33 11
127 17 1 39 32 8
128 17 2 44 39 10
129 19 2 33 36 11
130 15 2 35 33 13
131 13 1 32 33 11
132 9 1 28 32 20
133 15 2 40 37 10
134 15 1 27 30 15
135 15 1 37 38 12
136 16 2 32 29 14
137 11 1 28 22 23
138 14 1 34 35 14
139 11 2 30 35 16
140 15 2 35 34 11
141 13 1 31 35 12
142 15 2 32 34 10
143 16 1 30 34 14
144 14 2 30 35 12
145 15 1 31 23 12
146 16 2 40 31 11
147 16 2 32 27 12
148 11 1 36 36 13
149 12 1 32 31 11
150 9 1 35 32 19
151 16 2 38 39 12
152 13 2 42 37 17
153 16 1 34 38 9
154 12 2 35 39 12
155 9 2 35 34 19
156 13 2 33 31 18
157 13 2 36 32 15
158 14 2 32 37 14
159 19 2 33 36 11
160 13 2 34 32 9
161 12 2 32 35 18
162 13 2 34 36 16
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Gender Connected Separate Depression
15.51618 0.92197 0.03285 0.03139 -0.40119
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-7.1006 -1.2720 0.0919 1.2562 4.7868
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 15.51618 2.01191 7.712 1.33e-12 ***
Gender 0.92197 0.32083 2.874 0.00462 **
Connected 0.03285 0.04837 0.679 0.49807
Separate 0.03139 0.04708 0.667 0.50596
Depression -0.40119 0.04818 -8.327 3.83e-14 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.916 on 157 degrees of freedom
Multiple R-squared: 0.3447, Adjusted R-squared: 0.328
F-statistic: 20.65 on 4 and 157 DF, p-value: 1.095e-13
> 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.92080723 0.1583855383 0.0791927691
[2,] 0.85111409 0.2977718150 0.1488859075
[3,] 0.77685684 0.4462863100 0.2231431550
[4,] 0.74158956 0.5168208863 0.2584104431
[5,] 0.81373274 0.3725345191 0.1862672595
[6,] 0.86009259 0.2798148231 0.1399074116
[7,] 0.83150596 0.3369880736 0.1684940368
[8,] 0.88582213 0.2283557425 0.1141778712
[9,] 0.87243300 0.2551340023 0.1275670011
[10,] 0.82794828 0.3441034321 0.1720517161
[11,] 0.79880623 0.4023875434 0.2011937717
[12,] 0.74364135 0.5127173086 0.2563586543
[13,] 0.68548887 0.6290222683 0.3145111341
[14,] 0.75357771 0.4928445837 0.2464222919
[15,] 0.90187625 0.1962474920 0.0981237460
[16,] 0.89085222 0.2182955657 0.1091477829
[17,] 0.89370683 0.2125863335 0.1062931667
[18,] 0.88399112 0.2320177560 0.1160088780
[19,] 0.99950911 0.0009817724 0.0004908862
[20,] 0.99935434 0.0012913298 0.0006456649
[21,] 0.99893840 0.0021231921 0.0010615960
[22,] 0.99837722 0.0032455685 0.0016227842
[23,] 0.99892095 0.0021580984 0.0010790492
[24,] 0.99829436 0.0034112809 0.0017056404
[25,] 0.99740048 0.0051990381 0.0025995190
[26,] 0.99655473 0.0068905410 0.0034452705
[27,] 0.99482845 0.0103430932 0.0051715466
[28,] 0.99255986 0.0148802864 0.0074401432
[29,] 0.98975834 0.0204833133 0.0102416567
[30,] 0.99041015 0.0191796957 0.0095898479
[31,] 0.98741347 0.0251730686 0.0125865343
[32,] 0.98512249 0.0297550111 0.0148775056
[33,] 0.98346039 0.0330792245 0.0165396122
[34,] 0.97730264 0.0453947167 0.0226973583
[35,] 0.97541276 0.0491744873 0.0245872437
[36,] 0.96756175 0.0648764940 0.0324382470
[37,] 0.96114291 0.0777141814 0.0388570907
[38,] 0.97881574 0.0423685125 0.0211842563
[39,] 0.98924347 0.0215130585 0.0107565293
[40,] 0.98639174 0.0272165180 0.0136082590
[41,] 0.98149768 0.0370046304 0.0185023152
[42,] 0.98833008 0.0233398347 0.0116699174
[43,] 0.98586334 0.0282733112 0.0141366556
[44,] 0.98100854 0.0379829197 0.0189914598
[45,] 0.97634482 0.0473103548 0.0236551774
[46,] 0.97008389 0.0598322161 0.0299161080
[47,] 0.97177942 0.0564411505 0.0282205753
[48,] 0.97290538 0.0541892416 0.0270946208
[49,] 0.96456906 0.0708618862 0.0354309431
[50,] 0.95980201 0.0803959733 0.0401979866
[51,] 0.95041292 0.0991741573 0.0495870787
[52,] 0.95908760 0.0818247928 0.0409123964
[53,] 0.95710936 0.0857812726 0.0428906363
[54,] 0.96429897 0.0714020570 0.0357010285
[55,] 0.95637663 0.0872467483 0.0436233741
[56,] 0.97878773 0.0424245419 0.0212122709
[57,] 0.97212854 0.0557429193 0.0278714596
[58,] 0.96489989 0.0702002297 0.0351001148
[59,] 0.98763308 0.0247338440 0.0123669220
[60,] 0.98736235 0.0252752918 0.0126376459
[61,] 0.98606456 0.0278708797 0.0139354398
[62,] 0.98164758 0.0367048376 0.0183524188
[63,] 0.98178485 0.0364303078 0.0182151539
[64,] 0.97642011 0.0471597746 0.0235798873
[65,] 0.98022764 0.0395447187 0.0197723594
[66,] 0.97452269 0.0509546101 0.0254773050
[67,] 0.96747182 0.0650563589 0.0325281794
[68,] 0.96176071 0.0764785741 0.0382392871
[69,] 0.95154263 0.0969147346 0.0484573673
[70,] 0.95864477 0.0827104687 0.0413552343
[71,] 0.94824168 0.1035166487 0.0517583243
[72,] 0.94687196 0.1062560771 0.0531280386
[73,] 0.95099235 0.0980153052 0.0490076526
[74,] 0.93998728 0.1200254498 0.0600127249
[75,] 0.93002414 0.1399517174 0.0699758587
[76,] 0.91918091 0.1616381773 0.0808190887
[77,] 0.92025720 0.1594856096 0.0797428048
[78,] 0.90232260 0.1953547963 0.0976773981
[79,] 0.88110679 0.2377864296 0.1188932148
[80,] 0.86617341 0.2676531745 0.1338265872
[81,] 0.84326232 0.3134753534 0.1567376767
[82,] 0.81479697 0.3704060554 0.1852030277
[83,] 0.88083282 0.2383343598 0.1191671799
[84,] 0.90523164 0.1895367167 0.0947683584
[85,] 0.88575832 0.2284833516 0.1142416758
[86,] 0.86455035 0.2708992923 0.1354496461
[87,] 0.84121802 0.3175639629 0.1587819815
[88,] 0.85224856 0.2955028840 0.1477514420
[89,] 0.82595651 0.3480869836 0.1740434918
[90,] 0.80756142 0.3848771677 0.1924385839
[91,] 0.78798920 0.4240216022 0.2120108011
[92,] 0.81388679 0.3722264198 0.1861132099
[93,] 0.78181267 0.4363746619 0.2181873310
[94,] 0.75996905 0.4800619046 0.2400309523
[95,] 0.72215361 0.5556927801 0.2778463901
[96,] 0.69585004 0.6082999179 0.3041499589
[97,] 0.77219581 0.4556083811 0.2278041906
[98,] 0.78345839 0.4330832108 0.2165416054
[99,] 0.81009743 0.3798051320 0.1899025660
[100,] 0.77828516 0.4434296745 0.2217148372
[101,] 0.80208246 0.3958350875 0.1979175438
[102,] 0.84271378 0.3145724441 0.1572862221
[103,] 0.81580778 0.3683844393 0.1841922196
[104,] 0.80195977 0.3960804695 0.1980402347
[105,] 0.81819608 0.3636078301 0.1818039150
[106,] 0.81678344 0.3664331233 0.1832165617
[107,] 0.80018028 0.3996394467 0.1998197233
[108,] 0.85893816 0.2821236897 0.1410618448
[109,] 0.83637321 0.3272535889 0.1636267945
[110,] 0.80673685 0.3865263042 0.1932631521
[111,] 0.77072216 0.4585556887 0.2292778443
[112,] 0.77324249 0.4535150193 0.2267575097
[113,] 0.73519780 0.5296044067 0.2648022034
[114,] 0.70793671 0.5841265809 0.2920632905
[115,] 0.66147383 0.6770523485 0.3385261743
[116,] 0.61039906 0.7792018794 0.3896009397
[117,] 0.58933229 0.8213354278 0.4106677139
[118,] 0.53728675 0.9254265075 0.4627132537
[119,] 0.56723273 0.8655345302 0.4327672651
[120,] 0.52623619 0.9475276283 0.4737638142
[121,] 0.50724665 0.9855066941 0.4927533470
[122,] 0.67890070 0.6421985997 0.3210992999
[123,] 0.63007905 0.7398419089 0.3699209545
[124,] 0.60531079 0.7893784174 0.3946892087
[125,] 0.58669066 0.8266186733 0.4133093367
[126,] 0.52692212 0.9461557544 0.4730778772
[127,] 0.53651595 0.9269680953 0.4634840476
[128,] 0.51149437 0.9770112685 0.4885056343
[129,] 0.50887985 0.9822403085 0.4911201543
[130,] 0.49542497 0.9908499435 0.5045750282
[131,] 0.46071171 0.9214234148 0.5392882926
[132,] 0.45142706 0.9028541198 0.5485729401
[133,] 0.38120542 0.7624108346 0.6187945827
[134,] 0.31994797 0.6398959387 0.6800520306
[135,] 0.26748071 0.5349614262 0.7325192869
[136,] 0.42836301 0.8567260250 0.5716369875
[137,] 0.36349447 0.7269889446 0.6365055277
[138,] 0.35790464 0.7158092856 0.6420953572
[139,] 0.29510485 0.5902096977 0.7048951512
[140,] 0.29658054 0.5931610773 0.7034194614
[141,] 0.26368186 0.5273637117 0.7363181441
[142,] 0.20762729 0.4152545705 0.7923727148
[143,] 0.15963569 0.3192713717 0.8403643141
[144,] 0.12280505 0.2456101081 0.8771949460
[145,] 0.17400719 0.3480143875 0.8259928062
[146,] 0.10292591 0.2058518133 0.8970740934
[147,] 0.08298703 0.1659740603 0.9170129699
> postscript(file="/var/wessaorg/rcomp/tmp/1brqa1323802152.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/2cu3t1323802152.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/3ezrm1323802152.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/4ncvi1323802152.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/5lq6s1323802152.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
-1.085304439 2.767518244 -2.827408611 -1.677907414 4.786778252 3.394270524
7 8 9 10 11 12
3.212039754 -1.193776812 -0.629284609 0.447289356 2.352527238 2.599713307
13 14 15 16 17 18
-2.767046795 1.782783642 2.406492821 1.091630913 0.991617403 1.612051192
19 20 21 22 23 24
-0.900025811 1.799855915 2.283272055 -2.734713883 -1.019604603 -2.182902684
25 26 27 28 29 30
2.689485281 -7.100569837 1.693876550 0.412463434 1.136813958 -2.375263045
31 32 33 34 35 36
0.353473989 0.688460787 1.463410119 -0.225162974 0.718895440 0.684466178
37 38 39 40 41 42
-1.339882274 1.157842996 1.726209463 -1.611695331 -0.047203128 2.103964040
43 44 45 46 47 48
0.518752832 -1.006918841 -3.074087191 -3.458552160 -1.221723214 -0.098154571
49 50 51 52 53 54
3.282527519 -1.277664801 0.407956578 1.185789398 -0.303592596 -2.052966768
55 56 57 58 59 60
-2.080565293 0.234412203 1.507134166 -0.769143144 -2.771553652 -1.559077917
61 62 63 64 65 66
-2.278573707 -0.939243001 -3.761196528 0.139741471 0.765542241 -4.336045855
67 68 69 70 71 72
-1.820925751 -1.456740526 0.318817196 1.867536513 0.399178798 2.446777109
73 74 75 76 77 78
0.514452948 0.038665622 -0.989334321 0.039843548 2.478675517 0.370318731
79 80 81 82 83 84
1.884608786 -1.890272320 0.761040143 1.165674025 -1.060401137 2.124993078
85 86 87 88 89 90
0.335889469 -0.201607841 1.305020313 -0.696960449 -0.299206086 -3.653633061
91 92 93 94 95 96
2.707161187 -0.529155512 0.418830707 0.727788807 -2.242404375 0.641973598
97 98 99 100 101 102
-1.254969792 -1.069695922 2.692412794 0.392695938 1.273629393 -0.333002755
103 104 105 106 107 108
1.110331313 -2.955020646 1.750885233 -2.133811656 0.706209677 2.410052927
109 110 111 112 113 114
-2.701346959 -0.462219451 1.203977550 -2.396292083 -2.285007785 1.492825036
115 116 117 118 119 120
3.171639879 1.353990995 -0.082889173 -0.516933214 -1.931928978 0.279600006
121 122 123 124 125 126
-1.587536566 0.390830764 -0.419334969 -1.558681257 -0.003996086 -2.001068574
127 128 129 130 131 132
1.485902914 0.982371400 3.839073106 0.669920000 -1.111951454 -1.338418518
133 134 135 136 137 138
-0.823456604 2.751233111 0.968062270 2.295208523 2.179025466 0.963158754
139 140 141 142 143 144
-2.025020366 -0.163854407 -0.740679737 -0.466498776 3.125944588 -0.629796856
145 146 147 148 149 150
1.635954202 0.766054488 1.555592601 -2.535121366 -2.049179131 -1.969562066
151 152 153 154 155 156
0.981859153 -0.080797582 0.863029656 -2.919591093 -2.954301427 0.804362772
157 158 159 160 161 162
-0.529155512 0.044119230 3.839073106 -2.870620411 -0.288331957 -0.187806200
> postscript(file="/var/wessaorg/rcomp/tmp/688ss1323802152.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 -1.085304439 NA
1 2.767518244 -1.085304439
2 -2.827408611 2.767518244
3 -1.677907414 -2.827408611
4 4.786778252 -1.677907414
5 3.394270524 4.786778252
6 3.212039754 3.394270524
7 -1.193776812 3.212039754
8 -0.629284609 -1.193776812
9 0.447289356 -0.629284609
10 2.352527238 0.447289356
11 2.599713307 2.352527238
12 -2.767046795 2.599713307
13 1.782783642 -2.767046795
14 2.406492821 1.782783642
15 1.091630913 2.406492821
16 0.991617403 1.091630913
17 1.612051192 0.991617403
18 -0.900025811 1.612051192
19 1.799855915 -0.900025811
20 2.283272055 1.799855915
21 -2.734713883 2.283272055
22 -1.019604603 -2.734713883
23 -2.182902684 -1.019604603
24 2.689485281 -2.182902684
25 -7.100569837 2.689485281
26 1.693876550 -7.100569837
27 0.412463434 1.693876550
28 1.136813958 0.412463434
29 -2.375263045 1.136813958
30 0.353473989 -2.375263045
31 0.688460787 0.353473989
32 1.463410119 0.688460787
33 -0.225162974 1.463410119
34 0.718895440 -0.225162974
35 0.684466178 0.718895440
36 -1.339882274 0.684466178
37 1.157842996 -1.339882274
38 1.726209463 1.157842996
39 -1.611695331 1.726209463
40 -0.047203128 -1.611695331
41 2.103964040 -0.047203128
42 0.518752832 2.103964040
43 -1.006918841 0.518752832
44 -3.074087191 -1.006918841
45 -3.458552160 -3.074087191
46 -1.221723214 -3.458552160
47 -0.098154571 -1.221723214
48 3.282527519 -0.098154571
49 -1.277664801 3.282527519
50 0.407956578 -1.277664801
51 1.185789398 0.407956578
52 -0.303592596 1.185789398
53 -2.052966768 -0.303592596
54 -2.080565293 -2.052966768
55 0.234412203 -2.080565293
56 1.507134166 0.234412203
57 -0.769143144 1.507134166
58 -2.771553652 -0.769143144
59 -1.559077917 -2.771553652
60 -2.278573707 -1.559077917
61 -0.939243001 -2.278573707
62 -3.761196528 -0.939243001
63 0.139741471 -3.761196528
64 0.765542241 0.139741471
65 -4.336045855 0.765542241
66 -1.820925751 -4.336045855
67 -1.456740526 -1.820925751
68 0.318817196 -1.456740526
69 1.867536513 0.318817196
70 0.399178798 1.867536513
71 2.446777109 0.399178798
72 0.514452948 2.446777109
73 0.038665622 0.514452948
74 -0.989334321 0.038665622
75 0.039843548 -0.989334321
76 2.478675517 0.039843548
77 0.370318731 2.478675517
78 1.884608786 0.370318731
79 -1.890272320 1.884608786
80 0.761040143 -1.890272320
81 1.165674025 0.761040143
82 -1.060401137 1.165674025
83 2.124993078 -1.060401137
84 0.335889469 2.124993078
85 -0.201607841 0.335889469
86 1.305020313 -0.201607841
87 -0.696960449 1.305020313
88 -0.299206086 -0.696960449
89 -3.653633061 -0.299206086
90 2.707161187 -3.653633061
91 -0.529155512 2.707161187
92 0.418830707 -0.529155512
93 0.727788807 0.418830707
94 -2.242404375 0.727788807
95 0.641973598 -2.242404375
96 -1.254969792 0.641973598
97 -1.069695922 -1.254969792
98 2.692412794 -1.069695922
99 0.392695938 2.692412794
100 1.273629393 0.392695938
101 -0.333002755 1.273629393
102 1.110331313 -0.333002755
103 -2.955020646 1.110331313
104 1.750885233 -2.955020646
105 -2.133811656 1.750885233
106 0.706209677 -2.133811656
107 2.410052927 0.706209677
108 -2.701346959 2.410052927
109 -0.462219451 -2.701346959
110 1.203977550 -0.462219451
111 -2.396292083 1.203977550
112 -2.285007785 -2.396292083
113 1.492825036 -2.285007785
114 3.171639879 1.492825036
115 1.353990995 3.171639879
116 -0.082889173 1.353990995
117 -0.516933214 -0.082889173
118 -1.931928978 -0.516933214
119 0.279600006 -1.931928978
120 -1.587536566 0.279600006
121 0.390830764 -1.587536566
122 -0.419334969 0.390830764
123 -1.558681257 -0.419334969
124 -0.003996086 -1.558681257
125 -2.001068574 -0.003996086
126 1.485902914 -2.001068574
127 0.982371400 1.485902914
128 3.839073106 0.982371400
129 0.669920000 3.839073106
130 -1.111951454 0.669920000
131 -1.338418518 -1.111951454
132 -0.823456604 -1.338418518
133 2.751233111 -0.823456604
134 0.968062270 2.751233111
135 2.295208523 0.968062270
136 2.179025466 2.295208523
137 0.963158754 2.179025466
138 -2.025020366 0.963158754
139 -0.163854407 -2.025020366
140 -0.740679737 -0.163854407
141 -0.466498776 -0.740679737
142 3.125944588 -0.466498776
143 -0.629796856 3.125944588
144 1.635954202 -0.629796856
145 0.766054488 1.635954202
146 1.555592601 0.766054488
147 -2.535121366 1.555592601
148 -2.049179131 -2.535121366
149 -1.969562066 -2.049179131
150 0.981859153 -1.969562066
151 -0.080797582 0.981859153
152 0.863029656 -0.080797582
153 -2.919591093 0.863029656
154 -2.954301427 -2.919591093
155 0.804362772 -2.954301427
156 -0.529155512 0.804362772
157 0.044119230 -0.529155512
158 3.839073106 0.044119230
159 -2.870620411 3.839073106
160 -0.288331957 -2.870620411
161 -0.187806200 -0.288331957
162 NA -0.187806200
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.767518244 -1.085304439
[2,] -2.827408611 2.767518244
[3,] -1.677907414 -2.827408611
[4,] 4.786778252 -1.677907414
[5,] 3.394270524 4.786778252
[6,] 3.212039754 3.394270524
[7,] -1.193776812 3.212039754
[8,] -0.629284609 -1.193776812
[9,] 0.447289356 -0.629284609
[10,] 2.352527238 0.447289356
[11,] 2.599713307 2.352527238
[12,] -2.767046795 2.599713307
[13,] 1.782783642 -2.767046795
[14,] 2.406492821 1.782783642
[15,] 1.091630913 2.406492821
[16,] 0.991617403 1.091630913
[17,] 1.612051192 0.991617403
[18,] -0.900025811 1.612051192
[19,] 1.799855915 -0.900025811
[20,] 2.283272055 1.799855915
[21,] -2.734713883 2.283272055
[22,] -1.019604603 -2.734713883
[23,] -2.182902684 -1.019604603
[24,] 2.689485281 -2.182902684
[25,] -7.100569837 2.689485281
[26,] 1.693876550 -7.100569837
[27,] 0.412463434 1.693876550
[28,] 1.136813958 0.412463434
[29,] -2.375263045 1.136813958
[30,] 0.353473989 -2.375263045
[31,] 0.688460787 0.353473989
[32,] 1.463410119 0.688460787
[33,] -0.225162974 1.463410119
[34,] 0.718895440 -0.225162974
[35,] 0.684466178 0.718895440
[36,] -1.339882274 0.684466178
[37,] 1.157842996 -1.339882274
[38,] 1.726209463 1.157842996
[39,] -1.611695331 1.726209463
[40,] -0.047203128 -1.611695331
[41,] 2.103964040 -0.047203128
[42,] 0.518752832 2.103964040
[43,] -1.006918841 0.518752832
[44,] -3.074087191 -1.006918841
[45,] -3.458552160 -3.074087191
[46,] -1.221723214 -3.458552160
[47,] -0.098154571 -1.221723214
[48,] 3.282527519 -0.098154571
[49,] -1.277664801 3.282527519
[50,] 0.407956578 -1.277664801
[51,] 1.185789398 0.407956578
[52,] -0.303592596 1.185789398
[53,] -2.052966768 -0.303592596
[54,] -2.080565293 -2.052966768
[55,] 0.234412203 -2.080565293
[56,] 1.507134166 0.234412203
[57,] -0.769143144 1.507134166
[58,] -2.771553652 -0.769143144
[59,] -1.559077917 -2.771553652
[60,] -2.278573707 -1.559077917
[61,] -0.939243001 -2.278573707
[62,] -3.761196528 -0.939243001
[63,] 0.139741471 -3.761196528
[64,] 0.765542241 0.139741471
[65,] -4.336045855 0.765542241
[66,] -1.820925751 -4.336045855
[67,] -1.456740526 -1.820925751
[68,] 0.318817196 -1.456740526
[69,] 1.867536513 0.318817196
[70,] 0.399178798 1.867536513
[71,] 2.446777109 0.399178798
[72,] 0.514452948 2.446777109
[73,] 0.038665622 0.514452948
[74,] -0.989334321 0.038665622
[75,] 0.039843548 -0.989334321
[76,] 2.478675517 0.039843548
[77,] 0.370318731 2.478675517
[78,] 1.884608786 0.370318731
[79,] -1.890272320 1.884608786
[80,] 0.761040143 -1.890272320
[81,] 1.165674025 0.761040143
[82,] -1.060401137 1.165674025
[83,] 2.124993078 -1.060401137
[84,] 0.335889469 2.124993078
[85,] -0.201607841 0.335889469
[86,] 1.305020313 -0.201607841
[87,] -0.696960449 1.305020313
[88,] -0.299206086 -0.696960449
[89,] -3.653633061 -0.299206086
[90,] 2.707161187 -3.653633061
[91,] -0.529155512 2.707161187
[92,] 0.418830707 -0.529155512
[93,] 0.727788807 0.418830707
[94,] -2.242404375 0.727788807
[95,] 0.641973598 -2.242404375
[96,] -1.254969792 0.641973598
[97,] -1.069695922 -1.254969792
[98,] 2.692412794 -1.069695922
[99,] 0.392695938 2.692412794
[100,] 1.273629393 0.392695938
[101,] -0.333002755 1.273629393
[102,] 1.110331313 -0.333002755
[103,] -2.955020646 1.110331313
[104,] 1.750885233 -2.955020646
[105,] -2.133811656 1.750885233
[106,] 0.706209677 -2.133811656
[107,] 2.410052927 0.706209677
[108,] -2.701346959 2.410052927
[109,] -0.462219451 -2.701346959
[110,] 1.203977550 -0.462219451
[111,] -2.396292083 1.203977550
[112,] -2.285007785 -2.396292083
[113,] 1.492825036 -2.285007785
[114,] 3.171639879 1.492825036
[115,] 1.353990995 3.171639879
[116,] -0.082889173 1.353990995
[117,] -0.516933214 -0.082889173
[118,] -1.931928978 -0.516933214
[119,] 0.279600006 -1.931928978
[120,] -1.587536566 0.279600006
[121,] 0.390830764 -1.587536566
[122,] -0.419334969 0.390830764
[123,] -1.558681257 -0.419334969
[124,] -0.003996086 -1.558681257
[125,] -2.001068574 -0.003996086
[126,] 1.485902914 -2.001068574
[127,] 0.982371400 1.485902914
[128,] 3.839073106 0.982371400
[129,] 0.669920000 3.839073106
[130,] -1.111951454 0.669920000
[131,] -1.338418518 -1.111951454
[132,] -0.823456604 -1.338418518
[133,] 2.751233111 -0.823456604
[134,] 0.968062270 2.751233111
[135,] 2.295208523 0.968062270
[136,] 2.179025466 2.295208523
[137,] 0.963158754 2.179025466
[138,] -2.025020366 0.963158754
[139,] -0.163854407 -2.025020366
[140,] -0.740679737 -0.163854407
[141,] -0.466498776 -0.740679737
[142,] 3.125944588 -0.466498776
[143,] -0.629796856 3.125944588
[144,] 1.635954202 -0.629796856
[145,] 0.766054488 1.635954202
[146,] 1.555592601 0.766054488
[147,] -2.535121366 1.555592601
[148,] -2.049179131 -2.535121366
[149,] -1.969562066 -2.049179131
[150,] 0.981859153 -1.969562066
[151,] -0.080797582 0.981859153
[152,] 0.863029656 -0.080797582
[153,] -2.919591093 0.863029656
[154,] -2.954301427 -2.919591093
[155,] 0.804362772 -2.954301427
[156,] -0.529155512 0.804362772
[157,] 0.044119230 -0.529155512
[158,] 3.839073106 0.044119230
[159,] -2.870620411 3.839073106
[160,] -0.288331957 -2.870620411
[161,] -0.187806200 -0.288331957
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.767518244 -1.085304439
2 -2.827408611 2.767518244
3 -1.677907414 -2.827408611
4 4.786778252 -1.677907414
5 3.394270524 4.786778252
6 3.212039754 3.394270524
7 -1.193776812 3.212039754
8 -0.629284609 -1.193776812
9 0.447289356 -0.629284609
10 2.352527238 0.447289356
11 2.599713307 2.352527238
12 -2.767046795 2.599713307
13 1.782783642 -2.767046795
14 2.406492821 1.782783642
15 1.091630913 2.406492821
16 0.991617403 1.091630913
17 1.612051192 0.991617403
18 -0.900025811 1.612051192
19 1.799855915 -0.900025811
20 2.283272055 1.799855915
21 -2.734713883 2.283272055
22 -1.019604603 -2.734713883
23 -2.182902684 -1.019604603
24 2.689485281 -2.182902684
25 -7.100569837 2.689485281
26 1.693876550 -7.100569837
27 0.412463434 1.693876550
28 1.136813958 0.412463434
29 -2.375263045 1.136813958
30 0.353473989 -2.375263045
31 0.688460787 0.353473989
32 1.463410119 0.688460787
33 -0.225162974 1.463410119
34 0.718895440 -0.225162974
35 0.684466178 0.718895440
36 -1.339882274 0.684466178
37 1.157842996 -1.339882274
38 1.726209463 1.157842996
39 -1.611695331 1.726209463
40 -0.047203128 -1.611695331
41 2.103964040 -0.047203128
42 0.518752832 2.103964040
43 -1.006918841 0.518752832
44 -3.074087191 -1.006918841
45 -3.458552160 -3.074087191
46 -1.221723214 -3.458552160
47 -0.098154571 -1.221723214
48 3.282527519 -0.098154571
49 -1.277664801 3.282527519
50 0.407956578 -1.277664801
51 1.185789398 0.407956578
52 -0.303592596 1.185789398
53 -2.052966768 -0.303592596
54 -2.080565293 -2.052966768
55 0.234412203 -2.080565293
56 1.507134166 0.234412203
57 -0.769143144 1.507134166
58 -2.771553652 -0.769143144
59 -1.559077917 -2.771553652
60 -2.278573707 -1.559077917
61 -0.939243001 -2.278573707
62 -3.761196528 -0.939243001
63 0.139741471 -3.761196528
64 0.765542241 0.139741471
65 -4.336045855 0.765542241
66 -1.820925751 -4.336045855
67 -1.456740526 -1.820925751
68 0.318817196 -1.456740526
69 1.867536513 0.318817196
70 0.399178798 1.867536513
71 2.446777109 0.399178798
72 0.514452948 2.446777109
73 0.038665622 0.514452948
74 -0.989334321 0.038665622
75 0.039843548 -0.989334321
76 2.478675517 0.039843548
77 0.370318731 2.478675517
78 1.884608786 0.370318731
79 -1.890272320 1.884608786
80 0.761040143 -1.890272320
81 1.165674025 0.761040143
82 -1.060401137 1.165674025
83 2.124993078 -1.060401137
84 0.335889469 2.124993078
85 -0.201607841 0.335889469
86 1.305020313 -0.201607841
87 -0.696960449 1.305020313
88 -0.299206086 -0.696960449
89 -3.653633061 -0.299206086
90 2.707161187 -3.653633061
91 -0.529155512 2.707161187
92 0.418830707 -0.529155512
93 0.727788807 0.418830707
94 -2.242404375 0.727788807
95 0.641973598 -2.242404375
96 -1.254969792 0.641973598
97 -1.069695922 -1.254969792
98 2.692412794 -1.069695922
99 0.392695938 2.692412794
100 1.273629393 0.392695938
101 -0.333002755 1.273629393
102 1.110331313 -0.333002755
103 -2.955020646 1.110331313
104 1.750885233 -2.955020646
105 -2.133811656 1.750885233
106 0.706209677 -2.133811656
107 2.410052927 0.706209677
108 -2.701346959 2.410052927
109 -0.462219451 -2.701346959
110 1.203977550 -0.462219451
111 -2.396292083 1.203977550
112 -2.285007785 -2.396292083
113 1.492825036 -2.285007785
114 3.171639879 1.492825036
115 1.353990995 3.171639879
116 -0.082889173 1.353990995
117 -0.516933214 -0.082889173
118 -1.931928978 -0.516933214
119 0.279600006 -1.931928978
120 -1.587536566 0.279600006
121 0.390830764 -1.587536566
122 -0.419334969 0.390830764
123 -1.558681257 -0.419334969
124 -0.003996086 -1.558681257
125 -2.001068574 -0.003996086
126 1.485902914 -2.001068574
127 0.982371400 1.485902914
128 3.839073106 0.982371400
129 0.669920000 3.839073106
130 -1.111951454 0.669920000
131 -1.338418518 -1.111951454
132 -0.823456604 -1.338418518
133 2.751233111 -0.823456604
134 0.968062270 2.751233111
135 2.295208523 0.968062270
136 2.179025466 2.295208523
137 0.963158754 2.179025466
138 -2.025020366 0.963158754
139 -0.163854407 -2.025020366
140 -0.740679737 -0.163854407
141 -0.466498776 -0.740679737
142 3.125944588 -0.466498776
143 -0.629796856 3.125944588
144 1.635954202 -0.629796856
145 0.766054488 1.635954202
146 1.555592601 0.766054488
147 -2.535121366 1.555592601
148 -2.049179131 -2.535121366
149 -1.969562066 -2.049179131
150 0.981859153 -1.969562066
151 -0.080797582 0.981859153
152 0.863029656 -0.080797582
153 -2.919591093 0.863029656
154 -2.954301427 -2.919591093
155 0.804362772 -2.954301427
156 -0.529155512 0.804362772
157 0.044119230 -0.529155512
158 3.839073106 0.044119230
159 -2.870620411 3.839073106
160 -0.288331957 -2.870620411
161 -0.187806200 -0.288331957
> 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/7ns0o1323802152.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/822xe1323802152.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/9uno61323802152.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/10is0w1323802152.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/11rrje1323802152.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/124fxp1323802152.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/1363he1323802152.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/14ca7z1323802152.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/1527o41323802152.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/169mi41323802152.tab")
+ }
>
> try(system("convert tmp/1brqa1323802152.ps tmp/1brqa1323802152.png",intern=TRUE))
character(0)
> try(system("convert tmp/2cu3t1323802152.ps tmp/2cu3t1323802152.png",intern=TRUE))
character(0)
> try(system("convert tmp/3ezrm1323802152.ps tmp/3ezrm1323802152.png",intern=TRUE))
character(0)
> try(system("convert tmp/4ncvi1323802152.ps tmp/4ncvi1323802152.png",intern=TRUE))
character(0)
> try(system("convert tmp/5lq6s1323802152.ps tmp/5lq6s1323802152.png",intern=TRUE))
character(0)
> try(system("convert tmp/688ss1323802152.ps tmp/688ss1323802152.png",intern=TRUE))
character(0)
> try(system("convert tmp/7ns0o1323802152.ps tmp/7ns0o1323802152.png",intern=TRUE))
character(0)
> try(system("convert tmp/822xe1323802152.ps tmp/822xe1323802152.png",intern=TRUE))
character(0)
> try(system("convert tmp/9uno61323802152.ps tmp/9uno61323802152.png",intern=TRUE))
character(0)
> try(system("convert tmp/10is0w1323802152.ps tmp/10is0w1323802152.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
5.116 0.627 5.753