R version 2.8.0 (2008-10-20)
Copyright (C) 2008 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.
Natural language support but running in an English locale
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(5
+ ,1
+ ,1
+ ,1
+ ,2
+ ,1
+ ,21
+ ,4
+ ,1
+ ,4
+ ,1
+ ,4
+ ,1
+ ,21
+ ,7
+ ,1
+ ,5
+ ,2
+ ,4
+ ,1
+ ,24
+ ,7
+ ,2
+ ,2
+ ,1
+ ,4
+ ,2
+ ,21
+ ,5
+ ,1
+ ,1
+ ,1
+ ,3
+ ,2
+ ,21
+ ,5
+ ,1
+ ,1
+ ,1
+ ,2
+ ,2
+ ,22
+ ,4
+ ,1
+ ,2
+ ,1
+ ,3
+ ,2
+ ,22
+ ,4
+ ,2
+ ,1
+ ,1
+ ,4
+ ,1
+ ,20
+ ,6
+ ,2
+ ,1
+ ,1
+ ,2
+ ,1
+ ,21
+ ,5
+ ,2
+ ,1
+ ,1
+ ,3
+ ,0
+ ,21
+ ,1
+ ,2
+ ,3
+ ,2
+ ,3
+ ,2
+ ,21
+ ,5
+ ,1
+ ,1
+ ,1
+ ,3
+ ,1
+ ,22
+ ,4
+ ,2
+ ,1
+ ,1
+ ,4
+ ,1
+ ,22
+ ,6
+ ,1
+ ,1
+ ,1
+ ,3
+ ,1
+ ,23
+ ,7
+ ,1
+ ,2
+ ,1
+ ,2
+ ,1
+ ,23
+ ,7
+ ,1
+ ,4
+ ,2
+ ,5
+ ,2
+ ,21
+ ,2
+ ,2
+ ,1
+ ,1
+ ,2
+ ,2
+ ,24
+ ,6
+ ,2
+ ,1
+ ,1
+ ,3
+ ,1
+ ,23
+ ,4
+ ,2
+ ,1
+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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 = '3'
> #'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
roken algemene_tevredenheid meer_sport drugs drankgebruik geslacht leeftijd
1 1 5 1 1 2 1 21
2 4 4 1 1 4 1 21
3 5 7 1 2 4 1 24
4 2 7 2 1 4 2 21
5 1 5 1 1 3 2 21
6 1 5 1 1 2 2 22
7 2 4 1 1 3 2 22
8 1 4 2 1 4 1 20
9 1 6 2 1 2 1 21
10 1 5 2 1 3 0 21
11 3 1 2 2 3 2 21
12 1 5 1 1 3 1 22
13 1 4 2 1 4 1 22
14 1 6 1 1 3 1 23
15 2 7 1 1 2 1 23
16 4 7 1 2 5 2 21
17 1 2 2 1 2 2 24
18 1 6 2 1 3 1 23
19 1 4 2 1 3 2 21
20 2 3 1 1 3 1 23
21 3 6 1 1 3 2 32
22 1 6 1 1 4 1 21
23 1 5 2 2 3 2 21
24 1 4 2 1 1 2 21
25 1 6 1 2 3 1 21
26 1 4 2 1 2 2 21
27 2 3 2 4 4 1 20
28 1 4 2 1 4 1 24
29 1 5 1 1 4 1 22
30 1 6 1 1 1 2 22
31 1 6 2 1 3 2 21
32 1 4 2 1 1 2 21
33 1 6 1 1 4 1 21
34 1 6 2 1 2 2 21
35 1 5 2 1 3 1 23
36 1 6 2 1 3 1 23
37 1 4 1 1 2 2 21
38 1 6 2 1 4 1 20
39 1 7 1 1 1 2 21
40 1 5 2 1 2 1 20
41 1 6 2 1 3 2 21
42 1 6 1 1 3 1 22
43 4 5 2 1 5 2 21
44 1 7 2 1 3 1 22
45 1 6 2 1 4 1 22
46 4 3 1 3 3 2 22
47 2 4 1 2 4 1 22
48 2 5 1 1 2 1 21
49 1 4 1 1 3 1 21
50 1 3 2 1 2 2 21
51 2 5 1 2 3 1 23
52 1 5 1 1 2 2 23
53 1 4 2 1 3 2 23
54 1 5 2 1 4 1 22
55 1 1 2 1 1 1 24
56 1 2 2 1 1 1 23
57 1 3 2 1 1 2 21
58 2 4 2 1 4 1 22
59 1 3 2 1 2 2 22
60 1 7 2 1 2 2 21
61 1 2 2 1 3 1 21
62 2 4 1 2 5 1 21
63 1 2 2 1 3 2 21
64 2 5 1 1 3 1 20
65 4 6 1 1 3 2 22
66 1 6 2 1 3 2 22
67 1 6 2 1 3 1 22
68 1 6 2 1 4 1 22
69 2 6 1 1 4 1 21
70 3 6 1 2 4 1 23
71 1 6 2 1 3 2 21
72 1 4 2 1 4 1 22
73 1 4 1 1 1 2 23
74 1 5 1 1 3 1 21
75 1 6 2 1 3 1 24
76 1 6 2 1 3 1 24
77 1 7 2 1 5 2 20
78 4 4 1 1 4 2 21
79 1 6 2 1 3 1 22
80 1 6 1 1 5 1 20
81 2 6 2 1 4 1 21
82 1 3 2 1 4 1 21
83 1 5 1 1 4 1 21
84 1 6 1 2 4 1 22
85 1 4 2 1 3 2 22
86 1 5 2 1 3 1 22
87 1 6 1 1 4 1 21
88 1 6 1 1 3 1 22
89 1 3 2 1 1 2 21
90 2 6 1 3 4 1 21
91 1 5 1 1 4 1 21
92 1 6 2 1 3 2 22
93 1 4 2 1 3 2 22
94 1 7 1 2 2 2 22
95 1 5 2 1 4 1 22
96 2 6 1 1 1 1 21
97 1 6 1 1 3 2 21
98 5 6 2 1 5 1 20
99 1 7 2 1 4 1 21
100 1 6 2 1 4 1 21
101 1 6 2 1 3 2 23
102 2 6 2 1 4 1 23
103 1 6 1 2 4 1 22
104 3 2 2 3 4 1 25
105 1 4 2 1 3 2 21
106 1 4 2 1 3 2 21
107 1 6 2 1 3 1 22
108 3 5 2 1 5 1 21
109 1 6 2 1 4 1 22
110 1 6 1 1 3 1 21
111 1 2 1 1 1 2 22
112 1 7 1 1 4 1 21
113 1 1 2 1 3 2 21
114 1 4 1 1 2 1 23
115 2 1 2 1 4 2 22
116 2 6 2 1 4 1 0
117 4 6 2 1 5 1 23
118 4 6 1 3 4 1 22
119 1 7 1 1 4 1 20
120 1 6 2 1 3 1 25
121 1 4 2 1 4 1 0
122 1 4 2 1 4 1 22
123 4 6 2 3 4 1 22
124 1 5 2 2 5 1 22
125 1 7 1 1 3 1 22
126 1 4 2 1 4 2 0
127 1 4 2 1 4 1 21
128 3 6 2 1 3 2 23
129 1 7 2 1 3 2 21
130 1 5 2 2 4 2 21
131 1 6 2 3 4 2 20
132 4 6 2 1 4 2 21
133 4 6 1 1 5 1 24
134 1 5 2 1 4 1 23
135 2 7 2 3 4 1 22
136 1 4 2 1 1 2 21
137 2 6 2 2 4 1 22
138 1 6 2 1 4 1 21
139 3 7 1 1 4 1 21
140 2 6 1 1 4 2 21
141 2 6 2 1 4 1 22
142 1 5 2 1 4 1 20
143 1 5 2 1 3 2 21
144 2 5 2 1 3 2 21
145 1 6 2 1 4 1 22
146 2 6 1 3 4 1 21
147 2 7 2 2 5 1 23
148 1 4 2 1 1 2 23
149 1 6 2 1 4 2 24
150 2 6 2 1 3 2 32
151 1 7 1 1 4 1 22
152 2 6 2 1 4 1 22
153 1 7 2 2 4 1 20
154 1 4 2 1 3 1 21
155 1 6 1 1 4 1 23
156 1 4 2 1 3 2 21
157 1 4 2 1 4 2 21
158 1 7 1 1 4 1 23
159 1 4 2 2 4 1 24
160 1 7 2 1 4 1 22
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) algemene_tevredenheid meer_sport
-0.47185 -0.03049 -0.40146
drugs drankgebruik geslacht
0.38520 0.37012 0.35130
leeftijd
0.02898
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.4605 -0.4578 -0.2161 0.3249 3.2910
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.47185 0.67887 -0.695 0.48808
algemene_tevredenheid -0.03049 0.05064 -0.602 0.54803
meer_sport -0.40146 0.14400 -2.788 0.00598 **
drugs 0.38520 0.12337 3.122 0.00215 **
drankgebruik 0.37012 0.07694 4.810 3.58e-06 ***
geslacht 0.35130 0.14714 2.387 0.01818 *
leeftijd 0.02898 0.02012 1.440 0.15183
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.838 on 153 degrees of freedom
Multiple R-squared: 0.2537, Adjusted R-squared: 0.2245
F-statistic: 8.669 on 6 and 153 DF, p-value: 3.998e-08
> 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.68930008 0.62139985 0.310699925
[2,] 0.72683677 0.54632647 0.273163235
[3,] 0.76541816 0.46916367 0.234581835
[4,] 0.69990235 0.60019530 0.300097651
[5,] 0.64161124 0.71677751 0.358388755
[6,] 0.65872265 0.68255470 0.341277349
[7,] 0.73324843 0.53350314 0.266751568
[8,] 0.65550694 0.68898611 0.344493057
[9,] 0.57624347 0.84751306 0.423756529
[10,] 0.49032264 0.98064528 0.509677362
[11,] 0.40773756 0.81547513 0.592262436
[12,] 0.34030613 0.68061226 0.659693868
[13,] 0.39075035 0.78150069 0.609249655
[14,] 0.59856578 0.80286845 0.401434225
[15,] 0.62881469 0.74237062 0.371185312
[16,] 0.80156402 0.39687195 0.198435977
[17,] 0.75749863 0.48500274 0.242501369
[18,] 0.81505467 0.36989066 0.184945331
[19,] 0.80842345 0.38315311 0.191576555
[20,] 0.82593273 0.34813453 0.174067267
[21,] 0.78233833 0.43532335 0.217661674
[22,] 0.73750311 0.52499379 0.262496894
[23,] 0.70690891 0.58618217 0.293091087
[24,] 0.69939432 0.60121136 0.300605679
[25,] 0.64566732 0.70866535 0.354332675
[26,] 0.58994039 0.82011923 0.410059613
[27,] 0.53253900 0.93492200 0.467461001
[28,] 0.48597467 0.97194935 0.514025327
[29,] 0.43105847 0.86211694 0.568941531
[30,] 0.37516659 0.75033318 0.624833411
[31,] 0.34568006 0.69136012 0.654319941
[32,] 0.29949035 0.59898071 0.700509645
[33,] 0.26880588 0.53761177 0.731194116
[34,] 0.46940276 0.93880551 0.530597244
[35,] 0.41563438 0.83126876 0.584365620
[36,] 0.38105973 0.76211945 0.618940274
[37,] 0.41864573 0.83729147 0.581354267
[38,] 0.38363302 0.76726605 0.616366976
[39,] 0.41114395 0.82228789 0.588856054
[40,] 0.37259045 0.74518090 0.627409549
[41,] 0.32430070 0.64860140 0.675699299
[42,] 0.28199396 0.56398793 0.718006037
[43,] 0.26046248 0.52092497 0.739537516
[44,] 0.23767400 0.47534801 0.762325997
[45,] 0.20975023 0.41950046 0.790249770
[46,] 0.18832611 0.37665223 0.811673885
[47,] 0.16978721 0.33957443 0.830212786
[48,] 0.14503768 0.29007536 0.854962319
[49,] 0.12894476 0.25788951 0.871055243
[50,] 0.10510519 0.21021038 0.894894811
[51,] 0.08445244 0.16890487 0.915547564
[52,] 0.06686516 0.13373031 0.933134843
[53,] 0.06127171 0.12254342 0.938728288
[54,] 0.05072458 0.10144915 0.949275423
[55,] 0.04799256 0.09598512 0.952007440
[56,] 0.17622623 0.35245246 0.823773770
[57,] 0.15390809 0.30781617 0.846091915
[58,] 0.12712232 0.25424464 0.872877682
[59,] 0.10908852 0.21817703 0.890911483
[60,] 0.09027985 0.18055969 0.909720153
[61,] 0.08517588 0.17035176 0.914824122
[62,] 0.07040528 0.14081055 0.929594724
[63,] 0.05961969 0.11923938 0.940380312
[64,] 0.04908668 0.09817336 0.950913319
[65,] 0.04038521 0.08077042 0.959614791
[66,] 0.03154449 0.06308899 0.968455507
[67,] 0.02435171 0.04870342 0.975648291
[68,] 0.02650909 0.05301819 0.973490906
[69,] 0.08221796 0.16443593 0.917782037
[70,] 0.06653474 0.13306947 0.933465264
[71,] 0.07311714 0.14623428 0.926882858
[72,] 0.06870099 0.13740198 0.931299012
[73,] 0.05755829 0.11511658 0.942441710
[74,] 0.05398862 0.10797724 0.946011380
[75,] 0.07000163 0.14000326 0.929998369
[76,] 0.05900772 0.11801545 0.940992276
[77,] 0.04680749 0.09361499 0.953192506
[78,] 0.04285073 0.08570147 0.957149266
[79,] 0.03513661 0.07027322 0.964863388
[80,] 0.02836291 0.05672583 0.971637085
[81,] 0.02409991 0.04819982 0.975900090
[82,] 0.02219464 0.04438928 0.977805360
[83,] 0.01756520 0.03513039 0.982434805
[84,] 0.01406169 0.02812338 0.985938310
[85,] 0.01325177 0.02650353 0.986748233
[86,] 0.01071034 0.02142069 0.989289656
[87,] 0.01990330 0.03980659 0.980096704
[88,] 0.01736917 0.03473834 0.982630829
[89,] 0.32715913 0.65431825 0.672840875
[90,] 0.29314765 0.58629531 0.706852346
[91,] 0.26197354 0.52394708 0.738026461
[92,] 0.23268102 0.46536203 0.767318984
[93,] 0.20868218 0.41736435 0.791317823
[94,] 0.23362438 0.46724876 0.766375621
[95,] 0.22325680 0.44651359 0.776743203
[96,] 0.19368876 0.38737751 0.806311243
[97,] 0.16670630 0.33341259 0.833293704
[98,] 0.13768651 0.27537302 0.862313490
[99,] 0.16819172 0.33638344 0.831808280
[100,] 0.14569374 0.29138749 0.854306256
[101,] 0.12304786 0.24609572 0.876952138
[102,] 0.10050482 0.20100963 0.899495185
[103,] 0.09565925 0.19131849 0.904340754
[104,] 0.07827057 0.15654114 0.921729428
[105,] 0.06139372 0.12278744 0.938606280
[106,] 0.05167091 0.10334181 0.948329094
[107,] 0.06471251 0.12942502 0.935287488
[108,] 0.21677875 0.43355750 0.783221251
[109,] 0.32556612 0.65113225 0.674433876
[110,] 0.31321564 0.62643128 0.686784359
[111,] 0.26940556 0.53881112 0.730594439
[112,] 0.23364952 0.46729905 0.766350475
[113,] 0.19673017 0.39346034 0.803269830
[114,] 0.50950290 0.98099419 0.490497096
[115,] 0.50352279 0.99295441 0.496477206
[116,] 0.47258257 0.94516515 0.527417426
[117,] 0.42003234 0.84006469 0.579967657
[118,] 0.36540074 0.73080148 0.634599259
[119,] 0.48047002 0.96094004 0.519529978
[120,] 0.44265652 0.88531304 0.557343482
[121,] 0.43479831 0.86959661 0.565201693
[122,] 0.48069303 0.96138607 0.519306967
[123,] 0.85201079 0.29597843 0.147989213
[124,] 0.98857780 0.02284441 0.011422204
[125,] 0.98186071 0.03627857 0.018139287
[126,] 0.97118940 0.05762121 0.028810605
[127,] 0.95562556 0.08874887 0.044374436
[128,] 0.94450798 0.11098404 0.055492019
[129,] 0.92071574 0.15856853 0.079284263
[130,] 0.98752664 0.02494672 0.012473360
[131,] 0.98866532 0.02266936 0.011334680
[132,] 0.99226529 0.01546943 0.007734715
[133,] 0.98473525 0.03052951 0.015264753
[134,] 0.97264583 0.05470833 0.027354166
[135,] 0.98689726 0.02620549 0.013102744
[136,] 0.97344907 0.05310185 0.026550925
[137,] 0.98092305 0.03815390 0.019076948
[138,] 0.98585506 0.02828988 0.014144940
[139,] 0.96287062 0.07425875 0.037129376
[140,] 0.93423835 0.13152330 0.065761651
[141,] 0.85137863 0.29724274 0.148621372
> postscript(file="/var/www/html/freestat/rcomp/tmp/13k391291287622.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/2dbku1291287622.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/3dbku1291287622.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/4dbku1291287622.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/56k1x1291287622.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 = 160
Frequency = 1
1 2 3 4 5 6
-0.059529096 2.169740910 2.789072663 0.311362041 -0.780952330 -0.439808368
7 8 9 10 11 12
0.159583273 -0.399818861 0.372420185 0.323113424 1.113367927 -0.458628404
13 14 15 16 17 18
-0.457774207 -0.457119352 0.943489007 1.154582448 -0.187761331 -0.055656796
19 20 21 22 23 24
-0.409976498 0.451420474 0.930779992 -0.769285641 -0.764685175 0.330266772
25 26 27 28 29 30
-0.784359408 -0.039854863 -0.585891790 -0.515729553 -0.828750039 -0.039200008
31 32 33 34 35 36
-0.349003048 0.330266772 -0.769285641 0.021118586 -0.086143520 -0.055656796
37 38 39 40 41 42
-0.441317419 -0.338845412 0.020264389 0.370911134 -0.349003048 -0.428141679
43 44 45 46 47 48
1.880266957 0.003807602 -0.396800757 1.358705745 -0.244432165 0.940470904
49 50 51 52 53 54
-0.460137455 -0.070341587 0.127198522 -0.468786041 -0.467931844 -0.427287482
55 56 57 58 59 60
0.503175178 0.562639576 0.299780047 0.542225793 -0.099319260 0.051605311
61 62 63 64 65 66
-0.119648348 -0.585576127 -0.470949947 0.599326942 2.220556722 -0.377980721
67 68 69 70 71 72
-0.026679123 -0.396800757 0.230714359 0.787563611 -0.349003048 -0.457774207
73 74 75 76 77 78
-0.129151130 -0.429650731 -0.084634469 -0.084634469 -1.029781920 1.818439311
79 80 81 82 83 84
-0.026679123 -1.110429603 0.632176916 -0.459283258 -0.799772366 -1.183458716
85 86 87 88 89 90
-0.438954171 -0.057165847 -0.769285641 -0.428141679 0.299780047 -0.539676444
91 92 93 94 95 96
-0.799772366 -0.377980721 -0.438954171 -0.764030320 -0.427287482 1.341079263
97 98 99 100 101 102
-0.750465605 3.291032954 -0.337336360 -0.367823084 -0.406958394 0.574221570
103 104 105 106 107 108
-1.183458716 0.623928522 -0.409976498 -0.409976498 -0.026679123 1.231568556
109 110 111 112 113 114
-0.396800757 -0.399164006 -0.161146907 -0.738798916 -0.501436671 -0.147971167
115 116 117 118 119 120
0.099464021 1.240708048 2.204099935 1.431345883 -0.709821243 -0.113612142
121 122 123 124 125 126
0.179734599 -0.457774207 1.832808439 -1.182604519 -0.397654955 -0.171567000
127 128 129 130 131 132
-0.428796534 1.593041606 -0.318516324 -1.134806810 -1.460537814 2.280875317
133 134 135 136 137 138
1.773659705 -0.456265155 -0.136704836 0.330266772 0.218003841 -0.367823084
139 140 141 142 143 144
1.261201084 -0.120587240 0.603199243 -0.369332136 -0.379489773 0.620510227
145 146 147 148 149 150
-0.396800757 -0.539676444 -0.150608742 0.272311426 -0.806057702 0.332242549
151 152 153 154 155 156
-0.767776589 0.603199243 -0.693554089 -0.058674899 -0.827240987 -0.409976498
157 158 159 160
-0.780098132 -0.796754262 -0.900924954 -0.366314033
> postscript(file="/var/www/html/freestat/rcomp/tmp/66k1x1291287622.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 = 160
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.059529096 NA
1 2.169740910 -0.059529096
2 2.789072663 2.169740910
3 0.311362041 2.789072663
4 -0.780952330 0.311362041
5 -0.439808368 -0.780952330
6 0.159583273 -0.439808368
7 -0.399818861 0.159583273
8 0.372420185 -0.399818861
9 0.323113424 0.372420185
10 1.113367927 0.323113424
11 -0.458628404 1.113367927
12 -0.457774207 -0.458628404
13 -0.457119352 -0.457774207
14 0.943489007 -0.457119352
15 1.154582448 0.943489007
16 -0.187761331 1.154582448
17 -0.055656796 -0.187761331
18 -0.409976498 -0.055656796
19 0.451420474 -0.409976498
20 0.930779992 0.451420474
21 -0.769285641 0.930779992
22 -0.764685175 -0.769285641
23 0.330266772 -0.764685175
24 -0.784359408 0.330266772
25 -0.039854863 -0.784359408
26 -0.585891790 -0.039854863
27 -0.515729553 -0.585891790
28 -0.828750039 -0.515729553
29 -0.039200008 -0.828750039
30 -0.349003048 -0.039200008
31 0.330266772 -0.349003048
32 -0.769285641 0.330266772
33 0.021118586 -0.769285641
34 -0.086143520 0.021118586
35 -0.055656796 -0.086143520
36 -0.441317419 -0.055656796
37 -0.338845412 -0.441317419
38 0.020264389 -0.338845412
39 0.370911134 0.020264389
40 -0.349003048 0.370911134
41 -0.428141679 -0.349003048
42 1.880266957 -0.428141679
43 0.003807602 1.880266957
44 -0.396800757 0.003807602
45 1.358705745 -0.396800757
46 -0.244432165 1.358705745
47 0.940470904 -0.244432165
48 -0.460137455 0.940470904
49 -0.070341587 -0.460137455
50 0.127198522 -0.070341587
51 -0.468786041 0.127198522
52 -0.467931844 -0.468786041
53 -0.427287482 -0.467931844
54 0.503175178 -0.427287482
55 0.562639576 0.503175178
56 0.299780047 0.562639576
57 0.542225793 0.299780047
58 -0.099319260 0.542225793
59 0.051605311 -0.099319260
60 -0.119648348 0.051605311
61 -0.585576127 -0.119648348
62 -0.470949947 -0.585576127
63 0.599326942 -0.470949947
64 2.220556722 0.599326942
65 -0.377980721 2.220556722
66 -0.026679123 -0.377980721
67 -0.396800757 -0.026679123
68 0.230714359 -0.396800757
69 0.787563611 0.230714359
70 -0.349003048 0.787563611
71 -0.457774207 -0.349003048
72 -0.129151130 -0.457774207
73 -0.429650731 -0.129151130
74 -0.084634469 -0.429650731
75 -0.084634469 -0.084634469
76 -1.029781920 -0.084634469
77 1.818439311 -1.029781920
78 -0.026679123 1.818439311
79 -1.110429603 -0.026679123
80 0.632176916 -1.110429603
81 -0.459283258 0.632176916
82 -0.799772366 -0.459283258
83 -1.183458716 -0.799772366
84 -0.438954171 -1.183458716
85 -0.057165847 -0.438954171
86 -0.769285641 -0.057165847
87 -0.428141679 -0.769285641
88 0.299780047 -0.428141679
89 -0.539676444 0.299780047
90 -0.799772366 -0.539676444
91 -0.377980721 -0.799772366
92 -0.438954171 -0.377980721
93 -0.764030320 -0.438954171
94 -0.427287482 -0.764030320
95 1.341079263 -0.427287482
96 -0.750465605 1.341079263
97 3.291032954 -0.750465605
98 -0.337336360 3.291032954
99 -0.367823084 -0.337336360
100 -0.406958394 -0.367823084
101 0.574221570 -0.406958394
102 -1.183458716 0.574221570
103 0.623928522 -1.183458716
104 -0.409976498 0.623928522
105 -0.409976498 -0.409976498
106 -0.026679123 -0.409976498
107 1.231568556 -0.026679123
108 -0.396800757 1.231568556
109 -0.399164006 -0.396800757
110 -0.161146907 -0.399164006
111 -0.738798916 -0.161146907
112 -0.501436671 -0.738798916
113 -0.147971167 -0.501436671
114 0.099464021 -0.147971167
115 1.240708048 0.099464021
116 2.204099935 1.240708048
117 1.431345883 2.204099935
118 -0.709821243 1.431345883
119 -0.113612142 -0.709821243
120 0.179734599 -0.113612142
121 -0.457774207 0.179734599
122 1.832808439 -0.457774207
123 -1.182604519 1.832808439
124 -0.397654955 -1.182604519
125 -0.171567000 -0.397654955
126 -0.428796534 -0.171567000
127 1.593041606 -0.428796534
128 -0.318516324 1.593041606
129 -1.134806810 -0.318516324
130 -1.460537814 -1.134806810
131 2.280875317 -1.460537814
132 1.773659705 2.280875317
133 -0.456265155 1.773659705
134 -0.136704836 -0.456265155
135 0.330266772 -0.136704836
136 0.218003841 0.330266772
137 -0.367823084 0.218003841
138 1.261201084 -0.367823084
139 -0.120587240 1.261201084
140 0.603199243 -0.120587240
141 -0.369332136 0.603199243
142 -0.379489773 -0.369332136
143 0.620510227 -0.379489773
144 -0.396800757 0.620510227
145 -0.539676444 -0.396800757
146 -0.150608742 -0.539676444
147 0.272311426 -0.150608742
148 -0.806057702 0.272311426
149 0.332242549 -0.806057702
150 -0.767776589 0.332242549
151 0.603199243 -0.767776589
152 -0.693554089 0.603199243
153 -0.058674899 -0.693554089
154 -0.827240987 -0.058674899
155 -0.409976498 -0.827240987
156 -0.780098132 -0.409976498
157 -0.796754262 -0.780098132
158 -0.900924954 -0.796754262
159 -0.366314033 -0.900924954
160 NA -0.366314033
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.169740910 -0.059529096
[2,] 2.789072663 2.169740910
[3,] 0.311362041 2.789072663
[4,] -0.780952330 0.311362041
[5,] -0.439808368 -0.780952330
[6,] 0.159583273 -0.439808368
[7,] -0.399818861 0.159583273
[8,] 0.372420185 -0.399818861
[9,] 0.323113424 0.372420185
[10,] 1.113367927 0.323113424
[11,] -0.458628404 1.113367927
[12,] -0.457774207 -0.458628404
[13,] -0.457119352 -0.457774207
[14,] 0.943489007 -0.457119352
[15,] 1.154582448 0.943489007
[16,] -0.187761331 1.154582448
[17,] -0.055656796 -0.187761331
[18,] -0.409976498 -0.055656796
[19,] 0.451420474 -0.409976498
[20,] 0.930779992 0.451420474
[21,] -0.769285641 0.930779992
[22,] -0.764685175 -0.769285641
[23,] 0.330266772 -0.764685175
[24,] -0.784359408 0.330266772
[25,] -0.039854863 -0.784359408
[26,] -0.585891790 -0.039854863
[27,] -0.515729553 -0.585891790
[28,] -0.828750039 -0.515729553
[29,] -0.039200008 -0.828750039
[30,] -0.349003048 -0.039200008
[31,] 0.330266772 -0.349003048
[32,] -0.769285641 0.330266772
[33,] 0.021118586 -0.769285641
[34,] -0.086143520 0.021118586
[35,] -0.055656796 -0.086143520
[36,] -0.441317419 -0.055656796
[37,] -0.338845412 -0.441317419
[38,] 0.020264389 -0.338845412
[39,] 0.370911134 0.020264389
[40,] -0.349003048 0.370911134
[41,] -0.428141679 -0.349003048
[42,] 1.880266957 -0.428141679
[43,] 0.003807602 1.880266957
[44,] -0.396800757 0.003807602
[45,] 1.358705745 -0.396800757
[46,] -0.244432165 1.358705745
[47,] 0.940470904 -0.244432165
[48,] -0.460137455 0.940470904
[49,] -0.070341587 -0.460137455
[50,] 0.127198522 -0.070341587
[51,] -0.468786041 0.127198522
[52,] -0.467931844 -0.468786041
[53,] -0.427287482 -0.467931844
[54,] 0.503175178 -0.427287482
[55,] 0.562639576 0.503175178
[56,] 0.299780047 0.562639576
[57,] 0.542225793 0.299780047
[58,] -0.099319260 0.542225793
[59,] 0.051605311 -0.099319260
[60,] -0.119648348 0.051605311
[61,] -0.585576127 -0.119648348
[62,] -0.470949947 -0.585576127
[63,] 0.599326942 -0.470949947
[64,] 2.220556722 0.599326942
[65,] -0.377980721 2.220556722
[66,] -0.026679123 -0.377980721
[67,] -0.396800757 -0.026679123
[68,] 0.230714359 -0.396800757
[69,] 0.787563611 0.230714359
[70,] -0.349003048 0.787563611
[71,] -0.457774207 -0.349003048
[72,] -0.129151130 -0.457774207
[73,] -0.429650731 -0.129151130
[74,] -0.084634469 -0.429650731
[75,] -0.084634469 -0.084634469
[76,] -1.029781920 -0.084634469
[77,] 1.818439311 -1.029781920
[78,] -0.026679123 1.818439311
[79,] -1.110429603 -0.026679123
[80,] 0.632176916 -1.110429603
[81,] -0.459283258 0.632176916
[82,] -0.799772366 -0.459283258
[83,] -1.183458716 -0.799772366
[84,] -0.438954171 -1.183458716
[85,] -0.057165847 -0.438954171
[86,] -0.769285641 -0.057165847
[87,] -0.428141679 -0.769285641
[88,] 0.299780047 -0.428141679
[89,] -0.539676444 0.299780047
[90,] -0.799772366 -0.539676444
[91,] -0.377980721 -0.799772366
[92,] -0.438954171 -0.377980721
[93,] -0.764030320 -0.438954171
[94,] -0.427287482 -0.764030320
[95,] 1.341079263 -0.427287482
[96,] -0.750465605 1.341079263
[97,] 3.291032954 -0.750465605
[98,] -0.337336360 3.291032954
[99,] -0.367823084 -0.337336360
[100,] -0.406958394 -0.367823084
[101,] 0.574221570 -0.406958394
[102,] -1.183458716 0.574221570
[103,] 0.623928522 -1.183458716
[104,] -0.409976498 0.623928522
[105,] -0.409976498 -0.409976498
[106,] -0.026679123 -0.409976498
[107,] 1.231568556 -0.026679123
[108,] -0.396800757 1.231568556
[109,] -0.399164006 -0.396800757
[110,] -0.161146907 -0.399164006
[111,] -0.738798916 -0.161146907
[112,] -0.501436671 -0.738798916
[113,] -0.147971167 -0.501436671
[114,] 0.099464021 -0.147971167
[115,] 1.240708048 0.099464021
[116,] 2.204099935 1.240708048
[117,] 1.431345883 2.204099935
[118,] -0.709821243 1.431345883
[119,] -0.113612142 -0.709821243
[120,] 0.179734599 -0.113612142
[121,] -0.457774207 0.179734599
[122,] 1.832808439 -0.457774207
[123,] -1.182604519 1.832808439
[124,] -0.397654955 -1.182604519
[125,] -0.171567000 -0.397654955
[126,] -0.428796534 -0.171567000
[127,] 1.593041606 -0.428796534
[128,] -0.318516324 1.593041606
[129,] -1.134806810 -0.318516324
[130,] -1.460537814 -1.134806810
[131,] 2.280875317 -1.460537814
[132,] 1.773659705 2.280875317
[133,] -0.456265155 1.773659705
[134,] -0.136704836 -0.456265155
[135,] 0.330266772 -0.136704836
[136,] 0.218003841 0.330266772
[137,] -0.367823084 0.218003841
[138,] 1.261201084 -0.367823084
[139,] -0.120587240 1.261201084
[140,] 0.603199243 -0.120587240
[141,] -0.369332136 0.603199243
[142,] -0.379489773 -0.369332136
[143,] 0.620510227 -0.379489773
[144,] -0.396800757 0.620510227
[145,] -0.539676444 -0.396800757
[146,] -0.150608742 -0.539676444
[147,] 0.272311426 -0.150608742
[148,] -0.806057702 0.272311426
[149,] 0.332242549 -0.806057702
[150,] -0.767776589 0.332242549
[151,] 0.603199243 -0.767776589
[152,] -0.693554089 0.603199243
[153,] -0.058674899 -0.693554089
[154,] -0.827240987 -0.058674899
[155,] -0.409976498 -0.827240987
[156,] -0.780098132 -0.409976498
[157,] -0.796754262 -0.780098132
[158,] -0.900924954 -0.796754262
[159,] -0.366314033 -0.900924954
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.169740910 -0.059529096
2 2.789072663 2.169740910
3 0.311362041 2.789072663
4 -0.780952330 0.311362041
5 -0.439808368 -0.780952330
6 0.159583273 -0.439808368
7 -0.399818861 0.159583273
8 0.372420185 -0.399818861
9 0.323113424 0.372420185
10 1.113367927 0.323113424
11 -0.458628404 1.113367927
12 -0.457774207 -0.458628404
13 -0.457119352 -0.457774207
14 0.943489007 -0.457119352
15 1.154582448 0.943489007
16 -0.187761331 1.154582448
17 -0.055656796 -0.187761331
18 -0.409976498 -0.055656796
19 0.451420474 -0.409976498
20 0.930779992 0.451420474
21 -0.769285641 0.930779992
22 -0.764685175 -0.769285641
23 0.330266772 -0.764685175
24 -0.784359408 0.330266772
25 -0.039854863 -0.784359408
26 -0.585891790 -0.039854863
27 -0.515729553 -0.585891790
28 -0.828750039 -0.515729553
29 -0.039200008 -0.828750039
30 -0.349003048 -0.039200008
31 0.330266772 -0.349003048
32 -0.769285641 0.330266772
33 0.021118586 -0.769285641
34 -0.086143520 0.021118586
35 -0.055656796 -0.086143520
36 -0.441317419 -0.055656796
37 -0.338845412 -0.441317419
38 0.020264389 -0.338845412
39 0.370911134 0.020264389
40 -0.349003048 0.370911134
41 -0.428141679 -0.349003048
42 1.880266957 -0.428141679
43 0.003807602 1.880266957
44 -0.396800757 0.003807602
45 1.358705745 -0.396800757
46 -0.244432165 1.358705745
47 0.940470904 -0.244432165
48 -0.460137455 0.940470904
49 -0.070341587 -0.460137455
50 0.127198522 -0.070341587
51 -0.468786041 0.127198522
52 -0.467931844 -0.468786041
53 -0.427287482 -0.467931844
54 0.503175178 -0.427287482
55 0.562639576 0.503175178
56 0.299780047 0.562639576
57 0.542225793 0.299780047
58 -0.099319260 0.542225793
59 0.051605311 -0.099319260
60 -0.119648348 0.051605311
61 -0.585576127 -0.119648348
62 -0.470949947 -0.585576127
63 0.599326942 -0.470949947
64 2.220556722 0.599326942
65 -0.377980721 2.220556722
66 -0.026679123 -0.377980721
67 -0.396800757 -0.026679123
68 0.230714359 -0.396800757
69 0.787563611 0.230714359
70 -0.349003048 0.787563611
71 -0.457774207 -0.349003048
72 -0.129151130 -0.457774207
73 -0.429650731 -0.129151130
74 -0.084634469 -0.429650731
75 -0.084634469 -0.084634469
76 -1.029781920 -0.084634469
77 1.818439311 -1.029781920
78 -0.026679123 1.818439311
79 -1.110429603 -0.026679123
80 0.632176916 -1.110429603
81 -0.459283258 0.632176916
82 -0.799772366 -0.459283258
83 -1.183458716 -0.799772366
84 -0.438954171 -1.183458716
85 -0.057165847 -0.438954171
86 -0.769285641 -0.057165847
87 -0.428141679 -0.769285641
88 0.299780047 -0.428141679
89 -0.539676444 0.299780047
90 -0.799772366 -0.539676444
91 -0.377980721 -0.799772366
92 -0.438954171 -0.377980721
93 -0.764030320 -0.438954171
94 -0.427287482 -0.764030320
95 1.341079263 -0.427287482
96 -0.750465605 1.341079263
97 3.291032954 -0.750465605
98 -0.337336360 3.291032954
99 -0.367823084 -0.337336360
100 -0.406958394 -0.367823084
101 0.574221570 -0.406958394
102 -1.183458716 0.574221570
103 0.623928522 -1.183458716
104 -0.409976498 0.623928522
105 -0.409976498 -0.409976498
106 -0.026679123 -0.409976498
107 1.231568556 -0.026679123
108 -0.396800757 1.231568556
109 -0.399164006 -0.396800757
110 -0.161146907 -0.399164006
111 -0.738798916 -0.161146907
112 -0.501436671 -0.738798916
113 -0.147971167 -0.501436671
114 0.099464021 -0.147971167
115 1.240708048 0.099464021
116 2.204099935 1.240708048
117 1.431345883 2.204099935
118 -0.709821243 1.431345883
119 -0.113612142 -0.709821243
120 0.179734599 -0.113612142
121 -0.457774207 0.179734599
122 1.832808439 -0.457774207
123 -1.182604519 1.832808439
124 -0.397654955 -1.182604519
125 -0.171567000 -0.397654955
126 -0.428796534 -0.171567000
127 1.593041606 -0.428796534
128 -0.318516324 1.593041606
129 -1.134806810 -0.318516324
130 -1.460537814 -1.134806810
131 2.280875317 -1.460537814
132 1.773659705 2.280875317
133 -0.456265155 1.773659705
134 -0.136704836 -0.456265155
135 0.330266772 -0.136704836
136 0.218003841 0.330266772
137 -0.367823084 0.218003841
138 1.261201084 -0.367823084
139 -0.120587240 1.261201084
140 0.603199243 -0.120587240
141 -0.369332136 0.603199243
142 -0.379489773 -0.369332136
143 0.620510227 -0.379489773
144 -0.396800757 0.620510227
145 -0.539676444 -0.396800757
146 -0.150608742 -0.539676444
147 0.272311426 -0.150608742
148 -0.806057702 0.272311426
149 0.332242549 -0.806057702
150 -0.767776589 0.332242549
151 0.603199243 -0.767776589
152 -0.693554089 0.603199243
153 -0.058674899 -0.693554089
154 -0.827240987 -0.058674899
155 -0.409976498 -0.827240987
156 -0.780098132 -0.409976498
157 -0.796754262 -0.780098132
158 -0.900924954 -0.796754262
159 -0.366314033 -0.900924954
> 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/freestat/rcomp/tmp/7zcji1291287622.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/8zcji1291287622.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/html/freestat/rcomp/tmp/9s3i31291287622.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/www/html/freestat/rcomp/tmp/10s3i31291287622.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/www/html/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/11vlhr1291287622.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/freestat/rcomp/tmp/12h4ff1291287622.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/freestat/rcomp/tmp/13n5ur1291287622.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/freestat/rcomp/tmp/14rnsw1291287622.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/freestat/rcomp/tmp/15c69k1291287622.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/freestat/rcomp/tmp/16y7q81291287622.tab")
+ }
>
> try(system("convert tmp/13k391291287622.ps tmp/13k391291287622.png",intern=TRUE))
character(0)
> try(system("convert tmp/2dbku1291287622.ps tmp/2dbku1291287622.png",intern=TRUE))
character(0)
> try(system("convert tmp/3dbku1291287622.ps tmp/3dbku1291287622.png",intern=TRUE))
character(0)
> try(system("convert tmp/4dbku1291287622.ps tmp/4dbku1291287622.png",intern=TRUE))
character(0)
> try(system("convert tmp/56k1x1291287622.ps tmp/56k1x1291287622.png",intern=TRUE))
character(0)
> try(system("convert tmp/66k1x1291287622.ps tmp/66k1x1291287622.png",intern=TRUE))
character(0)
> try(system("convert tmp/7zcji1291287622.ps tmp/7zcji1291287622.png",intern=TRUE))
character(0)
> try(system("convert tmp/8zcji1291287622.ps tmp/8zcji1291287622.png",intern=TRUE))
character(0)
> try(system("convert tmp/9s3i31291287622.ps tmp/9s3i31291287622.png",intern=TRUE))
character(0)
> try(system("convert tmp/10s3i31291287622.ps tmp/10s3i31291287622.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
5.774 2.640 6.144