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(9.3
+ ,8.1
+ ,10.9
+ ,25.6
+ ,8.7
+ ,7.7
+ ,10
+ ,23.7
+ ,8.2
+ ,7.5
+ ,9.2
+ ,22
+ ,8.3
+ ,7.6
+ ,9.2
+ ,21.3
+ ,8.5
+ ,7.8
+ ,9.5
+ ,20.7
+ ,8.6
+ ,7.8
+ ,9.6
+ ,20.4
+ ,8.5
+ ,7.8
+ ,9.5
+ ,20.3
+ ,8.2
+ ,7.5
+ ,9.1
+ ,20.4
+ ,8.1
+ ,7.5
+ ,8.9
+ ,19.8
+ ,7.9
+ ,7.1
+ ,9
+ ,19.5
+ ,8.6
+ ,7.5
+ ,10.1
+ ,23.1
+ ,8.7
+ ,7.5
+ ,10.3
+ ,23.5
+ ,8.7
+ ,7.6
+ ,10.2
+ ,23.5
+ ,8.5
+ ,7.7
+ ,9.6
+ ,22.9
+ ,8.4
+ ,7.7
+ ,9.2
+ ,21.9
+ ,8.5
+ ,7.9
+ ,9.3
+ ,21.5
+ ,8.7
+ ,8.1
+ ,9.4
+ ,20.5
+ ,8.7
+ ,8.2
+ ,9.4
+ ,20.2
+ ,8.6
+ ,8.2
+ ,9.2
+ ,19.4
+ ,8.5
+ ,8.2
+ ,9
+ ,19.2
+ ,8.3
+ ,7.9
+ ,9
+ ,18.8
+ ,8
+ ,7.3
+ ,9
+ ,18.8
+ ,8.2
+ ,6.9
+ ,9.8
+ ,22.6
+ ,8.1
+ ,6.6
+ ,10
+ ,23.3
+ ,8.1
+ ,6.7
+ ,9.8
+ ,23
+ ,8
+ ,6.9
+ ,9.3
+ ,21.4
+ ,7.9
+ ,7
+ ,9
+ ,19.9
+ ,7.9
+ ,7.1
+ ,9
+ ,18.8
+ ,8
+ ,7.2
+ ,9.1
+ ,18.6
+ ,8
+ ,7.1
+ ,9.1
+ ,18.4
+ ,7.9
+ ,6.9
+ ,9.1
+ ,18.6
+ ,8
+ ,7
+ ,9.2
+ ,19.9
+ ,7.7
+ ,6.8
+ ,8.8
+ ,19.2
+ ,7.2
+ ,6.4
+ ,8.3
+ ,18.4
+ ,7.5
+ ,6.7
+ ,8.4
+ ,21.1
+ ,7.3
+ ,6.6
+ ,8.1
+ ,20.5
+ ,7
+ ,6.4
+ ,7.7
+ ,19.1
+ ,7
+ ,6.3
+ ,7.9
+ ,18.1
+ ,7
+ ,6.2
+ ,7.9
+ ,17
+ ,7.2
+ ,6.5
+ ,8
+ ,17.1
+ ,7.3
+ ,6.8
+ ,7.9
+ ,17.4
+ ,7.1
+ ,6.8
+ ,7.6
+ ,16.8
+ ,6.8
+ ,6.4
+ ,7.1
+ ,15.3
+ ,6.4
+ ,6.1
+ ,6.8
+ ,14.3
+ ,6.1
+ ,5.8
+ ,6.5
+ ,13.4
+ ,6.5
+ ,6.1
+ ,6.9
+ ,15.3
+ ,7.7
+ ,7.2
+ ,8.2
+ ,22.1
+ ,7.9
+ ,7.3
+ ,8.7
+ ,23.7
+ ,7.5
+ ,6.9
+ ,8.3
+ ,22.2
+ ,6.9
+ ,6.1
+ ,7.9
+ ,19.5
+ ,6.6
+ ,5.8
+ ,7.5
+ ,16.6
+ ,6.9
+ ,6.2
+ ,7.8
+ ,17.3
+ ,7.7
+ ,7.1
+ ,8.3
+ ,19.8
+ ,8
+ ,7.7
+ ,8.4
+ ,21.2
+ ,8
+ ,7.9
+ ,8.2
+ ,21.5
+ ,7.7
+ ,7.7
+ ,7.7
+ ,20.6
+ ,7.3
+ ,7.4
+ ,7.2
+ ,19.1
+ ,7.4
+ ,7.5
+ ,7.3
+ ,19.6
+ ,8.1
+ ,8
+ ,8.1
+ ,23.5
+ ,8.3
+ ,8.1
+ ,8.5
+ ,24
+ ,8.2
+ ,8
+ ,8.4
+ ,23.2)
+ ,dim=c(4
+ ,61)
+ ,dimnames=list(c('TW'
+ ,'WM'
+ ,'WV'
+ ,'WJ')
+ ,1:61))
> y <- array(NA,dim=c(4,61),dimnames=list(c('TW','WM','WV','WJ'),1:61))
> 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 = '1'
> #'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
TW WM WV WJ
1 9.3 8.1 10.9 25.6
2 8.7 7.7 10.0 23.7
3 8.2 7.5 9.2 22.0
4 8.3 7.6 9.2 21.3
5 8.5 7.8 9.5 20.7
6 8.6 7.8 9.6 20.4
7 8.5 7.8 9.5 20.3
8 8.2 7.5 9.1 20.4
9 8.1 7.5 8.9 19.8
10 7.9 7.1 9.0 19.5
11 8.6 7.5 10.1 23.1
12 8.7 7.5 10.3 23.5
13 8.7 7.6 10.2 23.5
14 8.5 7.7 9.6 22.9
15 8.4 7.7 9.2 21.9
16 8.5 7.9 9.3 21.5
17 8.7 8.1 9.4 20.5
18 8.7 8.2 9.4 20.2
19 8.6 8.2 9.2 19.4
20 8.5 8.2 9.0 19.2
21 8.3 7.9 9.0 18.8
22 8.0 7.3 9.0 18.8
23 8.2 6.9 9.8 22.6
24 8.1 6.6 10.0 23.3
25 8.1 6.7 9.8 23.0
26 8.0 6.9 9.3 21.4
27 7.9 7.0 9.0 19.9
28 7.9 7.1 9.0 18.8
29 8.0 7.2 9.1 18.6
30 8.0 7.1 9.1 18.4
31 7.9 6.9 9.1 18.6
32 8.0 7.0 9.2 19.9
33 7.7 6.8 8.8 19.2
34 7.2 6.4 8.3 18.4
35 7.5 6.7 8.4 21.1
36 7.3 6.6 8.1 20.5
37 7.0 6.4 7.7 19.1
38 7.0 6.3 7.9 18.1
39 7.0 6.2 7.9 17.0
40 7.2 6.5 8.0 17.1
41 7.3 6.8 7.9 17.4
42 7.1 6.8 7.6 16.8
43 6.8 6.4 7.1 15.3
44 6.4 6.1 6.8 14.3
45 6.1 5.8 6.5 13.4
46 6.5 6.1 6.9 15.3
47 7.7 7.2 8.2 22.1
48 7.9 7.3 8.7 23.7
49 7.5 6.9 8.3 22.2
50 6.9 6.1 7.9 19.5
51 6.6 5.8 7.5 16.6
52 6.9 6.2 7.8 17.3
53 7.7 7.1 8.3 19.8
54 8.0 7.7 8.4 21.2
55 8.0 7.9 8.2 21.5
56 7.7 7.7 7.7 20.6
57 7.3 7.4 7.2 19.1
58 7.4 7.5 7.3 19.6
59 8.1 8.0 8.1 23.5
60 8.3 8.1 8.5 24.0
61 8.2 8.0 8.4 23.2
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) WM WV WJ
0.198077 0.533259 0.423734 0.006747
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.057966 -0.026525 -0.002343 0.021312 0.077325
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.198077 0.048873 4.053 0.000155 ***
WM 0.533259 0.008401 63.479 < 2e-16 ***
WV 0.423734 0.006563 64.567 < 2e-16 ***
WJ 0.006747 0.002578 2.618 0.011321 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.03281 on 57 degrees of freedom
Multiple R-squared: 0.9978, Adjusted R-squared: 0.9977
F-statistic: 8595 on 3 and 57 DF, p-value: < 2.2e-16
> if (n > n25) {
+ kp3 <- k + 3
+ nmkm3 <- n - k - 3
+ gqarr <- array(NA, dim=c(nmkm3-kp3+1,3))
+ numgqtests <- 0
+ numsignificant1 <- 0
+ numsignificant5 <- 0
+ numsignificant10 <- 0
+ for (mypoint in kp3:nmkm3) {
+ j <- 0
+ numgqtests <- numgqtests + 1
+ for (myalt in c('greater', 'two.sided', 'less')) {
+ j <- j + 1
+ gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value
+ }
+ if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1
+ }
+ gqarr
+ }
[,1] [,2] [,3]
[1,] 0.49873009 0.99746019 0.501269907
[2,] 0.32645990 0.65291979 0.673540103
[3,] 0.19653938 0.39307876 0.803460621
[4,] 0.23274596 0.46549193 0.767254035
[5,] 0.16107625 0.32215251 0.838923746
[6,] 0.10140903 0.20281806 0.898590969
[7,] 0.06891168 0.13782335 0.931088323
[8,] 0.04589707 0.09179414 0.954102931
[9,] 0.14590987 0.29181974 0.854090131
[10,] 0.10100409 0.20200818 0.898995909
[11,] 0.11929654 0.23859307 0.880703464
[12,] 0.11394730 0.22789459 0.886052705
[13,] 0.11345732 0.22691464 0.886542680
[14,] 0.13083466 0.26166931 0.869165344
[15,] 0.24800348 0.49600697 0.751996516
[16,] 0.21939124 0.43878248 0.780608760
[17,] 0.26537575 0.53075150 0.734624248
[18,] 0.22459859 0.44919717 0.775401414
[19,] 0.21606752 0.43213503 0.783932485
[20,] 0.23228146 0.46456292 0.767718538
[21,] 0.19313958 0.38627915 0.806860425
[22,] 0.18088696 0.36177392 0.819113041
[23,] 0.17298225 0.34596449 0.827017754
[24,] 0.18339288 0.36678577 0.816607116
[25,] 0.18071942 0.36143884 0.819280580
[26,] 0.16102585 0.32205170 0.838974152
[27,] 0.11870753 0.23741505 0.881292474
[28,] 0.22731229 0.45462459 0.772687705
[29,] 0.20185698 0.40371395 0.798143023
[30,] 0.15642497 0.31284994 0.843575028
[31,] 0.11633467 0.23266933 0.883665334
[32,] 0.10654899 0.21309797 0.893451015
[33,] 0.09443152 0.18886304 0.905568479
[34,] 0.07666614 0.15333228 0.923333862
[35,] 0.05149424 0.10298848 0.948505758
[36,] 0.13508965 0.27017929 0.864910354
[37,] 0.37363780 0.74727559 0.626362203
[38,] 0.34010492 0.68020984 0.659895082
[39,] 0.32186382 0.64372763 0.678136185
[40,] 0.29451246 0.58902492 0.705487540
[41,] 0.35002483 0.70004967 0.649975165
[42,] 0.35835090 0.71670181 0.641649096
[43,] 0.45536211 0.91072422 0.544637891
[44,] 0.63044062 0.73911875 0.369559375
[45,] 0.51426596 0.97146808 0.485734040
[46,] 0.99026682 0.01946637 0.009733184
[47,] 0.97908288 0.04183423 0.020917117
[48,] 0.96049255 0.07901489 0.039507446
> postscript(file="/var/www/html/rcomp/tmp/1wykt1258738873.ps",horizontal=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/2wd221258738873.ps",horizontal=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/39odb1258738873.ps",horizontal=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/4ddq51258738873.ps",horizontal=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/5cshi1258738873.ps",horizontal=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 = 61
Frequency = 1
1 2 3 4 5
-8.899736e-03 -1.416131e-03 -4.430707e-02 7.090210e-03 -2.263318e-02
6 7 8 9 10
3.701767e-02 -1.993424e-02 8.862034e-03 -2.342845e-03 -2.938856e-02
11 12 13 14 15
-3.308937e-02 -2.053502e-02 -3.148752e-02 -2.652483e-02 4.971595e-02
16 17 18 19 20
3.389807e-03 6.111207e-02 9.810417e-03 -4.499451e-05 -1.394881e-02
21 22 23 24 25
-5.127230e-02 -3.131714e-02 1.735953e-02 -1.213275e-02 2.131231e-02
26 27 28 29 30
3.732313e-02 2.123836e-02 -2.466543e-02 -1.901517e-02 3.566015e-02
31 32 33 34 35
4.096240e-02 3.649164e-02 1.735993e-02 -5.207197e-02 2.735927e-02
36 37 38 39 40
1.185361e-02 -2.554964e-03 -2.722848e-02 3.351946e-02 3.049379e-02
41 42 43 44 45
1.086537e-02 -5.796616e-02 7.732508e-02 -2.882993e-02 -3.565967e-02
46 47 48 49 50
2.204937e-02 3.872935e-02 -3.725904e-02 -4.434116e-02 -3.002304e-02
51 52 53 54 55
1.901526e-02 -2.613139e-02 6.520074e-02 -6.574052e-03 -3.050326e-02
56 57 58 59 60
-5.912142e-03 -2.394676e-02 -2.301965e-02 4.504956e-02 1.885660e-02
61
1.995369e-02
> postscript(file="/var/www/html/rcomp/tmp/6rsm91258738873.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 61
Frequency = 1
lag(myerror, k = 1) myerror
0 -8.899736e-03 NA
1 -1.416131e-03 -8.899736e-03
2 -4.430707e-02 -1.416131e-03
3 7.090210e-03 -4.430707e-02
4 -2.263318e-02 7.090210e-03
5 3.701767e-02 -2.263318e-02
6 -1.993424e-02 3.701767e-02
7 8.862034e-03 -1.993424e-02
8 -2.342845e-03 8.862034e-03
9 -2.938856e-02 -2.342845e-03
10 -3.308937e-02 -2.938856e-02
11 -2.053502e-02 -3.308937e-02
12 -3.148752e-02 -2.053502e-02
13 -2.652483e-02 -3.148752e-02
14 4.971595e-02 -2.652483e-02
15 3.389807e-03 4.971595e-02
16 6.111207e-02 3.389807e-03
17 9.810417e-03 6.111207e-02
18 -4.499451e-05 9.810417e-03
19 -1.394881e-02 -4.499451e-05
20 -5.127230e-02 -1.394881e-02
21 -3.131714e-02 -5.127230e-02
22 1.735953e-02 -3.131714e-02
23 -1.213275e-02 1.735953e-02
24 2.131231e-02 -1.213275e-02
25 3.732313e-02 2.131231e-02
26 2.123836e-02 3.732313e-02
27 -2.466543e-02 2.123836e-02
28 -1.901517e-02 -2.466543e-02
29 3.566015e-02 -1.901517e-02
30 4.096240e-02 3.566015e-02
31 3.649164e-02 4.096240e-02
32 1.735993e-02 3.649164e-02
33 -5.207197e-02 1.735993e-02
34 2.735927e-02 -5.207197e-02
35 1.185361e-02 2.735927e-02
36 -2.554964e-03 1.185361e-02
37 -2.722848e-02 -2.554964e-03
38 3.351946e-02 -2.722848e-02
39 3.049379e-02 3.351946e-02
40 1.086537e-02 3.049379e-02
41 -5.796616e-02 1.086537e-02
42 7.732508e-02 -5.796616e-02
43 -2.882993e-02 7.732508e-02
44 -3.565967e-02 -2.882993e-02
45 2.204937e-02 -3.565967e-02
46 3.872935e-02 2.204937e-02
47 -3.725904e-02 3.872935e-02
48 -4.434116e-02 -3.725904e-02
49 -3.002304e-02 -4.434116e-02
50 1.901526e-02 -3.002304e-02
51 -2.613139e-02 1.901526e-02
52 6.520074e-02 -2.613139e-02
53 -6.574052e-03 6.520074e-02
54 -3.050326e-02 -6.574052e-03
55 -5.912142e-03 -3.050326e-02
56 -2.394676e-02 -5.912142e-03
57 -2.301965e-02 -2.394676e-02
58 4.504956e-02 -2.301965e-02
59 1.885660e-02 4.504956e-02
60 1.995369e-02 1.885660e-02
61 NA 1.995369e-02
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.416131e-03 -8.899736e-03
[2,] -4.430707e-02 -1.416131e-03
[3,] 7.090210e-03 -4.430707e-02
[4,] -2.263318e-02 7.090210e-03
[5,] 3.701767e-02 -2.263318e-02
[6,] -1.993424e-02 3.701767e-02
[7,] 8.862034e-03 -1.993424e-02
[8,] -2.342845e-03 8.862034e-03
[9,] -2.938856e-02 -2.342845e-03
[10,] -3.308937e-02 -2.938856e-02
[11,] -2.053502e-02 -3.308937e-02
[12,] -3.148752e-02 -2.053502e-02
[13,] -2.652483e-02 -3.148752e-02
[14,] 4.971595e-02 -2.652483e-02
[15,] 3.389807e-03 4.971595e-02
[16,] 6.111207e-02 3.389807e-03
[17,] 9.810417e-03 6.111207e-02
[18,] -4.499451e-05 9.810417e-03
[19,] -1.394881e-02 -4.499451e-05
[20,] -5.127230e-02 -1.394881e-02
[21,] -3.131714e-02 -5.127230e-02
[22,] 1.735953e-02 -3.131714e-02
[23,] -1.213275e-02 1.735953e-02
[24,] 2.131231e-02 -1.213275e-02
[25,] 3.732313e-02 2.131231e-02
[26,] 2.123836e-02 3.732313e-02
[27,] -2.466543e-02 2.123836e-02
[28,] -1.901517e-02 -2.466543e-02
[29,] 3.566015e-02 -1.901517e-02
[30,] 4.096240e-02 3.566015e-02
[31,] 3.649164e-02 4.096240e-02
[32,] 1.735993e-02 3.649164e-02
[33,] -5.207197e-02 1.735993e-02
[34,] 2.735927e-02 -5.207197e-02
[35,] 1.185361e-02 2.735927e-02
[36,] -2.554964e-03 1.185361e-02
[37,] -2.722848e-02 -2.554964e-03
[38,] 3.351946e-02 -2.722848e-02
[39,] 3.049379e-02 3.351946e-02
[40,] 1.086537e-02 3.049379e-02
[41,] -5.796616e-02 1.086537e-02
[42,] 7.732508e-02 -5.796616e-02
[43,] -2.882993e-02 7.732508e-02
[44,] -3.565967e-02 -2.882993e-02
[45,] 2.204937e-02 -3.565967e-02
[46,] 3.872935e-02 2.204937e-02
[47,] -3.725904e-02 3.872935e-02
[48,] -4.434116e-02 -3.725904e-02
[49,] -3.002304e-02 -4.434116e-02
[50,] 1.901526e-02 -3.002304e-02
[51,] -2.613139e-02 1.901526e-02
[52,] 6.520074e-02 -2.613139e-02
[53,] -6.574052e-03 6.520074e-02
[54,] -3.050326e-02 -6.574052e-03
[55,] -5.912142e-03 -3.050326e-02
[56,] -2.394676e-02 -5.912142e-03
[57,] -2.301965e-02 -2.394676e-02
[58,] 4.504956e-02 -2.301965e-02
[59,] 1.885660e-02 4.504956e-02
[60,] 1.995369e-02 1.885660e-02
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.416131e-03 -8.899736e-03
2 -4.430707e-02 -1.416131e-03
3 7.090210e-03 -4.430707e-02
4 -2.263318e-02 7.090210e-03
5 3.701767e-02 -2.263318e-02
6 -1.993424e-02 3.701767e-02
7 8.862034e-03 -1.993424e-02
8 -2.342845e-03 8.862034e-03
9 -2.938856e-02 -2.342845e-03
10 -3.308937e-02 -2.938856e-02
11 -2.053502e-02 -3.308937e-02
12 -3.148752e-02 -2.053502e-02
13 -2.652483e-02 -3.148752e-02
14 4.971595e-02 -2.652483e-02
15 3.389807e-03 4.971595e-02
16 6.111207e-02 3.389807e-03
17 9.810417e-03 6.111207e-02
18 -4.499451e-05 9.810417e-03
19 -1.394881e-02 -4.499451e-05
20 -5.127230e-02 -1.394881e-02
21 -3.131714e-02 -5.127230e-02
22 1.735953e-02 -3.131714e-02
23 -1.213275e-02 1.735953e-02
24 2.131231e-02 -1.213275e-02
25 3.732313e-02 2.131231e-02
26 2.123836e-02 3.732313e-02
27 -2.466543e-02 2.123836e-02
28 -1.901517e-02 -2.466543e-02
29 3.566015e-02 -1.901517e-02
30 4.096240e-02 3.566015e-02
31 3.649164e-02 4.096240e-02
32 1.735993e-02 3.649164e-02
33 -5.207197e-02 1.735993e-02
34 2.735927e-02 -5.207197e-02
35 1.185361e-02 2.735927e-02
36 -2.554964e-03 1.185361e-02
37 -2.722848e-02 -2.554964e-03
38 3.351946e-02 -2.722848e-02
39 3.049379e-02 3.351946e-02
40 1.086537e-02 3.049379e-02
41 -5.796616e-02 1.086537e-02
42 7.732508e-02 -5.796616e-02
43 -2.882993e-02 7.732508e-02
44 -3.565967e-02 -2.882993e-02
45 2.204937e-02 -3.565967e-02
46 3.872935e-02 2.204937e-02
47 -3.725904e-02 3.872935e-02
48 -4.434116e-02 -3.725904e-02
49 -3.002304e-02 -4.434116e-02
50 1.901526e-02 -3.002304e-02
51 -2.613139e-02 1.901526e-02
52 6.520074e-02 -2.613139e-02
53 -6.574052e-03 6.520074e-02
54 -3.050326e-02 -6.574052e-03
55 -5.912142e-03 -3.050326e-02
56 -2.394676e-02 -5.912142e-03
57 -2.301965e-02 -2.394676e-02
58 4.504956e-02 -2.301965e-02
59 1.885660e-02 4.504956e-02
60 1.995369e-02 1.885660e-02
> 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/760za1258738873.ps",horizontal=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/89me61258738873.ps",horizontal=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/9cjyr1258738873.ps",horizontal=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/10km431258738873.ps",horizontal=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/11mjyf1258738873.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/128sxq1258738873.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/13fj521258738873.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/14amie1258738873.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/15t3b61258738873.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/16vgll1258738873.tab")
+ }
>
> system("convert tmp/1wykt1258738873.ps tmp/1wykt1258738873.png")
> system("convert tmp/2wd221258738873.ps tmp/2wd221258738873.png")
> system("convert tmp/39odb1258738873.ps tmp/39odb1258738873.png")
> system("convert tmp/4ddq51258738873.ps tmp/4ddq51258738873.png")
> system("convert tmp/5cshi1258738873.ps tmp/5cshi1258738873.png")
> system("convert tmp/6rsm91258738873.ps tmp/6rsm91258738873.png")
> system("convert tmp/760za1258738873.ps tmp/760za1258738873.png")
> system("convert tmp/89me61258738873.ps tmp/89me61258738873.png")
> system("convert tmp/9cjyr1258738873.ps tmp/9cjyr1258738873.png")
> system("convert tmp/10km431258738873.ps tmp/10km431258738873.png")
>
>
> proc.time()
user system elapsed
2.541 1.608 3.294