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(11
+ ,0
+ ,8
+ ,17
+ ,2
+ ,6
+ ,10
+ ,-2
+ ,3
+ ,23
+ ,3
+ ,7
+ ,9
+ ,-4
+ ,3
+ ,24
+ ,1
+ ,4
+ ,8
+ ,-4
+ ,7
+ ,27
+ ,1
+ ,3
+ ,7
+ ,-7
+ ,4
+ ,31
+ ,0
+ ,0
+ ,6
+ ,-9
+ ,-4
+ ,40
+ ,1
+ ,6
+ ,5
+ ,-13
+ ,-6
+ ,47
+ ,-1
+ ,3
+ ,4
+ ,-8
+ ,8
+ ,43
+ ,2
+ ,1
+ ,3
+ ,-13
+ ,2
+ ,60
+ ,2
+ ,6
+ ,2
+ ,-15
+ ,-1
+ ,64
+ ,0
+ ,5
+ ,1
+ ,-15
+ ,-2
+ ,65
+ ,1
+ ,7
+ ,12
+ ,-15
+ ,0
+ ,65
+ ,1
+ ,4
+ ,11
+ ,-10
+ ,10
+ ,55
+ ,3
+ ,3
+ ,10
+ ,-12
+ ,3
+ ,57
+ ,3
+ ,6
+ ,9
+ ,-11
+ ,6
+ ,57
+ ,1
+ ,6
+ ,8
+ ,-11
+ ,7
+ ,57
+ ,1
+ ,5
+ ,7
+ ,-17
+ ,-4
+ ,65
+ ,-2
+ ,2
+ ,6
+ ,-18
+ ,-5
+ ,69
+ ,1
+ ,3
+ ,5
+ ,-19
+ ,-7
+ ,70
+ ,1
+ ,-2
+ ,4
+ ,-22
+ ,-10
+ ,71
+ ,-1
+ ,-4
+ ,3
+ ,-24
+ ,-21
+ ,71
+ ,-4
+ ,0
+ ,2
+ ,-24
+ ,-22
+ ,73
+ ,-2
+ ,1
+ ,1
+ ,-20
+ ,-16
+ ,68
+ ,-1
+ ,4
+ ,12
+ ,-25
+ ,-25
+ ,65
+ ,-5
+ ,-3
+ ,11
+ ,-22
+ ,-22
+ ,57
+ ,-4
+ ,-3
+ ,10
+ ,-17
+ ,-22
+ ,41
+ ,-5
+ ,0
+ ,9
+ ,-9
+ ,-19
+ ,21
+ ,0
+ ,6
+ ,8
+ ,-11
+ ,-21
+ ,21
+ ,-2
+ ,-1
+ ,7
+ ,-13
+ ,-31
+ ,17
+ ,-4
+ ,0
+ ,6
+ ,-11
+ ,-28
+ ,9
+ ,-6
+ ,-1
+ ,5
+ ,-9
+ ,-23
+ ,11
+ ,-2
+ ,1
+ ,4
+ ,-7
+ ,-17
+ ,6
+ ,-2
+ ,-4
+ ,3
+ ,-3
+ ,-12
+ ,-2
+ ,-2
+ ,-1
+ ,2
+ ,-3
+ ,-14
+ ,0
+ ,1
+ ,-1
+ ,1
+ ,-6
+ ,-18
+ ,5
+ ,-2
+ ,0
+ ,12
+ ,-4
+ ,-16
+ ,3
+ ,0
+ ,3
+ ,11
+ ,-8
+ ,-22
+ ,7
+ ,-1
+ ,0
+ ,10
+ ,-1
+ ,-9
+ ,4
+ ,2
+ ,8
+ ,9
+ ,-2
+ ,-10
+ ,8
+ ,3
+ ,8
+ ,8
+ ,-2
+ ,-10
+ ,9
+ ,2
+ ,8
+ ,7
+ ,-1
+ ,0
+ ,14
+ ,3
+ ,8
+ ,6
+ ,1
+ ,3
+ ,12
+ ,4
+ ,11
+ ,5
+ ,2
+ ,2
+ ,12
+ ,5
+ ,13
+ ,4
+ ,2
+ ,4
+ ,7
+ ,5
+ ,5
+ ,3
+ ,-1
+ ,-3
+ ,15
+ ,4
+ ,12
+ ,2
+ ,1
+ ,0
+ ,14
+ ,5
+ ,13
+ ,1
+ ,-1
+ ,-1
+ ,19
+ ,6
+ ,9
+ ,12
+ ,-8
+ ,-7
+ ,39
+ ,4
+ ,11
+ ,11
+ ,1
+ ,2
+ ,12
+ ,6
+ ,7
+ ,10
+ ,2
+ ,3
+ ,11
+ ,6
+ ,12
+ ,9
+ ,-2
+ ,-3
+ ,17
+ ,3
+ ,11
+ ,8
+ ,-2
+ ,-5
+ ,16
+ ,5
+ ,10
+ ,7
+ ,-2
+ ,0
+ ,25
+ ,5
+ ,13
+ ,6
+ ,-2
+ ,-3
+ ,24
+ ,5
+ ,14
+ ,5
+ ,-6
+ ,-7
+ ,28
+ ,3
+ ,10
+ ,4
+ ,-4
+ ,-7
+ ,25
+ ,5
+ ,13
+ ,3
+ ,-5
+ ,-7
+ ,31
+ ,5
+ ,12
+ ,2
+ ,-2
+ ,-4
+ ,24
+ ,6
+ ,13
+ ,1
+ ,-1
+ ,-3
+ ,24
+ ,6
+ ,17
+ ,12
+ ,-5
+ ,-6
+ ,33
+ ,5
+ ,15)
+ ,dim=c(6
+ ,60)
+ ,dimnames=list(c('maand'
+ ,'indicator'
+ ,'economie'
+ ,'werkloosheid'
+ ,'financiƫn'
+ ,'spaarvermogen')
+ ,1:60))
> y <- array(NA,dim=c(6,60),dimnames=list(c('maand','indicator','economie','werkloosheid','financiƫn','spaarvermogen'),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 = '4'
> #'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
werkloosheid maand indicator economie financi\303\253n spaarvermogen
1 17 11 0 8 2 6
2 23 10 -2 3 3 7
3 24 9 -4 3 1 4
4 27 8 -4 7 1 3
5 31 7 -7 4 0 0
6 40 6 -9 -4 1 6
7 47 5 -13 -6 -1 3
8 43 4 -8 8 2 1
9 60 3 -13 2 2 6
10 64 2 -15 -1 0 5
11 65 1 -15 -2 1 7
12 65 12 -15 0 1 4
13 55 11 -10 10 3 3
14 57 10 -12 3 3 6
15 57 9 -11 6 1 6
16 57 8 -11 7 1 5
17 65 7 -17 -4 -2 2
18 69 6 -18 -5 1 3
19 70 5 -19 -7 1 -2
20 71 4 -22 -10 -1 -4
21 71 3 -24 -21 -4 0
22 73 2 -24 -22 -2 1
23 68 1 -20 -16 -1 4
24 65 12 -25 -25 -5 -3
25 57 11 -22 -22 -4 -3
26 41 10 -17 -22 -5 0
27 21 9 -9 -19 0 6
28 21 8 -11 -21 -2 -1
29 17 7 -13 -31 -4 0
30 9 6 -11 -28 -6 -1
31 11 5 -9 -23 -2 1
32 6 4 -7 -17 -2 -4
33 -2 3 -3 -12 -2 -1
34 0 2 -3 -14 1 -1
35 5 1 -6 -18 -2 0
36 3 12 -4 -16 0 3
37 7 11 -8 -22 -1 0
38 4 10 -1 -9 2 8
39 8 9 -2 -10 3 8
40 9 8 -2 -10 2 8
41 14 7 -1 0 3 8
42 12 6 1 3 4 11
43 12 5 2 2 5 13
44 7 4 2 4 5 5
45 15 3 -1 -3 4 12
46 14 2 1 0 5 13
47 19 1 -1 -1 6 9
48 39 12 -8 -7 4 11
49 12 11 1 2 6 7
50 11 10 2 3 6 12
51 17 9 -2 -3 3 11
52 16 8 -2 -5 5 10
53 25 7 -2 0 5 13
54 24 6 -2 -3 5 14
55 28 5 -6 -7 3 10
56 25 4 -4 -7 5 13
57 31 3 -5 -7 5 12
58 24 2 -2 -4 6 13
59 24 1 -1 -3 6 17
60 33 12 -5 -6 5 15
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) maand indicator economie
1.5445 -0.1126 -3.9328 1.0080
`financi\303\253n` spaarvermogen
0.9951 0.8922
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.97544 -1.02144 0.08744 0.82472 2.46080
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.54452 0.56152 2.751 0.00808 **
maand -0.11257 0.04445 -2.533 0.01426 *
indicator -3.93285 0.02975 -132.180 < 2e-16 ***
economie 1.00797 0.02212 45.572 < 2e-16 ***
`financi\303\253n` 0.99509 0.12856 7.740 2.59e-10 ***
spaarvermogen 0.89222 0.05643 15.810 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.171 on 54 degrees of freedom
Multiple R-squared: 0.9976, Adjusted R-squared: 0.9974
F-statistic: 4579 on 5 and 54 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.0637765 0.1275530 0.93622350
[2,] 0.1864881 0.3729761 0.81351195
[3,] 0.2584839 0.5169678 0.74151611
[4,] 0.3224069 0.6448137 0.67759314
[5,] 0.2424320 0.4848640 0.75756798
[6,] 0.6360765 0.7278470 0.36392350
[7,] 0.5541233 0.8917535 0.44587674
[8,] 0.4701778 0.9403556 0.52982221
[9,] 0.5580571 0.8838857 0.44194286
[10,] 0.4901629 0.9803257 0.50983713
[11,] 0.8657179 0.2685642 0.13428209
[12,] 0.9292787 0.1414427 0.07072135
[13,] 0.8960304 0.2079393 0.10396963
[14,] 0.8520870 0.2958259 0.14791297
[15,] 0.8483197 0.3033605 0.15168026
[16,] 0.8713558 0.2572885 0.12864425
[17,] 0.8814613 0.2370774 0.11853871
[18,] 0.8604871 0.2790258 0.13951289
[19,] 0.9057781 0.1884438 0.09422188
[20,] 0.8973315 0.2053370 0.10266848
[21,] 0.8604199 0.2791602 0.13958010
[22,] 0.8437070 0.3125861 0.15629305
[23,] 0.8339966 0.3320068 0.16600339
[24,] 0.7804403 0.4391195 0.21955974
[25,] 0.7377774 0.5244451 0.26222255
[26,] 0.6917131 0.6165737 0.30828687
[27,] 0.6703458 0.6593084 0.32965420
[28,] 0.6541031 0.6917939 0.34589694
[29,] 0.6731799 0.6536402 0.32682008
[30,] 0.6005901 0.7988197 0.39940987
[31,] 0.5538471 0.8923059 0.44615293
[32,] 0.8175104 0.3649791 0.18248956
[33,] 0.7879134 0.4241732 0.21208662
[34,] 0.8010501 0.3978998 0.19894989
[35,] 0.7690290 0.4619420 0.23097099
[36,] 0.6977811 0.6044378 0.30221890
[37,] 0.6532568 0.6934863 0.34674315
[38,] 0.5821732 0.8356535 0.41782675
[39,] 0.4837003 0.9674007 0.51629966
[40,] 0.3730994 0.7461989 0.62690057
[41,] 0.4801240 0.9602479 0.51987604
[42,] 0.3946899 0.7893797 0.60531013
[43,] 0.3810099 0.7620197 0.61899013
> postscript(file="/var/www/html/rcomp/tmp/16rmo1291238458.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/html/rcomp/tmp/26rmo1291238458.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/html/rcomp/tmp/36rmo1291238458.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/html/rcomp/tmp/4yjmr1291238458.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/html/rcomp/tmp/5yjmr1291238458.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 6
1.28654374 2.46079596 0.14937714 -0.10283658 -1.31829566 1.41874956
7 8 9 10 11 12
-0.74242946 -0.50312348 -1.69323432 0.23480204 -0.64933737 1.24968842
13 14 15 16 17 18
-0.37627288 -1.97543976 0.81111950 0.58280244 1.62271333 -1.29223351
19 20 21 22 23 24
2.13938336 -1.97320520 0.55254315 0.56553321 1.46479680 -0.66353664
25 26 27 28 29 30
-0.99655985 0.87352519 -1.12895921 1.14443599 0.34378973 -0.04458462
31 32 33 34 35 36
-1.09609981 0.07032959 -0.02735001 0.89073507 0.10454113 0.52575130
37 38 39 40 41 42
-1.59865677 -0.40790127 -0.44044487 1.44207415 -0.81239921 -1.75493026
43 44 45 46 47 48
0.29377597 0.30303848 -1.80276572 0.03914469 0.64263837 0.60454789
49 50 51 52 53 54
1.39459693 -1.25419888 -1.17286591 -1.36746884 -0.19653102 0.82257265
55 56 57 58 59 60
-1.43045454 -1.34418020 1.50262264 1.27737869 0.52080362 0.83114510
> postscript(file="/var/www/html/rcomp/tmp/6yjmr1291238458.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 1.28654374 NA
1 2.46079596 1.28654374
2 0.14937714 2.46079596
3 -0.10283658 0.14937714
4 -1.31829566 -0.10283658
5 1.41874956 -1.31829566
6 -0.74242946 1.41874956
7 -0.50312348 -0.74242946
8 -1.69323432 -0.50312348
9 0.23480204 -1.69323432
10 -0.64933737 0.23480204
11 1.24968842 -0.64933737
12 -0.37627288 1.24968842
13 -1.97543976 -0.37627288
14 0.81111950 -1.97543976
15 0.58280244 0.81111950
16 1.62271333 0.58280244
17 -1.29223351 1.62271333
18 2.13938336 -1.29223351
19 -1.97320520 2.13938336
20 0.55254315 -1.97320520
21 0.56553321 0.55254315
22 1.46479680 0.56553321
23 -0.66353664 1.46479680
24 -0.99655985 -0.66353664
25 0.87352519 -0.99655985
26 -1.12895921 0.87352519
27 1.14443599 -1.12895921
28 0.34378973 1.14443599
29 -0.04458462 0.34378973
30 -1.09609981 -0.04458462
31 0.07032959 -1.09609981
32 -0.02735001 0.07032959
33 0.89073507 -0.02735001
34 0.10454113 0.89073507
35 0.52575130 0.10454113
36 -1.59865677 0.52575130
37 -0.40790127 -1.59865677
38 -0.44044487 -0.40790127
39 1.44207415 -0.44044487
40 -0.81239921 1.44207415
41 -1.75493026 -0.81239921
42 0.29377597 -1.75493026
43 0.30303848 0.29377597
44 -1.80276572 0.30303848
45 0.03914469 -1.80276572
46 0.64263837 0.03914469
47 0.60454789 0.64263837
48 1.39459693 0.60454789
49 -1.25419888 1.39459693
50 -1.17286591 -1.25419888
51 -1.36746884 -1.17286591
52 -0.19653102 -1.36746884
53 0.82257265 -0.19653102
54 -1.43045454 0.82257265
55 -1.34418020 -1.43045454
56 1.50262264 -1.34418020
57 1.27737869 1.50262264
58 0.52080362 1.27737869
59 0.83114510 0.52080362
60 NA 0.83114510
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.46079596 1.28654374
[2,] 0.14937714 2.46079596
[3,] -0.10283658 0.14937714
[4,] -1.31829566 -0.10283658
[5,] 1.41874956 -1.31829566
[6,] -0.74242946 1.41874956
[7,] -0.50312348 -0.74242946
[8,] -1.69323432 -0.50312348
[9,] 0.23480204 -1.69323432
[10,] -0.64933737 0.23480204
[11,] 1.24968842 -0.64933737
[12,] -0.37627288 1.24968842
[13,] -1.97543976 -0.37627288
[14,] 0.81111950 -1.97543976
[15,] 0.58280244 0.81111950
[16,] 1.62271333 0.58280244
[17,] -1.29223351 1.62271333
[18,] 2.13938336 -1.29223351
[19,] -1.97320520 2.13938336
[20,] 0.55254315 -1.97320520
[21,] 0.56553321 0.55254315
[22,] 1.46479680 0.56553321
[23,] -0.66353664 1.46479680
[24,] -0.99655985 -0.66353664
[25,] 0.87352519 -0.99655985
[26,] -1.12895921 0.87352519
[27,] 1.14443599 -1.12895921
[28,] 0.34378973 1.14443599
[29,] -0.04458462 0.34378973
[30,] -1.09609981 -0.04458462
[31,] 0.07032959 -1.09609981
[32,] -0.02735001 0.07032959
[33,] 0.89073507 -0.02735001
[34,] 0.10454113 0.89073507
[35,] 0.52575130 0.10454113
[36,] -1.59865677 0.52575130
[37,] -0.40790127 -1.59865677
[38,] -0.44044487 -0.40790127
[39,] 1.44207415 -0.44044487
[40,] -0.81239921 1.44207415
[41,] -1.75493026 -0.81239921
[42,] 0.29377597 -1.75493026
[43,] 0.30303848 0.29377597
[44,] -1.80276572 0.30303848
[45,] 0.03914469 -1.80276572
[46,] 0.64263837 0.03914469
[47,] 0.60454789 0.64263837
[48,] 1.39459693 0.60454789
[49,] -1.25419888 1.39459693
[50,] -1.17286591 -1.25419888
[51,] -1.36746884 -1.17286591
[52,] -0.19653102 -1.36746884
[53,] 0.82257265 -0.19653102
[54,] -1.43045454 0.82257265
[55,] -1.34418020 -1.43045454
[56,] 1.50262264 -1.34418020
[57,] 1.27737869 1.50262264
[58,] 0.52080362 1.27737869
[59,] 0.83114510 0.52080362
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.46079596 1.28654374
2 0.14937714 2.46079596
3 -0.10283658 0.14937714
4 -1.31829566 -0.10283658
5 1.41874956 -1.31829566
6 -0.74242946 1.41874956
7 -0.50312348 -0.74242946
8 -1.69323432 -0.50312348
9 0.23480204 -1.69323432
10 -0.64933737 0.23480204
11 1.24968842 -0.64933737
12 -0.37627288 1.24968842
13 -1.97543976 -0.37627288
14 0.81111950 -1.97543976
15 0.58280244 0.81111950
16 1.62271333 0.58280244
17 -1.29223351 1.62271333
18 2.13938336 -1.29223351
19 -1.97320520 2.13938336
20 0.55254315 -1.97320520
21 0.56553321 0.55254315
22 1.46479680 0.56553321
23 -0.66353664 1.46479680
24 -0.99655985 -0.66353664
25 0.87352519 -0.99655985
26 -1.12895921 0.87352519
27 1.14443599 -1.12895921
28 0.34378973 1.14443599
29 -0.04458462 0.34378973
30 -1.09609981 -0.04458462
31 0.07032959 -1.09609981
32 -0.02735001 0.07032959
33 0.89073507 -0.02735001
34 0.10454113 0.89073507
35 0.52575130 0.10454113
36 -1.59865677 0.52575130
37 -0.40790127 -1.59865677
38 -0.44044487 -0.40790127
39 1.44207415 -0.44044487
40 -0.81239921 1.44207415
41 -1.75493026 -0.81239921
42 0.29377597 -1.75493026
43 0.30303848 0.29377597
44 -1.80276572 0.30303848
45 0.03914469 -1.80276572
46 0.64263837 0.03914469
47 0.60454789 0.64263837
48 1.39459693 0.60454789
49 -1.25419888 1.39459693
50 -1.17286591 -1.25419888
51 -1.36746884 -1.17286591
52 -0.19653102 -1.36746884
53 0.82257265 -0.19653102
54 -1.43045454 0.82257265
55 -1.34418020 -1.43045454
56 1.50262264 -1.34418020
57 1.27737869 1.50262264
58 0.52080362 1.27737869
59 0.83114510 0.52080362
> 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/7rs3u1291238458.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/html/rcomp/tmp/8kjkf1291238458.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/html/rcomp/tmp/9kjkf1291238458.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/html/rcomp/tmp/10kjkf1291238458.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/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/11gti51291238458.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/12jbgb1291238458.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/13x3wk1291238458.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/14jmv81291238458.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/154mbe1291238458.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/167nsk1291238458.tab")
+ }
>
> try(system("convert tmp/16rmo1291238458.ps tmp/16rmo1291238458.png",intern=TRUE))
character(0)
> try(system("convert tmp/26rmo1291238458.ps tmp/26rmo1291238458.png",intern=TRUE))
character(0)
> try(system("convert tmp/36rmo1291238458.ps tmp/36rmo1291238458.png",intern=TRUE))
character(0)
> try(system("convert tmp/4yjmr1291238458.ps tmp/4yjmr1291238458.png",intern=TRUE))
character(0)
> try(system("convert tmp/5yjmr1291238458.ps tmp/5yjmr1291238458.png",intern=TRUE))
character(0)
> try(system("convert tmp/6yjmr1291238458.ps tmp/6yjmr1291238458.png",intern=TRUE))
character(0)
> try(system("convert tmp/7rs3u1291238458.ps tmp/7rs3u1291238458.png",intern=TRUE))
character(0)
> try(system("convert tmp/8kjkf1291238458.ps tmp/8kjkf1291238458.png",intern=TRUE))
character(0)
> try(system("convert tmp/9kjkf1291238458.ps tmp/9kjkf1291238458.png",intern=TRUE))
character(0)
> try(system("convert tmp/10kjkf1291238458.ps tmp/10kjkf1291238458.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.481 1.611 6.689