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(1
+ ,1
+ ,4
+ ,4
+ ,5
+ ,5
+ ,3
+ ,3
+ ,1
+ ,1
+ ,2
+ ,2
+ ,7
+ ,7
+ ,4
+ ,4
+ ,1
+ ,2
+ ,2
+ ,2
+ ,7
+ ,7
+ ,3
+ ,3
+ ,1
+ ,1
+ ,4
+ ,4
+ ,7
+ ,7
+ ,4
+ ,4
+ ,1
+ ,1
+ ,3
+ ,3
+ ,3
+ ,3
+ ,1
+ ,1
+ ,1
+ ,1
+ ,1
+ ,1
+ ,2
+ ,2
+ ,4
+ ,4
+ ,1
+ ,1
+ ,2
+ ,2
+ ,1
+ ,1
+ ,2
+ ,2
+ ,1
+ ,1
+ ,3
+ ,3
+ ,7
+ ,7
+ ,6
+ ,6
+ ,1
+ ,1
+ ,5
+ ,5
+ ,5
+ ,5
+ ,2
+ ,2
+ ,1
+ ,1
+ ,2
+ ,2
+ ,5
+ ,5
+ ,4
+ ,4
+ ,1
+ ,2
+ ,4
+ ,4
+ ,6
+ ,6
+ ,2
+ ,2
+ ,1
+ ,1
+ ,3
+ ,3
+ ,2
+ ,2
+ ,2
+ ,2
+ ,1
+ ,1
+ ,2
+ ,2
+ ,6
+ ,6
+ ,2
+ ,2
+ ,1
+ ,2
+ ,4
+ ,4
+ ,6
+ ,6
+ ,6
+ ,6
+ ,1
+ ,1
+ ,2
+ ,2
+ ,6
+ ,6
+ ,2
+ ,2
+ ,1
+ ,1
+ ,5
+ ,5
+ ,6
+ ,6
+ ,4
+ ,4
+ ,1
+ ,1
+ ,5
+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,0
+ ,1
+ ,0
+ ,1
+ ,0
+ ,0
+ ,1
+ ,2
+ ,0
+ ,5
+ ,0
+ ,2
+ ,0
+ ,0
+ ,1
+ ,2
+ ,0
+ ,5
+ ,0
+ ,1
+ ,0
+ ,0
+ ,1
+ ,2
+ ,0
+ ,2
+ ,0
+ ,2
+ ,0
+ ,0
+ ,2
+ ,1
+ ,0
+ ,4
+ ,0
+ ,5
+ ,0
+ ,0
+ ,1
+ ,3
+ ,0
+ ,5
+ ,0
+ ,5
+ ,0
+ ,0
+ ,3
+ ,6
+ ,0
+ ,5
+ ,0
+ ,4
+ ,0
+ ,0
+ ,1
+ ,1
+ ,0
+ ,5
+ ,0
+ ,1
+ ,0)
+ ,dim=c(8
+ ,152)
+ ,dimnames=list(c('Gender'
+ ,'Depressed'
+ ,'Cannotdo'
+ ,'Cannotdo_G'
+ ,'Worrytoomuch'
+ ,'Worrytoomuch_G'
+ ,'Limitactivity'
+ ,'Limitactivity_G')
+ ,1:152))
> y <- array(NA,dim=c(8,152),dimnames=list(c('Gender','Depressed','Cannotdo','Cannotdo_G','Worrytoomuch','Worrytoomuch_G','Limitactivity','Limitactivity_G'),1:152))
> 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 = '2'
> #'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
Depressed Gender Cannotdo Cannotdo_G Worrytoomuch Worrytoomuch_G
1 1 1 4 4 5 5
2 1 1 2 2 7 7
3 2 1 2 2 7 7
4 1 1 4 4 7 7
5 1 1 3 3 3 3
6 1 1 1 1 2 2
7 1 1 2 2 1 1
8 1 1 3 3 7 7
9 1 1 5 5 5 5
10 1 1 2 2 5 5
11 2 1 4 4 6 6
12 1 1 3 3 2 2
13 1 1 2 2 6 6
14 2 1 4 4 6 6
15 1 1 2 2 6 6
16 1 1 5 5 6 6
17 1 1 5 5 6 6
18 1 1 1 1 1 1
19 1 1 2 2 7 7
20 1 1 1 1 4 4
21 1 1 3 3 3 3
22 2 1 2 2 7 7
23 1 1 4 4 5 5
24 1 1 6 6 2 2
25 2 1 3 3 7 7
26 1 1 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0 5 0
100 1 0 6 0 6 0
101 1 0 6 0 6 0
102 3 0 5 0 3 0
103 2 0 2 0 4 0
104 2 0 4 0 6 0
105 1 0 3 0 1 0
106 1 0 2 0 4 0
107 1 0 2 0 5 0
108 1 0 5 0 3 0
109 1 0 1 0 2 0
110 3 0 5 0 7 0
111 1 0 2 0 1 0
112 1 0 1 0 5 0
113 1 0 2 0 5 0
114 1 0 2 0 2 0
115 1 0 0 0 6 0
116 1 0 5 0 2 0
117 1 0 3 0 5 0
118 1 0 2 0 3 0
119 1 0 2 0 5 0
120 1 0 1 0 6 0
121 1 0 4 0 5 0
122 1 0 2 0 2 0
123 3 0 7 0 1 0
124 2 0 5 0 5 0
125 2 0 3 0 6 0
126 1 0 4 0 6 0
127 1 0 2 0 3 0
128 1 0 6 0 5 0
129 1 0 4 0 5 0
130 1 0 2 0 2 0
131 2 0 7 0 3 0
132 1 0 4 0 3 0
133 1 0 4 0 6 0
134 1 0 4 0 5 0
135 1 0 2 0 2 0
136 1 0 5 0 4 0
137 1 0 2 0 2 0
138 1 0 3 0 5 0
139 1 0 4 0 5 0
140 1 0 2 0 1 0
141 1 0 2 0 5 0
142 2 0 2 0 5 0
143 1 0 3 0 6 0
144 1 0 4 0 5 0
145 1 0 1 0 1 0
146 1 0 2 0 5 0
147 1 0 2 0 5 0
148 1 0 2 0 2 0
149 2 0 1 0 4 0
150 1 0 3 0 5 0
151 3 0 6 0 5 0
152 1 0 1 0 5 0
Limitactivity Limitactivity_G
1 3 3
2 4 4
3 3 3
4 4 4
5 1 1
6 4 4
7 2 2
8 6 6
9 2 2
10 4 4
11 2 2
12 2 2
13 2 2
14 6 6
15 2 2
16 4 4
17 3 3
18 1 1
19 4 4
20 1 1
21 4 4
22 1 1
23 4 4
24 3 3
25 2 2
26 4 4
27 5 5
28 5 5
29 2 2
30 3 3
31 2 2
32 2 2
33 2 2
34 2 2
35 2 2
36 2 2
37 1 1
38 3 3
39 2 2
40 2 2
41 4 4
42 3 3
43 3 3
44 4 4
45 2 2
46 5 5
47 1 1
48 3 3
49 3 3
50 2 2
51 4 4
52 4 4
53 4 4
54 4 4
55 4 4
56 2 2
57 3 3
58 3 3
59 3 3
60 2 2
61 2 0
62 2 0
63 4 0
64 2 0
65 1 0
66 4 0
67 3 0
68 1 0
69 4 0
70 4 0
71 4 0
72 1 0
73 4 0
74 3 0
75 6 0
76 5 0
77 4 0
78 1 0
79 4 0
80 1 0
81 1 0
82 2 0
83 1 0
84 3 0
85 3 0
86 4 0
87 3 0
88 2 0
89 5 0
90 2 0
91 3 0
92 2 0
93 3 0
94 2 0
95 4 0
96 2 0
97 2 0
98 4 0
99 5 0
100 4 0
101 2 0
102 5 0
103 2 0
104 3 0
105 2 0
106 3 0
107 3 0
108 3 0
109 1 0
110 4 0
111 1 0
112 1 0
113 1 0
114 3 0
115 2 0
116 3 0
117 5 0
118 3 0
119 3 0
120 4 0
121 2 0
122 3 0
123 5 0
124 2 0
125 2 0
126 4 0
127 0 0
128 6 0
129 1 0
130 2 0
131 1 0
132 4 0
133 2 0
134 4 0
135 1 0
136 4 0
137 1 0
138 2 0
139 5 0
140 2 0
141 4 0
142 4 0
143 2 0
144 2 0
145 1 0
146 2 0
147 1 0
148 2 0
149 5 0
150 5 0
151 4 0
152 1 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Gender Cannotdo Cannotdo_G
0.66254 0.25238 0.08535 -0.10007
Worrytoomuch Worrytoomuch_G Limitactivity Limitactivity_G
0.02725 0.06611 0.08788 -0.10040
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.8381 -0.3213 -0.1332 0.0912 2.6044
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.66254 0.17810 3.720 0.000285 ***
Gender 0.25238 0.30885 0.817 0.415181
Cannotdo 0.08535 0.03878 2.201 0.029349 *
Cannotdo_G -0.10007 0.05975 -1.675 0.096155 .
Worrytoomuch 0.02725 0.03550 0.768 0.444035
Worrytoomuch_G 0.06611 0.05542 1.193 0.234896
Limitactivity 0.08788 0.04492 1.956 0.052388 .
Limitactivity_G -0.10040 0.07554 -1.329 0.185931
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.5506 on 144 degrees of freedom
Multiple R-squared: 0.1338, Adjusted R-squared: 0.09168
F-statistic: 3.177 on 7 and 144 DF, p-value: 0.003719
> 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.560084776 0.879830447 0.43991522
[2,] 0.390916678 0.781833356 0.60908332
[3,] 0.423990511 0.847981021 0.57600949
[4,] 0.609390008 0.781219985 0.39060999
[5,] 0.512084831 0.975830337 0.48791517
[6,] 0.440372675 0.880745350 0.55962732
[7,] 0.360677074 0.721354147 0.63932293
[8,] 0.271404723 0.542809447 0.72859528
[9,] 0.220928182 0.441856363 0.77907182
[10,] 0.159238715 0.318477430 0.84076129
[11,] 0.110626898 0.221253797 0.88937310
[12,] 0.142353665 0.284707329 0.85764634
[13,] 0.103332034 0.206664068 0.89666797
[14,] 0.071381250 0.142762500 0.92861875
[15,] 0.080168821 0.160337642 0.91983118
[16,] 0.055942572 0.111885145 0.94405743
[17,] 0.043237131 0.086474262 0.95676287
[18,] 0.029219282 0.058438563 0.97078072
[19,] 0.066534191 0.133068382 0.93346581
[20,] 0.046396376 0.092792752 0.95360362
[21,] 0.036263700 0.072527400 0.96373630
[22,] 0.024441719 0.048883438 0.97555828
[23,] 0.018569355 0.037138710 0.98143065
[24,] 0.012175125 0.024350250 0.98782487
[25,] 0.009290641 0.018581283 0.99070936
[26,] 0.005890585 0.011781171 0.99410941
[27,] 0.003852422 0.007704843 0.99614758
[28,] 0.002824488 0.005648975 0.99717551
[29,] 0.001734387 0.003468773 0.99826561
[30,] 0.001290463 0.002580927 0.99870954
[31,] 0.003500058 0.007000116 0.99649994
[32,] 0.002408137 0.004816273 0.99759186
[33,] 0.003954517 0.007909034 0.99604548
[34,] 0.007020663 0.014041326 0.99297934
[35,] 0.010148463 0.020296926 0.98985154
[36,] 0.006875095 0.013750190 0.99312490
[37,] 0.004720254 0.009440509 0.99527975
[38,] 0.003102300 0.006204600 0.99689770
[39,] 0.006704698 0.013409396 0.99329530
[40,] 0.011949517 0.023899034 0.98805048
[41,] 0.011698274 0.023396547 0.98830173
[42,] 0.016042271 0.032084542 0.98395773
[43,] 0.633947040 0.732105919 0.36605296
[44,] 0.595321640 0.809356720 0.40467836
[45,] 0.554840676 0.890318648 0.44515932
[46,] 0.533363967 0.933272066 0.46663603
[47,] 0.484286474 0.968572949 0.51571353
[48,] 0.448154309 0.896308618 0.55184569
[49,] 0.403516621 0.807033241 0.59648338
[50,] 0.363462155 0.726924309 0.63653785
[51,] 0.321673547 0.643347095 0.67832645
[52,] 0.278279523 0.556559046 0.72172048
[53,] 0.253527436 0.507054872 0.74647256
[54,] 0.293488002 0.586976004 0.70651200
[55,] 0.252189710 0.504379420 0.74781029
[56,] 0.826750243 0.346499513 0.17324976
[57,] 0.903460279 0.193079441 0.09653972
[58,] 0.881444112 0.237111776 0.11855589
[59,] 0.868484877 0.263030246 0.13151512
[60,] 0.866217224 0.267565551 0.13378278
[61,] 0.855960707 0.288078587 0.14403929
[62,] 0.827453600 0.345092800 0.17254640
[63,] 0.865090884 0.269818232 0.13490912
[64,] 0.869898486 0.260203028 0.13010151
[65,] 0.847103275 0.305793449 0.15289672
[66,] 0.859008797 0.281982407 0.14099120
[67,] 0.862150714 0.275698571 0.13784929
[68,] 0.846775926 0.306448147 0.15322407
[69,] 0.836317048 0.327365904 0.16368295
[70,] 0.806091489 0.387817022 0.19390851
[71,] 0.783601278 0.432797445 0.21639872
[72,] 0.746679329 0.506641342 0.25332067
[73,] 0.708242695 0.583514610 0.29175730
[74,] 0.667086653 0.665826695 0.33291335
[75,] 0.633362415 0.733275169 0.36663758
[76,] 0.621263743 0.757472513 0.37873626
[77,] 0.594567816 0.810864367 0.40543218
[78,] 0.550049573 0.899900854 0.44995043
[79,] 0.519855082 0.960289836 0.48014492
[80,] 0.513559520 0.972880960 0.48644048
[81,] 0.478002178 0.956004355 0.52199782
[82,] 0.429487479 0.858974957 0.57051252
[83,] 0.447800941 0.895601882 0.55219906
[84,] 0.403281120 0.806562241 0.59671888
[85,] 0.403572450 0.807144901 0.59642755
[86,] 0.381318295 0.762636590 0.61868171
[87,] 0.353304834 0.706609668 0.64669517
[88,] 0.348351599 0.696703198 0.65164840
[89,] 0.367079440 0.734158880 0.63292056
[90,] 0.396015968 0.792031936 0.60398403
[91,] 0.403171621 0.806343242 0.59682838
[92,] 0.674827136 0.650345727 0.32517286
[93,] 0.746334289 0.507331422 0.25366571
[94,] 0.743275535 0.513448931 0.25672447
[95,] 0.700312816 0.599374367 0.29968718
[96,] 0.659776323 0.680447354 0.34022368
[97,] 0.619836354 0.760327291 0.38016365
[98,] 0.608710567 0.782578867 0.39128943
[99,] 0.557718156 0.884563689 0.44228184
[100,] 0.819765416 0.360469168 0.18023458
[101,] 0.781383088 0.437233824 0.21861691
[102,] 0.740221397 0.519557206 0.25977860
[103,] 0.691444302 0.617111396 0.30855570
[104,] 0.641792745 0.716414511 0.35820726
[105,] 0.605115428 0.789769143 0.39488457
[106,] 0.608914085 0.782171830 0.39108592
[107,] 0.582833364 0.834333273 0.41716664
[108,] 0.527079191 0.945841618 0.47292081
[109,] 0.470790804 0.941581608 0.52920920
[110,] 0.420603650 0.841207300 0.57939635
[111,] 0.377533415 0.755066830 0.62246659
[112,] 0.324103752 0.648207504 0.67589625
[113,] 0.517883788 0.964232423 0.48211621
[114,] 0.528818841 0.942362318 0.47118116
[115,] 0.611878226 0.776243549 0.38812177
[116,] 0.569680956 0.860638088 0.43031904
[117,] 0.496650596 0.993301191 0.50334940
[118,] 0.549520567 0.900958866 0.45047943
[119,] 0.479787615 0.959575231 0.52021238
[120,] 0.402843040 0.805686079 0.59715696
[121,] 0.403277559 0.806555118 0.59672244
[122,] 0.366680468 0.733360936 0.63331953
[123,] 0.296434654 0.592869309 0.70356535
[124,] 0.268471794 0.536943589 0.73152821
[125,] 0.197020220 0.394040440 0.80297978
[126,] 0.214832853 0.429665706 0.78516715
[127,] 0.146864458 0.293728915 0.85313554
[128,] 0.097730384 0.195460768 0.90226962
[129,] 0.148607330 0.297214659 0.85139267
[130,] 0.094376689 0.188753378 0.90562331
[131,] 0.066579459 0.133158918 0.93342054
> postscript(file="/var/www/html/rcomp/tmp/1kebm1292769564.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/rcomp/tmp/2dnap1292769564.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/rcomp/tmp/3dnap1292769564.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/rcomp/tmp/4dnap1292769564.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/rcomp/tmp/5dnap1292769564.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 = 152
Frequency = 1
1 2 3 4 5 6
-0.285299278 -0.488931227 0.498547545 -0.459499553 -0.138336068 -0.036843304
7 8 9 10 11 12
0.046190828 -0.449172933 -0.283104669 -0.302209723 0.608818742 -0.032454087
13 14 15 16 17 18
-0.420612932 0.658903656 -0.420612932 -0.351422964 -0.363944193 0.018953762
19 20 21 22 23 24
-0.488931227 -0.261128493 -0.100772382 0.473505088 -0.272778049 0.024214652
25 26 27 28 29 30
0.500742153 -0.022127467 -0.417546651 -0.102966991 0.859469324 -0.049364533
31 32 33 34 35 36
-0.312536343 -0.017738250 -0.312536343 -0.047169924 -0.327252180 -0.032454087
37 38 39 40 41 42
0.013888032 -0.314730951 -0.111099002 -0.327252180 0.727221951 -0.270583441
43 44 45 46 47 48
0.650771644 0.741937788 0.658031983 -0.073535317 -0.167767741 -0.019932859
49 50 51 52 53 54
0.822777311 0.731611168 -0.302209723 -0.302209723 2.604429525 -0.258062212
55 56 57 58 59 60
-0.243346375 -0.469826173 -0.128009448 -0.349228356 -0.221370200 -0.283104669
61 62 63 64 65 66
-0.288691349 -0.063490701 -0.577043885 1.049109622 -0.030113533 2.395706646
67 68 69 70 71 72
-0.147764360 -0.115464388 0.422956115 -0.239242913 -0.320991321 0.027987852
73 74 75 76 77 78
-0.689644208 0.654284462 0.247203903 -0.637670522 0.620907294 -0.367914504
79 80 81 82 83 84
0.481057501 0.136985728 -0.371516952 -0.063490701 0.136985728 -0.038766484
85 86 87 88 89 90
-0.322068517 -0.522544946 -0.318466069 -0.176091025 -0.327119019 0.544209389
91 92 93 94 95 96
-0.294819048 -0.063490701 0.681533931 -0.117989639 -0.577043885 -0.428541141
97 98 99 100 101 102
-0.346792734 0.535556439 -0.664919991 -0.689644208 -0.513891996 1.389578948
103 104 105 106 107 108
0.882010361 0.568933607 -0.121592087 -0.205865746 -0.233115215 -0.434668840
109 110 111 112 113 114
0.109736259 1.368457177 0.051634874 0.027987852 -0.057363002 -0.151366807
115 116 117 118 119 120
-0.001786868 -0.407419371 -0.494218281 -0.178616276 -0.233115215 -0.262889935
121 122 123 124 125 126
-0.315940818 -0.151366807 1.273376176 0.598708328 0.742160568 -0.518942499
127 128 129 130 131 132
0.085012042 -0.838146951 -0.228064712 -0.063490701 0.570381663 -0.437194092
133 134 135 136 137 138
-0.343190287 -0.491693030 0.024385405 -0.549794415 0.024385405 -0.230589963
139 140 141 142 143 144
-0.579569136 -0.036241232 -0.320991321 0.679008679 -0.257839432 -0.315940818
145 146 147 148 149 150
0.136985728 -0.145239109 -0.057363002 -0.063490701 0.703732897 -0.494218281
151 152
1.337605261 0.027987852
> postscript(file="/var/www/html/rcomp/tmp/65wrs1292769564.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 = 152
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.285299278 NA
1 -0.488931227 -0.285299278
2 0.498547545 -0.488931227
3 -0.459499553 0.498547545
4 -0.138336068 -0.459499553
5 -0.036843304 -0.138336068
6 0.046190828 -0.036843304
7 -0.449172933 0.046190828
8 -0.283104669 -0.449172933
9 -0.302209723 -0.283104669
10 0.608818742 -0.302209723
11 -0.032454087 0.608818742
12 -0.420612932 -0.032454087
13 0.658903656 -0.420612932
14 -0.420612932 0.658903656
15 -0.351422964 -0.420612932
16 -0.363944193 -0.351422964
17 0.018953762 -0.363944193
18 -0.488931227 0.018953762
19 -0.261128493 -0.488931227
20 -0.100772382 -0.261128493
21 0.473505088 -0.100772382
22 -0.272778049 0.473505088
23 0.024214652 -0.272778049
24 0.500742153 0.024214652
25 -0.022127467 0.500742153
26 -0.417546651 -0.022127467
27 -0.102966991 -0.417546651
28 0.859469324 -0.102966991
29 -0.049364533 0.859469324
30 -0.312536343 -0.049364533
31 -0.017738250 -0.312536343
32 -0.312536343 -0.017738250
33 -0.047169924 -0.312536343
34 -0.327252180 -0.047169924
35 -0.032454087 -0.327252180
36 0.013888032 -0.032454087
37 -0.314730951 0.013888032
38 -0.111099002 -0.314730951
39 -0.327252180 -0.111099002
40 0.727221951 -0.327252180
41 -0.270583441 0.727221951
42 0.650771644 -0.270583441
43 0.741937788 0.650771644
44 0.658031983 0.741937788
45 -0.073535317 0.658031983
46 -0.167767741 -0.073535317
47 -0.019932859 -0.167767741
48 0.822777311 -0.019932859
49 0.731611168 0.822777311
50 -0.302209723 0.731611168
51 -0.302209723 -0.302209723
52 2.604429525 -0.302209723
53 -0.258062212 2.604429525
54 -0.243346375 -0.258062212
55 -0.469826173 -0.243346375
56 -0.128009448 -0.469826173
57 -0.349228356 -0.128009448
58 -0.221370200 -0.349228356
59 -0.283104669 -0.221370200
60 -0.288691349 -0.283104669
61 -0.063490701 -0.288691349
62 -0.577043885 -0.063490701
63 1.049109622 -0.577043885
64 -0.030113533 1.049109622
65 2.395706646 -0.030113533
66 -0.147764360 2.395706646
67 -0.115464388 -0.147764360
68 0.422956115 -0.115464388
69 -0.239242913 0.422956115
70 -0.320991321 -0.239242913
71 0.027987852 -0.320991321
72 -0.689644208 0.027987852
73 0.654284462 -0.689644208
74 0.247203903 0.654284462
75 -0.637670522 0.247203903
76 0.620907294 -0.637670522
77 -0.367914504 0.620907294
78 0.481057501 -0.367914504
79 0.136985728 0.481057501
80 -0.371516952 0.136985728
81 -0.063490701 -0.371516952
82 0.136985728 -0.063490701
83 -0.038766484 0.136985728
84 -0.322068517 -0.038766484
85 -0.522544946 -0.322068517
86 -0.318466069 -0.522544946
87 -0.176091025 -0.318466069
88 -0.327119019 -0.176091025
89 0.544209389 -0.327119019
90 -0.294819048 0.544209389
91 -0.063490701 -0.294819048
92 0.681533931 -0.063490701
93 -0.117989639 0.681533931
94 -0.577043885 -0.117989639
95 -0.428541141 -0.577043885
96 -0.346792734 -0.428541141
97 0.535556439 -0.346792734
98 -0.664919991 0.535556439
99 -0.689644208 -0.664919991
100 -0.513891996 -0.689644208
101 1.389578948 -0.513891996
102 0.882010361 1.389578948
103 0.568933607 0.882010361
104 -0.121592087 0.568933607
105 -0.205865746 -0.121592087
106 -0.233115215 -0.205865746
107 -0.434668840 -0.233115215
108 0.109736259 -0.434668840
109 1.368457177 0.109736259
110 0.051634874 1.368457177
111 0.027987852 0.051634874
112 -0.057363002 0.027987852
113 -0.151366807 -0.057363002
114 -0.001786868 -0.151366807
115 -0.407419371 -0.001786868
116 -0.494218281 -0.407419371
117 -0.178616276 -0.494218281
118 -0.233115215 -0.178616276
119 -0.262889935 -0.233115215
120 -0.315940818 -0.262889935
121 -0.151366807 -0.315940818
122 1.273376176 -0.151366807
123 0.598708328 1.273376176
124 0.742160568 0.598708328
125 -0.518942499 0.742160568
126 0.085012042 -0.518942499
127 -0.838146951 0.085012042
128 -0.228064712 -0.838146951
129 -0.063490701 -0.228064712
130 0.570381663 -0.063490701
131 -0.437194092 0.570381663
132 -0.343190287 -0.437194092
133 -0.491693030 -0.343190287
134 0.024385405 -0.491693030
135 -0.549794415 0.024385405
136 0.024385405 -0.549794415
137 -0.230589963 0.024385405
138 -0.579569136 -0.230589963
139 -0.036241232 -0.579569136
140 -0.320991321 -0.036241232
141 0.679008679 -0.320991321
142 -0.257839432 0.679008679
143 -0.315940818 -0.257839432
144 0.136985728 -0.315940818
145 -0.145239109 0.136985728
146 -0.057363002 -0.145239109
147 -0.063490701 -0.057363002
148 0.703732897 -0.063490701
149 -0.494218281 0.703732897
150 1.337605261 -0.494218281
151 0.027987852 1.337605261
152 NA 0.027987852
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.488931227 -0.285299278
[2,] 0.498547545 -0.488931227
[3,] -0.459499553 0.498547545
[4,] -0.138336068 -0.459499553
[5,] -0.036843304 -0.138336068
[6,] 0.046190828 -0.036843304
[7,] -0.449172933 0.046190828
[8,] -0.283104669 -0.449172933
[9,] -0.302209723 -0.283104669
[10,] 0.608818742 -0.302209723
[11,] -0.032454087 0.608818742
[12,] -0.420612932 -0.032454087
[13,] 0.658903656 -0.420612932
[14,] -0.420612932 0.658903656
[15,] -0.351422964 -0.420612932
[16,] -0.363944193 -0.351422964
[17,] 0.018953762 -0.363944193
[18,] -0.488931227 0.018953762
[19,] -0.261128493 -0.488931227
[20,] -0.100772382 -0.261128493
[21,] 0.473505088 -0.100772382
[22,] -0.272778049 0.473505088
[23,] 0.024214652 -0.272778049
[24,] 0.500742153 0.024214652
[25,] -0.022127467 0.500742153
[26,] -0.417546651 -0.022127467
[27,] -0.102966991 -0.417546651
[28,] 0.859469324 -0.102966991
[29,] -0.049364533 0.859469324
[30,] -0.312536343 -0.049364533
[31,] -0.017738250 -0.312536343
[32,] -0.312536343 -0.017738250
[33,] -0.047169924 -0.312536343
[34,] -0.327252180 -0.047169924
[35,] -0.032454087 -0.327252180
[36,] 0.013888032 -0.032454087
[37,] -0.314730951 0.013888032
[38,] -0.111099002 -0.314730951
[39,] -0.327252180 -0.111099002
[40,] 0.727221951 -0.327252180
[41,] -0.270583441 0.727221951
[42,] 0.650771644 -0.270583441
[43,] 0.741937788 0.650771644
[44,] 0.658031983 0.741937788
[45,] -0.073535317 0.658031983
[46,] -0.167767741 -0.073535317
[47,] -0.019932859 -0.167767741
[48,] 0.822777311 -0.019932859
[49,] 0.731611168 0.822777311
[50,] -0.302209723 0.731611168
[51,] -0.302209723 -0.302209723
[52,] 2.604429525 -0.302209723
[53,] -0.258062212 2.604429525
[54,] -0.243346375 -0.258062212
[55,] -0.469826173 -0.243346375
[56,] -0.128009448 -0.469826173
[57,] -0.349228356 -0.128009448
[58,] -0.221370200 -0.349228356
[59,] -0.283104669 -0.221370200
[60,] -0.288691349 -0.283104669
[61,] -0.063490701 -0.288691349
[62,] -0.577043885 -0.063490701
[63,] 1.049109622 -0.577043885
[64,] -0.030113533 1.049109622
[65,] 2.395706646 -0.030113533
[66,] -0.147764360 2.395706646
[67,] -0.115464388 -0.147764360
[68,] 0.422956115 -0.115464388
[69,] -0.239242913 0.422956115
[70,] -0.320991321 -0.239242913
[71,] 0.027987852 -0.320991321
[72,] -0.689644208 0.027987852
[73,] 0.654284462 -0.689644208
[74,] 0.247203903 0.654284462
[75,] -0.637670522 0.247203903
[76,] 0.620907294 -0.637670522
[77,] -0.367914504 0.620907294
[78,] 0.481057501 -0.367914504
[79,] 0.136985728 0.481057501
[80,] -0.371516952 0.136985728
[81,] -0.063490701 -0.371516952
[82,] 0.136985728 -0.063490701
[83,] -0.038766484 0.136985728
[84,] -0.322068517 -0.038766484
[85,] -0.522544946 -0.322068517
[86,] -0.318466069 -0.522544946
[87,] -0.176091025 -0.318466069
[88,] -0.327119019 -0.176091025
[89,] 0.544209389 -0.327119019
[90,] -0.294819048 0.544209389
[91,] -0.063490701 -0.294819048
[92,] 0.681533931 -0.063490701
[93,] -0.117989639 0.681533931
[94,] -0.577043885 -0.117989639
[95,] -0.428541141 -0.577043885
[96,] -0.346792734 -0.428541141
[97,] 0.535556439 -0.346792734
[98,] -0.664919991 0.535556439
[99,] -0.689644208 -0.664919991
[100,] -0.513891996 -0.689644208
[101,] 1.389578948 -0.513891996
[102,] 0.882010361 1.389578948
[103,] 0.568933607 0.882010361
[104,] -0.121592087 0.568933607
[105,] -0.205865746 -0.121592087
[106,] -0.233115215 -0.205865746
[107,] -0.434668840 -0.233115215
[108,] 0.109736259 -0.434668840
[109,] 1.368457177 0.109736259
[110,] 0.051634874 1.368457177
[111,] 0.027987852 0.051634874
[112,] -0.057363002 0.027987852
[113,] -0.151366807 -0.057363002
[114,] -0.001786868 -0.151366807
[115,] -0.407419371 -0.001786868
[116,] -0.494218281 -0.407419371
[117,] -0.178616276 -0.494218281
[118,] -0.233115215 -0.178616276
[119,] -0.262889935 -0.233115215
[120,] -0.315940818 -0.262889935
[121,] -0.151366807 -0.315940818
[122,] 1.273376176 -0.151366807
[123,] 0.598708328 1.273376176
[124,] 0.742160568 0.598708328
[125,] -0.518942499 0.742160568
[126,] 0.085012042 -0.518942499
[127,] -0.838146951 0.085012042
[128,] -0.228064712 -0.838146951
[129,] -0.063490701 -0.228064712
[130,] 0.570381663 -0.063490701
[131,] -0.437194092 0.570381663
[132,] -0.343190287 -0.437194092
[133,] -0.491693030 -0.343190287
[134,] 0.024385405 -0.491693030
[135,] -0.549794415 0.024385405
[136,] 0.024385405 -0.549794415
[137,] -0.230589963 0.024385405
[138,] -0.579569136 -0.230589963
[139,] -0.036241232 -0.579569136
[140,] -0.320991321 -0.036241232
[141,] 0.679008679 -0.320991321
[142,] -0.257839432 0.679008679
[143,] -0.315940818 -0.257839432
[144,] 0.136985728 -0.315940818
[145,] -0.145239109 0.136985728
[146,] -0.057363002 -0.145239109
[147,] -0.063490701 -0.057363002
[148,] 0.703732897 -0.063490701
[149,] -0.494218281 0.703732897
[150,] 1.337605261 -0.494218281
[151,] 0.027987852 1.337605261
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.488931227 -0.285299278
2 0.498547545 -0.488931227
3 -0.459499553 0.498547545
4 -0.138336068 -0.459499553
5 -0.036843304 -0.138336068
6 0.046190828 -0.036843304
7 -0.449172933 0.046190828
8 -0.283104669 -0.449172933
9 -0.302209723 -0.283104669
10 0.608818742 -0.302209723
11 -0.032454087 0.608818742
12 -0.420612932 -0.032454087
13 0.658903656 -0.420612932
14 -0.420612932 0.658903656
15 -0.351422964 -0.420612932
16 -0.363944193 -0.351422964
17 0.018953762 -0.363944193
18 -0.488931227 0.018953762
19 -0.261128493 -0.488931227
20 -0.100772382 -0.261128493
21 0.473505088 -0.100772382
22 -0.272778049 0.473505088
23 0.024214652 -0.272778049
24 0.500742153 0.024214652
25 -0.022127467 0.500742153
26 -0.417546651 -0.022127467
27 -0.102966991 -0.417546651
28 0.859469324 -0.102966991
29 -0.049364533 0.859469324
30 -0.312536343 -0.049364533
31 -0.017738250 -0.312536343
32 -0.312536343 -0.017738250
33 -0.047169924 -0.312536343
34 -0.327252180 -0.047169924
35 -0.032454087 -0.327252180
36 0.013888032 -0.032454087
37 -0.314730951 0.013888032
38 -0.111099002 -0.314730951
39 -0.327252180 -0.111099002
40 0.727221951 -0.327252180
41 -0.270583441 0.727221951
42 0.650771644 -0.270583441
43 0.741937788 0.650771644
44 0.658031983 0.741937788
45 -0.073535317 0.658031983
46 -0.167767741 -0.073535317
47 -0.019932859 -0.167767741
48 0.822777311 -0.019932859
49 0.731611168 0.822777311
50 -0.302209723 0.731611168
51 -0.302209723 -0.302209723
52 2.604429525 -0.302209723
53 -0.258062212 2.604429525
54 -0.243346375 -0.258062212
55 -0.469826173 -0.243346375
56 -0.128009448 -0.469826173
57 -0.349228356 -0.128009448
58 -0.221370200 -0.349228356
59 -0.283104669 -0.221370200
60 -0.288691349 -0.283104669
61 -0.063490701 -0.288691349
62 -0.577043885 -0.063490701
63 1.049109622 -0.577043885
64 -0.030113533 1.049109622
65 2.395706646 -0.030113533
66 -0.147764360 2.395706646
67 -0.115464388 -0.147764360
68 0.422956115 -0.115464388
69 -0.239242913 0.422956115
70 -0.320991321 -0.239242913
71 0.027987852 -0.320991321
72 -0.689644208 0.027987852
73 0.654284462 -0.689644208
74 0.247203903 0.654284462
75 -0.637670522 0.247203903
76 0.620907294 -0.637670522
77 -0.367914504 0.620907294
78 0.481057501 -0.367914504
79 0.136985728 0.481057501
80 -0.371516952 0.136985728
81 -0.063490701 -0.371516952
82 0.136985728 -0.063490701
83 -0.038766484 0.136985728
84 -0.322068517 -0.038766484
85 -0.522544946 -0.322068517
86 -0.318466069 -0.522544946
87 -0.176091025 -0.318466069
88 -0.327119019 -0.176091025
89 0.544209389 -0.327119019
90 -0.294819048 0.544209389
91 -0.063490701 -0.294819048
92 0.681533931 -0.063490701
93 -0.117989639 0.681533931
94 -0.577043885 -0.117989639
95 -0.428541141 -0.577043885
96 -0.346792734 -0.428541141
97 0.535556439 -0.346792734
98 -0.664919991 0.535556439
99 -0.689644208 -0.664919991
100 -0.513891996 -0.689644208
101 1.389578948 -0.513891996
102 0.882010361 1.389578948
103 0.568933607 0.882010361
104 -0.121592087 0.568933607
105 -0.205865746 -0.121592087
106 -0.233115215 -0.205865746
107 -0.434668840 -0.233115215
108 0.109736259 -0.434668840
109 1.368457177 0.109736259
110 0.051634874 1.368457177
111 0.027987852 0.051634874
112 -0.057363002 0.027987852
113 -0.151366807 -0.057363002
114 -0.001786868 -0.151366807
115 -0.407419371 -0.001786868
116 -0.494218281 -0.407419371
117 -0.178616276 -0.494218281
118 -0.233115215 -0.178616276
119 -0.262889935 -0.233115215
120 -0.315940818 -0.262889935
121 -0.151366807 -0.315940818
122 1.273376176 -0.151366807
123 0.598708328 1.273376176
124 0.742160568 0.598708328
125 -0.518942499 0.742160568
126 0.085012042 -0.518942499
127 -0.838146951 0.085012042
128 -0.228064712 -0.838146951
129 -0.063490701 -0.228064712
130 0.570381663 -0.063490701
131 -0.437194092 0.570381663
132 -0.343190287 -0.437194092
133 -0.491693030 -0.343190287
134 0.024385405 -0.491693030
135 -0.549794415 0.024385405
136 0.024385405 -0.549794415
137 -0.230589963 0.024385405
138 -0.579569136 -0.230589963
139 -0.036241232 -0.579569136
140 -0.320991321 -0.036241232
141 0.679008679 -0.320991321
142 -0.257839432 0.679008679
143 -0.315940818 -0.257839432
144 0.136985728 -0.315940818
145 -0.145239109 0.136985728
146 -0.057363002 -0.145239109
147 -0.063490701 -0.057363002
148 0.703732897 -0.063490701
149 -0.494218281 0.703732897
150 1.337605261 -0.494218281
151 0.027987852 1.337605261
> 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/7y6rd1292769564.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/rcomp/tmp/8y6rd1292769564.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/rcomp/tmp/9rfqg1292769564.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/rcomp/tmp/10rfqg1292769564.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/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/11uf641292769564.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/12yy5a1292769564.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/13bpk01292769564.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/14f8161292769564.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/15i90d1292769564.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/16w0f31292769564.tab")
+ }
>
> try(system("convert tmp/1kebm1292769564.ps tmp/1kebm1292769564.png",intern=TRUE))
character(0)
> try(system("convert tmp/2dnap1292769564.ps tmp/2dnap1292769564.png",intern=TRUE))
character(0)
> try(system("convert tmp/3dnap1292769564.ps tmp/3dnap1292769564.png",intern=TRUE))
character(0)
> try(system("convert tmp/4dnap1292769564.ps tmp/4dnap1292769564.png",intern=TRUE))
character(0)
> try(system("convert tmp/5dnap1292769564.ps tmp/5dnap1292769564.png",intern=TRUE))
character(0)
> try(system("convert tmp/65wrs1292769564.ps tmp/65wrs1292769564.png",intern=TRUE))
character(0)
> try(system("convert tmp/7y6rd1292769564.ps tmp/7y6rd1292769564.png",intern=TRUE))
character(0)
> try(system("convert tmp/8y6rd1292769564.ps tmp/8y6rd1292769564.png",intern=TRUE))
character(0)
> try(system("convert tmp/9rfqg1292769564.ps tmp/9rfqg1292769564.png",intern=TRUE))
character(0)
> try(system("convert tmp/10rfqg1292769564.ps tmp/10rfqg1292769564.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.106 1.759 9.619