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(-14,3.4,6.9,0.75,-7,3.4,7.2,0.75,-9,3.4,7.1,0.75,-9,4,6.5,0.65,-4,3.4,6.6,0.5,-3,3.1,6.7,0.5,1,3.3,6.9,0.39,-1,3.5,7.1,0.25,-2,3.5,7.4,0.25,1,3.7,7.6,0.25,-3,3.4,7.8,0.25,-2,3,8.1,0.25,0,3.1,8.5,0.25,-2,2.9,8.7,0.25,-4,2.4,8.8,0.25,-4,2.4,8,0.25,-7,2.7,8,0.25,-9,2.5,8.3,0.25,-13,2.1,8.5,0.25,-8,1.9,8.7,0.25,-13,0.8,8.6,0.25,-15,0.8,8.3,0.25,-15,0.3,7.9,0.25,-15,0,7.9,0.25,-10,-0.9,8.1,0.25,-12,-1,8.3,0.25,-11,-0.7,8.1,0.25,-11,-1.7,7.4,0.25,-17,-1,7.3,0.25,-18,-0.2,7.7,0.25,-19,0.7,8,0.31,-22,0.6,8,0.66,-24,1.9,7.7,1,-24,2.1,6.9,1.62,-20,2.7,6.6,2.25,-25,3.2,6.9,2.92,-22,4.8,7.5,3.23,-17,5.5,7.9,3.25,-9,5.4,7.7,3.25,-11,5.9,6.5,3.18,-13,5.8,6.1,3,-11,5.1,6.4,3,-9,4.1,6.8,3,-7,4.4,7.1,3,-3,3.6,7.3,3,-3,3.5,7.2,3,-6,3.1,7,3,-4,2.9,7,3,-8,2.2,7,3,-1,1.4,7.3,3,-2,1.2,7.5,3,-2,1.3,7.2,3,-1,1.3,7.7,2.9,1,1.3,8,2.75,2,1.8,7.9,2.75,2,1.8,8,2.65,-1,1.8,8,2.5,1,1.7,7.9,2.5,-1,2.1,7.9,2.39,-8,2,8,2.25),dim=c(4,60),dimnames=list(c('vertrouwen','CPI','Werkloosheid','Rente'),1:60))
> y <- array(NA,dim=c(4,60),dimnames=list(c('vertrouwen','CPI','Werkloosheid','Rente'),1:60))
> 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
> 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
vertrouwen CPI Werkloosheid Rente
1 -14 3.4 6.9 0.75
2 -7 3.4 7.2 0.75
3 -9 3.4 7.1 0.75
4 -9 4.0 6.5 0.65
5 -4 3.4 6.6 0.50
6 -3 3.1 6.7 0.50
7 1 3.3 6.9 0.39
8 -1 3.5 7.1 0.25
9 -2 3.5 7.4 0.25
10 1 3.7 7.6 0.25
11 -3 3.4 7.8 0.25
12 -2 3.0 8.1 0.25
13 0 3.1 8.5 0.25
14 -2 2.9 8.7 0.25
15 -4 2.4 8.8 0.25
16 -4 2.4 8.0 0.25
17 -7 2.7 8.0 0.25
18 -9 2.5 8.3 0.25
19 -13 2.1 8.5 0.25
20 -8 1.9 8.7 0.25
21 -13 0.8 8.6 0.25
22 -15 0.8 8.3 0.25
23 -15 0.3 7.9 0.25
24 -15 0.0 7.9 0.25
25 -10 -0.9 8.1 0.25
26 -12 -1.0 8.3 0.25
27 -11 -0.7 8.1 0.25
28 -11 -1.7 7.4 0.25
29 -17 -1.0 7.3 0.25
30 -18 -0.2 7.7 0.25
31 -19 0.7 8.0 0.31
32 -22 0.6 8.0 0.66
33 -24 1.9 7.7 1.00
34 -24 2.1 6.9 1.62
35 -20 2.7 6.6 2.25
36 -25 3.2 6.9 2.92
37 -22 4.8 7.5 3.23
38 -17 5.5 7.9 3.25
39 -9 5.4 7.7 3.25
40 -11 5.9 6.5 3.18
41 -13 5.8 6.1 3.00
42 -11 5.1 6.4 3.00
43 -9 4.1 6.8 3.00
44 -7 4.4 7.1 3.00
45 -3 3.6 7.3 3.00
46 -3 3.5 7.2 3.00
47 -6 3.1 7.0 3.00
48 -4 2.9 7.0 3.00
49 -8 2.2 7.0 3.00
50 -1 1.4 7.3 3.00
51 -2 1.2 7.5 3.00
52 -2 1.3 7.2 3.00
53 -1 1.3 7.7 2.90
54 1 1.3 8.0 2.75
55 2 1.8 7.9 2.75
56 2 1.8 8.0 2.65
57 -1 1.8 8.0 2.50
58 1 1.7 7.9 2.50
59 -1 2.1 7.9 2.39
60 -8 2.0 8.0 2.25
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) CPI Werkloosheid Rente
-32.9128 0.8085 2.8511 0.7012
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-16.6163 -4.3754 0.9091 6.0012 11.2985
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -32.9128 14.1765 -2.322 0.0239 *
CPI 0.8085 0.6504 1.243 0.2190
Werkloosheid 2.8511 1.7402 1.638 0.1069
Rente 0.7012 0.8629 0.813 0.4199
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 7.336 on 56 degrees of freedom
Multiple R-squared: 0.06249, Adjusted R-squared: 0.01226
F-statistic: 1.244 on 3 and 56 DF, p-value: 0.3024
> 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.0320694327 0.0641388654 0.9679305673
[2,] 0.0505893579 0.1011787158 0.9494106421
[3,] 0.0253058648 0.0506117296 0.9746941352
[4,] 0.0148762705 0.0297525411 0.9851237295
[5,] 0.0104255134 0.0208510268 0.9895744866
[6,] 0.0053342297 0.0106684593 0.9946657703
[7,] 0.0030403300 0.0060806601 0.9969596700
[8,] 0.0014069399 0.0028138799 0.9985930601
[9,] 0.0009496411 0.0018992821 0.9990503589
[10,] 0.0009722244 0.0019444488 0.9990277756
[11,] 0.0027743683 0.0055487367 0.9972256317
[12,] 0.0065497009 0.0130994018 0.9934502991
[13,] 0.0138935502 0.0277871005 0.9861064498
[14,] 0.0120054614 0.0240109227 0.9879945386
[15,] 0.0069051064 0.0138102128 0.9930948936
[16,] 0.0040198971 0.0080397942 0.9959801029
[17,] 0.0022339425 0.0044678851 0.9977660575
[18,] 0.0012818170 0.0025636340 0.9987181830
[19,] 0.0076081641 0.0152163282 0.9923918359
[20,] 0.0072865213 0.0145730426 0.9927134787
[21,] 0.0062041782 0.0124083564 0.9937958218
[22,] 0.0055038734 0.0110077468 0.9944961266
[23,] 0.0049889891 0.0099779781 0.9950110109
[24,] 0.0065565144 0.0131130288 0.9934434856
[25,] 0.0127017782 0.0254035563 0.9872982218
[26,] 0.0087197332 0.0174394663 0.9912802668
[27,] 0.0054829974 0.0109659947 0.9945170026
[28,] 0.0121144452 0.0242288904 0.9878855548
[29,] 0.0888945286 0.1777890571 0.9111054714
[30,] 0.7042531264 0.5914937473 0.2957468736
[31,] 0.9572042713 0.0855914575 0.0427957287
[32,] 0.9968103745 0.0063792510 0.0031896255
[33,] 0.9997948889 0.0004102223 0.0002051111
[34,] 0.9996879982 0.0006240036 0.0003120018
[35,] 0.9994568301 0.0010863398 0.0005431699
[36,] 0.9991800079 0.0016399843 0.0008199921
[37,] 0.9988921088 0.0022157824 0.0011078912
[38,] 0.9988367833 0.0023264333 0.0011632167
[39,] 0.9988995640 0.0022008720 0.0011004360
[40,] 0.9984010949 0.0031978103 0.0015989051
[41,] 0.9971024734 0.0057950532 0.0028975266
[42,] 0.9949448806 0.0101102388 0.0050551194
[43,] 0.9966270885 0.0067458230 0.0033729115
[44,] 0.9928314653 0.0143370694 0.0071685347
[45,] 0.9856422013 0.0287155974 0.0143577987
[46,] 0.9614808591 0.0770382818 0.0385191409
[47,] 0.9643189416 0.0713621168 0.0356810584
> postscript(file="/var/www/rcomp/tmp/1unve1321973228.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/2x6751321973228.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/3ow251321973228.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/4alz41321973228.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/5zx3m1321973228.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 = 60
Frequency = 1
1 2 3 4 5
-4.034790342 2.109873973 0.394985868 1.690656133 6.995837414
6 7 8 9 10
7.953284486 11.298483230 8.664717022 6.809381337 9.077451569
11 12 13 14 15
4.749786746 5.217863016 5.996562448 3.588044635 1.707197684
16 17 18 19 20
3.988092844 0.745533878 -1.948095830 -6.194907664 -1.603425476
21 22 23 24 25
-5.428930704 -6.573595019 -5.028882495 -4.786323529 0.371129581
26 27 28 29 30
-2.118241220 -0.790576397 2.013736756 -4.267122270 -7.054393761
31 32 33 34 35
-9.679476443 -12.844032354 -15.278182741 -13.593717896 -9.665236165
36 37 38 39 40
-16.394619546 -16.616300906 -13.336742773 -4.685665994 -3.619506419
41 42 43 44 45
-4.271995559 -2.561360322 -0.893278013 0.008827335 4.085427456
46 47 48 49 50
4.451392340 2.345028085 4.506734063 1.072704985 7.864193210
51 52 53 54 55
6.455675398 7.230158094 6.874715448 8.124555006 9.005401957
56 57 58 59 60
8.790406890 5.895582133 8.261547017 6.015263573 -1.090831773
> postscript(file="/var/www/rcomp/tmp/6wz491321973228.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 = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 -4.034790342 NA
1 2.109873973 -4.034790342
2 0.394985868 2.109873973
3 1.690656133 0.394985868
4 6.995837414 1.690656133
5 7.953284486 6.995837414
6 11.298483230 7.953284486
7 8.664717022 11.298483230
8 6.809381337 8.664717022
9 9.077451569 6.809381337
10 4.749786746 9.077451569
11 5.217863016 4.749786746
12 5.996562448 5.217863016
13 3.588044635 5.996562448
14 1.707197684 3.588044635
15 3.988092844 1.707197684
16 0.745533878 3.988092844
17 -1.948095830 0.745533878
18 -6.194907664 -1.948095830
19 -1.603425476 -6.194907664
20 -5.428930704 -1.603425476
21 -6.573595019 -5.428930704
22 -5.028882495 -6.573595019
23 -4.786323529 -5.028882495
24 0.371129581 -4.786323529
25 -2.118241220 0.371129581
26 -0.790576397 -2.118241220
27 2.013736756 -0.790576397
28 -4.267122270 2.013736756
29 -7.054393761 -4.267122270
30 -9.679476443 -7.054393761
31 -12.844032354 -9.679476443
32 -15.278182741 -12.844032354
33 -13.593717896 -15.278182741
34 -9.665236165 -13.593717896
35 -16.394619546 -9.665236165
36 -16.616300906 -16.394619546
37 -13.336742773 -16.616300906
38 -4.685665994 -13.336742773
39 -3.619506419 -4.685665994
40 -4.271995559 -3.619506419
41 -2.561360322 -4.271995559
42 -0.893278013 -2.561360322
43 0.008827335 -0.893278013
44 4.085427456 0.008827335
45 4.451392340 4.085427456
46 2.345028085 4.451392340
47 4.506734063 2.345028085
48 1.072704985 4.506734063
49 7.864193210 1.072704985
50 6.455675398 7.864193210
51 7.230158094 6.455675398
52 6.874715448 7.230158094
53 8.124555006 6.874715448
54 9.005401957 8.124555006
55 8.790406890 9.005401957
56 5.895582133 8.790406890
57 8.261547017 5.895582133
58 6.015263573 8.261547017
59 -1.090831773 6.015263573
60 NA -1.090831773
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.109873973 -4.034790342
[2,] 0.394985868 2.109873973
[3,] 1.690656133 0.394985868
[4,] 6.995837414 1.690656133
[5,] 7.953284486 6.995837414
[6,] 11.298483230 7.953284486
[7,] 8.664717022 11.298483230
[8,] 6.809381337 8.664717022
[9,] 9.077451569 6.809381337
[10,] 4.749786746 9.077451569
[11,] 5.217863016 4.749786746
[12,] 5.996562448 5.217863016
[13,] 3.588044635 5.996562448
[14,] 1.707197684 3.588044635
[15,] 3.988092844 1.707197684
[16,] 0.745533878 3.988092844
[17,] -1.948095830 0.745533878
[18,] -6.194907664 -1.948095830
[19,] -1.603425476 -6.194907664
[20,] -5.428930704 -1.603425476
[21,] -6.573595019 -5.428930704
[22,] -5.028882495 -6.573595019
[23,] -4.786323529 -5.028882495
[24,] 0.371129581 -4.786323529
[25,] -2.118241220 0.371129581
[26,] -0.790576397 -2.118241220
[27,] 2.013736756 -0.790576397
[28,] -4.267122270 2.013736756
[29,] -7.054393761 -4.267122270
[30,] -9.679476443 -7.054393761
[31,] -12.844032354 -9.679476443
[32,] -15.278182741 -12.844032354
[33,] -13.593717896 -15.278182741
[34,] -9.665236165 -13.593717896
[35,] -16.394619546 -9.665236165
[36,] -16.616300906 -16.394619546
[37,] -13.336742773 -16.616300906
[38,] -4.685665994 -13.336742773
[39,] -3.619506419 -4.685665994
[40,] -4.271995559 -3.619506419
[41,] -2.561360322 -4.271995559
[42,] -0.893278013 -2.561360322
[43,] 0.008827335 -0.893278013
[44,] 4.085427456 0.008827335
[45,] 4.451392340 4.085427456
[46,] 2.345028085 4.451392340
[47,] 4.506734063 2.345028085
[48,] 1.072704985 4.506734063
[49,] 7.864193210 1.072704985
[50,] 6.455675398 7.864193210
[51,] 7.230158094 6.455675398
[52,] 6.874715448 7.230158094
[53,] 8.124555006 6.874715448
[54,] 9.005401957 8.124555006
[55,] 8.790406890 9.005401957
[56,] 5.895582133 8.790406890
[57,] 8.261547017 5.895582133
[58,] 6.015263573 8.261547017
[59,] -1.090831773 6.015263573
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.109873973 -4.034790342
2 0.394985868 2.109873973
3 1.690656133 0.394985868
4 6.995837414 1.690656133
5 7.953284486 6.995837414
6 11.298483230 7.953284486
7 8.664717022 11.298483230
8 6.809381337 8.664717022
9 9.077451569 6.809381337
10 4.749786746 9.077451569
11 5.217863016 4.749786746
12 5.996562448 5.217863016
13 3.588044635 5.996562448
14 1.707197684 3.588044635
15 3.988092844 1.707197684
16 0.745533878 3.988092844
17 -1.948095830 0.745533878
18 -6.194907664 -1.948095830
19 -1.603425476 -6.194907664
20 -5.428930704 -1.603425476
21 -6.573595019 -5.428930704
22 -5.028882495 -6.573595019
23 -4.786323529 -5.028882495
24 0.371129581 -4.786323529
25 -2.118241220 0.371129581
26 -0.790576397 -2.118241220
27 2.013736756 -0.790576397
28 -4.267122270 2.013736756
29 -7.054393761 -4.267122270
30 -9.679476443 -7.054393761
31 -12.844032354 -9.679476443
32 -15.278182741 -12.844032354
33 -13.593717896 -15.278182741
34 -9.665236165 -13.593717896
35 -16.394619546 -9.665236165
36 -16.616300906 -16.394619546
37 -13.336742773 -16.616300906
38 -4.685665994 -13.336742773
39 -3.619506419 -4.685665994
40 -4.271995559 -3.619506419
41 -2.561360322 -4.271995559
42 -0.893278013 -2.561360322
43 0.008827335 -0.893278013
44 4.085427456 0.008827335
45 4.451392340 4.085427456
46 2.345028085 4.451392340
47 4.506734063 2.345028085
48 1.072704985 4.506734063
49 7.864193210 1.072704985
50 6.455675398 7.864193210
51 7.230158094 6.455675398
52 6.874715448 7.230158094
53 8.124555006 6.874715448
54 9.005401957 8.124555006
55 8.790406890 9.005401957
56 5.895582133 8.790406890
57 8.261547017 5.895582133
58 6.015263573 8.261547017
59 -1.090831773 6.015263573
> 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/7sdmj1321973228.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/83bpx1321973228.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/9zlbw1321973228.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/10rj2f1321973228.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/11f4lq1321973229.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/12qkvp1321973229.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/13hybd1321973229.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/14xfmp1321973229.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/15t99w1321973229.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/16kytk1321973229.tab")
+ }
>
> try(system("convert tmp/1unve1321973228.ps tmp/1unve1321973228.png",intern=TRUE))
character(0)
> try(system("convert tmp/2x6751321973228.ps tmp/2x6751321973228.png",intern=TRUE))
character(0)
> try(system("convert tmp/3ow251321973228.ps tmp/3ow251321973228.png",intern=TRUE))
character(0)
> try(system("convert tmp/4alz41321973228.ps tmp/4alz41321973228.png",intern=TRUE))
character(0)
> try(system("convert tmp/5zx3m1321973228.ps tmp/5zx3m1321973228.png",intern=TRUE))
character(0)
> try(system("convert tmp/6wz491321973228.ps tmp/6wz491321973228.png",intern=TRUE))
character(0)
> try(system("convert tmp/7sdmj1321973228.ps tmp/7sdmj1321973228.png",intern=TRUE))
character(0)
> try(system("convert tmp/83bpx1321973228.ps tmp/83bpx1321973228.png",intern=TRUE))
character(0)
> try(system("convert tmp/9zlbw1321973228.ps tmp/9zlbw1321973228.png",intern=TRUE))
character(0)
> try(system("convert tmp/10rj2f1321973228.ps tmp/10rj2f1321973228.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.952 0.628 4.602