R version 2.7.0 (2008-04-22)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
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(17.3,0,15.4,0,16.9,0,20.8,0,16.4,0,11.3,0,17.5,0,16.6,0,17.5,0,19.5,0,18.8,0,20.2,0,19.2,0,14.4,0,24.5,0,25.7,0,27.1,0,21,0,18.6,0,20,0,21.8,0,20.4,0,18,1,21.5,1,19.1,1,19.7,1,26,1,26.3,1,24.6,1,22.4,1,32,1,24,1,30,1,24.1,1,26.3,1,29.8,1,21.9,1,22.8,1,29.2,1,27.5,1,27.4,1,31,1,26.1,1,22.2,1,34,1,26.9,1,31.9,1,34.2,1,31.2,1,28.5,1,37.1,1,36,1,34.8,1,32.1,1,37.2,1,36.3,1,39.5,1,37.1,1,35.6,1,36.2,1,35.9,1,32.5,1,39.2,1,39.4,1,42.8,1,34.5,1,43.7,1,46.3,1,40.8,1,48.4,1,43.2,1,48.1,1,42.8,1),dim=c(2,73),dimnames=list(c('Aantal_werklozen','Dummyvariabele'),1:73))
> y <- array(NA,dim=c(2,73),dimnames=list(c('Aantal_werklozen','Dummyvariabele'),1:73))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par20 = ''
> par19 = ''
> par18 = ''
> par17 = ''
> par16 = ''
> par15 = ''
> par14 = ''
> par13 = ''
> par12 = ''
> par11 = ''
> par10 = ''
> par9 = ''
> par8 = ''
> par7 = ''
> par6 = ''
> par5 = ''
> par4 = ''
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '1'
> ylab = ''
> xlab = ''
> main = ''
> #'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
Aantal_werklozen Dummyvariabele
1 17.3 0
2 15.4 0
3 16.9 0
4 20.8 0
5 16.4 0
6 11.3 0
7 17.5 0
8 16.6 0
9 17.5 0
10 19.5 0
11 18.8 0
12 20.2 0
13 19.2 0
14 14.4 0
15 24.5 0
16 25.7 0
17 27.1 0
18 21.0 0
19 18.6 0
20 20.0 0
21 21.8 0
22 20.4 0
23 18.0 1
24 21.5 1
25 19.1 1
26 19.7 1
27 26.0 1
28 26.3 1
29 24.6 1
30 22.4 1
31 32.0 1
32 24.0 1
33 30.0 1
34 24.1 1
35 26.3 1
36 29.8 1
37 21.9 1
38 22.8 1
39 29.2 1
40 27.5 1
41 27.4 1
42 31.0 1
43 26.1 1
44 22.2 1
45 34.0 1
46 26.9 1
47 31.9 1
48 34.2 1
49 31.2 1
50 28.5 1
51 37.1 1
52 36.0 1
53 34.8 1
54 32.1 1
55 37.2 1
56 36.3 1
57 39.5 1
58 37.1 1
59 35.6 1
60 36.2 1
61 35.9 1
62 32.5 1
63 39.2 1
64 39.4 1
65 42.8 1
66 34.5 1
67 43.7 1
68 46.3 1
69 40.8 1
70 48.4 1
71 43.2 1
72 48.1 1
73 42.8 1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Dummyvariabele
19.13 12.99
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-14.1196 -4.7196 -0.1196 4.0804 16.2804
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 19.132 1.463 13.079 < 2e-16 ***
Dummyvariabele 12.988 1.750 7.421 1.97e-10 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 6.861 on 71 degrees of freedom
Multiple R-squared: 0.4368, Adjusted R-squared: 0.4289
F-statistic: 55.08 on 1 and 71 DF, p-value: 1.97e-10
> 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.0471507173 0.0943014347 0.9528493
[2,] 0.0844085911 0.1688171822 0.9155914
[3,] 0.0357548428 0.0715096856 0.9642452
[4,] 0.0134953100 0.0269906199 0.9865047
[5,] 0.0049851194 0.0099702387 0.9950149
[6,] 0.0026856589 0.0053713179 0.9973143
[7,] 0.0011101043 0.0022202086 0.9988899
[8,] 0.0006561070 0.0013122141 0.9993439
[9,] 0.0002674196 0.0005348391 0.9997326
[10,] 0.0001727365 0.0003454730 0.9998273
[11,] 0.0007748284 0.0015496569 0.9992252
[12,] 0.0025292933 0.0050585866 0.9974707
[13,] 0.0074546877 0.0149093754 0.9925453
[14,] 0.0042030298 0.0084060596 0.9957970
[15,] 0.0021017759 0.0042035518 0.9978982
[16,] 0.0010381241 0.0020762481 0.9989619
[17,] 0.0005898574 0.0011797148 0.9994101
[18,] 0.0002806543 0.0005613085 0.9997193
[19,] 0.0002122453 0.0004244907 0.9997878
[20,] 0.0001595671 0.0003191342 0.9998404
[21,] 0.0001293009 0.0002586019 0.9998707
[22,] 0.0001081260 0.0002162521 0.9998919
[23,] 0.0001571438 0.0003142876 0.9998429
[24,] 0.0001741522 0.0003483043 0.9998258
[25,] 0.0001376552 0.0002753103 0.9998623
[26,] 0.0001161107 0.0002322214 0.9998839
[27,] 0.0004379046 0.0008758093 0.9995621
[28,] 0.0003619470 0.0007238940 0.9996381
[29,] 0.0004615228 0.0009230456 0.9995385
[30,] 0.0004122660 0.0008245319 0.9995877
[31,] 0.0003468016 0.0006936032 0.9996532
[32,] 0.0003738785 0.0007477570 0.9996261
[33,] 0.0006316412 0.0012632824 0.9993684
[34,] 0.0010158805 0.0020317611 0.9989841
[35,] 0.0011338763 0.0022677526 0.9988661
[36,] 0.0012220005 0.0024440009 0.9987780
[37,] 0.0013986453 0.0027972905 0.9986014
[38,] 0.0017906096 0.0035812192 0.9982094
[39,] 0.0026516357 0.0053032714 0.9973484
[40,] 0.0130790819 0.0261581638 0.9869209
[41,] 0.0222862605 0.0445725211 0.9777137
[42,] 0.0426879732 0.0853759464 0.9573120
[43,] 0.0579550897 0.1159101793 0.9420449
[44,] 0.0783451862 0.1566903723 0.9216548
[45,] 0.1039860089 0.2079720177 0.8960140
[46,] 0.1956847249 0.3913694499 0.8043153
[47,] 0.2519911881 0.5039823763 0.7480088
[48,] 0.2859664080 0.5719328161 0.7140336
[49,] 0.3145151226 0.6290302452 0.6854849
[50,] 0.3978775990 0.7957551981 0.6021224
[51,] 0.4193087316 0.8386174632 0.5806913
[52,] 0.4345261641 0.8690523282 0.5654738
[53,] 0.4444556830 0.8889113660 0.5555443
[54,] 0.4365777980 0.8731555960 0.5634222
[55,] 0.4482002748 0.8964005496 0.5517997
[56,] 0.4544483299 0.9088966598 0.5455517
[57,] 0.4771832987 0.9543665973 0.5228167
[58,] 0.7055771738 0.5888456523 0.2944228
[59,] 0.6922009839 0.6155980322 0.3077990
[60,] 0.6745267494 0.6509465011 0.3254733
[61,] 0.6087766968 0.7824466065 0.3912233
[62,] 0.8994107960 0.2011784080 0.1005892
[63,] 0.8344927093 0.3310145813 0.1655073
[64,] 0.7390337865 0.5219324270 0.2609662
> postscript(file="/var/www/html/rcomp/tmp/1adp81229985038.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/2j74y1229985038.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/3tbnv1229985038.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/4f0mo1229985038.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/57qaf1229985038.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 = 73
Frequency = 1
1 2 3 4 5 6
-1.83181818 -3.73181818 -2.23181818 1.66818182 -2.73181818 -7.83181818
7 8 9 10 11 12
-1.63181818 -2.53181818 -1.63181818 0.36818182 -0.33181818 1.06818182
13 14 15 16 17 18
0.06818182 -4.73181818 5.36818182 6.56818182 7.96818182 1.86818182
19 20 21 22 23 24
-0.53181818 0.86818182 2.66818182 1.26818182 -14.11960784 -10.61960784
25 26 27 28 29 30
-13.01960784 -12.41960784 -6.11960784 -5.81960784 -7.51960784 -9.71960784
31 32 33 34 35 36
-0.11960784 -8.11960784 -2.11960784 -8.01960784 -5.81960784 -2.31960784
37 38 39 40 41 42
-10.21960784 -9.31960784 -2.91960784 -4.61960784 -4.71960784 -1.11960784
43 44 45 46 47 48
-6.01960784 -9.91960784 1.88039216 -5.21960784 -0.21960784 2.08039216
49 50 51 52 53 54
-0.91960784 -3.61960784 4.98039216 3.88039216 2.68039216 -0.01960784
55 56 57 58 59 60
5.08039216 4.18039216 7.38039216 4.98039216 3.48039216 4.08039216
61 62 63 64 65 66
3.78039216 0.38039216 7.08039216 7.28039216 10.68039216 2.38039216
67 68 69 70 71 72
11.58039216 14.18039216 8.68039216 16.28039216 11.08039216 15.98039216
73
10.68039216
> postscript(file="/var/www/html/rcomp/tmp/6l8061229985038.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 = 73
Frequency = 1
lag(myerror, k = 1) myerror
0 -1.83181818 NA
1 -3.73181818 -1.83181818
2 -2.23181818 -3.73181818
3 1.66818182 -2.23181818
4 -2.73181818 1.66818182
5 -7.83181818 -2.73181818
6 -1.63181818 -7.83181818
7 -2.53181818 -1.63181818
8 -1.63181818 -2.53181818
9 0.36818182 -1.63181818
10 -0.33181818 0.36818182
11 1.06818182 -0.33181818
12 0.06818182 1.06818182
13 -4.73181818 0.06818182
14 5.36818182 -4.73181818
15 6.56818182 5.36818182
16 7.96818182 6.56818182
17 1.86818182 7.96818182
18 -0.53181818 1.86818182
19 0.86818182 -0.53181818
20 2.66818182 0.86818182
21 1.26818182 2.66818182
22 -14.11960784 1.26818182
23 -10.61960784 -14.11960784
24 -13.01960784 -10.61960784
25 -12.41960784 -13.01960784
26 -6.11960784 -12.41960784
27 -5.81960784 -6.11960784
28 -7.51960784 -5.81960784
29 -9.71960784 -7.51960784
30 -0.11960784 -9.71960784
31 -8.11960784 -0.11960784
32 -2.11960784 -8.11960784
33 -8.01960784 -2.11960784
34 -5.81960784 -8.01960784
35 -2.31960784 -5.81960784
36 -10.21960784 -2.31960784
37 -9.31960784 -10.21960784
38 -2.91960784 -9.31960784
39 -4.61960784 -2.91960784
40 -4.71960784 -4.61960784
41 -1.11960784 -4.71960784
42 -6.01960784 -1.11960784
43 -9.91960784 -6.01960784
44 1.88039216 -9.91960784
45 -5.21960784 1.88039216
46 -0.21960784 -5.21960784
47 2.08039216 -0.21960784
48 -0.91960784 2.08039216
49 -3.61960784 -0.91960784
50 4.98039216 -3.61960784
51 3.88039216 4.98039216
52 2.68039216 3.88039216
53 -0.01960784 2.68039216
54 5.08039216 -0.01960784
55 4.18039216 5.08039216
56 7.38039216 4.18039216
57 4.98039216 7.38039216
58 3.48039216 4.98039216
59 4.08039216 3.48039216
60 3.78039216 4.08039216
61 0.38039216 3.78039216
62 7.08039216 0.38039216
63 7.28039216 7.08039216
64 10.68039216 7.28039216
65 2.38039216 10.68039216
66 11.58039216 2.38039216
67 14.18039216 11.58039216
68 8.68039216 14.18039216
69 16.28039216 8.68039216
70 11.08039216 16.28039216
71 15.98039216 11.08039216
72 10.68039216 15.98039216
73 NA 10.68039216
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -3.73181818 -1.83181818
[2,] -2.23181818 -3.73181818
[3,] 1.66818182 -2.23181818
[4,] -2.73181818 1.66818182
[5,] -7.83181818 -2.73181818
[6,] -1.63181818 -7.83181818
[7,] -2.53181818 -1.63181818
[8,] -1.63181818 -2.53181818
[9,] 0.36818182 -1.63181818
[10,] -0.33181818 0.36818182
[11,] 1.06818182 -0.33181818
[12,] 0.06818182 1.06818182
[13,] -4.73181818 0.06818182
[14,] 5.36818182 -4.73181818
[15,] 6.56818182 5.36818182
[16,] 7.96818182 6.56818182
[17,] 1.86818182 7.96818182
[18,] -0.53181818 1.86818182
[19,] 0.86818182 -0.53181818
[20,] 2.66818182 0.86818182
[21,] 1.26818182 2.66818182
[22,] -14.11960784 1.26818182
[23,] -10.61960784 -14.11960784
[24,] -13.01960784 -10.61960784
[25,] -12.41960784 -13.01960784
[26,] -6.11960784 -12.41960784
[27,] -5.81960784 -6.11960784
[28,] -7.51960784 -5.81960784
[29,] -9.71960784 -7.51960784
[30,] -0.11960784 -9.71960784
[31,] -8.11960784 -0.11960784
[32,] -2.11960784 -8.11960784
[33,] -8.01960784 -2.11960784
[34,] -5.81960784 -8.01960784
[35,] -2.31960784 -5.81960784
[36,] -10.21960784 -2.31960784
[37,] -9.31960784 -10.21960784
[38,] -2.91960784 -9.31960784
[39,] -4.61960784 -2.91960784
[40,] -4.71960784 -4.61960784
[41,] -1.11960784 -4.71960784
[42,] -6.01960784 -1.11960784
[43,] -9.91960784 -6.01960784
[44,] 1.88039216 -9.91960784
[45,] -5.21960784 1.88039216
[46,] -0.21960784 -5.21960784
[47,] 2.08039216 -0.21960784
[48,] -0.91960784 2.08039216
[49,] -3.61960784 -0.91960784
[50,] 4.98039216 -3.61960784
[51,] 3.88039216 4.98039216
[52,] 2.68039216 3.88039216
[53,] -0.01960784 2.68039216
[54,] 5.08039216 -0.01960784
[55,] 4.18039216 5.08039216
[56,] 7.38039216 4.18039216
[57,] 4.98039216 7.38039216
[58,] 3.48039216 4.98039216
[59,] 4.08039216 3.48039216
[60,] 3.78039216 4.08039216
[61,] 0.38039216 3.78039216
[62,] 7.08039216 0.38039216
[63,] 7.28039216 7.08039216
[64,] 10.68039216 7.28039216
[65,] 2.38039216 10.68039216
[66,] 11.58039216 2.38039216
[67,] 14.18039216 11.58039216
[68,] 8.68039216 14.18039216
[69,] 16.28039216 8.68039216
[70,] 11.08039216 16.28039216
[71,] 15.98039216 11.08039216
[72,] 10.68039216 15.98039216
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -3.73181818 -1.83181818
2 -2.23181818 -3.73181818
3 1.66818182 -2.23181818
4 -2.73181818 1.66818182
5 -7.83181818 -2.73181818
6 -1.63181818 -7.83181818
7 -2.53181818 -1.63181818
8 -1.63181818 -2.53181818
9 0.36818182 -1.63181818
10 -0.33181818 0.36818182
11 1.06818182 -0.33181818
12 0.06818182 1.06818182
13 -4.73181818 0.06818182
14 5.36818182 -4.73181818
15 6.56818182 5.36818182
16 7.96818182 6.56818182
17 1.86818182 7.96818182
18 -0.53181818 1.86818182
19 0.86818182 -0.53181818
20 2.66818182 0.86818182
21 1.26818182 2.66818182
22 -14.11960784 1.26818182
23 -10.61960784 -14.11960784
24 -13.01960784 -10.61960784
25 -12.41960784 -13.01960784
26 -6.11960784 -12.41960784
27 -5.81960784 -6.11960784
28 -7.51960784 -5.81960784
29 -9.71960784 -7.51960784
30 -0.11960784 -9.71960784
31 -8.11960784 -0.11960784
32 -2.11960784 -8.11960784
33 -8.01960784 -2.11960784
34 -5.81960784 -8.01960784
35 -2.31960784 -5.81960784
36 -10.21960784 -2.31960784
37 -9.31960784 -10.21960784
38 -2.91960784 -9.31960784
39 -4.61960784 -2.91960784
40 -4.71960784 -4.61960784
41 -1.11960784 -4.71960784
42 -6.01960784 -1.11960784
43 -9.91960784 -6.01960784
44 1.88039216 -9.91960784
45 -5.21960784 1.88039216
46 -0.21960784 -5.21960784
47 2.08039216 -0.21960784
48 -0.91960784 2.08039216
49 -3.61960784 -0.91960784
50 4.98039216 -3.61960784
51 3.88039216 4.98039216
52 2.68039216 3.88039216
53 -0.01960784 2.68039216
54 5.08039216 -0.01960784
55 4.18039216 5.08039216
56 7.38039216 4.18039216
57 4.98039216 7.38039216
58 3.48039216 4.98039216
59 4.08039216 3.48039216
60 3.78039216 4.08039216
61 0.38039216 3.78039216
62 7.08039216 0.38039216
63 7.28039216 7.08039216
64 10.68039216 7.28039216
65 2.38039216 10.68039216
66 11.58039216 2.38039216
67 14.18039216 11.58039216
68 8.68039216 14.18039216
69 16.28039216 8.68039216
70 11.08039216 16.28039216
71 15.98039216 11.08039216
72 10.68039216 15.98039216
> 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/7vl7c1229985038.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/817ou1229985038.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/93hf41229985038.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/10hwlp1229985038.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/117lue1229985038.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/12xf4n1229985038.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/13kymg1229985038.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/14hku41229985039.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/15vxyo1229985039.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/1678tg1229985039.tab")
+ }
>
> system("convert tmp/1adp81229985038.ps tmp/1adp81229985038.png")
> system("convert tmp/2j74y1229985038.ps tmp/2j74y1229985038.png")
> system("convert tmp/3tbnv1229985038.ps tmp/3tbnv1229985038.png")
> system("convert tmp/4f0mo1229985038.ps tmp/4f0mo1229985038.png")
> system("convert tmp/57qaf1229985038.ps tmp/57qaf1229985038.png")
> system("convert tmp/6l8061229985038.ps tmp/6l8061229985038.png")
> system("convert tmp/7vl7c1229985038.ps tmp/7vl7c1229985038.png")
> system("convert tmp/817ou1229985038.ps tmp/817ou1229985038.png")
> system("convert tmp/93hf41229985038.ps tmp/93hf41229985038.png")
> system("convert tmp/10hwlp1229985038.ps tmp/10hwlp1229985038.png")
>
>
> proc.time()
user system elapsed
5.262 2.780 5.649