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
+ ,9
+ ,12
+ ,12
+ ,8
+ ,13
+ ,5
+ ,1
+ ,9
+ ,15
+ ,10
+ ,12
+ ,16
+ ,6
+ ,0
+ ,9
+ ,12
+ ,9
+ ,7
+ ,12
+ ,6
+ ,3
+ ,9
+ ,10
+ ,10
+ ,10
+ ,11
+ ,5
+ ,3
+ ,9
+ ,12
+ ,12
+ ,7
+ ,12
+ ,3
+ ,1
+ ,9
+ ,15
+ ,13
+ ,16
+ ,18
+ ,8
+ ,3
+ ,9
+ ,9
+ ,12
+ ,11
+ ,11
+ ,4
+ ,1
+ ,9
+ ,12
+ ,12
+ ,14
+ ,14
+ ,4
+ ,4
+ ,9
+ ,11
+ ,6
+ ,6
+ ,9
+ ,4
+ ,0
+ ,9
+ ,11
+ ,5
+ ,16
+ ,14
+ ,6
+ ,3
+ ,9
+ ,11
+ ,12
+ ,11
+ ,12
+ ,6
+ ,2
+ ,9
+ ,15
+ ,11
+ ,16
+ ,11
+ ,5
+ ,4
+ ,9
+ ,7
+ ,14
+ ,12
+ ,12
+ ,4
+ ,3
+ ,9
+ ,11
+ ,14
+ ,7
+ ,13
+ ,6
+ ,1
+ ,9
+ ,11
+ ,12
+ ,13
+ ,11
+ ,4
+ ,1
+ ,9
+ ,10
+ ,12
+ ,11
+ ,12
+ ,6
+ ,2
+ ,9
+ ,14
+ ,11
+ ,15
+ ,16
+ ,6
+ ,3
+ ,9
+ ,10
+ ,11
+ ,7
+ ,9
+ ,4
+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4
+ ,1
+ ,10
+ ,13
+ ,12
+ ,14
+ ,14
+ ,6
+ ,2
+ ,10
+ ,15
+ ,12
+ ,14
+ ,16
+ ,4
+ ,0
+ ,10
+ ,8
+ ,10
+ ,10
+ ,6
+ ,4
+ ,5
+ ,10
+ ,12
+ ,12
+ ,10
+ ,13
+ ,4
+ ,2
+ ,10
+ ,10
+ ,13
+ ,4
+ ,13
+ ,6
+ ,1
+ ,10
+ ,8
+ ,12
+ ,8
+ ,14
+ ,5
+ ,1
+ ,10
+ ,10
+ ,15
+ ,15
+ ,15
+ ,6
+ ,4
+ ,10
+ ,15
+ ,11
+ ,16
+ ,14
+ ,6
+ ,3
+ ,10
+ ,16
+ ,12
+ ,12
+ ,15
+ ,8
+ ,0
+ ,10
+ ,13
+ ,11
+ ,12
+ ,13
+ ,7
+ ,3
+ ,10
+ ,16
+ ,12
+ ,15
+ ,16
+ ,7
+ ,3
+ ,10
+ ,9
+ ,11
+ ,9
+ ,12
+ ,4
+ ,0
+ ,10
+ ,14
+ ,10
+ ,12
+ ,15
+ ,6
+ ,2
+ ,10
+ ,14
+ ,11
+ ,14
+ ,12
+ ,6
+ ,5
+ ,10
+ ,12
+ ,11
+ ,11
+ ,14
+ ,2
+ ,2
+ ,10)
+ ,dim=c(7
+ ,156)
+ ,dimnames=list(c('Popularity'
+ ,'FindingFriends'
+ ,'KnowingPeople'
+ ,'Liked'
+ ,'Celebrity'
+ ,'Sum_friends'
+ ,'Month')
+ ,1:156))
> y <- array(NA,dim=c(7,156),dimnames=list(c('Popularity','FindingFriends','KnowingPeople','Liked','Celebrity','Sum_friends','Month'),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 Month
1 13 13 14 13 3 2 9
2 12 12 8 13 5 1 9
3 15 10 12 16 6 0 9
4 12 9 7 12 6 3 9
5 10 10 10 11 5 3 9
6 12 12 7 12 3 1 9
7 15 13 16 18 8 3 9
8 9 12 11 11 4 1 9
9 12 12 14 14 4 4 9
10 11 6 6 9 4 0 9
11 11 5 16 14 6 3 9
12 11 12 11 12 6 2 9
13 15 11 16 11 5 4 9
14 7 14 12 12 4 3 9
15 11 14 7 13 6 1 9
16 11 12 13 11 4 1 9
17 10 12 11 12 6 2 9
18 14 11 15 16 6 3 9
19 10 11 7 9 4 1 9
20 6 7 9 11 4 1 9
21 11 9 7 13 2 2 9
22 15 11 14 15 7 3 9
23 11 11 15 10 5 4 9
24 12 12 7 11 4 2 9
25 14 12 15 13 6 1 9
26 15 11 17 16 6 2 9
27 9 11 15 15 7 2 9
28 13 8 14 14 5 4 9
29 13 9 14 14 6 2 9
30 16 12 8 14 4 3 9
31 13 10 8 8 4 3 9
32 12 10 14 13 7 3 9
33 14 12 14 15 7 4 9
34 11 8 8 13 4 2 9
35 9 12 11 11 4 2 9
36 16 11 16 15 6 4 9
37 12 12 10 15 6 3 9
38 10 7 8 9 5 4 9
39 13 11 14 13 6 2 9
40 16 11 16 16 7 5 9
41 14 12 13 13 6 3 9
42 15 9 5 11 3 1 9
43 5 15 8 12 3 1 9
44 8 11 10 12 4 1 9
45 11 11 8 12 6 2 9
46 16 11 13 14 7 3 9
47 17 11 15 14 5 9 9
48 9 15 6 8 4 0 9
49 9 11 12 13 5 0 9
50 13 12 16 16 6 2 9
51 10 12 5 13 6 2 9
52 6 9 15 11 6 3 10
53 12 12 12 14 5 1 10
54 8 12 8 13 4 2 10
55 14 13 13 13 5 0 10
56 12 11 14 13 5 5 10
57 11 9 12 12 4 2 10
58 16 9 16 16 6 4 10
59 8 11 10 15 2 3 10
60 15 11 15 15 8 0 10
61 7 12 8 12 3 0 10
62 16 12 16 14 6 4 10
63 14 9 19 12 6 1 10
64 16 11 14 15 6 1 10
65 9 9 6 12 5 4 10
66 14 12 13 13 5 2 10
67 11 12 15 12 6 4 10
68 13 12 7 12 5 1 10
69 15 12 13 13 6 4 10
70 5 14 4 5 2 2 10
71 15 11 14 13 5 5 10
72 13 12 13 13 5 4 10
73 11 11 11 14 5 4 10
74 11 6 14 17 6 4 10
75 12 10 12 13 6 4 10
76 12 12 15 13 6 3 10
77 12 13 14 12 5 3 10
78 12 8 13 13 5 3 10
79 14 12 8 14 4 2 10
80 6 12 6 11 2 1 10
81 7 12 7 12 4 1 10
82 14 6 13 12 6 5 10
83 14 11 13 16 6 4 10
84 10 10 11 12 5 2 10
85 13 12 5 12 3 3 10
86 12 13 12 12 6 2 10
87 9 11 8 10 4 2 10
88 12 7 11 15 5 2 10
89 16 11 14 15 8 2 10
90 10 11 9 12 4 3 10
91 14 11 10 16 6 2 10
92 10 11 13 15 6 3 10
93 16 12 16 16 7 4 10
94 15 10 16 13 6 3 10
95 12 11 11 12 5 3 10
96 10 12 8 11 4 0 10
97 8 7 4 13 6 1 10
98 8 13 7 10 3 2 10
99 11 8 14 15 5 2 10
100 13 12 11 13 6 3 10
101 16 11 17 16 7 4 10
102 16 12 15 15 7 4 10
103 14 14 17 18 6 1 10
104 11 10 5 13 3 2 10
105 4 10 4 10 2 2 10
106 14 13 10 16 8 3 10
107 9 10 11 13 3 3 10
108 14 11 15 15 8 3 10
109 8 10 10 14 3 1 10
110 8 7 9 15 4 1 10
111 11 10 12 14 5 1 10
112 12 8 15 13 7 1 10
113 11 12 7 13 6 0 10
114 14 12 13 15 6 1 10
115 15 12 12 16 7 3 10
116 16 11 14 14 6 3 10
117 16 12 14 14 6 0 10
118 11 12 8 16 6 2 10
119 14 12 15 14 6 5 10
120 14 11 12 12 4 2 10
121 12 12 12 13 4 3 10
122 14 11 16 12 5 3 10
123 8 11 9 12 4 5 10
124 13 13 15 14 6 4 10
125 16 12 15 14 6 4 10
126 12 12 6 14 5 0 10
127 16 12 14 16 8 3 10
128 12 12 15 13 6 0 10
129 11 8 10 14 5 2 10
130 4 8 6 4 4 0 10
131 16 12 14 16 8 6 10
132 15 11 12 13 6 3 10
133 10 12 8 16 4 1 10
134 13 13 11 15 6 6 10
135 15 12 13 14 6 2 10
136 12 12 9 13 4 1 10
137 14 11 15 14 6 3 10
138 7 12 13 12 3 1 10
139 19 12 15 15 6 2 10
140 12 10 14 14 5 4 10
141 12 11 16 13 4 1 10
142 13 12 14 14 6 2 10
143 15 12 14 16 4 0 10
144 8 10 10 6 4 5 10
145 12 12 10 13 4 2 10
146 10 13 4 13 6 1 10
147 8 12 8 14 5 1 10
148 10 15 15 15 6 4 10
149 15 11 16 14 6 3 10
150 16 12 12 15 8 0 10
151 13 11 12 13 7 3 10
152 16 12 15 16 7 3 10
153 9 11 9 12 4 0 10
154 14 10 12 15 6 2 10
155 14 11 14 12 6 5 10
156 12 11 11 14 2 2 10
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) FindingFriends KnowingPeople Liked Celebrity
2.3954 0.1081 0.2114 0.3665 0.6015
Sum_friends Month
0.2134 -0.2560
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-6.260963 -1.264412 -0.004282 1.334929 6.828887
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.39536 3.62429 0.661 0.509685
FindingFriends 0.10811 0.09571 1.130 0.260478
KnowingPeople 0.21144 0.06373 3.318 0.001141 **
Liked 0.36648 0.09689 3.782 0.000224 ***
Celebrity 0.60154 0.15578 3.861 0.000168 ***
Sum_friends 0.21341 0.12024 1.775 0.077949 .
Month -0.25597 0.36124 -0.709 0.479690
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.094 on 149 degrees of freedom
Multiple R-squared: 0.5111, Adjusted R-squared: 0.4914
F-statistic: 25.96 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.12789144 0.25578287 0.87210856
[2,] 0.14878616 0.29757232 0.85121384
[3,] 0.07809752 0.15619504 0.92190248
[4,] 0.56576958 0.86846085 0.43423042
[5,] 0.83455147 0.33089706 0.16544853
[6,] 0.76539798 0.46920405 0.23460202
[7,] 0.68264058 0.63471884 0.31735942
[8,] 0.62786277 0.74427447 0.37213723
[9,] 0.54114704 0.91770591 0.45885296
[10,] 0.45931255 0.91862510 0.54068745
[11,] 0.74280400 0.51439200 0.25719600
[12,] 0.68429700 0.63140601 0.31570300
[13,] 0.65249688 0.69500624 0.34750312
[14,] 0.58463657 0.83072686 0.41536343
[15,] 0.56420140 0.87159721 0.43579860
[16,] 0.52300065 0.95399870 0.47699935
[17,] 0.45970194 0.91940389 0.54029806
[18,] 0.71719242 0.56561515 0.28280758
[19,] 0.66306940 0.67386120 0.33693060
[20,] 0.60404444 0.79191112 0.39595556
[21,] 0.73545062 0.52909877 0.26454938
[22,] 0.82337202 0.35325597 0.17662798
[23,] 0.78888524 0.42222952 0.21111476
[24,] 0.74592883 0.50814234 0.25407117
[25,] 0.70423068 0.59153863 0.29576932
[26,] 0.69475823 0.61048353 0.30524177
[27,] 0.69367657 0.61264686 0.30632343
[28,] 0.66490032 0.67019936 0.33509968
[29,] 0.61437541 0.77124919 0.38562459
[30,] 0.56745535 0.86508931 0.43254465
[31,] 0.52658727 0.94682546 0.47341273
[32,] 0.49186586 0.98373172 0.50813414
[33,] 0.81322518 0.37354964 0.18677482
[34,] 0.95023065 0.09953871 0.04976935
[35,] 0.95525531 0.08948937 0.04474469
[36,] 0.94214672 0.11570656 0.05785328
[37,] 0.94865820 0.10268361 0.05134180
[38,] 0.95268484 0.09463033 0.04731516
[39,] 0.94673467 0.10653067 0.05326533
[40,] 0.93907560 0.12184879 0.06092440
[41,] 0.92383571 0.15232858 0.07616429
[42,] 0.91704558 0.16590885 0.08295442
[43,] 0.96094409 0.07811181 0.03905591
[44,] 0.97507693 0.04984615 0.02492307
[45,] 0.97183716 0.05632568 0.02816284
[46,] 0.98898238 0.02203524 0.01101762
[47,] 0.98521096 0.02957808 0.01478904
[48,] 0.98101068 0.03797863 0.01898932
[49,] 0.98063339 0.03873322 0.01936661
[50,] 0.98525321 0.02949358 0.01474679
[51,] 0.98555544 0.02888912 0.01444456
[52,] 0.98453848 0.03092304 0.01546152
[53,] 0.98644242 0.02711516 0.01355758
[54,] 0.98509894 0.02980212 0.01490106
[55,] 0.98868719 0.02262561 0.01131281
[56,] 0.98679478 0.02641044 0.01320522
[57,] 0.98649997 0.02700006 0.01350003
[58,] 0.98663408 0.02673185 0.01336592
[59,] 0.98970475 0.02059051 0.01029525
[60,] 0.98920219 0.02159561 0.01079781
[61,] 0.98586753 0.02826494 0.01413247
[62,] 0.98628220 0.02743559 0.01371780
[63,] 0.98176927 0.03646147 0.01823073
[64,] 0.97851606 0.04296788 0.02148394
[65,] 0.98516194 0.02967611 0.01483806
[66,] 0.98052920 0.03894161 0.01947080
[67,] 0.97731103 0.04537793 0.02268897
[68,] 0.97045793 0.05908414 0.02954207
[69,] 0.96150216 0.07699568 0.03849784
[70,] 0.97512284 0.04975432 0.02487716
[71,] 0.97337297 0.05325405 0.02662703
[72,] 0.97656029 0.04687942 0.02343971
[73,] 0.97604724 0.04790552 0.02395276
[74,] 0.96838805 0.06322391 0.03161195
[75,] 0.96119210 0.07761581 0.03880790
[76,] 0.98712121 0.02575758 0.01287879
[77,] 0.98291600 0.03416800 0.01708400
[78,] 0.97725299 0.04549401 0.02274701
[79,] 0.97055009 0.05889982 0.02944991
[80,] 0.96482557 0.07034886 0.03517443
[81,] 0.95483339 0.09033323 0.04516661
[82,] 0.94638229 0.10723543 0.05361771
[83,] 0.96845942 0.06308117 0.03154058
[84,] 0.95959882 0.08080235 0.04040118
[85,] 0.95471998 0.09056003 0.04528002
[86,] 0.94353588 0.11292824 0.05646412
[87,] 0.93037055 0.13925890 0.06962945
[88,] 0.92345980 0.15308039 0.07654020
[89,] 0.90488190 0.19023619 0.09511810
[90,] 0.89810058 0.20379884 0.10189942
[91,] 0.87619511 0.24760979 0.12380489
[92,] 0.85017943 0.29964115 0.14982057
[93,] 0.82590687 0.34818626 0.17409313
[94,] 0.83855417 0.32289166 0.16144583
[95,] 0.88281673 0.23436654 0.11718327
[96,] 0.88299259 0.23401481 0.11700741
[97,] 0.85765559 0.28468883 0.14234441
[98,] 0.83367798 0.33264405 0.16632202
[99,] 0.82756099 0.34487803 0.17243901
[100,] 0.82304892 0.35390216 0.17695108
[101,] 0.84870981 0.30258038 0.15129019
[102,] 0.83472679 0.33054641 0.16527321
[103,] 0.87970755 0.24058490 0.12029245
[104,] 0.84973155 0.30053690 0.15026845
[105,] 0.81880350 0.36239301 0.18119650
[106,] 0.78018727 0.43962547 0.21981273
[107,] 0.78055290 0.43889420 0.21944710
[108,] 0.79613435 0.40773131 0.20386565
[109,] 0.78328573 0.43342854 0.21671427
[110,] 0.73728091 0.52543817 0.26271909
[111,] 0.80488338 0.39023325 0.19511662
[112,] 0.77142220 0.45715561 0.22857780
[113,] 0.74181538 0.51636925 0.25818462
[114,] 0.73758315 0.52483369 0.26241685
[115,] 0.69140089 0.61719823 0.30859911
[116,] 0.68701165 0.62597670 0.31298835
[117,] 0.66873361 0.66253277 0.33126639
[118,] 0.60934595 0.78130810 0.39065405
[119,] 0.57528369 0.84943263 0.42471631
[120,] 0.59093628 0.81812744 0.40906372
[121,] 0.58161986 0.83676029 0.41838014
[122,] 0.51253389 0.97493221 0.48746611
[123,] 0.49846584 0.99693167 0.50153416
[124,] 0.46361174 0.92722348 0.53638826
[125,] 0.39495759 0.78991519 0.60504241
[126,] 0.36803755 0.73607509 0.63196245
[127,] 0.36054348 0.72108697 0.63945652
[128,] 0.29079080 0.58158160 0.70920920
[129,] 0.36370614 0.72741228 0.63629386
[130,] 0.71898745 0.56202511 0.28101255
[131,] 0.73966453 0.52067094 0.26033547
[132,] 0.68409409 0.63181182 0.31590591
[133,] 0.58442148 0.83115705 0.41557852
[134,] 0.53037911 0.93924179 0.46962089
[135,] 0.40535282 0.81070565 0.59464718
[136,] 0.37189067 0.74378135 0.62810933
[137,] 0.50738905 0.98522190 0.49261095
> postscript(file="/var/www/html/rcomp/tmp/1ai9b1290543551.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/2ai9b1290543551.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/3ai9b1290543551.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/4la8w1290543551.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/5la8w1290543551.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.54715073 0.93421174 1.81712227 0.80809164 -0.96631156 2.71520725
7 8 9 10 11 12
-1.92922196 -1.36560527 -0.73957884 3.28660131 -2.39535743 -1.14857445
13 14 15 16 17 18
2.44354568 -4.58655957 -0.67211106 0.21152057 -2.14857445 -0.56553076
19 20 21 22 23 24
1.32120593 -3.40218357 2.06118920 0.41084213 -0.97854056 2.26673230
25 26 27 28 29 30
0.85261130 0.22500584 -5.58718419 0.09131832 -0.19151054 4.74245441
31 32 33 34 35 36
4.15753352 -1.74809500 -0.91067813 0.75477988 -1.57901603 1.37609808
37 38 39 40 41 42
-1.24997817 0.30043373 -0.04125287 0.19466977 0.84866394 6.82888662
43 44 45 46 47 48
-4.82055836 -2.41253536 -0.40615370 1.98875590 2.48849892 0.68009242
49 50 51 52 53 54
-2.59001632 -1.67166659 -1.24642864 -6.26096262 -0.02204755 -2.42169243
55 56 57 58 59 60
2.23829330 -0.82397856 0.42336445 1.48180613 -2.47973946 0.49406217
61 62 63 64 65 66
-2.02685336 1.89043097 0.95363389 2.69517024 -1.33637545 1.91958129
67 68 69 70 71 72
-2.16517858 2.76809122 1.89121890 -0.65726792 2.17602144 0.49275977
73 74 75 76 77 78
-1.34273324 -3.13746786 -0.68112500 -1.31824451 -0.24689938 0.13860856
79 80 81 82 83 84
3.21183089 -1.84937240 -2.63036791 1.69294187 -0.10010164 -1.07484885
85 86 87 88 89 90
3.96722561 -0.21215533 -0.21415288 0.15004963 1.27867774 -0.37195408
91 92 93 94 95 96
0.96103113 -3.52021420 0.55593674 1.68653743 0.60363088 0.73808245
97 98 99 100 101 102
-2.02506755 -0.61739394 -1.59237113 0.52750382 0.45260916 1.13385050
103 104 105 106 107 108
-1.36289957 2.03037870 -3.05721330 -0.67168039 -1.45165455 -1.14617010
109 110 111 112 113 114
-2.17987263 -2.61212458 -0.80582854 -1.06052583 0.01348443 0.79849781
115 116 117 118 119 120
0.61509583 2.63482540 3.16694817 -1.72420422 -0.11154270 3.20714543
121 122 123 124 125 126
0.51914848 1.54644547 -2.79877560 -1.00624145 2.10186805 1.45998570
127 128 129 130 131 132
0.59068079 -0.67801223 -0.38014612 -1.84126859 -0.04955149 2.42417625
133 134 135 136 137 138
-1.30771171 -0.95379132 1.95156374 1.58028125 0.42338832 -3.29744953
139 140 141 142 143 144
5.16221289 -0.86893498 0.20833118 -0.25987335 2.63707655 -0.70324308
145 146 147 148 149 150
1.15543341 -0.67372459 -3.17629922 -4.58893715 1.21195124 2.02026391
151 152 153 154 155 156
-0.17736462 0.98078458 -0.73172180 1.01274315 0.94095725 1.88871089
> postscript(file="/var/www/html/rcomp/tmp/6v17z1290543551.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.54715073 NA
1 0.93421174 1.54715073
2 1.81712227 0.93421174
3 0.80809164 1.81712227
4 -0.96631156 0.80809164
5 2.71520725 -0.96631156
6 -1.92922196 2.71520725
7 -1.36560527 -1.92922196
8 -0.73957884 -1.36560527
9 3.28660131 -0.73957884
10 -2.39535743 3.28660131
11 -1.14857445 -2.39535743
12 2.44354568 -1.14857445
13 -4.58655957 2.44354568
14 -0.67211106 -4.58655957
15 0.21152057 -0.67211106
16 -2.14857445 0.21152057
17 -0.56553076 -2.14857445
18 1.32120593 -0.56553076
19 -3.40218357 1.32120593
20 2.06118920 -3.40218357
21 0.41084213 2.06118920
22 -0.97854056 0.41084213
23 2.26673230 -0.97854056
24 0.85261130 2.26673230
25 0.22500584 0.85261130
26 -5.58718419 0.22500584
27 0.09131832 -5.58718419
28 -0.19151054 0.09131832
29 4.74245441 -0.19151054
30 4.15753352 4.74245441
31 -1.74809500 4.15753352
32 -0.91067813 -1.74809500
33 0.75477988 -0.91067813
34 -1.57901603 0.75477988
35 1.37609808 -1.57901603
36 -1.24997817 1.37609808
37 0.30043373 -1.24997817
38 -0.04125287 0.30043373
39 0.19466977 -0.04125287
40 0.84866394 0.19466977
41 6.82888662 0.84866394
42 -4.82055836 6.82888662
43 -2.41253536 -4.82055836
44 -0.40615370 -2.41253536
45 1.98875590 -0.40615370
46 2.48849892 1.98875590
47 0.68009242 2.48849892
48 -2.59001632 0.68009242
49 -1.67166659 -2.59001632
50 -1.24642864 -1.67166659
51 -6.26096262 -1.24642864
52 -0.02204755 -6.26096262
53 -2.42169243 -0.02204755
54 2.23829330 -2.42169243
55 -0.82397856 2.23829330
56 0.42336445 -0.82397856
57 1.48180613 0.42336445
58 -2.47973946 1.48180613
59 0.49406217 -2.47973946
60 -2.02685336 0.49406217
61 1.89043097 -2.02685336
62 0.95363389 1.89043097
63 2.69517024 0.95363389
64 -1.33637545 2.69517024
65 1.91958129 -1.33637545
66 -2.16517858 1.91958129
67 2.76809122 -2.16517858
68 1.89121890 2.76809122
69 -0.65726792 1.89121890
70 2.17602144 -0.65726792
71 0.49275977 2.17602144
72 -1.34273324 0.49275977
73 -3.13746786 -1.34273324
74 -0.68112500 -3.13746786
75 -1.31824451 -0.68112500
76 -0.24689938 -1.31824451
77 0.13860856 -0.24689938
78 3.21183089 0.13860856
79 -1.84937240 3.21183089
80 -2.63036791 -1.84937240
81 1.69294187 -2.63036791
82 -0.10010164 1.69294187
83 -1.07484885 -0.10010164
84 3.96722561 -1.07484885
85 -0.21215533 3.96722561
86 -0.21415288 -0.21215533
87 0.15004963 -0.21415288
88 1.27867774 0.15004963
89 -0.37195408 1.27867774
90 0.96103113 -0.37195408
91 -3.52021420 0.96103113
92 0.55593674 -3.52021420
93 1.68653743 0.55593674
94 0.60363088 1.68653743
95 0.73808245 0.60363088
96 -2.02506755 0.73808245
97 -0.61739394 -2.02506755
98 -1.59237113 -0.61739394
99 0.52750382 -1.59237113
100 0.45260916 0.52750382
101 1.13385050 0.45260916
102 -1.36289957 1.13385050
103 2.03037870 -1.36289957
104 -3.05721330 2.03037870
105 -0.67168039 -3.05721330
106 -1.45165455 -0.67168039
107 -1.14617010 -1.45165455
108 -2.17987263 -1.14617010
109 -2.61212458 -2.17987263
110 -0.80582854 -2.61212458
111 -1.06052583 -0.80582854
112 0.01348443 -1.06052583
113 0.79849781 0.01348443
114 0.61509583 0.79849781
115 2.63482540 0.61509583
116 3.16694817 2.63482540
117 -1.72420422 3.16694817
118 -0.11154270 -1.72420422
119 3.20714543 -0.11154270
120 0.51914848 3.20714543
121 1.54644547 0.51914848
122 -2.79877560 1.54644547
123 -1.00624145 -2.79877560
124 2.10186805 -1.00624145
125 1.45998570 2.10186805
126 0.59068079 1.45998570
127 -0.67801223 0.59068079
128 -0.38014612 -0.67801223
129 -1.84126859 -0.38014612
130 -0.04955149 -1.84126859
131 2.42417625 -0.04955149
132 -1.30771171 2.42417625
133 -0.95379132 -1.30771171
134 1.95156374 -0.95379132
135 1.58028125 1.95156374
136 0.42338832 1.58028125
137 -3.29744953 0.42338832
138 5.16221289 -3.29744953
139 -0.86893498 5.16221289
140 0.20833118 -0.86893498
141 -0.25987335 0.20833118
142 2.63707655 -0.25987335
143 -0.70324308 2.63707655
144 1.15543341 -0.70324308
145 -0.67372459 1.15543341
146 -3.17629922 -0.67372459
147 -4.58893715 -3.17629922
148 1.21195124 -4.58893715
149 2.02026391 1.21195124
150 -0.17736462 2.02026391
151 0.98078458 -0.17736462
152 -0.73172180 0.98078458
153 1.01274315 -0.73172180
154 0.94095725 1.01274315
155 1.88871089 0.94095725
156 NA 1.88871089
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.93421174 1.54715073
[2,] 1.81712227 0.93421174
[3,] 0.80809164 1.81712227
[4,] -0.96631156 0.80809164
[5,] 2.71520725 -0.96631156
[6,] -1.92922196 2.71520725
[7,] -1.36560527 -1.92922196
[8,] -0.73957884 -1.36560527
[9,] 3.28660131 -0.73957884
[10,] -2.39535743 3.28660131
[11,] -1.14857445 -2.39535743
[12,] 2.44354568 -1.14857445
[13,] -4.58655957 2.44354568
[14,] -0.67211106 -4.58655957
[15,] 0.21152057 -0.67211106
[16,] -2.14857445 0.21152057
[17,] -0.56553076 -2.14857445
[18,] 1.32120593 -0.56553076
[19,] -3.40218357 1.32120593
[20,] 2.06118920 -3.40218357
[21,] 0.41084213 2.06118920
[22,] -0.97854056 0.41084213
[23,] 2.26673230 -0.97854056
[24,] 0.85261130 2.26673230
[25,] 0.22500584 0.85261130
[26,] -5.58718419 0.22500584
[27,] 0.09131832 -5.58718419
[28,] -0.19151054 0.09131832
[29,] 4.74245441 -0.19151054
[30,] 4.15753352 4.74245441
[31,] -1.74809500 4.15753352
[32,] -0.91067813 -1.74809500
[33,] 0.75477988 -0.91067813
[34,] -1.57901603 0.75477988
[35,] 1.37609808 -1.57901603
[36,] -1.24997817 1.37609808
[37,] 0.30043373 -1.24997817
[38,] -0.04125287 0.30043373
[39,] 0.19466977 -0.04125287
[40,] 0.84866394 0.19466977
[41,] 6.82888662 0.84866394
[42,] -4.82055836 6.82888662
[43,] -2.41253536 -4.82055836
[44,] -0.40615370 -2.41253536
[45,] 1.98875590 -0.40615370
[46,] 2.48849892 1.98875590
[47,] 0.68009242 2.48849892
[48,] -2.59001632 0.68009242
[49,] -1.67166659 -2.59001632
[50,] -1.24642864 -1.67166659
[51,] -6.26096262 -1.24642864
[52,] -0.02204755 -6.26096262
[53,] -2.42169243 -0.02204755
[54,] 2.23829330 -2.42169243
[55,] -0.82397856 2.23829330
[56,] 0.42336445 -0.82397856
[57,] 1.48180613 0.42336445
[58,] -2.47973946 1.48180613
[59,] 0.49406217 -2.47973946
[60,] -2.02685336 0.49406217
[61,] 1.89043097 -2.02685336
[62,] 0.95363389 1.89043097
[63,] 2.69517024 0.95363389
[64,] -1.33637545 2.69517024
[65,] 1.91958129 -1.33637545
[66,] -2.16517858 1.91958129
[67,] 2.76809122 -2.16517858
[68,] 1.89121890 2.76809122
[69,] -0.65726792 1.89121890
[70,] 2.17602144 -0.65726792
[71,] 0.49275977 2.17602144
[72,] -1.34273324 0.49275977
[73,] -3.13746786 -1.34273324
[74,] -0.68112500 -3.13746786
[75,] -1.31824451 -0.68112500
[76,] -0.24689938 -1.31824451
[77,] 0.13860856 -0.24689938
[78,] 3.21183089 0.13860856
[79,] -1.84937240 3.21183089
[80,] -2.63036791 -1.84937240
[81,] 1.69294187 -2.63036791
[82,] -0.10010164 1.69294187
[83,] -1.07484885 -0.10010164
[84,] 3.96722561 -1.07484885
[85,] -0.21215533 3.96722561
[86,] -0.21415288 -0.21215533
[87,] 0.15004963 -0.21415288
[88,] 1.27867774 0.15004963
[89,] -0.37195408 1.27867774
[90,] 0.96103113 -0.37195408
[91,] -3.52021420 0.96103113
[92,] 0.55593674 -3.52021420
[93,] 1.68653743 0.55593674
[94,] 0.60363088 1.68653743
[95,] 0.73808245 0.60363088
[96,] -2.02506755 0.73808245
[97,] -0.61739394 -2.02506755
[98,] -1.59237113 -0.61739394
[99,] 0.52750382 -1.59237113
[100,] 0.45260916 0.52750382
[101,] 1.13385050 0.45260916
[102,] -1.36289957 1.13385050
[103,] 2.03037870 -1.36289957
[104,] -3.05721330 2.03037870
[105,] -0.67168039 -3.05721330
[106,] -1.45165455 -0.67168039
[107,] -1.14617010 -1.45165455
[108,] -2.17987263 -1.14617010
[109,] -2.61212458 -2.17987263
[110,] -0.80582854 -2.61212458
[111,] -1.06052583 -0.80582854
[112,] 0.01348443 -1.06052583
[113,] 0.79849781 0.01348443
[114,] 0.61509583 0.79849781
[115,] 2.63482540 0.61509583
[116,] 3.16694817 2.63482540
[117,] -1.72420422 3.16694817
[118,] -0.11154270 -1.72420422
[119,] 3.20714543 -0.11154270
[120,] 0.51914848 3.20714543
[121,] 1.54644547 0.51914848
[122,] -2.79877560 1.54644547
[123,] -1.00624145 -2.79877560
[124,] 2.10186805 -1.00624145
[125,] 1.45998570 2.10186805
[126,] 0.59068079 1.45998570
[127,] -0.67801223 0.59068079
[128,] -0.38014612 -0.67801223
[129,] -1.84126859 -0.38014612
[130,] -0.04955149 -1.84126859
[131,] 2.42417625 -0.04955149
[132,] -1.30771171 2.42417625
[133,] -0.95379132 -1.30771171
[134,] 1.95156374 -0.95379132
[135,] 1.58028125 1.95156374
[136,] 0.42338832 1.58028125
[137,] -3.29744953 0.42338832
[138,] 5.16221289 -3.29744953
[139,] -0.86893498 5.16221289
[140,] 0.20833118 -0.86893498
[141,] -0.25987335 0.20833118
[142,] 2.63707655 -0.25987335
[143,] -0.70324308 2.63707655
[144,] 1.15543341 -0.70324308
[145,] -0.67372459 1.15543341
[146,] -3.17629922 -0.67372459
[147,] -4.58893715 -3.17629922
[148,] 1.21195124 -4.58893715
[149,] 2.02026391 1.21195124
[150,] -0.17736462 2.02026391
[151,] 0.98078458 -0.17736462
[152,] -0.73172180 0.98078458
[153,] 1.01274315 -0.73172180
[154,] 0.94095725 1.01274315
[155,] 1.88871089 0.94095725
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.93421174 1.54715073
2 1.81712227 0.93421174
3 0.80809164 1.81712227
4 -0.96631156 0.80809164
5 2.71520725 -0.96631156
6 -1.92922196 2.71520725
7 -1.36560527 -1.92922196
8 -0.73957884 -1.36560527
9 3.28660131 -0.73957884
10 -2.39535743 3.28660131
11 -1.14857445 -2.39535743
12 2.44354568 -1.14857445
13 -4.58655957 2.44354568
14 -0.67211106 -4.58655957
15 0.21152057 -0.67211106
16 -2.14857445 0.21152057
17 -0.56553076 -2.14857445
18 1.32120593 -0.56553076
19 -3.40218357 1.32120593
20 2.06118920 -3.40218357
21 0.41084213 2.06118920
22 -0.97854056 0.41084213
23 2.26673230 -0.97854056
24 0.85261130 2.26673230
25 0.22500584 0.85261130
26 -5.58718419 0.22500584
27 0.09131832 -5.58718419
28 -0.19151054 0.09131832
29 4.74245441 -0.19151054
30 4.15753352 4.74245441
31 -1.74809500 4.15753352
32 -0.91067813 -1.74809500
33 0.75477988 -0.91067813
34 -1.57901603 0.75477988
35 1.37609808 -1.57901603
36 -1.24997817 1.37609808
37 0.30043373 -1.24997817
38 -0.04125287 0.30043373
39 0.19466977 -0.04125287
40 0.84866394 0.19466977
41 6.82888662 0.84866394
42 -4.82055836 6.82888662
43 -2.41253536 -4.82055836
44 -0.40615370 -2.41253536
45 1.98875590 -0.40615370
46 2.48849892 1.98875590
47 0.68009242 2.48849892
48 -2.59001632 0.68009242
49 -1.67166659 -2.59001632
50 -1.24642864 -1.67166659
51 -6.26096262 -1.24642864
52 -0.02204755 -6.26096262
53 -2.42169243 -0.02204755
54 2.23829330 -2.42169243
55 -0.82397856 2.23829330
56 0.42336445 -0.82397856
57 1.48180613 0.42336445
58 -2.47973946 1.48180613
59 0.49406217 -2.47973946
60 -2.02685336 0.49406217
61 1.89043097 -2.02685336
62 0.95363389 1.89043097
63 2.69517024 0.95363389
64 -1.33637545 2.69517024
65 1.91958129 -1.33637545
66 -2.16517858 1.91958129
67 2.76809122 -2.16517858
68 1.89121890 2.76809122
69 -0.65726792 1.89121890
70 2.17602144 -0.65726792
71 0.49275977 2.17602144
72 -1.34273324 0.49275977
73 -3.13746786 -1.34273324
74 -0.68112500 -3.13746786
75 -1.31824451 -0.68112500
76 -0.24689938 -1.31824451
77 0.13860856 -0.24689938
78 3.21183089 0.13860856
79 -1.84937240 3.21183089
80 -2.63036791 -1.84937240
81 1.69294187 -2.63036791
82 -0.10010164 1.69294187
83 -1.07484885 -0.10010164
84 3.96722561 -1.07484885
85 -0.21215533 3.96722561
86 -0.21415288 -0.21215533
87 0.15004963 -0.21415288
88 1.27867774 0.15004963
89 -0.37195408 1.27867774
90 0.96103113 -0.37195408
91 -3.52021420 0.96103113
92 0.55593674 -3.52021420
93 1.68653743 0.55593674
94 0.60363088 1.68653743
95 0.73808245 0.60363088
96 -2.02506755 0.73808245
97 -0.61739394 -2.02506755
98 -1.59237113 -0.61739394
99 0.52750382 -1.59237113
100 0.45260916 0.52750382
101 1.13385050 0.45260916
102 -1.36289957 1.13385050
103 2.03037870 -1.36289957
104 -3.05721330 2.03037870
105 -0.67168039 -3.05721330
106 -1.45165455 -0.67168039
107 -1.14617010 -1.45165455
108 -2.17987263 -1.14617010
109 -2.61212458 -2.17987263
110 -0.80582854 -2.61212458
111 -1.06052583 -0.80582854
112 0.01348443 -1.06052583
113 0.79849781 0.01348443
114 0.61509583 0.79849781
115 2.63482540 0.61509583
116 3.16694817 2.63482540
117 -1.72420422 3.16694817
118 -0.11154270 -1.72420422
119 3.20714543 -0.11154270
120 0.51914848 3.20714543
121 1.54644547 0.51914848
122 -2.79877560 1.54644547
123 -1.00624145 -2.79877560
124 2.10186805 -1.00624145
125 1.45998570 2.10186805
126 0.59068079 1.45998570
127 -0.67801223 0.59068079
128 -0.38014612 -0.67801223
129 -1.84126859 -0.38014612
130 -0.04955149 -1.84126859
131 2.42417625 -0.04955149
132 -1.30771171 2.42417625
133 -0.95379132 -1.30771171
134 1.95156374 -0.95379132
135 1.58028125 1.95156374
136 0.42338832 1.58028125
137 -3.29744953 0.42338832
138 5.16221289 -3.29744953
139 -0.86893498 5.16221289
140 0.20833118 -0.86893498
141 -0.25987335 0.20833118
142 2.63707655 -0.25987335
143 -0.70324308 2.63707655
144 1.15543341 -0.70324308
145 -0.67372459 1.15543341
146 -3.17629922 -0.67372459
147 -4.58893715 -3.17629922
148 1.21195124 -4.58893715
149 2.02026391 1.21195124
150 -0.17736462 2.02026391
151 0.98078458 -0.17736462
152 -0.73172180 0.98078458
153 1.01274315 -0.73172180
154 0.94095725 1.01274315
155 1.88871089 0.94095725
> 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/7v17z1290543551.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/8oao21290543551.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/9oao21290543551.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/10z15n1290543551.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/11kk4b1290543551.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/1252kh1290543551.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/13jciq1290543551.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/14ndhd1290543551.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/15qdfj1290543551.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/16ceep1290543551.tab")
+ }
>
> try(system("convert tmp/1ai9b1290543551.ps tmp/1ai9b1290543551.png",intern=TRUE))
character(0)
> try(system("convert tmp/2ai9b1290543551.ps tmp/2ai9b1290543551.png",intern=TRUE))
character(0)
> try(system("convert tmp/3ai9b1290543551.ps tmp/3ai9b1290543551.png",intern=TRUE))
character(0)
> try(system("convert tmp/4la8w1290543551.ps tmp/4la8w1290543551.png",intern=TRUE))
character(0)
> try(system("convert tmp/5la8w1290543551.ps tmp/5la8w1290543551.png",intern=TRUE))
character(0)
> try(system("convert tmp/6v17z1290543551.ps tmp/6v17z1290543551.png",intern=TRUE))
character(0)
> try(system("convert tmp/7v17z1290543551.ps tmp/7v17z1290543551.png",intern=TRUE))
character(0)
> try(system("convert tmp/8oao21290543551.ps tmp/8oao21290543551.png",intern=TRUE))
character(0)
> try(system("convert tmp/9oao21290543551.ps tmp/9oao21290543551.png",intern=TRUE))
character(0)
> try(system("convert tmp/10z15n1290543551.ps tmp/10z15n1290543551.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.104 1.795 11.676