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(83.4,108.8,113.6,128.4,112.9,121.1,104,119.5,109.9,128.7,99,108.7,106.3,105.5,128.9,119.8,111.1,111.3,102.9,110.6,130,120.1,87,97.5,87.5,107.7,117.6,127.3,103.4,117.2,110.8,119.8,112.6,116.2,102.5,111,112.4,112.4,135.6,130.6,105.1,109.1,127.7,118.8,137,123.9,91,101.6,90.5,112.8,122.4,128,123.3,129.6,124.3,125.8,120,119.5,118.1,115.7,119,113.6,142.7,129.7,123.6,112,129.6,116.8,151.6,127,110.4,112.1,99.2,114.2,130.5,121.1,136.2,131.6,129.7,125,128,120.4,121.6,117.7,135.8,117.5,143.8,120.6,147.5,127.5,136.2,112.3,156.6,124.5,123.3,115.2,104.5,104.7,139.8,130.9,136.5,129.2,112.1,113.5,118.5,125.6,94.4,107.6,102.3,107,111.4,121.6,99.2,110.7,87.8,106.3,115.8,118.6,79.7,104.6),dim=c(2,60),dimnames=list(c('inv','cons'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('inv','cons'),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 = '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
inv cons M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 83.4 108.8 1 0 0 0 0 0 0 0 0 0 0 1
2 113.6 128.4 0 1 0 0 0 0 0 0 0 0 0 2
3 112.9 121.1 0 0 1 0 0 0 0 0 0 0 0 3
4 104.0 119.5 0 0 0 1 0 0 0 0 0 0 0 4
5 109.9 128.7 0 0 0 0 1 0 0 0 0 0 0 5
6 99.0 108.7 0 0 0 0 0 1 0 0 0 0 0 6
7 106.3 105.5 0 0 0 0 0 0 1 0 0 0 0 7
8 128.9 119.8 0 0 0 0 0 0 0 1 0 0 0 8
9 111.1 111.3 0 0 0 0 0 0 0 0 1 0 0 9
10 102.9 110.6 0 0 0 0 0 0 0 0 0 1 0 10
11 130.0 120.1 0 0 0 0 0 0 0 0 0 0 1 11
12 87.0 97.5 0 0 0 0 0 0 0 0 0 0 0 12
13 87.5 107.7 1 0 0 0 0 0 0 0 0 0 0 13
14 117.6 127.3 0 1 0 0 0 0 0 0 0 0 0 14
15 103.4 117.2 0 0 1 0 0 0 0 0 0 0 0 15
16 110.8 119.8 0 0 0 1 0 0 0 0 0 0 0 16
17 112.6 116.2 0 0 0 0 1 0 0 0 0 0 0 17
18 102.5 111.0 0 0 0 0 0 1 0 0 0 0 0 18
19 112.4 112.4 0 0 0 0 0 0 1 0 0 0 0 19
20 135.6 130.6 0 0 0 0 0 0 0 1 0 0 0 20
21 105.1 109.1 0 0 0 0 0 0 0 0 1 0 0 21
22 127.7 118.8 0 0 0 0 0 0 0 0 0 1 0 22
23 137.0 123.9 0 0 0 0 0 0 0 0 0 0 1 23
24 91.0 101.6 0 0 0 0 0 0 0 0 0 0 0 24
25 90.5 112.8 1 0 0 0 0 0 0 0 0 0 0 25
26 122.4 128.0 0 1 0 0 0 0 0 0 0 0 0 26
27 123.3 129.6 0 0 1 0 0 0 0 0 0 0 0 27
28 124.3 125.8 0 0 0 1 0 0 0 0 0 0 0 28
29 120.0 119.5 0 0 0 0 1 0 0 0 0 0 0 29
30 118.1 115.7 0 0 0 0 0 1 0 0 0 0 0 30
31 119.0 113.6 0 0 0 0 0 0 1 0 0 0 0 31
32 142.7 129.7 0 0 0 0 0 0 0 1 0 0 0 32
33 123.6 112.0 0 0 0 0 0 0 0 0 1 0 0 33
34 129.6 116.8 0 0 0 0 0 0 0 0 0 1 0 34
35 151.6 127.0 0 0 0 0 0 0 0 0 0 0 1 35
36 110.4 112.1 0 0 0 0 0 0 0 0 0 0 0 36
37 99.2 114.2 1 0 0 0 0 0 0 0 0 0 0 37
38 130.5 121.1 0 1 0 0 0 0 0 0 0 0 0 38
39 136.2 131.6 0 0 1 0 0 0 0 0 0 0 0 39
40 129.7 125.0 0 0 0 1 0 0 0 0 0 0 0 40
41 128.0 120.4 0 0 0 0 1 0 0 0 0 0 0 41
42 121.6 117.7 0 0 0 0 0 1 0 0 0 0 0 42
43 135.8 117.5 0 0 0 0 0 0 1 0 0 0 0 43
44 143.8 120.6 0 0 0 0 0 0 0 1 0 0 0 44
45 147.5 127.5 0 0 0 0 0 0 0 0 1 0 0 45
46 136.2 112.3 0 0 0 0 0 0 0 0 0 1 0 46
47 156.6 124.5 0 0 0 0 0 0 0 0 0 0 1 47
48 123.3 115.2 0 0 0 0 0 0 0 0 0 0 0 48
49 104.5 104.7 1 0 0 0 0 0 0 0 0 0 0 49
50 139.8 130.9 0 1 0 0 0 0 0 0 0 0 0 50
51 136.5 129.2 0 0 1 0 0 0 0 0 0 0 0 51
52 112.1 113.5 0 0 0 1 0 0 0 0 0 0 0 52
53 118.5 125.6 0 0 0 0 1 0 0 0 0 0 0 53
54 94.4 107.6 0 0 0 0 0 1 0 0 0 0 0 54
55 102.3 107.0 0 0 0 0 0 0 1 0 0 0 0 55
56 111.4 121.6 0 0 0 0 0 0 0 1 0 0 0 56
57 99.2 110.7 0 0 0 0 0 0 0 0 1 0 0 57
58 87.8 106.3 0 0 0 0 0 0 0 0 0 1 0 58
59 115.8 118.6 0 0 0 0 0 0 0 0 0 0 1 59
60 79.7 104.6 0 0 0 0 0 0 0 0 0 0 0 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) cons M1 M2 M3 M4
-98.6032 1.8125 -10.1516 -10.2323 -10.1369 -7.4404
M5 M6 M7 M8 M9 M10
-8.4075 -1.1934 8.4282 1.5924 5.0314 6.5518
M11 t
9.9185 0.1221
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-19.8999 -6.0424 0.8843 5.8060 19.0907
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -98.60318 29.98995 -3.288 0.00194 **
cons 1.81249 0.28134 6.442 6.27e-08 ***
M1 -10.15157 6.60470 -1.537 0.13114
M2 -10.23230 8.84614 -1.157 0.25337
M3 -10.13694 8.57076 -1.183 0.24299
M4 -7.44036 7.71202 -0.965 0.33970
M5 -8.40748 7.91370 -1.062 0.29360
M6 -1.19344 6.70397 -0.178 0.85949
M7 8.42818 6.63327 1.271 0.21026
M8 1.59241 8.28460 0.192 0.84842
M9 5.03145 6.84696 0.735 0.46616
M10 6.55181 6.74115 0.972 0.33618
M11 9.91852 7.98052 1.243 0.22022
t 0.12213 0.07837 1.558 0.12601
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 10.21 on 46 degrees of freedom
Multiple R-squared: 0.7444, Adjusted R-squared: 0.6721
F-statistic: 10.3 on 13 and 46 DF, p-value: 1.115e-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,] 1.105990e-01 2.211980e-01 0.8894010
[2,] 3.940886e-02 7.881771e-02 0.9605911
[3,] 1.306722e-02 2.613443e-02 0.9869328
[4,] 4.124957e-03 8.249915e-03 0.9958750
[5,] 3.121904e-03 6.243808e-03 0.9968781
[6,] 1.719376e-02 3.438752e-02 0.9828062
[7,] 7.551963e-03 1.510393e-02 0.9924480
[8,] 3.093725e-03 6.187450e-03 0.9969063
[9,] 1.976741e-03 3.953482e-03 0.9980233
[10,] 1.290960e-03 2.581921e-03 0.9987090
[11,] 8.100877e-04 1.620175e-03 0.9991899
[12,] 7.965985e-04 1.593197e-03 0.9992034
[13,] 4.115497e-04 8.230994e-04 0.9995885
[14,] 2.468413e-04 4.936826e-04 0.9997532
[15,] 1.322822e-04 2.645644e-04 0.9998677
[16,] 6.616130e-05 1.323226e-04 0.9999338
[17,] 4.023604e-05 8.047208e-05 0.9999598
[18,] 2.340810e-05 4.681619e-05 0.9999766
[19,] 1.683942e-05 3.367883e-05 0.9999832
[20,] 1.207546e-05 2.415092e-05 0.9999879
[21,] 2.576667e-04 5.153333e-04 0.9997423
[22,] 2.726087e-04 5.452173e-04 0.9997274
[23,] 3.378923e-03 6.757847e-03 0.9966211
[24,] 2.921906e-02 5.843811e-02 0.9707809
[25,] 9.407071e-02 1.881414e-01 0.9059293
[26,] 3.032378e-01 6.064756e-01 0.6967622
[27,] 5.899933e-01 8.200133e-01 0.4100067
> postscript(file="/var/www/html/rcomp/tmp/18pca1258787892.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/2ay6x1258787892.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/34tx51258787892.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/4p8wy1258787892.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/5fpf41258787892.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 = 60
Frequency = 1
1 2 3 4 5 6
-5.1664580 -10.5326903 1.7810098 -7.0377112 -16.9676449 1.0460200
7 8 9 10 11 12
4.4022509 7.7972597 1.8422752 -6.7314709 -0.3389739 7.4197255
13 14 15 16 17 18
-0.5382419 -6.0044741 -2.1157977 -2.2469832 6.9229748 -1.0882351
19 20 21 22 23 24
-3.4694653 -6.5431735 -1.6357679 1.7405739 -1.6919663 2.5229856
25 26 27 28 29 30
-8.2474733 -3.9387427 -6.1562174 -1.0874570 6.8762282 4.5275301
31 32 33 34 35 36
-0.5099797 0.7225443 10.1424821 5.8000325 5.8237854 1.4262999
37 38 39 40 41 42
-3.5504860 15.2019244 1.6532750 4.2970117 11.7794613 2.9370225
43 44 45 46 47 48
7.7557787 16.8506928 4.4833386 19.0907199 13.8894897 7.2420516
49 50 51 52 53 54
17.5026591 5.2739827 4.8377302 6.0751399 -8.6110193 -7.4223375
55 56 57 58 59 60
-8.1785846 -18.8273233 -14.8323280 -19.8998554 -17.6823348 -18.6110626
> postscript(file="/var/www/html/rcomp/tmp/6khy01258787892.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 = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 -5.1664580 NA
1 -10.5326903 -5.1664580
2 1.7810098 -10.5326903
3 -7.0377112 1.7810098
4 -16.9676449 -7.0377112
5 1.0460200 -16.9676449
6 4.4022509 1.0460200
7 7.7972597 4.4022509
8 1.8422752 7.7972597
9 -6.7314709 1.8422752
10 -0.3389739 -6.7314709
11 7.4197255 -0.3389739
12 -0.5382419 7.4197255
13 -6.0044741 -0.5382419
14 -2.1157977 -6.0044741
15 -2.2469832 -2.1157977
16 6.9229748 -2.2469832
17 -1.0882351 6.9229748
18 -3.4694653 -1.0882351
19 -6.5431735 -3.4694653
20 -1.6357679 -6.5431735
21 1.7405739 -1.6357679
22 -1.6919663 1.7405739
23 2.5229856 -1.6919663
24 -8.2474733 2.5229856
25 -3.9387427 -8.2474733
26 -6.1562174 -3.9387427
27 -1.0874570 -6.1562174
28 6.8762282 -1.0874570
29 4.5275301 6.8762282
30 -0.5099797 4.5275301
31 0.7225443 -0.5099797
32 10.1424821 0.7225443
33 5.8000325 10.1424821
34 5.8237854 5.8000325
35 1.4262999 5.8237854
36 -3.5504860 1.4262999
37 15.2019244 -3.5504860
38 1.6532750 15.2019244
39 4.2970117 1.6532750
40 11.7794613 4.2970117
41 2.9370225 11.7794613
42 7.7557787 2.9370225
43 16.8506928 7.7557787
44 4.4833386 16.8506928
45 19.0907199 4.4833386
46 13.8894897 19.0907199
47 7.2420516 13.8894897
48 17.5026591 7.2420516
49 5.2739827 17.5026591
50 4.8377302 5.2739827
51 6.0751399 4.8377302
52 -8.6110193 6.0751399
53 -7.4223375 -8.6110193
54 -8.1785846 -7.4223375
55 -18.8273233 -8.1785846
56 -14.8323280 -18.8273233
57 -19.8998554 -14.8323280
58 -17.6823348 -19.8998554
59 -18.6110626 -17.6823348
60 NA -18.6110626
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -10.5326903 -5.1664580
[2,] 1.7810098 -10.5326903
[3,] -7.0377112 1.7810098
[4,] -16.9676449 -7.0377112
[5,] 1.0460200 -16.9676449
[6,] 4.4022509 1.0460200
[7,] 7.7972597 4.4022509
[8,] 1.8422752 7.7972597
[9,] -6.7314709 1.8422752
[10,] -0.3389739 -6.7314709
[11,] 7.4197255 -0.3389739
[12,] -0.5382419 7.4197255
[13,] -6.0044741 -0.5382419
[14,] -2.1157977 -6.0044741
[15,] -2.2469832 -2.1157977
[16,] 6.9229748 -2.2469832
[17,] -1.0882351 6.9229748
[18,] -3.4694653 -1.0882351
[19,] -6.5431735 -3.4694653
[20,] -1.6357679 -6.5431735
[21,] 1.7405739 -1.6357679
[22,] -1.6919663 1.7405739
[23,] 2.5229856 -1.6919663
[24,] -8.2474733 2.5229856
[25,] -3.9387427 -8.2474733
[26,] -6.1562174 -3.9387427
[27,] -1.0874570 -6.1562174
[28,] 6.8762282 -1.0874570
[29,] 4.5275301 6.8762282
[30,] -0.5099797 4.5275301
[31,] 0.7225443 -0.5099797
[32,] 10.1424821 0.7225443
[33,] 5.8000325 10.1424821
[34,] 5.8237854 5.8000325
[35,] 1.4262999 5.8237854
[36,] -3.5504860 1.4262999
[37,] 15.2019244 -3.5504860
[38,] 1.6532750 15.2019244
[39,] 4.2970117 1.6532750
[40,] 11.7794613 4.2970117
[41,] 2.9370225 11.7794613
[42,] 7.7557787 2.9370225
[43,] 16.8506928 7.7557787
[44,] 4.4833386 16.8506928
[45,] 19.0907199 4.4833386
[46,] 13.8894897 19.0907199
[47,] 7.2420516 13.8894897
[48,] 17.5026591 7.2420516
[49,] 5.2739827 17.5026591
[50,] 4.8377302 5.2739827
[51,] 6.0751399 4.8377302
[52,] -8.6110193 6.0751399
[53,] -7.4223375 -8.6110193
[54,] -8.1785846 -7.4223375
[55,] -18.8273233 -8.1785846
[56,] -14.8323280 -18.8273233
[57,] -19.8998554 -14.8323280
[58,] -17.6823348 -19.8998554
[59,] -18.6110626 -17.6823348
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -10.5326903 -5.1664580
2 1.7810098 -10.5326903
3 -7.0377112 1.7810098
4 -16.9676449 -7.0377112
5 1.0460200 -16.9676449
6 4.4022509 1.0460200
7 7.7972597 4.4022509
8 1.8422752 7.7972597
9 -6.7314709 1.8422752
10 -0.3389739 -6.7314709
11 7.4197255 -0.3389739
12 -0.5382419 7.4197255
13 -6.0044741 -0.5382419
14 -2.1157977 -6.0044741
15 -2.2469832 -2.1157977
16 6.9229748 -2.2469832
17 -1.0882351 6.9229748
18 -3.4694653 -1.0882351
19 -6.5431735 -3.4694653
20 -1.6357679 -6.5431735
21 1.7405739 -1.6357679
22 -1.6919663 1.7405739
23 2.5229856 -1.6919663
24 -8.2474733 2.5229856
25 -3.9387427 -8.2474733
26 -6.1562174 -3.9387427
27 -1.0874570 -6.1562174
28 6.8762282 -1.0874570
29 4.5275301 6.8762282
30 -0.5099797 4.5275301
31 0.7225443 -0.5099797
32 10.1424821 0.7225443
33 5.8000325 10.1424821
34 5.8237854 5.8000325
35 1.4262999 5.8237854
36 -3.5504860 1.4262999
37 15.2019244 -3.5504860
38 1.6532750 15.2019244
39 4.2970117 1.6532750
40 11.7794613 4.2970117
41 2.9370225 11.7794613
42 7.7557787 2.9370225
43 16.8506928 7.7557787
44 4.4833386 16.8506928
45 19.0907199 4.4833386
46 13.8894897 19.0907199
47 7.2420516 13.8894897
48 17.5026591 7.2420516
49 5.2739827 17.5026591
50 4.8377302 5.2739827
51 6.0751399 4.8377302
52 -8.6110193 6.0751399
53 -7.4223375 -8.6110193
54 -8.1785846 -7.4223375
55 -18.8273233 -8.1785846
56 -14.8323280 -18.8273233
57 -19.8998554 -14.8323280
58 -17.6823348 -19.8998554
59 -18.6110626 -17.6823348
> 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/78gg61258787892.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/8w9hr1258787892.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/98ihu1258787892.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/10sbmy1258787892.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/11407s1258787892.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/12ebey1258787892.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/13wld51258787893.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/14774e1258787893.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/15xb5y1258787893.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/163w081258787893.tab")
+ }
>
> system("convert tmp/18pca1258787892.ps tmp/18pca1258787892.png")
> system("convert tmp/2ay6x1258787892.ps tmp/2ay6x1258787892.png")
> system("convert tmp/34tx51258787892.ps tmp/34tx51258787892.png")
> system("convert tmp/4p8wy1258787892.ps tmp/4p8wy1258787892.png")
> system("convert tmp/5fpf41258787892.ps tmp/5fpf41258787892.png")
> system("convert tmp/6khy01258787892.ps tmp/6khy01258787892.png")
> system("convert tmp/78gg61258787892.ps tmp/78gg61258787892.png")
> system("convert tmp/8w9hr1258787892.ps tmp/8w9hr1258787892.png")
> system("convert tmp/98ihu1258787892.ps tmp/98ihu1258787892.png")
> system("convert tmp/10sbmy1258787892.ps tmp/10sbmy1258787892.png")
>
>
> proc.time()
user system elapsed
2.395 1.553 3.669