R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
Copyright (C) 2013 The R Foundation for Statistical Computing
Platform: i686-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(13
+ ,13
+ ,14
+ ,13
+ ,3
+ ,12
+ ,12
+ ,8
+ ,13
+ ,5
+ ,15
+ ,10
+ ,12
+ ,16
+ ,6
+ ,12
+ ,9
+ ,7
+ ,12
+ ,6
+ ,10
+ ,10
+ ,10
+ ,11
+ ,5
+ ,12
+ ,12
+ ,7
+ ,12
+ ,3
+ ,15
+ ,13
+ ,16
+ ,18
+ ,8
+ ,9
+ ,12
+ ,11
+ ,11
+ ,4
+ ,12
+ ,12
+ ,14
+ ,14
+ ,4
+ ,11
+ ,6
+ ,6
+ ,9
+ ,4
+ ,11
+ ,5
+ ,16
+ ,14
+ ,6
+ ,11
+ ,12
+ ,11
+ ,12
+ ,6
+ ,15
+ ,11
+ ,16
+ ,11
+ ,5
+ ,7
+ ,14
+ ,12
+ ,12
+ ,4
+ ,11
+ ,14
+ ,7
+ ,13
+ ,6
+ ,11
+ ,12
+ ,13
+ ,11
+ ,4
+ ,10
+ ,12
+ ,11
+ ,12
+ ,6
+ ,14
+ ,11
+ ,15
+ ,16
+ ,6
+ ,10
+ ,11
+ ,7
+ ,9
+ ,4
+ ,6
+ ,7
+ ,9
+ ,11
+ ,4
+ ,11
+ ,9
+ ,7
+ ,13
+ ,2
+ ,15
+ ,11
+ ,14
+ ,15
+ ,7
+ ,11
+ ,11
+ ,15
+ ,10
+ ,5
+ ,12
+ ,12
+ ,7
+ ,11
+ ,4
+ ,14
+ ,12
+ ,15
+ ,13
+ ,6
+ ,15
+ ,11
+ ,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for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par20 = ''
> par19 = ''
> par18 = ''
> par17 = ''
> par16 = ''
> par15 = ''
> par14 = ''
> par13 = ''
> par12 = ''
> par11 = ''
> par10 = ''
> par9 = ''
> par8 = ''
> par7 = ''
> par6 = ''
> par5 = ''
> par4 = ''
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '3'
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following objects are masked from 'package:base':
as.Date, 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
Knowingpeople Popularity Findingfriends Liked Celebrity
1 14 13 13 13 3
2 8 12 12 13 5
3 12 15 10 16 6
4 7 12 9 12 6
5 10 10 10 11 5
6 7 12 12 12 3
7 16 15 13 18 8
8 11 9 12 11 4
9 14 12 12 14 4
10 6 11 6 9 4
11 16 11 5 14 6
12 11 11 12 12 6
13 16 15 11 11 5
14 12 7 14 12 4
15 7 11 14 13 6
16 13 11 12 11 4
17 11 10 12 12 6
18 15 14 11 16 6
19 7 10 11 9 4
20 9 6 7 11 4
21 7 11 9 13 2
22 14 15 11 15 7
23 15 11 11 10 5
24 7 12 12 11 4
25 15 14 12 13 6
26 17 15 11 16 6
27 15 9 11 15 7
28 14 13 8 14 5
29 14 13 9 14 6
30 8 16 12 14 4
31 8 13 10 8 4
32 14 12 10 13 7
33 14 14 12 15 7
34 8 11 8 13 4
35 11 9 12 11 4
36 16 16 11 15 6
37 10 12 12 15 6
38 8 10 7 9 5
39 14 13 11 13 6
40 16 16 11 16 7
41 13 14 12 13 6
42 5 15 9 11 3
43 8 5 15 12 3
44 10 8 11 12 4
45 8 11 11 12 6
46 13 16 11 14 7
47 15 17 11 14 5
48 6 9 15 8 4
49 12 9 11 13 5
50 16 13 12 16 6
51 5 10 12 13 6
52 15 6 9 11 6
53 12 12 12 14 5
54 8 8 12 13 4
55 13 14 13 13 5
56 14 12 11 13 5
57 12 11 9 12 4
58 16 16 9 16 6
59 10 8 11 15 2
60 15 15 11 15 8
61 8 7 12 12 3
62 16 16 12 14 6
63 19 14 9 12 6
64 14 16 11 15 6
65 6 9 9 12 5
66 13 14 12 13 5
67 15 11 12 12 6
68 7 13 12 12 5
69 13 15 12 13 6
70 4 5 14 5 2
71 14 15 11 13 5
72 13 13 12 13 5
73 11 11 11 14 5
74 14 11 6 17 6
75 12 12 10 13 6
76 15 12 12 13 6
77 14 12 13 12 5
78 13 12 8 13 5
79 8 14 12 14 4
80 6 6 12 11 2
81 7 7 12 12 4
82 13 14 6 12 6
83 13 14 11 16 6
84 11 10 10 12 5
85 5 13 12 12 3
86 12 12 13 12 6
87 8 9 11 10 4
88 11 12 7 15 5
89 14 16 11 15 8
90 9 10 11 12 4
91 10 14 11 16 6
92 13 10 11 15 6
93 16 16 12 16 7
94 16 15 10 13 6
95 11 12 11 12 5
96 8 10 12 11 4
97 4 8 7 13 6
98 7 8 13 10 3
99 14 11 8 15 5
100 11 13 12 13 6
101 17 16 11 16 7
102 15 16 12 15 7
103 17 14 14 18 6
104 5 11 10 13 3
105 4 4 10 10 2
106 10 14 13 16 8
107 11 9 10 13 3
108 15 14 11 15 8
109 10 8 10 14 3
110 9 8 7 15 4
111 12 11 10 14 5
112 15 12 8 13 7
113 7 11 12 13 6
114 13 14 12 15 6
115 12 15 12 16 7
116 14 16 11 14 6
117 14 16 12 14 6
118 8 11 12 16 6
119 15 14 12 14 6
120 12 14 11 12 4
121 12 12 12 13 4
122 16 14 11 12 5
123 9 8 11 12 4
124 15 13 13 14 6
125 15 16 12 14 6
126 6 12 12 14 5
127 14 16 12 16 8
128 15 12 12 13 6
129 10 11 8 14 5
130 6 4 8 4 4
131 14 16 12 16 8
132 12 15 11 13 6
133 8 10 12 16 4
134 11 13 13 15 6
135 13 15 12 14 6
136 9 12 12 13 4
137 15 14 11 14 6
138 13 7 12 12 3
139 15 19 12 15 6
140 14 12 10 14 5
141 16 12 11 13 4
142 14 13 12 14 6
143 14 15 12 16 4
144 10 8 10 6 4
145 10 12 12 13 4
146 4 10 13 13 6
147 8 8 12 14 5
148 15 10 15 15 6
149 16 15 11 14 6
150 12 16 12 15 8
151 12 13 11 13 7
152 15 16 12 16 7
153 9 9 11 12 4
154 12 14 10 15 6
155 14 14 11 12 6
156 11 12 11 14 2
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Popularity Findingfriends Liked Celebrity
0.70477 0.38811 -0.07209 0.26767 0.66952
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-7.1457 -1.5530 0.2044 1.7720 6.2812
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.70477 1.79737 0.392 0.69553
Popularity 0.38811 0.09769 3.973 0.00011 ***
Findingfriends -0.07209 0.12131 -0.594 0.55326
Liked 0.26767 0.12500 2.141 0.03385 *
Celebrity 0.66952 0.19983 3.351 0.00102 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.656 on 151 degrees of freedom
Multiple R-squared: 0.4263, Adjusted R-squared: 0.4111
F-statistic: 28.05 on 4 and 151 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.7145996 0.57080072 0.28540036
[2,] 0.5680701 0.86385971 0.43192985
[3,] 0.5097718 0.98045639 0.49022819
[4,] 0.3850670 0.77013409 0.61493296
[5,] 0.3666323 0.73326459 0.63336771
[6,] 0.9416476 0.11670482 0.05835241
[7,] 0.9282163 0.14356733 0.07178366
[8,] 0.9494158 0.10116845 0.05058422
[9,] 0.9508214 0.09835723 0.04917862
[10,] 0.9288217 0.14235662 0.07117831
[11,] 0.9011255 0.19774909 0.09887455
[12,] 0.8712715 0.25745705 0.12872853
[13,] 0.8288738 0.34225241 0.17112621
[14,] 0.8735288 0.25294232 0.12647116
[15,] 0.8328318 0.33433648 0.16716824
[16,] 0.9114287 0.17714269 0.08857134
[17,] 0.9173298 0.16534042 0.08267021
[18,] 0.9095974 0.18080529 0.09040265
[19,] 0.9068303 0.18633941 0.09316970
[20,] 0.8942579 0.21148427 0.10574213
[21,] 0.8727122 0.25457556 0.12728778
[22,] 0.8411917 0.31761668 0.15880834
[23,] 0.8847823 0.23043550 0.11521775
[24,] 0.8583005 0.28339905 0.14169952
[25,] 0.8264258 0.34714837 0.17357419
[26,] 0.7870371 0.42592576 0.21296288
[27,] 0.7854169 0.42916613 0.21458306
[28,] 0.7567582 0.48648360 0.24324180
[29,] 0.7364980 0.52700390 0.26350195
[30,] 0.7529204 0.49415924 0.24707962
[31,] 0.7221205 0.55575903 0.27787952
[32,] 0.6883911 0.62321790 0.31160895
[33,] 0.6425734 0.71485320 0.35742660
[34,] 0.5907035 0.81859293 0.40929646
[35,] 0.7103654 0.57926916 0.28963458
[36,] 0.6764341 0.64713184 0.32356592
[37,] 0.6315698 0.73686038 0.36843019
[38,] 0.6749658 0.65006840 0.32503420
[39,] 0.6395101 0.72097974 0.36048987
[40,] 0.6211913 0.75761737 0.37880869
[41,] 0.5913315 0.81733700 0.40866850
[42,] 0.5557561 0.88848772 0.44424386
[43,] 0.5468436 0.90631284 0.45315642
[44,] 0.7749048 0.45019039 0.22509519
[45,] 0.8735642 0.25287164 0.12643582
[46,] 0.8465615 0.30687691 0.15343846
[47,] 0.8288640 0.34227196 0.17113598
[48,] 0.8028806 0.39423874 0.19711937
[49,] 0.7996752 0.40064955 0.20032477
[50,] 0.7787694 0.44246114 0.22123057
[51,] 0.7487020 0.50259598 0.25129799
[52,] 0.7199062 0.56018759 0.28009380
[53,] 0.6790696 0.64186084 0.32093042
[54,] 0.6381895 0.72362100 0.36181050
[55,] 0.6264399 0.74712013 0.37356006
[56,] 0.8089526 0.38209486 0.19104743
[57,] 0.7752931 0.44941388 0.22470694
[58,] 0.8272917 0.34541668 0.17270834
[59,] 0.7986997 0.40260051 0.20130026
[60,] 0.8281254 0.34374912 0.17187456
[61,] 0.8784526 0.24309487 0.12154743
[62,] 0.8533847 0.29323067 0.14661533
[63,] 0.8284238 0.34315243 0.17157621
[64,] 0.8055723 0.38885539 0.19442770
[65,] 0.7783559 0.44328811 0.22164406
[66,] 0.7442458 0.51150849 0.25575424
[67,] 0.7206476 0.55870488 0.27935244
[68,] 0.6807793 0.63844135 0.31922068
[69,] 0.6928901 0.61421987 0.30710994
[70,] 0.7017996 0.59640085 0.29820042
[71,] 0.6710602 0.65787965 0.32893982
[72,] 0.7243416 0.55131672 0.27565836
[73,] 0.6850871 0.62982581 0.31491290
[74,] 0.6563397 0.68732062 0.34366031
[75,] 0.6122679 0.77546418 0.38773209
[76,] 0.5719960 0.85600798 0.42800399
[77,] 0.5289281 0.94214380 0.47107190
[78,] 0.7053056 0.58938871 0.29469436
[79,] 0.6643938 0.67121248 0.33560624
[80,] 0.6264463 0.74710733 0.37355366
[81,] 0.5899815 0.82003709 0.41001854
[82,] 0.5608441 0.87831181 0.43915591
[83,] 0.5186985 0.96260301 0.48130150
[84,] 0.5621024 0.87579513 0.43789757
[85,] 0.5509301 0.89813973 0.44906986
[86,] 0.5121004 0.97579916 0.48789958
[87,] 0.5055428 0.98891439 0.49445719
[88,] 0.4585091 0.91701829 0.54149085
[89,] 0.4312766 0.86255324 0.56872338
[90,] 0.6464460 0.70710806 0.35355403
[91,] 0.6066586 0.78668280 0.39334140
[92,] 0.6030198 0.79396037 0.39698018
[93,] 0.5699729 0.86005420 0.43002710
[94,] 0.5559336 0.88813276 0.44406638
[95,] 0.5082390 0.98352203 0.49176101
[96,] 0.5698759 0.86024814 0.43012407
[97,] 0.7410063 0.51798737 0.25899369
[98,] 0.7333516 0.53329687 0.26664843
[99,] 0.7823678 0.43526431 0.21763215
[100,] 0.7570148 0.48597039 0.24298520
[101,] 0.7380219 0.52395628 0.26197814
[102,] 0.7006053 0.59878948 0.29939474
[103,] 0.6558853 0.68822944 0.34411472
[104,] 0.6125257 0.77494861 0.38747431
[105,] 0.6522522 0.69549554 0.34774777
[106,] 0.7298049 0.54039016 0.27019508
[107,] 0.6835562 0.63288751 0.31644375
[108,] 0.6580926 0.68381488 0.34190744
[109,] 0.6066104 0.78677916 0.39338958
[110,] 0.5545188 0.89096232 0.44548116
[111,] 0.5811903 0.83761949 0.41880975
[112,] 0.5547849 0.89043014 0.44521507
[113,] 0.5139591 0.97208175 0.48604088
[114,] 0.4603711 0.92074214 0.53962893
[115,] 0.4819886 0.96397716 0.51801142
[116,] 0.4232889 0.84657783 0.57671108
[117,] 0.4163470 0.83269399 0.58365300
[118,] 0.3640991 0.72819820 0.63590090
[119,] 0.5856096 0.82878087 0.41439044
[120,] 0.5292860 0.94142797 0.47071398
[121,] 0.5635022 0.87299555 0.43649778
[122,] 0.5075582 0.98488362 0.49244181
[123,] 0.4535935 0.90718696 0.54640652
[124,] 0.3940279 0.78805574 0.60597213
[125,] 0.3493975 0.69879493 0.65060254
[126,] 0.3586031 0.71720628 0.64139686
[127,] 0.3099869 0.61997387 0.69001306
[128,] 0.2499550 0.49990991 0.75004505
[129,] 0.2684969 0.53699371 0.73150314
[130,] 0.2365551 0.47311027 0.76344486
[131,] 0.2923273 0.58465457 0.70767272
[132,] 0.2556241 0.51124828 0.74437586
[133,] 0.2528684 0.50573684 0.74713158
[134,] 0.3674713 0.73494260 0.63252870
[135,] 0.3134352 0.62687036 0.68656482
[136,] 0.2325764 0.46515288 0.76742356
[137,] 0.2116082 0.42321638 0.78839181
[138,] 0.1645634 0.32912672 0.83543664
[139,] 0.7731207 0.45375866 0.22687933
[140,] 0.6598780 0.68024407 0.34012203
[141,] 0.7149845 0.57003099 0.28501550
> postscript(file="/var/wessaorg/rcomp/tmp/1pe8y1386625704.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/wessaorg/rcomp/tmp/2zbqh1386625704.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/wessaorg/rcomp/tmp/31nqp1386625704.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/wessaorg/rcomp/tmp/4bu6k1386625704.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/wessaorg/rcomp/tmp/5pdxg1386625704.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 = 156
Frequency = 1
1 2 3 4 5 6
3.69857236 -3.32444584 -2.10549595 -4.94255407 -0.15704777 -2.71772860
7 8 9 10 11 12
0.23637269 2.04475950 3.07740400 -3.62863755 3.62186901 -0.33818303
13 14 15 16 17 18
3.97447512 3.69748453 -4.46168329 3.26853420 0.04992961 1.35470282
19 20 21 22 23 24
-1.88009425 0.84866678 -2.14402451 -0.43525966 4.79459823 -3.11957845
25 26 27 28 29 30
2.22980651 2.96659018 2.89341622 1.73142447 1.13398824 -4.47504659
31 32 33 34 35 36
-1.84884580 1.19233718 0.02493911 -2.55515536 2.04475950 1.84615005
37 38 39 40 41 42
-2.52931323 -1.83796113 1.54583302 0.90895517 0.22980651 -5.83065242
43 44 45 46 47 48
1.21531832 1.09311349 -3.41026917 -1.55569979 1.39523228 -1.93596456
49 50 51 52 53 54
1.76780597 2.81490160 -6.21774291 5.65379432 0.40788164 -1.10247289
55 56 57 58 59 60
0.97141500 2.60346803 1.78460329 1.43430527 1.62914066 -0.10478202
61 62 63 64 65 66
0.22283463 2.18590870 6.28122063 -0.15384995 -4.10869377 0.89932887
67 68 69 70 71 72
3.66181697 -4.44488597 -0.15830614 -0.31353783 1.43913009 1.28744151
73 74 75 76 77 78
-0.27609184 0.89093759 -0.13814046 3.00603180 3.01531281 1.38720964
79 80 81 82 83 84
-3.69882129 -0.45185785 -1.44668773 0.06496224 -0.64529718 0.57527971
85 86 87 88 89 90
-5.10584125 0.34579045 -0.75965412 -1.22022153 -1.49289467 -0.68311180
91 92 93 94 95 96
-3.64529718 1.17482593 0.98104130 2.69752160 -0.12885945 -1.34335315
97 98 99 100 101 102
-6.80194827 -0.55784685 2.23997725 -1.38208085 1.90895517 0.24871382
103 104 105 106 107 108
3.03561618 -4.74146074 -1.55213230 -4.84016963 2.03476456 0.28333062
109 110 111 112 113 114
1.15520469 -0.99824858 0.65182203 2.04816492 -4.60585555 -0.30553853
115 116 117 118 119 120
-2.63084605 0.11382257 0.18590870 -4.40887310 1.96213399 0.76443761
121 122 123 124 125 126
1.34507652 4.09491525 0.09311349 2.42233277 1.18590870 -5.59211836
127 128 129 130 131 132
-1.68848106 3.00603180 -1.49235023 0.57068583 -1.68848106 -1.23039227
133 134 135 136 137 138
-2.68171574 -1.84533975 -0.42597866 -1.65492348 1.89004786 5.22283463
139 140 141 142 143 144
-0.24610176 2.26370938 5.27299039 1.35024664 1.37772103 2.62706247
145 146 147 148 149 150
-0.65492348 -7.14565677 -2.03966777 3.46317045 2.50193521 -3.42080854
151 152 153 154 155 156
-1.12368934 -0.01895870 -0.29499915 -1.44971079 1.42539289 1.34436259
> postscript(file="/var/wessaorg/rcomp/tmp/6wins1386625704.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 = 156
Frequency = 1
lag(myerror, k = 1) myerror
0 3.69857236 NA
1 -3.32444584 3.69857236
2 -2.10549595 -3.32444584
3 -4.94255407 -2.10549595
4 -0.15704777 -4.94255407
5 -2.71772860 -0.15704777
6 0.23637269 -2.71772860
7 2.04475950 0.23637269
8 3.07740400 2.04475950
9 -3.62863755 3.07740400
10 3.62186901 -3.62863755
11 -0.33818303 3.62186901
12 3.97447512 -0.33818303
13 3.69748453 3.97447512
14 -4.46168329 3.69748453
15 3.26853420 -4.46168329
16 0.04992961 3.26853420
17 1.35470282 0.04992961
18 -1.88009425 1.35470282
19 0.84866678 -1.88009425
20 -2.14402451 0.84866678
21 -0.43525966 -2.14402451
22 4.79459823 -0.43525966
23 -3.11957845 4.79459823
24 2.22980651 -3.11957845
25 2.96659018 2.22980651
26 2.89341622 2.96659018
27 1.73142447 2.89341622
28 1.13398824 1.73142447
29 -4.47504659 1.13398824
30 -1.84884580 -4.47504659
31 1.19233718 -1.84884580
32 0.02493911 1.19233718
33 -2.55515536 0.02493911
34 2.04475950 -2.55515536
35 1.84615005 2.04475950
36 -2.52931323 1.84615005
37 -1.83796113 -2.52931323
38 1.54583302 -1.83796113
39 0.90895517 1.54583302
40 0.22980651 0.90895517
41 -5.83065242 0.22980651
42 1.21531832 -5.83065242
43 1.09311349 1.21531832
44 -3.41026917 1.09311349
45 -1.55569979 -3.41026917
46 1.39523228 -1.55569979
47 -1.93596456 1.39523228
48 1.76780597 -1.93596456
49 2.81490160 1.76780597
50 -6.21774291 2.81490160
51 5.65379432 -6.21774291
52 0.40788164 5.65379432
53 -1.10247289 0.40788164
54 0.97141500 -1.10247289
55 2.60346803 0.97141500
56 1.78460329 2.60346803
57 1.43430527 1.78460329
58 1.62914066 1.43430527
59 -0.10478202 1.62914066
60 0.22283463 -0.10478202
61 2.18590870 0.22283463
62 6.28122063 2.18590870
63 -0.15384995 6.28122063
64 -4.10869377 -0.15384995
65 0.89932887 -4.10869377
66 3.66181697 0.89932887
67 -4.44488597 3.66181697
68 -0.15830614 -4.44488597
69 -0.31353783 -0.15830614
70 1.43913009 -0.31353783
71 1.28744151 1.43913009
72 -0.27609184 1.28744151
73 0.89093759 -0.27609184
74 -0.13814046 0.89093759
75 3.00603180 -0.13814046
76 3.01531281 3.00603180
77 1.38720964 3.01531281
78 -3.69882129 1.38720964
79 -0.45185785 -3.69882129
80 -1.44668773 -0.45185785
81 0.06496224 -1.44668773
82 -0.64529718 0.06496224
83 0.57527971 -0.64529718
84 -5.10584125 0.57527971
85 0.34579045 -5.10584125
86 -0.75965412 0.34579045
87 -1.22022153 -0.75965412
88 -1.49289467 -1.22022153
89 -0.68311180 -1.49289467
90 -3.64529718 -0.68311180
91 1.17482593 -3.64529718
92 0.98104130 1.17482593
93 2.69752160 0.98104130
94 -0.12885945 2.69752160
95 -1.34335315 -0.12885945
96 -6.80194827 -1.34335315
97 -0.55784685 -6.80194827
98 2.23997725 -0.55784685
99 -1.38208085 2.23997725
100 1.90895517 -1.38208085
101 0.24871382 1.90895517
102 3.03561618 0.24871382
103 -4.74146074 3.03561618
104 -1.55213230 -4.74146074
105 -4.84016963 -1.55213230
106 2.03476456 -4.84016963
107 0.28333062 2.03476456
108 1.15520469 0.28333062
109 -0.99824858 1.15520469
110 0.65182203 -0.99824858
111 2.04816492 0.65182203
112 -4.60585555 2.04816492
113 -0.30553853 -4.60585555
114 -2.63084605 -0.30553853
115 0.11382257 -2.63084605
116 0.18590870 0.11382257
117 -4.40887310 0.18590870
118 1.96213399 -4.40887310
119 0.76443761 1.96213399
120 1.34507652 0.76443761
121 4.09491525 1.34507652
122 0.09311349 4.09491525
123 2.42233277 0.09311349
124 1.18590870 2.42233277
125 -5.59211836 1.18590870
126 -1.68848106 -5.59211836
127 3.00603180 -1.68848106
128 -1.49235023 3.00603180
129 0.57068583 -1.49235023
130 -1.68848106 0.57068583
131 -1.23039227 -1.68848106
132 -2.68171574 -1.23039227
133 -1.84533975 -2.68171574
134 -0.42597866 -1.84533975
135 -1.65492348 -0.42597866
136 1.89004786 -1.65492348
137 5.22283463 1.89004786
138 -0.24610176 5.22283463
139 2.26370938 -0.24610176
140 5.27299039 2.26370938
141 1.35024664 5.27299039
142 1.37772103 1.35024664
143 2.62706247 1.37772103
144 -0.65492348 2.62706247
145 -7.14565677 -0.65492348
146 -2.03966777 -7.14565677
147 3.46317045 -2.03966777
148 2.50193521 3.46317045
149 -3.42080854 2.50193521
150 -1.12368934 -3.42080854
151 -0.01895870 -1.12368934
152 -0.29499915 -0.01895870
153 -1.44971079 -0.29499915
154 1.42539289 -1.44971079
155 1.34436259 1.42539289
156 NA 1.34436259
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -3.32444584 3.69857236
[2,] -2.10549595 -3.32444584
[3,] -4.94255407 -2.10549595
[4,] -0.15704777 -4.94255407
[5,] -2.71772860 -0.15704777
[6,] 0.23637269 -2.71772860
[7,] 2.04475950 0.23637269
[8,] 3.07740400 2.04475950
[9,] -3.62863755 3.07740400
[10,] 3.62186901 -3.62863755
[11,] -0.33818303 3.62186901
[12,] 3.97447512 -0.33818303
[13,] 3.69748453 3.97447512
[14,] -4.46168329 3.69748453
[15,] 3.26853420 -4.46168329
[16,] 0.04992961 3.26853420
[17,] 1.35470282 0.04992961
[18,] -1.88009425 1.35470282
[19,] 0.84866678 -1.88009425
[20,] -2.14402451 0.84866678
[21,] -0.43525966 -2.14402451
[22,] 4.79459823 -0.43525966
[23,] -3.11957845 4.79459823
[24,] 2.22980651 -3.11957845
[25,] 2.96659018 2.22980651
[26,] 2.89341622 2.96659018
[27,] 1.73142447 2.89341622
[28,] 1.13398824 1.73142447
[29,] -4.47504659 1.13398824
[30,] -1.84884580 -4.47504659
[31,] 1.19233718 -1.84884580
[32,] 0.02493911 1.19233718
[33,] -2.55515536 0.02493911
[34,] 2.04475950 -2.55515536
[35,] 1.84615005 2.04475950
[36,] -2.52931323 1.84615005
[37,] -1.83796113 -2.52931323
[38,] 1.54583302 -1.83796113
[39,] 0.90895517 1.54583302
[40,] 0.22980651 0.90895517
[41,] -5.83065242 0.22980651
[42,] 1.21531832 -5.83065242
[43,] 1.09311349 1.21531832
[44,] -3.41026917 1.09311349
[45,] -1.55569979 -3.41026917
[46,] 1.39523228 -1.55569979
[47,] -1.93596456 1.39523228
[48,] 1.76780597 -1.93596456
[49,] 2.81490160 1.76780597
[50,] -6.21774291 2.81490160
[51,] 5.65379432 -6.21774291
[52,] 0.40788164 5.65379432
[53,] -1.10247289 0.40788164
[54,] 0.97141500 -1.10247289
[55,] 2.60346803 0.97141500
[56,] 1.78460329 2.60346803
[57,] 1.43430527 1.78460329
[58,] 1.62914066 1.43430527
[59,] -0.10478202 1.62914066
[60,] 0.22283463 -0.10478202
[61,] 2.18590870 0.22283463
[62,] 6.28122063 2.18590870
[63,] -0.15384995 6.28122063
[64,] -4.10869377 -0.15384995
[65,] 0.89932887 -4.10869377
[66,] 3.66181697 0.89932887
[67,] -4.44488597 3.66181697
[68,] -0.15830614 -4.44488597
[69,] -0.31353783 -0.15830614
[70,] 1.43913009 -0.31353783
[71,] 1.28744151 1.43913009
[72,] -0.27609184 1.28744151
[73,] 0.89093759 -0.27609184
[74,] -0.13814046 0.89093759
[75,] 3.00603180 -0.13814046
[76,] 3.01531281 3.00603180
[77,] 1.38720964 3.01531281
[78,] -3.69882129 1.38720964
[79,] -0.45185785 -3.69882129
[80,] -1.44668773 -0.45185785
[81,] 0.06496224 -1.44668773
[82,] -0.64529718 0.06496224
[83,] 0.57527971 -0.64529718
[84,] -5.10584125 0.57527971
[85,] 0.34579045 -5.10584125
[86,] -0.75965412 0.34579045
[87,] -1.22022153 -0.75965412
[88,] -1.49289467 -1.22022153
[89,] -0.68311180 -1.49289467
[90,] -3.64529718 -0.68311180
[91,] 1.17482593 -3.64529718
[92,] 0.98104130 1.17482593
[93,] 2.69752160 0.98104130
[94,] -0.12885945 2.69752160
[95,] -1.34335315 -0.12885945
[96,] -6.80194827 -1.34335315
[97,] -0.55784685 -6.80194827
[98,] 2.23997725 -0.55784685
[99,] -1.38208085 2.23997725
[100,] 1.90895517 -1.38208085
[101,] 0.24871382 1.90895517
[102,] 3.03561618 0.24871382
[103,] -4.74146074 3.03561618
[104,] -1.55213230 -4.74146074
[105,] -4.84016963 -1.55213230
[106,] 2.03476456 -4.84016963
[107,] 0.28333062 2.03476456
[108,] 1.15520469 0.28333062
[109,] -0.99824858 1.15520469
[110,] 0.65182203 -0.99824858
[111,] 2.04816492 0.65182203
[112,] -4.60585555 2.04816492
[113,] -0.30553853 -4.60585555
[114,] -2.63084605 -0.30553853
[115,] 0.11382257 -2.63084605
[116,] 0.18590870 0.11382257
[117,] -4.40887310 0.18590870
[118,] 1.96213399 -4.40887310
[119,] 0.76443761 1.96213399
[120,] 1.34507652 0.76443761
[121,] 4.09491525 1.34507652
[122,] 0.09311349 4.09491525
[123,] 2.42233277 0.09311349
[124,] 1.18590870 2.42233277
[125,] -5.59211836 1.18590870
[126,] -1.68848106 -5.59211836
[127,] 3.00603180 -1.68848106
[128,] -1.49235023 3.00603180
[129,] 0.57068583 -1.49235023
[130,] -1.68848106 0.57068583
[131,] -1.23039227 -1.68848106
[132,] -2.68171574 -1.23039227
[133,] -1.84533975 -2.68171574
[134,] -0.42597866 -1.84533975
[135,] -1.65492348 -0.42597866
[136,] 1.89004786 -1.65492348
[137,] 5.22283463 1.89004786
[138,] -0.24610176 5.22283463
[139,] 2.26370938 -0.24610176
[140,] 5.27299039 2.26370938
[141,] 1.35024664 5.27299039
[142,] 1.37772103 1.35024664
[143,] 2.62706247 1.37772103
[144,] -0.65492348 2.62706247
[145,] -7.14565677 -0.65492348
[146,] -2.03966777 -7.14565677
[147,] 3.46317045 -2.03966777
[148,] 2.50193521 3.46317045
[149,] -3.42080854 2.50193521
[150,] -1.12368934 -3.42080854
[151,] -0.01895870 -1.12368934
[152,] -0.29499915 -0.01895870
[153,] -1.44971079 -0.29499915
[154,] 1.42539289 -1.44971079
[155,] 1.34436259 1.42539289
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -3.32444584 3.69857236
2 -2.10549595 -3.32444584
3 -4.94255407 -2.10549595
4 -0.15704777 -4.94255407
5 -2.71772860 -0.15704777
6 0.23637269 -2.71772860
7 2.04475950 0.23637269
8 3.07740400 2.04475950
9 -3.62863755 3.07740400
10 3.62186901 -3.62863755
11 -0.33818303 3.62186901
12 3.97447512 -0.33818303
13 3.69748453 3.97447512
14 -4.46168329 3.69748453
15 3.26853420 -4.46168329
16 0.04992961 3.26853420
17 1.35470282 0.04992961
18 -1.88009425 1.35470282
19 0.84866678 -1.88009425
20 -2.14402451 0.84866678
21 -0.43525966 -2.14402451
22 4.79459823 -0.43525966
23 -3.11957845 4.79459823
24 2.22980651 -3.11957845
25 2.96659018 2.22980651
26 2.89341622 2.96659018
27 1.73142447 2.89341622
28 1.13398824 1.73142447
29 -4.47504659 1.13398824
30 -1.84884580 -4.47504659
31 1.19233718 -1.84884580
32 0.02493911 1.19233718
33 -2.55515536 0.02493911
34 2.04475950 -2.55515536
35 1.84615005 2.04475950
36 -2.52931323 1.84615005
37 -1.83796113 -2.52931323
38 1.54583302 -1.83796113
39 0.90895517 1.54583302
40 0.22980651 0.90895517
41 -5.83065242 0.22980651
42 1.21531832 -5.83065242
43 1.09311349 1.21531832
44 -3.41026917 1.09311349
45 -1.55569979 -3.41026917
46 1.39523228 -1.55569979
47 -1.93596456 1.39523228
48 1.76780597 -1.93596456
49 2.81490160 1.76780597
50 -6.21774291 2.81490160
51 5.65379432 -6.21774291
52 0.40788164 5.65379432
53 -1.10247289 0.40788164
54 0.97141500 -1.10247289
55 2.60346803 0.97141500
56 1.78460329 2.60346803
57 1.43430527 1.78460329
58 1.62914066 1.43430527
59 -0.10478202 1.62914066
60 0.22283463 -0.10478202
61 2.18590870 0.22283463
62 6.28122063 2.18590870
63 -0.15384995 6.28122063
64 -4.10869377 -0.15384995
65 0.89932887 -4.10869377
66 3.66181697 0.89932887
67 -4.44488597 3.66181697
68 -0.15830614 -4.44488597
69 -0.31353783 -0.15830614
70 1.43913009 -0.31353783
71 1.28744151 1.43913009
72 -0.27609184 1.28744151
73 0.89093759 -0.27609184
74 -0.13814046 0.89093759
75 3.00603180 -0.13814046
76 3.01531281 3.00603180
77 1.38720964 3.01531281
78 -3.69882129 1.38720964
79 -0.45185785 -3.69882129
80 -1.44668773 -0.45185785
81 0.06496224 -1.44668773
82 -0.64529718 0.06496224
83 0.57527971 -0.64529718
84 -5.10584125 0.57527971
85 0.34579045 -5.10584125
86 -0.75965412 0.34579045
87 -1.22022153 -0.75965412
88 -1.49289467 -1.22022153
89 -0.68311180 -1.49289467
90 -3.64529718 -0.68311180
91 1.17482593 -3.64529718
92 0.98104130 1.17482593
93 2.69752160 0.98104130
94 -0.12885945 2.69752160
95 -1.34335315 -0.12885945
96 -6.80194827 -1.34335315
97 -0.55784685 -6.80194827
98 2.23997725 -0.55784685
99 -1.38208085 2.23997725
100 1.90895517 -1.38208085
101 0.24871382 1.90895517
102 3.03561618 0.24871382
103 -4.74146074 3.03561618
104 -1.55213230 -4.74146074
105 -4.84016963 -1.55213230
106 2.03476456 -4.84016963
107 0.28333062 2.03476456
108 1.15520469 0.28333062
109 -0.99824858 1.15520469
110 0.65182203 -0.99824858
111 2.04816492 0.65182203
112 -4.60585555 2.04816492
113 -0.30553853 -4.60585555
114 -2.63084605 -0.30553853
115 0.11382257 -2.63084605
116 0.18590870 0.11382257
117 -4.40887310 0.18590870
118 1.96213399 -4.40887310
119 0.76443761 1.96213399
120 1.34507652 0.76443761
121 4.09491525 1.34507652
122 0.09311349 4.09491525
123 2.42233277 0.09311349
124 1.18590870 2.42233277
125 -5.59211836 1.18590870
126 -1.68848106 -5.59211836
127 3.00603180 -1.68848106
128 -1.49235023 3.00603180
129 0.57068583 -1.49235023
130 -1.68848106 0.57068583
131 -1.23039227 -1.68848106
132 -2.68171574 -1.23039227
133 -1.84533975 -2.68171574
134 -0.42597866 -1.84533975
135 -1.65492348 -0.42597866
136 1.89004786 -1.65492348
137 5.22283463 1.89004786
138 -0.24610176 5.22283463
139 2.26370938 -0.24610176
140 5.27299039 2.26370938
141 1.35024664 5.27299039
142 1.37772103 1.35024664
143 2.62706247 1.37772103
144 -0.65492348 2.62706247
145 -7.14565677 -0.65492348
146 -2.03966777 -7.14565677
147 3.46317045 -2.03966777
148 2.50193521 3.46317045
149 -3.42080854 2.50193521
150 -1.12368934 -3.42080854
151 -0.01895870 -1.12368934
152 -0.29499915 -0.01895870
153 -1.44971079 -0.29499915
154 1.42539289 -1.44971079
155 1.34436259 1.42539289
> 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/wessaorg/rcomp/tmp/779o61386625704.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/wessaorg/rcomp/tmp/8cdjl1386625704.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/wessaorg/rcomp/tmp/9k2pi1386625704.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/wessaorg/rcomp/tmp/109l4y1386625704.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/11810a1386625704.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/wessaorg/rcomp/tmp/12k7zw1386625704.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/wessaorg/rcomp/tmp/1333sc1386625704.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/wessaorg/rcomp/tmp/14mls41386625704.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/wessaorg/rcomp/tmp/156c171386625704.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/wessaorg/rcomp/tmp/16s7tj1386625704.tab")
+ }
>
> try(system("convert tmp/1pe8y1386625704.ps tmp/1pe8y1386625704.png",intern=TRUE))
character(0)
> try(system("convert tmp/2zbqh1386625704.ps tmp/2zbqh1386625704.png",intern=TRUE))
character(0)
> try(system("convert tmp/31nqp1386625704.ps tmp/31nqp1386625704.png",intern=TRUE))
character(0)
> try(system("convert tmp/4bu6k1386625704.ps tmp/4bu6k1386625704.png",intern=TRUE))
character(0)
> try(system("convert tmp/5pdxg1386625704.ps tmp/5pdxg1386625704.png",intern=TRUE))
character(0)
> try(system("convert tmp/6wins1386625704.ps tmp/6wins1386625704.png",intern=TRUE))
character(0)
> try(system("convert tmp/779o61386625704.ps tmp/779o61386625704.png",intern=TRUE))
character(0)
> try(system("convert tmp/8cdjl1386625704.ps tmp/8cdjl1386625704.png",intern=TRUE))
character(0)
> try(system("convert tmp/9k2pi1386625704.ps tmp/9k2pi1386625704.png",intern=TRUE))
character(0)
> try(system("convert tmp/109l4y1386625704.ps tmp/109l4y1386625704.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
11.485 2.147 13.638