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(122.74
+ ,95.10
+ ,96.33
+ ,109.84
+ ,97.00
+ ,96.33
+ ,101.99
+ ,112.70
+ ,95.05
+ ,125.12
+ ,102.90
+ ,96.84
+ ,103.5
+ ,97.40
+ ,96.92
+ ,102.8
+ ,111.40
+ ,97.44
+ ,118.72
+ ,87.40
+ ,97.78
+ ,119.01
+ ,96.80
+ ,97.69
+ ,118.61
+ ,114.10
+ ,96.67
+ ,120.43
+ ,110.30
+ ,98.29
+ ,111.83
+ ,103.90
+ ,98.20
+ ,116.79
+ ,101.60
+ ,98.71
+ ,131.71
+ ,94.60
+ ,98.54
+ ,120.57
+ ,95.90
+ ,98.20
+ ,117.83
+ ,104.70
+ ,100.80
+ ,130.8
+ ,102.80
+ ,101.33
+ ,107.46
+ ,98.10
+ ,101.88
+ ,112.09
+ ,113.90
+ ,101.85
+ ,129.47
+ ,80.90
+ ,102.04
+ ,119.72
+ ,95.70
+ ,102.22
+ ,134.81
+ ,113.20
+ ,102.63
+ ,135.8
+ ,105.90
+ ,102.65
+ ,129.27
+ ,108.80
+ ,102.54
+ ,126.94
+ ,102.30
+ ,102.37
+ ,153.45
+ ,99.00
+ ,102.68
+ ,121.86
+ ,100.70
+ ,102.76
+ ,133.47
+ ,115.50
+ ,102.82
+ ,135.34
+ ,100.70
+ ,103.31
+ ,117.1
+ ,109.90
+ ,103.23
+ ,120.65
+ ,114.60
+ ,103.60
+ ,132.49
+ ,85.40
+ ,103.95
+ ,137.6
+ ,100.50
+ ,103.93
+ ,138.69
+ ,114.80
+ ,104.25
+ ,125.53
+ ,116.50
+ ,104.38
+ ,133.09
+ ,112.90
+ ,104.36
+ ,129.08
+ ,102.00
+ ,104.32
+ ,145.94
+ ,106.00
+ ,104.58
+ ,129.07
+ ,105.30
+ ,104.68
+ ,139.69
+ ,118.80
+ ,104.92
+ ,142.09
+ ,106.10
+ ,105.46
+ ,137.29
+ ,109.30
+ ,105.23
+ ,127.03
+ ,117.20
+ ,105.58
+ ,137.25
+ ,92.50
+ ,105.34
+ ,156.87
+ ,104.20
+ ,105.28
+ ,150.89
+ ,112.50
+ ,105.70
+ ,139.14
+ ,122.40
+ ,105.67
+ ,158.3
+ ,113.30
+ ,105.71
+ ,149
+ ,100.00
+ ,106.19
+ ,158.36
+ ,110.70
+ ,106.93
+ ,168.06
+ ,112.80
+ ,107.44
+ ,153.38
+ ,109.80
+ ,107.85
+ ,173.86
+ ,117.30
+ ,108.71
+ ,162.47
+ ,109.10
+ ,109.32
+ ,145.17
+ ,115.90
+ ,109.49
+ ,168.89
+ ,96.00
+ ,110.20
+ ,166.64
+ ,99.80
+ ,110.62
+ ,140.07
+ ,116.80
+ ,111.22
+ ,128.84
+ ,115.70
+ ,110.88
+ ,123.41
+ ,99.40
+ ,111.15
+ ,120.3
+ ,94.30
+ ,111.29
+ ,129.67
+ ,91.00
+ ,111.09
+ ,118.1
+ ,93.20
+ ,111.24
+ ,113.91
+ ,103.10
+ ,111.45
+ ,131.09
+ ,94.10
+ ,111.75
+ ,119.15
+ ,91.80
+ ,111.07
+ ,122.3
+ ,102.70
+ ,111.17)
+ ,dim=c(3
+ ,66)
+ ,dimnames=list(c('Invoer'
+ ,'TIP'
+ ,'CONS')
+ ,1:66))
> y <- array(NA,dim=c(3,66),dimnames=list(c('Invoer','TIP','CONS'),1:66))
> 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 = 'Include Monthly 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
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
Invoer TIP CONS M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 122.74 95.1 96.33 1 0 0 0 0 0 0 0 0 0 0 1
2 109.84 97.0 96.33 0 1 0 0 0 0 0 0 0 0 0 2
3 101.99 112.7 95.05 0 0 1 0 0 0 0 0 0 0 0 3
4 125.12 102.9 96.84 0 0 0 1 0 0 0 0 0 0 0 4
5 103.50 97.4 96.92 0 0 0 0 1 0 0 0 0 0 0 5
6 102.80 111.4 97.44 0 0 0 0 0 1 0 0 0 0 0 6
7 118.72 87.4 97.78 0 0 0 0 0 0 1 0 0 0 0 7
8 119.01 96.8 97.69 0 0 0 0 0 0 0 1 0 0 0 8
9 118.61 114.1 96.67 0 0 0 0 0 0 0 0 1 0 0 9
10 120.43 110.3 98.29 0 0 0 0 0 0 0 0 0 1 0 10
11 111.83 103.9 98.20 0 0 0 0 0 0 0 0 0 0 1 11
12 116.79 101.6 98.71 0 0 0 0 0 0 0 0 0 0 0 12
13 131.71 94.6 98.54 1 0 0 0 0 0 0 0 0 0 0 13
14 120.57 95.9 98.20 0 1 0 0 0 0 0 0 0 0 0 14
15 117.83 104.7 100.80 0 0 1 0 0 0 0 0 0 0 0 15
16 130.80 102.8 101.33 0 0 0 1 0 0 0 0 0 0 0 16
17 107.46 98.1 101.88 0 0 0 0 1 0 0 0 0 0 0 17
18 112.09 113.9 101.85 0 0 0 0 0 1 0 0 0 0 0 18
19 129.47 80.9 102.04 0 0 0 0 0 0 1 0 0 0 0 19
20 119.72 95.7 102.22 0 0 0 0 0 0 0 1 0 0 0 20
21 134.81 113.2 102.63 0 0 0 0 0 0 0 0 1 0 0 21
22 135.80 105.9 102.65 0 0 0 0 0 0 0 0 0 1 0 22
23 129.27 108.8 102.54 0 0 0 0 0 0 0 0 0 0 1 23
24 126.94 102.3 102.37 0 0 0 0 0 0 0 0 0 0 0 24
25 153.45 99.0 102.68 1 0 0 0 0 0 0 0 0 0 0 25
26 121.86 100.7 102.76 0 1 0 0 0 0 0 0 0 0 0 26
27 133.47 115.5 102.82 0 0 1 0 0 0 0 0 0 0 0 27
28 135.34 100.7 103.31 0 0 0 1 0 0 0 0 0 0 0 28
29 117.10 109.9 103.23 0 0 0 0 1 0 0 0 0 0 0 29
30 120.65 114.6 103.60 0 0 0 0 0 1 0 0 0 0 0 30
31 132.49 85.4 103.95 0 0 0 0 0 0 1 0 0 0 0 31
32 137.60 100.5 103.93 0 0 0 0 0 0 0 1 0 0 0 32
33 138.69 114.8 104.25 0 0 0 0 0 0 0 0 1 0 0 33
34 125.53 116.5 104.38 0 0 0 0 0 0 0 0 0 1 0 34
35 133.09 112.9 104.36 0 0 0 0 0 0 0 0 0 0 1 35
36 129.08 102.0 104.32 0 0 0 0 0 0 0 0 0 0 0 36
37 145.94 106.0 104.58 1 0 0 0 0 0 0 0 0 0 0 37
38 129.07 105.3 104.68 0 1 0 0 0 0 0 0 0 0 0 38
39 139.69 118.8 104.92 0 0 1 0 0 0 0 0 0 0 0 39
40 142.09 106.1 105.46 0 0 0 1 0 0 0 0 0 0 0 40
41 137.29 109.3 105.23 0 0 0 0 1 0 0 0 0 0 0 41
42 127.03 117.2 105.58 0 0 0 0 0 1 0 0 0 0 0 42
43 137.25 92.5 105.34 0 0 0 0 0 0 1 0 0 0 0 43
44 156.87 104.2 105.28 0 0 0 0 0 0 0 1 0 0 0 44
45 150.89 112.5 105.70 0 0 0 0 0 0 0 0 1 0 0 45
46 139.14 122.4 105.67 0 0 0 0 0 0 0 0 0 1 0 46
47 158.30 113.3 105.71 0 0 0 0 0 0 0 0 0 0 1 47
48 149.00 100.0 106.19 0 0 0 0 0 0 0 0 0 0 0 48
49 158.36 110.7 106.93 1 0 0 0 0 0 0 0 0 0 0 49
50 168.06 112.8 107.44 0 1 0 0 0 0 0 0 0 0 0 50
51 153.38 109.8 107.85 0 0 1 0 0 0 0 0 0 0 0 51
52 173.86 117.3 108.71 0 0 0 1 0 0 0 0 0 0 0 52
53 162.47 109.1 109.32 0 0 0 0 1 0 0 0 0 0 0 53
54 145.17 115.9 109.49 0 0 0 0 0 1 0 0 0 0 0 54
55 168.89 96.0 110.20 0 0 0 0 0 0 1 0 0 0 0 55
56 166.64 99.8 110.62 0 0 0 0 0 0 0 1 0 0 0 56
57 140.07 116.8 111.22 0 0 0 0 0 0 0 0 1 0 0 57
58 128.84 115.7 110.88 0 0 0 0 0 0 0 0 0 1 0 58
59 123.41 99.4 111.15 0 0 0 0 0 0 0 0 0 0 1 59
60 120.30 94.3 111.29 0 0 0 0 0 0 0 0 0 0 0 60
61 129.67 91.0 111.09 1 0 0 0 0 0 0 0 0 0 0 61
62 118.10 93.2 111.24 0 1 0 0 0 0 0 0 0 0 0 62
63 113.91 103.1 111.45 0 0 1 0 0 0 0 0 0 0 0 63
64 131.09 94.1 111.75 0 0 0 1 0 0 0 0 0 0 0 64
65 119.15 91.8 111.07 0 0 0 0 1 0 0 0 0 0 0 65
66 122.30 102.7 111.17 0 0 0 0 0 1 0 0 0 0 0 66
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) TIP CONS M1 M2 M3
-98.8671 1.5811 0.5584 15.0703 0.0912 -17.3516
M4 M5 M6 M7 M8 M9
5.6607 -7.6948 -26.7890 29.1699 14.0996 -13.1599
M10 M11 t
-20.0903 -8.8892 0.2978
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-16.380 -6.410 -1.241 5.310 23.447
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -98.8671 159.5385 -0.620 0.538210
TIP 1.5811 0.2413 6.553 2.77e-08 ***
CONS 0.5585 1.5778 0.354 0.724841
M1 15.0703 6.2820 2.399 0.020135 *
M2 0.0912 6.2848 0.015 0.988478
M3 -17.3516 6.7899 -2.556 0.013628 *
M4 5.6607 6.4203 0.882 0.382079
M5 -7.6948 6.3291 -1.216 0.229665
M6 -26.7890 7.0323 -3.809 0.000376 ***
M7 29.1699 7.0782 4.121 0.000139 ***
M8 14.0996 6.5753 2.144 0.036795 *
M9 -13.1599 7.4662 -1.763 0.083961 .
M10 -20.0903 7.4587 -2.694 0.009545 **
M11 -8.8892 6.8130 -1.305 0.197841
t 0.2978 0.3860 0.771 0.444022
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 10.36 on 51 degrees of freedom
Multiple R-squared: 0.7038, Adjusted R-squared: 0.6226
F-statistic: 8.658 on 14 and 51 DF, p-value: 3.660e-09
> 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,] 9.027110e-03 0.0180542206 0.9909729
[2,] 2.134446e-03 0.0042688910 0.9978656
[3,] 2.793709e-03 0.0055874170 0.9972063
[4,] 3.257333e-03 0.0065146661 0.9967427
[5,] 2.658511e-03 0.0053170224 0.9973415
[6,] 4.144866e-03 0.0082897311 0.9958551
[7,] 1.403734e-03 0.0028074682 0.9985963
[8,] 5.652187e-03 0.0113043747 0.9943478
[9,] 8.131887e-03 0.0162637745 0.9918681
[10,] 6.138759e-03 0.0122775172 0.9938612
[11,] 6.236628e-03 0.0124732559 0.9937634
[12,] 5.803503e-03 0.0116070063 0.9941965
[13,] 2.640660e-03 0.0052813194 0.9973593
[14,] 1.989633e-03 0.0039792666 0.9980104
[15,] 1.167039e-03 0.0023340776 0.9988330
[16,] 5.632367e-04 0.0011264734 0.9994368
[17,] 3.389898e-03 0.0067797963 0.9966101
[18,] 1.704265e-03 0.0034085303 0.9982957
[19,] 8.482625e-04 0.0016965250 0.9991517
[20,] 4.966142e-04 0.0009932284 0.9995034
[21,] 2.262742e-04 0.0004525484 0.9997737
[22,] 1.964793e-04 0.0003929585 0.9998035
[23,] 8.131154e-05 0.0001626231 0.9999187
[24,] 2.618441e-04 0.0005236881 0.9997382
[25,] 4.493486e-04 0.0008986972 0.9995507
[26,] 5.636870e-03 0.0112737403 0.9943631
[27,] 1.522781e-01 0.3045562171 0.8477219
[28,] 9.572293e-02 0.1914458681 0.9042771
[29,] 2.201447e-01 0.4402894033 0.7798553
[30,] 1.986115e-01 0.3972230714 0.8013885
[31,] 1.264640e-01 0.2529280223 0.8735360
> postscript(file="/var/www/html/rcomp/tmp/1wbzj1261220755.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/2vfee1261220755.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/374iy1261220755.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/4l21t1261220755.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/5391b1261220755.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 = 66
Frequency = 1
1 2 3 4 5 6
2.0845955 0.8619515 -13.9508721 0.3638193 0.4527952 -3.8760879
7 8 9 10 11 12
-6.4570324 -6.2062849 -6.4273127 7.1286869 -2.8011073 -3.6764250
13 14 15 16 17 18
7.0378668 8.7137334 7.7534834 0.1214065 -3.0369393 -4.5745932
19 20 21 22 23 24
8.6178116 -9.8599708 4.2942098 23.4474504 0.8949234 -0.2501789
25 26 27 28 29 30
15.9361192 -3.7049876 1.6168285 3.3028240 -16.3804996 -1.6717141
31 32 33 34 35 36
-0.1167066 -4.0971191 1.1667287 -8.1210421 -6.3569087 -2.2979245
37 38 39 40 41 42
-7.2754763 -8.4131968 -2.1265169 -3.2586796 0.0681519 -4.0813007
43 44 45 46 47 48
-10.9316008 4.9959445 12.6203358 -8.1328139 13.8936684 16.1668157
49 50 51 52 53 54
-7.1719239 13.6044114 20.5837227 5.4153504 19.7072242 10.3574632
55 56 57 58 59 60
8.8875283 15.1674303 -11.6539616 -14.3222813 -5.6305759 -9.9422873
61 62 63 64 65 66
-10.6111814 -11.0619118 -13.8766457 -5.9447206 -0.8107323 3.8462327
> postscript(file="/var/www/html/rcomp/tmp/67yk61261220755.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 = 66
Frequency = 1
lag(myerror, k = 1) myerror
0 2.0845955 NA
1 0.8619515 2.0845955
2 -13.9508721 0.8619515
3 0.3638193 -13.9508721
4 0.4527952 0.3638193
5 -3.8760879 0.4527952
6 -6.4570324 -3.8760879
7 -6.2062849 -6.4570324
8 -6.4273127 -6.2062849
9 7.1286869 -6.4273127
10 -2.8011073 7.1286869
11 -3.6764250 -2.8011073
12 7.0378668 -3.6764250
13 8.7137334 7.0378668
14 7.7534834 8.7137334
15 0.1214065 7.7534834
16 -3.0369393 0.1214065
17 -4.5745932 -3.0369393
18 8.6178116 -4.5745932
19 -9.8599708 8.6178116
20 4.2942098 -9.8599708
21 23.4474504 4.2942098
22 0.8949234 23.4474504
23 -0.2501789 0.8949234
24 15.9361192 -0.2501789
25 -3.7049876 15.9361192
26 1.6168285 -3.7049876
27 3.3028240 1.6168285
28 -16.3804996 3.3028240
29 -1.6717141 -16.3804996
30 -0.1167066 -1.6717141
31 -4.0971191 -0.1167066
32 1.1667287 -4.0971191
33 -8.1210421 1.1667287
34 -6.3569087 -8.1210421
35 -2.2979245 -6.3569087
36 -7.2754763 -2.2979245
37 -8.4131968 -7.2754763
38 -2.1265169 -8.4131968
39 -3.2586796 -2.1265169
40 0.0681519 -3.2586796
41 -4.0813007 0.0681519
42 -10.9316008 -4.0813007
43 4.9959445 -10.9316008
44 12.6203358 4.9959445
45 -8.1328139 12.6203358
46 13.8936684 -8.1328139
47 16.1668157 13.8936684
48 -7.1719239 16.1668157
49 13.6044114 -7.1719239
50 20.5837227 13.6044114
51 5.4153504 20.5837227
52 19.7072242 5.4153504
53 10.3574632 19.7072242
54 8.8875283 10.3574632
55 15.1674303 8.8875283
56 -11.6539616 15.1674303
57 -14.3222813 -11.6539616
58 -5.6305759 -14.3222813
59 -9.9422873 -5.6305759
60 -10.6111814 -9.9422873
61 -11.0619118 -10.6111814
62 -13.8766457 -11.0619118
63 -5.9447206 -13.8766457
64 -0.8107323 -5.9447206
65 3.8462327 -0.8107323
66 NA 3.8462327
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.8619515 2.0845955
[2,] -13.9508721 0.8619515
[3,] 0.3638193 -13.9508721
[4,] 0.4527952 0.3638193
[5,] -3.8760879 0.4527952
[6,] -6.4570324 -3.8760879
[7,] -6.2062849 -6.4570324
[8,] -6.4273127 -6.2062849
[9,] 7.1286869 -6.4273127
[10,] -2.8011073 7.1286869
[11,] -3.6764250 -2.8011073
[12,] 7.0378668 -3.6764250
[13,] 8.7137334 7.0378668
[14,] 7.7534834 8.7137334
[15,] 0.1214065 7.7534834
[16,] -3.0369393 0.1214065
[17,] -4.5745932 -3.0369393
[18,] 8.6178116 -4.5745932
[19,] -9.8599708 8.6178116
[20,] 4.2942098 -9.8599708
[21,] 23.4474504 4.2942098
[22,] 0.8949234 23.4474504
[23,] -0.2501789 0.8949234
[24,] 15.9361192 -0.2501789
[25,] -3.7049876 15.9361192
[26,] 1.6168285 -3.7049876
[27,] 3.3028240 1.6168285
[28,] -16.3804996 3.3028240
[29,] -1.6717141 -16.3804996
[30,] -0.1167066 -1.6717141
[31,] -4.0971191 -0.1167066
[32,] 1.1667287 -4.0971191
[33,] -8.1210421 1.1667287
[34,] -6.3569087 -8.1210421
[35,] -2.2979245 -6.3569087
[36,] -7.2754763 -2.2979245
[37,] -8.4131968 -7.2754763
[38,] -2.1265169 -8.4131968
[39,] -3.2586796 -2.1265169
[40,] 0.0681519 -3.2586796
[41,] -4.0813007 0.0681519
[42,] -10.9316008 -4.0813007
[43,] 4.9959445 -10.9316008
[44,] 12.6203358 4.9959445
[45,] -8.1328139 12.6203358
[46,] 13.8936684 -8.1328139
[47,] 16.1668157 13.8936684
[48,] -7.1719239 16.1668157
[49,] 13.6044114 -7.1719239
[50,] 20.5837227 13.6044114
[51,] 5.4153504 20.5837227
[52,] 19.7072242 5.4153504
[53,] 10.3574632 19.7072242
[54,] 8.8875283 10.3574632
[55,] 15.1674303 8.8875283
[56,] -11.6539616 15.1674303
[57,] -14.3222813 -11.6539616
[58,] -5.6305759 -14.3222813
[59,] -9.9422873 -5.6305759
[60,] -10.6111814 -9.9422873
[61,] -11.0619118 -10.6111814
[62,] -13.8766457 -11.0619118
[63,] -5.9447206 -13.8766457
[64,] -0.8107323 -5.9447206
[65,] 3.8462327 -0.8107323
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.8619515 2.0845955
2 -13.9508721 0.8619515
3 0.3638193 -13.9508721
4 0.4527952 0.3638193
5 -3.8760879 0.4527952
6 -6.4570324 -3.8760879
7 -6.2062849 -6.4570324
8 -6.4273127 -6.2062849
9 7.1286869 -6.4273127
10 -2.8011073 7.1286869
11 -3.6764250 -2.8011073
12 7.0378668 -3.6764250
13 8.7137334 7.0378668
14 7.7534834 8.7137334
15 0.1214065 7.7534834
16 -3.0369393 0.1214065
17 -4.5745932 -3.0369393
18 8.6178116 -4.5745932
19 -9.8599708 8.6178116
20 4.2942098 -9.8599708
21 23.4474504 4.2942098
22 0.8949234 23.4474504
23 -0.2501789 0.8949234
24 15.9361192 -0.2501789
25 -3.7049876 15.9361192
26 1.6168285 -3.7049876
27 3.3028240 1.6168285
28 -16.3804996 3.3028240
29 -1.6717141 -16.3804996
30 -0.1167066 -1.6717141
31 -4.0971191 -0.1167066
32 1.1667287 -4.0971191
33 -8.1210421 1.1667287
34 -6.3569087 -8.1210421
35 -2.2979245 -6.3569087
36 -7.2754763 -2.2979245
37 -8.4131968 -7.2754763
38 -2.1265169 -8.4131968
39 -3.2586796 -2.1265169
40 0.0681519 -3.2586796
41 -4.0813007 0.0681519
42 -10.9316008 -4.0813007
43 4.9959445 -10.9316008
44 12.6203358 4.9959445
45 -8.1328139 12.6203358
46 13.8936684 -8.1328139
47 16.1668157 13.8936684
48 -7.1719239 16.1668157
49 13.6044114 -7.1719239
50 20.5837227 13.6044114
51 5.4153504 20.5837227
52 19.7072242 5.4153504
53 10.3574632 19.7072242
54 8.8875283 10.3574632
55 15.1674303 8.8875283
56 -11.6539616 15.1674303
57 -14.3222813 -11.6539616
58 -5.6305759 -14.3222813
59 -9.9422873 -5.6305759
60 -10.6111814 -9.9422873
61 -11.0619118 -10.6111814
62 -13.8766457 -11.0619118
63 -5.9447206 -13.8766457
64 -0.8107323 -5.9447206
65 3.8462327 -0.8107323
> 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/7z4m91261220755.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/82cvs1261220755.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/9t7q51261220755.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/1066v11261220755.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/11o6ix1261220755.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/12r64w1261220755.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/13tvjx1261220756.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/14urop1261220756.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/153z6a1261220756.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/16fzyd1261220756.tab")
+ }
>
> try(system("convert tmp/1wbzj1261220755.ps tmp/1wbzj1261220755.png",intern=TRUE))
character(0)
> try(system("convert tmp/2vfee1261220755.ps tmp/2vfee1261220755.png",intern=TRUE))
character(0)
> try(system("convert tmp/374iy1261220755.ps tmp/374iy1261220755.png",intern=TRUE))
character(0)
> try(system("convert tmp/4l21t1261220755.ps tmp/4l21t1261220755.png",intern=TRUE))
character(0)
> try(system("convert tmp/5391b1261220755.ps tmp/5391b1261220755.png",intern=TRUE))
character(0)
> try(system("convert tmp/67yk61261220755.ps tmp/67yk61261220755.png",intern=TRUE))
character(0)
> try(system("convert tmp/7z4m91261220755.ps tmp/7z4m91261220755.png",intern=TRUE))
character(0)
> try(system("convert tmp/82cvs1261220755.ps tmp/82cvs1261220755.png",intern=TRUE))
character(0)
> try(system("convert tmp/9t7q51261220755.ps tmp/9t7q51261220755.png",intern=TRUE))
character(0)
> try(system("convert tmp/1066v11261220755.ps tmp/1066v11261220755.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.471 1.555 3.083