R version 2.12.1 (2010-12-16)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-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(3
+ ,2
+ ,3
+ ,3
+ ,3
+ ,7
+ ,6
+ ,5
+ ,6
+ ,0
+ ,7
+ ,7
+ ,2
+ ,7
+ ,6
+ ,6
+ ,0
+ ,6
+ ,8
+ ,3
+ ,8
+ ,6
+ ,6
+ ,6
+ ,6
+ ,9
+ ,8
+ ,8
+ ,7
+ ,8
+ ,5
+ ,5
+ ,5
+ ,7
+ ,9
+ ,3
+ ,1
+ ,0
+ ,7
+ ,7
+ ,7
+ ,8
+ ,8
+ ,9
+ ,8
+ ,8
+ ,8
+ ,9
+ ,8
+ ,4
+ ,4
+ ,0
+ ,2
+ ,3
+ ,2
+ ,7
+ ,7
+ ,7
+ ,0
+ ,4
+ ,8
+ ,4
+ ,7
+ ,4
+ ,4
+ ,9
+ ,9
+ ,4
+ ,4
+ ,4
+ ,6
+ ,6
+ ,6
+ ,6
+ ,6
+ ,6
+ ,6
+ ,6
+ ,5
+ ,6
+ ,6
+ ,4
+ ,4
+ ,7
+ ,7
+ ,7
+ ,5
+ ,5
+ ,8
+ ,9
+ ,5
+ ,4
+ ,5
+ ,4
+ ,4
+ ,8
+ ,8
+ ,8
+ ,6
+ ,6
+ ,0
+ ,2
+ ,2
+ ,7
+ ,5
+ ,5
+ ,5
+ ,0
+ ,4
+ ,9
+ ,4
+ ,4
+ ,0
+ ,2
+ ,2
+ ,2
+ ,2
+ ,2
+ ,9
+ ,9
+ ,9
+ ,6
+ ,6
+ ,8
+ ,8
+ ,8
+ ,4
+ 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(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
> 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
Sport GoingOut Relation Family Friends Coach Job
1 3 2 3 3 3 7 6
2 5 6 0 7 7 2 7
3 6 6 0 6 8 3 8
4 6 6 6 6 9 8 8
5 7 8 5 5 5 7 9
6 3 1 0 7 7 7 8
7 8 9 8 8 8 9 8
8 4 4 0 2 3 2 7
9 7 7 0 4 8 4 7
10 4 4 9 9 4 4 4
11 6 6 6 6 6 6 6
12 6 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1 0 9 6 6 6
77 5 5 0 5 5 5 6
78 5 5 1 5 3 3 9
79 4 2 7 7 4 2 7
80 2 2 2 2 9 2 9
81 7 7 4 4 4 4 4
82 5 5 0 6 8 8 8
83 6 2 5 5 5 5 5
84 5 5 5 5 5 9 8
85 3 3 3 3 8 2 9
86 6 6 0 6 6 6 6
87 4 1 4 4 9 4 4
88 5 5 9 9 5 5 7
89 7 7 0 8 8 8 8
90 4 2 4 4 3 3 9
91 6 6 2 2 2 2 9
92 8 8 7 7 7 7 7
93 7 7 7 7 7 7 8
94 6 6 6 6 4 9 4
95 7 7 0 5 5 5 6
96 4 4 5 5 9 5 7
97 0 5 6 6 6 2 6
98 3 2 0 3 3 3 7
99 5 5 5 5 5 5 5
100 6 2 9 9 2 2 9
101 5 5 0 7 7 7 7
102 7 7 7 7 7 7 7
103 6 5 1 6 6 6 6
104 8 8 3 3 8 3 6
105 7 2 7 7 9 3 9
106 8 8 8 8 8 2 9
107 3 3 0 3 3 3 8
108 8 2 5 5 5 5 8
109 3 3 3 3 3 3 3
110 4 5 0 4 4 4 6
111 2 2 5 5 5 5 5
112 7 2 7 7 9 7 7
113 6 6 0 6 6 6 6
114 2 2 0 7 7 7 7
115 7 7 0 9 7 2 7
116 6 6 6 6 6 6 6
117 6 2 0 6 3 9 8
118 6 2 6 6 9 4 9
119 6 5 6 6 6 6 6
120 6 6 2 2 2 2 9
121 4 4 5 5 5 2 5
122 5 5 0 5 5 5 6
123 7 7 4 4 9 4 4
124 6 6 0 7 7 7 7
125 6 6 6 6 6 6 6
126 5 5 5 5 8 7 8
127 8 2 8 8 8 8 8
128 6 6 6 6 6 6 9
129 0 3 5 5 3 3 8
130 4 2 0 4 4 4 4
131 8 8 8 8 9 8 6
132 6 6 0 6 6 9 6
133 4 4 9 9 4 2 7
134 6 6 5 5 5 5 9
135 2 5 0 6 6 6 8
136 4 4 0 4 4 4 4
137 6 2 0 6 6 6 6
138 3 3 3 3 3 3 9
139 6 6 6 6 6 6 6
140 5 5 0 5 5 5 5
141 4 4 4 4 9 8 8
142 6 6 6 6 6 6 6
143 1 1 0 5 9 5 6
144 4 5 4 4 3 3 6
145 4 2 7 7 7 2 7
146 6 6 0 6 6 6 7
147 5 5 5 5 5 5 9
148 9 2 6 6 6 6 6
149 6 6 6 6 9 6 6
150 8 8 8 8 8 9 6
151 7 7 2 2 4 4 4
152 7 7 7 7 7 7 7
153 0 9 0 4 4 4 8
154 6 2 0 6 8 7 7
155 6 6 5 5 5 5 9
156 5 5 0 2 9 2 6
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) GoingOut Relation Family Friends Coach
1.39978 0.36802 0.06355 0.14513 0.15296 0.12801
Job
-0.06668
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-5.8829 -0.6032 -0.0059 0.7751 4.3264
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.39978 0.66606 2.102 0.0373 *
GoingOut 0.36802 0.05937 6.199 5.31e-09 ***
Relation 0.06355 0.04636 1.371 0.1725
Family 0.14513 0.08704 1.667 0.0975 .
Friends 0.15296 0.06294 2.430 0.0163 *
Coach 0.12801 0.06366 2.011 0.0462 *
Job -0.06668 0.07735 -0.862 0.3901
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.496 on 149 degrees of freedom
Multiple R-squared: 0.383, Adjusted R-squared: 0.3581
F-statistic: 15.41 on 6 and 149 DF, p-value: 1.057e-13
> 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,] 3.100928e-02 6.201855e-02 0.9689907
[2,] 8.198958e-03 1.639792e-02 0.9918010
[3,] 2.024892e-02 4.049785e-02 0.9797511
[4,] 8.239205e-03 1.647841e-02 0.9917608
[5,] 2.271443e-02 4.542886e-02 0.9772856
[6,] 9.883672e-03 1.976734e-02 0.9901163
[7,] 4.008534e-03 8.017067e-03 0.9959915
[8,] 1.745416e-02 3.490831e-02 0.9825458
[9,] 1.268034e-02 2.536069e-02 0.9873197
[10,] 6.747602e-03 1.349520e-02 0.9932524
[11,] 3.411032e-03 6.822065e-03 0.9965890
[12,] 1.371751e-02 2.743501e-02 0.9862825
[13,] 7.559548e-03 1.511910e-02 0.9924405
[14,] 4.288497e-03 8.576994e-03 0.9957115
[15,] 3.624009e-03 7.248019e-03 0.9963760
[16,] 1.951467e-03 3.902935e-03 0.9980485
[17,] 1.021335e-03 2.042669e-03 0.9989787
[18,] 5.491051e-03 1.098210e-02 0.9945089
[19,] 3.367736e-03 6.735471e-03 0.9966323
[20,] 1.949739e-03 3.899477e-03 0.9980503
[21,] 3.069395e-03 6.138790e-03 0.9969306
[22,] 2.405566e-03 4.811133e-03 0.9975944
[23,] 1.388499e-03 2.776999e-03 0.9986115
[24,] 1.170230e-03 2.340460e-03 0.9988298
[25,] 7.573090e-04 1.514618e-03 0.9992427
[26,] 4.289117e-04 8.578234e-04 0.9995711
[27,] 2.386973e-04 4.773945e-04 0.9997613
[28,] 2.098446e-04 4.196892e-04 0.9997902
[29,] 1.116982e-04 2.233964e-04 0.9998883
[30,] 2.997351e-03 5.994702e-03 0.9970026
[31,] 3.687575e-03 7.375149e-03 0.9963124
[32,] 2.553708e-03 5.107416e-03 0.9974463
[33,] 3.345367e-03 6.690734e-03 0.9966546
[34,] 2.365421e-03 4.730842e-03 0.9976346
[35,] 1.697085e-03 3.394170e-03 0.9983029
[36,] 1.152943e-03 2.305886e-03 0.9988471
[37,] 7.406707e-04 1.481341e-03 0.9992593
[38,] 1.058510e-03 2.117019e-03 0.9989415
[39,] 6.680093e-04 1.336019e-03 0.9993320
[40,] 4.779727e-04 9.559454e-04 0.9995220
[41,] 3.125949e-04 6.251897e-04 0.9996874
[42,] 3.357108e-04 6.714216e-04 0.9996643
[43,] 2.116121e-04 4.232242e-04 0.9997884
[44,] 1.782105e-04 3.564210e-04 0.9998218
[45,] 1.129239e-04 2.258478e-04 0.9998871
[46,] 1.356341e-04 2.712682e-04 0.9998644
[47,] 1.999379e-04 3.998758e-04 0.9998001
[48,] 1.713370e-04 3.426740e-04 0.9998287
[49,] 1.138896e-04 2.277792e-04 0.9998861
[50,] 7.056467e-05 1.411293e-04 0.9999294
[51,] 4.287552e-05 8.575105e-05 0.9999571
[52,] 7.786411e-05 1.557282e-04 0.9999221
[53,] 9.982755e-04 1.996551e-03 0.9990017
[54,] 7.352139e-04 1.470428e-03 0.9992648
[55,] 3.157201e-02 6.314402e-02 0.9684280
[56,] 2.382591e-02 4.765182e-02 0.9761741
[57,] 1.810418e-02 3.620837e-02 0.9818958
[58,] 1.355463e-02 2.710925e-02 0.9864454
[59,] 1.597351e-02 3.194703e-02 0.9840265
[60,] 1.180906e-02 2.361811e-02 0.9881909
[61,] 1.602300e-02 3.204601e-02 0.9839770
[62,] 1.194544e-02 2.389088e-02 0.9880546
[63,] 9.025426e-03 1.805085e-02 0.9909746
[64,] 1.091869e-02 2.183738e-02 0.9890813
[65,] 9.403825e-03 1.880765e-02 0.9905962
[66,] 8.932694e-03 1.786539e-02 0.9910673
[67,] 1.043088e-02 2.086176e-02 0.9895691
[68,] 7.620030e-03 1.524006e-02 0.9923800
[69,] 5.980293e-03 1.196059e-02 0.9940197
[70,] 4.378393e-03 8.756785e-03 0.9956216
[71,] 4.373084e-03 8.746169e-03 0.9956269
[72,] 4.039307e-03 8.078615e-03 0.9959607
[73,] 3.240396e-03 6.480793e-03 0.9967596
[74,] 4.001629e-03 8.003258e-03 0.9959984
[75,] 3.123633e-03 6.247267e-03 0.9968764
[76,] 2.494755e-03 4.989509e-03 0.9975052
[77,] 1.770933e-03 3.541867e-03 0.9982291
[78,] 1.206622e-03 2.413244e-03 0.9987934
[79,] 9.513900e-04 1.902780e-03 0.9990486
[80,] 6.438852e-04 1.287770e-03 0.9993561
[81,] 5.186840e-04 1.037368e-03 0.9994813
[82,] 7.415918e-04 1.483184e-03 0.9992584
[83,] 5.365642e-04 1.073128e-03 0.9994634
[84,] 3.517294e-04 7.034588e-04 0.9996483
[85,] 2.352944e-04 4.705887e-04 0.9997647
[86,] 2.287995e-04 4.575989e-04 0.9997712
[87,] 2.268084e-04 4.536168e-04 0.9997732
[88,] 1.528180e-02 3.056359e-02 0.9847182
[89,] 1.119441e-02 2.238883e-02 0.9888056
[90,] 8.271388e-03 1.654278e-02 0.9917286
[91,] 1.124276e-02 2.248553e-02 0.9887572
[92,] 8.739069e-03 1.747814e-02 0.9912609
[93,] 6.246055e-03 1.249211e-02 0.9937539
[94,] 4.685580e-03 9.371159e-03 0.9953144
[95,] 6.029572e-03 1.205914e-02 0.9939704
[96,] 8.638720e-03 1.727744e-02 0.9913613
[97,] 8.291579e-03 1.658316e-02 0.9917084
[98,] 5.924466e-03 1.184893e-02 0.9940755
[99,] 3.095794e-02 6.191588e-02 0.9690421
[100,] 2.556240e-02 5.112480e-02 0.9744376
[101,] 1.944233e-02 3.888467e-02 0.9805577
[102,] 3.616851e-02 7.233702e-02 0.9638315
[103,] 3.349129e-02 6.698258e-02 0.9665087
[104,] 2.609139e-02 5.218278e-02 0.9739086
[105,] 4.801486e-02 9.602972e-02 0.9519851
[106,] 1.021749e-01 2.043499e-01 0.8978251
[107,] 8.120280e-02 1.624056e-01 0.9187972
[108,] 7.516763e-02 1.503353e-01 0.9248324
[109,] 7.781943e-02 1.556389e-01 0.9221806
[110,] 6.055186e-02 1.211037e-01 0.9394481
[111,] 1.441374e-01 2.882748e-01 0.8558626
[112,] 1.175270e-01 2.350540e-01 0.8824730
[113,] 9.690616e-02 1.938123e-01 0.9030938
[114,] 7.920206e-02 1.584041e-01 0.9207979
[115,] 7.443462e-02 1.488692e-01 0.9255654
[116,] 5.708291e-02 1.141658e-01 0.9429171
[117,] 4.799580e-02 9.599160e-02 0.9520042
[118,] 4.740796e-02 9.481592e-02 0.9525920
[119,] 3.808138e-02 7.616276e-02 0.9619186
[120,] 1.759541e-01 3.519082e-01 0.8240459
[121,] 1.521614e-01 3.043228e-01 0.8478386
[122,] 1.173289e-01 2.346579e-01 0.8826711
[123,] 8.661349e-02 1.732270e-01 0.9133865
[124,] 7.001829e-02 1.400366e-01 0.9299817
[125,] 6.758827e-02 1.351765e-01 0.9324117
[126,] 7.683351e-02 1.536670e-01 0.9231665
[127,] 6.963908e-02 1.392782e-01 0.9303609
[128,] 5.592501e-02 1.118500e-01 0.9440750
[129,] 3.754666e-02 7.509332e-02 0.9624533
[130,] 2.535082e-02 5.070163e-02 0.9746492
[131,] 1.499819e-02 2.999639e-02 0.9850018
[132,] 3.603794e-02 7.207589e-02 0.9639621
[133,] 2.309186e-02 4.618372e-02 0.9769081
[134,] 4.394532e-01 8.789065e-01 0.5605468
[135,] 3.708668e-01 7.417336e-01 0.6291332
[136,] 2.795462e-01 5.590923e-01 0.7204538
[137,] 6.540815e-01 6.918371e-01 0.3459185
> postscript(file="/var/www/rcomp/tmp/1eapj1321957431.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/rcomp/tmp/21l6e1321957431.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/rcomp/tmp/3j2bj1321957431.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/rcomp/tmp/4n3uz1321957431.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/rcomp/tmp/5xly61321957431.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 156
Frequency = 1
1 2 3 4 5 6
-0.716737138 -0.483779130 0.447063397 -0.727259089 0.551911792 -1.217063541
7 8 9 10 11 12
-0.223733121 0.589748741 1.174616454 -1.607156300 -0.145722638 0.850915400
13 14 15 16 17 18
-0.061689153 -1.788916715 1.233252460 -0.442346453 -2.514997797 1.321644000
19 20 21 22 23 24
-0.921369842 -0.430380936 -2.904017712 -0.192735727 0.073845954 2.596166204
25 26 27 28 29 30
-0.145722638 -0.145722638 1.674302757 -0.086186850 0.736964164 1.201600684
31 32 33 34 35 36
-0.919552100 0.552458154 0.431305370 1.586407940 -0.430380936 -0.869588238
37 38 39 40 41 42
0.235584825 -0.354732266 2.380143864 0.742179629 1.288204143 -2.882005251
43 44 45 46 47 48
-0.372668648 -0.674796622 -0.513741019 0.771241735 0.861318539 0.522486138
49 50 51 52 53 54
1.241327633 -0.089928909 0.942316809 -0.782983740 -0.036976047 0.172294867
55 56 57 58 59 60
1.293265048 -1.157725169 -1.195723514 -1.077687743 -0.514997797 0.205616139
61 62 63 64 65 66
-1.508788283 -3.512984129 0.107573467 3.838396318 -0.076947959 -0.036976047
67 68 69 70 71 72
0.349536061 1.414294588 0.305394539 -2.250677125 0.343929833 -0.427500280
73 74 75 76 77 78
1.410519020 0.867476192 -1.409685877 1.640281815 0.029704432 0.728133804
79 80 81 82 83 84
0.002310377 -1.585705412 1.332202965 -0.824975015 1.749322875 -0.666736263
85 86 87 88 89 90
-1.009448443 0.235584825 -0.224477906 -1.056102833 0.148724949 0.786666851
91 92 93 94 95 96
2.012928681 0.695268609 0.129967469 -0.357201210 1.293667671 -1.465185851
97 98 99 100 101 102
-5.265658824 0.052642506 -0.354732266 2.024222034 -0.755817542 0.063286990
103 104 105 106 107 108
0.540051962 1.822406859 2.242868823 1.107045248 -0.248695395 3.949364313
109 110 111 112 113 114
-0.772751522 -0.544194341 -2.250677125 1.597462431 0.235584825 -2.651762401
115 116 117 118 119 120
0.857939214 -0.145722638 1.915859922 1.323540346 0.222295742 2.012928681
121 122 123 124 125 126
-0.602679810 0.029704432 0.567411811 -0.123835923 -0.145722638 -0.869588238
127 128 129 130 131 132
2.480406901 0.054318799 -3.856714889 0.426499842 -0.014022571 -0.148449250
133 134 135 136 137 138
-1.151092146 0.543971270 -3.263035836 -0.309536919 1.707658347 -0.372668648
139 140 141 142 143 144
-0.145722638 -0.036976047 -1.573856566 -0.145722638 -3.110054969 -0.517429727
145 146 147 148 149 150
-0.456564315 0.302265304 -0.088010350 4.326350884 -0.604597330 0.010924301
151 152 153 154 155 156
1.749568727 0.063286990 -5.882906905 1.340411006 0.543971270 0.237300497
> postscript(file="/var/www/rcomp/tmp/6y3gk1321957431.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 156
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.716737138 NA
1 -0.483779130 -0.716737138
2 0.447063397 -0.483779130
3 -0.727259089 0.447063397
4 0.551911792 -0.727259089
5 -1.217063541 0.551911792
6 -0.223733121 -1.217063541
7 0.589748741 -0.223733121
8 1.174616454 0.589748741
9 -1.607156300 1.174616454
10 -0.145722638 -1.607156300
11 0.850915400 -0.145722638
12 -0.061689153 0.850915400
13 -1.788916715 -0.061689153
14 1.233252460 -1.788916715
15 -0.442346453 1.233252460
16 -2.514997797 -0.442346453
17 1.321644000 -2.514997797
18 -0.921369842 1.321644000
19 -0.430380936 -0.921369842
20 -2.904017712 -0.430380936
21 -0.192735727 -2.904017712
22 0.073845954 -0.192735727
23 2.596166204 0.073845954
24 -0.145722638 2.596166204
25 -0.145722638 -0.145722638
26 1.674302757 -0.145722638
27 -0.086186850 1.674302757
28 0.736964164 -0.086186850
29 1.201600684 0.736964164
30 -0.919552100 1.201600684
31 0.552458154 -0.919552100
32 0.431305370 0.552458154
33 1.586407940 0.431305370
34 -0.430380936 1.586407940
35 -0.869588238 -0.430380936
36 0.235584825 -0.869588238
37 -0.354732266 0.235584825
38 2.380143864 -0.354732266
39 0.742179629 2.380143864
40 1.288204143 0.742179629
41 -2.882005251 1.288204143
42 -0.372668648 -2.882005251
43 -0.674796622 -0.372668648
44 -0.513741019 -0.674796622
45 0.771241735 -0.513741019
46 0.861318539 0.771241735
47 0.522486138 0.861318539
48 1.241327633 0.522486138
49 -0.089928909 1.241327633
50 0.942316809 -0.089928909
51 -0.782983740 0.942316809
52 -0.036976047 -0.782983740
53 0.172294867 -0.036976047
54 1.293265048 0.172294867
55 -1.157725169 1.293265048
56 -1.195723514 -1.157725169
57 -1.077687743 -1.195723514
58 -0.514997797 -1.077687743
59 0.205616139 -0.514997797
60 -1.508788283 0.205616139
61 -3.512984129 -1.508788283
62 0.107573467 -3.512984129
63 3.838396318 0.107573467
64 -0.076947959 3.838396318
65 -0.036976047 -0.076947959
66 0.349536061 -0.036976047
67 1.414294588 0.349536061
68 0.305394539 1.414294588
69 -2.250677125 0.305394539
70 0.343929833 -2.250677125
71 -0.427500280 0.343929833
72 1.410519020 -0.427500280
73 0.867476192 1.410519020
74 -1.409685877 0.867476192
75 1.640281815 -1.409685877
76 0.029704432 1.640281815
77 0.728133804 0.029704432
78 0.002310377 0.728133804
79 -1.585705412 0.002310377
80 1.332202965 -1.585705412
81 -0.824975015 1.332202965
82 1.749322875 -0.824975015
83 -0.666736263 1.749322875
84 -1.009448443 -0.666736263
85 0.235584825 -1.009448443
86 -0.224477906 0.235584825
87 -1.056102833 -0.224477906
88 0.148724949 -1.056102833
89 0.786666851 0.148724949
90 2.012928681 0.786666851
91 0.695268609 2.012928681
92 0.129967469 0.695268609
93 -0.357201210 0.129967469
94 1.293667671 -0.357201210
95 -1.465185851 1.293667671
96 -5.265658824 -1.465185851
97 0.052642506 -5.265658824
98 -0.354732266 0.052642506
99 2.024222034 -0.354732266
100 -0.755817542 2.024222034
101 0.063286990 -0.755817542
102 0.540051962 0.063286990
103 1.822406859 0.540051962
104 2.242868823 1.822406859
105 1.107045248 2.242868823
106 -0.248695395 1.107045248
107 3.949364313 -0.248695395
108 -0.772751522 3.949364313
109 -0.544194341 -0.772751522
110 -2.250677125 -0.544194341
111 1.597462431 -2.250677125
112 0.235584825 1.597462431
113 -2.651762401 0.235584825
114 0.857939214 -2.651762401
115 -0.145722638 0.857939214
116 1.915859922 -0.145722638
117 1.323540346 1.915859922
118 0.222295742 1.323540346
119 2.012928681 0.222295742
120 -0.602679810 2.012928681
121 0.029704432 -0.602679810
122 0.567411811 0.029704432
123 -0.123835923 0.567411811
124 -0.145722638 -0.123835923
125 -0.869588238 -0.145722638
126 2.480406901 -0.869588238
127 0.054318799 2.480406901
128 -3.856714889 0.054318799
129 0.426499842 -3.856714889
130 -0.014022571 0.426499842
131 -0.148449250 -0.014022571
132 -1.151092146 -0.148449250
133 0.543971270 -1.151092146
134 -3.263035836 0.543971270
135 -0.309536919 -3.263035836
136 1.707658347 -0.309536919
137 -0.372668648 1.707658347
138 -0.145722638 -0.372668648
139 -0.036976047 -0.145722638
140 -1.573856566 -0.036976047
141 -0.145722638 -1.573856566
142 -3.110054969 -0.145722638
143 -0.517429727 -3.110054969
144 -0.456564315 -0.517429727
145 0.302265304 -0.456564315
146 -0.088010350 0.302265304
147 4.326350884 -0.088010350
148 -0.604597330 4.326350884
149 0.010924301 -0.604597330
150 1.749568727 0.010924301
151 0.063286990 1.749568727
152 -5.882906905 0.063286990
153 1.340411006 -5.882906905
154 0.543971270 1.340411006
155 0.237300497 0.543971270
156 NA 0.237300497
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.483779130 -0.716737138
[2,] 0.447063397 -0.483779130
[3,] -0.727259089 0.447063397
[4,] 0.551911792 -0.727259089
[5,] -1.217063541 0.551911792
[6,] -0.223733121 -1.217063541
[7,] 0.589748741 -0.223733121
[8,] 1.174616454 0.589748741
[9,] -1.607156300 1.174616454
[10,] -0.145722638 -1.607156300
[11,] 0.850915400 -0.145722638
[12,] -0.061689153 0.850915400
[13,] -1.788916715 -0.061689153
[14,] 1.233252460 -1.788916715
[15,] -0.442346453 1.233252460
[16,] -2.514997797 -0.442346453
[17,] 1.321644000 -2.514997797
[18,] -0.921369842 1.321644000
[19,] -0.430380936 -0.921369842
[20,] -2.904017712 -0.430380936
[21,] -0.192735727 -2.904017712
[22,] 0.073845954 -0.192735727
[23,] 2.596166204 0.073845954
[24,] -0.145722638 2.596166204
[25,] -0.145722638 -0.145722638
[26,] 1.674302757 -0.145722638
[27,] -0.086186850 1.674302757
[28,] 0.736964164 -0.086186850
[29,] 1.201600684 0.736964164
[30,] -0.919552100 1.201600684
[31,] 0.552458154 -0.919552100
[32,] 0.431305370 0.552458154
[33,] 1.586407940 0.431305370
[34,] -0.430380936 1.586407940
[35,] -0.869588238 -0.430380936
[36,] 0.235584825 -0.869588238
[37,] -0.354732266 0.235584825
[38,] 2.380143864 -0.354732266
[39,] 0.742179629 2.380143864
[40,] 1.288204143 0.742179629
[41,] -2.882005251 1.288204143
[42,] -0.372668648 -2.882005251
[43,] -0.674796622 -0.372668648
[44,] -0.513741019 -0.674796622
[45,] 0.771241735 -0.513741019
[46,] 0.861318539 0.771241735
[47,] 0.522486138 0.861318539
[48,] 1.241327633 0.522486138
[49,] -0.089928909 1.241327633
[50,] 0.942316809 -0.089928909
[51,] -0.782983740 0.942316809
[52,] -0.036976047 -0.782983740
[53,] 0.172294867 -0.036976047
[54,] 1.293265048 0.172294867
[55,] -1.157725169 1.293265048
[56,] -1.195723514 -1.157725169
[57,] -1.077687743 -1.195723514
[58,] -0.514997797 -1.077687743
[59,] 0.205616139 -0.514997797
[60,] -1.508788283 0.205616139
[61,] -3.512984129 -1.508788283
[62,] 0.107573467 -3.512984129
[63,] 3.838396318 0.107573467
[64,] -0.076947959 3.838396318
[65,] -0.036976047 -0.076947959
[66,] 0.349536061 -0.036976047
[67,] 1.414294588 0.349536061
[68,] 0.305394539 1.414294588
[69,] -2.250677125 0.305394539
[70,] 0.343929833 -2.250677125
[71,] -0.427500280 0.343929833
[72,] 1.410519020 -0.427500280
[73,] 0.867476192 1.410519020
[74,] -1.409685877 0.867476192
[75,] 1.640281815 -1.409685877
[76,] 0.029704432 1.640281815
[77,] 0.728133804 0.029704432
[78,] 0.002310377 0.728133804
[79,] -1.585705412 0.002310377
[80,] 1.332202965 -1.585705412
[81,] -0.824975015 1.332202965
[82,] 1.749322875 -0.824975015
[83,] -0.666736263 1.749322875
[84,] -1.009448443 -0.666736263
[85,] 0.235584825 -1.009448443
[86,] -0.224477906 0.235584825
[87,] -1.056102833 -0.224477906
[88,] 0.148724949 -1.056102833
[89,] 0.786666851 0.148724949
[90,] 2.012928681 0.786666851
[91,] 0.695268609 2.012928681
[92,] 0.129967469 0.695268609
[93,] -0.357201210 0.129967469
[94,] 1.293667671 -0.357201210
[95,] -1.465185851 1.293667671
[96,] -5.265658824 -1.465185851
[97,] 0.052642506 -5.265658824
[98,] -0.354732266 0.052642506
[99,] 2.024222034 -0.354732266
[100,] -0.755817542 2.024222034
[101,] 0.063286990 -0.755817542
[102,] 0.540051962 0.063286990
[103,] 1.822406859 0.540051962
[104,] 2.242868823 1.822406859
[105,] 1.107045248 2.242868823
[106,] -0.248695395 1.107045248
[107,] 3.949364313 -0.248695395
[108,] -0.772751522 3.949364313
[109,] -0.544194341 -0.772751522
[110,] -2.250677125 -0.544194341
[111,] 1.597462431 -2.250677125
[112,] 0.235584825 1.597462431
[113,] -2.651762401 0.235584825
[114,] 0.857939214 -2.651762401
[115,] -0.145722638 0.857939214
[116,] 1.915859922 -0.145722638
[117,] 1.323540346 1.915859922
[118,] 0.222295742 1.323540346
[119,] 2.012928681 0.222295742
[120,] -0.602679810 2.012928681
[121,] 0.029704432 -0.602679810
[122,] 0.567411811 0.029704432
[123,] -0.123835923 0.567411811
[124,] -0.145722638 -0.123835923
[125,] -0.869588238 -0.145722638
[126,] 2.480406901 -0.869588238
[127,] 0.054318799 2.480406901
[128,] -3.856714889 0.054318799
[129,] 0.426499842 -3.856714889
[130,] -0.014022571 0.426499842
[131,] -0.148449250 -0.014022571
[132,] -1.151092146 -0.148449250
[133,] 0.543971270 -1.151092146
[134,] -3.263035836 0.543971270
[135,] -0.309536919 -3.263035836
[136,] 1.707658347 -0.309536919
[137,] -0.372668648 1.707658347
[138,] -0.145722638 -0.372668648
[139,] -0.036976047 -0.145722638
[140,] -1.573856566 -0.036976047
[141,] -0.145722638 -1.573856566
[142,] -3.110054969 -0.145722638
[143,] -0.517429727 -3.110054969
[144,] -0.456564315 -0.517429727
[145,] 0.302265304 -0.456564315
[146,] -0.088010350 0.302265304
[147,] 4.326350884 -0.088010350
[148,] -0.604597330 4.326350884
[149,] 0.010924301 -0.604597330
[150,] 1.749568727 0.010924301
[151,] 0.063286990 1.749568727
[152,] -5.882906905 0.063286990
[153,] 1.340411006 -5.882906905
[154,] 0.543971270 1.340411006
[155,] 0.237300497 0.543971270
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.483779130 -0.716737138
2 0.447063397 -0.483779130
3 -0.727259089 0.447063397
4 0.551911792 -0.727259089
5 -1.217063541 0.551911792
6 -0.223733121 -1.217063541
7 0.589748741 -0.223733121
8 1.174616454 0.589748741
9 -1.607156300 1.174616454
10 -0.145722638 -1.607156300
11 0.850915400 -0.145722638
12 -0.061689153 0.850915400
13 -1.788916715 -0.061689153
14 1.233252460 -1.788916715
15 -0.442346453 1.233252460
16 -2.514997797 -0.442346453
17 1.321644000 -2.514997797
18 -0.921369842 1.321644000
19 -0.430380936 -0.921369842
20 -2.904017712 -0.430380936
21 -0.192735727 -2.904017712
22 0.073845954 -0.192735727
23 2.596166204 0.073845954
24 -0.145722638 2.596166204
25 -0.145722638 -0.145722638
26 1.674302757 -0.145722638
27 -0.086186850 1.674302757
28 0.736964164 -0.086186850
29 1.201600684 0.736964164
30 -0.919552100 1.201600684
31 0.552458154 -0.919552100
32 0.431305370 0.552458154
33 1.586407940 0.431305370
34 -0.430380936 1.586407940
35 -0.869588238 -0.430380936
36 0.235584825 -0.869588238
37 -0.354732266 0.235584825
38 2.380143864 -0.354732266
39 0.742179629 2.380143864
40 1.288204143 0.742179629
41 -2.882005251 1.288204143
42 -0.372668648 -2.882005251
43 -0.674796622 -0.372668648
44 -0.513741019 -0.674796622
45 0.771241735 -0.513741019
46 0.861318539 0.771241735
47 0.522486138 0.861318539
48 1.241327633 0.522486138
49 -0.089928909 1.241327633
50 0.942316809 -0.089928909
51 -0.782983740 0.942316809
52 -0.036976047 -0.782983740
53 0.172294867 -0.036976047
54 1.293265048 0.172294867
55 -1.157725169 1.293265048
56 -1.195723514 -1.157725169
57 -1.077687743 -1.195723514
58 -0.514997797 -1.077687743
59 0.205616139 -0.514997797
60 -1.508788283 0.205616139
61 -3.512984129 -1.508788283
62 0.107573467 -3.512984129
63 3.838396318 0.107573467
64 -0.076947959 3.838396318
65 -0.036976047 -0.076947959
66 0.349536061 -0.036976047
67 1.414294588 0.349536061
68 0.305394539 1.414294588
69 -2.250677125 0.305394539
70 0.343929833 -2.250677125
71 -0.427500280 0.343929833
72 1.410519020 -0.427500280
73 0.867476192 1.410519020
74 -1.409685877 0.867476192
75 1.640281815 -1.409685877
76 0.029704432 1.640281815
77 0.728133804 0.029704432
78 0.002310377 0.728133804
79 -1.585705412 0.002310377
80 1.332202965 -1.585705412
81 -0.824975015 1.332202965
82 1.749322875 -0.824975015
83 -0.666736263 1.749322875
84 -1.009448443 -0.666736263
85 0.235584825 -1.009448443
86 -0.224477906 0.235584825
87 -1.056102833 -0.224477906
88 0.148724949 -1.056102833
89 0.786666851 0.148724949
90 2.012928681 0.786666851
91 0.695268609 2.012928681
92 0.129967469 0.695268609
93 -0.357201210 0.129967469
94 1.293667671 -0.357201210
95 -1.465185851 1.293667671
96 -5.265658824 -1.465185851
97 0.052642506 -5.265658824
98 -0.354732266 0.052642506
99 2.024222034 -0.354732266
100 -0.755817542 2.024222034
101 0.063286990 -0.755817542
102 0.540051962 0.063286990
103 1.822406859 0.540051962
104 2.242868823 1.822406859
105 1.107045248 2.242868823
106 -0.248695395 1.107045248
107 3.949364313 -0.248695395
108 -0.772751522 3.949364313
109 -0.544194341 -0.772751522
110 -2.250677125 -0.544194341
111 1.597462431 -2.250677125
112 0.235584825 1.597462431
113 -2.651762401 0.235584825
114 0.857939214 -2.651762401
115 -0.145722638 0.857939214
116 1.915859922 -0.145722638
117 1.323540346 1.915859922
118 0.222295742 1.323540346
119 2.012928681 0.222295742
120 -0.602679810 2.012928681
121 0.029704432 -0.602679810
122 0.567411811 0.029704432
123 -0.123835923 0.567411811
124 -0.145722638 -0.123835923
125 -0.869588238 -0.145722638
126 2.480406901 -0.869588238
127 0.054318799 2.480406901
128 -3.856714889 0.054318799
129 0.426499842 -3.856714889
130 -0.014022571 0.426499842
131 -0.148449250 -0.014022571
132 -1.151092146 -0.148449250
133 0.543971270 -1.151092146
134 -3.263035836 0.543971270
135 -0.309536919 -3.263035836
136 1.707658347 -0.309536919
137 -0.372668648 1.707658347
138 -0.145722638 -0.372668648
139 -0.036976047 -0.145722638
140 -1.573856566 -0.036976047
141 -0.145722638 -1.573856566
142 -3.110054969 -0.145722638
143 -0.517429727 -3.110054969
144 -0.456564315 -0.517429727
145 0.302265304 -0.456564315
146 -0.088010350 0.302265304
147 4.326350884 -0.088010350
148 -0.604597330 4.326350884
149 0.010924301 -0.604597330
150 1.749568727 0.010924301
151 0.063286990 1.749568727
152 -5.882906905 0.063286990
153 1.340411006 -5.882906905
154 0.543971270 1.340411006
155 0.237300497 0.543971270
> 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/rcomp/tmp/7t91b1321957431.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/rcomp/tmp/8bupq1321957431.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/rcomp/tmp/95fa71321957431.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/rcomp/tmp/101glk1321957431.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/rcomp/tmp/11jx371321957431.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/rcomp/tmp/120y7x1321957431.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/rcomp/tmp/13j64i1321957431.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/rcomp/tmp/149k231321957431.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/rcomp/tmp/15t4e51321957431.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/rcomp/tmp/16z3v51321957431.tab")
+ }
>
> try(system("convert tmp/1eapj1321957431.ps tmp/1eapj1321957431.png",intern=TRUE))
character(0)
> try(system("convert tmp/21l6e1321957431.ps tmp/21l6e1321957431.png",intern=TRUE))
character(0)
> try(system("convert tmp/3j2bj1321957431.ps tmp/3j2bj1321957431.png",intern=TRUE))
character(0)
> try(system("convert tmp/4n3uz1321957431.ps tmp/4n3uz1321957431.png",intern=TRUE))
character(0)
> try(system("convert tmp/5xly61321957431.ps tmp/5xly61321957431.png",intern=TRUE))
character(0)
> try(system("convert tmp/6y3gk1321957431.ps tmp/6y3gk1321957431.png",intern=TRUE))
character(0)
> try(system("convert tmp/7t91b1321957431.ps tmp/7t91b1321957431.png",intern=TRUE))
character(0)
> try(system("convert tmp/8bupq1321957431.ps tmp/8bupq1321957431.png",intern=TRUE))
character(0)
> try(system("convert tmp/95fa71321957431.ps tmp/95fa71321957431.png",intern=TRUE))
character(0)
> try(system("convert tmp/101glk1321957431.ps tmp/101glk1321957431.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
6.744 0.656 7.398