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
+ ,18
+ ,12
+ ,8
+ ,20
+ ,9
+ ,1
+ ,1
+ ,11
+ ,15
+ ,12
+ ,21
+ ,9
+ ,4
+ ,1
+ ,12
+ ,10
+ ,10
+ ,31
+ ,14
+ ,1
+ ,1
+ ,16
+ ,12
+ ,7
+ ,21
+ ,8
+ ,5
+ ,2
+ ,18
+ ,11
+ ,6
+ ,18
+ ,8
+ ,1
+ ,1
+ ,14
+ ,5
+ ,8
+ ,26
+ ,11
+ ,1
+ ,1
+ ,14
+ ,16
+ ,16
+ ,22
+ ,10
+ ,1
+ ,1
+ ,15
+ ,11
+ ,8
+ ,22
+ ,9
+ ,1
+ ,1
+ ,15
+ ,15
+ ,16
+ ,29
+ ,15
+ ,1
+ ,1
+ ,17
+ ,12
+ ,7
+ ,15
+ ,14
+ ,2
+ ,1
+ ,19
+ ,9
+ ,11
+ ,16
+ ,11
+ ,1
+ ,1
+ ,10
+ ,11
+ ,16
+ ,24
+ ,14
+ ,3
+ ,2
+ ,18
+ ,15
+ ,16
+ ,17
+ ,6
+ ,1
+ ,1
+ ,14
+ ,12
+ ,12
+ ,19
+ ,20
+ ,1
+ ,1
+ ,14
+ ,16
+ ,13
+ ,22
+ ,9
+ ,1
+ ,1
+ ,17
+ ,14
+ ,19
+ ,31
+ ,10
+ ,1
+ ,1
+ ,14
+ ,11
+ ,7
+ ,28
+ ,8
+ ,1
+ ,1
+ ,16
+ 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
+ ,16
+ ,15
+ ,22
+ ,13
+ ,1
+ ,2
+ ,13
+ ,12
+ ,14
+ ,9
+ ,6
+ ,2
+ ,1
+ ,14
+ ,12
+ ,14
+ ,29
+ ,11
+ ,2
+ ,1
+ ,19
+ ,16
+ ,14
+ ,20
+ ,7
+ ,1
+ ,1
+ ,13
+ ,12
+ ,11
+ ,16
+ ,8
+ ,1
+ ,1)
+ ,dim=c(7
+ ,145)
+ ,dimnames=list(c('Happiness'
+ ,'Popularity'
+ ,'KnowingPeople'
+ ,'CMistakes'
+ ,'DAction'
+ ,'Tobacco'
+ ,'Drugs')
+ ,1:145))
> y <- array(NA,dim=c(7,145),dimnames=list(c('Happiness','Popularity','KnowingPeople','CMistakes','DAction','Tobacco','Drugs'),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
1 14 11 11 26 9 2 1
2 18 12 8 20 9 1 1
3 11 15 12 21 9 4 1
4 12 10 10 31 14 1 1
5 16 12 7 21 8 5 2
6 18 11 6 18 8 1 1
7 14 5 8 26 11 1 1
8 14 16 16 22 10 1 1
9 15 11 8 22 9 1 1
10 15 15 16 29 15 1 1
11 17 12 7 15 14 2 1
12 19 9 11 16 11 1 1
13 10 11 16 24 14 3 2
14 18 15 16 17 6 1 1
15 14 12 12 19 20 1 1
16 14 16 13 22 9 1 1
17 17 14 19 31 10 1 1
18 14 11 7 28 8 1 1
19 16 10 8 38 11 2 1
20 18 7 12 26 14 4 2
21 14 11 13 25 11 1 1
22 12 10 11 25 16 2 1
23 17 11 8 29 14 1 1
24 9 16 16 28 11 2 4
25 16 14 15 15 11 3 1
26 14 12 11 18 12 1 1
27 11 12 12 21 9 1 2
28 16 11 7 25 7 1 2
29 13 6 9 23 13 1 1
30 17 14 15 23 10 1 1
31 15 9 6 19 9 2 1
32 14 15 14 18 9 1 1
33 16 12 14 18 13 1 1
34 9 12 7 26 16 1 1
35 15 9 15 18 12 1 1
36 17 13 14 18 6 1 1
37 13 15 17 28 14 1 1
38 15 11 14 17 14 1 1
39 16 10 5 29 10 2 2
40 16 13 14 12 4 1 1
41 12 16 8 28 12 1 1
42 11 13 8 20 14 1 1
43 15 14 13 17 9 2 1
44 17 14 14 17 9 1 1
45 13 16 16 20 10 1 1
46 16 9 11 31 14 1 1
47 14 8 10 21 10 1 1
48 11 8 10 19 9 1 1
49 12 12 10 23 14 1 1
50 12 10 8 15 8 4 1
51 15 16 14 24 9 2 1
52 16 13 14 28 8 1 1
53 15 11 12 16 9 1 1
54 12 14 13 19 9 4 3
55 12 15 5 21 9 2 2
56 8 8 10 21 15 1 1
57 13 9 6 20 8 1 1
58 11 17 15 16 10 1 1
59 14 9 12 25 8 1 1
60 15 13 16 30 14 1 1
61 10 6 15 29 11 1 1
62 11 13 12 22 10 2 1
63 12 8 8 19 12 1 1
64 15 12 14 33 14 1 1
65 15 13 14 17 9 2 1
66 14 14 13 9 13 1 1
67 16 11 12 14 15 2 2
68 15 15 15 15 8 2 1
69 15 7 8 12 7 4 1
70 13 16 16 21 10 1 1
71 17 16 14 20 10 1 1
72 13 14 13 29 13 3 2
73 15 11 15 33 11 1 1
74 13 13 7 21 8 1 1
75 15 13 5 15 12 1 1
76 16 7 7 19 9 1 1
77 15 15 13 23 10 1 1
78 16 11 14 20 11 1 1
79 15 15 14 20 11 1 1
80 14 13 13 18 10 1 1
81 15 11 11 31 16 4 1
82 7 12 15 18 16 1 1
83 17 10 13 13 8 1 1
84 13 12 14 9 6 2 1
85 15 12 13 20 11 1 1
86 14 12 9 18 12 1 1
87 13 14 8 23 14 1 2
88 16 6 6 17 9 1 1
89 12 14 13 17 11 1 1
90 14 15 16 16 8 1 1
91 17 8 7 31 8 1 1
92 15 12 11 15 7 1 1
93 17 10 8 28 16 1 1
94 12 15 13 26 13 1 1
95 16 11 5 20 8 1 2
96 11 9 8 19 11 1 2
97 15 14 10 25 14 5 1
98 9 10 9 18 10 1 1
99 16 16 16 20 10 1 1
100 10 5 4 33 14 1 1
101 10 8 4 24 14 3 3
102 15 13 11 22 10 1 1
103 11 16 14 32 12 1 1
104 13 16 15 31 9 1 1
105 14 14 17 13 16 1 1
106 18 14 10 18 8 1 1
107 16 10 15 17 9 1 1
108 14 9 11 29 16 1 1
109 14 14 15 22 13 2 1
110 14 8 10 18 13 4 1
111 14 8 9 22 8 4 3
112 12 16 14 25 14 1 1
113 14 12 15 20 11 1 1
114 15 9 9 20 9 1 1
115 15 15 12 17 8 4 3
116 13 12 10 26 13 2 3
117 17 14 16 10 10 1 1
118 17 12 15 15 8 1 2
119 19 16 14 20 7 1 1
120 15 12 12 14 11 1 1
121 13 14 15 16 11 1 1
122 9 8 9 23 14 1 2
123 15 15 12 11 6 2 2
124 15 16 15 19 10 4 1
125 16 12 6 30 9 4 1
126 11 4 4 21 12 1 1
127 14 8 8 20 11 1 1
128 11 11 10 22 14 1 1
129 15 4 6 30 12 2 3
130 13 14 12 25 14 1 1
131 16 14 14 23 14 1 1
132 14 13 11 23 8 3 1
133 15 14 15 21 11 2 1
134 16 7 13 30 12 2 1
135 16 19 15 22 9 1 1
136 11 12 16 32 16 1 1
137 13 10 4 22 11 2 2
138 16 14 15 15 11 3 1
139 12 16 12 21 12 1 1
140 9 11 15 27 15 1 1
141 13 16 15 22 13 1 2
142 13 12 14 9 6 2 1
143 14 12 14 29 11 2 1
144 19 16 14 20 7 1 1
145 13 12 11 16 8 1 1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Popularity KnowingPeople CMistakes DAction
17.566245 0.007132 0.034430 0.006202 -0.306971
Tobacco Drugs
0.173787 -0.826460
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-5.7157 -1.6388 0.0427 1.4944 5.0648
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 17.566245 1.379172 12.737 < 2e-16 ***
Popularity 0.007132 0.076841 0.093 0.9262
KnowingPeople 0.034430 0.066563 0.517 0.6058
CMistakes 0.006202 0.035267 0.176 0.8607
DAction -0.306971 0.072950 -4.208 4.61e-05 ***
Tobacco 0.173787 0.203693 0.853 0.3950
Drugs -0.826460 0.368906 -2.240 0.0267 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.22 on 138 degrees of freedom
Multiple R-squared: 0.1634, Adjusted R-squared: 0.1271
F-statistic: 4.493 on 6 and 138 DF, p-value: 0.000345
> 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.4378594 0.8757189 0.56214057
[2,] 0.2831474 0.5662948 0.71685262
[3,] 0.2266912 0.4533825 0.77330875
[4,] 0.5846325 0.8307349 0.41536746
[5,] 0.5029461 0.9941078 0.49705389
[6,] 0.4154513 0.8309026 0.58454870
[7,] 0.4091667 0.8183335 0.59083326
[8,] 0.6891932 0.6216137 0.31080683
[9,] 0.6317784 0.7364431 0.36822156
[10,] 0.7445800 0.5108400 0.25541999
[11,] 0.8941172 0.2117656 0.10588278
[12,] 0.8665518 0.2668964 0.13344818
[13,] 0.8438789 0.3122423 0.15612114
[14,] 0.8631295 0.2737411 0.13687055
[15,] 0.8917485 0.2165031 0.10825154
[16,] 0.8601645 0.2796710 0.13983548
[17,] 0.8399414 0.3201172 0.16005858
[18,] 0.8808342 0.2383317 0.11916585
[19,] 0.8598890 0.2802221 0.14011104
[20,] 0.8656745 0.2686511 0.13432555
[21,] 0.8606480 0.2787039 0.13935195
[22,] 0.8354738 0.3290525 0.16452625
[23,] 0.8090802 0.3818397 0.19091984
[24,] 0.7875560 0.4248881 0.21244405
[25,] 0.8746716 0.2506568 0.12532841
[26,] 0.8495753 0.3008493 0.15042466
[27,] 0.8162404 0.3675192 0.18375958
[28,] 0.7762448 0.4475105 0.22375525
[29,] 0.7437789 0.5124423 0.25622113
[30,] 0.7517755 0.4964491 0.24822455
[31,] 0.7205077 0.5589846 0.27949229
[32,] 0.6937253 0.6125493 0.30627466
[33,] 0.7039116 0.5921767 0.29608837
[34,] 0.6558906 0.6882187 0.34410936
[35,] 0.6402933 0.7194134 0.35970672
[36,] 0.6147228 0.7705544 0.38527721
[37,] 0.6193451 0.7613099 0.38065494
[38,] 0.6032883 0.7934234 0.39671170
[39,] 0.7574259 0.4851482 0.24257408
[40,] 0.7328124 0.5343752 0.26718758
[41,] 0.8006486 0.3987027 0.19935137
[42,] 0.7629649 0.4740702 0.23703510
[43,] 0.7249374 0.5501253 0.27506263
[44,] 0.6824672 0.6350657 0.31753283
[45,] 0.6613031 0.6773937 0.33869686
[46,] 0.6421834 0.7156333 0.35781665
[47,] 0.8229552 0.3540896 0.17704480
[48,] 0.8147079 0.3705842 0.18529208
[49,] 0.8575175 0.2849650 0.14248250
[50,] 0.8395544 0.3208913 0.16044564
[51,] 0.8218485 0.3563030 0.17815149
[52,] 0.9013190 0.1973621 0.09868104
[53,] 0.9317858 0.1364285 0.06821425
[54,] 0.9236923 0.1526154 0.07630769
[55,] 0.9142465 0.1715069 0.08575347
[56,] 0.8931044 0.2137912 0.10689559
[57,] 0.8702020 0.2595961 0.12979803
[58,] 0.9153999 0.1692002 0.08460008
[59,] 0.8953122 0.2093755 0.10468776
[60,] 0.8735209 0.2529582 0.12647910
[61,] 0.8618063 0.2763875 0.13819374
[62,] 0.8658923 0.2682153 0.13410765
[63,] 0.8381324 0.3237353 0.16186764
[64,] 0.8079686 0.3840628 0.19203142
[65,] 0.8025601 0.3948798 0.19743988
[66,] 0.7838219 0.4323561 0.21617806
[67,] 0.7629799 0.4740402 0.23702012
[68,] 0.7241628 0.5516743 0.27583716
[69,] 0.7107929 0.5784141 0.28920705
[70,] 0.6720045 0.6559911 0.32799553
[71,] 0.6278041 0.7443918 0.37219588
[72,] 0.6173773 0.7652454 0.38262269
[73,] 0.8214694 0.3570612 0.17853061
[74,] 0.8152587 0.3694827 0.18474133
[75,] 0.8396293 0.3207413 0.16037067
[76,] 0.8118606 0.3762787 0.18813937
[77,] 0.7774000 0.4451999 0.22259995
[78,] 0.7434722 0.5130556 0.25652778
[79,] 0.7272876 0.5454249 0.27271243
[80,] 0.7220417 0.5559166 0.27795830
[81,] 0.6965765 0.6068470 0.30342349
[82,] 0.6969862 0.6060275 0.30301377
[83,] 0.6510744 0.6978511 0.34892556
[84,] 0.8483353 0.3033294 0.15166468
[85,] 0.8289702 0.3420595 0.17102976
[86,] 0.8326249 0.3347502 0.16737511
[87,] 0.8252081 0.3495838 0.17479190
[88,] 0.8074938 0.3850125 0.19250625
[89,] 0.9343988 0.1312024 0.06560118
[90,] 0.9204996 0.1590008 0.07950038
[91,] 0.9211017 0.1577965 0.07889825
[92,] 0.9074816 0.1850369 0.09251843
[93,] 0.8837491 0.2325018 0.11625092
[94,] 0.9060802 0.1878395 0.09391977
[95,] 0.9229416 0.1541167 0.07705837
[96,] 0.9259360 0.1481280 0.07406402
[97,] 0.9387402 0.1225196 0.06125981
[98,] 0.9211544 0.1576912 0.07884560
[99,] 0.9270879 0.1458242 0.07291212
[100,] 0.9045448 0.1909104 0.09545519
[101,] 0.9015272 0.1969456 0.09847282
[102,] 0.8818682 0.2362635 0.11813176
[103,] 0.8541749 0.2916503 0.14582514
[104,] 0.8147348 0.3705305 0.18526523
[105,] 0.7691814 0.4616372 0.23081862
[106,] 0.7294896 0.5410207 0.27051036
[107,] 0.6736486 0.6527028 0.32635141
[108,] 0.7364630 0.5270740 0.26353701
[109,] 0.7169336 0.5661327 0.28306637
[110,] 0.7422447 0.5155107 0.25775534
[111,] 0.7651492 0.4697017 0.23485084
[112,] 0.7056938 0.5886125 0.29430625
[113,] 0.7400756 0.5198487 0.25992436
[114,] 0.6844748 0.6310505 0.31552523
[115,] 0.6095648 0.7808704 0.39043521
[116,] 0.5285472 0.9429055 0.47145276
[117,] 0.4541248 0.9082495 0.54587525
[118,] 0.4225094 0.8450187 0.57749063
[119,] 0.3416981 0.6833963 0.65830187
[120,] 0.3012840 0.6025680 0.69871601
[121,] 0.2230210 0.4460421 0.77697896
[122,] 0.4153011 0.8306021 0.58469894
[123,] 0.6459986 0.7080029 0.35400143
[124,] 0.5174868 0.9650264 0.48251318
[125,] 0.6046477 0.7907047 0.39535233
[126,] 0.5456862 0.9086277 0.45431383
> postscript(file="/var/www/rcomp/tmp/1bwf01292695515.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/2bwf01292695515.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/34oxl1292695515.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/44oxl1292695515.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/54oxl1292695515.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
-0.943062434 3.364096118 -4.322583983 -1.223869344 1.216664196 3.145521661
7 8 9 10 11 12
-0.009250098 -0.645305353 0.358823693 1.853266011 3.790605829 4.920954625
13 14 15 16 17 18
-2.915278543 2.164954164 2.609260846 -0.848986807 2.209848545 -0.950931461
19 20 21 22 23 24
1.706873688 5.064778007 -0.217990497 -0.780930308 3.850262833 -3.069954189
25 26 27 28 29 30
1.406201925 0.194124386 -2.953365301 1.587164840 -0.418263059 2.397186646
31 32 33 34 35 36
0.286767666 -0.851475161 2.397805840 -3.489890376 1.077801554 1.241876039
37 38 39 40 41 42
-0.481932623 1.718111471 2.385473565 -0.334852178 -1.793138127 -2.108180694
43 44 45 46 47 48
0.022502063 2.161859387 -1.632900704 2.748833003 -0.375465981 -3.670032414
49 50 51 52 53 54
-1.188515196 -3.418960495 -0.069608533 0.793794958 0.258318136 -1.684556167
55 56 57 58 59 60
-1.907540041 -4.840610568 -1.852618541 -3.580793753 -1.090209420 1.554357052
61 62 63 64 65 66
-4.275998428 -3.659976377 -1.680259415 1.611742054 -0.004795589 0.473792190
67 68 69 70 71 72
3.765222489 -0.348056346 -0.685927932 -1.639103028 2.435959048 -0.171368292
73 74 75 76 77 78
0.663531155 -1.921779637 1.412178393 1.440389438 0.458914175 1.778591250
79 80 81 82 83 84
0.750062355 -0.495809755 1.827149120 -5.715710788 1.942656375 -2.868958016
85 86 87 88 89 90
0.805888902 0.262984138 0.692540519 1.494356187 -2.189768572 -1.214901347
91 92 93 94 95 96
2.051858237 -0.322124053 4.477539546 -1.638779552 1.994007297 -2.167902311
97 98 99 100 101 102
1.089666907 -5.336693579 1.367099296 -2.994033618 -1.654262949 0.548240699
103 104 105 106 107 108
-3.024526682 -1.973667481 1.232176635 2.986405485 1.155958407 1.375179818
109 110 111 112 113 114
0.150515018 0.042692640 0.170378625 -1.367168245 -0.262970850 0.351062913
115 116 117 118 119 120
1.048175052 0.965040368 2.443386990 2.673587935 3.515045801 0.877532726
121 122 123 124 125 126
-1.252425999 -3.299096014 -0.007439175 -0.113630104 0.849571024 -2.526415664
127 128 129 130 131 132
0.006567178 -2.175180647 2.828037282 -0.284044045 2.659500852 -1.419478191
133 134 135 136 137 138
0.542775178 1.912710658 1.060756769 -1.836973208 -0.229709205 1.406201925
139 140 141 142 143 144
-1.887441359 -4.071370568 0.136498180 -2.868958016 -0.458149095 3.515045801
145
-2.021355295
> postscript(file="/var/www/rcomp/tmp/6wfwo1292695515.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 -0.943062434 NA
1 3.364096118 -0.943062434
2 -4.322583983 3.364096118
3 -1.223869344 -4.322583983
4 1.216664196 -1.223869344
5 3.145521661 1.216664196
6 -0.009250098 3.145521661
7 -0.645305353 -0.009250098
8 0.358823693 -0.645305353
9 1.853266011 0.358823693
10 3.790605829 1.853266011
11 4.920954625 3.790605829
12 -2.915278543 4.920954625
13 2.164954164 -2.915278543
14 2.609260846 2.164954164
15 -0.848986807 2.609260846
16 2.209848545 -0.848986807
17 -0.950931461 2.209848545
18 1.706873688 -0.950931461
19 5.064778007 1.706873688
20 -0.217990497 5.064778007
21 -0.780930308 -0.217990497
22 3.850262833 -0.780930308
23 -3.069954189 3.850262833
24 1.406201925 -3.069954189
25 0.194124386 1.406201925
26 -2.953365301 0.194124386
27 1.587164840 -2.953365301
28 -0.418263059 1.587164840
29 2.397186646 -0.418263059
30 0.286767666 2.397186646
31 -0.851475161 0.286767666
32 2.397805840 -0.851475161
33 -3.489890376 2.397805840
34 1.077801554 -3.489890376
35 1.241876039 1.077801554
36 -0.481932623 1.241876039
37 1.718111471 -0.481932623
38 2.385473565 1.718111471
39 -0.334852178 2.385473565
40 -1.793138127 -0.334852178
41 -2.108180694 -1.793138127
42 0.022502063 -2.108180694
43 2.161859387 0.022502063
44 -1.632900704 2.161859387
45 2.748833003 -1.632900704
46 -0.375465981 2.748833003
47 -3.670032414 -0.375465981
48 -1.188515196 -3.670032414
49 -3.418960495 -1.188515196
50 -0.069608533 -3.418960495
51 0.793794958 -0.069608533
52 0.258318136 0.793794958
53 -1.684556167 0.258318136
54 -1.907540041 -1.684556167
55 -4.840610568 -1.907540041
56 -1.852618541 -4.840610568
57 -3.580793753 -1.852618541
58 -1.090209420 -3.580793753
59 1.554357052 -1.090209420
60 -4.275998428 1.554357052
61 -3.659976377 -4.275998428
62 -1.680259415 -3.659976377
63 1.611742054 -1.680259415
64 -0.004795589 1.611742054
65 0.473792190 -0.004795589
66 3.765222489 0.473792190
67 -0.348056346 3.765222489
68 -0.685927932 -0.348056346
69 -1.639103028 -0.685927932
70 2.435959048 -1.639103028
71 -0.171368292 2.435959048
72 0.663531155 -0.171368292
73 -1.921779637 0.663531155
74 1.412178393 -1.921779637
75 1.440389438 1.412178393
76 0.458914175 1.440389438
77 1.778591250 0.458914175
78 0.750062355 1.778591250
79 -0.495809755 0.750062355
80 1.827149120 -0.495809755
81 -5.715710788 1.827149120
82 1.942656375 -5.715710788
83 -2.868958016 1.942656375
84 0.805888902 -2.868958016
85 0.262984138 0.805888902
86 0.692540519 0.262984138
87 1.494356187 0.692540519
88 -2.189768572 1.494356187
89 -1.214901347 -2.189768572
90 2.051858237 -1.214901347
91 -0.322124053 2.051858237
92 4.477539546 -0.322124053
93 -1.638779552 4.477539546
94 1.994007297 -1.638779552
95 -2.167902311 1.994007297
96 1.089666907 -2.167902311
97 -5.336693579 1.089666907
98 1.367099296 -5.336693579
99 -2.994033618 1.367099296
100 -1.654262949 -2.994033618
101 0.548240699 -1.654262949
102 -3.024526682 0.548240699
103 -1.973667481 -3.024526682
104 1.232176635 -1.973667481
105 2.986405485 1.232176635
106 1.155958407 2.986405485
107 1.375179818 1.155958407
108 0.150515018 1.375179818
109 0.042692640 0.150515018
110 0.170378625 0.042692640
111 -1.367168245 0.170378625
112 -0.262970850 -1.367168245
113 0.351062913 -0.262970850
114 1.048175052 0.351062913
115 0.965040368 1.048175052
116 2.443386990 0.965040368
117 2.673587935 2.443386990
118 3.515045801 2.673587935
119 0.877532726 3.515045801
120 -1.252425999 0.877532726
121 -3.299096014 -1.252425999
122 -0.007439175 -3.299096014
123 -0.113630104 -0.007439175
124 0.849571024 -0.113630104
125 -2.526415664 0.849571024
126 0.006567178 -2.526415664
127 -2.175180647 0.006567178
128 2.828037282 -2.175180647
129 -0.284044045 2.828037282
130 2.659500852 -0.284044045
131 -1.419478191 2.659500852
132 0.542775178 -1.419478191
133 1.912710658 0.542775178
134 1.060756769 1.912710658
135 -1.836973208 1.060756769
136 -0.229709205 -1.836973208
137 1.406201925 -0.229709205
138 -1.887441359 1.406201925
139 -4.071370568 -1.887441359
140 0.136498180 -4.071370568
141 -2.868958016 0.136498180
142 -0.458149095 -2.868958016
143 3.515045801 -0.458149095
144 -2.021355295 3.515045801
145 NA -2.021355295
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 3.364096118 -0.943062434
[2,] -4.322583983 3.364096118
[3,] -1.223869344 -4.322583983
[4,] 1.216664196 -1.223869344
[5,] 3.145521661 1.216664196
[6,] -0.009250098 3.145521661
[7,] -0.645305353 -0.009250098
[8,] 0.358823693 -0.645305353
[9,] 1.853266011 0.358823693
[10,] 3.790605829 1.853266011
[11,] 4.920954625 3.790605829
[12,] -2.915278543 4.920954625
[13,] 2.164954164 -2.915278543
[14,] 2.609260846 2.164954164
[15,] -0.848986807 2.609260846
[16,] 2.209848545 -0.848986807
[17,] -0.950931461 2.209848545
[18,] 1.706873688 -0.950931461
[19,] 5.064778007 1.706873688
[20,] -0.217990497 5.064778007
[21,] -0.780930308 -0.217990497
[22,] 3.850262833 -0.780930308
[23,] -3.069954189 3.850262833
[24,] 1.406201925 -3.069954189
[25,] 0.194124386 1.406201925
[26,] -2.953365301 0.194124386
[27,] 1.587164840 -2.953365301
[28,] -0.418263059 1.587164840
[29,] 2.397186646 -0.418263059
[30,] 0.286767666 2.397186646
[31,] -0.851475161 0.286767666
[32,] 2.397805840 -0.851475161
[33,] -3.489890376 2.397805840
[34,] 1.077801554 -3.489890376
[35,] 1.241876039 1.077801554
[36,] -0.481932623 1.241876039
[37,] 1.718111471 -0.481932623
[38,] 2.385473565 1.718111471
[39,] -0.334852178 2.385473565
[40,] -1.793138127 -0.334852178
[41,] -2.108180694 -1.793138127
[42,] 0.022502063 -2.108180694
[43,] 2.161859387 0.022502063
[44,] -1.632900704 2.161859387
[45,] 2.748833003 -1.632900704
[46,] -0.375465981 2.748833003
[47,] -3.670032414 -0.375465981
[48,] -1.188515196 -3.670032414
[49,] -3.418960495 -1.188515196
[50,] -0.069608533 -3.418960495
[51,] 0.793794958 -0.069608533
[52,] 0.258318136 0.793794958
[53,] -1.684556167 0.258318136
[54,] -1.907540041 -1.684556167
[55,] -4.840610568 -1.907540041
[56,] -1.852618541 -4.840610568
[57,] -3.580793753 -1.852618541
[58,] -1.090209420 -3.580793753
[59,] 1.554357052 -1.090209420
[60,] -4.275998428 1.554357052
[61,] -3.659976377 -4.275998428
[62,] -1.680259415 -3.659976377
[63,] 1.611742054 -1.680259415
[64,] -0.004795589 1.611742054
[65,] 0.473792190 -0.004795589
[66,] 3.765222489 0.473792190
[67,] -0.348056346 3.765222489
[68,] -0.685927932 -0.348056346
[69,] -1.639103028 -0.685927932
[70,] 2.435959048 -1.639103028
[71,] -0.171368292 2.435959048
[72,] 0.663531155 -0.171368292
[73,] -1.921779637 0.663531155
[74,] 1.412178393 -1.921779637
[75,] 1.440389438 1.412178393
[76,] 0.458914175 1.440389438
[77,] 1.778591250 0.458914175
[78,] 0.750062355 1.778591250
[79,] -0.495809755 0.750062355
[80,] 1.827149120 -0.495809755
[81,] -5.715710788 1.827149120
[82,] 1.942656375 -5.715710788
[83,] -2.868958016 1.942656375
[84,] 0.805888902 -2.868958016
[85,] 0.262984138 0.805888902
[86,] 0.692540519 0.262984138
[87,] 1.494356187 0.692540519
[88,] -2.189768572 1.494356187
[89,] -1.214901347 -2.189768572
[90,] 2.051858237 -1.214901347
[91,] -0.322124053 2.051858237
[92,] 4.477539546 -0.322124053
[93,] -1.638779552 4.477539546
[94,] 1.994007297 -1.638779552
[95,] -2.167902311 1.994007297
[96,] 1.089666907 -2.167902311
[97,] -5.336693579 1.089666907
[98,] 1.367099296 -5.336693579
[99,] -2.994033618 1.367099296
[100,] -1.654262949 -2.994033618
[101,] 0.548240699 -1.654262949
[102,] -3.024526682 0.548240699
[103,] -1.973667481 -3.024526682
[104,] 1.232176635 -1.973667481
[105,] 2.986405485 1.232176635
[106,] 1.155958407 2.986405485
[107,] 1.375179818 1.155958407
[108,] 0.150515018 1.375179818
[109,] 0.042692640 0.150515018
[110,] 0.170378625 0.042692640
[111,] -1.367168245 0.170378625
[112,] -0.262970850 -1.367168245
[113,] 0.351062913 -0.262970850
[114,] 1.048175052 0.351062913
[115,] 0.965040368 1.048175052
[116,] 2.443386990 0.965040368
[117,] 2.673587935 2.443386990
[118,] 3.515045801 2.673587935
[119,] 0.877532726 3.515045801
[120,] -1.252425999 0.877532726
[121,] -3.299096014 -1.252425999
[122,] -0.007439175 -3.299096014
[123,] -0.113630104 -0.007439175
[124,] 0.849571024 -0.113630104
[125,] -2.526415664 0.849571024
[126,] 0.006567178 -2.526415664
[127,] -2.175180647 0.006567178
[128,] 2.828037282 -2.175180647
[129,] -0.284044045 2.828037282
[130,] 2.659500852 -0.284044045
[131,] -1.419478191 2.659500852
[132,] 0.542775178 -1.419478191
[133,] 1.912710658 0.542775178
[134,] 1.060756769 1.912710658
[135,] -1.836973208 1.060756769
[136,] -0.229709205 -1.836973208
[137,] 1.406201925 -0.229709205
[138,] -1.887441359 1.406201925
[139,] -4.071370568 -1.887441359
[140,] 0.136498180 -4.071370568
[141,] -2.868958016 0.136498180
[142,] -0.458149095 -2.868958016
[143,] 3.515045801 -0.458149095
[144,] -2.021355295 3.515045801
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 3.364096118 -0.943062434
2 -4.322583983 3.364096118
3 -1.223869344 -4.322583983
4 1.216664196 -1.223869344
5 3.145521661 1.216664196
6 -0.009250098 3.145521661
7 -0.645305353 -0.009250098
8 0.358823693 -0.645305353
9 1.853266011 0.358823693
10 3.790605829 1.853266011
11 4.920954625 3.790605829
12 -2.915278543 4.920954625
13 2.164954164 -2.915278543
14 2.609260846 2.164954164
15 -0.848986807 2.609260846
16 2.209848545 -0.848986807
17 -0.950931461 2.209848545
18 1.706873688 -0.950931461
19 5.064778007 1.706873688
20 -0.217990497 5.064778007
21 -0.780930308 -0.217990497
22 3.850262833 -0.780930308
23 -3.069954189 3.850262833
24 1.406201925 -3.069954189
25 0.194124386 1.406201925
26 -2.953365301 0.194124386
27 1.587164840 -2.953365301
28 -0.418263059 1.587164840
29 2.397186646 -0.418263059
30 0.286767666 2.397186646
31 -0.851475161 0.286767666
32 2.397805840 -0.851475161
33 -3.489890376 2.397805840
34 1.077801554 -3.489890376
35 1.241876039 1.077801554
36 -0.481932623 1.241876039
37 1.718111471 -0.481932623
38 2.385473565 1.718111471
39 -0.334852178 2.385473565
40 -1.793138127 -0.334852178
41 -2.108180694 -1.793138127
42 0.022502063 -2.108180694
43 2.161859387 0.022502063
44 -1.632900704 2.161859387
45 2.748833003 -1.632900704
46 -0.375465981 2.748833003
47 -3.670032414 -0.375465981
48 -1.188515196 -3.670032414
49 -3.418960495 -1.188515196
50 -0.069608533 -3.418960495
51 0.793794958 -0.069608533
52 0.258318136 0.793794958
53 -1.684556167 0.258318136
54 -1.907540041 -1.684556167
55 -4.840610568 -1.907540041
56 -1.852618541 -4.840610568
57 -3.580793753 -1.852618541
58 -1.090209420 -3.580793753
59 1.554357052 -1.090209420
60 -4.275998428 1.554357052
61 -3.659976377 -4.275998428
62 -1.680259415 -3.659976377
63 1.611742054 -1.680259415
64 -0.004795589 1.611742054
65 0.473792190 -0.004795589
66 3.765222489 0.473792190
67 -0.348056346 3.765222489
68 -0.685927932 -0.348056346
69 -1.639103028 -0.685927932
70 2.435959048 -1.639103028
71 -0.171368292 2.435959048
72 0.663531155 -0.171368292
73 -1.921779637 0.663531155
74 1.412178393 -1.921779637
75 1.440389438 1.412178393
76 0.458914175 1.440389438
77 1.778591250 0.458914175
78 0.750062355 1.778591250
79 -0.495809755 0.750062355
80 1.827149120 -0.495809755
81 -5.715710788 1.827149120
82 1.942656375 -5.715710788
83 -2.868958016 1.942656375
84 0.805888902 -2.868958016
85 0.262984138 0.805888902
86 0.692540519 0.262984138
87 1.494356187 0.692540519
88 -2.189768572 1.494356187
89 -1.214901347 -2.189768572
90 2.051858237 -1.214901347
91 -0.322124053 2.051858237
92 4.477539546 -0.322124053
93 -1.638779552 4.477539546
94 1.994007297 -1.638779552
95 -2.167902311 1.994007297
96 1.089666907 -2.167902311
97 -5.336693579 1.089666907
98 1.367099296 -5.336693579
99 -2.994033618 1.367099296
100 -1.654262949 -2.994033618
101 0.548240699 -1.654262949
102 -3.024526682 0.548240699
103 -1.973667481 -3.024526682
104 1.232176635 -1.973667481
105 2.986405485 1.232176635
106 1.155958407 2.986405485
107 1.375179818 1.155958407
108 0.150515018 1.375179818
109 0.042692640 0.150515018
110 0.170378625 0.042692640
111 -1.367168245 0.170378625
112 -0.262970850 -1.367168245
113 0.351062913 -0.262970850
114 1.048175052 0.351062913
115 0.965040368 1.048175052
116 2.443386990 0.965040368
117 2.673587935 2.443386990
118 3.515045801 2.673587935
119 0.877532726 3.515045801
120 -1.252425999 0.877532726
121 -3.299096014 -1.252425999
122 -0.007439175 -3.299096014
123 -0.113630104 -0.007439175
124 0.849571024 -0.113630104
125 -2.526415664 0.849571024
126 0.006567178 -2.526415664
127 -2.175180647 0.006567178
128 2.828037282 -2.175180647
129 -0.284044045 2.828037282
130 2.659500852 -0.284044045
131 -1.419478191 2.659500852
132 0.542775178 -1.419478191
133 1.912710658 0.542775178
134 1.060756769 1.912710658
135 -1.836973208 1.060756769
136 -0.229709205 -1.836973208
137 1.406201925 -0.229709205
138 -1.887441359 1.406201925
139 -4.071370568 -1.887441359
140 0.136498180 -4.071370568
141 -2.868958016 0.136498180
142 -0.458149095 -2.868958016
143 3.515045801 -0.458149095
144 -2.021355295 3.515045801
> 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/7povr1292695515.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/8povr1292695515.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/9povr1292695515.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/100xuc1292695515.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/113gbi1292695515.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/126y9o1292695515.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/1338pw1292695515.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/14o96k1292695515.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/1599m81292695515.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/16dsle1292695515.tab")
+ }
>
> try(system("convert tmp/1bwf01292695515.ps tmp/1bwf01292695515.png",intern=TRUE))
character(0)
> try(system("convert tmp/2bwf01292695515.ps tmp/2bwf01292695515.png",intern=TRUE))
character(0)
> try(system("convert tmp/34oxl1292695515.ps tmp/34oxl1292695515.png",intern=TRUE))
character(0)
> try(system("convert tmp/44oxl1292695515.ps tmp/44oxl1292695515.png",intern=TRUE))
character(0)
> try(system("convert tmp/54oxl1292695515.ps tmp/54oxl1292695515.png",intern=TRUE))
character(0)
> try(system("convert tmp/6wfwo1292695515.ps tmp/6wfwo1292695515.png",intern=TRUE))
character(0)
> try(system("convert tmp/7povr1292695515.ps tmp/7povr1292695515.png",intern=TRUE))
character(0)
> try(system("convert tmp/8povr1292695515.ps tmp/8povr1292695515.png",intern=TRUE))
character(0)
> try(system("convert tmp/9povr1292695515.ps tmp/9povr1292695515.png",intern=TRUE))
character(0)
> try(system("convert tmp/100xuc1292695515.ps tmp/100xuc1292695515.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.500 1.690 6.198