R version 2.8.0 (2008-10-20)
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.
Natural language support but running in an English locale
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
+ ,-3.0
+ ,14097.8
+ ,15116.3
+ ,95.9
+ ,-3.7
+ ,14776.8
+ ,17413.2
+ ,104.7
+ ,-4.7
+ ,16833.3
+ ,16181.5
+ ,102.8
+ ,-6.4
+ ,15385.5
+ ,15607.4
+ ,98.1
+ ,-7.5
+ ,15172.6
+ ,17160.9
+ ,113.9
+ ,-7.8
+ ,16858.9
+ ,14915.8
+ ,80.9
+ ,-7.7
+ ,14143.5
+ ,13768
+ ,95.7
+ ,-6.6
+ ,14731.8
+ ,17487.5
+ ,113.2
+ ,-4.2
+ ,16471.6
+ ,16198.1
+ ,105.9
+ ,-2.0
+ ,15214
+ ,17535.2
+ ,108.8
+ ,-0.7
+ ,17637.4
+ ,16571.8
+ ,102.3
+ ,0.1
+ ,17972.4
+ ,16198.9
+ ,99
+ ,0.9
+ ,16896.2
+ ,16554.2
+ ,100.7
+ ,2.1
+ ,16698
+ ,19554.2
+ ,115.5
+ ,3.5
+ ,19691.6
+ ,15903.8
+ ,100.7
+ ,4.9
+ ,15930.7
+ ,18003.8
+ ,109.9
+ ,5.7
+ ,17444.6
+ ,18329.6
+ ,114.6
+ ,6.2
+ ,17699.4
+ ,16260.7
+ ,85.4
+ ,6.5
+ ,15189.8
+ ,14851.9
+ ,100.5
+ ,6.5
+ ,15672.7
+ ,18174.1
+ ,114.8
+ ,6.3
+ ,17180.8
+ ,18406.6
+ ,116.5
+ ,6.2
+ ,17664.9
+ ,18466.5
+ ,112.9
+ ,6.4
+ ,17862.9
+ ,16016.5
+ ,102
+ ,6.3
+ ,16162.3
+ ,17428.5
+ ,106
+ ,5.8
+ ,17463.6
+ ,17167.2
+ ,105.3
+ ,5.1
+ ,16772.1
+ ,19630
+ ,118.8
+ ,5.1
+ ,19106.9
+ ,17183.6
+ ,106.1
+ ,5.8
+ ,16721.3
+ ,18344.7
+ ,109.3
+ ,6.7
+ ,18161.3
+ ,19301.4
+ ,117.2
+ ,7.1
+ ,18509.9
+ ,18147.5
+ ,92.5
+ ,6.7
+ ,17802.7
+ ,16192.9
+ ,104.2
+ ,5.5
+ ,16409.9
+ ,18374.4
+ ,112.5
+ ,4.2
+ ,17967.7
+ ,20515.2
+ ,122.4
+ ,3.0
+ ,20286.6
+ ,18957.2
+ ,113.3
+ ,2.2
+ ,19537.3
+ ,16471.5
+ ,100
+ ,2.0
+ ,18021.9
+ ,18746.8
+ ,110.7
+ ,1.8
+ ,20194.3
+ ,19009.5
+ ,112.8
+ ,1.8
+ ,19049.6
+ ,19211.2
+ ,109.8
+ ,1.5
+ ,20244.7
+ ,20547.7
+ ,117.3
+ ,0.4
+ ,21473.3
+ ,19325.8
+ ,109.1
+ ,-0.9
+ ,19673.6
+ ,20605.5
+ ,115.9
+ ,-1.7
+ ,21053.2
+ ,20056.9
+ ,96
+ ,-2.6
+ ,20159.5
+ ,16141.4
+ ,99.8
+ ,-4.4
+ ,18203.6
+ ,20359.8
+ ,116.8
+ ,-8.3
+ ,21289.5
+ ,19711.6
+ ,115.7
+ ,-14.4
+ ,20432.3
+ ,15638.6
+ ,99.4
+ ,-21.3
+ ,17180.4
+ ,14384.5
+ ,94.3
+ ,-26.5
+ ,15816.8
+ ,13855.6
+ ,91
+ ,-29.2
+ ,15071.8
+ ,14308.3
+ ,93.2
+ ,-30.8
+ ,14521.1
+ ,15290.6
+ ,103.1
+ ,-30.9
+ ,15668.8
+ ,14423.8
+ ,94.1
+ ,-29.5
+ ,14346.9
+ ,13779.7
+ ,91.8
+ ,-27.1
+ ,13881
+ ,15686.3
+ ,102.7
+ ,-24.4
+ ,15465.9
+ ,14733.8
+ ,82.6
+ ,-21.9
+ ,14238.2
+ ,12522.5
+ ,89.1
+ ,-19.3
+ ,13557.7
+ ,16189.4
+ ,104.5
+ ,-17.0
+ ,16127.6
+ ,16059.1
+ ,105.1
+ ,-13.8
+ ,16793.9
+ ,16007.1
+ ,95.1
+ ,-9.9
+ ,16014
+ ,15806.8
+ ,88.7
+ ,-7.9
+ ,16867.9
+ ,15160
+ ,86.3
+ ,-7.2
+ ,16014.6
+ ,15692.1
+ ,91.8
+ ,-6.2
+ ,15878.6
+ ,18908.9
+ ,111.5
+ ,-4.5
+ ,18664.9
+ ,16969.9
+ ,99.7
+ ,-3.9
+ ,17962.5
+ ,16997.5
+ ,97.5
+ ,-5.0
+ ,17332.7
+ ,19858.9
+ ,111.7
+ ,-6.2
+ ,19542.1
+ ,17681.2
+ ,86.2
+ ,-6.1
+ ,17203.6
+ ,16006.9
+ ,95.4
+ ,-5.0
+ ,16579)
+ ,dim=c(4
+ ,68)
+ ,dimnames=list(c('uitvoer'
+ ,'productie'
+ ,'ondernemersvertrouwen'
+ ,'invoer')
+ ,1:68))
> y <- array(NA,dim=c(4,68),dimnames=list(c('uitvoer','productie','ondernemersvertrouwen','invoer'),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 = '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 ondernemersvertrouwen invoer t
1 94.6 14544.5 -3.0 14097.8 1
2 95.9 15116.3 -3.7 14776.8 2
3 104.7 17413.2 -4.7 16833.3 3
4 102.8 16181.5 -6.4 15385.5 4
5 98.1 15607.4 -7.5 15172.6 5
6 113.9 17160.9 -7.8 16858.9 6
7 80.9 14915.8 -7.7 14143.5 7
8 95.7 13768.0 -6.6 14731.8 8
9 113.2 17487.5 -4.2 16471.6 9
10 105.9 16198.1 -2.0 15214.0 10
11 108.8 17535.2 -0.7 17637.4 11
12 102.3 16571.8 0.1 17972.4 12
13 99.0 16198.9 0.9 16896.2 13
14 100.7 16554.2 2.1 16698.0 14
15 115.5 19554.2 3.5 19691.6 15
16 100.7 15903.8 4.9 15930.7 16
17 109.9 18003.8 5.7 17444.6 17
18 114.6 18329.6 6.2 17699.4 18
19 85.4 16260.7 6.5 15189.8 19
20 100.5 14851.9 6.5 15672.7 20
21 114.8 18174.1 6.3 17180.8 21
22 116.5 18406.6 6.2 17664.9 22
23 112.9 18466.5 6.4 17862.9 23
24 102.0 16016.5 6.3 16162.3 24
25 106.0 17428.5 5.8 17463.6 25
26 105.3 17167.2 5.1 16772.1 26
27 118.8 19630.0 5.1 19106.9 27
28 106.1 17183.6 5.8 16721.3 28
29 109.3 18344.7 6.7 18161.3 29
30 117.2 19301.4 7.1 18509.9 30
31 92.5 18147.5 6.7 17802.7 31
32 104.2 16192.9 5.5 16409.9 32
33 112.5 18374.4 4.2 17967.7 33
34 122.4 20515.2 3.0 20286.6 34
35 113.3 18957.2 2.2 19537.3 35
36 100.0 16471.5 2.0 18021.9 36
37 110.7 18746.8 1.8 20194.3 37
38 112.8 19009.5 1.8 19049.6 38
39 109.8 19211.2 1.5 20244.7 39
40 117.3 20547.7 0.4 21473.3 40
41 109.1 19325.8 -0.9 19673.6 41
42 115.9 20605.5 -1.7 21053.2 42
43 96.0 20056.9 -2.6 20159.5 43
44 99.8 16141.4 -4.4 18203.6 44
45 116.8 20359.8 -8.3 21289.5 45
46 115.7 19711.6 -14.4 20432.3 46
47 99.4 15638.6 -21.3 17180.4 47
48 94.3 14384.5 -26.5 15816.8 48
49 91.0 13855.6 -29.2 15071.8 49
50 93.2 14308.3 -30.8 14521.1 50
51 103.1 15290.6 -30.9 15668.8 51
52 94.1 14423.8 -29.5 14346.9 52
53 91.8 13779.7 -27.1 13881.0 53
54 102.7 15686.3 -24.4 15465.9 54
55 82.6 14733.8 -21.9 14238.2 55
56 89.1 12522.5 -19.3 13557.7 56
57 104.5 16189.4 -17.0 16127.6 57
58 105.1 16059.1 -13.8 16793.9 58
59 95.1 16007.1 -9.9 16014.0 59
60 88.7 15806.8 -7.9 16867.9 60
61 86.3 15160.0 -7.2 16014.6 61
62 91.8 15692.1 -6.2 15878.6 62
63 111.5 18908.9 -4.5 18664.9 63
64 99.7 16969.9 -3.9 17962.5 64
65 97.5 16997.5 -5.0 17332.7 65
66 111.7 19858.9 -6.2 19542.1 66
67 86.2 17681.2 -6.1 17203.6 67
68 95.4 16006.9 -5.0 16579.0 68
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) uitvoer ondernemersvertrouwen
30.811592 0.003488 -0.167650
invoer t
0.001037 -0.159945
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-19.2152 -1.9600 0.4693 4.2478 7.8374
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 30.811592 8.030548 3.837 0.000291 ***
uitvoer 0.003488 0.001118 3.120 0.002726 **
ondernemersvertrouwen -0.167650 0.097799 -1.714 0.091405 .
invoer 0.001037 0.001076 0.963 0.339122
t -0.159945 0.046721 -3.423 0.001092 **
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 5.918 on 63 degrees of freedom
Multiple R-squared: 0.6674, Adjusted R-squared: 0.6463
F-statistic: 31.6 on 4 and 63 DF, p-value: 1.925e-14
> 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.3482187 0.6964375 0.6517813
[2,] 0.6750714 0.6498571 0.3249286
[3,] 0.5420018 0.9159965 0.4579982
[4,] 0.7636628 0.4726744 0.2363372
[5,] 0.7770992 0.4458015 0.2229008
[6,] 0.7220150 0.5559700 0.2779850
[7,] 0.6446663 0.7106674 0.3553337
[8,] 0.5761983 0.8476034 0.4238017
[9,] 0.5059332 0.9881336 0.4940668
[10,] 0.4124775 0.8249549 0.5875225
[11,] 0.3508999 0.7017997 0.6491001
[12,] 0.6959278 0.6081443 0.3040722
[13,] 0.7396632 0.5206736 0.2603368
[14,] 0.7400724 0.5198553 0.2599276
[15,] 0.7193663 0.5612673 0.2806337
[16,] 0.6497895 0.7004209 0.3502105
[17,] 0.5771499 0.8457001 0.4228501
[18,] 0.5079331 0.9841338 0.4920669
[19,] 0.4300938 0.8601876 0.5699062
[20,] 0.3705954 0.7411908 0.6294046
[21,] 0.3042178 0.6084356 0.6957822
[22,] 0.2534168 0.5068336 0.7465832
[23,] 0.2287290 0.4574580 0.7712710
[24,] 0.6704378 0.6591243 0.3295622
[25,] 0.6516330 0.6967341 0.3483670
[26,] 0.6185521 0.7628958 0.3814479
[27,] 0.6179437 0.7641127 0.3820563
[28,] 0.5833195 0.8333610 0.4166805
[29,] 0.5171693 0.9656613 0.4828307
[30,] 0.4591015 0.9182031 0.5408985
[31,] 0.4975913 0.9951827 0.5024087
[32,] 0.4592945 0.9185891 0.5407055
[33,] 0.4220776 0.8441553 0.5779224
[34,] 0.4107541 0.8215083 0.5892459
[35,] 0.4195681 0.8391362 0.5804319
[36,] 0.7214068 0.5571863 0.2785932
[37,] 0.6880656 0.6238687 0.3119344
[38,] 0.6244413 0.7511174 0.3755587
[39,] 0.5785132 0.8429735 0.4214868
[40,] 0.5510906 0.8978187 0.4489094
[41,] 0.5377601 0.9244798 0.4622399
[42,] 0.5909585 0.8180830 0.4090415
[43,] 0.5576097 0.8847805 0.4423903
[44,] 0.5289423 0.9421153 0.4710577
[45,] 0.4601457 0.9202915 0.5398543
[46,] 0.3685254 0.7370508 0.6314746
[47,] 0.2873971 0.5747942 0.7126029
[48,] 0.4635297 0.9270595 0.5364703
[49,] 0.3740636 0.7481272 0.6259364
[50,] 0.2927485 0.5854971 0.7072515
[51,] 0.3573315 0.7146629 0.6426685
[52,] 0.4321023 0.8642046 0.5678977
[53,] 0.3105287 0.6210574 0.6894713
> postscript(file="/var/www/html/freestat/rcomp/tmp/147eo1292605120.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/freestat/rcomp/tmp/2fywr1292605120.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/freestat/rcomp/tmp/3fywr1292605120.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/freestat/rcomp/tmp/48qvu1292605120.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/freestat/rcomp/tmp/58qvu1292605120.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 = 68
Frequency = 1
1 2 3 4 5 6
-1.89206944 -3.24746531 -4.59734712 -0.82609912 -3.32769137 5.41614679
7 8 9 10 11 12
-16.76264396 1.77491988 5.06194199 4.09110451 0.19385264 -2.99942557
13 14 15 16 17 18
-3.58933249 -2.56188902 -0.93284358 1.29105425 1.89206488 5.43548373
19 20 21 22 23 24
-13.73760177 5.93504719 7.21194695 7.74248520 3.92182193 3.47221822
25 26 27 28 29 30
1.27508132 2.24573371 4.89644935 3.47843969 1.44726828 5.87640483
31 32 33 34 35 36
-13.97339468 5.94581218 4.96502006 4.95402560 2.09012012 -0.84371044
37 38 39 40 41 42
-0.20427665 2.32601837 -2.50653661 -0.96559742 -3.09670926 -2.16390033
43 44 45 46 47 48
-19.21521887 0.12579385 -1.27859645 -0.09216715 0.18647593 0.16179484
49 50 51 52 53 54
-0.81413086 0.26958753 5.69731951 1.48517685 2.47673039 5.69717136
55 56 57 58 59 60
-9.22931653 6.28388338 6.77715377 7.83735805 -0.35911403 -6.45041609
61 62 63 64 65 66
-5.43289500 -1.32005154 4.71806441 0.66900790 -0.99890476 0.89047944
67 68
-14.41404336 1.61692988
> postscript(file="/var/www/html/freestat/rcomp/tmp/68qvu1292605120.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 = 68
Frequency = 1
lag(myerror, k = 1) myerror
0 -1.89206944 NA
1 -3.24746531 -1.89206944
2 -4.59734712 -3.24746531
3 -0.82609912 -4.59734712
4 -3.32769137 -0.82609912
5 5.41614679 -3.32769137
6 -16.76264396 5.41614679
7 1.77491988 -16.76264396
8 5.06194199 1.77491988
9 4.09110451 5.06194199
10 0.19385264 4.09110451
11 -2.99942557 0.19385264
12 -3.58933249 -2.99942557
13 -2.56188902 -3.58933249
14 -0.93284358 -2.56188902
15 1.29105425 -0.93284358
16 1.89206488 1.29105425
17 5.43548373 1.89206488
18 -13.73760177 5.43548373
19 5.93504719 -13.73760177
20 7.21194695 5.93504719
21 7.74248520 7.21194695
22 3.92182193 7.74248520
23 3.47221822 3.92182193
24 1.27508132 3.47221822
25 2.24573371 1.27508132
26 4.89644935 2.24573371
27 3.47843969 4.89644935
28 1.44726828 3.47843969
29 5.87640483 1.44726828
30 -13.97339468 5.87640483
31 5.94581218 -13.97339468
32 4.96502006 5.94581218
33 4.95402560 4.96502006
34 2.09012012 4.95402560
35 -0.84371044 2.09012012
36 -0.20427665 -0.84371044
37 2.32601837 -0.20427665
38 -2.50653661 2.32601837
39 -0.96559742 -2.50653661
40 -3.09670926 -0.96559742
41 -2.16390033 -3.09670926
42 -19.21521887 -2.16390033
43 0.12579385 -19.21521887
44 -1.27859645 0.12579385
45 -0.09216715 -1.27859645
46 0.18647593 -0.09216715
47 0.16179484 0.18647593
48 -0.81413086 0.16179484
49 0.26958753 -0.81413086
50 5.69731951 0.26958753
51 1.48517685 5.69731951
52 2.47673039 1.48517685
53 5.69717136 2.47673039
54 -9.22931653 5.69717136
55 6.28388338 -9.22931653
56 6.77715377 6.28388338
57 7.83735805 6.77715377
58 -0.35911403 7.83735805
59 -6.45041609 -0.35911403
60 -5.43289500 -6.45041609
61 -1.32005154 -5.43289500
62 4.71806441 -1.32005154
63 0.66900790 4.71806441
64 -0.99890476 0.66900790
65 0.89047944 -0.99890476
66 -14.41404336 0.89047944
67 1.61692988 -14.41404336
68 NA 1.61692988
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -3.24746531 -1.89206944
[2,] -4.59734712 -3.24746531
[3,] -0.82609912 -4.59734712
[4,] -3.32769137 -0.82609912
[5,] 5.41614679 -3.32769137
[6,] -16.76264396 5.41614679
[7,] 1.77491988 -16.76264396
[8,] 5.06194199 1.77491988
[9,] 4.09110451 5.06194199
[10,] 0.19385264 4.09110451
[11,] -2.99942557 0.19385264
[12,] -3.58933249 -2.99942557
[13,] -2.56188902 -3.58933249
[14,] -0.93284358 -2.56188902
[15,] 1.29105425 -0.93284358
[16,] 1.89206488 1.29105425
[17,] 5.43548373 1.89206488
[18,] -13.73760177 5.43548373
[19,] 5.93504719 -13.73760177
[20,] 7.21194695 5.93504719
[21,] 7.74248520 7.21194695
[22,] 3.92182193 7.74248520
[23,] 3.47221822 3.92182193
[24,] 1.27508132 3.47221822
[25,] 2.24573371 1.27508132
[26,] 4.89644935 2.24573371
[27,] 3.47843969 4.89644935
[28,] 1.44726828 3.47843969
[29,] 5.87640483 1.44726828
[30,] -13.97339468 5.87640483
[31,] 5.94581218 -13.97339468
[32,] 4.96502006 5.94581218
[33,] 4.95402560 4.96502006
[34,] 2.09012012 4.95402560
[35,] -0.84371044 2.09012012
[36,] -0.20427665 -0.84371044
[37,] 2.32601837 -0.20427665
[38,] -2.50653661 2.32601837
[39,] -0.96559742 -2.50653661
[40,] -3.09670926 -0.96559742
[41,] -2.16390033 -3.09670926
[42,] -19.21521887 -2.16390033
[43,] 0.12579385 -19.21521887
[44,] -1.27859645 0.12579385
[45,] -0.09216715 -1.27859645
[46,] 0.18647593 -0.09216715
[47,] 0.16179484 0.18647593
[48,] -0.81413086 0.16179484
[49,] 0.26958753 -0.81413086
[50,] 5.69731951 0.26958753
[51,] 1.48517685 5.69731951
[52,] 2.47673039 1.48517685
[53,] 5.69717136 2.47673039
[54,] -9.22931653 5.69717136
[55,] 6.28388338 -9.22931653
[56,] 6.77715377 6.28388338
[57,] 7.83735805 6.77715377
[58,] -0.35911403 7.83735805
[59,] -6.45041609 -0.35911403
[60,] -5.43289500 -6.45041609
[61,] -1.32005154 -5.43289500
[62,] 4.71806441 -1.32005154
[63,] 0.66900790 4.71806441
[64,] -0.99890476 0.66900790
[65,] 0.89047944 -0.99890476
[66,] -14.41404336 0.89047944
[67,] 1.61692988 -14.41404336
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -3.24746531 -1.89206944
2 -4.59734712 -3.24746531
3 -0.82609912 -4.59734712
4 -3.32769137 -0.82609912
5 5.41614679 -3.32769137
6 -16.76264396 5.41614679
7 1.77491988 -16.76264396
8 5.06194199 1.77491988
9 4.09110451 5.06194199
10 0.19385264 4.09110451
11 -2.99942557 0.19385264
12 -3.58933249 -2.99942557
13 -2.56188902 -3.58933249
14 -0.93284358 -2.56188902
15 1.29105425 -0.93284358
16 1.89206488 1.29105425
17 5.43548373 1.89206488
18 -13.73760177 5.43548373
19 5.93504719 -13.73760177
20 7.21194695 5.93504719
21 7.74248520 7.21194695
22 3.92182193 7.74248520
23 3.47221822 3.92182193
24 1.27508132 3.47221822
25 2.24573371 1.27508132
26 4.89644935 2.24573371
27 3.47843969 4.89644935
28 1.44726828 3.47843969
29 5.87640483 1.44726828
30 -13.97339468 5.87640483
31 5.94581218 -13.97339468
32 4.96502006 5.94581218
33 4.95402560 4.96502006
34 2.09012012 4.95402560
35 -0.84371044 2.09012012
36 -0.20427665 -0.84371044
37 2.32601837 -0.20427665
38 -2.50653661 2.32601837
39 -0.96559742 -2.50653661
40 -3.09670926 -0.96559742
41 -2.16390033 -3.09670926
42 -19.21521887 -2.16390033
43 0.12579385 -19.21521887
44 -1.27859645 0.12579385
45 -0.09216715 -1.27859645
46 0.18647593 -0.09216715
47 0.16179484 0.18647593
48 -0.81413086 0.16179484
49 0.26958753 -0.81413086
50 5.69731951 0.26958753
51 1.48517685 5.69731951
52 2.47673039 1.48517685
53 5.69717136 2.47673039
54 -9.22931653 5.69717136
55 6.28388338 -9.22931653
56 6.77715377 6.28388338
57 7.83735805 6.77715377
58 -0.35911403 7.83735805
59 -6.45041609 -0.35911403
60 -5.43289500 -6.45041609
61 -1.32005154 -5.43289500
62 4.71806441 -1.32005154
63 0.66900790 4.71806441
64 -0.99890476 0.66900790
65 0.89047944 -0.99890476
66 -14.41404336 0.89047944
67 1.61692988 -14.41404336
> 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/freestat/rcomp/tmp/71zcx1292605120.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/freestat/rcomp/tmp/81zcx1292605120.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/freestat/rcomp/tmp/9tqti1292605120.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/freestat/rcomp/tmp/10tqti1292605120.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/11frs61292605120.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/freestat/rcomp/tmp/120r8c1292605120.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/freestat/rcomp/tmp/13psn51292605120.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/freestat/rcomp/tmp/14hj5q1292605120.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/freestat/rcomp/tmp/15323e1292605120.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/freestat/rcomp/tmp/16hu1n1292605120.tab")
+ }
>
> try(system("convert tmp/147eo1292605120.ps tmp/147eo1292605120.png",intern=TRUE))
character(0)
> try(system("convert tmp/2fywr1292605120.ps tmp/2fywr1292605120.png",intern=TRUE))
character(0)
> try(system("convert tmp/3fywr1292605120.ps tmp/3fywr1292605120.png",intern=TRUE))
character(0)
> try(system("convert tmp/48qvu1292605120.ps tmp/48qvu1292605120.png",intern=TRUE))
character(0)
> try(system("convert tmp/58qvu1292605120.ps tmp/58qvu1292605120.png",intern=TRUE))
character(0)
> try(system("convert tmp/68qvu1292605120.ps tmp/68qvu1292605120.png",intern=TRUE))
character(0)
> try(system("convert tmp/71zcx1292605120.ps tmp/71zcx1292605120.png",intern=TRUE))
character(0)
> try(system("convert tmp/81zcx1292605120.ps tmp/81zcx1292605120.png",intern=TRUE))
character(0)
> try(system("convert tmp/9tqti1292605120.ps tmp/9tqti1292605120.png",intern=TRUE))
character(0)
> try(system("convert tmp/10tqti1292605120.ps tmp/10tqti1292605120.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.257 2.643 4.694