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(14544.5,94.6,15116.3,95.9,17413.2,104.7,16181.5,102.8,15607.4,98.1,17160.9,113.9,14915.8,80.9,13768,95.7,17487.5,113.2,16198.1,105.9,17535.2,108.8,16571.8,102.3,16198.9,99,16554.2,100.7,19554.2,115.5,15903.8,100.7,18003.8,109.9,18329.6,114.6,16260.7,85.4,14851.9,100.5,18174.1,114.8,18406.6,116.5,18466.5,112.9,16016.5,102,17428.5,106,17167.2,105.3,19630,118.8,17183.6,106.1,18344.7,109.3,19301.4,117.2,18147.5,92.5,16192.9,104.2,18374.4,112.5,20515.2,122.4,18957.2,113.3,16471.5,100,18746.8,110.7,19009.5,112.8,19211.2,109.8,20547.7,117.3,19325.8,109.1,20605.5,115.9,20056.9,96,16141.4,99.8,20359.8,116.8,19711.6,115.7,15638.6,99.4,14384.5,94.3,13855.6,91,14308.3,93.2,15290.6,103.1,14423.8,94.1,13779.7,91.8,15686.3,102.7,14733.8,82.6,12522.5,89.1,16189.4,104.5,16059.1,105.1,16007.1,95.1,15806.8,88.7,15160,86.3,15692.1,91.8,18908.9,111.5,16969.9,99.7,16997.5,97.5,19858.9,111.7,17681.2,86.2,16006.9,95.4),dim=c(2,68),dimnames=list(c('uitvoer','productie'),1:68))
> y <- array(NA,dim=c(2,68),dimnames=list(c('uitvoer','productie'),1:68))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '2'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
productie uitvoer
1 94.6 14544.5
2 95.9 15116.3
3 104.7 17413.2
4 102.8 16181.5
5 98.1 15607.4
6 113.9 17160.9
7 80.9 14915.8
8 95.7 13768.0
9 113.2 17487.5
10 105.9 16198.1
11 108.8 17535.2
12 102.3 16571.8
13 99.0 16198.9
14 100.7 16554.2
15 115.5 19554.2
16 100.7 15903.8
17 109.9 18003.8
18 114.6 18329.6
19 85.4 16260.7
20 100.5 14851.9
21 114.8 18174.1
22 116.5 18406.6
23 112.9 18466.5
24 102.0 16016.5
25 106.0 17428.5
26 105.3 17167.2
27 118.8 19630.0
28 106.1 17183.6
29 109.3 18344.7
30 117.2 19301.4
31 92.5 18147.5
32 104.2 16192.9
33 112.5 18374.4
34 122.4 20515.2
35 113.3 18957.2
36 100.0 16471.5
37 110.7 18746.8
38 112.8 19009.5
39 109.8 19211.2
40 117.3 20547.7
41 109.1 19325.8
42 115.9 20605.5
43 96.0 20056.9
44 99.8 16141.4
45 116.8 20359.8
46 115.7 19711.6
47 99.4 15638.6
48 94.3 14384.5
49 91.0 13855.6
50 93.2 14308.3
51 103.1 15290.6
52 94.1 14423.8
53 91.8 13779.7
54 102.7 15686.3
55 82.6 14733.8
56 89.1 12522.5
57 104.5 16189.4
58 105.1 16059.1
59 95.1 16007.1
60 88.7 15806.8
61 86.3 15160.0
62 91.8 15692.1
63 111.5 18908.9
64 99.7 16969.9
65 97.5 16997.5
66 111.7 19858.9
67 86.2 17681.2
68 95.4 16006.9
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) uitvoer
35.384515 0.003985
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-19.649 -1.172 1.242 3.896 10.124
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.538e+01 6.782e+00 5.217 1.97e-06 ***
uitvoer 3.985e-03 3.962e-04 10.059 5.96e-15 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 6.299 on 66 degrees of freedom
Multiple R-squared: 0.6052, Adjusted R-squared: 0.5992
F-statistic: 101.2 on 1 and 66 DF, p-value: 5.958e-15
> 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.01223939 0.02447877 0.9877606
[2,] 0.16524366 0.33048732 0.8347563
[3,] 0.64691962 0.70616076 0.3530804
[4,] 0.73396968 0.53206065 0.2660303
[5,] 0.68020636 0.63958728 0.3197936
[6,] 0.61175575 0.77648851 0.3882443
[7,] 0.51802471 0.96395057 0.4819753
[8,] 0.42731357 0.85462713 0.5726864
[9,] 0.35326154 0.70652308 0.6467385
[10,] 0.28750598 0.57501197 0.7124940
[11,] 0.24084804 0.48169608 0.7591520
[12,] 0.17714199 0.35428397 0.8228580
[13,] 0.12749923 0.25499845 0.8725008
[14,] 0.09965527 0.19931055 0.9003447
[15,] 0.47340044 0.94680089 0.5265996
[16,] 0.47460518 0.94921037 0.5253948
[17,] 0.44769594 0.89539189 0.5523041
[18,] 0.43391552 0.86783104 0.5660845
[19,] 0.37458896 0.74917793 0.6254110
[20,] 0.31488001 0.62976003 0.6851200
[21,] 0.25738699 0.51477398 0.7426130
[22,] 0.20490302 0.40980604 0.7950970
[23,] 0.17578657 0.35157314 0.8242134
[24,] 0.13683549 0.27367099 0.8631645
[25,] 0.10857738 0.21715477 0.8914226
[26,] 0.09199418 0.18398835 0.9080058
[27,] 0.44376614 0.88753229 0.5562339
[28,] 0.40857534 0.81715068 0.5914247
[29,] 0.36880632 0.73761264 0.6311937
[30,] 0.36018302 0.72036603 0.6398170
[31,] 0.31940791 0.63881582 0.6805921
[32,] 0.26330392 0.52660783 0.7366961
[33,] 0.22213878 0.44427757 0.7778612
[34,] 0.19080533 0.38161066 0.8091947
[35,] 0.16370934 0.32741869 0.8362907
[36,] 0.14388020 0.28776039 0.8561198
[37,] 0.12329484 0.24658968 0.8767052
[38,] 0.10651258 0.21302516 0.8934874
[39,] 0.50128602 0.99742796 0.4987140
[40,] 0.43116898 0.86233796 0.5688310
[41,] 0.38127324 0.76254648 0.6187268
[42,] 0.36854628 0.73709256 0.6314537
[43,] 0.31330075 0.62660150 0.6866992
[44,] 0.25316889 0.50633778 0.7468311
[45,] 0.19509101 0.39018202 0.8049090
[46,] 0.14686730 0.29373460 0.8531327
[47,] 0.17571120 0.35142240 0.8242888
[48,] 0.13502573 0.27005146 0.8649743
[49,] 0.10210645 0.20421291 0.8978935
[50,] 0.11594060 0.23188121 0.8840594
[51,] 0.17846423 0.35692846 0.8215358
[52,] 0.16725785 0.33451570 0.8327421
[53,] 0.22489916 0.44979833 0.7751008
[54,] 0.44750546 0.89501092 0.5524945
[55,] 0.37863243 0.75726487 0.6213676
[56,] 0.31533744 0.63067487 0.6846626
[57,] 0.24282581 0.48565163 0.7571742
[58,] 0.15850384 0.31700769 0.8414962
[59,] 0.13488800 0.26977600 0.8651120
> postscript(file="/var/www/html/rcomp/tmp/1bvbb1290542189.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/2bvbb1290542189.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/3mnae1290542189.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/4mnae1290542189.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/5mnae1290542189.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 = 68
Frequency = 1
1 2 3 4 5 6
1.25123906 0.27244254 -0.08140101 2.92729728 0.51526000 10.12409105
7 8 9 10 11 12
-13.92850412 5.44582721 8.12249094 5.96114124 3.53239196 0.87183333
13 14 15 16 17 18
-0.94204701 -0.65802533 2.18606425 1.93401605 2.76487875 6.16646688
19 20 21 22 23 24
-14.78833876 5.92615677 6.98618157 7.75959852 3.92087884 2.78487235
25 26 27 28 29 30
1.15762384 1.49898364 5.18397825 2.23362466 0.80628880 4.89354897
31 32 33 34 35 36
-15.20780935 4.28186482 3.88792529 5.25618761 2.36529042 -1.02844073
37 38 39 40 41 42
0.60379827 1.65685905 -2.14697666 0.02666525 -3.30369244 -1.60368529
43 44 45 46 47 48
-19.31734781 0.08710794 0.27550377 1.75877748 1.69091853 1.58888762
49 50 51 52 53 54
0.39671462 0.79256774 6.77780414 1.23226519 1.49919916 4.80081956
55 56 57 58 59 60
-11.50317889 3.80952269 4.59581338 5.71509842 -4.07766580 -9.67940951
61 62 63 64 65 66
-9.50171523 -6.12229520 0.75778058 -3.31471598 -5.62471036 -2.82825772
67 68
-19.64946234 -3.77686874
> postscript(file="/var/www/html/rcomp/tmp/6we9z1290542189.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 = 68
Frequency = 1
lag(myerror, k = 1) myerror
0 1.25123906 NA
1 0.27244254 1.25123906
2 -0.08140101 0.27244254
3 2.92729728 -0.08140101
4 0.51526000 2.92729728
5 10.12409105 0.51526000
6 -13.92850412 10.12409105
7 5.44582721 -13.92850412
8 8.12249094 5.44582721
9 5.96114124 8.12249094
10 3.53239196 5.96114124
11 0.87183333 3.53239196
12 -0.94204701 0.87183333
13 -0.65802533 -0.94204701
14 2.18606425 -0.65802533
15 1.93401605 2.18606425
16 2.76487875 1.93401605
17 6.16646688 2.76487875
18 -14.78833876 6.16646688
19 5.92615677 -14.78833876
20 6.98618157 5.92615677
21 7.75959852 6.98618157
22 3.92087884 7.75959852
23 2.78487235 3.92087884
24 1.15762384 2.78487235
25 1.49898364 1.15762384
26 5.18397825 1.49898364
27 2.23362466 5.18397825
28 0.80628880 2.23362466
29 4.89354897 0.80628880
30 -15.20780935 4.89354897
31 4.28186482 -15.20780935
32 3.88792529 4.28186482
33 5.25618761 3.88792529
34 2.36529042 5.25618761
35 -1.02844073 2.36529042
36 0.60379827 -1.02844073
37 1.65685905 0.60379827
38 -2.14697666 1.65685905
39 0.02666525 -2.14697666
40 -3.30369244 0.02666525
41 -1.60368529 -3.30369244
42 -19.31734781 -1.60368529
43 0.08710794 -19.31734781
44 0.27550377 0.08710794
45 1.75877748 0.27550377
46 1.69091853 1.75877748
47 1.58888762 1.69091853
48 0.39671462 1.58888762
49 0.79256774 0.39671462
50 6.77780414 0.79256774
51 1.23226519 6.77780414
52 1.49919916 1.23226519
53 4.80081956 1.49919916
54 -11.50317889 4.80081956
55 3.80952269 -11.50317889
56 4.59581338 3.80952269
57 5.71509842 4.59581338
58 -4.07766580 5.71509842
59 -9.67940951 -4.07766580
60 -9.50171523 -9.67940951
61 -6.12229520 -9.50171523
62 0.75778058 -6.12229520
63 -3.31471598 0.75778058
64 -5.62471036 -3.31471598
65 -2.82825772 -5.62471036
66 -19.64946234 -2.82825772
67 -3.77686874 -19.64946234
68 NA -3.77686874
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.27244254 1.25123906
[2,] -0.08140101 0.27244254
[3,] 2.92729728 -0.08140101
[4,] 0.51526000 2.92729728
[5,] 10.12409105 0.51526000
[6,] -13.92850412 10.12409105
[7,] 5.44582721 -13.92850412
[8,] 8.12249094 5.44582721
[9,] 5.96114124 8.12249094
[10,] 3.53239196 5.96114124
[11,] 0.87183333 3.53239196
[12,] -0.94204701 0.87183333
[13,] -0.65802533 -0.94204701
[14,] 2.18606425 -0.65802533
[15,] 1.93401605 2.18606425
[16,] 2.76487875 1.93401605
[17,] 6.16646688 2.76487875
[18,] -14.78833876 6.16646688
[19,] 5.92615677 -14.78833876
[20,] 6.98618157 5.92615677
[21,] 7.75959852 6.98618157
[22,] 3.92087884 7.75959852
[23,] 2.78487235 3.92087884
[24,] 1.15762384 2.78487235
[25,] 1.49898364 1.15762384
[26,] 5.18397825 1.49898364
[27,] 2.23362466 5.18397825
[28,] 0.80628880 2.23362466
[29,] 4.89354897 0.80628880
[30,] -15.20780935 4.89354897
[31,] 4.28186482 -15.20780935
[32,] 3.88792529 4.28186482
[33,] 5.25618761 3.88792529
[34,] 2.36529042 5.25618761
[35,] -1.02844073 2.36529042
[36,] 0.60379827 -1.02844073
[37,] 1.65685905 0.60379827
[38,] -2.14697666 1.65685905
[39,] 0.02666525 -2.14697666
[40,] -3.30369244 0.02666525
[41,] -1.60368529 -3.30369244
[42,] -19.31734781 -1.60368529
[43,] 0.08710794 -19.31734781
[44,] 0.27550377 0.08710794
[45,] 1.75877748 0.27550377
[46,] 1.69091853 1.75877748
[47,] 1.58888762 1.69091853
[48,] 0.39671462 1.58888762
[49,] 0.79256774 0.39671462
[50,] 6.77780414 0.79256774
[51,] 1.23226519 6.77780414
[52,] 1.49919916 1.23226519
[53,] 4.80081956 1.49919916
[54,] -11.50317889 4.80081956
[55,] 3.80952269 -11.50317889
[56,] 4.59581338 3.80952269
[57,] 5.71509842 4.59581338
[58,] -4.07766580 5.71509842
[59,] -9.67940951 -4.07766580
[60,] -9.50171523 -9.67940951
[61,] -6.12229520 -9.50171523
[62,] 0.75778058 -6.12229520
[63,] -3.31471598 0.75778058
[64,] -5.62471036 -3.31471598
[65,] -2.82825772 -5.62471036
[66,] -19.64946234 -2.82825772
[67,] -3.77686874 -19.64946234
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.27244254 1.25123906
2 -0.08140101 0.27244254
3 2.92729728 -0.08140101
4 0.51526000 2.92729728
5 10.12409105 0.51526000
6 -13.92850412 10.12409105
7 5.44582721 -13.92850412
8 8.12249094 5.44582721
9 5.96114124 8.12249094
10 3.53239196 5.96114124
11 0.87183333 3.53239196
12 -0.94204701 0.87183333
13 -0.65802533 -0.94204701
14 2.18606425 -0.65802533
15 1.93401605 2.18606425
16 2.76487875 1.93401605
17 6.16646688 2.76487875
18 -14.78833876 6.16646688
19 5.92615677 -14.78833876
20 6.98618157 5.92615677
21 7.75959852 6.98618157
22 3.92087884 7.75959852
23 2.78487235 3.92087884
24 1.15762384 2.78487235
25 1.49898364 1.15762384
26 5.18397825 1.49898364
27 2.23362466 5.18397825
28 0.80628880 2.23362466
29 4.89354897 0.80628880
30 -15.20780935 4.89354897
31 4.28186482 -15.20780935
32 3.88792529 4.28186482
33 5.25618761 3.88792529
34 2.36529042 5.25618761
35 -1.02844073 2.36529042
36 0.60379827 -1.02844073
37 1.65685905 0.60379827
38 -2.14697666 1.65685905
39 0.02666525 -2.14697666
40 -3.30369244 0.02666525
41 -1.60368529 -3.30369244
42 -19.31734781 -1.60368529
43 0.08710794 -19.31734781
44 0.27550377 0.08710794
45 1.75877748 0.27550377
46 1.69091853 1.75877748
47 1.58888762 1.69091853
48 0.39671462 1.58888762
49 0.79256774 0.39671462
50 6.77780414 0.79256774
51 1.23226519 6.77780414
52 1.49919916 1.23226519
53 4.80081956 1.49919916
54 -11.50317889 4.80081956
55 3.80952269 -11.50317889
56 4.59581338 3.80952269
57 5.71509842 4.59581338
58 -4.07766580 5.71509842
59 -9.67940951 -4.07766580
60 -9.50171523 -9.67940951
61 -6.12229520 -9.50171523
62 0.75778058 -6.12229520
63 -3.31471598 0.75778058
64 -5.62471036 -3.31471598
65 -2.82825772 -5.62471036
66 -19.64946234 -2.82825772
67 -3.77686874 -19.64946234
> 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/7we9z1290542189.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/875q11290542189.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/975q11290542189.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/10iwq51290542189.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/113x6s1290542189.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/12z77t1290542190.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/13vzn21290542190.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/14y0lq1290542190.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/152ikw1290542190.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/16ys041290542190.tab")
+ }
>
> try(system("convert tmp/1bvbb1290542189.ps tmp/1bvbb1290542189.png",intern=TRUE))
character(0)
> try(system("convert tmp/2bvbb1290542189.ps tmp/2bvbb1290542189.png",intern=TRUE))
character(0)
> try(system("convert tmp/3mnae1290542189.ps tmp/3mnae1290542189.png",intern=TRUE))
character(0)
> try(system("convert tmp/4mnae1290542189.ps tmp/4mnae1290542189.png",intern=TRUE))
character(0)
> try(system("convert tmp/5mnae1290542189.ps tmp/5mnae1290542189.png",intern=TRUE))
character(0)
> try(system("convert tmp/6we9z1290542189.ps tmp/6we9z1290542189.png",intern=TRUE))
character(0)
> try(system("convert tmp/7we9z1290542189.ps tmp/7we9z1290542189.png",intern=TRUE))
character(0)
> try(system("convert tmp/875q11290542189.ps tmp/875q11290542189.png",intern=TRUE))
character(0)
> try(system("convert tmp/975q11290542189.ps tmp/975q11290542189.png",intern=TRUE))
character(0)
> try(system("convert tmp/10iwq51290542189.ps tmp/10iwq51290542189.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.531 1.602 6.082