R version 2.9.0 (2009-04-17)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
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(13
+ ,13
+ ,14
+ ,13
+ ,3
+ ,2
+ ,1
+ ,12
+ ,12
+ ,8
+ ,13
+ ,5
+ ,1
+ ,1
+ ,15
+ ,10
+ ,12
+ ,16
+ ,6
+ ,0
+ ,1
+ ,12
+ ,9
+ ,7
+ ,12
+ ,6
+ ,3
+ ,1
+ ,10
+ ,10
+ ,10
+ ,11
+ ,5
+ ,3
+ ,1
+ ,12
+ ,12
+ ,7
+ ,12
+ ,3
+ ,1
+ ,1
+ ,15
+ ,13
+ ,16
+ ,18
+ ,8
+ ,3
+ ,1
+ ,9
+ ,12
+ ,11
+ ,11
+ ,4
+ ,1
+ ,1
+ ,12
+ ,12
+ ,14
+ ,14
+ ,4
+ ,4
+ ,1
+ ,11
+ ,6
+ ,6
+ ,9
+ ,4
+ ,0
+ ,1
+ ,11
+ ,5
+ ,16
+ ,14
+ ,6
+ ,3
+ ,1
+ ,11
+ ,12
+ ,11
+ ,12
+ ,6
+ ,2
+ ,1
+ ,15
+ ,11
+ ,16
+ ,11
+ ,5
+ ,4
+ ,1
+ ,7
+ ,14
+ ,12
+ ,12
+ ,4
+ ,3
+ ,1
+ ,11
+ ,14
+ ,7
+ ,13
+ ,6
+ ,1
+ ,1
+ ,11
+ ,12
+ ,13
+ ,11
+ ,4
+ ,1
+ ,1
+ ,10
+ ,12
+ ,11
+ ,12
+ ,6
+ ,2
+ ,1
+ ,14
+ ,11
+ ,15
+ ,16
+ ,6
+ ,3
+ ,1
+ ,10
+ ,11
+ ,7
+ ,9
+ ,4
+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4
+ ,1
+ ,8
+ ,13
+ ,12
+ ,14
+ ,14
+ ,6
+ ,2
+ ,8
+ ,15
+ ,12
+ ,14
+ ,16
+ ,4
+ ,0
+ ,8
+ ,8
+ ,10
+ ,10
+ ,6
+ ,4
+ ,5
+ ,8
+ ,12
+ ,12
+ ,10
+ ,13
+ ,4
+ ,2
+ ,8
+ ,10
+ ,13
+ ,4
+ ,13
+ ,6
+ ,1
+ ,8
+ ,8
+ ,12
+ ,8
+ ,14
+ ,5
+ ,1
+ ,8
+ ,10
+ ,15
+ ,15
+ ,15
+ ,6
+ ,4
+ ,8
+ ,15
+ ,11
+ ,16
+ ,14
+ ,6
+ ,3
+ ,8
+ ,16
+ ,12
+ ,12
+ ,15
+ ,8
+ ,0
+ ,9
+ ,13
+ ,11
+ ,12
+ ,13
+ ,7
+ ,3
+ ,10
+ ,16
+ ,12
+ ,15
+ ,16
+ ,7
+ ,3
+ ,10
+ ,9
+ ,11
+ ,9
+ ,12
+ ,4
+ ,0
+ ,14
+ ,14
+ ,10
+ ,12
+ ,15
+ ,6
+ ,2
+ ,14
+ ,14
+ ,11
+ ,14
+ ,12
+ ,6
+ ,5
+ ,14
+ ,12
+ ,11
+ ,11
+ ,14
+ ,2
+ ,2
+ ,14)
+ ,dim=c(7
+ ,156)
+ ,dimnames=list(c('Popularity'
+ ,'FindingFriends'
+ ,'KnowingPeople'
+ ,'Liked'
+ ,'Celebrity'
+ ,'Sum_friends'
+ ,'Day')
+ ,1:156))
> y <- array(NA,dim=c(7,156),dimnames=list(c('Popularity','FindingFriends','KnowingPeople','Liked','Celebrity','Sum_friends','Day'),1:156))
> 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
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
Popularity FindingFriends KnowingPeople Liked Celebrity Sum_friends Day
1 13 13 14 13 3 2 1
2 12 12 8 13 5 1 1
3 15 10 12 16 6 0 1
4 12 9 7 12 6 3 1
5 10 10 10 11 5 3 1
6 12 12 7 12 3 1 1
7 15 13 16 18 8 3 1
8 9 12 11 11 4 1 1
9 12 12 14 14 4 4 1
10 11 6 6 9 4 0 1
11 11 5 16 14 6 3 1
12 11 12 11 12 6 2 1
13 15 11 16 11 5 4 1
14 7 14 12 12 4 3 1
15 11 14 7 13 6 1 1
16 11 12 13 11 4 1 1
17 10 12 11 12 6 2 1
18 14 11 15 16 6 3 1
19 10 11 7 9 4 1 2
20 6 7 9 11 4 1 2
21 11 9 7 13 2 2 2
22 15 11 14 15 7 3 2
23 11 11 15 10 5 4 2
24 12 12 7 11 4 2 2
25 14 12 15 13 6 1 2
26 15 11 17 16 6 2 2
27 9 11 15 15 7 2 2
28 13 8 14 14 5 4 2
29 13 9 14 14 6 2 2
30 16 12 8 14 4 3 2
31 13 10 8 8 4 3 2
32 12 10 14 13 7 3 2
33 14 12 14 15 7 4 2
34 11 8 8 13 4 2 3
35 9 12 11 11 4 2 3
36 16 11 16 15 6 4 3
37 12 12 10 15 6 3 3
38 10 7 8 9 5 4 3
39 13 11 14 13 6 2 3
40 16 11 16 16 7 5 3
41 14 12 13 13 6 3 3
42 15 9 5 11 3 1 3
43 5 15 8 12 3 1 3
44 8 11 10 12 4 1 3
45 11 11 8 12 6 2 3
46 16 11 13 14 7 3 3
47 17 11 15 14 5 9 3
48 9 15 6 8 4 0 3
49 9 11 12 13 5 0 3
50 13 12 16 16 6 2 3
51 10 12 5 13 6 2 3
52 6 9 15 11 6 3 4
53 12 12 12 14 5 1 4
54 8 12 8 13 4 2 4
55 14 13 13 13 5 0 4
56 12 11 14 13 5 5 4
57 11 9 12 12 4 2 4
58 16 9 16 16 6 4 4
59 8 11 10 15 2 3 4
60 15 11 15 15 8 0 4
61 7 12 8 12 3 0 4
62 16 12 16 14 6 4 4
63 14 9 19 12 6 1 4
64 16 11 14 15 6 1 4
65 9 9 6 12 5 4 4
66 14 12 13 13 5 2 4
67 11 12 15 12 6 4 4
68 13 12 7 12 5 1 4
69 15 12 13 13 6 4 5
70 5 14 4 5 2 2 5
71 15 11 14 13 5 5 5
72 13 12 13 13 5 4 5
73 11 11 11 14 5 4 5
74 11 6 14 17 6 4 5
75 12 10 12 13 6 4 5
76 12 12 15 13 6 3 5
77 12 13 14 12 5 3 5
78 12 8 13 13 5 3 5
79 14 12 8 14 4 2 5
80 6 12 6 11 2 1 5
81 7 12 7 12 4 1 5
82 14 6 13 12 6 5 5
83 14 11 13 16 6 4 5
84 10 10 11 12 5 2 5
85 13 12 5 12 3 3 5
86 12 13 12 12 6 2 5
87 9 11 8 10 4 2 6
88 12 7 11 15 5 2 6
89 16 11 14 15 8 2 6
90 10 11 9 12 4 3 6
91 14 11 10 16 6 2 6
92 10 11 13 15 6 3 6
93 16 12 16 16 7 4 6
94 15 10 16 13 6 3 6
95 12 11 11 12 5 3 6
96 10 12 8 11 4 0 6
97 8 7 4 13 6 1 6
98 8 13 7 10 3 2 6
99 11 8 14 15 5 2 6
100 13 12 11 13 6 3 6
101 16 11 17 16 7 4 6
102 16 12 15 15 7 4 6
103 14 14 17 18 6 1 6
104 11 10 5 13 3 2 6
105 4 10 4 10 2 2 6
106 14 13 10 16 8 3 6
107 9 10 11 13 3 3 7
108 14 11 15 15 8 3 7
109 8 10 10 14 3 1 7
110 8 7 9 15 4 1 7
111 11 10 12 14 5 1 7
112 12 8 15 13 7 1 7
113 11 12 7 13 6 0 7
114 14 12 13 15 6 1 7
115 15 12 12 16 7 3 7
116 16 11 14 14 6 3 7
117 16 12 14 14 6 0 7
118 11 12 8 16 6 2 7
119 14 12 15 14 6 5 7
120 14 11 12 12 4 2 7
121 12 12 12 13 4 3 7
122 14 11 16 12 5 3 7
123 8 11 9 12 4 5 7
124 13 13 15 14 6 4 7
125 16 12 15 14 6 4 7
126 12 12 6 14 5 0 7
127 16 12 14 16 8 3 7
128 12 12 15 13 6 0 7
129 11 8 10 14 5 2 7
130 4 8 6 4 4 0 7
131 16 12 14 16 8 6 7
132 15 11 12 13 6 3 7
133 10 12 8 16 4 1 7
134 13 13 11 15 6 6 7
135 15 12 13 14 6 2 7
136 12 12 9 13 4 1 7
137 14 11 15 14 6 3 7
138 7 12 13 12 3 1 8
139 19 12 15 15 6 2 8
140 12 10 14 14 5 4 8
141 12 11 16 13 4 1 8
142 13 12 14 14 6 2 8
143 15 12 14 16 4 0 8
144 8 10 10 6 4 5 8
145 12 12 10 13 4 2 8
146 10 13 4 13 6 1 8
147 8 12 8 14 5 1 8
148 10 15 15 15 6 4 8
149 15 11 16 14 6 3 8
150 16 12 12 15 8 0 9
151 13 11 12 13 7 3 10
152 16 12 15 16 7 3 10
153 9 11 9 12 4 0 14
154 14 10 12 15 6 2 14
155 14 11 14 12 6 5 14
156 12 11 11 14 2 2 14
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) FindingFriends KnowingPeople Liked Celebrity
3.420e-02 1.063e-01 2.114e-01 3.576e-01 6.060e-01
Sum_friends Day
2.126e-01 4.112e-05
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-6.37065 -1.21133 0.01488 1.39241 6.98704
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.420e-02 1.433e+00 0.024 0.980999
FindingFriends 1.063e-01 9.594e-02 1.108 0.269635
KnowingPeople 2.114e-01 6.385e-02 3.312 0.001164 **
Liked 3.576e-01 9.715e-02 3.681 0.000324 ***
Celebrity 6.060e-01 1.560e-01 3.886 0.000153 ***
Sum_friends 2.126e-01 1.204e-01 1.765 0.079577 .
Day 4.112e-05 6.253e-02 0.001 0.999476
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.098 on 149 degrees of freedom
Multiple R-squared: 0.5095, Adjusted R-squared: 0.4897
F-statistic: 25.79 on 6 and 149 DF, p-value: < 2.2e-16
> 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.12807987 0.25615973 0.871920133
[2,] 0.14870477 0.29740955 0.851295226
[3,] 0.07793727 0.15587453 0.922062734
[4,] 0.56623780 0.86752440 0.433762201
[5,] 0.83305545 0.33388911 0.166944553
[6,] 0.76319898 0.47360203 0.236801017
[7,] 0.68026238 0.63947523 0.319737617
[8,] 0.62377927 0.75244145 0.376220726
[9,] 0.53627673 0.92744653 0.463723267
[10,] 0.45102028 0.90204056 0.548979718
[11,] 0.63185479 0.73629042 0.368145208
[12,] 0.60074943 0.79850113 0.399250566
[13,] 0.63961903 0.72076193 0.360380965
[14,] 0.57505359 0.84989282 0.424946409
[15,] 0.56107911 0.87784179 0.438920894
[16,] 0.51401372 0.97197257 0.485986284
[17,] 0.44602144 0.89204287 0.553978565
[18,] 0.70562009 0.58875983 0.294379915
[19,] 0.65186157 0.69627686 0.348138428
[20,] 0.59203699 0.81592601 0.407963006
[21,] 0.72688833 0.54622334 0.273111669
[22,] 0.81034176 0.37931648 0.189658239
[23,] 0.77414409 0.45171182 0.225855912
[24,] 0.72729209 0.54541582 0.272707910
[25,] 0.69690499 0.60619003 0.303095014
[26,] 0.69302747 0.61394505 0.306972526
[27,] 0.68974142 0.62051715 0.310258575
[28,] 0.66319201 0.67361597 0.336807986
[29,] 0.61448885 0.77102230 0.385511150
[30,] 0.56575838 0.86848325 0.434241624
[31,] 0.52245812 0.95508375 0.477541876
[32,] 0.48386620 0.96773240 0.516133799
[33,] 0.78451165 0.43097671 0.215488353
[34,] 0.95211140 0.09577719 0.047888595
[35,] 0.95633260 0.08733480 0.043667402
[36,] 0.94329770 0.11340459 0.056702297
[37,] 0.95082628 0.09834744 0.049173720
[38,] 0.95068813 0.09862374 0.049311872
[39,] 0.94024328 0.11951344 0.059756720
[40,] 0.93780885 0.12438230 0.062191150
[41,] 0.92607800 0.14784401 0.073922003
[42,] 0.91933369 0.16133262 0.080666308
[43,] 0.98658497 0.02683005 0.013415027
[44,] 0.98259388 0.03481225 0.017406124
[45,] 0.98563288 0.02873424 0.014367121
[46,] 0.99112474 0.01775051 0.008875255
[47,] 0.98820476 0.02359047 0.011795237
[48,] 0.98420235 0.03159530 0.015797651
[49,] 0.98259173 0.03481654 0.017408269
[50,] 0.98806095 0.02387811 0.011939054
[51,] 0.98707670 0.02584660 0.012923299
[52,] 0.98667369 0.02665261 0.013326307
[53,] 0.98736740 0.02526520 0.012632601
[54,] 0.98585054 0.02829893 0.014149463
[55,] 0.98910456 0.02179089 0.010895445
[56,] 0.98776173 0.02447654 0.012238269
[57,] 0.98738146 0.02523708 0.012618541
[58,] 0.98744640 0.02510720 0.012553601
[59,] 0.99036020 0.01927960 0.009639800
[60,] 0.98995578 0.02008844 0.010044219
[61,] 0.98686063 0.02627875 0.013139373
[62,] 0.98746388 0.02507224 0.012536118
[63,] 0.98337161 0.03325678 0.016628391
[64,] 0.98029863 0.03940275 0.019701373
[65,] 0.98618156 0.02763689 0.013818445
[66,] 0.98173954 0.03652092 0.018260458
[67,] 0.97830322 0.04339355 0.021696775
[68,] 0.97156582 0.05686836 0.028434179
[69,] 0.96294295 0.07411410 0.037057051
[70,] 0.97697046 0.04605908 0.023029538
[71,] 0.97495629 0.05008742 0.025043712
[72,] 0.97741604 0.04516792 0.022583958
[73,] 0.97735864 0.04528272 0.022641358
[74,] 0.97005725 0.05988550 0.029942750
[75,] 0.96273677 0.07452646 0.037263228
[76,] 0.98882693 0.02234613 0.011173067
[77,] 0.98489218 0.03021564 0.015107818
[78,] 0.97983214 0.04033572 0.020167858
[79,] 0.97400411 0.05199178 0.025995888
[80,] 0.96931730 0.06136540 0.030682700
[81,] 0.96049216 0.07901569 0.039507843
[82,] 0.95378136 0.09243728 0.046218638
[83,] 0.97159178 0.05681645 0.028408223
[84,] 0.96366379 0.07267242 0.036336209
[85,] 0.96040942 0.07918116 0.039590581
[86,] 0.95115766 0.09768469 0.048842345
[87,] 0.94042989 0.11914022 0.059570108
[88,] 0.93372813 0.13254374 0.066271868
[89,] 0.91714632 0.16570736 0.082853682
[90,] 0.90806400 0.18387199 0.091935996
[91,] 0.88892485 0.22215029 0.111075147
[92,] 0.86463630 0.27072741 0.135363705
[93,] 0.84398692 0.31202615 0.156013077
[94,] 0.84969341 0.30061318 0.150306592
[95,] 0.89895528 0.20208944 0.101044720
[96,] 0.89668657 0.20662686 0.103313432
[97,] 0.87246344 0.25507311 0.127536557
[98,] 0.84768404 0.30463192 0.152315961
[99,] 0.84012185 0.31975629 0.159878147
[100,] 0.83052684 0.33894632 0.169473160
[101,] 0.84853497 0.30293006 0.151465029
[102,] 0.83257364 0.33485273 0.167426364
[103,] 0.87592411 0.24815179 0.124075893
[104,] 0.84573926 0.30852149 0.154260743
[105,] 0.81575659 0.36848682 0.184243411
[106,] 0.77748795 0.44502410 0.222512052
[107,] 0.78116743 0.43766514 0.218832572
[108,] 0.79977659 0.40044683 0.200223414
[109,] 0.78541214 0.42917572 0.214587859
[110,] 0.73952914 0.52094172 0.260470861
[111,] 0.81141009 0.37717983 0.188589914
[112,] 0.78057279 0.43885441 0.219427207
[113,] 0.75475773 0.49048453 0.245242265
[114,] 0.74603956 0.50792087 0.253960436
[115,] 0.69933115 0.60133769 0.300668847
[116,] 0.70010367 0.59979266 0.299896332
[117,] 0.68713561 0.62572877 0.312864385
[118,] 0.62786784 0.74426432 0.372132161
[119,] 0.59028777 0.81942446 0.409712229
[120,] 0.59414284 0.81171432 0.405857159
[121,] 0.58558609 0.82882783 0.414413915
[122,] 0.51709940 0.96580121 0.482900603
[123,] 0.50121185 0.99757630 0.498788148
[124,] 0.46867880 0.93735761 0.531321195
[125,] 0.39853455 0.79706910 0.601465449
[126,] 0.37042573 0.74085147 0.629574265
[127,] 0.36712768 0.73425536 0.632872321
[128,] 0.29482015 0.58964029 0.705179853
[129,] 0.36627295 0.73254590 0.633727049
[130,] 0.73286717 0.53426567 0.267132835
[131,] 0.74532438 0.50935123 0.254675617
[132,] 0.69431623 0.61136754 0.305683770
[133,] 0.59806828 0.80386344 0.401931718
[134,] 0.53275916 0.93448168 0.467240842
[135,] 0.41026079 0.82052158 0.589739212
[136,] 0.38776435 0.77552870 0.612235650
[137,] 0.56672345 0.86655311 0.433276553
> postscript(file="/var/www/html/rcomp/tmp/16gge1290545223.ps",horizontal=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/html/rcomp/tmp/26gge1290545223.ps",horizontal=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/html/rcomp/tmp/36gge1290545223.ps",horizontal=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/html/rcomp/tmp/4umqb1290545223.ps",horizontal=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/html/rcomp/tmp/5umqb1290545223.ps",horizontal=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 = 156
Frequency = 1
1 2 3 4 5 6
1.73103659 1.10659174 2.00708853 0.96337957 -0.81360522 2.88768857
7 8 9 10 11 12
-1.72269371 -1.20644687 -0.55151146 3.41647477 -2.22968872 -0.98870131
13 14 15 16 17 18
2.59882986 -4.41334147 -0.50057488 0.37066607 -1.98870131 -0.37134807
19 20 21 22 23 24
1.46087583 -3.25208777 2.24231556 0.59169300 -0.83212419 2.42668498
25 26 27 28 29 30
1.02044106 0.41832489 -5.40714940 0.26765307 -0.01945218 4.92970970
31 32 33 34 35 36
4.28817621 -1.58671729 -0.72721077 0.92512379 -1.41913024 1.56216858
37 38 39 40 41 42
-1.06287177 0.43079344 0.12554497 0.38591903 1.01808474 6.98704483
43 44 45 46 47 48
-4.64274509 -2.24642649 -0.24815033 2.16073895 2.67425487 0.81731237
49 50 51 52 53 54
-2.42036083 -1.47657533 -1.07776593 -6.37064845 -0.09694925 -2.50012786
55 56 57 58 59 60
2.15554926 -0.90629465 0.33064948 1.41708919 -2.53259073 0.41196575
61 62 63 64 65 66
-2.11127718 1.81346837 0.85113616 2.62281791 -1.43189651 1.83664963
67 68 69 70 71 72
-2.25980102 2.67555546 1.80540137 -0.79384205 2.09366423 0.41140625
73 74 75 76 77 78
-1.41704760 -3.19880052 -0.77054984 -1.40488455 -0.33609524 0.04921791
79 80 81 82 83 84
3.14218748 -1.93738395 -2.71848078 1.58825958 -0.16122662 -1.17025563
85 86 87 88 89 90
3.88520889 -0.30661194 -0.32097684 0.07568053 1.19812478 -0.46030858
91 92 93 94 95 96
0.89826510 -3.59102306 0.49209417 1.59623607 0.51079949 0.64027925
97 98 99 100 101 102
-2.12233146 -0.71613370 -1.66495268 0.44084844 0.38695328 1.06118124
103 104 105 106 107 108
-1.40343343 1.95273063 -3.15689034 -0.73895106 -1.52857277 -1.22596100
109 110 111 112 113 114
-2.24957053 -2.68286752 -0.88446734 -1.16055887 -0.07561519 0.72783545
115 116 117 118 119 120
0.55042829 2.55513583 3.08663659 -1.78519159 -0.18781259 3.11792086
121 122 123 124 125 126
0.44137355 1.45354074 -2.88555195 -1.08151409 2.02478854 1.38418968
127 128 129 130 131 132
0.52153636 -0.76716339 -0.46157615 -2.00815950 -0.11626704 2.33566643
133 134 135 136 137 138
-1.36058070 -1.01858579 1.87287786 1.50090639 0.34369231 -3.38126041
139 140 141 142 143 144
5.09230615 -0.94519890 0.12706323 -0.33860679 2.58331816 -0.84487272
145 146 147 148 149 150
1.07682062 -0.76022949 -3.25133962 -4.65180401 1.13220766 1.93978811
151 152 153 154 155 156
-0.27046181 0.91597436 -0.82283412 0.93899529 0.84493283 1.82579924
> postscript(file="/var/www/html/rcomp/tmp/6mvpe1290545223.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 156
Frequency = 1
lag(myerror, k = 1) myerror
0 1.73103659 NA
1 1.10659174 1.73103659
2 2.00708853 1.10659174
3 0.96337957 2.00708853
4 -0.81360522 0.96337957
5 2.88768857 -0.81360522
6 -1.72269371 2.88768857
7 -1.20644687 -1.72269371
8 -0.55151146 -1.20644687
9 3.41647477 -0.55151146
10 -2.22968872 3.41647477
11 -0.98870131 -2.22968872
12 2.59882986 -0.98870131
13 -4.41334147 2.59882986
14 -0.50057488 -4.41334147
15 0.37066607 -0.50057488
16 -1.98870131 0.37066607
17 -0.37134807 -1.98870131
18 1.46087583 -0.37134807
19 -3.25208777 1.46087583
20 2.24231556 -3.25208777
21 0.59169300 2.24231556
22 -0.83212419 0.59169300
23 2.42668498 -0.83212419
24 1.02044106 2.42668498
25 0.41832489 1.02044106
26 -5.40714940 0.41832489
27 0.26765307 -5.40714940
28 -0.01945218 0.26765307
29 4.92970970 -0.01945218
30 4.28817621 4.92970970
31 -1.58671729 4.28817621
32 -0.72721077 -1.58671729
33 0.92512379 -0.72721077
34 -1.41913024 0.92512379
35 1.56216858 -1.41913024
36 -1.06287177 1.56216858
37 0.43079344 -1.06287177
38 0.12554497 0.43079344
39 0.38591903 0.12554497
40 1.01808474 0.38591903
41 6.98704483 1.01808474
42 -4.64274509 6.98704483
43 -2.24642649 -4.64274509
44 -0.24815033 -2.24642649
45 2.16073895 -0.24815033
46 2.67425487 2.16073895
47 0.81731237 2.67425487
48 -2.42036083 0.81731237
49 -1.47657533 -2.42036083
50 -1.07776593 -1.47657533
51 -6.37064845 -1.07776593
52 -0.09694925 -6.37064845
53 -2.50012786 -0.09694925
54 2.15554926 -2.50012786
55 -0.90629465 2.15554926
56 0.33064948 -0.90629465
57 1.41708919 0.33064948
58 -2.53259073 1.41708919
59 0.41196575 -2.53259073
60 -2.11127718 0.41196575
61 1.81346837 -2.11127718
62 0.85113616 1.81346837
63 2.62281791 0.85113616
64 -1.43189651 2.62281791
65 1.83664963 -1.43189651
66 -2.25980102 1.83664963
67 2.67555546 -2.25980102
68 1.80540137 2.67555546
69 -0.79384205 1.80540137
70 2.09366423 -0.79384205
71 0.41140625 2.09366423
72 -1.41704760 0.41140625
73 -3.19880052 -1.41704760
74 -0.77054984 -3.19880052
75 -1.40488455 -0.77054984
76 -0.33609524 -1.40488455
77 0.04921791 -0.33609524
78 3.14218748 0.04921791
79 -1.93738395 3.14218748
80 -2.71848078 -1.93738395
81 1.58825958 -2.71848078
82 -0.16122662 1.58825958
83 -1.17025563 -0.16122662
84 3.88520889 -1.17025563
85 -0.30661194 3.88520889
86 -0.32097684 -0.30661194
87 0.07568053 -0.32097684
88 1.19812478 0.07568053
89 -0.46030858 1.19812478
90 0.89826510 -0.46030858
91 -3.59102306 0.89826510
92 0.49209417 -3.59102306
93 1.59623607 0.49209417
94 0.51079949 1.59623607
95 0.64027925 0.51079949
96 -2.12233146 0.64027925
97 -0.71613370 -2.12233146
98 -1.66495268 -0.71613370
99 0.44084844 -1.66495268
100 0.38695328 0.44084844
101 1.06118124 0.38695328
102 -1.40343343 1.06118124
103 1.95273063 -1.40343343
104 -3.15689034 1.95273063
105 -0.73895106 -3.15689034
106 -1.52857277 -0.73895106
107 -1.22596100 -1.52857277
108 -2.24957053 -1.22596100
109 -2.68286752 -2.24957053
110 -0.88446734 -2.68286752
111 -1.16055887 -0.88446734
112 -0.07561519 -1.16055887
113 0.72783545 -0.07561519
114 0.55042829 0.72783545
115 2.55513583 0.55042829
116 3.08663659 2.55513583
117 -1.78519159 3.08663659
118 -0.18781259 -1.78519159
119 3.11792086 -0.18781259
120 0.44137355 3.11792086
121 1.45354074 0.44137355
122 -2.88555195 1.45354074
123 -1.08151409 -2.88555195
124 2.02478854 -1.08151409
125 1.38418968 2.02478854
126 0.52153636 1.38418968
127 -0.76716339 0.52153636
128 -0.46157615 -0.76716339
129 -2.00815950 -0.46157615
130 -0.11626704 -2.00815950
131 2.33566643 -0.11626704
132 -1.36058070 2.33566643
133 -1.01858579 -1.36058070
134 1.87287786 -1.01858579
135 1.50090639 1.87287786
136 0.34369231 1.50090639
137 -3.38126041 0.34369231
138 5.09230615 -3.38126041
139 -0.94519890 5.09230615
140 0.12706323 -0.94519890
141 -0.33860679 0.12706323
142 2.58331816 -0.33860679
143 -0.84487272 2.58331816
144 1.07682062 -0.84487272
145 -0.76022949 1.07682062
146 -3.25133962 -0.76022949
147 -4.65180401 -3.25133962
148 1.13220766 -4.65180401
149 1.93978811 1.13220766
150 -0.27046181 1.93978811
151 0.91597436 -0.27046181
152 -0.82283412 0.91597436
153 0.93899529 -0.82283412
154 0.84493283 0.93899529
155 1.82579924 0.84493283
156 NA 1.82579924
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 1.10659174 1.73103659
[2,] 2.00708853 1.10659174
[3,] 0.96337957 2.00708853
[4,] -0.81360522 0.96337957
[5,] 2.88768857 -0.81360522
[6,] -1.72269371 2.88768857
[7,] -1.20644687 -1.72269371
[8,] -0.55151146 -1.20644687
[9,] 3.41647477 -0.55151146
[10,] -2.22968872 3.41647477
[11,] -0.98870131 -2.22968872
[12,] 2.59882986 -0.98870131
[13,] -4.41334147 2.59882986
[14,] -0.50057488 -4.41334147
[15,] 0.37066607 -0.50057488
[16,] -1.98870131 0.37066607
[17,] -0.37134807 -1.98870131
[18,] 1.46087583 -0.37134807
[19,] -3.25208777 1.46087583
[20,] 2.24231556 -3.25208777
[21,] 0.59169300 2.24231556
[22,] -0.83212419 0.59169300
[23,] 2.42668498 -0.83212419
[24,] 1.02044106 2.42668498
[25,] 0.41832489 1.02044106
[26,] -5.40714940 0.41832489
[27,] 0.26765307 -5.40714940
[28,] -0.01945218 0.26765307
[29,] 4.92970970 -0.01945218
[30,] 4.28817621 4.92970970
[31,] -1.58671729 4.28817621
[32,] -0.72721077 -1.58671729
[33,] 0.92512379 -0.72721077
[34,] -1.41913024 0.92512379
[35,] 1.56216858 -1.41913024
[36,] -1.06287177 1.56216858
[37,] 0.43079344 -1.06287177
[38,] 0.12554497 0.43079344
[39,] 0.38591903 0.12554497
[40,] 1.01808474 0.38591903
[41,] 6.98704483 1.01808474
[42,] -4.64274509 6.98704483
[43,] -2.24642649 -4.64274509
[44,] -0.24815033 -2.24642649
[45,] 2.16073895 -0.24815033
[46,] 2.67425487 2.16073895
[47,] 0.81731237 2.67425487
[48,] -2.42036083 0.81731237
[49,] -1.47657533 -2.42036083
[50,] -1.07776593 -1.47657533
[51,] -6.37064845 -1.07776593
[52,] -0.09694925 -6.37064845
[53,] -2.50012786 -0.09694925
[54,] 2.15554926 -2.50012786
[55,] -0.90629465 2.15554926
[56,] 0.33064948 -0.90629465
[57,] 1.41708919 0.33064948
[58,] -2.53259073 1.41708919
[59,] 0.41196575 -2.53259073
[60,] -2.11127718 0.41196575
[61,] 1.81346837 -2.11127718
[62,] 0.85113616 1.81346837
[63,] 2.62281791 0.85113616
[64,] -1.43189651 2.62281791
[65,] 1.83664963 -1.43189651
[66,] -2.25980102 1.83664963
[67,] 2.67555546 -2.25980102
[68,] 1.80540137 2.67555546
[69,] -0.79384205 1.80540137
[70,] 2.09366423 -0.79384205
[71,] 0.41140625 2.09366423
[72,] -1.41704760 0.41140625
[73,] -3.19880052 -1.41704760
[74,] -0.77054984 -3.19880052
[75,] -1.40488455 -0.77054984
[76,] -0.33609524 -1.40488455
[77,] 0.04921791 -0.33609524
[78,] 3.14218748 0.04921791
[79,] -1.93738395 3.14218748
[80,] -2.71848078 -1.93738395
[81,] 1.58825958 -2.71848078
[82,] -0.16122662 1.58825958
[83,] -1.17025563 -0.16122662
[84,] 3.88520889 -1.17025563
[85,] -0.30661194 3.88520889
[86,] -0.32097684 -0.30661194
[87,] 0.07568053 -0.32097684
[88,] 1.19812478 0.07568053
[89,] -0.46030858 1.19812478
[90,] 0.89826510 -0.46030858
[91,] -3.59102306 0.89826510
[92,] 0.49209417 -3.59102306
[93,] 1.59623607 0.49209417
[94,] 0.51079949 1.59623607
[95,] 0.64027925 0.51079949
[96,] -2.12233146 0.64027925
[97,] -0.71613370 -2.12233146
[98,] -1.66495268 -0.71613370
[99,] 0.44084844 -1.66495268
[100,] 0.38695328 0.44084844
[101,] 1.06118124 0.38695328
[102,] -1.40343343 1.06118124
[103,] 1.95273063 -1.40343343
[104,] -3.15689034 1.95273063
[105,] -0.73895106 -3.15689034
[106,] -1.52857277 -0.73895106
[107,] -1.22596100 -1.52857277
[108,] -2.24957053 -1.22596100
[109,] -2.68286752 -2.24957053
[110,] -0.88446734 -2.68286752
[111,] -1.16055887 -0.88446734
[112,] -0.07561519 -1.16055887
[113,] 0.72783545 -0.07561519
[114,] 0.55042829 0.72783545
[115,] 2.55513583 0.55042829
[116,] 3.08663659 2.55513583
[117,] -1.78519159 3.08663659
[118,] -0.18781259 -1.78519159
[119,] 3.11792086 -0.18781259
[120,] 0.44137355 3.11792086
[121,] 1.45354074 0.44137355
[122,] -2.88555195 1.45354074
[123,] -1.08151409 -2.88555195
[124,] 2.02478854 -1.08151409
[125,] 1.38418968 2.02478854
[126,] 0.52153636 1.38418968
[127,] -0.76716339 0.52153636
[128,] -0.46157615 -0.76716339
[129,] -2.00815950 -0.46157615
[130,] -0.11626704 -2.00815950
[131,] 2.33566643 -0.11626704
[132,] -1.36058070 2.33566643
[133,] -1.01858579 -1.36058070
[134,] 1.87287786 -1.01858579
[135,] 1.50090639 1.87287786
[136,] 0.34369231 1.50090639
[137,] -3.38126041 0.34369231
[138,] 5.09230615 -3.38126041
[139,] -0.94519890 5.09230615
[140,] 0.12706323 -0.94519890
[141,] -0.33860679 0.12706323
[142,] 2.58331816 -0.33860679
[143,] -0.84487272 2.58331816
[144,] 1.07682062 -0.84487272
[145,] -0.76022949 1.07682062
[146,] -3.25133962 -0.76022949
[147,] -4.65180401 -3.25133962
[148,] 1.13220766 -4.65180401
[149,] 1.93978811 1.13220766
[150,] -0.27046181 1.93978811
[151,] 0.91597436 -0.27046181
[152,] -0.82283412 0.91597436
[153,] 0.93899529 -0.82283412
[154,] 0.84493283 0.93899529
[155,] 1.82579924 0.84493283
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 1.10659174 1.73103659
2 2.00708853 1.10659174
3 0.96337957 2.00708853
4 -0.81360522 0.96337957
5 2.88768857 -0.81360522
6 -1.72269371 2.88768857
7 -1.20644687 -1.72269371
8 -0.55151146 -1.20644687
9 3.41647477 -0.55151146
10 -2.22968872 3.41647477
11 -0.98870131 -2.22968872
12 2.59882986 -0.98870131
13 -4.41334147 2.59882986
14 -0.50057488 -4.41334147
15 0.37066607 -0.50057488
16 -1.98870131 0.37066607
17 -0.37134807 -1.98870131
18 1.46087583 -0.37134807
19 -3.25208777 1.46087583
20 2.24231556 -3.25208777
21 0.59169300 2.24231556
22 -0.83212419 0.59169300
23 2.42668498 -0.83212419
24 1.02044106 2.42668498
25 0.41832489 1.02044106
26 -5.40714940 0.41832489
27 0.26765307 -5.40714940
28 -0.01945218 0.26765307
29 4.92970970 -0.01945218
30 4.28817621 4.92970970
31 -1.58671729 4.28817621
32 -0.72721077 -1.58671729
33 0.92512379 -0.72721077
34 -1.41913024 0.92512379
35 1.56216858 -1.41913024
36 -1.06287177 1.56216858
37 0.43079344 -1.06287177
38 0.12554497 0.43079344
39 0.38591903 0.12554497
40 1.01808474 0.38591903
41 6.98704483 1.01808474
42 -4.64274509 6.98704483
43 -2.24642649 -4.64274509
44 -0.24815033 -2.24642649
45 2.16073895 -0.24815033
46 2.67425487 2.16073895
47 0.81731237 2.67425487
48 -2.42036083 0.81731237
49 -1.47657533 -2.42036083
50 -1.07776593 -1.47657533
51 -6.37064845 -1.07776593
52 -0.09694925 -6.37064845
53 -2.50012786 -0.09694925
54 2.15554926 -2.50012786
55 -0.90629465 2.15554926
56 0.33064948 -0.90629465
57 1.41708919 0.33064948
58 -2.53259073 1.41708919
59 0.41196575 -2.53259073
60 -2.11127718 0.41196575
61 1.81346837 -2.11127718
62 0.85113616 1.81346837
63 2.62281791 0.85113616
64 -1.43189651 2.62281791
65 1.83664963 -1.43189651
66 -2.25980102 1.83664963
67 2.67555546 -2.25980102
68 1.80540137 2.67555546
69 -0.79384205 1.80540137
70 2.09366423 -0.79384205
71 0.41140625 2.09366423
72 -1.41704760 0.41140625
73 -3.19880052 -1.41704760
74 -0.77054984 -3.19880052
75 -1.40488455 -0.77054984
76 -0.33609524 -1.40488455
77 0.04921791 -0.33609524
78 3.14218748 0.04921791
79 -1.93738395 3.14218748
80 -2.71848078 -1.93738395
81 1.58825958 -2.71848078
82 -0.16122662 1.58825958
83 -1.17025563 -0.16122662
84 3.88520889 -1.17025563
85 -0.30661194 3.88520889
86 -0.32097684 -0.30661194
87 0.07568053 -0.32097684
88 1.19812478 0.07568053
89 -0.46030858 1.19812478
90 0.89826510 -0.46030858
91 -3.59102306 0.89826510
92 0.49209417 -3.59102306
93 1.59623607 0.49209417
94 0.51079949 1.59623607
95 0.64027925 0.51079949
96 -2.12233146 0.64027925
97 -0.71613370 -2.12233146
98 -1.66495268 -0.71613370
99 0.44084844 -1.66495268
100 0.38695328 0.44084844
101 1.06118124 0.38695328
102 -1.40343343 1.06118124
103 1.95273063 -1.40343343
104 -3.15689034 1.95273063
105 -0.73895106 -3.15689034
106 -1.52857277 -0.73895106
107 -1.22596100 -1.52857277
108 -2.24957053 -1.22596100
109 -2.68286752 -2.24957053
110 -0.88446734 -2.68286752
111 -1.16055887 -0.88446734
112 -0.07561519 -1.16055887
113 0.72783545 -0.07561519
114 0.55042829 0.72783545
115 2.55513583 0.55042829
116 3.08663659 2.55513583
117 -1.78519159 3.08663659
118 -0.18781259 -1.78519159
119 3.11792086 -0.18781259
120 0.44137355 3.11792086
121 1.45354074 0.44137355
122 -2.88555195 1.45354074
123 -1.08151409 -2.88555195
124 2.02478854 -1.08151409
125 1.38418968 2.02478854
126 0.52153636 1.38418968
127 -0.76716339 0.52153636
128 -0.46157615 -0.76716339
129 -2.00815950 -0.46157615
130 -0.11626704 -2.00815950
131 2.33566643 -0.11626704
132 -1.36058070 2.33566643
133 -1.01858579 -1.36058070
134 1.87287786 -1.01858579
135 1.50090639 1.87287786
136 0.34369231 1.50090639
137 -3.38126041 0.34369231
138 5.09230615 -3.38126041
139 -0.94519890 5.09230615
140 0.12706323 -0.94519890
141 -0.33860679 0.12706323
142 2.58331816 -0.33860679
143 -0.84487272 2.58331816
144 1.07682062 -0.84487272
145 -0.76022949 1.07682062
146 -3.25133962 -0.76022949
147 -4.65180401 -3.25133962
148 1.13220766 -4.65180401
149 1.93978811 1.13220766
150 -0.27046181 1.93978811
151 0.91597436 -0.27046181
152 -0.82283412 0.91597436
153 0.93899529 -0.82283412
154 0.84493283 0.93899529
155 1.82579924 0.84493283
> 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/html/rcomp/tmp/7mvpe1290545223.ps",horizontal=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/html/rcomp/tmp/8fmoz1290545223.ps",horizontal=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/html/rcomp/tmp/9fmoz1290545223.ps",horizontal=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/html/rcomp/tmp/108wo21290545223.ps",horizontal=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/html/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/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/html/rcomp/tmp/11temq1290545223.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/html/rcomp/tmp/12ff3v1290545223.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/html/rcomp/tmp/13b71m1290545223.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/html/rcomp/tmp/14e7za1290545223.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/html/rcomp/tmp/1508xy1290545223.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/html/rcomp/tmp/16l8wm1290545223.tab")
+ }
>
> try(system("convert tmp/16gge1290545223.ps tmp/16gge1290545223.png",intern=TRUE))
character(0)
> try(system("convert tmp/26gge1290545223.ps tmp/26gge1290545223.png",intern=TRUE))
character(0)
> try(system("convert tmp/36gge1290545223.ps tmp/36gge1290545223.png",intern=TRUE))
character(0)
> try(system("convert tmp/4umqb1290545223.ps tmp/4umqb1290545223.png",intern=TRUE))
character(0)
> try(system("convert tmp/5umqb1290545223.ps tmp/5umqb1290545223.png",intern=TRUE))
character(0)
> try(system("convert tmp/6mvpe1290545223.ps tmp/6mvpe1290545223.png",intern=TRUE))
character(0)
> try(system("convert tmp/7mvpe1290545223.ps tmp/7mvpe1290545223.png",intern=TRUE))
character(0)
> try(system("convert tmp/8fmoz1290545223.ps tmp/8fmoz1290545223.png",intern=TRUE))
character(0)
> try(system("convert tmp/9fmoz1290545223.ps tmp/9fmoz1290545223.png",intern=TRUE))
character(0)
> try(system("convert tmp/108wo21290545223.ps tmp/108wo21290545223.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.994 1.733 11.829