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(14
+ ,11
+ ,11
+ ,26
+ ,9
+ ,2
+ ,1
+ ,1
+ ,18
+ ,12
+ ,8
+ ,20
+ ,9
+ ,1
+ ,1
+ ,1
+ ,11
+ ,15
+ ,12
+ ,21
+ ,9
+ ,4
+ ,1
+ ,1
+ ,12
+ ,10
+ ,10
+ ,31
+ ,14
+ ,1
+ ,1
+ ,2
+ ,16
+ ,12
+ ,7
+ ,21
+ ,8
+ ,5
+ ,2
+ ,1
+ ,18
+ ,11
+ ,6
+ ,18
+ ,8
+ ,1
+ ,1
+ ,1
+ ,14
+ ,5
+ ,8
+ ,26
+ ,11
+ ,1
+ ,1
+ ,1
+ ,14
+ ,16
+ ,16
+ ,22
+ ,10
+ ,1
+ ,1
+ ,1
+ ,15
+ ,11
+ ,8
+ ,22
+ ,9
+ ,1
+ ,1
+ ,1
+ ,15
+ ,15
+ ,16
+ ,29
+ ,15
+ ,1
+ ,1
+ ,1
+ ,17
+ ,12
+ ,7
+ ,15
+ ,14
+ ,2
+ ,1
+ ,2
+ ,19
+ ,9
+ ,11
+ ,16
+ ,11
+ ,1
+ ,1
+ ,1
+ ,10
+ ,11
+ ,16
+ ,24
+ ,14
+ ,3
+ ,2
+ ,2
+ ,18
+ ,15
+ ,16
+ ,17
+ ,6
+ ,1
+ ,1
+ ,1
+ ,14
+ ,12
+ ,12
+ ,19
+ ,20
+ ,1
+ ,1
+ ,2
+ ,14
+ ,16
+ ,13
+ ,22
+ ,9
+ ,1
+ ,1
+ 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,1
+ ,13
+ ,12
+ ,11
+ ,16
+ ,8
+ ,1
+ ,1
+ ,1)
+ ,dim=c(8
+ ,145)
+ ,dimnames=list(c('Happiness'
+ ,'Popularity'
+ ,'KnowingPeople'
+ ,'CMistakes'
+ ,'DAction'
+ ,'Tobacco'
+ ,'Drugs'
+ ,'Gender')
+ ,1:145))
> y <- array(NA,dim=c(8,145),dimnames=list(c('Happiness','Popularity','KnowingPeople','CMistakes','DAction','Tobacco','Drugs','Gender'),1:145))
> 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
Happiness Popularity KnowingPeople CMistakes DAction Tobacco Drugs Gender
1 14 11 11 26 9 2 1 1
2 18 12 8 20 9 1 1 1
3 11 15 12 21 9 4 1 1
4 12 10 10 31 14 1 1 2
5 16 12 7 21 8 5 2 1
6 18 11 6 18 8 1 1 1
7 14 5 8 26 11 1 1 1
8 14 16 16 22 10 1 1 1
9 15 11 8 22 9 1 1 1
10 15 15 16 29 15 1 1 1
11 17 12 7 15 14 2 1 2
12 19 9 11 16 11 1 1 1
13 10 11 16 24 14 3 2 2
14 18 15 16 17 6 1 1 1
15 14 12 12 19 20 1 1 2
16 14 16 13 22 9 1 1 2
17 17 14 19 31 10 1 1 1
18 14 11 7 28 8 1 1 2
19 16 10 8 38 11 2 1 1
20 18 7 12 26 14 4 2 2
21 14 11 13 25 11 1 1 1
22 12 10 11 25 16 2 1 1
23 17 11 8 29 14 1 1 2
24 9 16 16 28 11 2 4 1
25 16 14 15 15 11 3 1 2
26 14 12 11 18 12 1 1 1
27 11 12 12 21 9 1 2 2
28 16 11 7 25 7 1 2 1
29 13 6 9 23 13 1 1 2
30 17 14 15 23 10 1 1 1
31 15 9 6 19 9 2 1 1
32 14 15 14 18 9 1 1 2
33 16 12 14 18 13 1 1 2
34 9 12 7 26 16 1 1 2
35 15 9 15 18 12 1 1 2
36 17 13 14 18 6 1 1 1
37 13 15 17 28 14 1 1 2
38 15 11 14 17 14 1 1 2
39 16 10 5 29 10 2 2 1
40 16 13 14 12 4 1 1 2
41 12 16 8 28 12 1 1 1
42 11 13 8 20 14 1 1 1
43 15 14 13 17 9 2 1 1
44 17 14 14 17 9 1 1 1
45 13 16 16 20 10 1 1 2
46 16 9 11 31 14 1 1 1
47 14 8 10 21 10 1 1 2
48 11 8 10 19 9 1 1 2
49 12 12 10 23 14 1 1 1
50 12 10 8 15 8 4 1 2
51 15 16 14 24 9 2 1 1
52 16 13 14 28 8 1 1 1
53 15 11 12 16 9 1 1 1
54 12 14 13 19 9 4 3 2
55 12 15 5 21 9 2 2 1
56 8 8 10 21 15 1 1 2
57 13 9 6 20 8 1 1 2
58 11 17 15 16 10 1 1 1
59 14 9 12 25 8 1 1 1
60 15 13 16 30 14 1 1 1
61 10 6 15 29 11 1 1 2
62 11 13 12 22 10 2 1 1
63 12 8 8 19 12 1 1 2
64 15 12 14 33 14 1 1 1
65 15 13 14 17 9 2 1 2
66 14 14 13 9 13 1 1 2
67 16 11 12 14 15 2 2 1
68 15 15 15 15 8 2 1 1
69 15 7 8 12 7 4 1 2
70 13 16 16 21 10 1 1 2
71 17 16 14 20 10 1 1 1
72 13 14 13 29 13 3 2 1
73 15 11 15 33 11 1 1 2
74 13 13 7 21 8 1 1 2
75 15 13 5 15 12 1 1 2
76 16 7 7 19 9 1 1 2
77 15 15 13 23 10 1 1 1
78 16 11 14 20 11 1 1 2
79 15 15 14 20 11 1 1 1
80 14 13 13 18 10 1 1 1
81 15 11 11 31 16 4 1 2
82 7 12 15 18 16 1 1 1
83 17 10 13 13 8 1 1 1
84 13 12 14 9 6 2 1 1
85 15 12 13 20 11 1 1 1
86 14 12 9 18 12 1 1 1
87 13 14 8 23 14 1 2 1
88 16 6 6 17 9 1 1 1
89 12 14 13 17 11 1 1 1
90 14 15 16 16 8 1 1 1
91 17 8 7 31 8 1 1 2
92 15 12 11 15 7 1 1 2
93 17 10 8 28 16 1 1 1
94 12 15 13 26 13 1 1 2
95 16 11 5 20 8 1 2 1
96 11 9 8 19 11 1 2 2
97 15 14 10 25 14 5 1 1
98 9 10 9 18 10 1 1 2
99 16 16 16 20 10 1 1 1
100 10 5 4 33 14 1 1 2
101 10 8 4 24 14 3 3 1
102 15 13 11 22 10 1 1 1
103 11 16 14 32 12 1 1 1
104 13 16 15 31 9 1 1 1
105 14 14 17 13 16 1 1 2
106 18 14 10 18 8 1 1 1
107 16 10 15 17 9 1 1 2
108 14 9 11 29 16 1 1 1
109 14 14 15 22 13 2 1 1
110 14 8 10 18 13 4 1 1
111 14 8 9 22 8 4 3 1
112 12 16 14 25 14 1 1 1
113 14 12 15 20 11 1 1 1
114 15 9 9 20 9 1 1 1
115 15 15 12 17 8 4 3 1
116 13 12 10 26 13 2 3 1
117 17 14 16 10 10 1 1 2
118 17 12 15 15 8 1 2 1
119 19 16 14 20 7 1 1 1
120 15 12 12 14 11 1 1 1
121 13 14 15 16 11 1 1 2
122 9 8 9 23 14 1 2 2
123 15 15 12 11 6 2 2 1
124 15 16 15 19 10 4 1 2
125 16 12 6 30 9 4 1 1
126 11 4 4 21 12 1 1 2
127 14 8 8 20 11 1 1 2
128 11 11 10 22 14 1 1 1
129 15 4 6 30 12 2 3 1
130 13 14 12 25 14 1 1 2
131 16 14 14 23 14 1 1 2
132 14 13 11 23 8 3 1 1
133 15 14 15 21 11 2 1 2
134 16 7 13 30 12 2 1 1
135 16 19 15 22 9 1 1 1
136 11 12 16 32 16 1 1 2
137 13 10 4 22 11 2 2 1
138 16 14 15 15 11 3 1 2
139 12 16 12 21 12 1 1 1
140 9 11 15 27 15 1 1 1
141 13 16 15 22 13 1 2 1
142 13 12 14 9 6 2 1 1
143 14 12 14 29 11 2 1 1
144 19 16 14 20 7 1 1 1
145 13 12 11 16 8 1 1 1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Popularity KnowingPeople CMistakes DAction
18.995717 -0.027802 0.045546 -0.006374 -0.280841
Tobacco Drugs Gender
0.181746 -0.914459 -0.762812
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-6.2416 -1.3881 -0.0171 1.5153 5.3774
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 18.995717 1.559459 12.181 < 2e-16 ***
Popularity -0.027802 0.078309 -0.355 0.723108
KnowingPeople 0.045546 0.066199 0.688 0.492605
CMistakes -0.006374 0.035558 -0.179 0.857999
DAction -0.280841 0.073563 -3.818 0.000203 ***
Tobacco 0.181746 0.201833 0.900 0.369447
Drugs -0.914459 0.368378 -2.482 0.014259 *
Gender -0.762812 0.401175 -1.901 0.059343 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.199 on 137 degrees of freedom
Multiple R-squared: 0.1849, Adjusted R-squared: 0.1433
F-statistic: 4.441 on 7 and 137 DF, p-value: 0.0001773
> 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.2497097 0.4994193 0.75029034
[2,] 0.2105054 0.4210107 0.78949463
[3,] 0.2320846 0.4641691 0.76791543
[4,] 0.3979141 0.7958281 0.60208594
[5,] 0.3405525 0.6811051 0.65944747
[6,] 0.2411308 0.4822616 0.75886922
[7,] 0.5685053 0.8629894 0.43149469
[8,] 0.4771434 0.9542868 0.52285658
[9,] 0.5316197 0.9367605 0.46838026
[10,] 0.8802726 0.2394548 0.11972741
[11,] 0.8588240 0.2823520 0.14117602
[12,] 0.8565929 0.2868142 0.14340709
[13,] 0.8900575 0.2198849 0.10994246
[14,] 0.9269901 0.1460197 0.07300987
[15,] 0.9042260 0.1915481 0.09577403
[16,] 0.8869548 0.2260903 0.11304516
[17,] 0.9123359 0.1753282 0.08766408
[18,] 0.8940540 0.2118919 0.10594597
[19,] 0.8925133 0.2149735 0.10748673
[20,] 0.8840139 0.2319723 0.11598613
[21,] 0.8639508 0.2720983 0.13604917
[22,] 0.8319344 0.3361312 0.16806558
[23,] 0.8195059 0.3609883 0.18049413
[24,] 0.8878805 0.2242391 0.11211953
[25,] 0.8628699 0.2742601 0.13713007
[26,] 0.8296484 0.3407032 0.17035162
[27,] 0.7894328 0.4211343 0.21056715
[28,] 0.7615928 0.4768144 0.23840719
[29,] 0.7627963 0.4744073 0.23720367
[30,] 0.7196987 0.5606026 0.28030131
[31,] 0.6993855 0.6012289 0.30061447
[32,] 0.7333437 0.5333127 0.26665634
[33,] 0.6890939 0.6218121 0.31090607
[34,] 0.6644265 0.6711471 0.33557353
[35,] 0.6254527 0.7490947 0.37454733
[36,] 0.6147104 0.7705792 0.38528961
[37,] 0.5851890 0.8296220 0.41481100
[38,] 0.7114668 0.5770664 0.28853320
[39,] 0.7024817 0.5950365 0.29751827
[40,] 0.7472797 0.5054406 0.25272032
[41,] 0.7036337 0.5927326 0.29636631
[42,] 0.6593470 0.6813061 0.34065303
[43,] 0.6189543 0.7620914 0.38104571
[44,] 0.5854778 0.8290445 0.41452223
[45,] 0.5665666 0.8668667 0.43343335
[46,] 0.7575765 0.4848469 0.24242346
[47,] 0.7311849 0.5376302 0.26881512
[48,] 0.8045271 0.3909458 0.19547290
[49,] 0.7908322 0.4183357 0.20916784
[50,] 0.7651374 0.4697251 0.23486257
[51,] 0.8476961 0.3046078 0.15230388
[52,] 0.9008367 0.1983266 0.09916330
[53,] 0.8865337 0.2269326 0.11346630
[54,] 0.8708935 0.2582130 0.12910650
[55,] 0.8445751 0.3108497 0.15542486
[56,] 0.8163176 0.3673647 0.18368237
[57,] 0.8528691 0.2942618 0.14713090
[58,] 0.8251227 0.3497545 0.17487725
[59,] 0.7933451 0.4133097 0.20665486
[60,] 0.7687609 0.4624783 0.23123913
[61,] 0.7685207 0.4629586 0.23147932
[62,] 0.7302474 0.5395053 0.26975263
[63,] 0.7006434 0.5987132 0.29935658
[64,] 0.6836345 0.6327311 0.31636555
[65,] 0.6699730 0.6600540 0.33002699
[66,] 0.6513470 0.6973061 0.34865304
[67,] 0.6043219 0.7913563 0.39567813
[68,] 0.5993233 0.8013535 0.40067674
[69,] 0.5537720 0.8924560 0.44622799
[70,] 0.5118627 0.9762747 0.48813733
[71,] 0.5156831 0.9686337 0.48431687
[72,] 0.7967464 0.4065072 0.20325358
[73,] 0.7800977 0.4398047 0.21990234
[74,] 0.8211514 0.3576971 0.17884857
[75,] 0.7880764 0.4238471 0.21192356
[76,] 0.7498814 0.5002372 0.25011861
[77,] 0.7116297 0.5767405 0.28837026
[78,] 0.6843006 0.6313988 0.31569938
[79,] 0.6899708 0.6200585 0.31002923
[80,] 0.6694441 0.6611117 0.33055586
[81,] 0.6994322 0.6011356 0.30056780
[82,] 0.6525442 0.6949116 0.34745578
[83,] 0.8239344 0.3521312 0.17606558
[84,] 0.7941130 0.4117739 0.20588695
[85,] 0.7956070 0.4087860 0.20439298
[86,] 0.7774177 0.4451646 0.22258229
[87,] 0.7525589 0.4948822 0.24744112
[88,] 0.8995403 0.2009193 0.10045965
[89,] 0.8795894 0.2408213 0.12041064
[90,] 0.8791532 0.2416936 0.12084679
[91,] 0.8633366 0.2733267 0.13666336
[92,] 0.8321782 0.3356436 0.16782182
[93,] 0.8626848 0.2746304 0.13731522
[94,] 0.8866340 0.2267321 0.11336604
[95,] 0.8917159 0.2165681 0.10828407
[96,] 0.9085861 0.1828279 0.09141395
[97,] 0.8849746 0.2300508 0.11502542
[98,] 0.8989646 0.2020708 0.10103538
[99,] 0.8734009 0.2531983 0.12659914
[100,] 0.9026611 0.1946778 0.09733892
[101,] 0.8829563 0.2340875 0.11704375
[102,] 0.8512057 0.2975887 0.14879434
[103,] 0.8104019 0.3791962 0.18959811
[104,] 0.7659762 0.4680477 0.23402383
[105,] 0.7244215 0.5511570 0.27557851
[106,] 0.6655754 0.6688491 0.33442456
[107,] 0.7132527 0.5734945 0.28674726
[108,] 0.6900290 0.6199421 0.30997103
[109,] 0.7037738 0.5924524 0.29622618
[110,] 0.8022129 0.3955741 0.19778706
[111,] 0.7498430 0.5003140 0.25015699
[112,] 0.8556847 0.2886305 0.14431526
[113,] 0.8216358 0.3567284 0.17836419
[114,] 0.7826880 0.4346241 0.21731203
[115,] 0.7119521 0.5760959 0.28804795
[116,] 0.6649057 0.6701886 0.33509430
[117,] 0.5768305 0.8463390 0.42316950
[118,] 0.5328287 0.9343425 0.46717127
[119,] 0.4376338 0.8752677 0.56236617
[120,] 0.3452990 0.6905979 0.65470103
[121,] 0.4245580 0.8491161 0.57544196
[122,] 0.5696084 0.8607832 0.43039161
[123,] 0.4337545 0.8675089 0.56624554
[124,] 0.6469733 0.7060534 0.35302672
> postscript(file="/var/www/rcomp/tmp/1gy301292693455.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/2gy301292693455.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/398231292693455.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/498231292693455.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/598231292693455.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 = 145
Frequency = 1
1 2 3 4 5 6
-1.183831603 3.124112193 -4.513530663 -0.785456990 1.082666287 2.893813915
7 8 9 10 11 12
-0.470580134 -0.835460376 0.109057742 1.585557848 4.123056516 4.440250446
13 14 15 16 17 18
-2.524584273 1.981504961 2.787609995 -0.216849939 2.029661675 -0.325180455
19 20 21 22 23 24
1.563174385 5.377393070 -0.537871116 -1.252124554 4.320690241 -2.954744160
25 26 27 28 29 30
1.790022586 -0.182753497 -2.374428293 1.526504463 -0.182953303 2.160855041
31 32 33 34 35 36
-0.056322820 -0.315694927 2.724259617 -3.063401922 1.314465218 1.023366768
37 38 39 40 41 42
0.015608698 1.970923604 2.276066102 0.186253375 -1.871164084 -2.443882756
43 44 45 46 47 48
-0.248883107 1.887316774 -1.085396650 2.378382345 -0.028164275 -3.321752834
49 50 51 52 53 54
-1.543655963 -3.026630479 -0.194206328 0.648788034 -0.111371967 -1.007897273
55 56 57 58 59 60
-1.916754109 -4.623961723 -1.386231259 -3.800355633 -1.390451255 1.255486364
61 62 63 64 65 66
-3.979668520 -3.918428583 -1.388138522 1.337898720 0.440579778 0.768044785
67 68 69 70 71 72
3.293636051 -0.605761949 -0.410000560 -1.079022625 2.242884356 -0.316319767
73 74 75 76 77 78
1.184840074 -1.314193628 1.862017047 1.787083838 0.279750321 2.147524146
79 80 81 82 83 84
0.495922367 -0.807724800 2.213241324 -6.241577018 1.515316559 -3.243548224
85 86 87 88 89 90
0.458061260 -0.091660716 0.517501093 1.029267905 -2.505455815 -1.463188043
91 92 93 94 95 96
2.610534121 0.156733653 4.085382963 -1.095794299 1.866567632 -1.726717257
97 98 99 100 101 102
0.797711997 -4.946134960 1.151791575 -2.638443093 -1.909787582 0.308864079
103 104 105 106 107 108
-3.118946329 -2.013388275 1.453876852 2.795035850 1.493372162 0.927315317
109 110 111 112 113 114
-0.184743724 -0.512815408 -0.017056918 -1.601883480 -0.633031521 -0.004841695
115 116 117 118 119 120
1.009051282 0.841797882 2.795258107 2.407036102 3.400362825 0.465363504
121 122 123 124 125 126
-0.840110845 -2.932048517 -0.141840619 0.408536901 0.733706403 -2.304414907
127 128 129 130 131 132
0.337394992 -2.577832487 2.546219039 0.196416078 3.092575248 -1.609935461
133 134 135 136 137 138
1.010013005 1.481883248 1.012653002 -1.435075290 -0.442165169 1.790022586
139 140 141 142 143 144
-2.097967817 -4.492853807 -0.032933177 -3.243548224 -0.711865181 3.400362825
145
-2.318863588
> postscript(file="/var/www/rcomp/tmp/6kz2p1292693455.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 = 145
Frequency = 1
lag(myerror, k = 1) myerror
0 -1.183831603 NA
1 3.124112193 -1.183831603
2 -4.513530663 3.124112193
3 -0.785456990 -4.513530663
4 1.082666287 -0.785456990
5 2.893813915 1.082666287
6 -0.470580134 2.893813915
7 -0.835460376 -0.470580134
8 0.109057742 -0.835460376
9 1.585557848 0.109057742
10 4.123056516 1.585557848
11 4.440250446 4.123056516
12 -2.524584273 4.440250446
13 1.981504961 -2.524584273
14 2.787609995 1.981504961
15 -0.216849939 2.787609995
16 2.029661675 -0.216849939
17 -0.325180455 2.029661675
18 1.563174385 -0.325180455
19 5.377393070 1.563174385
20 -0.537871116 5.377393070
21 -1.252124554 -0.537871116
22 4.320690241 -1.252124554
23 -2.954744160 4.320690241
24 1.790022586 -2.954744160
25 -0.182753497 1.790022586
26 -2.374428293 -0.182753497
27 1.526504463 -2.374428293
28 -0.182953303 1.526504463
29 2.160855041 -0.182953303
30 -0.056322820 2.160855041
31 -0.315694927 -0.056322820
32 2.724259617 -0.315694927
33 -3.063401922 2.724259617
34 1.314465218 -3.063401922
35 1.023366768 1.314465218
36 0.015608698 1.023366768
37 1.970923604 0.015608698
38 2.276066102 1.970923604
39 0.186253375 2.276066102
40 -1.871164084 0.186253375
41 -2.443882756 -1.871164084
42 -0.248883107 -2.443882756
43 1.887316774 -0.248883107
44 -1.085396650 1.887316774
45 2.378382345 -1.085396650
46 -0.028164275 2.378382345
47 -3.321752834 -0.028164275
48 -1.543655963 -3.321752834
49 -3.026630479 -1.543655963
50 -0.194206328 -3.026630479
51 0.648788034 -0.194206328
52 -0.111371967 0.648788034
53 -1.007897273 -0.111371967
54 -1.916754109 -1.007897273
55 -4.623961723 -1.916754109
56 -1.386231259 -4.623961723
57 -3.800355633 -1.386231259
58 -1.390451255 -3.800355633
59 1.255486364 -1.390451255
60 -3.979668520 1.255486364
61 -3.918428583 -3.979668520
62 -1.388138522 -3.918428583
63 1.337898720 -1.388138522
64 0.440579778 1.337898720
65 0.768044785 0.440579778
66 3.293636051 0.768044785
67 -0.605761949 3.293636051
68 -0.410000560 -0.605761949
69 -1.079022625 -0.410000560
70 2.242884356 -1.079022625
71 -0.316319767 2.242884356
72 1.184840074 -0.316319767
73 -1.314193628 1.184840074
74 1.862017047 -1.314193628
75 1.787083838 1.862017047
76 0.279750321 1.787083838
77 2.147524146 0.279750321
78 0.495922367 2.147524146
79 -0.807724800 0.495922367
80 2.213241324 -0.807724800
81 -6.241577018 2.213241324
82 1.515316559 -6.241577018
83 -3.243548224 1.515316559
84 0.458061260 -3.243548224
85 -0.091660716 0.458061260
86 0.517501093 -0.091660716
87 1.029267905 0.517501093
88 -2.505455815 1.029267905
89 -1.463188043 -2.505455815
90 2.610534121 -1.463188043
91 0.156733653 2.610534121
92 4.085382963 0.156733653
93 -1.095794299 4.085382963
94 1.866567632 -1.095794299
95 -1.726717257 1.866567632
96 0.797711997 -1.726717257
97 -4.946134960 0.797711997
98 1.151791575 -4.946134960
99 -2.638443093 1.151791575
100 -1.909787582 -2.638443093
101 0.308864079 -1.909787582
102 -3.118946329 0.308864079
103 -2.013388275 -3.118946329
104 1.453876852 -2.013388275
105 2.795035850 1.453876852
106 1.493372162 2.795035850
107 0.927315317 1.493372162
108 -0.184743724 0.927315317
109 -0.512815408 -0.184743724
110 -0.017056918 -0.512815408
111 -1.601883480 -0.017056918
112 -0.633031521 -1.601883480
113 -0.004841695 -0.633031521
114 1.009051282 -0.004841695
115 0.841797882 1.009051282
116 2.795258107 0.841797882
117 2.407036102 2.795258107
118 3.400362825 2.407036102
119 0.465363504 3.400362825
120 -0.840110845 0.465363504
121 -2.932048517 -0.840110845
122 -0.141840619 -2.932048517
123 0.408536901 -0.141840619
124 0.733706403 0.408536901
125 -2.304414907 0.733706403
126 0.337394992 -2.304414907
127 -2.577832487 0.337394992
128 2.546219039 -2.577832487
129 0.196416078 2.546219039
130 3.092575248 0.196416078
131 -1.609935461 3.092575248
132 1.010013005 -1.609935461
133 1.481883248 1.010013005
134 1.012653002 1.481883248
135 -1.435075290 1.012653002
136 -0.442165169 -1.435075290
137 1.790022586 -0.442165169
138 -2.097967817 1.790022586
139 -4.492853807 -2.097967817
140 -0.032933177 -4.492853807
141 -3.243548224 -0.032933177
142 -0.711865181 -3.243548224
143 3.400362825 -0.711865181
144 -2.318863588 3.400362825
145 NA -2.318863588
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 3.124112193 -1.183831603
[2,] -4.513530663 3.124112193
[3,] -0.785456990 -4.513530663
[4,] 1.082666287 -0.785456990
[5,] 2.893813915 1.082666287
[6,] -0.470580134 2.893813915
[7,] -0.835460376 -0.470580134
[8,] 0.109057742 -0.835460376
[9,] 1.585557848 0.109057742
[10,] 4.123056516 1.585557848
[11,] 4.440250446 4.123056516
[12,] -2.524584273 4.440250446
[13,] 1.981504961 -2.524584273
[14,] 2.787609995 1.981504961
[15,] -0.216849939 2.787609995
[16,] 2.029661675 -0.216849939
[17,] -0.325180455 2.029661675
[18,] 1.563174385 -0.325180455
[19,] 5.377393070 1.563174385
[20,] -0.537871116 5.377393070
[21,] -1.252124554 -0.537871116
[22,] 4.320690241 -1.252124554
[23,] -2.954744160 4.320690241
[24,] 1.790022586 -2.954744160
[25,] -0.182753497 1.790022586
[26,] -2.374428293 -0.182753497
[27,] 1.526504463 -2.374428293
[28,] -0.182953303 1.526504463
[29,] 2.160855041 -0.182953303
[30,] -0.056322820 2.160855041
[31,] -0.315694927 -0.056322820
[32,] 2.724259617 -0.315694927
[33,] -3.063401922 2.724259617
[34,] 1.314465218 -3.063401922
[35,] 1.023366768 1.314465218
[36,] 0.015608698 1.023366768
[37,] 1.970923604 0.015608698
[38,] 2.276066102 1.970923604
[39,] 0.186253375 2.276066102
[40,] -1.871164084 0.186253375
[41,] -2.443882756 -1.871164084
[42,] -0.248883107 -2.443882756
[43,] 1.887316774 -0.248883107
[44,] -1.085396650 1.887316774
[45,] 2.378382345 -1.085396650
[46,] -0.028164275 2.378382345
[47,] -3.321752834 -0.028164275
[48,] -1.543655963 -3.321752834
[49,] -3.026630479 -1.543655963
[50,] -0.194206328 -3.026630479
[51,] 0.648788034 -0.194206328
[52,] -0.111371967 0.648788034
[53,] -1.007897273 -0.111371967
[54,] -1.916754109 -1.007897273
[55,] -4.623961723 -1.916754109
[56,] -1.386231259 -4.623961723
[57,] -3.800355633 -1.386231259
[58,] -1.390451255 -3.800355633
[59,] 1.255486364 -1.390451255
[60,] -3.979668520 1.255486364
[61,] -3.918428583 -3.979668520
[62,] -1.388138522 -3.918428583
[63,] 1.337898720 -1.388138522
[64,] 0.440579778 1.337898720
[65,] 0.768044785 0.440579778
[66,] 3.293636051 0.768044785
[67,] -0.605761949 3.293636051
[68,] -0.410000560 -0.605761949
[69,] -1.079022625 -0.410000560
[70,] 2.242884356 -1.079022625
[71,] -0.316319767 2.242884356
[72,] 1.184840074 -0.316319767
[73,] -1.314193628 1.184840074
[74,] 1.862017047 -1.314193628
[75,] 1.787083838 1.862017047
[76,] 0.279750321 1.787083838
[77,] 2.147524146 0.279750321
[78,] 0.495922367 2.147524146
[79,] -0.807724800 0.495922367
[80,] 2.213241324 -0.807724800
[81,] -6.241577018 2.213241324
[82,] 1.515316559 -6.241577018
[83,] -3.243548224 1.515316559
[84,] 0.458061260 -3.243548224
[85,] -0.091660716 0.458061260
[86,] 0.517501093 -0.091660716
[87,] 1.029267905 0.517501093
[88,] -2.505455815 1.029267905
[89,] -1.463188043 -2.505455815
[90,] 2.610534121 -1.463188043
[91,] 0.156733653 2.610534121
[92,] 4.085382963 0.156733653
[93,] -1.095794299 4.085382963
[94,] 1.866567632 -1.095794299
[95,] -1.726717257 1.866567632
[96,] 0.797711997 -1.726717257
[97,] -4.946134960 0.797711997
[98,] 1.151791575 -4.946134960
[99,] -2.638443093 1.151791575
[100,] -1.909787582 -2.638443093
[101,] 0.308864079 -1.909787582
[102,] -3.118946329 0.308864079
[103,] -2.013388275 -3.118946329
[104,] 1.453876852 -2.013388275
[105,] 2.795035850 1.453876852
[106,] 1.493372162 2.795035850
[107,] 0.927315317 1.493372162
[108,] -0.184743724 0.927315317
[109,] -0.512815408 -0.184743724
[110,] -0.017056918 -0.512815408
[111,] -1.601883480 -0.017056918
[112,] -0.633031521 -1.601883480
[113,] -0.004841695 -0.633031521
[114,] 1.009051282 -0.004841695
[115,] 0.841797882 1.009051282
[116,] 2.795258107 0.841797882
[117,] 2.407036102 2.795258107
[118,] 3.400362825 2.407036102
[119,] 0.465363504 3.400362825
[120,] -0.840110845 0.465363504
[121,] -2.932048517 -0.840110845
[122,] -0.141840619 -2.932048517
[123,] 0.408536901 -0.141840619
[124,] 0.733706403 0.408536901
[125,] -2.304414907 0.733706403
[126,] 0.337394992 -2.304414907
[127,] -2.577832487 0.337394992
[128,] 2.546219039 -2.577832487
[129,] 0.196416078 2.546219039
[130,] 3.092575248 0.196416078
[131,] -1.609935461 3.092575248
[132,] 1.010013005 -1.609935461
[133,] 1.481883248 1.010013005
[134,] 1.012653002 1.481883248
[135,] -1.435075290 1.012653002
[136,] -0.442165169 -1.435075290
[137,] 1.790022586 -0.442165169
[138,] -2.097967817 1.790022586
[139,] -4.492853807 -2.097967817
[140,] -0.032933177 -4.492853807
[141,] -3.243548224 -0.032933177
[142,] -0.711865181 -3.243548224
[143,] 3.400362825 -0.711865181
[144,] -2.318863588 3.400362825
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 3.124112193 -1.183831603
2 -4.513530663 3.124112193
3 -0.785456990 -4.513530663
4 1.082666287 -0.785456990
5 2.893813915 1.082666287
6 -0.470580134 2.893813915
7 -0.835460376 -0.470580134
8 0.109057742 -0.835460376
9 1.585557848 0.109057742
10 4.123056516 1.585557848
11 4.440250446 4.123056516
12 -2.524584273 4.440250446
13 1.981504961 -2.524584273
14 2.787609995 1.981504961
15 -0.216849939 2.787609995
16 2.029661675 -0.216849939
17 -0.325180455 2.029661675
18 1.563174385 -0.325180455
19 5.377393070 1.563174385
20 -0.537871116 5.377393070
21 -1.252124554 -0.537871116
22 4.320690241 -1.252124554
23 -2.954744160 4.320690241
24 1.790022586 -2.954744160
25 -0.182753497 1.790022586
26 -2.374428293 -0.182753497
27 1.526504463 -2.374428293
28 -0.182953303 1.526504463
29 2.160855041 -0.182953303
30 -0.056322820 2.160855041
31 -0.315694927 -0.056322820
32 2.724259617 -0.315694927
33 -3.063401922 2.724259617
34 1.314465218 -3.063401922
35 1.023366768 1.314465218
36 0.015608698 1.023366768
37 1.970923604 0.015608698
38 2.276066102 1.970923604
39 0.186253375 2.276066102
40 -1.871164084 0.186253375
41 -2.443882756 -1.871164084
42 -0.248883107 -2.443882756
43 1.887316774 -0.248883107
44 -1.085396650 1.887316774
45 2.378382345 -1.085396650
46 -0.028164275 2.378382345
47 -3.321752834 -0.028164275
48 -1.543655963 -3.321752834
49 -3.026630479 -1.543655963
50 -0.194206328 -3.026630479
51 0.648788034 -0.194206328
52 -0.111371967 0.648788034
53 -1.007897273 -0.111371967
54 -1.916754109 -1.007897273
55 -4.623961723 -1.916754109
56 -1.386231259 -4.623961723
57 -3.800355633 -1.386231259
58 -1.390451255 -3.800355633
59 1.255486364 -1.390451255
60 -3.979668520 1.255486364
61 -3.918428583 -3.979668520
62 -1.388138522 -3.918428583
63 1.337898720 -1.388138522
64 0.440579778 1.337898720
65 0.768044785 0.440579778
66 3.293636051 0.768044785
67 -0.605761949 3.293636051
68 -0.410000560 -0.605761949
69 -1.079022625 -0.410000560
70 2.242884356 -1.079022625
71 -0.316319767 2.242884356
72 1.184840074 -0.316319767
73 -1.314193628 1.184840074
74 1.862017047 -1.314193628
75 1.787083838 1.862017047
76 0.279750321 1.787083838
77 2.147524146 0.279750321
78 0.495922367 2.147524146
79 -0.807724800 0.495922367
80 2.213241324 -0.807724800
81 -6.241577018 2.213241324
82 1.515316559 -6.241577018
83 -3.243548224 1.515316559
84 0.458061260 -3.243548224
85 -0.091660716 0.458061260
86 0.517501093 -0.091660716
87 1.029267905 0.517501093
88 -2.505455815 1.029267905
89 -1.463188043 -2.505455815
90 2.610534121 -1.463188043
91 0.156733653 2.610534121
92 4.085382963 0.156733653
93 -1.095794299 4.085382963
94 1.866567632 -1.095794299
95 -1.726717257 1.866567632
96 0.797711997 -1.726717257
97 -4.946134960 0.797711997
98 1.151791575 -4.946134960
99 -2.638443093 1.151791575
100 -1.909787582 -2.638443093
101 0.308864079 -1.909787582
102 -3.118946329 0.308864079
103 -2.013388275 -3.118946329
104 1.453876852 -2.013388275
105 2.795035850 1.453876852
106 1.493372162 2.795035850
107 0.927315317 1.493372162
108 -0.184743724 0.927315317
109 -0.512815408 -0.184743724
110 -0.017056918 -0.512815408
111 -1.601883480 -0.017056918
112 -0.633031521 -1.601883480
113 -0.004841695 -0.633031521
114 1.009051282 -0.004841695
115 0.841797882 1.009051282
116 2.795258107 0.841797882
117 2.407036102 2.795258107
118 3.400362825 2.407036102
119 0.465363504 3.400362825
120 -0.840110845 0.465363504
121 -2.932048517 -0.840110845
122 -0.141840619 -2.932048517
123 0.408536901 -0.141840619
124 0.733706403 0.408536901
125 -2.304414907 0.733706403
126 0.337394992 -2.304414907
127 -2.577832487 0.337394992
128 2.546219039 -2.577832487
129 0.196416078 2.546219039
130 3.092575248 0.196416078
131 -1.609935461 3.092575248
132 1.010013005 -1.609935461
133 1.481883248 1.010013005
134 1.012653002 1.481883248
135 -1.435075290 1.012653002
136 -0.442165169 -1.435075290
137 1.790022586 -0.442165169
138 -2.097967817 1.790022586
139 -4.492853807 -2.097967817
140 -0.032933177 -4.492853807
141 -3.243548224 -0.032933177
142 -0.711865181 -3.243548224
143 3.400362825 -0.711865181
144 -2.318863588 3.400362825
> 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/7vqjr1292693455.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/8vqjr1292693455.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/9vqjr1292693455.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/1050ic1292693455.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/119ig01292693455.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/12u1x61292693455.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/138avf1292693455.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/14tbt21292693455.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/15xtr81292693455.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/160c8w1292693455.tab")
+ }
>
> try(system("convert tmp/1gy301292693455.ps tmp/1gy301292693455.png",intern=TRUE))
character(0)
> try(system("convert tmp/2gy301292693455.ps tmp/2gy301292693455.png",intern=TRUE))
character(0)
> try(system("convert tmp/398231292693455.ps tmp/398231292693455.png",intern=TRUE))
character(0)
> try(system("convert tmp/498231292693455.ps tmp/498231292693455.png",intern=TRUE))
character(0)
> try(system("convert tmp/598231292693455.ps tmp/598231292693455.png",intern=TRUE))
character(0)
> try(system("convert tmp/6kz2p1292693455.ps tmp/6kz2p1292693455.png",intern=TRUE))
character(0)
> try(system("convert tmp/7vqjr1292693455.ps tmp/7vqjr1292693455.png",intern=TRUE))
character(0)
> try(system("convert tmp/8vqjr1292693455.ps tmp/8vqjr1292693455.png",intern=TRUE))
character(0)
> try(system("convert tmp/9vqjr1292693455.ps tmp/9vqjr1292693455.png",intern=TRUE))
character(0)
> try(system("convert tmp/1050ic1292693455.ps tmp/1050ic1292693455.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.410 1.570 6.027