R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
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(4
+ ,1
+ ,3
+ ,6
+ ,0
+ ,7
+ ,0
+ ,4
+ ,0
+ ,4
+ ,6
+ ,0
+ ,8
+ ,0
+ ,4
+ ,0
+ ,4
+ ,6
+ ,0
+ ,8
+ ,0
+ ,4
+ ,0
+ ,4
+ ,6
+ ,0
+ ,8
+ ,0
+ ,4
+ ,0
+ ,4
+ ,6
+ ,0
+ ,8
+ ,0
+ ,4
+ ,1
+ ,4
+ ,6
+ ,1
+ ,7
+ ,0
+ ,4
+ ,0
+ ,4
+ ,6
+ ,0
+ ,8
+ ,0
+ ,4
+ ,0
+ ,3
+ ,6
+ ,0
+ ,8
+ ,0
+ ,4
+ ,0
+ ,4
+ ,6
+ ,0
+ ,7
+ ,0
+ ,4
+ ,1
+ ,4
+ ,6
+ ,0
+ ,8
+ ,0
+ ,4
+ ,1
+ ,3
+ ,6
+ ,0
+ ,8
+ ,0
+ ,4
+ ,0
+ ,4
+ ,6
+ ,0
+ ,8
+ ,0
+ ,4
+ ,0
+ ,4
+ ,5
+ ,1
+ ,8
+ ,0
+ ,4
+ ,1
+ ,3
+ ,6
+ ,0
+ ,8
+ ,0
+ ,4
+ ,0
+ ,4
+ ,5
+ ,1
+ ,7
+ ,0
+ ,4
+ ,0
+ ,3
+ ,5
+ ,1
+ ,7
+ ,0
+ ,4
+ ,1
+ ,3
+ ,5
+ ,1
+ ,8
+ ,1
+ ,4
+ ,1
+ ,3
+ ,6
+ ,0
+ ,8
+ ,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+ ,0
+ ,2
+ ,0
+ ,0
+ ,5
+ ,0
+ ,7
+ ,1
+ ,2
+ ,0
+ ,0
+ ,5
+ ,0
+ ,7
+ ,0
+ ,2
+ ,1
+ ,0
+ ,6
+ ,0
+ ,8
+ ,0
+ ,2
+ ,0
+ ,0
+ ,6
+ ,1
+ ,7
+ ,0
+ ,2
+ ,0
+ ,0
+ ,6
+ ,1
+ ,8
+ ,0
+ ,2
+ ,0
+ ,0
+ ,6
+ ,0
+ ,7
+ ,0
+ ,2
+ ,0
+ ,0
+ ,5
+ ,0
+ ,8
+ ,0
+ ,2
+ ,0
+ ,0
+ ,6
+ ,0
+ ,8
+ ,0
+ ,2
+ ,1
+ ,0
+ ,6
+ ,0
+ ,8
+ ,0
+ ,2
+ ,0
+ ,0
+ ,6
+ ,1
+ ,7
+ ,0
+ ,2
+ ,0
+ ,0
+ ,6
+ ,0
+ ,7
+ ,0
+ ,2
+ ,1
+ ,0
+ ,5
+ ,0
+ ,8
+ ,1
+ ,2
+ ,1
+ ,0
+ ,5
+ ,1
+ ,8
+ ,1
+ ,2
+ ,1
+ ,0
+ ,5
+ ,0
+ ,8
+ ,0)
+ ,dim=c(7
+ ,154)
+ ,dimnames=list(c('Weeks'
+ ,'UsedLimit'
+ ,'T40'
+ ,'Used'
+ ,'Useful'
+ ,'Outcome'
+ ,'CorrectAnalysis')
+ ,1:154))
> y <- array(NA,dim=c(7,154),dimnames=list(c('Weeks','UsedLimit','T40','Used','Useful','Outcome','CorrectAnalysis'),1:154))
> 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 = '7'
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) 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
CorrectAnalysis Weeks UsedLimit T40 Used Useful Outcome
1 0 4 1 3 6 0 7
2 0 4 0 4 6 0 8
3 0 4 0 4 6 0 8
4 0 4 0 4 6 0 8
5 0 4 0 4 6 0 8
6 0 4 1 4 6 1 7
7 0 4 0 4 6 0 8
8 0 4 0 3 6 0 8
9 0 4 0 4 6 0 7
10 0 4 1 4 6 0 8
11 0 4 1 3 6 0 8
12 0 4 0 4 6 0 8
13 0 4 0 4 5 1 8
14 0 4 1 3 6 0 8
15 0 4 0 4 5 1 7
16 0 4 0 3 5 1 7
17 1 4 1 3 5 1 8
18 0 4 1 3 6 0 8
19 0 4 0 4 6 0 7
20 1 4 0 3 5 1 7
21 0 4 1 4 6 1 8
22 0 4 1 4 5 1 7
23 0 4 0 4 6 1 7
24 0 4 1 4 6 1 7
25 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0 2 0 0 6 0 8
90 0 2 0 0 6 0 7
91 0 2 0 0 6 1 8
92 0 2 1 0 6 0 8
93 0 2 1 0 6 1 8
94 0 2 0 0 6 0 8
95 0 2 0 0 6 0 8
96 0 2 0 0 6 0 7
97 0 2 1 0 6 0 8
98 0 2 0 0 6 0 8
99 0 2 1 0 6 0 8
100 0 2 0 0 6 0 7
101 0 2 1 0 6 0 7
102 0 2 0 0 6 0 8
103 0 2 0 0 6 0 8
104 0 2 0 0 6 0 8
105 0 2 0 0 5 0 8
106 0 2 0 0 6 0 8
107 0 2 0 0 6 0 8
108 0 2 1 0 5 0 8
109 0 2 0 0 6 0 8
110 0 2 1 0 6 0 8
111 0 2 1 0 5 1 8
112 0 2 0 0 6 0 8
113 0 2 0 0 5 0 8
114 0 2 1 0 5 0 8
115 0 2 1 0 6 0 8
116 0 2 0 0 6 0 8
117 0 2 1 0 6 0 7
118 0 2 1 0 6 0 8
119 0 2 0 0 6 0 8
120 0 2 0 0 6 0 7
121 0 2 1 0 6 0 8
122 0 2 0 0 6 0 8
123 0 2 1 0 5 0 8
124 0 2 0 0 5 1 7
125 0 2 0 0 6 0 7
126 0 2 0 0 6 0 8
127 0 2 0 0 6 1 8
128 0 2 0 0 6 0 7
129 0 2 0 0 6 0 8
130 0 2 0 0 6 0 7
131 0 2 1 0 6 0 8
132 0 2 1 0 6 0 7
133 0 2 1 0 5 0 8
134 0 2 0 0 6 0 8
135 0 2 0 0 6 0 8
136 0 2 0 0 6 0 8
137 0 2 1 0 5 1 7
138 0 2 1 0 5 1 7
139 0 2 0 0 6 0 8
140 0 2 0 0 6 0 8
141 1 2 0 0 5 0 7
142 0 2 0 0 5 0 7
143 0 2 1 0 6 0 8
144 0 2 0 0 6 1 7
145 0 2 0 0 6 1 8
146 0 2 0 0 6 0 7
147 0 2 0 0 5 0 8
148 0 2 0 0 6 0 8
149 0 2 1 0 6 0 8
150 0 2 0 0 6 1 7
151 0 2 0 0 6 0 7
152 1 2 1 0 5 0 8
153 1 2 1 0 5 1 8
154 0 2 1 0 5 0 8
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Weeks UsedLimit T40 Used Useful
0.53369 0.32090 -0.01391 -0.16220 -0.23725 0.05050
Outcome
0.02990
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.42024 -0.13249 0.00881 0.02971 0.80146
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.53369 0.47061 1.134 0.25863
Weeks 0.32090 0.11245 2.854 0.00495 **
UsedLimit -0.01391 0.04205 -0.331 0.74119
T40 -0.16220 0.05929 -2.736 0.00699 **
Used -0.23725 0.04397 -5.396 2.67e-07 ***
Useful 0.05050 0.04602 1.097 0.27435
Outcome 0.02990 0.04004 0.747 0.45641
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2364 on 147 degrees of freedom
Multiple R-squared: 0.2577, Adjusted R-squared: 0.2274
F-statistic: 8.504 on 6 and 147 DF, p-value: 6.226e-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.0000000000 0.0000000000 1.000000000
[2,] 0.0000000000 0.0000000000 1.000000000
[3,] 0.0000000000 0.0000000000 1.000000000
[4,] 0.0000000000 0.0000000000 1.000000000
[5,] 0.0000000000 0.0000000000 1.000000000
[6,] 0.0000000000 0.0000000000 1.000000000
[7,] 0.0000000000 0.0000000000 1.000000000
[8,] 0.4349212398 0.8698424796 0.565078760
[9,] 0.3860876608 0.7721753215 0.613912339
[10,] 0.3512631843 0.7025263686 0.648736816
[11,] 0.8426405370 0.3147189260 0.157359463
[12,] 0.7912499187 0.4175001626 0.208750081
[13,] 0.7775542659 0.4448914683 0.222445734
[14,] 0.7174996446 0.5650007108 0.282500355
[15,] 0.6530403334 0.6939193331 0.346959667
[16,] 0.6551921231 0.6896157539 0.344807877
[17,] 0.6564633291 0.6870733418 0.343536671
[18,] 0.6147820131 0.7704359738 0.385217987
[19,] 0.5602022219 0.8795955561 0.439797778
[20,] 0.5065322493 0.9869355014 0.493467751
[21,] 0.4484660499 0.8969320998 0.551533950
[22,] 0.3888826663 0.7777653327 0.611117334
[23,] 0.3326229799 0.6652459599 0.667377020
[24,] 0.2808026990 0.5616053980 0.719197301
[25,] 0.2402218822 0.4804437644 0.759778118
[26,] 0.1969491893 0.3938983786 0.803050811
[27,] 0.1588149993 0.3176299986 0.841185001
[28,] 0.2218880778 0.4437761556 0.778111922
[29,] 0.1874762890 0.3749525780 0.812523711
[30,] 0.1510425749 0.3020851498 0.848957425
[31,] 0.1465410345 0.2930820691 0.853458965
[32,] 0.6646945995 0.6706108010 0.335305400
[33,] 0.6335846805 0.7328306389 0.366415319
[34,] 0.5825625049 0.8348749902 0.417437495
[35,] 0.5447477858 0.9105044284 0.455252214
[36,] 0.4929928384 0.9859856767 0.507007162
[37,] 0.4416757546 0.8833515092 0.558324245
[38,] 0.3915561901 0.7831123802 0.608443810
[39,] 0.3429487485 0.6858974969 0.657051252
[40,] 0.2973150307 0.5946300613 0.702684969
[41,] 0.2547866363 0.5095732726 0.745213364
[42,] 0.3109201250 0.6218402500 0.689079875
[43,] 0.5842462236 0.8315075529 0.415753776
[44,] 0.5379345232 0.9241309535 0.462065477
[45,] 0.9068913542 0.1862172915 0.093108646
[46,] 0.8845356419 0.2309287163 0.115464358
[47,] 0.9213881932 0.1572236135 0.078611807
[48,] 0.9200770523 0.1598458954 0.079922948
[49,] 0.9019011667 0.1961976666 0.098098833
[50,] 0.8807678627 0.2384642746 0.119232137
[51,] 0.9596842700 0.0806314600 0.040315730
[52,] 0.9544453564 0.0911092873 0.045554644
[53,] 0.9564002348 0.0871995304 0.043599765
[54,] 0.9442901420 0.1114197160 0.055709858
[55,] 0.9425493759 0.1149012483 0.057450624
[56,] 0.9275878347 0.1448243306 0.072412165
[57,] 0.9097956256 0.1804087488 0.090204374
[58,] 0.9627613188 0.0744773624 0.037238681
[59,] 0.9519671731 0.0960656537 0.048032827
[60,] 0.9396885452 0.1206229096 0.060311455
[61,] 0.9377293666 0.1245412668 0.062270633
[62,] 0.9219104194 0.1561791613 0.078089581
[63,] 0.9040464438 0.1919071124 0.095953556
[64,] 0.8990967115 0.2018065770 0.100903288
[65,] 0.8978907139 0.2042185723 0.102109286
[66,] 0.8766394737 0.2467210526 0.123360526
[67,] 0.8769671780 0.2460656439 0.123032822
[68,] 0.8531102070 0.2937795860 0.146889793
[69,] 0.8596615389 0.2806769222 0.140338461
[70,] 0.9597576003 0.0804847994 0.040242400
[71,] 0.9516226537 0.0967546926 0.048377346
[72,] 0.9410101423 0.1179797154 0.058989858
[73,] 0.9478226260 0.1043547479 0.052177374
[74,] 0.9435363741 0.1129272519 0.056463626
[75,] 0.9943282737 0.0113434526 0.005671726
[76,] 0.9919984148 0.0160031705 0.008001585
[77,] 0.9888811653 0.0222376695 0.011118835
[78,] 0.9847168807 0.0305662385 0.015283119
[79,] 0.9829227761 0.0341544479 0.017077224
[80,] 0.9770792096 0.0458415807 0.022920790
[81,] 0.9697515117 0.0604969766 0.030248488
[82,] 0.9602184431 0.0795631139 0.039781557
[83,] 0.9483797970 0.1032404061 0.051620203
[84,] 0.9337657655 0.1324684690 0.066234235
[85,] 0.9160683127 0.1678633745 0.083931687
[86,] 0.8949450442 0.2101099115 0.105054956
[87,] 0.8706492642 0.2587014716 0.129350736
[88,] 0.8420774991 0.3158450017 0.157922501
[89,] 0.8093975255 0.3812049490 0.190602474
[90,] 0.7728383148 0.4543233704 0.227161685
[91,] 0.7329317014 0.5341365972 0.267068299
[92,] 0.6899397092 0.6201205816 0.310060291
[93,] 0.6429321539 0.7141356922 0.357067846
[94,] 0.5934399632 0.8131200735 0.406560037
[95,] 0.5421858986 0.9156282028 0.457814101
[96,] 0.5287621955 0.9424756091 0.471237805
[97,] 0.4762373878 0.9524747755 0.523762612
[98,] 0.4238607541 0.8477215082 0.576139246
[99,] 0.4110561009 0.8221122017 0.588943899
[100,] 0.3598919188 0.7197838376 0.640108081
[101,] 0.3111241317 0.6222482634 0.688875868
[102,] 0.3089696569 0.6179393138 0.691030343
[103,] 0.2626181498 0.5252362996 0.737381850
[104,] 0.2568994621 0.5137989241 0.743100538
[105,] 0.2574435082 0.5148870164 0.742556492
[106,] 0.2150520228 0.4301040456 0.784947977
[107,] 0.1763104564 0.3526209127 0.823689544
[108,] 0.1430750341 0.2861500683 0.856924966
[109,] 0.1134800909 0.2269601817 0.886519909
[110,] 0.0881499584 0.1762999168 0.911850042
[111,] 0.0674170537 0.1348341075 0.932582946
[112,] 0.0504119235 0.1008238470 0.949588076
[113,] 0.0368095048 0.0736190096 0.963190495
[114,] 0.0395951263 0.0791902526 0.960404874
[115,] 0.0402958965 0.0805917931 0.959704103
[116,] 0.0288117824 0.0576235648 0.971188218
[117,] 0.0199599984 0.0399199968 0.980040002
[118,] 0.0135237331 0.0270474663 0.986476267
[119,] 0.0089511184 0.0179022368 0.991048882
[120,] 0.0057060849 0.0114121697 0.994293915
[121,] 0.0035643309 0.0071286617 0.996435669
[122,] 0.0021325814 0.0042651628 0.997867419
[123,] 0.0012832798 0.0025665596 0.998716720
[124,] 0.0017130521 0.0034261042 0.998286948
[125,] 0.0009532549 0.0019065099 0.999046745
[126,] 0.0005088941 0.0010177883 0.999491106
[127,] 0.0002599680 0.0005199360 0.999740032
[128,] 0.0003423959 0.0006847918 0.999657604
[129,] 0.0020310590 0.0040621179 0.997968941
[130,] 0.0011627972 0.0023255944 0.998837203
[131,] 0.0007154460 0.0014308919 0.999284554
[132,] 0.0238647878 0.0477295756 0.976135212
[133,] 0.0177422232 0.0354844464 0.982257777
[134,] 0.0094093366 0.0188186733 0.990590663
[135,] 0.0043682206 0.0087364411 0.995631779
> postscript(file="/var/wessaorg/rcomp/tmp/19ujw1355681359.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/2al751355681359.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/37ta91355681359.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/4vomy1355681359.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/51u4g1355681359.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 = 154
Frequency = 1
1 2 3 4 5 6
-0.102587035 0.015796654 0.015796654 0.015796654 0.015796654 0.009115597
7 8 9 10 11 12
0.015796654 -0.146401251 0.045697898 0.029709625 -0.132488280 0.015796654
13 14 15 16 17 18
-0.271950880 -0.132488280 -0.242049636 -0.404247540 0.579764186 -0.132488280
19 20 21 22 23 24
0.045697898 0.595752460 -0.020785647 -0.228136665 -0.004797374 0.009115597
25 26 27 28 29 30
-0.353752268 -0.271950880 0.059610869 -0.221455609 0.045697898 -0.034698618
31 32 33 34 35 36
0.015796654 0.029709625 -0.020785647 -0.116500006 0.015796654 0.015796654
37 38 39 40 41 42
-0.420235814 -0.191554364 -0.004797374 -0.196896523 0.757950364 -0.191554364
43 44 45 46 47 48
0.009115597 -0.132488280 -0.034698618 -0.004797374 0.015796654 0.045697898
49 50 51 52 53 54
-0.004797374 0.015796654 -0.383653513 0.579764186 0.045697898 0.778544391
55 56 57 58 59 60
0.015796654 -0.353752268 -0.242049636 0.045697898 0.045697898 0.609665431
61 62 63 64 65 66
-0.102587035 -0.271950880 0.015796654 -0.102587035 0.015796654 0.015796654
67 68 69 70 71 72
0.565851215 0.029709625 0.045697898 -0.221455609 0.015796654 0.045697898
73 74 75 76 77 78
-0.191554364 -0.207542638 0.045697898 -0.166995278 0.045697898 -0.242049636
79 80 81 82 83 84
0.646247732 -0.196896523 0.015796654 -0.177641393 0.015796654 0.778544391
85 86 87 88 89 90
-0.004797374 0.029709625 0.052624114 -0.184628148 0.008809898 0.038711143
91 92 93 94 95 96
-0.041685374 0.022722869 -0.027772403 0.008809898 0.008809898 0.038711143
97 98 99 100 101 102
0.022722869 0.008809898 0.022722869 0.038711143 0.052624114 0.008809898
103 104 105 106 107 108
0.008809898 0.008809898 -0.228442364 0.008809898 0.008809898 -0.214529393
109 110 111 112 113 114
0.008809898 0.022722869 -0.265024665 0.008809898 -0.228442364 -0.214529393
115 116 117 118 119 120
0.022722869 0.008809898 0.052624114 0.022722869 0.008809898 0.038711143
121 122 123 124 125 126
0.022722869 0.008809898 -0.214529393 -0.249036391 0.038711143 0.008809898
127 128 129 130 131 132
-0.041685374 0.038711143 0.008809898 0.038711143 0.022722869 0.052624114
133 134 135 136 137 138
-0.214529393 0.008809898 0.008809898 0.008809898 -0.235123420 -0.235123420
139 140 141 142 143 144
0.008809898 0.008809898 0.801458881 -0.198541119 0.022722869 -0.011784129
145 146 147 148 149 150
-0.041685374 0.038711143 -0.228442364 0.008809898 0.022722869 -0.011784129
151 152 153 154
0.038711143 0.785470607 0.734975335 -0.214529393
> postscript(file="/var/wessaorg/rcomp/tmp/67tej1355681359.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 = 154
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.102587035 NA
1 0.015796654 -0.102587035
2 0.015796654 0.015796654
3 0.015796654 0.015796654
4 0.015796654 0.015796654
5 0.009115597 0.015796654
6 0.015796654 0.009115597
7 -0.146401251 0.015796654
8 0.045697898 -0.146401251
9 0.029709625 0.045697898
10 -0.132488280 0.029709625
11 0.015796654 -0.132488280
12 -0.271950880 0.015796654
13 -0.132488280 -0.271950880
14 -0.242049636 -0.132488280
15 -0.404247540 -0.242049636
16 0.579764186 -0.404247540
17 -0.132488280 0.579764186
18 0.045697898 -0.132488280
19 0.595752460 0.045697898
20 -0.020785647 0.595752460
21 -0.228136665 -0.020785647
22 -0.004797374 -0.228136665
23 0.009115597 -0.004797374
24 -0.353752268 0.009115597
25 -0.271950880 -0.353752268
26 0.059610869 -0.271950880
27 -0.221455609 0.059610869
28 0.045697898 -0.221455609
29 -0.034698618 0.045697898
30 0.015796654 -0.034698618
31 0.029709625 0.015796654
32 -0.020785647 0.029709625
33 -0.116500006 -0.020785647
34 0.015796654 -0.116500006
35 0.015796654 0.015796654
36 -0.420235814 0.015796654
37 -0.191554364 -0.420235814
38 -0.004797374 -0.191554364
39 -0.196896523 -0.004797374
40 0.757950364 -0.196896523
41 -0.191554364 0.757950364
42 0.009115597 -0.191554364
43 -0.132488280 0.009115597
44 -0.034698618 -0.132488280
45 -0.004797374 -0.034698618
46 0.015796654 -0.004797374
47 0.045697898 0.015796654
48 -0.004797374 0.045697898
49 0.015796654 -0.004797374
50 -0.383653513 0.015796654
51 0.579764186 -0.383653513
52 0.045697898 0.579764186
53 0.778544391 0.045697898
54 0.015796654 0.778544391
55 -0.353752268 0.015796654
56 -0.242049636 -0.353752268
57 0.045697898 -0.242049636
58 0.045697898 0.045697898
59 0.609665431 0.045697898
60 -0.102587035 0.609665431
61 -0.271950880 -0.102587035
62 0.015796654 -0.271950880
63 -0.102587035 0.015796654
64 0.015796654 -0.102587035
65 0.015796654 0.015796654
66 0.565851215 0.015796654
67 0.029709625 0.565851215
68 0.045697898 0.029709625
69 -0.221455609 0.045697898
70 0.015796654 -0.221455609
71 0.045697898 0.015796654
72 -0.191554364 0.045697898
73 -0.207542638 -0.191554364
74 0.045697898 -0.207542638
75 -0.166995278 0.045697898
76 0.045697898 -0.166995278
77 -0.242049636 0.045697898
78 0.646247732 -0.242049636
79 -0.196896523 0.646247732
80 0.015796654 -0.196896523
81 -0.177641393 0.015796654
82 0.015796654 -0.177641393
83 0.778544391 0.015796654
84 -0.004797374 0.778544391
85 0.029709625 -0.004797374
86 0.052624114 0.029709625
87 -0.184628148 0.052624114
88 0.008809898 -0.184628148
89 0.038711143 0.008809898
90 -0.041685374 0.038711143
91 0.022722869 -0.041685374
92 -0.027772403 0.022722869
93 0.008809898 -0.027772403
94 0.008809898 0.008809898
95 0.038711143 0.008809898
96 0.022722869 0.038711143
97 0.008809898 0.022722869
98 0.022722869 0.008809898
99 0.038711143 0.022722869
100 0.052624114 0.038711143
101 0.008809898 0.052624114
102 0.008809898 0.008809898
103 0.008809898 0.008809898
104 -0.228442364 0.008809898
105 0.008809898 -0.228442364
106 0.008809898 0.008809898
107 -0.214529393 0.008809898
108 0.008809898 -0.214529393
109 0.022722869 0.008809898
110 -0.265024665 0.022722869
111 0.008809898 -0.265024665
112 -0.228442364 0.008809898
113 -0.214529393 -0.228442364
114 0.022722869 -0.214529393
115 0.008809898 0.022722869
116 0.052624114 0.008809898
117 0.022722869 0.052624114
118 0.008809898 0.022722869
119 0.038711143 0.008809898
120 0.022722869 0.038711143
121 0.008809898 0.022722869
122 -0.214529393 0.008809898
123 -0.249036391 -0.214529393
124 0.038711143 -0.249036391
125 0.008809898 0.038711143
126 -0.041685374 0.008809898
127 0.038711143 -0.041685374
128 0.008809898 0.038711143
129 0.038711143 0.008809898
130 0.022722869 0.038711143
131 0.052624114 0.022722869
132 -0.214529393 0.052624114
133 0.008809898 -0.214529393
134 0.008809898 0.008809898
135 0.008809898 0.008809898
136 -0.235123420 0.008809898
137 -0.235123420 -0.235123420
138 0.008809898 -0.235123420
139 0.008809898 0.008809898
140 0.801458881 0.008809898
141 -0.198541119 0.801458881
142 0.022722869 -0.198541119
143 -0.011784129 0.022722869
144 -0.041685374 -0.011784129
145 0.038711143 -0.041685374
146 -0.228442364 0.038711143
147 0.008809898 -0.228442364
148 0.022722869 0.008809898
149 -0.011784129 0.022722869
150 0.038711143 -0.011784129
151 0.785470607 0.038711143
152 0.734975335 0.785470607
153 -0.214529393 0.734975335
154 NA -0.214529393
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.015796654 -0.102587035
[2,] 0.015796654 0.015796654
[3,] 0.015796654 0.015796654
[4,] 0.015796654 0.015796654
[5,] 0.009115597 0.015796654
[6,] 0.015796654 0.009115597
[7,] -0.146401251 0.015796654
[8,] 0.045697898 -0.146401251
[9,] 0.029709625 0.045697898
[10,] -0.132488280 0.029709625
[11,] 0.015796654 -0.132488280
[12,] -0.271950880 0.015796654
[13,] -0.132488280 -0.271950880
[14,] -0.242049636 -0.132488280
[15,] -0.404247540 -0.242049636
[16,] 0.579764186 -0.404247540
[17,] -0.132488280 0.579764186
[18,] 0.045697898 -0.132488280
[19,] 0.595752460 0.045697898
[20,] -0.020785647 0.595752460
[21,] -0.228136665 -0.020785647
[22,] -0.004797374 -0.228136665
[23,] 0.009115597 -0.004797374
[24,] -0.353752268 0.009115597
[25,] -0.271950880 -0.353752268
[26,] 0.059610869 -0.271950880
[27,] -0.221455609 0.059610869
[28,] 0.045697898 -0.221455609
[29,] -0.034698618 0.045697898
[30,] 0.015796654 -0.034698618
[31,] 0.029709625 0.015796654
[32,] -0.020785647 0.029709625
[33,] -0.116500006 -0.020785647
[34,] 0.015796654 -0.116500006
[35,] 0.015796654 0.015796654
[36,] -0.420235814 0.015796654
[37,] -0.191554364 -0.420235814
[38,] -0.004797374 -0.191554364
[39,] -0.196896523 -0.004797374
[40,] 0.757950364 -0.196896523
[41,] -0.191554364 0.757950364
[42,] 0.009115597 -0.191554364
[43,] -0.132488280 0.009115597
[44,] -0.034698618 -0.132488280
[45,] -0.004797374 -0.034698618
[46,] 0.015796654 -0.004797374
[47,] 0.045697898 0.015796654
[48,] -0.004797374 0.045697898
[49,] 0.015796654 -0.004797374
[50,] -0.383653513 0.015796654
[51,] 0.579764186 -0.383653513
[52,] 0.045697898 0.579764186
[53,] 0.778544391 0.045697898
[54,] 0.015796654 0.778544391
[55,] -0.353752268 0.015796654
[56,] -0.242049636 -0.353752268
[57,] 0.045697898 -0.242049636
[58,] 0.045697898 0.045697898
[59,] 0.609665431 0.045697898
[60,] -0.102587035 0.609665431
[61,] -0.271950880 -0.102587035
[62,] 0.015796654 -0.271950880
[63,] -0.102587035 0.015796654
[64,] 0.015796654 -0.102587035
[65,] 0.015796654 0.015796654
[66,] 0.565851215 0.015796654
[67,] 0.029709625 0.565851215
[68,] 0.045697898 0.029709625
[69,] -0.221455609 0.045697898
[70,] 0.015796654 -0.221455609
[71,] 0.045697898 0.015796654
[72,] -0.191554364 0.045697898
[73,] -0.207542638 -0.191554364
[74,] 0.045697898 -0.207542638
[75,] -0.166995278 0.045697898
[76,] 0.045697898 -0.166995278
[77,] -0.242049636 0.045697898
[78,] 0.646247732 -0.242049636
[79,] -0.196896523 0.646247732
[80,] 0.015796654 -0.196896523
[81,] -0.177641393 0.015796654
[82,] 0.015796654 -0.177641393
[83,] 0.778544391 0.015796654
[84,] -0.004797374 0.778544391
[85,] 0.029709625 -0.004797374
[86,] 0.052624114 0.029709625
[87,] -0.184628148 0.052624114
[88,] 0.008809898 -0.184628148
[89,] 0.038711143 0.008809898
[90,] -0.041685374 0.038711143
[91,] 0.022722869 -0.041685374
[92,] -0.027772403 0.022722869
[93,] 0.008809898 -0.027772403
[94,] 0.008809898 0.008809898
[95,] 0.038711143 0.008809898
[96,] 0.022722869 0.038711143
[97,] 0.008809898 0.022722869
[98,] 0.022722869 0.008809898
[99,] 0.038711143 0.022722869
[100,] 0.052624114 0.038711143
[101,] 0.008809898 0.052624114
[102,] 0.008809898 0.008809898
[103,] 0.008809898 0.008809898
[104,] -0.228442364 0.008809898
[105,] 0.008809898 -0.228442364
[106,] 0.008809898 0.008809898
[107,] -0.214529393 0.008809898
[108,] 0.008809898 -0.214529393
[109,] 0.022722869 0.008809898
[110,] -0.265024665 0.022722869
[111,] 0.008809898 -0.265024665
[112,] -0.228442364 0.008809898
[113,] -0.214529393 -0.228442364
[114,] 0.022722869 -0.214529393
[115,] 0.008809898 0.022722869
[116,] 0.052624114 0.008809898
[117,] 0.022722869 0.052624114
[118,] 0.008809898 0.022722869
[119,] 0.038711143 0.008809898
[120,] 0.022722869 0.038711143
[121,] 0.008809898 0.022722869
[122,] -0.214529393 0.008809898
[123,] -0.249036391 -0.214529393
[124,] 0.038711143 -0.249036391
[125,] 0.008809898 0.038711143
[126,] -0.041685374 0.008809898
[127,] 0.038711143 -0.041685374
[128,] 0.008809898 0.038711143
[129,] 0.038711143 0.008809898
[130,] 0.022722869 0.038711143
[131,] 0.052624114 0.022722869
[132,] -0.214529393 0.052624114
[133,] 0.008809898 -0.214529393
[134,] 0.008809898 0.008809898
[135,] 0.008809898 0.008809898
[136,] -0.235123420 0.008809898
[137,] -0.235123420 -0.235123420
[138,] 0.008809898 -0.235123420
[139,] 0.008809898 0.008809898
[140,] 0.801458881 0.008809898
[141,] -0.198541119 0.801458881
[142,] 0.022722869 -0.198541119
[143,] -0.011784129 0.022722869
[144,] -0.041685374 -0.011784129
[145,] 0.038711143 -0.041685374
[146,] -0.228442364 0.038711143
[147,] 0.008809898 -0.228442364
[148,] 0.022722869 0.008809898
[149,] -0.011784129 0.022722869
[150,] 0.038711143 -0.011784129
[151,] 0.785470607 0.038711143
[152,] 0.734975335 0.785470607
[153,] -0.214529393 0.734975335
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.015796654 -0.102587035
2 0.015796654 0.015796654
3 0.015796654 0.015796654
4 0.015796654 0.015796654
5 0.009115597 0.015796654
6 0.015796654 0.009115597
7 -0.146401251 0.015796654
8 0.045697898 -0.146401251
9 0.029709625 0.045697898
10 -0.132488280 0.029709625
11 0.015796654 -0.132488280
12 -0.271950880 0.015796654
13 -0.132488280 -0.271950880
14 -0.242049636 -0.132488280
15 -0.404247540 -0.242049636
16 0.579764186 -0.404247540
17 -0.132488280 0.579764186
18 0.045697898 -0.132488280
19 0.595752460 0.045697898
20 -0.020785647 0.595752460
21 -0.228136665 -0.020785647
22 -0.004797374 -0.228136665
23 0.009115597 -0.004797374
24 -0.353752268 0.009115597
25 -0.271950880 -0.353752268
26 0.059610869 -0.271950880
27 -0.221455609 0.059610869
28 0.045697898 -0.221455609
29 -0.034698618 0.045697898
30 0.015796654 -0.034698618
31 0.029709625 0.015796654
32 -0.020785647 0.029709625
33 -0.116500006 -0.020785647
34 0.015796654 -0.116500006
35 0.015796654 0.015796654
36 -0.420235814 0.015796654
37 -0.191554364 -0.420235814
38 -0.004797374 -0.191554364
39 -0.196896523 -0.004797374
40 0.757950364 -0.196896523
41 -0.191554364 0.757950364
42 0.009115597 -0.191554364
43 -0.132488280 0.009115597
44 -0.034698618 -0.132488280
45 -0.004797374 -0.034698618
46 0.015796654 -0.004797374
47 0.045697898 0.015796654
48 -0.004797374 0.045697898
49 0.015796654 -0.004797374
50 -0.383653513 0.015796654
51 0.579764186 -0.383653513
52 0.045697898 0.579764186
53 0.778544391 0.045697898
54 0.015796654 0.778544391
55 -0.353752268 0.015796654
56 -0.242049636 -0.353752268
57 0.045697898 -0.242049636
58 0.045697898 0.045697898
59 0.609665431 0.045697898
60 -0.102587035 0.609665431
61 -0.271950880 -0.102587035
62 0.015796654 -0.271950880
63 -0.102587035 0.015796654
64 0.015796654 -0.102587035
65 0.015796654 0.015796654
66 0.565851215 0.015796654
67 0.029709625 0.565851215
68 0.045697898 0.029709625
69 -0.221455609 0.045697898
70 0.015796654 -0.221455609
71 0.045697898 0.015796654
72 -0.191554364 0.045697898
73 -0.207542638 -0.191554364
74 0.045697898 -0.207542638
75 -0.166995278 0.045697898
76 0.045697898 -0.166995278
77 -0.242049636 0.045697898
78 0.646247732 -0.242049636
79 -0.196896523 0.646247732
80 0.015796654 -0.196896523
81 -0.177641393 0.015796654
82 0.015796654 -0.177641393
83 0.778544391 0.015796654
84 -0.004797374 0.778544391
85 0.029709625 -0.004797374
86 0.052624114 0.029709625
87 -0.184628148 0.052624114
88 0.008809898 -0.184628148
89 0.038711143 0.008809898
90 -0.041685374 0.038711143
91 0.022722869 -0.041685374
92 -0.027772403 0.022722869
93 0.008809898 -0.027772403
94 0.008809898 0.008809898
95 0.038711143 0.008809898
96 0.022722869 0.038711143
97 0.008809898 0.022722869
98 0.022722869 0.008809898
99 0.038711143 0.022722869
100 0.052624114 0.038711143
101 0.008809898 0.052624114
102 0.008809898 0.008809898
103 0.008809898 0.008809898
104 -0.228442364 0.008809898
105 0.008809898 -0.228442364
106 0.008809898 0.008809898
107 -0.214529393 0.008809898
108 0.008809898 -0.214529393
109 0.022722869 0.008809898
110 -0.265024665 0.022722869
111 0.008809898 -0.265024665
112 -0.228442364 0.008809898
113 -0.214529393 -0.228442364
114 0.022722869 -0.214529393
115 0.008809898 0.022722869
116 0.052624114 0.008809898
117 0.022722869 0.052624114
118 0.008809898 0.022722869
119 0.038711143 0.008809898
120 0.022722869 0.038711143
121 0.008809898 0.022722869
122 -0.214529393 0.008809898
123 -0.249036391 -0.214529393
124 0.038711143 -0.249036391
125 0.008809898 0.038711143
126 -0.041685374 0.008809898
127 0.038711143 -0.041685374
128 0.008809898 0.038711143
129 0.038711143 0.008809898
130 0.022722869 0.038711143
131 0.052624114 0.022722869
132 -0.214529393 0.052624114
133 0.008809898 -0.214529393
134 0.008809898 0.008809898
135 0.008809898 0.008809898
136 -0.235123420 0.008809898
137 -0.235123420 -0.235123420
138 0.008809898 -0.235123420
139 0.008809898 0.008809898
140 0.801458881 0.008809898
141 -0.198541119 0.801458881
142 0.022722869 -0.198541119
143 -0.011784129 0.022722869
144 -0.041685374 -0.011784129
145 0.038711143 -0.041685374
146 -0.228442364 0.038711143
147 0.008809898 -0.228442364
148 0.022722869 0.008809898
149 -0.011784129 0.022722869
150 0.038711143 -0.011784129
151 0.785470607 0.038711143
152 0.734975335 0.785470607
153 -0.214529393 0.734975335
> 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/73ts51355681359.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/89qgf1355681359.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/9w5jv1355681359.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/10i5x11355681359.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/11atmc1355681359.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/12e42p1355681359.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/13frqx1355681359.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/14lw8u1355681359.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/151mxc1355681359.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/16r5421355681359.tab")
+ }
>
> try(system("convert tmp/19ujw1355681359.ps tmp/19ujw1355681359.png",intern=TRUE))
character(0)
> try(system("convert tmp/2al751355681359.ps tmp/2al751355681359.png",intern=TRUE))
character(0)
> try(system("convert tmp/37ta91355681359.ps tmp/37ta91355681359.png",intern=TRUE))
character(0)
> try(system("convert tmp/4vomy1355681359.ps tmp/4vomy1355681359.png",intern=TRUE))
character(0)
> try(system("convert tmp/51u4g1355681359.ps tmp/51u4g1355681359.png",intern=TRUE))
character(0)
> try(system("convert tmp/67tej1355681359.ps tmp/67tej1355681359.png",intern=TRUE))
character(0)
> try(system("convert tmp/73ts51355681359.ps tmp/73ts51355681359.png",intern=TRUE))
character(0)
> try(system("convert tmp/89qgf1355681359.ps tmp/89qgf1355681359.png",intern=TRUE))
character(0)
> try(system("convert tmp/9w5jv1355681359.ps tmp/9w5jv1355681359.png",intern=TRUE))
character(0)
> try(system("convert tmp/10i5x11355681359.ps tmp/10i5x11355681359.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
8.021 0.877 8.906