R version 2.12.0 (2010-10-15)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-pc-linux-gnu (32-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> x <- array(list(7
+ ,41
+ ,38
+ ,13
+ ,12
+ ,14
+ ,12
+ ,5
+ ,39
+ ,32
+ ,16
+ ,11
+ ,18
+ ,11
+ ,5
+ ,30
+ ,35
+ ,19
+ ,15
+ ,11
+ ,14
+ ,5
+ ,31
+ ,33
+ ,15
+ ,6
+ ,12
+ ,12
+ ,8
+ ,34
+ ,37
+ ,14
+ ,13
+ ,16
+ ,21
+ ,6
+ ,35
+ ,29
+ ,13
+ ,10
+ ,18
+ ,12
+ ,5
+ ,39
+ ,31
+ ,19
+ ,12
+ ,14
+ ,22
+ ,6
+ ,34
+ ,36
+ ,15
+ ,14
+ ,14
+ ,11
+ ,5
+ ,36
+ ,35
+ ,14
+ ,12
+ ,15
+ ,10
+ ,4
+ ,37
+ ,38
+ ,15
+ ,6
+ ,15
+ ,13
+ ,6
+ ,38
+ ,31
+ ,16
+ ,10
+ ,17
+ ,10
+ ,5
+ ,36
+ ,34
+ ,16
+ ,12
+ ,19
+ ,8
+ ,5
+ ,38
+ ,35
+ ,16
+ ,12
+ ,10
+ ,15
+ ,6
+ ,39
+ ,38
+ ,16
+ ,11
+ ,16
+ ,14
+ ,7
+ ,33
+ ,37
+ ,17
+ ,15
+ ,18
+ ,10
+ ,6
+ ,32
+ ,33
+ ,15
+ ,12
+ ,14
+ ,14
+ ,7
+ ,36
+ ,32
+ ,15
+ ,10
+ ,14
+ ,14
+ ,6
+ ,38
+ ,38
+ ,20
+ ,12
+ ,17
+ ,11
+ ,8
+ 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> y <- array(NA,dim=c(7,162),dimnames=list(c('Age','Connected','Separate','Learning','Software','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'
> 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
Learning Age Connected Separate Software Happiness Depression
1 13 7 41 38 12 14 12
2 16 5 39 32 11 18 11
3 19 5 30 35 15 11 14
4 15 5 31 33 6 12 12
5 14 8 34 37 13 16 21
6 13 6 35 29 10 18 12
7 19 5 39 31 12 14 22
8 15 6 34 36 14 14 11
9 14 5 36 35 12 15 10
10 15 4 37 38 6 15 13
11 16 6 38 31 10 17 10
12 16 5 36 34 12 19 8
13 16 5 38 35 12 10 15
14 16 6 39 38 11 16 14
15 17 7 33 37 15 18 10
16 15 6 32 33 12 14 14
17 15 7 36 32 10 14 14
18 20 6 38 38 12 17 11
19 18 8 39 38 11 14 10
20 16 7 32 32 12 16 13
21 16 5 32 33 11 18 7
22 16 5 31 31 12 11 14
23 19 7 39 38 13 14 12
24 16 7 37 39 11 12 14
25 17 5 39 32 9 17 11
26 17 4 41 32 13 9 9
27 16 10 36 35 10 16 11
28 15 6 33 37 14 14 15
29 16 5 33 33 12 15 14
30 14 5 34 33 10 11 13
31 15 5 31 28 12 16 9
32 12 5 27 32 8 13 15
33 14 6 37 31 10 17 10
34 16 5 34 37 12 15 11
35 14 5 34 30 12 14 13
36 7 5 32 33 7 16 8
37 10 5 29 31 6 9 20
38 14 5 36 33 12 15 12
39 16 5 29 31 10 17 10
40 16 5 35 33 10 13 10
41 16 5 37 32 10 15 9
42 14 7 34 33 12 16 14
43 20 5 38 32 15 16 8
44 14 6 35 33 10 12 14
45 14 7 38 28 10 12 11
46 11 7 37 35 12 11 13
47 14 5 38 39 13 15 9
48 15 5 33 34 11 15 11
49 16 4 36 38 11 17 15
50 14 5 38 32 12 13 11
51 16 4 32 38 14 16 10
52 14 5 32 30 10 14 14
53 12 5 32 33 12 11 18
54 16 7 34 38 13 12 14
55 9 5 32 32 5 12 11
56 14 5 37 32 6 15 12
57 16 6 39 34 12 16 13
58 16 4 29 34 12 15 9
59 15 6 37 36 11 12 10
60 16 6 35 34 10 12 15
61 12 5 30 28 7 8 20
62 16 7 38 34 12 13 12
63 16 6 34 35 14 11 12
64 14 8 31 35 11 14 14
65 16 7 34 31 12 15 13
66 17 5 35 37 13 10 11
67 18 6 36 35 14 11 17
68 18 6 30 27 11 12 12
69 12 5 39 40 12 15 13
70 16 5 35 37 12 15 14
71 10 5 38 36 8 14 13
72 14 5 31 38 11 16 15
73 18 4 34 39 14 15 13
74 18 6 38 41 14 15 10
75 16 6 34 27 12 13 11
76 17 6 39 30 9 12 19
77 16 6 37 37 13 17 13
78 16 7 34 31 11 13 17
79 13 5 28 31 12 15 13
80 16 7 37 27 12 13 9
81 16 6 33 36 12 15 11
82 20 5 37 38 12 16 10
83 16 5 35 37 12 15 9
84 15 4 37 33 12 16 12
85 15 8 32 34 11 15 12
86 16 8 33 31 10 14 13
87 14 5 38 39 9 15 13
88 16 5 33 34 12 14 12
89 16 6 29 32 12 13 15
90 15 4 33 33 12 7 22
91 12 5 31 36 9 17 13
92 17 5 36 32 15 13 15
93 16 5 35 41 12 15 13
94 15 5 32 28 12 14 15
95 13 6 29 30 12 13 10
96 16 6 39 36 10 16 11
97 16 5 37 35 13 12 16
98 16 6 35 31 9 14 11
99 16 5 37 34 12 17 11
100 14 7 32 36 10 15 10
101 16 5 38 36 14 17 10
102 16 6 37 35 11 12 16
103 20 6 36 37 15 16 12
104 15 6 32 28 11 11 11
105 16 4 33 39 11 15 16
106 13 5 40 32 12 9 19
107 17 5 38 35 12 16 11
108 16 7 41 39 12 15 16
109 16 6 36 35 11 10 15
110 12 9 43 42 7 10 24
111 16 6 30 34 12 15 14
112 16 6 31 33 14 11 15
113 17 5 32 41 11 13 11
114 13 6 32 33 11 14 15
115 12 5 37 34 10 18 12
116 18 8 37 32 13 16 10
117 14 7 33 40 13 14 14
118 14 5 34 40 8 14 13
119 13 7 33 35 11 14 9
120 16 6 38 36 12 14 15
121 13 6 33 37 11 12 15
122 16 9 31 27 13 14 14
123 13 7 38 39 12 15 11
124 16 6 37 38 14 15 8
125 15 5 33 31 13 15 11
126 16 5 31 33 15 13 11
127 15 6 39 32 10 17 8
128 17 6 44 39 11 17 10
129 15 7 33 36 9 19 11
130 12 5 35 33 11 15 13
131 16 5 32 33 10 13 11
132 10 5 28 32 11 9 20
133 16 6 40 37 8 15 10
134 12 4 27 30 11 15 15
135 14 5 37 38 12 15 12
136 15 7 32 29 12 16 14
137 13 5 28 22 9 11 23
138 15 7 34 35 11 14 14
139 11 7 30 35 10 11 16
140 12 6 35 34 8 15 11
141 8 5 31 35 9 13 12
142 16 8 32 34 8 15 10
143 15 5 30 34 9 16 14
144 17 5 30 35 15 14 12
145 16 5 31 23 11 15 12
146 10 6 40 31 8 16 11
147 18 4 32 27 13 16 12
148 13 5 36 36 12 11 13
149 16 5 32 31 12 12 11
150 13 7 35 32 9 9 19
151 10 6 38 39 7 16 12
152 15 7 42 37 13 13 17
153 16 10 34 38 9 16 9
154 16 6 35 39 6 12 12
155 14 8 35 34 8 9 19
156 10 4 33 31 8 13 18
157 17 5 36 32 15 13 15
158 13 6 32 37 6 14 14
159 15 7 33 36 9 19 11
160 16 7 34 32 11 13 9
161 12 6 32 35 8 12 18
162 13 6 34 36 8 13 16
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Age Connected Separate Software Happiness
5.40277 0.12553 0.10984 -0.02664 0.55002 0.06271
Depression
-0.08012
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-5.8790 -1.1687 0.1378 1.0704 4.1151
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.40277 2.42443 2.228 0.0273 *
Age 0.12553 0.12719 0.987 0.3252
Connected 0.10984 0.04693 2.340 0.0205 *
Separate -0.02664 0.04437 -0.600 0.5492
Software 0.55002 0.06873 8.003 2.67e-13 ***
Happiness 0.06271 0.07481 0.838 0.4032
Depression -0.08012 0.05517 -1.452 0.1484
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.843 on 155 degrees of freedom
Multiple R-squared: 0.3579, Adjusted R-squared: 0.3331
F-statistic: 14.4 on 6 and 155 DF, p-value: 5.125e-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.26082785 0.5216557 0.73917215
[2,] 0.45295231 0.9059046 0.54704769
[3,] 0.39248528 0.7849706 0.60751472
[4,] 0.31821006 0.6364201 0.68178994
[5,] 0.29876931 0.5975386 0.70123069
[6,] 0.36268609 0.7253722 0.63731391
[7,] 0.28761934 0.5752387 0.71238066
[8,] 0.25636452 0.5127290 0.74363548
[9,] 0.71801336 0.5639733 0.28198664
[10,] 0.86901551 0.2619690 0.13098449
[11,] 0.83053654 0.3389269 0.16946346
[12,] 0.77861274 0.4427745 0.22138726
[13,] 0.72097364 0.5580527 0.27902636
[14,] 0.75621465 0.4875707 0.24378535
[15,] 0.69907411 0.6018518 0.30092589
[16,] 0.68350503 0.6329899 0.31649497
[17,] 0.62785346 0.7442931 0.37214654
[18,] 0.59291425 0.8141715 0.40708575
[19,] 0.57407567 0.8518487 0.42592433
[20,] 0.51025294 0.9794941 0.48974706
[21,] 0.48973061 0.9794612 0.51026939
[22,] 0.42868860 0.8573772 0.57131140
[23,] 0.41588356 0.8317671 0.58411644
[24,] 0.39132466 0.7826493 0.60867534
[25,] 0.33486819 0.6697364 0.66513181
[26,] 0.31841154 0.6368231 0.68158846
[27,] 0.84259964 0.3148007 0.15740036
[28,] 0.82992982 0.3401404 0.17007018
[29,] 0.82969847 0.3406031 0.17030153
[30,] 0.84756770 0.3048646 0.15243230
[31,] 0.83026988 0.3394602 0.16973012
[32,] 0.80246181 0.3950764 0.19753819
[33,] 0.78861674 0.4227665 0.21138326
[34,] 0.79328846 0.4134231 0.20671154
[35,] 0.75670715 0.4865857 0.24329285
[36,] 0.72066631 0.5586674 0.27933369
[37,] 0.89191767 0.2161647 0.10808233
[38,] 0.92219981 0.1556004 0.07780019
[39,] 0.90186236 0.1962753 0.09813764
[40,] 0.88495412 0.2300918 0.11504588
[41,] 0.88646657 0.2270669 0.11353343
[42,] 0.86279868 0.2744026 0.13720132
[43,] 0.83346818 0.3330636 0.16653182
[44,] 0.86096818 0.2780636 0.13903182
[45,] 0.83348532 0.3330294 0.16651468
[46,] 0.84605136 0.3078973 0.15394864
[47,] 0.83005666 0.3398867 0.16994334
[48,] 0.79894564 0.4021087 0.20105436
[49,] 0.77567481 0.4486504 0.22432519
[50,] 0.73842509 0.5231498 0.26157491
[51,] 0.73675192 0.5264962 0.26324808
[52,] 0.70164788 0.5967042 0.29835212
[53,] 0.65941417 0.6811717 0.34058583
[54,] 0.61677747 0.7664451 0.38322253
[55,] 0.57578442 0.8484312 0.42421558
[56,] 0.53365638 0.9326872 0.46634362
[57,] 0.50514534 0.9897093 0.49485466
[58,] 0.49415761 0.9883152 0.50584239
[59,] 0.63279009 0.7344198 0.36720991
[60,] 0.76632900 0.4673420 0.23367100
[61,] 0.73324284 0.5335143 0.26675716
[62,] 0.81550149 0.3689970 0.18449851
[63,] 0.78324291 0.4335142 0.21675709
[64,] 0.77906157 0.4418769 0.22093843
[65,] 0.75377572 0.4924486 0.24622428
[66,] 0.71608501 0.5678300 0.28391499
[67,] 0.78117997 0.4376401 0.21882003
[68,] 0.74711199 0.5057760 0.25288801
[69,] 0.72763931 0.5447214 0.27236069
[70,] 0.72627610 0.5474478 0.27372390
[71,] 0.68704638 0.6259072 0.31295362
[72,] 0.64902293 0.7019541 0.35097707
[73,] 0.80262874 0.3947425 0.19737126
[74,] 0.76983483 0.4603303 0.23016517
[75,] 0.74161588 0.5167682 0.25838412
[76,] 0.70372340 0.5925532 0.29627660
[77,] 0.68890468 0.6221906 0.31109532
[78,] 0.64713705 0.7057259 0.35286295
[79,] 0.61069177 0.7786165 0.38930823
[80,] 0.58653882 0.8269224 0.41346118
[81,] 0.56899733 0.8620053 0.43100267
[82,] 0.54929518 0.9014096 0.45070482
[83,] 0.50936008 0.9812798 0.49063992
[84,] 0.47191606 0.9438321 0.52808394
[85,] 0.42842424 0.8568485 0.57157576
[86,] 0.44449275 0.8889855 0.55550725
[87,] 0.41157348 0.8231470 0.58842652
[88,] 0.37533626 0.7506725 0.62466374
[89,] 0.37945096 0.7589019 0.62054904
[90,] 0.33707641 0.6741528 0.66292359
[91,] 0.30007027 0.6001405 0.69992973
[92,] 0.27158966 0.5431793 0.72841034
[93,] 0.25795774 0.5159155 0.74204226
[94,] 0.31278760 0.6255752 0.68721240
[95,] 0.27161105 0.5432221 0.72838895
[96,] 0.29732717 0.5946543 0.70267283
[97,] 0.30191685 0.6038337 0.69808315
[98,] 0.28986145 0.5797229 0.71013855
[99,] 0.26208660 0.5241732 0.73791340
[100,] 0.25469675 0.5093935 0.74530325
[101,] 0.22493081 0.4498616 0.77506919
[102,] 0.20513626 0.4102725 0.79486374
[103,] 0.17512704 0.3502541 0.82487296
[104,] 0.23294880 0.4658976 0.76705120
[105,] 0.21149508 0.4229902 0.78850492
[106,] 0.23888662 0.4777732 0.76111338
[107,] 0.21210844 0.4242169 0.78789156
[108,] 0.19106825 0.3821365 0.80893175
[109,] 0.18199084 0.3639817 0.81800916
[110,] 0.20044084 0.4008817 0.79955916
[111,] 0.18588976 0.3717795 0.81411024
[112,] 0.15938647 0.3187729 0.84061353
[113,] 0.13715413 0.2743083 0.86284587
[114,] 0.16727014 0.3345403 0.83272986
[115,] 0.14118644 0.2823729 0.85881356
[116,] 0.11753243 0.2350649 0.88246757
[117,] 0.09376324 0.1875265 0.90623676
[118,] 0.07492416 0.1498483 0.92507584
[119,] 0.07096696 0.1419339 0.92903304
[120,] 0.05518986 0.1103797 0.94481014
[121,] 0.06356871 0.1271374 0.93643129
[122,] 0.06333546 0.1266709 0.93666454
[123,] 0.08477652 0.1695530 0.91522348
[124,] 0.11652662 0.2330532 0.88347338
[125,] 0.11897022 0.2379404 0.88102978
[126,] 0.09407582 0.1881516 0.90592418
[127,] 0.08002242 0.1600448 0.91997758
[128,] 0.05826069 0.1165214 0.94173931
[129,] 0.04093640 0.0818728 0.95906360
[130,] 0.10159083 0.2031817 0.89840917
[131,] 0.07905326 0.1581065 0.92094674
[132,] 0.62182831 0.7563434 0.37817169
[133,] 0.56218526 0.8756295 0.43781474
[134,] 0.49899689 0.9979938 0.50100311
[135,] 0.48764188 0.9752838 0.51235812
[136,] 0.41461299 0.8292260 0.58538701
[137,] 0.40284171 0.8056834 0.59715829
[138,] 0.52269166 0.9546167 0.47730834
[139,] 0.78415670 0.4316866 0.21584330
[140,] 0.71811247 0.5637751 0.28188753
[141,] 0.59284466 0.8143107 0.40715534
[142,] 0.78671330 0.4265734 0.21328670
[143,] 0.84511858 0.3097628 0.15488142
> postscript(file="/var/www/rcomp/tmp/1olzn1321981487.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/2tjuh1321981487.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/3cb8i1321981487.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/4p2jn1321981487.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/5es201321981487.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.289681721 0.240325199 2.788051324 3.352204915 -1.627275666 -1.895585083
7 8 9 10 11 12
3.795832420 -1.628682225 -1.792258761 2.843843838 0.730615625 -0.229966082
13 14 15 16 17 18
0.702195745 0.640389967 -0.498704674 -0.148485591 0.360020393 3.897137961
19 20 21 22 23 24
2.194260280 0.493814510 0.715386914 1.221737402 2.379983257 1.012014831
25 26 27 28 29 30
2.403081165 0.450235232 0.697562765 -1.171714908 0.804491057 -0.034598284
31 32 33 34 35 36
-0.572313474 -0.157442609 -1.159539657 0.560823703 -1.402675284 -5.878979415
37 38 39 40 41 42
-0.652281881 -1.685286573 1.844746502 1.489777683 1.037916765 -1.619117542
43 44 45 46 47 48
2.035120967 -0.252556729 -1.081162738 -4.661966896 -2.535551814 0.140785945
49 50 51 52 53 54
1.238395642 -1.886319293 -0.310200506 -0.002815193 -2.514349072 0.214864422
55 56 57 58 59 60
-2.314372728 1.478379814 -0.096298809 0.995425296 -0.262850643 1.854200655
61 62 63 64 65 66
0.670649058 -0.003983097 -0.387074982 -0.686401957 0.310196479 1.214489775
67 68 69 70 71 72
1.793844275 3.426585056 -3.748249474 0.691344201 -3.482142453 -0.275202135
73 74 75 76 77 78
1.799817969 0.922288340 0.294352938 3.178790617 -0.409433947 1.306121992
79 80 81 82 83 84
-1.779678382 -0.320953109 0.518504360 4.115096406 0.290735508 -0.732309925
85 86 87 88 89 90
-0.045832847 1.457268747 -0.014967026 0.733590274 1.297241706 1.072649780
91 92 93 94 95 96
-1.451375035 0.003783722 0.717765042 -0.076013661 -2.156638277 0.896777920
97 98 99 100 101 102
0.216723644 1.878417125 0.025968516 -0.477252160 -1.210775568 1.191244144
103 104 105 106 107 108
2.582947165 0.216116576 1.800101278 -2.214206621 1.005466492 -0.005266171
109 110 111 112 113 114
1.346381223 -0.691474054 1.035132440 0.129553097 2.562494276 -1.518339394
115 116 117 118 119 120
-2.856567879 1.028672831 -1.747433669 1.063778998 -2.181171670 0.352474775
121 122 123 124 125 126
-1.396227433 -0.125064449 -3.076340711 -1.208017354 -1.039169907 -0.740843999
127 128 129 130 131 132
-0.512836925 0.734608019 0.792221121 -2.945295659 1.899433575 -3.265923810
133 134 135 136 137 138
1.896203075 -1.860672957 -1.661953067 -0.505970686 0.682719775 0.109592305
139 140 141 142 143 144
-2.552639739 -1.554358532 -5.307304220 2.443997051 1.748027181 0.439686698
145 146 147 148 149 150
1.147605025 -4.246196105 2.107075337 -2.274429702 0.808820418 -0.265966489
151 152 153 154 155 156
-3.183275314 -1.512870799 1.386940116 3.947111497 1.211800843 -2.477252929
157 158 159 160 161 162
0.003783722 1.258203738 0.792221121 0.691783727 -0.449215414 0.134780268
> postscript(file="/var/www/rcomp/tmp/6stxh1321981487.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.289681721 NA
1 0.240325199 -3.289681721
2 2.788051324 0.240325199
3 3.352204915 2.788051324
4 -1.627275666 3.352204915
5 -1.895585083 -1.627275666
6 3.795832420 -1.895585083
7 -1.628682225 3.795832420
8 -1.792258761 -1.628682225
9 2.843843838 -1.792258761
10 0.730615625 2.843843838
11 -0.229966082 0.730615625
12 0.702195745 -0.229966082
13 0.640389967 0.702195745
14 -0.498704674 0.640389967
15 -0.148485591 -0.498704674
16 0.360020393 -0.148485591
17 3.897137961 0.360020393
18 2.194260280 3.897137961
19 0.493814510 2.194260280
20 0.715386914 0.493814510
21 1.221737402 0.715386914
22 2.379983257 1.221737402
23 1.012014831 2.379983257
24 2.403081165 1.012014831
25 0.450235232 2.403081165
26 0.697562765 0.450235232
27 -1.171714908 0.697562765
28 0.804491057 -1.171714908
29 -0.034598284 0.804491057
30 -0.572313474 -0.034598284
31 -0.157442609 -0.572313474
32 -1.159539657 -0.157442609
33 0.560823703 -1.159539657
34 -1.402675284 0.560823703
35 -5.878979415 -1.402675284
36 -0.652281881 -5.878979415
37 -1.685286573 -0.652281881
38 1.844746502 -1.685286573
39 1.489777683 1.844746502
40 1.037916765 1.489777683
41 -1.619117542 1.037916765
42 2.035120967 -1.619117542
43 -0.252556729 2.035120967
44 -1.081162738 -0.252556729
45 -4.661966896 -1.081162738
46 -2.535551814 -4.661966896
47 0.140785945 -2.535551814
48 1.238395642 0.140785945
49 -1.886319293 1.238395642
50 -0.310200506 -1.886319293
51 -0.002815193 -0.310200506
52 -2.514349072 -0.002815193
53 0.214864422 -2.514349072
54 -2.314372728 0.214864422
55 1.478379814 -2.314372728
56 -0.096298809 1.478379814
57 0.995425296 -0.096298809
58 -0.262850643 0.995425296
59 1.854200655 -0.262850643
60 0.670649058 1.854200655
61 -0.003983097 0.670649058
62 -0.387074982 -0.003983097
63 -0.686401957 -0.387074982
64 0.310196479 -0.686401957
65 1.214489775 0.310196479
66 1.793844275 1.214489775
67 3.426585056 1.793844275
68 -3.748249474 3.426585056
69 0.691344201 -3.748249474
70 -3.482142453 0.691344201
71 -0.275202135 -3.482142453
72 1.799817969 -0.275202135
73 0.922288340 1.799817969
74 0.294352938 0.922288340
75 3.178790617 0.294352938
76 -0.409433947 3.178790617
77 1.306121992 -0.409433947
78 -1.779678382 1.306121992
79 -0.320953109 -1.779678382
80 0.518504360 -0.320953109
81 4.115096406 0.518504360
82 0.290735508 4.115096406
83 -0.732309925 0.290735508
84 -0.045832847 -0.732309925
85 1.457268747 -0.045832847
86 -0.014967026 1.457268747
87 0.733590274 -0.014967026
88 1.297241706 0.733590274
89 1.072649780 1.297241706
90 -1.451375035 1.072649780
91 0.003783722 -1.451375035
92 0.717765042 0.003783722
93 -0.076013661 0.717765042
94 -2.156638277 -0.076013661
95 0.896777920 -2.156638277
96 0.216723644 0.896777920
97 1.878417125 0.216723644
98 0.025968516 1.878417125
99 -0.477252160 0.025968516
100 -1.210775568 -0.477252160
101 1.191244144 -1.210775568
102 2.582947165 1.191244144
103 0.216116576 2.582947165
104 1.800101278 0.216116576
105 -2.214206621 1.800101278
106 1.005466492 -2.214206621
107 -0.005266171 1.005466492
108 1.346381223 -0.005266171
109 -0.691474054 1.346381223
110 1.035132440 -0.691474054
111 0.129553097 1.035132440
112 2.562494276 0.129553097
113 -1.518339394 2.562494276
114 -2.856567879 -1.518339394
115 1.028672831 -2.856567879
116 -1.747433669 1.028672831
117 1.063778998 -1.747433669
118 -2.181171670 1.063778998
119 0.352474775 -2.181171670
120 -1.396227433 0.352474775
121 -0.125064449 -1.396227433
122 -3.076340711 -0.125064449
123 -1.208017354 -3.076340711
124 -1.039169907 -1.208017354
125 -0.740843999 -1.039169907
126 -0.512836925 -0.740843999
127 0.734608019 -0.512836925
128 0.792221121 0.734608019
129 -2.945295659 0.792221121
130 1.899433575 -2.945295659
131 -3.265923810 1.899433575
132 1.896203075 -3.265923810
133 -1.860672957 1.896203075
134 -1.661953067 -1.860672957
135 -0.505970686 -1.661953067
136 0.682719775 -0.505970686
137 0.109592305 0.682719775
138 -2.552639739 0.109592305
139 -1.554358532 -2.552639739
140 -5.307304220 -1.554358532
141 2.443997051 -5.307304220
142 1.748027181 2.443997051
143 0.439686698 1.748027181
144 1.147605025 0.439686698
145 -4.246196105 1.147605025
146 2.107075337 -4.246196105
147 -2.274429702 2.107075337
148 0.808820418 -2.274429702
149 -0.265966489 0.808820418
150 -3.183275314 -0.265966489
151 -1.512870799 -3.183275314
152 1.386940116 -1.512870799
153 3.947111497 1.386940116
154 1.211800843 3.947111497
155 -2.477252929 1.211800843
156 0.003783722 -2.477252929
157 1.258203738 0.003783722
158 0.792221121 1.258203738
159 0.691783727 0.792221121
160 -0.449215414 0.691783727
161 0.134780268 -0.449215414
162 NA 0.134780268
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.240325199 -3.289681721
[2,] 2.788051324 0.240325199
[3,] 3.352204915 2.788051324
[4,] -1.627275666 3.352204915
[5,] -1.895585083 -1.627275666
[6,] 3.795832420 -1.895585083
[7,] -1.628682225 3.795832420
[8,] -1.792258761 -1.628682225
[9,] 2.843843838 -1.792258761
[10,] 0.730615625 2.843843838
[11,] -0.229966082 0.730615625
[12,] 0.702195745 -0.229966082
[13,] 0.640389967 0.702195745
[14,] -0.498704674 0.640389967
[15,] -0.148485591 -0.498704674
[16,] 0.360020393 -0.148485591
[17,] 3.897137961 0.360020393
[18,] 2.194260280 3.897137961
[19,] 0.493814510 2.194260280
[20,] 0.715386914 0.493814510
[21,] 1.221737402 0.715386914
[22,] 2.379983257 1.221737402
[23,] 1.012014831 2.379983257
[24,] 2.403081165 1.012014831
[25,] 0.450235232 2.403081165
[26,] 0.697562765 0.450235232
[27,] -1.171714908 0.697562765
[28,] 0.804491057 -1.171714908
[29,] -0.034598284 0.804491057
[30,] -0.572313474 -0.034598284
[31,] -0.157442609 -0.572313474
[32,] -1.159539657 -0.157442609
[33,] 0.560823703 -1.159539657
[34,] -1.402675284 0.560823703
[35,] -5.878979415 -1.402675284
[36,] -0.652281881 -5.878979415
[37,] -1.685286573 -0.652281881
[38,] 1.844746502 -1.685286573
[39,] 1.489777683 1.844746502
[40,] 1.037916765 1.489777683
[41,] -1.619117542 1.037916765
[42,] 2.035120967 -1.619117542
[43,] -0.252556729 2.035120967
[44,] -1.081162738 -0.252556729
[45,] -4.661966896 -1.081162738
[46,] -2.535551814 -4.661966896
[47,] 0.140785945 -2.535551814
[48,] 1.238395642 0.140785945
[49,] -1.886319293 1.238395642
[50,] -0.310200506 -1.886319293
[51,] -0.002815193 -0.310200506
[52,] -2.514349072 -0.002815193
[53,] 0.214864422 -2.514349072
[54,] -2.314372728 0.214864422
[55,] 1.478379814 -2.314372728
[56,] -0.096298809 1.478379814
[57,] 0.995425296 -0.096298809
[58,] -0.262850643 0.995425296
[59,] 1.854200655 -0.262850643
[60,] 0.670649058 1.854200655
[61,] -0.003983097 0.670649058
[62,] -0.387074982 -0.003983097
[63,] -0.686401957 -0.387074982
[64,] 0.310196479 -0.686401957
[65,] 1.214489775 0.310196479
[66,] 1.793844275 1.214489775
[67,] 3.426585056 1.793844275
[68,] -3.748249474 3.426585056
[69,] 0.691344201 -3.748249474
[70,] -3.482142453 0.691344201
[71,] -0.275202135 -3.482142453
[72,] 1.799817969 -0.275202135
[73,] 0.922288340 1.799817969
[74,] 0.294352938 0.922288340
[75,] 3.178790617 0.294352938
[76,] -0.409433947 3.178790617
[77,] 1.306121992 -0.409433947
[78,] -1.779678382 1.306121992
[79,] -0.320953109 -1.779678382
[80,] 0.518504360 -0.320953109
[81,] 4.115096406 0.518504360
[82,] 0.290735508 4.115096406
[83,] -0.732309925 0.290735508
[84,] -0.045832847 -0.732309925
[85,] 1.457268747 -0.045832847
[86,] -0.014967026 1.457268747
[87,] 0.733590274 -0.014967026
[88,] 1.297241706 0.733590274
[89,] 1.072649780 1.297241706
[90,] -1.451375035 1.072649780
[91,] 0.003783722 -1.451375035
[92,] 0.717765042 0.003783722
[93,] -0.076013661 0.717765042
[94,] -2.156638277 -0.076013661
[95,] 0.896777920 -2.156638277
[96,] 0.216723644 0.896777920
[97,] 1.878417125 0.216723644
[98,] 0.025968516 1.878417125
[99,] -0.477252160 0.025968516
[100,] -1.210775568 -0.477252160
[101,] 1.191244144 -1.210775568
[102,] 2.582947165 1.191244144
[103,] 0.216116576 2.582947165
[104,] 1.800101278 0.216116576
[105,] -2.214206621 1.800101278
[106,] 1.005466492 -2.214206621
[107,] -0.005266171 1.005466492
[108,] 1.346381223 -0.005266171
[109,] -0.691474054 1.346381223
[110,] 1.035132440 -0.691474054
[111,] 0.129553097 1.035132440
[112,] 2.562494276 0.129553097
[113,] -1.518339394 2.562494276
[114,] -2.856567879 -1.518339394
[115,] 1.028672831 -2.856567879
[116,] -1.747433669 1.028672831
[117,] 1.063778998 -1.747433669
[118,] -2.181171670 1.063778998
[119,] 0.352474775 -2.181171670
[120,] -1.396227433 0.352474775
[121,] -0.125064449 -1.396227433
[122,] -3.076340711 -0.125064449
[123,] -1.208017354 -3.076340711
[124,] -1.039169907 -1.208017354
[125,] -0.740843999 -1.039169907
[126,] -0.512836925 -0.740843999
[127,] 0.734608019 -0.512836925
[128,] 0.792221121 0.734608019
[129,] -2.945295659 0.792221121
[130,] 1.899433575 -2.945295659
[131,] -3.265923810 1.899433575
[132,] 1.896203075 -3.265923810
[133,] -1.860672957 1.896203075
[134,] -1.661953067 -1.860672957
[135,] -0.505970686 -1.661953067
[136,] 0.682719775 -0.505970686
[137,] 0.109592305 0.682719775
[138,] -2.552639739 0.109592305
[139,] -1.554358532 -2.552639739
[140,] -5.307304220 -1.554358532
[141,] 2.443997051 -5.307304220
[142,] 1.748027181 2.443997051
[143,] 0.439686698 1.748027181
[144,] 1.147605025 0.439686698
[145,] -4.246196105 1.147605025
[146,] 2.107075337 -4.246196105
[147,] -2.274429702 2.107075337
[148,] 0.808820418 -2.274429702
[149,] -0.265966489 0.808820418
[150,] -3.183275314 -0.265966489
[151,] -1.512870799 -3.183275314
[152,] 1.386940116 -1.512870799
[153,] 3.947111497 1.386940116
[154,] 1.211800843 3.947111497
[155,] -2.477252929 1.211800843
[156,] 0.003783722 -2.477252929
[157,] 1.258203738 0.003783722
[158,] 0.792221121 1.258203738
[159,] 0.691783727 0.792221121
[160,] -0.449215414 0.691783727
[161,] 0.134780268 -0.449215414
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.240325199 -3.289681721
2 2.788051324 0.240325199
3 3.352204915 2.788051324
4 -1.627275666 3.352204915
5 -1.895585083 -1.627275666
6 3.795832420 -1.895585083
7 -1.628682225 3.795832420
8 -1.792258761 -1.628682225
9 2.843843838 -1.792258761
10 0.730615625 2.843843838
11 -0.229966082 0.730615625
12 0.702195745 -0.229966082
13 0.640389967 0.702195745
14 -0.498704674 0.640389967
15 -0.148485591 -0.498704674
16 0.360020393 -0.148485591
17 3.897137961 0.360020393
18 2.194260280 3.897137961
19 0.493814510 2.194260280
20 0.715386914 0.493814510
21 1.221737402 0.715386914
22 2.379983257 1.221737402
23 1.012014831 2.379983257
24 2.403081165 1.012014831
25 0.450235232 2.403081165
26 0.697562765 0.450235232
27 -1.171714908 0.697562765
28 0.804491057 -1.171714908
29 -0.034598284 0.804491057
30 -0.572313474 -0.034598284
31 -0.157442609 -0.572313474
32 -1.159539657 -0.157442609
33 0.560823703 -1.159539657
34 -1.402675284 0.560823703
35 -5.878979415 -1.402675284
36 -0.652281881 -5.878979415
37 -1.685286573 -0.652281881
38 1.844746502 -1.685286573
39 1.489777683 1.844746502
40 1.037916765 1.489777683
41 -1.619117542 1.037916765
42 2.035120967 -1.619117542
43 -0.252556729 2.035120967
44 -1.081162738 -0.252556729
45 -4.661966896 -1.081162738
46 -2.535551814 -4.661966896
47 0.140785945 -2.535551814
48 1.238395642 0.140785945
49 -1.886319293 1.238395642
50 -0.310200506 -1.886319293
51 -0.002815193 -0.310200506
52 -2.514349072 -0.002815193
53 0.214864422 -2.514349072
54 -2.314372728 0.214864422
55 1.478379814 -2.314372728
56 -0.096298809 1.478379814
57 0.995425296 -0.096298809
58 -0.262850643 0.995425296
59 1.854200655 -0.262850643
60 0.670649058 1.854200655
61 -0.003983097 0.670649058
62 -0.387074982 -0.003983097
63 -0.686401957 -0.387074982
64 0.310196479 -0.686401957
65 1.214489775 0.310196479
66 1.793844275 1.214489775
67 3.426585056 1.793844275
68 -3.748249474 3.426585056
69 0.691344201 -3.748249474
70 -3.482142453 0.691344201
71 -0.275202135 -3.482142453
72 1.799817969 -0.275202135
73 0.922288340 1.799817969
74 0.294352938 0.922288340
75 3.178790617 0.294352938
76 -0.409433947 3.178790617
77 1.306121992 -0.409433947
78 -1.779678382 1.306121992
79 -0.320953109 -1.779678382
80 0.518504360 -0.320953109
81 4.115096406 0.518504360
82 0.290735508 4.115096406
83 -0.732309925 0.290735508
84 -0.045832847 -0.732309925
85 1.457268747 -0.045832847
86 -0.014967026 1.457268747
87 0.733590274 -0.014967026
88 1.297241706 0.733590274
89 1.072649780 1.297241706
90 -1.451375035 1.072649780
91 0.003783722 -1.451375035
92 0.717765042 0.003783722
93 -0.076013661 0.717765042
94 -2.156638277 -0.076013661
95 0.896777920 -2.156638277
96 0.216723644 0.896777920
97 1.878417125 0.216723644
98 0.025968516 1.878417125
99 -0.477252160 0.025968516
100 -1.210775568 -0.477252160
101 1.191244144 -1.210775568
102 2.582947165 1.191244144
103 0.216116576 2.582947165
104 1.800101278 0.216116576
105 -2.214206621 1.800101278
106 1.005466492 -2.214206621
107 -0.005266171 1.005466492
108 1.346381223 -0.005266171
109 -0.691474054 1.346381223
110 1.035132440 -0.691474054
111 0.129553097 1.035132440
112 2.562494276 0.129553097
113 -1.518339394 2.562494276
114 -2.856567879 -1.518339394
115 1.028672831 -2.856567879
116 -1.747433669 1.028672831
117 1.063778998 -1.747433669
118 -2.181171670 1.063778998
119 0.352474775 -2.181171670
120 -1.396227433 0.352474775
121 -0.125064449 -1.396227433
122 -3.076340711 -0.125064449
123 -1.208017354 -3.076340711
124 -1.039169907 -1.208017354
125 -0.740843999 -1.039169907
126 -0.512836925 -0.740843999
127 0.734608019 -0.512836925
128 0.792221121 0.734608019
129 -2.945295659 0.792221121
130 1.899433575 -2.945295659
131 -3.265923810 1.899433575
132 1.896203075 -3.265923810
133 -1.860672957 1.896203075
134 -1.661953067 -1.860672957
135 -0.505970686 -1.661953067
136 0.682719775 -0.505970686
137 0.109592305 0.682719775
138 -2.552639739 0.109592305
139 -1.554358532 -2.552639739
140 -5.307304220 -1.554358532
141 2.443997051 -5.307304220
142 1.748027181 2.443997051
143 0.439686698 1.748027181
144 1.147605025 0.439686698
145 -4.246196105 1.147605025
146 2.107075337 -4.246196105
147 -2.274429702 2.107075337
148 0.808820418 -2.274429702
149 -0.265966489 0.808820418
150 -3.183275314 -0.265966489
151 -1.512870799 -3.183275314
152 1.386940116 -1.512870799
153 3.947111497 1.386940116
154 1.211800843 3.947111497
155 -2.477252929 1.211800843
156 0.003783722 -2.477252929
157 1.258203738 0.003783722
158 0.792221121 1.258203738
159 0.691783727 0.792221121
160 -0.449215414 0.691783727
161 0.134780268 -0.449215414
> plot(z,main=paste('Residual Lag plot, lowess, and regression line'), ylab='values of Residuals', xlab='lagged values of Residuals')
> lines(lowess(z))
> abline(lm(z))
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/7i6h71321981487.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/8xo1m1321981487.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/991931321981487.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/www/rcomp/tmp/10l4ky1321981487.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/rcomp/createtable")
>
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Estimated Regression Equation', 1, TRUE)
> a<-table.row.end(a)
> myeq <- colnames(x)[1]
> myeq <- paste(myeq, '[t] = ', sep='')
> for (i in 1:k){
+ if (mysum$coefficients[i,1] > 0) myeq <- paste(myeq, '+', '')
+ myeq <- paste(myeq, mysum$coefficients[i,1], sep=' ')
+ if (rownames(mysum$coefficients)[i] != '(Intercept)') {
+ myeq <- paste(myeq, rownames(mysum$coefficients)[i], sep='')
+ if (rownames(mysum$coefficients)[i] != 't') myeq <- paste(myeq, '[t]', sep='')
+ }
+ }
> myeq <- paste(myeq, ' + e[t]')
> a<-table.row.start(a)
> a<-table.element(a, myeq)
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/www/rcomp/tmp/11ftg41321981487.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a,hyperlink('http://www.xycoon.com/ols1.htm','Multiple Linear Regression - Ordinary Least Squares',''), 6, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'Variable',header=TRUE)
> a<-table.element(a,'Parameter',header=TRUE)
> a<-table.element(a,'S.D.',header=TRUE)
> a<-table.element(a,'T-STAT
H0: parameter = 0',header=TRUE)
> a<-table.element(a,'2-tail p-value',header=TRUE)
> a<-table.element(a,'1-tail p-value',header=TRUE)
> a<-table.row.end(a)
> for (i in 1:k){
+ a<-table.row.start(a)
+ a<-table.element(a,rownames(mysum$coefficients)[i],header=TRUE)
+ a<-table.element(a,mysum$coefficients[i,1])
+ a<-table.element(a, round(mysum$coefficients[i,2],6))
+ a<-table.element(a, round(mysum$coefficients[i,3],4))
+ a<-table.element(a, round(mysum$coefficients[i,4],6))
+ a<-table.element(a, round(mysum$coefficients[i,4]/2,6))
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/www/rcomp/tmp/12v0s91321981487.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Regression Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple R',1,TRUE)
> a<-table.element(a, sqrt(mysum$r.squared))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'R-squared',1,TRUE)
> a<-table.element(a, mysum$r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Adjusted R-squared',1,TRUE)
> a<-table.element(a, mysum$adj.r.squared)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (value)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[1])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF numerator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[2])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'F-TEST (DF denominator)',1,TRUE)
> a<-table.element(a, mysum$fstatistic[3])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'p-value',1,TRUE)
> a<-table.element(a, 1-pf(mysum$fstatistic[1],mysum$fstatistic[2],mysum$fstatistic[3]))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Residual Statistics', 2, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Residual Standard Deviation',1,TRUE)
> a<-table.element(a, mysum$sigma)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Sum Squared Residuals',1,TRUE)
> a<-table.element(a, sum(myerror*myerror))
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/www/rcomp/tmp/13suak1321981487.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a, 'Multiple Linear Regression - Actuals, Interpolation, and Residuals', 4, TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a, 'Time or Index', 1, TRUE)
> a<-table.element(a, 'Actuals', 1, TRUE)
> a<-table.element(a, 'Interpolation
Forecast', 1, TRUE)
> a<-table.element(a, 'Residuals
Prediction Error', 1, TRUE)
> a<-table.row.end(a)
> for (i in 1:n) {
+ a<-table.row.start(a)
+ a<-table.element(a,i, 1, TRUE)
+ a<-table.element(a,x[i])
+ a<-table.element(a,x[i]-mysum$resid[i])
+ a<-table.element(a,mysum$resid[i])
+ a<-table.row.end(a)
+ }
> a<-table.end(a)
> table.save(a,file="/var/www/rcomp/tmp/14n7161321981487.tab")
> if (n > n25) {
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'p-values',header=TRUE)
+ a<-table.element(a,'Alternative Hypothesis',3,header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'breakpoint index',header=TRUE)
+ a<-table.element(a,'greater',header=TRUE)
+ a<-table.element(a,'2-sided',header=TRUE)
+ a<-table.element(a,'less',header=TRUE)
+ a<-table.row.end(a)
+ for (mypoint in kp3:nmkm3) {
+ a<-table.row.start(a)
+ a<-table.element(a,mypoint,header=TRUE)
+ a<-table.element(a,gqarr[mypoint-kp3+1,1])
+ a<-table.element(a,gqarr[mypoint-kp3+1,2])
+ a<-table.element(a,gqarr[mypoint-kp3+1,3])
+ a<-table.row.end(a)
+ }
+ a<-table.end(a)
+ table.save(a,file="/var/www/rcomp/tmp/15ejdb1321981487.tab")
+ a<-table.start()
+ a<-table.row.start(a)
+ a<-table.element(a,'Meta Analysis of Goldfeld-Quandt test for Heteroskedasticity',4,TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'Description',header=TRUE)
+ a<-table.element(a,'# significant tests',header=TRUE)
+ a<-table.element(a,'% significant tests',header=TRUE)
+ a<-table.element(a,'OK/NOK',header=TRUE)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'1% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant1)
+ a<-table.element(a,numsignificant1/numgqtests)
+ if (numsignificant1/numgqtests < 0.01) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'5% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant5)
+ a<-table.element(a,numsignificant5/numgqtests)
+ if (numsignificant5/numgqtests < 0.05) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'10% type I error level',header=TRUE)
+ a<-table.element(a,numsignificant10)
+ a<-table.element(a,numsignificant10/numgqtests)
+ if (numsignificant10/numgqtests < 0.1) dum <- 'OK' else dum <- 'NOK'
+ a<-table.element(a,dum)
+ a<-table.row.end(a)
+ a<-table.end(a)
+ table.save(a,file="/var/www/rcomp/tmp/168fyh1321981487.tab")
+ }
>
> try(system("convert tmp/1olzn1321981487.ps tmp/1olzn1321981487.png",intern=TRUE))
character(0)
> try(system("convert tmp/2tjuh1321981487.ps tmp/2tjuh1321981487.png",intern=TRUE))
character(0)
> try(system("convert tmp/3cb8i1321981487.ps tmp/3cb8i1321981487.png",intern=TRUE))
character(0)
> try(system("convert tmp/4p2jn1321981487.ps tmp/4p2jn1321981487.png",intern=TRUE))
character(0)
> try(system("convert tmp/5es201321981487.ps tmp/5es201321981487.png",intern=TRUE))
character(0)
> try(system("convert tmp/6stxh1321981487.ps tmp/6stxh1321981487.png",intern=TRUE))
character(0)
> try(system("convert tmp/7i6h71321981487.ps tmp/7i6h71321981487.png",intern=TRUE))
character(0)
> try(system("convert tmp/8xo1m1321981487.ps tmp/8xo1m1321981487.png",intern=TRUE))
character(0)
> try(system("convert tmp/991931321981487.ps tmp/991931321981487.png",intern=TRUE))
character(0)
> try(system("convert tmp/10l4ky1321981487.ps tmp/10l4ky1321981487.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
6.570 0.380 6.949