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(41
+ ,38
+ ,14
+ ,12
+ ,39
+ ,32
+ ,18
+ ,11
+ ,30
+ ,35
+ ,11
+ ,14
+ ,31
+ ,33
+ ,12
+ ,12
+ ,34
+ ,37
+ ,16
+ ,21
+ ,35
+ ,29
+ ,18
+ ,12
+ ,39
+ ,31
+ ,14
+ ,22
+ ,34
+ ,36
+ ,14
+ ,11
+ ,36
+ ,35
+ ,15
+ ,10
+ ,37
+ ,38
+ ,15
+ ,13
+ ,38
+ ,31
+ ,17
+ ,10
+ ,36
+ ,34
+ ,19
+ ,8
+ ,38
+ ,35
+ ,10
+ ,15
+ ,39
+ ,38
+ ,16
+ ,14
+ ,33
+ ,37
+ ,18
+ ,10
+ ,32
+ ,33
+ ,14
+ ,14
+ ,36
+ ,32
+ ,14
+ ,14
+ ,38
+ ,38
+ ,17
+ ,11
+ ,39
+ ,38
+ ,14
+ ,10
+ ,32
+ ,32
+ ,16
+ ,13
+ ,32
+ ,33
+ ,18
+ ,7
+ ,31
+ ,31
+ ,11
+ ,14
+ ,39
+ ,38
+ ,14
+ ,12
+ ,37
+ ,39
+ ,12
+ ,14
+ ,39
+ ,32
+ ,17
+ ,11
+ ,41
+ ,32
+ ,9
+ ,9
+ ,36
+ ,35
+ ,16
+ ,11
+ ,33
+ ,37
+ ,14
+ ,15
+ ,33
+ ,33
+ ,15
+ ,14
+ ,34
+ ,33
+ ,11
+ ,13
+ ,31
+ ,28
+ ,16
+ ,9
+ ,27
+ ,32
+ ,13
+ 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,9
+ ,32
+ ,35
+ ,12
+ ,18
+ ,34
+ ,36
+ ,13
+ ,16)
+ ,dim=c(4
+ ,162)
+ ,dimnames=list(c('Connected'
+ ,'Separate'
+ ,'Happiness'
+ ,'Depression
')
+ ,1:162))
> y <- array(NA,dim=c(4,162),dimnames=list(c('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 = '1'
> #'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
Connected Separate Happiness Depression\r
1 41 38 14 12
2 39 32 18 11
3 30 35 11 14
4 31 33 12 12
5 34 37 16 21
6 35 29 18 12
7 39 31 14 22
8 34 36 14 11
9 36 35 15 10
10 37 38 15 13
11 38 31 17 10
12 36 34 19 8
13 38 35 10 15
14 39 38 16 14
15 33 37 18 10
16 32 33 14 14
17 36 32 14 14
18 38 38 17 11
19 39 38 14 10
20 32 32 16 13
21 32 33 18 7
22 31 31 11 14
23 39 38 14 12
24 37 39 12 14
25 39 32 17 11
26 41 32 9 9
27 36 35 16 11
28 33 37 14 15
29 33 33 15 14
30 34 33 11 13
31 31 28 16 9
32 27 32 13 15
33 37 31 17 10
34 34 37 15 11
35 34 30 14 13
36 32 33 16 8
37 29 31 9 20
38 36 33 15 12
39 29 31 17 10
40 35 33 13 10
41 37 32 15 9
42 34 33 16 14
43 38 32 16 8
44 35 33 12 14
45 38 28 12 11
46 37 35 11 13
47 38 39 15 9
48 33 34 15 11
49 36 38 17 15
50 38 32 13 11
51 32 38 16 10
52 32 30 14 14
53 32 33 11 18
54 34 38 12 14
55 32 32 12 11
56 37 32 15 12
57 39 34 16 13
58 29 34 15 9
59 37 36 12 10
60 35 34 12 15
61 30 28 8 20
62 38 34 13 12
63 34 35 11 12
64 31 35 14 14
65 34 31 15 13
66 35 37 10 11
67 36 35 11 17
68 30 27 12 12
69 39 40 15 13
70 35 37 15 14
71 38 36 14 13
72 31 38 16 15
73 34 39 15 13
74 38 41 15 10
75 34 27 13 11
76 39 30 12 19
77 37 37 17 13
78 34 31 13 17
79 28 31 15 13
80 37 27 13 9
81 33 36 15 11
82 37 38 16 10
83 35 37 15 9
84 37 33 16 12
85 32 34 15 12
86 33 31 14 13
87 38 39 15 13
88 33 34 14 12
89 29 32 13 15
90 33 33 7 22
91 31 36 17 13
92 36 32 13 15
93 35 41 15 13
94 32 28 14 15
95 29 30 13 10
96 39 36 16 11
97 37 35 12 16
98 35 31 14 11
99 37 34 17 11
100 32 36 15 10
101 38 36 17 10
102 37 35 12 16
103 36 37 16 12
104 32 28 11 11
105 33 39 15 16
106 40 32 9 19
107 38 35 16 11
108 41 39 15 16
109 36 35 10 15
110 43 42 10 24
111 30 34 15 14
112 31 33 11 15
113 32 41 13 11
114 32 33 14 15
115 37 34 18 12
116 37 32 16 10
117 33 40 14 14
118 34 40 14 13
119 33 35 14 9
120 38 36 14 15
121 33 37 12 15
122 31 27 14 14
123 38 39 15 11
124 37 38 15 8
125 33 31 15 11
126 31 33 13 11
127 39 32 17 8
128 44 39 17 10
129 33 36 19 11
130 35 33 15 13
131 32 33 13 11
132 28 32 9 20
133 40 37 15 10
134 27 30 15 15
135 37 38 15 12
136 32 29 16 14
137 28 22 11 23
138 34 35 14 14
139 30 35 11 16
140 35 34 15 11
141 31 35 13 12
142 32 34 15 10
143 30 34 16 14
144 30 35 14 12
145 31 23 15 12
146 40 31 16 11
147 32 27 16 12
148 36 36 11 13
149 32 31 12 11
150 35 32 9 19
151 38 39 16 12
152 42 37 13 17
153 34 38 16 9
154 35 39 12 12
155 35 34 9 19
156 33 31 13 18
157 36 32 13 15
158 32 37 14 14
159 33 36 19 11
160 34 32 13 9
161 32 35 12 18
162 34 36 13 16
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Separate Happiness `Depression\r`
22.90701 0.33724 0.07761 -0.06738
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-6.697 -2.305 -0.064 2.267 7.295
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 22.90701 3.41925 6.699 3.48e-10 ***
Separate 0.33724 0.07070 4.770 4.15e-06 ***
Happiness 0.07761 0.12766 0.608 0.544
`Depression\r` -0.06738 0.09342 -0.721 0.472
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.149 on 158 degrees of freedom
Multiple R-squared: 0.1459, Adjusted R-squared: 0.1297
F-statistic: 9 on 3 and 158 DF, p-value: 1.541e-05
> 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.9493495 0.10130092 0.05065046
[2,] 0.9055251 0.18894984 0.09447492
[3,] 0.8388399 0.32232029 0.16116015
[4,] 0.7541294 0.49174127 0.24587063
[5,] 0.6808688 0.63826243 0.31913122
[6,] 0.6442993 0.71140147 0.35570074
[7,] 0.7274688 0.54506238 0.27253119
[8,] 0.6705042 0.65899162 0.32949581
[9,] 0.7163961 0.56720789 0.28360394
[10,] 0.7178896 0.56422086 0.28211043
[11,] 0.6513458 0.69730843 0.34865421
[12,] 0.5871127 0.82577465 0.41288732
[13,] 0.5823592 0.83528166 0.41764083
[14,] 0.5944950 0.81101003 0.40550502
[15,] 0.6018909 0.79621828 0.39810914
[16,] 0.5662999 0.86740023 0.43370012
[17,] 0.5428844 0.91423114 0.45711557
[18,] 0.4748364 0.94967271 0.52516364
[19,] 0.5168603 0.96627941 0.48313971
[20,] 0.7506817 0.49863670 0.24931835
[21,] 0.6984049 0.60319023 0.30159511
[22,] 0.6967681 0.60646381 0.30323191
[23,] 0.6669335 0.66613299 0.33306649
[24,] 0.6166463 0.76670737 0.38335369
[25,] 0.6060244 0.78795125 0.39397563
[26,] 0.7998768 0.40024637 0.20012319
[27,] 0.7839244 0.43215116 0.21607558
[28,] 0.7629563 0.47408742 0.23704371
[29,] 0.7180613 0.56387749 0.28193875
[30,] 0.7155406 0.56891873 0.28445937
[31,] 0.7268648 0.54627036 0.27313518
[32,] 0.6879665 0.62406698 0.31203349
[33,] 0.7602927 0.47941466 0.23970733
[34,] 0.7177313 0.56453738 0.28226869
[35,] 0.7004831 0.59903389 0.29951694
[36,] 0.6540079 0.69198419 0.34599210
[37,] 0.6556731 0.68865370 0.34432685
[38,] 0.6103689 0.77926217 0.38963108
[39,] 0.6885586 0.62288281 0.31144141
[40,] 0.6599863 0.68002743 0.34001372
[41,] 0.6175356 0.76492870 0.38246435
[42,] 0.5919970 0.81600605 0.40800303
[43,] 0.5423938 0.91521237 0.45760618
[44,] 0.5583854 0.88322911 0.44161455
[45,] 0.6090430 0.78191403 0.39095701
[46,] 0.5715653 0.85686939 0.42843470
[47,] 0.5375818 0.92483636 0.46241818
[48,] 0.5040467 0.99190653 0.49595326
[49,] 0.4816208 0.96324156 0.51837922
[50,] 0.4698232 0.93964641 0.53017680
[51,] 0.5043460 0.99130794 0.49565397
[52,] 0.6351220 0.72975593 0.36487797
[53,] 0.6013771 0.79724580 0.39862290
[54,] 0.5567150 0.88656996 0.44328498
[55,] 0.5230480 0.95390405 0.47695203
[56,] 0.5275182 0.94496370 0.47248185
[57,] 0.4845036 0.96900717 0.51549641
[58,] 0.5077229 0.98455416 0.49227708
[59,] 0.4616929 0.92338571 0.53830714
[60,] 0.4168684 0.83373684 0.58313158
[61,] 0.3842588 0.76851754 0.61574123
[62,] 0.3640325 0.72806502 0.63596749
[63,] 0.3425265 0.68505303 0.65747349
[64,] 0.3028463 0.60569255 0.69715372
[65,] 0.2916395 0.58327906 0.70836047
[66,] 0.3535475 0.70709496 0.64645252
[67,] 0.3341284 0.66825681 0.66587159
[68,] 0.2960013 0.59200264 0.70399868
[69,] 0.2696458 0.53929158 0.73035421
[70,] 0.3914355 0.78287093 0.60856454
[71,] 0.3535704 0.70714083 0.64642958
[72,] 0.3141262 0.62825240 0.68587380
[73,] 0.4109181 0.82183620 0.58908190
[74,] 0.4705068 0.94101369 0.52949315
[75,] 0.4516474 0.90329471 0.54835264
[76,] 0.4094599 0.81891972 0.59054014
[77,] 0.3689824 0.73796479 0.63101760
[78,] 0.3539343 0.70786869 0.64606566
[79,] 0.3423580 0.68471608 0.65764196
[80,] 0.3035215 0.60704306 0.69647847
[81,] 0.2754801 0.55096011 0.72451995
[82,] 0.2476198 0.49523950 0.75238025
[83,] 0.2910974 0.58219486 0.70890257
[84,] 0.2530076 0.50601511 0.74699245
[85,] 0.2944405 0.58888093 0.70555953
[86,] 0.2770843 0.55416867 0.72291566
[87,] 0.2561115 0.51222293 0.74388853
[88,] 0.2215011 0.44300221 0.77849890
[89,] 0.2454510 0.49090204 0.75454898
[90,] 0.2521350 0.50426991 0.74786505
[91,] 0.2377564 0.47551271 0.76224365
[92,] 0.2123148 0.42462957 0.78768522
[93,] 0.1934494 0.38689883 0.80655058
[94,] 0.1968635 0.39372697 0.80313652
[95,] 0.1825467 0.36509336 0.81745332
[96,] 0.1706690 0.34133807 0.82933097
[97,] 0.1424776 0.28495522 0.85752239
[98,] 0.1202221 0.24044429 0.87977786
[99,] 0.1244039 0.24880775 0.87559612
[100,] 0.2570755 0.51415097 0.74292452
[101,] 0.2493531 0.49870620 0.75064690
[102,] 0.2887003 0.57740058 0.71129971
[103,] 0.2696492 0.53929849 0.73035076
[104,] 0.4540373 0.90807470 0.54596265
[105,] 0.4995638 0.99912763 0.50043619
[106,] 0.4758838 0.95176754 0.52411623
[107,] 0.5328995 0.93420107 0.46710054
[108,] 0.4988449 0.99768977 0.50115511
[109,] 0.4663411 0.93268225 0.53365887
[110,] 0.4558111 0.91162215 0.54418892
[111,] 0.4609884 0.92197685 0.53901158
[112,] 0.4429196 0.88583924 0.55708038
[113,] 0.4123557 0.82471132 0.58764434
[114,] 0.4118749 0.82374987 0.58812507
[115,] 0.3794655 0.75893101 0.62053450
[116,] 0.3337732 0.66754647 0.66622677
[117,] 0.2957572 0.59151446 0.70424277
[118,] 0.2520247 0.50404943 0.74797528
[119,] 0.2115931 0.42318614 0.78840693
[120,] 0.2068699 0.41373975 0.79313012
[121,] 0.2483907 0.49678144 0.75160928
[122,] 0.4883883 0.97677652 0.51161174
[123,] 0.4561091 0.91221816 0.54389092
[124,] 0.4089402 0.81788040 0.59105980
[125,] 0.3703910 0.74078198 0.62960901
[126,] 0.4333032 0.86660638 0.56669681
[127,] 0.5135320 0.97293593 0.48646796
[128,] 0.6441408 0.71171846 0.35585923
[129,] 0.6037765 0.79244708 0.39622354
[130,] 0.5406967 0.91860654 0.45930327
[131,] 0.5332514 0.93349728 0.46674864
[132,] 0.4661964 0.93239287 0.53380356
[133,] 0.5328703 0.93425949 0.46712974
[134,] 0.4731811 0.94636221 0.52681889
[135,] 0.4753839 0.95076786 0.52461607
[136,] 0.4285027 0.85700541 0.57149730
[137,] 0.4975804 0.99516074 0.50241963
[138,] 0.5947874 0.81042526 0.40521263
[139,] 0.5218337 0.95633266 0.47816633
[140,] 0.8018097 0.39638054 0.19819027
[141,] 0.7364148 0.52717048 0.26358524
[142,] 0.6596410 0.68071791 0.34035895
[143,] 0.5709087 0.85818258 0.42909129
[144,] 0.4702542 0.94050849 0.52974575
[145,] 0.4396733 0.87934657 0.56032671
[146,] 0.9806053 0.03878934 0.01939467
[147,] 0.9533081 0.09338386 0.04669193
[148,] 0.9166278 0.16674439 0.08337219
[149,] 0.8510071 0.29798581 0.14899290
> postscript(file="/var/wessaorg/rcomp/tmp/1u0gn1323870475.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/2ramo1323870475.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/31gxk1323870475.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/46akx1323870475.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/54ypd1323870475.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
4.99969499 4.64534889 -4.62098911 -3.15886361 -1.21188291 1.72446008
7 8 9 10 11 12
6.03418043 -1.39319307 0.79906512 0.98946316 3.99282535 0.69111858
13 14 15 16 17 18
3.52399733 2.97923133 -3.10825155 -2.17932727 2.15791736 1.69949027
19 20 21 22 23 24
2.86494037 -2.06467822 -2.96140496 -2.27201061 2.99969499 0.95242325
25 26 27 28 29 30
4.72295803 7.20907651 0.78883329 -2.46092847 -1.25693641 -0.01387717
31 32 33 34 35 36
-1.98520894 -6.69709620 2.99282535 -1.80804683 0.76502930 -2.73880938
37 38 39 40 41 42
-3.71252850 1.60830898 -5.00717465 0.62877264 2.74342169 -0.33454554
43 44 45 46 47 48
3.59843525 0.97589100 5.45998222 2.31163358 1.38270931 -1.79631295
49 50 51 52 53 54
-0.03100051 4.03339457 -4.29027790 -1.16759339 -1.67699064 -1.71033213
55 56 57 58 59 60
-1.88899629 2.94555361 4.26083252 -5.93106756 1.69464790 0.70602368
61 62 63 64 65 66
-1.62318548 3.42628263 -0.75574372 -3.85381652 0.35017554 -0.42000115
67 68 69 70 71 72
1.58114281 -2.13539585 2.31497390 -0.60591491 2.74156155 -4.95339137
73 74 75 76 77 78
-2.34778147 0.77559736 1.71961771 6.32451141 1.17148951 0.77490304
79 80 81 82 83 84
-5.64982446 4.58486309 -2.47080220 0.70972210 -0.94280144 2.53069984
85 86 87 88 89 90
-2.72893565 -0.57221532 1.65221853 -1.65132651 -4.69709620 -0.09704487
91 92 93 94 95 96
-4.49126586 2.30290380 -2.02227072 -0.42572683 -4.35949348 3.45158866
97 98 99 100 101 102
2.43615636 1.29303006 2.04846878 -3.53817951 2.30660222 2.43615636
103 104 105 106 107 108
0.18172134 -0.46240865 -3.14564955 6.88284957 2.78883329 4.85435045
109 110 111 112 113 114
1.52399733 6.76968070 -4.59418103 -2.87912255 -5.00180706 -2.11194996
115 116 117 118 119 120
2.03823695 2.73318986 -3.54003965 -2.60741696 -2.19070305 2.87631616
121 122 123 124 125 126
-2.30571020 -1.15585951 1.51746392 0.65257663 -0.78457907 -3.30385005
127 128 129 130 131 132
4.52082611 7.29486834 -2.78123875 0.67568629 -2.30385005 -5.04977313
133 134 135 136 137 138
4.12457586 -6.17782522 0.92208585 -0.98556704 -1.63041322 -0.85381652
139 140 141 142 143 144
-4.48623450 0.20368705 -3.91096200 -2.86369026 -4.67179017 -4.98857113
145 146 147 148 149 150
-0.01924476 6.13781179 -0.44583240 0.97438895 -1.55175166 1.88284957
151 152 153 154 155 156
1.50723209 6.75143528 -2.35765520 -1.18233137 1.20836032 -0.15771966
157 158 159 160 161 162
2.30290380 -3.52830578 -2.78123875 -0.10136004 -2.42908903 -0.97869740
> postscript(file="/var/wessaorg/rcomp/tmp/6jah41323870475.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 4.99969499 NA
1 4.64534889 4.99969499
2 -4.62098911 4.64534889
3 -3.15886361 -4.62098911
4 -1.21188291 -3.15886361
5 1.72446008 -1.21188291
6 6.03418043 1.72446008
7 -1.39319307 6.03418043
8 0.79906512 -1.39319307
9 0.98946316 0.79906512
10 3.99282535 0.98946316
11 0.69111858 3.99282535
12 3.52399733 0.69111858
13 2.97923133 3.52399733
14 -3.10825155 2.97923133
15 -2.17932727 -3.10825155
16 2.15791736 -2.17932727
17 1.69949027 2.15791736
18 2.86494037 1.69949027
19 -2.06467822 2.86494037
20 -2.96140496 -2.06467822
21 -2.27201061 -2.96140496
22 2.99969499 -2.27201061
23 0.95242325 2.99969499
24 4.72295803 0.95242325
25 7.20907651 4.72295803
26 0.78883329 7.20907651
27 -2.46092847 0.78883329
28 -1.25693641 -2.46092847
29 -0.01387717 -1.25693641
30 -1.98520894 -0.01387717
31 -6.69709620 -1.98520894
32 2.99282535 -6.69709620
33 -1.80804683 2.99282535
34 0.76502930 -1.80804683
35 -2.73880938 0.76502930
36 -3.71252850 -2.73880938
37 1.60830898 -3.71252850
38 -5.00717465 1.60830898
39 0.62877264 -5.00717465
40 2.74342169 0.62877264
41 -0.33454554 2.74342169
42 3.59843525 -0.33454554
43 0.97589100 3.59843525
44 5.45998222 0.97589100
45 2.31163358 5.45998222
46 1.38270931 2.31163358
47 -1.79631295 1.38270931
48 -0.03100051 -1.79631295
49 4.03339457 -0.03100051
50 -4.29027790 4.03339457
51 -1.16759339 -4.29027790
52 -1.67699064 -1.16759339
53 -1.71033213 -1.67699064
54 -1.88899629 -1.71033213
55 2.94555361 -1.88899629
56 4.26083252 2.94555361
57 -5.93106756 4.26083252
58 1.69464790 -5.93106756
59 0.70602368 1.69464790
60 -1.62318548 0.70602368
61 3.42628263 -1.62318548
62 -0.75574372 3.42628263
63 -3.85381652 -0.75574372
64 0.35017554 -3.85381652
65 -0.42000115 0.35017554
66 1.58114281 -0.42000115
67 -2.13539585 1.58114281
68 2.31497390 -2.13539585
69 -0.60591491 2.31497390
70 2.74156155 -0.60591491
71 -4.95339137 2.74156155
72 -2.34778147 -4.95339137
73 0.77559736 -2.34778147
74 1.71961771 0.77559736
75 6.32451141 1.71961771
76 1.17148951 6.32451141
77 0.77490304 1.17148951
78 -5.64982446 0.77490304
79 4.58486309 -5.64982446
80 -2.47080220 4.58486309
81 0.70972210 -2.47080220
82 -0.94280144 0.70972210
83 2.53069984 -0.94280144
84 -2.72893565 2.53069984
85 -0.57221532 -2.72893565
86 1.65221853 -0.57221532
87 -1.65132651 1.65221853
88 -4.69709620 -1.65132651
89 -0.09704487 -4.69709620
90 -4.49126586 -0.09704487
91 2.30290380 -4.49126586
92 -2.02227072 2.30290380
93 -0.42572683 -2.02227072
94 -4.35949348 -0.42572683
95 3.45158866 -4.35949348
96 2.43615636 3.45158866
97 1.29303006 2.43615636
98 2.04846878 1.29303006
99 -3.53817951 2.04846878
100 2.30660222 -3.53817951
101 2.43615636 2.30660222
102 0.18172134 2.43615636
103 -0.46240865 0.18172134
104 -3.14564955 -0.46240865
105 6.88284957 -3.14564955
106 2.78883329 6.88284957
107 4.85435045 2.78883329
108 1.52399733 4.85435045
109 6.76968070 1.52399733
110 -4.59418103 6.76968070
111 -2.87912255 -4.59418103
112 -5.00180706 -2.87912255
113 -2.11194996 -5.00180706
114 2.03823695 -2.11194996
115 2.73318986 2.03823695
116 -3.54003965 2.73318986
117 -2.60741696 -3.54003965
118 -2.19070305 -2.60741696
119 2.87631616 -2.19070305
120 -2.30571020 2.87631616
121 -1.15585951 -2.30571020
122 1.51746392 -1.15585951
123 0.65257663 1.51746392
124 -0.78457907 0.65257663
125 -3.30385005 -0.78457907
126 4.52082611 -3.30385005
127 7.29486834 4.52082611
128 -2.78123875 7.29486834
129 0.67568629 -2.78123875
130 -2.30385005 0.67568629
131 -5.04977313 -2.30385005
132 4.12457586 -5.04977313
133 -6.17782522 4.12457586
134 0.92208585 -6.17782522
135 -0.98556704 0.92208585
136 -1.63041322 -0.98556704
137 -0.85381652 -1.63041322
138 -4.48623450 -0.85381652
139 0.20368705 -4.48623450
140 -3.91096200 0.20368705
141 -2.86369026 -3.91096200
142 -4.67179017 -2.86369026
143 -4.98857113 -4.67179017
144 -0.01924476 -4.98857113
145 6.13781179 -0.01924476
146 -0.44583240 6.13781179
147 0.97438895 -0.44583240
148 -1.55175166 0.97438895
149 1.88284957 -1.55175166
150 1.50723209 1.88284957
151 6.75143528 1.50723209
152 -2.35765520 6.75143528
153 -1.18233137 -2.35765520
154 1.20836032 -1.18233137
155 -0.15771966 1.20836032
156 2.30290380 -0.15771966
157 -3.52830578 2.30290380
158 -2.78123875 -3.52830578
159 -0.10136004 -2.78123875
160 -2.42908903 -0.10136004
161 -0.97869740 -2.42908903
162 NA -0.97869740
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 4.64534889 4.99969499
[2,] -4.62098911 4.64534889
[3,] -3.15886361 -4.62098911
[4,] -1.21188291 -3.15886361
[5,] 1.72446008 -1.21188291
[6,] 6.03418043 1.72446008
[7,] -1.39319307 6.03418043
[8,] 0.79906512 -1.39319307
[9,] 0.98946316 0.79906512
[10,] 3.99282535 0.98946316
[11,] 0.69111858 3.99282535
[12,] 3.52399733 0.69111858
[13,] 2.97923133 3.52399733
[14,] -3.10825155 2.97923133
[15,] -2.17932727 -3.10825155
[16,] 2.15791736 -2.17932727
[17,] 1.69949027 2.15791736
[18,] 2.86494037 1.69949027
[19,] -2.06467822 2.86494037
[20,] -2.96140496 -2.06467822
[21,] -2.27201061 -2.96140496
[22,] 2.99969499 -2.27201061
[23,] 0.95242325 2.99969499
[24,] 4.72295803 0.95242325
[25,] 7.20907651 4.72295803
[26,] 0.78883329 7.20907651
[27,] -2.46092847 0.78883329
[28,] -1.25693641 -2.46092847
[29,] -0.01387717 -1.25693641
[30,] -1.98520894 -0.01387717
[31,] -6.69709620 -1.98520894
[32,] 2.99282535 -6.69709620
[33,] -1.80804683 2.99282535
[34,] 0.76502930 -1.80804683
[35,] -2.73880938 0.76502930
[36,] -3.71252850 -2.73880938
[37,] 1.60830898 -3.71252850
[38,] -5.00717465 1.60830898
[39,] 0.62877264 -5.00717465
[40,] 2.74342169 0.62877264
[41,] -0.33454554 2.74342169
[42,] 3.59843525 -0.33454554
[43,] 0.97589100 3.59843525
[44,] 5.45998222 0.97589100
[45,] 2.31163358 5.45998222
[46,] 1.38270931 2.31163358
[47,] -1.79631295 1.38270931
[48,] -0.03100051 -1.79631295
[49,] 4.03339457 -0.03100051
[50,] -4.29027790 4.03339457
[51,] -1.16759339 -4.29027790
[52,] -1.67699064 -1.16759339
[53,] -1.71033213 -1.67699064
[54,] -1.88899629 -1.71033213
[55,] 2.94555361 -1.88899629
[56,] 4.26083252 2.94555361
[57,] -5.93106756 4.26083252
[58,] 1.69464790 -5.93106756
[59,] 0.70602368 1.69464790
[60,] -1.62318548 0.70602368
[61,] 3.42628263 -1.62318548
[62,] -0.75574372 3.42628263
[63,] -3.85381652 -0.75574372
[64,] 0.35017554 -3.85381652
[65,] -0.42000115 0.35017554
[66,] 1.58114281 -0.42000115
[67,] -2.13539585 1.58114281
[68,] 2.31497390 -2.13539585
[69,] -0.60591491 2.31497390
[70,] 2.74156155 -0.60591491
[71,] -4.95339137 2.74156155
[72,] -2.34778147 -4.95339137
[73,] 0.77559736 -2.34778147
[74,] 1.71961771 0.77559736
[75,] 6.32451141 1.71961771
[76,] 1.17148951 6.32451141
[77,] 0.77490304 1.17148951
[78,] -5.64982446 0.77490304
[79,] 4.58486309 -5.64982446
[80,] -2.47080220 4.58486309
[81,] 0.70972210 -2.47080220
[82,] -0.94280144 0.70972210
[83,] 2.53069984 -0.94280144
[84,] -2.72893565 2.53069984
[85,] -0.57221532 -2.72893565
[86,] 1.65221853 -0.57221532
[87,] -1.65132651 1.65221853
[88,] -4.69709620 -1.65132651
[89,] -0.09704487 -4.69709620
[90,] -4.49126586 -0.09704487
[91,] 2.30290380 -4.49126586
[92,] -2.02227072 2.30290380
[93,] -0.42572683 -2.02227072
[94,] -4.35949348 -0.42572683
[95,] 3.45158866 -4.35949348
[96,] 2.43615636 3.45158866
[97,] 1.29303006 2.43615636
[98,] 2.04846878 1.29303006
[99,] -3.53817951 2.04846878
[100,] 2.30660222 -3.53817951
[101,] 2.43615636 2.30660222
[102,] 0.18172134 2.43615636
[103,] -0.46240865 0.18172134
[104,] -3.14564955 -0.46240865
[105,] 6.88284957 -3.14564955
[106,] 2.78883329 6.88284957
[107,] 4.85435045 2.78883329
[108,] 1.52399733 4.85435045
[109,] 6.76968070 1.52399733
[110,] -4.59418103 6.76968070
[111,] -2.87912255 -4.59418103
[112,] -5.00180706 -2.87912255
[113,] -2.11194996 -5.00180706
[114,] 2.03823695 -2.11194996
[115,] 2.73318986 2.03823695
[116,] -3.54003965 2.73318986
[117,] -2.60741696 -3.54003965
[118,] -2.19070305 -2.60741696
[119,] 2.87631616 -2.19070305
[120,] -2.30571020 2.87631616
[121,] -1.15585951 -2.30571020
[122,] 1.51746392 -1.15585951
[123,] 0.65257663 1.51746392
[124,] -0.78457907 0.65257663
[125,] -3.30385005 -0.78457907
[126,] 4.52082611 -3.30385005
[127,] 7.29486834 4.52082611
[128,] -2.78123875 7.29486834
[129,] 0.67568629 -2.78123875
[130,] -2.30385005 0.67568629
[131,] -5.04977313 -2.30385005
[132,] 4.12457586 -5.04977313
[133,] -6.17782522 4.12457586
[134,] 0.92208585 -6.17782522
[135,] -0.98556704 0.92208585
[136,] -1.63041322 -0.98556704
[137,] -0.85381652 -1.63041322
[138,] -4.48623450 -0.85381652
[139,] 0.20368705 -4.48623450
[140,] -3.91096200 0.20368705
[141,] -2.86369026 -3.91096200
[142,] -4.67179017 -2.86369026
[143,] -4.98857113 -4.67179017
[144,] -0.01924476 -4.98857113
[145,] 6.13781179 -0.01924476
[146,] -0.44583240 6.13781179
[147,] 0.97438895 -0.44583240
[148,] -1.55175166 0.97438895
[149,] 1.88284957 -1.55175166
[150,] 1.50723209 1.88284957
[151,] 6.75143528 1.50723209
[152,] -2.35765520 6.75143528
[153,] -1.18233137 -2.35765520
[154,] 1.20836032 -1.18233137
[155,] -0.15771966 1.20836032
[156,] 2.30290380 -0.15771966
[157,] -3.52830578 2.30290380
[158,] -2.78123875 -3.52830578
[159,] -0.10136004 -2.78123875
[160,] -2.42908903 -0.10136004
[161,] -0.97869740 -2.42908903
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 4.64534889 4.99969499
2 -4.62098911 4.64534889
3 -3.15886361 -4.62098911
4 -1.21188291 -3.15886361
5 1.72446008 -1.21188291
6 6.03418043 1.72446008
7 -1.39319307 6.03418043
8 0.79906512 -1.39319307
9 0.98946316 0.79906512
10 3.99282535 0.98946316
11 0.69111858 3.99282535
12 3.52399733 0.69111858
13 2.97923133 3.52399733
14 -3.10825155 2.97923133
15 -2.17932727 -3.10825155
16 2.15791736 -2.17932727
17 1.69949027 2.15791736
18 2.86494037 1.69949027
19 -2.06467822 2.86494037
20 -2.96140496 -2.06467822
21 -2.27201061 -2.96140496
22 2.99969499 -2.27201061
23 0.95242325 2.99969499
24 4.72295803 0.95242325
25 7.20907651 4.72295803
26 0.78883329 7.20907651
27 -2.46092847 0.78883329
28 -1.25693641 -2.46092847
29 -0.01387717 -1.25693641
30 -1.98520894 -0.01387717
31 -6.69709620 -1.98520894
32 2.99282535 -6.69709620
33 -1.80804683 2.99282535
34 0.76502930 -1.80804683
35 -2.73880938 0.76502930
36 -3.71252850 -2.73880938
37 1.60830898 -3.71252850
38 -5.00717465 1.60830898
39 0.62877264 -5.00717465
40 2.74342169 0.62877264
41 -0.33454554 2.74342169
42 3.59843525 -0.33454554
43 0.97589100 3.59843525
44 5.45998222 0.97589100
45 2.31163358 5.45998222
46 1.38270931 2.31163358
47 -1.79631295 1.38270931
48 -0.03100051 -1.79631295
49 4.03339457 -0.03100051
50 -4.29027790 4.03339457
51 -1.16759339 -4.29027790
52 -1.67699064 -1.16759339
53 -1.71033213 -1.67699064
54 -1.88899629 -1.71033213
55 2.94555361 -1.88899629
56 4.26083252 2.94555361
57 -5.93106756 4.26083252
58 1.69464790 -5.93106756
59 0.70602368 1.69464790
60 -1.62318548 0.70602368
61 3.42628263 -1.62318548
62 -0.75574372 3.42628263
63 -3.85381652 -0.75574372
64 0.35017554 -3.85381652
65 -0.42000115 0.35017554
66 1.58114281 -0.42000115
67 -2.13539585 1.58114281
68 2.31497390 -2.13539585
69 -0.60591491 2.31497390
70 2.74156155 -0.60591491
71 -4.95339137 2.74156155
72 -2.34778147 -4.95339137
73 0.77559736 -2.34778147
74 1.71961771 0.77559736
75 6.32451141 1.71961771
76 1.17148951 6.32451141
77 0.77490304 1.17148951
78 -5.64982446 0.77490304
79 4.58486309 -5.64982446
80 -2.47080220 4.58486309
81 0.70972210 -2.47080220
82 -0.94280144 0.70972210
83 2.53069984 -0.94280144
84 -2.72893565 2.53069984
85 -0.57221532 -2.72893565
86 1.65221853 -0.57221532
87 -1.65132651 1.65221853
88 -4.69709620 -1.65132651
89 -0.09704487 -4.69709620
90 -4.49126586 -0.09704487
91 2.30290380 -4.49126586
92 -2.02227072 2.30290380
93 -0.42572683 -2.02227072
94 -4.35949348 -0.42572683
95 3.45158866 -4.35949348
96 2.43615636 3.45158866
97 1.29303006 2.43615636
98 2.04846878 1.29303006
99 -3.53817951 2.04846878
100 2.30660222 -3.53817951
101 2.43615636 2.30660222
102 0.18172134 2.43615636
103 -0.46240865 0.18172134
104 -3.14564955 -0.46240865
105 6.88284957 -3.14564955
106 2.78883329 6.88284957
107 4.85435045 2.78883329
108 1.52399733 4.85435045
109 6.76968070 1.52399733
110 -4.59418103 6.76968070
111 -2.87912255 -4.59418103
112 -5.00180706 -2.87912255
113 -2.11194996 -5.00180706
114 2.03823695 -2.11194996
115 2.73318986 2.03823695
116 -3.54003965 2.73318986
117 -2.60741696 -3.54003965
118 -2.19070305 -2.60741696
119 2.87631616 -2.19070305
120 -2.30571020 2.87631616
121 -1.15585951 -2.30571020
122 1.51746392 -1.15585951
123 0.65257663 1.51746392
124 -0.78457907 0.65257663
125 -3.30385005 -0.78457907
126 4.52082611 -3.30385005
127 7.29486834 4.52082611
128 -2.78123875 7.29486834
129 0.67568629 -2.78123875
130 -2.30385005 0.67568629
131 -5.04977313 -2.30385005
132 4.12457586 -5.04977313
133 -6.17782522 4.12457586
134 0.92208585 -6.17782522
135 -0.98556704 0.92208585
136 -1.63041322 -0.98556704
137 -0.85381652 -1.63041322
138 -4.48623450 -0.85381652
139 0.20368705 -4.48623450
140 -3.91096200 0.20368705
141 -2.86369026 -3.91096200
142 -4.67179017 -2.86369026
143 -4.98857113 -4.67179017
144 -0.01924476 -4.98857113
145 6.13781179 -0.01924476
146 -0.44583240 6.13781179
147 0.97438895 -0.44583240
148 -1.55175166 0.97438895
149 1.88284957 -1.55175166
150 1.50723209 1.88284957
151 6.75143528 1.50723209
152 -2.35765520 6.75143528
153 -1.18233137 -2.35765520
154 1.20836032 -1.18233137
155 -0.15771966 1.20836032
156 2.30290380 -0.15771966
157 -3.52830578 2.30290380
158 -2.78123875 -3.52830578
159 -0.10136004 -2.78123875
160 -2.42908903 -0.10136004
161 -0.97869740 -2.42908903
> 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/72dpt1323870475.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/8e8e81323870475.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/99vw01323870475.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/106io81323870475.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/11yls51323870475.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/12wd301323870475.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/13csdv1323870475.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/142vz51323870475.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/158pym1323870475.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/16xdv71323870475.tab")
+ }
>
> try(system("convert tmp/1u0gn1323870475.ps tmp/1u0gn1323870475.png",intern=TRUE))
character(0)
> try(system("convert tmp/2ramo1323870475.ps tmp/2ramo1323870475.png",intern=TRUE))
character(0)
> try(system("convert tmp/31gxk1323870475.ps tmp/31gxk1323870475.png",intern=TRUE))
character(0)
> try(system("convert tmp/46akx1323870475.ps tmp/46akx1323870475.png",intern=TRUE))
character(0)
> try(system("convert tmp/54ypd1323870475.ps tmp/54ypd1323870475.png",intern=TRUE))
character(0)
> try(system("convert tmp/6jah41323870475.ps tmp/6jah41323870475.png",intern=TRUE))
character(0)
> try(system("convert tmp/72dpt1323870475.ps tmp/72dpt1323870475.png",intern=TRUE))
character(0)
> try(system("convert tmp/8e8e81323870475.ps tmp/8e8e81323870475.png",intern=TRUE))
character(0)
> try(system("convert tmp/99vw01323870475.ps tmp/99vw01323870475.png",intern=TRUE))
character(0)
> try(system("convert tmp/106io81323870475.ps tmp/106io81323870475.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.672 0.604 5.295