R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-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
+ ,13
+ ,14
+ ,12
+ ,9
+ ,39
+ ,16
+ ,18
+ ,11
+ ,9
+ ,30
+ ,19
+ ,11
+ ,14
+ ,9
+ ,31
+ ,15
+ ,12
+ ,12
+ ,9
+ ,34
+ ,14
+ ,16
+ ,21
+ ,9
+ ,35
+ ,13
+ ,18
+ ,12
+ ,9
+ ,39
+ ,19
+ ,14
+ ,22
+ ,9
+ ,34
+ ,15
+ ,14
+ ,11
+ ,9
+ ,36
+ ,14
+ ,15
+ ,10
+ ,9
+ ,37
+ ,15
+ ,15
+ ,13
+ ,9
+ ,38
+ ,16
+ ,17
+ ,10
+ ,9
+ ,36
+ ,16
+ ,19
+ ,8
+ ,9
+ ,38
+ ,16
+ ,10
+ ,15
+ ,9
+ ,39
+ ,16
+ ,16
+ ,14
+ ,9
+ ,33
+ ,17
+ ,18
+ ,10
+ ,9
+ ,32
+ ,15
+ ,14
+ ,14
+ ,9
+ ,36
+ ,15
+ ,14
+ ,14
+ ,9
+ ,38
+ ,20
+ ,17
+ ,11
+ ,9
+ ,39
+ ,18
+ ,14
+ ,10
+ ,9
+ ,32
+ ,16
+ ,16
+ ,13
+ ,9
+ ,32
+ ,16
+ ,18
+ ,7
+ ,9
+ ,31
+ ,16
+ ,11
+ ,14
+ ,9
+ ,39
+ ,19
+ ,14
+ ,12
+ ,9
+ ,37
+ ,16
+ ,12
+ ,14
+ ,9
+ ,39
+ ,17
+ ,17
+ ,11
+ ,9
+ ,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,16
+ ,11)
+ ,dim=c(5
+ ,162)
+ ,dimnames=list(c('connected'
+ ,'learning'
+ ,'happiness'
+ ,'depression'
+ ,'month')
+ ,1:162))
> y <- array(NA,dim=c(5,162),dimnames=list(c('connected','learning','happiness','depression','month'),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 = '2'
> par3 <- 'No Linear Trend'
> par2 <- 'Do not include Seasonal Dummies'
> par1 <- '2'
> #'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
Attaching package: 'zoo'
The following object(s) are masked from 'package:base':
as.Date, as.Date.numeric
> 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
learning connected happiness depression month
1 13 41 14 12 9
2 16 39 18 11 9
3 19 30 11 14 9
4 15 31 12 12 9
5 14 34 16 21 9
6 13 35 18 12 9
7 19 39 14 22 9
8 15 34 14 11 9
9 14 36 15 10 9
10 15 37 15 13 9
11 16 38 17 10 9
12 16 36 19 8 9
13 16 38 10 15 9
14 16 39 16 14 9
15 17 33 18 10 9
16 15 32 14 14 9
17 15 36 14 14 9
18 20 38 17 11 9
19 18 39 14 10 9
20 16 32 16 13 9
21 16 32 18 7 9
22 16 31 11 14 9
23 19 39 14 12 9
24 16 37 12 14 9
25 17 39 17 11 9
26 17 41 9 9 9
27 16 36 16 11 9
28 15 33 14 15 9
29 16 33 15 14 9
30 14 34 11 13 9
31 15 31 16 9 9
32 12 27 13 15 9
33 14 37 17 10 9
34 16 34 15 11 9
35 14 34 14 13 9
36 7 32 16 8 9
37 10 29 9 20 9
38 14 36 15 12 9
39 16 29 17 10 9
40 16 35 13 10 9
41 16 37 15 9 9
42 14 34 16 14 9
43 20 38 16 8 9
44 14 35 12 14 9
45 14 38 12 11 9
46 11 37 11 13 9
47 14 38 15 9 9
48 15 33 15 11 9
49 16 36 17 15 9
50 14 38 13 11 9
51 16 32 16 10 9
52 14 32 14 14 9
53 12 32 11 18 9
54 16 34 12 14 9
55 9 32 12 11 10
56 14 37 15 12 10
57 16 39 16 13 10
58 16 29 15 9 10
59 15 37 12 10 10
60 16 35 12 15 10
61 12 30 8 20 10
62 16 38 13 12 10
63 16 34 11 12 10
64 14 31 14 14 10
65 16 34 15 13 10
66 17 35 10 11 10
67 18 36 11 17 10
68 18 30 12 12 10
69 12 39 15 13 10
70 16 35 15 14 10
71 10 38 14 13 10
72 14 31 16 15 10
73 18 34 15 13 10
74 18 38 15 10 10
75 16 34 13 11 10
76 17 39 12 19 10
77 16 37 17 13 10
78 16 34 13 17 10
79 13 28 15 13 10
80 16 37 13 9 10
81 16 33 15 11 10
82 20 37 16 10 10
83 16 35 15 9 10
84 15 37 16 12 10
85 15 32 15 12 10
86 16 33 14 13 10
87 14 38 15 13 10
88 16 33 14 12 10
89 16 29 13 15 10
90 15 33 7 22 10
91 12 31 17 13 10
92 17 36 13 15 10
93 16 35 15 13 10
94 15 32 14 15 10
95 13 29 13 10 10
96 16 39 16 11 10
97 16 37 12 16 10
98 16 35 14 11 10
99 16 37 17 11 10
100 14 32 15 10 10
101 16 38 17 10 10
102 16 37 12 16 10
103 20 36 16 12 10
104 15 32 11 11 10
105 16 33 15 16 10
106 13 40 9 19 10
107 17 38 16 11 10
108 16 41 15 16 10
109 16 36 10 15 11
110 12 43 10 24 11
111 16 30 15 14 11
112 16 31 11 15 11
113 17 32 13 11 11
114 13 32 14 15 11
115 12 37 18 12 11
116 18 37 16 10 11
117 14 33 14 14 11
118 14 34 14 13 11
119 13 33 14 9 11
120 16 38 14 15 11
121 13 33 12 15 11
122 16 31 14 14 11
123 13 38 15 11 11
124 16 37 15 8 11
125 15 33 15 11 11
126 16 31 13 11 11
127 15 39 17 8 11
128 17 44 17 10 11
129 15 33 19 11 11
130 12 35 15 13 11
131 16 32 13 11 11
132 10 28 9 20 11
133 16 40 15 10 11
134 12 27 15 15 11
135 14 37 15 12 11
136 15 32 16 14 11
137 13 28 11 23 11
138 15 34 14 14 11
139 11 30 11 16 11
140 12 35 15 11 11
141 8 31 13 12 11
142 16 32 15 10 11
143 15 30 16 14 11
144 17 30 14 12 11
145 16 31 15 12 11
146 10 40 16 11 11
147 18 32 16 12 11
148 13 36 11 13 11
149 16 32 12 11 11
150 13 35 9 19 11
151 10 38 16 12 11
152 15 42 13 17 11
153 16 34 16 9 11
154 16 35 12 12 11
155 14 35 9 19 11
156 10 33 13 18 11
157 17 36 13 15 11
158 13 32 14 14 11
159 15 33 19 11 11
160 16 34 13 9 11
161 12 32 12 18 11
162 13 34 13 16 11
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) connected happiness depression month
15.26875 0.11460 0.05445 -0.11721 -0.35361
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-8.6871 -1.1533 0.3292 1.2484 4.6769
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 15.26875 3.33544 4.578 9.5e-06 ***
connected 0.11460 0.05122 2.237 0.0267 *
happiness 0.05445 0.08713 0.625 0.5330
depression -0.11721 0.06438 -1.820 0.0706 .
month -0.35361 0.21058 -1.679 0.0951 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.158 on 157 degrees of freedom
Multiple R-squared: 0.1077, Adjusted R-squared: 0.08492
F-statistic: 4.735 on 4 and 157 DF, p-value: 0.001236
> 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.86807737 0.26384525 0.13192263
[2,] 0.77492536 0.45014929 0.22507464
[3,] 0.65879646 0.68240707 0.34120354
[4,] 0.64289737 0.71420527 0.35710263
[5,] 0.64432964 0.71134072 0.35567036
[6,] 0.54211466 0.91577069 0.45788534
[7,] 0.44908349 0.89816698 0.55091651
[8,] 0.42603955 0.85207909 0.57396045
[9,] 0.35751802 0.71503605 0.64248198
[10,] 0.28382500 0.56765001 0.71617500
[11,] 0.59125574 0.81748851 0.40874426
[12,] 0.58939952 0.82120097 0.41060048
[13,] 0.51403537 0.97192926 0.48596463
[14,] 0.44019981 0.88039962 0.55980019
[15,] 0.37075066 0.74150132 0.62924934
[16,] 0.42700825 0.85401651 0.57299175
[17,] 0.36149758 0.72299516 0.63850242
[18,] 0.30861853 0.61723707 0.69138147
[19,] 0.25156757 0.50313515 0.74843243
[20,] 0.20022513 0.40045026 0.79977487
[21,] 0.16330315 0.32660630 0.83669685
[22,] 0.12757398 0.25514797 0.87242602
[23,] 0.12606677 0.25213353 0.87393323
[24,] 0.09677452 0.19354903 0.90322548
[25,] 0.11833484 0.23666968 0.88166516
[26,] 0.11734933 0.23469865 0.88265067
[27,] 0.09104758 0.18209517 0.90895242
[28,] 0.08033525 0.16067049 0.91966475
[29,] 0.69107264 0.61785471 0.30892736
[30,] 0.80355176 0.39289649 0.19644824
[31,] 0.78538217 0.42923566 0.21461783
[32,] 0.77695565 0.44608871 0.22304435
[33,] 0.73797153 0.52405695 0.26202847
[34,] 0.69260891 0.61478218 0.30739109
[35,] 0.65950873 0.68098255 0.34049127
[36,] 0.74001311 0.51997377 0.25998689
[37,] 0.71057113 0.57885774 0.28942887
[38,] 0.70355497 0.59289005 0.29644503
[39,] 0.82773759 0.34452481 0.17226241
[40,] 0.82936560 0.34126880 0.17063440
[41,] 0.79865891 0.40268219 0.20134109
[42,] 0.76176816 0.47646367 0.23823184
[43,] 0.75641557 0.48716885 0.24358443
[44,] 0.72551641 0.54896718 0.27448359
[45,] 0.69420470 0.61159061 0.30579530
[46,] 0.70804119 0.58391761 0.29195881
[47,] 0.67773569 0.64452862 0.32226431
[48,] 0.78182863 0.43634273 0.21817137
[49,] 0.78550494 0.42899013 0.21449506
[50,] 0.77820942 0.44358115 0.22179058
[51,] 0.81413845 0.37172310 0.18586155
[52,] 0.79205322 0.41589355 0.20794678
[53,] 0.77941531 0.44116939 0.22058469
[54,] 0.75947522 0.48104956 0.24052478
[55,] 0.72682169 0.54635663 0.27317831
[56,] 0.70940494 0.58119013 0.29059506
[57,] 0.67411114 0.65177772 0.32588886
[58,] 0.63976373 0.72047253 0.36023627
[59,] 0.63554989 0.72890023 0.36445011
[60,] 0.67764596 0.64470807 0.32235404
[61,] 0.73364225 0.53271551 0.26635775
[62,] 0.82287089 0.35425821 0.17712911
[63,] 0.79388523 0.41222953 0.20611477
[64,] 0.93802839 0.12394323 0.06197161
[65,] 0.92477487 0.15045026 0.07522513
[66,] 0.93399713 0.13200575 0.06600287
[67,] 0.92973368 0.14053264 0.07026632
[68,] 0.91452630 0.17094740 0.08547370
[69,] 0.91051457 0.17897086 0.08948543
[70,] 0.89060768 0.21878464 0.10939232
[71,] 0.87485069 0.25029861 0.12514931
[72,] 0.86755785 0.26488431 0.13244215
[73,] 0.84318031 0.31363939 0.15681969
[74,] 0.81616591 0.36766819 0.18383409
[75,] 0.87400327 0.25199345 0.12599673
[76,] 0.84908919 0.30182163 0.15091081
[77,] 0.82664797 0.34670405 0.17335203
[78,] 0.79711141 0.40577718 0.20288859
[79,] 0.76653021 0.46693958 0.23346979
[80,] 0.75991751 0.48016498 0.24008249
[81,] 0.72530885 0.54938231 0.27469115
[82,] 0.70282888 0.59434224 0.29717112
[83,] 0.67414813 0.65170374 0.32585187
[84,] 0.72996662 0.54006677 0.27003338
[85,] 0.71357327 0.57285347 0.28642673
[86,] 0.67377889 0.65244223 0.32622111
[87,] 0.63057904 0.73884193 0.36942096
[88,] 0.65443014 0.69113973 0.34556986
[89,] 0.61220235 0.77559531 0.38779765
[90,] 0.57069828 0.85860344 0.42930172
[91,] 0.52562988 0.94874024 0.47437012
[92,] 0.47997410 0.95994820 0.52002590
[93,] 0.49037284 0.98074569 0.50962716
[94,] 0.45353729 0.90707457 0.54646271
[95,] 0.40778654 0.81557308 0.59221346
[96,] 0.51068897 0.97862206 0.48931103
[97,] 0.47989715 0.95979430 0.52010285
[98,] 0.43861934 0.87723867 0.56138066
[99,] 0.44481660 0.88963320 0.55518340
[100,] 0.39902541 0.79805082 0.60097459
[101,] 0.35366090 0.70732180 0.64633910
[102,] 0.33514823 0.67029646 0.66485177
[103,] 0.34627508 0.69255016 0.65372492
[104,] 0.33192092 0.66384183 0.66807908
[105,] 0.32477354 0.64954708 0.67522646
[106,] 0.32058362 0.64116723 0.67941638
[107,] 0.29336040 0.58672081 0.70663960
[108,] 0.34647640 0.69295280 0.65352360
[109,] 0.37128746 0.74257491 0.62871254
[110,] 0.32754348 0.65508695 0.67245652
[111,] 0.28689645 0.57379290 0.71310355
[112,] 0.28898041 0.57796082 0.71101959
[113,] 0.28488741 0.56977482 0.71511259
[114,] 0.25052430 0.50104861 0.74947570
[115,] 0.24171253 0.48342505 0.75828747
[116,] 0.23693092 0.47386183 0.76306908
[117,] 0.19762894 0.39525788 0.80237106
[118,] 0.16206392 0.32412783 0.83793608
[119,] 0.14110218 0.28220436 0.85889782
[120,] 0.11565841 0.23131682 0.88434159
[121,] 0.10712167 0.21424335 0.89287833
[122,] 0.08398538 0.16797075 0.91601462
[123,] 0.08519615 0.17039230 0.91480385
[124,] 0.07124822 0.14249644 0.92875178
[125,] 0.07898548 0.15797096 0.92101452
[126,] 0.06674520 0.13349040 0.93325480
[127,] 0.06374250 0.12748501 0.93625750
[128,] 0.04786348 0.09572697 0.95213652
[129,] 0.03600502 0.07201004 0.96399498
[130,] 0.02553678 0.05107356 0.97446322
[131,] 0.01906996 0.03813991 0.98093004
[132,] 0.02341330 0.04682660 0.97658670
[133,] 0.02405557 0.04811114 0.97594443
[134,] 0.33646082 0.67292165 0.66353918
[135,] 0.27385841 0.54771682 0.72614159
[136,] 0.21606642 0.43213285 0.78393358
[137,] 0.18615283 0.37230566 0.81384717
[138,] 0.14604032 0.29208065 0.85395968
[139,] 0.28807616 0.57615231 0.71192384
[140,] 0.45313103 0.90626205 0.54686897
[141,] 0.47405134 0.94810269 0.52594866
[142,] 0.37779338 0.75558676 0.62220662
[143,] 0.28545200 0.57090400 0.71454800
[144,] 0.84440954 0.31118092 0.15559046
[145,] 0.91210657 0.17578686 0.08789343
[146,] 0.82939476 0.34121049 0.17060524
[147,] 0.69124354 0.61751293 0.30875646
> postscript(file="/var/fisher/rcomp/tmp/1o83j1355176536.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/fisher/rcomp/tmp/2trio1355176536.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/fisher/rcomp/tmp/3jcjr1355176536.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/fisher/rcomp/tmp/44mve1355176536.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/fisher/rcomp/tmp/5i7xs1355176536.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
-3.14079350 -0.24658652 4.51761760 0.11414532 -0.39256884 -2.67095927
7 8 9 10 11 12
4.26051547 -0.45577342 -1.85663996 -0.61961415 -0.19474436 -0.30885161
13 14 15 16 17 18
0.77244110 0.21393938 1.32382927 0.12506530 -0.33335191 3.92246568
19 20 21 22 23 24
1.85399503 0.89895947 0.08680346 1.40301329 3.08841510 0.66093958
25 26 27 28 29 30
0.80786138 0.77981587 0.20612219 0.12767104 0.95601310 -1.05800965
31 32 33 34 35 36
-0.45527637 -2.13025525 -2.08014005 0.48977869 -1.22135334 -8.68709071
37 38 39 40 41 42
-3.55562209 -1.62221988 0.83669438 0.36686014 -0.08845430 -1.21303910
43 44 45 46 47 48
3.62528347 -1.10985182 -1.80529484 -4.40182256 -2.20305860 -0.39561701
49 50 51 52 53 54
0.62051444 -1.85974273 0.54732936 -0.87493470 -2.24275086 1.00475249
55 56 57 58 59 60
-5.76405979 -1.38321496 0.45033857 1.18198936 -0.45429135 1.36096744
61 62 63 64 65 66
-1.26216927 0.61107652 1.17838953 -0.40672117 1.07780798 2.00102309
67 68 69 70 71 72
3.53523111 3.58235885 -3.49521353 1.08041372 -5.32616133 -0.39840693
73 74 75 76 77 78
3.07780798 2.26776066 0.95228370 2.37139037 0.62509928 1.65554392
79 80 81 82 83 84
-1.23456619 0.37405072 0.95799221 4.32791707 0.49436353 -0.43766286
85 86 87 88 89 90
0.18980655 1.24686018 -1.38060923 1.12965015 1.99414537 1.68288579
91 92 93 94 95 96
-2.68727490 2.19191524 0.96320368 0.59588456 -1.59190482 0.21591850
97 98 99 100 101 102
1.24896887 0.78323150 0.39067921 -1.04461352 0.15886487 1.24896887
103 104 105 106 107 108
4.67694144 0.29038810 1.54404240 -1.57987024 1.33052280 0.62720797
109 110 111 112 113 114
1.70886815 -2.03847164 2.00704446 2.22744177 2.53510153 -1.05050622
115 116 117 118 119 120
-3.19294943 2.68152629 -0.28232056 -0.51413490 -1.86837074 1.26186796
121 122 123 124 125 126
-1.05621473 1.94688805 -2.26142008 0.50155411 0.31160144 1.64970583
127 128 129 130 131 132
-0.83655029 0.82484827 0.09380985 -2.68318710 1.53510153 -2.73379934
133 134 135 136 137 138
0.39216127 -1.53193260 -1.02960574 0.72338795 0.50893498 0.60307514
139 140 141 142 143 144
-2.54074389 -2.91760717 -6.23308413 1.30899570 0.95259656 2.82707228
145 146 147 148 149 150
1.65802008 -5.54507659 3.48896788 -1.57999982 1.58954943 -0.65323950
151 152 153 154 155 156
-5.19865794 0.09231871 0.90812916 1.36294655 0.34676050 -3.75903252
157 158 159 160 161 162
2.54552446 -1.16771625 0.09380985 1.07147285 -1.58998032 -1.10805689
> postscript(file="/var/fisher/rcomp/tmp/68y221355176536.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 -3.14079350 NA
1 -0.24658652 -3.14079350
2 4.51761760 -0.24658652
3 0.11414532 4.51761760
4 -0.39256884 0.11414532
5 -2.67095927 -0.39256884
6 4.26051547 -2.67095927
7 -0.45577342 4.26051547
8 -1.85663996 -0.45577342
9 -0.61961415 -1.85663996
10 -0.19474436 -0.61961415
11 -0.30885161 -0.19474436
12 0.77244110 -0.30885161
13 0.21393938 0.77244110
14 1.32382927 0.21393938
15 0.12506530 1.32382927
16 -0.33335191 0.12506530
17 3.92246568 -0.33335191
18 1.85399503 3.92246568
19 0.89895947 1.85399503
20 0.08680346 0.89895947
21 1.40301329 0.08680346
22 3.08841510 1.40301329
23 0.66093958 3.08841510
24 0.80786138 0.66093958
25 0.77981587 0.80786138
26 0.20612219 0.77981587
27 0.12767104 0.20612219
28 0.95601310 0.12767104
29 -1.05800965 0.95601310
30 -0.45527637 -1.05800965
31 -2.13025525 -0.45527637
32 -2.08014005 -2.13025525
33 0.48977869 -2.08014005
34 -1.22135334 0.48977869
35 -8.68709071 -1.22135334
36 -3.55562209 -8.68709071
37 -1.62221988 -3.55562209
38 0.83669438 -1.62221988
39 0.36686014 0.83669438
40 -0.08845430 0.36686014
41 -1.21303910 -0.08845430
42 3.62528347 -1.21303910
43 -1.10985182 3.62528347
44 -1.80529484 -1.10985182
45 -4.40182256 -1.80529484
46 -2.20305860 -4.40182256
47 -0.39561701 -2.20305860
48 0.62051444 -0.39561701
49 -1.85974273 0.62051444
50 0.54732936 -1.85974273
51 -0.87493470 0.54732936
52 -2.24275086 -0.87493470
53 1.00475249 -2.24275086
54 -5.76405979 1.00475249
55 -1.38321496 -5.76405979
56 0.45033857 -1.38321496
57 1.18198936 0.45033857
58 -0.45429135 1.18198936
59 1.36096744 -0.45429135
60 -1.26216927 1.36096744
61 0.61107652 -1.26216927
62 1.17838953 0.61107652
63 -0.40672117 1.17838953
64 1.07780798 -0.40672117
65 2.00102309 1.07780798
66 3.53523111 2.00102309
67 3.58235885 3.53523111
68 -3.49521353 3.58235885
69 1.08041372 -3.49521353
70 -5.32616133 1.08041372
71 -0.39840693 -5.32616133
72 3.07780798 -0.39840693
73 2.26776066 3.07780798
74 0.95228370 2.26776066
75 2.37139037 0.95228370
76 0.62509928 2.37139037
77 1.65554392 0.62509928
78 -1.23456619 1.65554392
79 0.37405072 -1.23456619
80 0.95799221 0.37405072
81 4.32791707 0.95799221
82 0.49436353 4.32791707
83 -0.43766286 0.49436353
84 0.18980655 -0.43766286
85 1.24686018 0.18980655
86 -1.38060923 1.24686018
87 1.12965015 -1.38060923
88 1.99414537 1.12965015
89 1.68288579 1.99414537
90 -2.68727490 1.68288579
91 2.19191524 -2.68727490
92 0.96320368 2.19191524
93 0.59588456 0.96320368
94 -1.59190482 0.59588456
95 0.21591850 -1.59190482
96 1.24896887 0.21591850
97 0.78323150 1.24896887
98 0.39067921 0.78323150
99 -1.04461352 0.39067921
100 0.15886487 -1.04461352
101 1.24896887 0.15886487
102 4.67694144 1.24896887
103 0.29038810 4.67694144
104 1.54404240 0.29038810
105 -1.57987024 1.54404240
106 1.33052280 -1.57987024
107 0.62720797 1.33052280
108 1.70886815 0.62720797
109 -2.03847164 1.70886815
110 2.00704446 -2.03847164
111 2.22744177 2.00704446
112 2.53510153 2.22744177
113 -1.05050622 2.53510153
114 -3.19294943 -1.05050622
115 2.68152629 -3.19294943
116 -0.28232056 2.68152629
117 -0.51413490 -0.28232056
118 -1.86837074 -0.51413490
119 1.26186796 -1.86837074
120 -1.05621473 1.26186796
121 1.94688805 -1.05621473
122 -2.26142008 1.94688805
123 0.50155411 -2.26142008
124 0.31160144 0.50155411
125 1.64970583 0.31160144
126 -0.83655029 1.64970583
127 0.82484827 -0.83655029
128 0.09380985 0.82484827
129 -2.68318710 0.09380985
130 1.53510153 -2.68318710
131 -2.73379934 1.53510153
132 0.39216127 -2.73379934
133 -1.53193260 0.39216127
134 -1.02960574 -1.53193260
135 0.72338795 -1.02960574
136 0.50893498 0.72338795
137 0.60307514 0.50893498
138 -2.54074389 0.60307514
139 -2.91760717 -2.54074389
140 -6.23308413 -2.91760717
141 1.30899570 -6.23308413
142 0.95259656 1.30899570
143 2.82707228 0.95259656
144 1.65802008 2.82707228
145 -5.54507659 1.65802008
146 3.48896788 -5.54507659
147 -1.57999982 3.48896788
148 1.58954943 -1.57999982
149 -0.65323950 1.58954943
150 -5.19865794 -0.65323950
151 0.09231871 -5.19865794
152 0.90812916 0.09231871
153 1.36294655 0.90812916
154 0.34676050 1.36294655
155 -3.75903252 0.34676050
156 2.54552446 -3.75903252
157 -1.16771625 2.54552446
158 0.09380985 -1.16771625
159 1.07147285 0.09380985
160 -1.58998032 1.07147285
161 -1.10805689 -1.58998032
162 NA -1.10805689
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.24658652 -3.14079350
[2,] 4.51761760 -0.24658652
[3,] 0.11414532 4.51761760
[4,] -0.39256884 0.11414532
[5,] -2.67095927 -0.39256884
[6,] 4.26051547 -2.67095927
[7,] -0.45577342 4.26051547
[8,] -1.85663996 -0.45577342
[9,] -0.61961415 -1.85663996
[10,] -0.19474436 -0.61961415
[11,] -0.30885161 -0.19474436
[12,] 0.77244110 -0.30885161
[13,] 0.21393938 0.77244110
[14,] 1.32382927 0.21393938
[15,] 0.12506530 1.32382927
[16,] -0.33335191 0.12506530
[17,] 3.92246568 -0.33335191
[18,] 1.85399503 3.92246568
[19,] 0.89895947 1.85399503
[20,] 0.08680346 0.89895947
[21,] 1.40301329 0.08680346
[22,] 3.08841510 1.40301329
[23,] 0.66093958 3.08841510
[24,] 0.80786138 0.66093958
[25,] 0.77981587 0.80786138
[26,] 0.20612219 0.77981587
[27,] 0.12767104 0.20612219
[28,] 0.95601310 0.12767104
[29,] -1.05800965 0.95601310
[30,] -0.45527637 -1.05800965
[31,] -2.13025525 -0.45527637
[32,] -2.08014005 -2.13025525
[33,] 0.48977869 -2.08014005
[34,] -1.22135334 0.48977869
[35,] -8.68709071 -1.22135334
[36,] -3.55562209 -8.68709071
[37,] -1.62221988 -3.55562209
[38,] 0.83669438 -1.62221988
[39,] 0.36686014 0.83669438
[40,] -0.08845430 0.36686014
[41,] -1.21303910 -0.08845430
[42,] 3.62528347 -1.21303910
[43,] -1.10985182 3.62528347
[44,] -1.80529484 -1.10985182
[45,] -4.40182256 -1.80529484
[46,] -2.20305860 -4.40182256
[47,] -0.39561701 -2.20305860
[48,] 0.62051444 -0.39561701
[49,] -1.85974273 0.62051444
[50,] 0.54732936 -1.85974273
[51,] -0.87493470 0.54732936
[52,] -2.24275086 -0.87493470
[53,] 1.00475249 -2.24275086
[54,] -5.76405979 1.00475249
[55,] -1.38321496 -5.76405979
[56,] 0.45033857 -1.38321496
[57,] 1.18198936 0.45033857
[58,] -0.45429135 1.18198936
[59,] 1.36096744 -0.45429135
[60,] -1.26216927 1.36096744
[61,] 0.61107652 -1.26216927
[62,] 1.17838953 0.61107652
[63,] -0.40672117 1.17838953
[64,] 1.07780798 -0.40672117
[65,] 2.00102309 1.07780798
[66,] 3.53523111 2.00102309
[67,] 3.58235885 3.53523111
[68,] -3.49521353 3.58235885
[69,] 1.08041372 -3.49521353
[70,] -5.32616133 1.08041372
[71,] -0.39840693 -5.32616133
[72,] 3.07780798 -0.39840693
[73,] 2.26776066 3.07780798
[74,] 0.95228370 2.26776066
[75,] 2.37139037 0.95228370
[76,] 0.62509928 2.37139037
[77,] 1.65554392 0.62509928
[78,] -1.23456619 1.65554392
[79,] 0.37405072 -1.23456619
[80,] 0.95799221 0.37405072
[81,] 4.32791707 0.95799221
[82,] 0.49436353 4.32791707
[83,] -0.43766286 0.49436353
[84,] 0.18980655 -0.43766286
[85,] 1.24686018 0.18980655
[86,] -1.38060923 1.24686018
[87,] 1.12965015 -1.38060923
[88,] 1.99414537 1.12965015
[89,] 1.68288579 1.99414537
[90,] -2.68727490 1.68288579
[91,] 2.19191524 -2.68727490
[92,] 0.96320368 2.19191524
[93,] 0.59588456 0.96320368
[94,] -1.59190482 0.59588456
[95,] 0.21591850 -1.59190482
[96,] 1.24896887 0.21591850
[97,] 0.78323150 1.24896887
[98,] 0.39067921 0.78323150
[99,] -1.04461352 0.39067921
[100,] 0.15886487 -1.04461352
[101,] 1.24896887 0.15886487
[102,] 4.67694144 1.24896887
[103,] 0.29038810 4.67694144
[104,] 1.54404240 0.29038810
[105,] -1.57987024 1.54404240
[106,] 1.33052280 -1.57987024
[107,] 0.62720797 1.33052280
[108,] 1.70886815 0.62720797
[109,] -2.03847164 1.70886815
[110,] 2.00704446 -2.03847164
[111,] 2.22744177 2.00704446
[112,] 2.53510153 2.22744177
[113,] -1.05050622 2.53510153
[114,] -3.19294943 -1.05050622
[115,] 2.68152629 -3.19294943
[116,] -0.28232056 2.68152629
[117,] -0.51413490 -0.28232056
[118,] -1.86837074 -0.51413490
[119,] 1.26186796 -1.86837074
[120,] -1.05621473 1.26186796
[121,] 1.94688805 -1.05621473
[122,] -2.26142008 1.94688805
[123,] 0.50155411 -2.26142008
[124,] 0.31160144 0.50155411
[125,] 1.64970583 0.31160144
[126,] -0.83655029 1.64970583
[127,] 0.82484827 -0.83655029
[128,] 0.09380985 0.82484827
[129,] -2.68318710 0.09380985
[130,] 1.53510153 -2.68318710
[131,] -2.73379934 1.53510153
[132,] 0.39216127 -2.73379934
[133,] -1.53193260 0.39216127
[134,] -1.02960574 -1.53193260
[135,] 0.72338795 -1.02960574
[136,] 0.50893498 0.72338795
[137,] 0.60307514 0.50893498
[138,] -2.54074389 0.60307514
[139,] -2.91760717 -2.54074389
[140,] -6.23308413 -2.91760717
[141,] 1.30899570 -6.23308413
[142,] 0.95259656 1.30899570
[143,] 2.82707228 0.95259656
[144,] 1.65802008 2.82707228
[145,] -5.54507659 1.65802008
[146,] 3.48896788 -5.54507659
[147,] -1.57999982 3.48896788
[148,] 1.58954943 -1.57999982
[149,] -0.65323950 1.58954943
[150,] -5.19865794 -0.65323950
[151,] 0.09231871 -5.19865794
[152,] 0.90812916 0.09231871
[153,] 1.36294655 0.90812916
[154,] 0.34676050 1.36294655
[155,] -3.75903252 0.34676050
[156,] 2.54552446 -3.75903252
[157,] -1.16771625 2.54552446
[158,] 0.09380985 -1.16771625
[159,] 1.07147285 0.09380985
[160,] -1.58998032 1.07147285
[161,] -1.10805689 -1.58998032
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.24658652 -3.14079350
2 4.51761760 -0.24658652
3 0.11414532 4.51761760
4 -0.39256884 0.11414532
5 -2.67095927 -0.39256884
6 4.26051547 -2.67095927
7 -0.45577342 4.26051547
8 -1.85663996 -0.45577342
9 -0.61961415 -1.85663996
10 -0.19474436 -0.61961415
11 -0.30885161 -0.19474436
12 0.77244110 -0.30885161
13 0.21393938 0.77244110
14 1.32382927 0.21393938
15 0.12506530 1.32382927
16 -0.33335191 0.12506530
17 3.92246568 -0.33335191
18 1.85399503 3.92246568
19 0.89895947 1.85399503
20 0.08680346 0.89895947
21 1.40301329 0.08680346
22 3.08841510 1.40301329
23 0.66093958 3.08841510
24 0.80786138 0.66093958
25 0.77981587 0.80786138
26 0.20612219 0.77981587
27 0.12767104 0.20612219
28 0.95601310 0.12767104
29 -1.05800965 0.95601310
30 -0.45527637 -1.05800965
31 -2.13025525 -0.45527637
32 -2.08014005 -2.13025525
33 0.48977869 -2.08014005
34 -1.22135334 0.48977869
35 -8.68709071 -1.22135334
36 -3.55562209 -8.68709071
37 -1.62221988 -3.55562209
38 0.83669438 -1.62221988
39 0.36686014 0.83669438
40 -0.08845430 0.36686014
41 -1.21303910 -0.08845430
42 3.62528347 -1.21303910
43 -1.10985182 3.62528347
44 -1.80529484 -1.10985182
45 -4.40182256 -1.80529484
46 -2.20305860 -4.40182256
47 -0.39561701 -2.20305860
48 0.62051444 -0.39561701
49 -1.85974273 0.62051444
50 0.54732936 -1.85974273
51 -0.87493470 0.54732936
52 -2.24275086 -0.87493470
53 1.00475249 -2.24275086
54 -5.76405979 1.00475249
55 -1.38321496 -5.76405979
56 0.45033857 -1.38321496
57 1.18198936 0.45033857
58 -0.45429135 1.18198936
59 1.36096744 -0.45429135
60 -1.26216927 1.36096744
61 0.61107652 -1.26216927
62 1.17838953 0.61107652
63 -0.40672117 1.17838953
64 1.07780798 -0.40672117
65 2.00102309 1.07780798
66 3.53523111 2.00102309
67 3.58235885 3.53523111
68 -3.49521353 3.58235885
69 1.08041372 -3.49521353
70 -5.32616133 1.08041372
71 -0.39840693 -5.32616133
72 3.07780798 -0.39840693
73 2.26776066 3.07780798
74 0.95228370 2.26776066
75 2.37139037 0.95228370
76 0.62509928 2.37139037
77 1.65554392 0.62509928
78 -1.23456619 1.65554392
79 0.37405072 -1.23456619
80 0.95799221 0.37405072
81 4.32791707 0.95799221
82 0.49436353 4.32791707
83 -0.43766286 0.49436353
84 0.18980655 -0.43766286
85 1.24686018 0.18980655
86 -1.38060923 1.24686018
87 1.12965015 -1.38060923
88 1.99414537 1.12965015
89 1.68288579 1.99414537
90 -2.68727490 1.68288579
91 2.19191524 -2.68727490
92 0.96320368 2.19191524
93 0.59588456 0.96320368
94 -1.59190482 0.59588456
95 0.21591850 -1.59190482
96 1.24896887 0.21591850
97 0.78323150 1.24896887
98 0.39067921 0.78323150
99 -1.04461352 0.39067921
100 0.15886487 -1.04461352
101 1.24896887 0.15886487
102 4.67694144 1.24896887
103 0.29038810 4.67694144
104 1.54404240 0.29038810
105 -1.57987024 1.54404240
106 1.33052280 -1.57987024
107 0.62720797 1.33052280
108 1.70886815 0.62720797
109 -2.03847164 1.70886815
110 2.00704446 -2.03847164
111 2.22744177 2.00704446
112 2.53510153 2.22744177
113 -1.05050622 2.53510153
114 -3.19294943 -1.05050622
115 2.68152629 -3.19294943
116 -0.28232056 2.68152629
117 -0.51413490 -0.28232056
118 -1.86837074 -0.51413490
119 1.26186796 -1.86837074
120 -1.05621473 1.26186796
121 1.94688805 -1.05621473
122 -2.26142008 1.94688805
123 0.50155411 -2.26142008
124 0.31160144 0.50155411
125 1.64970583 0.31160144
126 -0.83655029 1.64970583
127 0.82484827 -0.83655029
128 0.09380985 0.82484827
129 -2.68318710 0.09380985
130 1.53510153 -2.68318710
131 -2.73379934 1.53510153
132 0.39216127 -2.73379934
133 -1.53193260 0.39216127
134 -1.02960574 -1.53193260
135 0.72338795 -1.02960574
136 0.50893498 0.72338795
137 0.60307514 0.50893498
138 -2.54074389 0.60307514
139 -2.91760717 -2.54074389
140 -6.23308413 -2.91760717
141 1.30899570 -6.23308413
142 0.95259656 1.30899570
143 2.82707228 0.95259656
144 1.65802008 2.82707228
145 -5.54507659 1.65802008
146 3.48896788 -5.54507659
147 -1.57999982 3.48896788
148 1.58954943 -1.57999982
149 -0.65323950 1.58954943
150 -5.19865794 -0.65323950
151 0.09231871 -5.19865794
152 0.90812916 0.09231871
153 1.36294655 0.90812916
154 0.34676050 1.36294655
155 -3.75903252 0.34676050
156 2.54552446 -3.75903252
157 -1.16771625 2.54552446
158 0.09380985 -1.16771625
159 1.07147285 0.09380985
160 -1.58998032 1.07147285
161 -1.10805689 -1.58998032
> 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/fisher/rcomp/tmp/7sd8v1355176536.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/fisher/rcomp/tmp/8ubnk1355176536.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/fisher/rcomp/tmp/9n7311355176536.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/fisher/rcomp/tmp/108qan1355176536.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/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/fisher/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/fisher/rcomp/tmp/11o9pq1355176536.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/fisher/rcomp/tmp/120dca1355176536.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/fisher/rcomp/tmp/13so121355176536.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/fisher/rcomp/tmp/14lgzt1355176536.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/fisher/rcomp/tmp/15kh7n1355176536.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/fisher/rcomp/tmp/16el431355176536.tab")
+ }
>
> try(system("convert tmp/1o83j1355176536.ps tmp/1o83j1355176536.png",intern=TRUE))
character(0)
> try(system("convert tmp/2trio1355176536.ps tmp/2trio1355176536.png",intern=TRUE))
character(0)
> try(system("convert tmp/3jcjr1355176536.ps tmp/3jcjr1355176536.png",intern=TRUE))
character(0)
> try(system("convert tmp/44mve1355176536.ps tmp/44mve1355176536.png",intern=TRUE))
character(0)
> try(system("convert tmp/5i7xs1355176536.ps tmp/5i7xs1355176536.png",intern=TRUE))
character(0)
> try(system("convert tmp/68y221355176536.ps tmp/68y221355176536.png",intern=TRUE))
character(0)
> try(system("convert tmp/7sd8v1355176536.ps tmp/7sd8v1355176536.png",intern=TRUE))
character(0)
> try(system("convert tmp/8ubnk1355176536.ps tmp/8ubnk1355176536.png",intern=TRUE))
character(0)
> try(system("convert tmp/9n7311355176536.ps tmp/9n7311355176536.png",intern=TRUE))
character(0)
> try(system("convert tmp/108qan1355176536.ps tmp/108qan1355176536.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
8.151 1.659 9.812