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(99.9,98.8,98.6,100.5,107.2,110.4,95.7,96.4,93.7,101.9,106.7,106.2,86.7,81,95.3,94.7,99.3,101,101.8,109.4,96,102.3,91.7,90.7,95.3,96.2,96.6,96.1,107.2,106,108,103.1,98.4,102,103.1,104.7,81.1,86,96.6,92.1,103.7,106.9,106.6,112.6,97.6,101.7,87.6,92,99.4,97.4,98.5,97,105.2,105.4,104.6,102.7,97.5,98.1,108.9,104.5,86.8,87.4,88.9,89.9,110.3,109.8,114.8,111.7,94.6,98.6,92,96.9,93.8,95.1,93.8,97,107.6,112.7,101,102.9,95.4,97.4,96.5,111.4,89.2,87.4,87.1,96.8,110.5,114.1,110.8,110.3,104.2,103.9,88.9,101.6,89.8,94.6,90,95.9,93.9,104.7,91.3,102.8,87.8,98.1,99.7,113.9,73.5,80.9,79.2,95.7,96.9,113.2,95.2,105.9,95.6,108.8,89.7,102.3),dim=c(2,60),dimnames=list(c('TotProd','ProdMetal'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('TotProd','ProdMetal'),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 = '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
TotProd ProdMetal M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 99.9 98.8 1 0 0 0 0 0 0 0 0 0 0
2 98.6 100.5 0 1 0 0 0 0 0 0 0 0 0
3 107.2 110.4 0 0 1 0 0 0 0 0 0 0 0
4 95.7 96.4 0 0 0 1 0 0 0 0 0 0 0
5 93.7 101.9 0 0 0 0 1 0 0 0 0 0 0
6 106.7 106.2 0 0 0 0 0 1 0 0 0 0 0
7 86.7 81.0 0 0 0 0 0 0 1 0 0 0 0
8 95.3 94.7 0 0 0 0 0 0 0 1 0 0 0
9 99.3 101.0 0 0 0 0 0 0 0 0 1 0 0
10 101.8 109.4 0 0 0 0 0 0 0 0 0 1 0
11 96.0 102.3 0 0 0 0 0 0 0 0 0 0 1
12 91.7 90.7 0 0 0 0 0 0 0 0 0 0 0
13 95.3 96.2 1 0 0 0 0 0 0 0 0 0 0
14 96.6 96.1 0 1 0 0 0 0 0 0 0 0 0
15 107.2 106.0 0 0 1 0 0 0 0 0 0 0 0
16 108.0 103.1 0 0 0 1 0 0 0 0 0 0 0
17 98.4 102.0 0 0 0 0 1 0 0 0 0 0 0
18 103.1 104.7 0 0 0 0 0 1 0 0 0 0 0
19 81.1 86.0 0 0 0 0 0 0 1 0 0 0 0
20 96.6 92.1 0 0 0 0 0 0 0 1 0 0 0
21 103.7 106.9 0 0 0 0 0 0 0 0 1 0 0
22 106.6 112.6 0 0 0 0 0 0 0 0 0 1 0
23 97.6 101.7 0 0 0 0 0 0 0 0 0 0 1
24 87.6 92.0 0 0 0 0 0 0 0 0 0 0 0
25 99.4 97.4 1 0 0 0 0 0 0 0 0 0 0
26 98.5 97.0 0 1 0 0 0 0 0 0 0 0 0
27 105.2 105.4 0 0 1 0 0 0 0 0 0 0 0
28 104.6 102.7 0 0 0 1 0 0 0 0 0 0 0
29 97.5 98.1 0 0 0 0 1 0 0 0 0 0 0
30 108.9 104.5 0 0 0 0 0 1 0 0 0 0 0
31 86.8 87.4 0 0 0 0 0 0 1 0 0 0 0
32 88.9 89.9 0 0 0 0 0 0 0 1 0 0 0
33 110.3 109.8 0 0 0 0 0 0 0 0 1 0 0
34 114.8 111.7 0 0 0 0 0 0 0 0 0 1 0
35 94.6 98.6 0 0 0 0 0 0 0 0 0 0 1
36 92.0 96.9 0 0 0 0 0 0 0 0 0 0 0
37 93.8 95.1 1 0 0 0 0 0 0 0 0 0 0
38 93.8 97.0 0 1 0 0 0 0 0 0 0 0 0
39 107.6 112.7 0 0 1 0 0 0 0 0 0 0 0
40 101.0 102.9 0 0 0 1 0 0 0 0 0 0 0
41 95.4 97.4 0 0 0 0 1 0 0 0 0 0 0
42 96.5 111.4 0 0 0 0 0 1 0 0 0 0 0
43 89.2 87.4 0 0 0 0 0 0 1 0 0 0 0
44 87.1 96.8 0 0 0 0 0 0 0 1 0 0 0
45 110.5 114.1 0 0 0 0 0 0 0 0 1 0 0
46 110.8 110.3 0 0 0 0 0 0 0 0 0 1 0
47 104.2 103.9 0 0 0 0 0 0 0 0 0 0 1
48 88.9 101.6 0 0 0 0 0 0 0 0 0 0 0
49 89.8 94.6 1 0 0 0 0 0 0 0 0 0 0
50 90.0 95.9 0 1 0 0 0 0 0 0 0 0 0
51 93.9 104.7 0 0 1 0 0 0 0 0 0 0 0
52 91.3 102.8 0 0 0 1 0 0 0 0 0 0 0
53 87.8 98.1 0 0 0 0 1 0 0 0 0 0 0
54 99.7 113.9 0 0 0 0 0 1 0 0 0 0 0
55 73.5 80.9 0 0 0 0 0 0 1 0 0 0 0
56 79.2 95.7 0 0 0 0 0 0 0 1 0 0 0
57 96.9 113.2 0 0 0 0 0 0 0 0 1 0 0
58 95.2 105.9 0 0 0 0 0 0 0 0 0 1 0
59 95.6 108.8 0 0 0 0 0 0 0 0 0 0 1
60 89.7 102.3 0 0 0 0 0 0 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) ProdMetal M1 M2 M3 M4
57.9680 0.3310 5.7527 5.3214 10.5522 8.5245
M5 M6 M7 M8 M9 M10
3.6531 9.2128 -2.4945 0.3868 10.0881 11.4637
M11
5.5146
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-10.8357 -2.7397 0.6173 3.5014 8.3906
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 57.9680 21.6608 2.676 0.0102 *
ProdMetal 0.3310 0.2226 1.487 0.1437
M1 5.7527 3.4099 1.687 0.0982 .
M2 5.3214 3.4120 1.560 0.1256
M3 10.5522 4.2158 2.503 0.0158 *
M4 8.5245 3.5782 2.382 0.0213 *
M5 3.6531 3.4659 1.054 0.2973
M6 9.2128 4.2555 2.165 0.0355 *
M7 -2.4945 4.3533 -0.573 0.5694
M8 0.3868 3.4683 0.112 0.9117
M9 10.0881 4.3727 2.307 0.0255 *
M10 11.4637 4.5125 2.540 0.0144 *
M11 5.5146 3.6916 1.494 0.1419
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.391 on 47 degrees of freedom
Multiple R-squared: 0.6641, Adjusted R-squared: 0.5783
F-statistic: 7.744 on 12 and 47 DF, p-value: 1.140e-07
> 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.1560954691 0.312190938 0.8439045
[2,] 0.1064562573 0.212912515 0.8935437
[3,] 0.0494150740 0.098830148 0.9505849
[4,] 0.1282526461 0.256505292 0.8717474
[5,] 0.0987481574 0.197496315 0.9012518
[6,] 0.0522515161 0.104503032 0.9477485
[7,] 0.0289718211 0.057943642 0.9710282
[8,] 0.0146315789 0.029263158 0.9853684
[9,] 0.0103341943 0.020668389 0.9896658
[10,] 0.0057156508 0.011431302 0.9942843
[11,] 0.0030564201 0.006112840 0.9969436
[12,] 0.0014299513 0.002859903 0.9985700
[13,] 0.0007893882 0.001578776 0.9992106
[14,] 0.0005639925 0.001127985 0.9994360
[15,] 0.0015194260 0.003038852 0.9984806
[16,] 0.0006821247 0.001364249 0.9993179
[17,] 0.0013711076 0.002742215 0.9986289
[18,] 0.0026014281 0.005202856 0.9973986
[19,] 0.0123969842 0.024793968 0.9876030
[20,] 0.0071927815 0.014385563 0.9928072
[21,] 0.0097232393 0.019446479 0.9902768
[22,] 0.0057637429 0.011527486 0.9942363
[23,] 0.0033881214 0.006776243 0.9966119
[24,] 0.0017589554 0.003517911 0.9982410
[25,] 0.0020873969 0.004174794 0.9979126
[26,] 0.0019329671 0.003865934 0.9980670
[27,] 0.0072271221 0.014454244 0.9927729
[28,] 0.0047447630 0.009489526 0.9952552
[29,] 0.0050140871 0.010028174 0.9949859
> postscript(file="/var/www/html/rcomp/tmp/18css1258908969.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/2ldyk1258908969.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/3zyhs1258908969.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/43v7x1258908969.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/5d46d1258908969.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
3.4721134 2.0406566 2.1325253 -2.7051879 -1.6545075 4.3622269
7 8 9 10 11 12
4.4118986 5.5953015 -2.1916415 -3.8479940 -1.3484059 3.7062689
13 14 15 16 17 18
-0.2671701 1.4972538 3.5891224 7.3768119 3.0123880 1.2587941
19 20 21 22 23 24
-2.8433254 7.7560180 0.2551941 -0.1073374 0.4502209 -0.8240894
25 26 27 28 29 30
3.4355761 3.0993134 1.7877493 4.1092298 3.4034627 7.1250031
31 32 33 34 35 36
2.3932118 0.7843165 5.8951642 8.3906029 -1.5235402 1.9537910
37 38 39 40 41 42
-1.4030209 -1.6006866 1.7711222 0.4430209 1.5351941 -7.5592061
43 44 45 46 47 48
4.7932118 -3.2998926 4.6716715 4.8540657 6.3219224 -2.7021196
49 50 51 52 53 54
-5.2374984 -5.0365373 -9.2805193 -9.2238747 -6.2965373 -5.1868181
55 56 57 58 59 60
-8.7549969 -10.8357433 -8.6303882 -9.2893372 -3.9001972 -2.1338509
> postscript(file="/var/www/html/rcomp/tmp/6ajdl1258908969.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 3.4721134 NA
1 2.0406566 3.4721134
2 2.1325253 2.0406566
3 -2.7051879 2.1325253
4 -1.6545075 -2.7051879
5 4.3622269 -1.6545075
6 4.4118986 4.3622269
7 5.5953015 4.4118986
8 -2.1916415 5.5953015
9 -3.8479940 -2.1916415
10 -1.3484059 -3.8479940
11 3.7062689 -1.3484059
12 -0.2671701 3.7062689
13 1.4972538 -0.2671701
14 3.5891224 1.4972538
15 7.3768119 3.5891224
16 3.0123880 7.3768119
17 1.2587941 3.0123880
18 -2.8433254 1.2587941
19 7.7560180 -2.8433254
20 0.2551941 7.7560180
21 -0.1073374 0.2551941
22 0.4502209 -0.1073374
23 -0.8240894 0.4502209
24 3.4355761 -0.8240894
25 3.0993134 3.4355761
26 1.7877493 3.0993134
27 4.1092298 1.7877493
28 3.4034627 4.1092298
29 7.1250031 3.4034627
30 2.3932118 7.1250031
31 0.7843165 2.3932118
32 5.8951642 0.7843165
33 8.3906029 5.8951642
34 -1.5235402 8.3906029
35 1.9537910 -1.5235402
36 -1.4030209 1.9537910
37 -1.6006866 -1.4030209
38 1.7711222 -1.6006866
39 0.4430209 1.7711222
40 1.5351941 0.4430209
41 -7.5592061 1.5351941
42 4.7932118 -7.5592061
43 -3.2998926 4.7932118
44 4.6716715 -3.2998926
45 4.8540657 4.6716715
46 6.3219224 4.8540657
47 -2.7021196 6.3219224
48 -5.2374984 -2.7021196
49 -5.0365373 -5.2374984
50 -9.2805193 -5.0365373
51 -9.2238747 -9.2805193
52 -6.2965373 -9.2238747
53 -5.1868181 -6.2965373
54 -8.7549969 -5.1868181
55 -10.8357433 -8.7549969
56 -8.6303882 -10.8357433
57 -9.2893372 -8.6303882
58 -3.9001972 -9.2893372
59 -2.1338509 -3.9001972
60 NA -2.1338509
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 2.0406566 3.4721134
[2,] 2.1325253 2.0406566
[3,] -2.7051879 2.1325253
[4,] -1.6545075 -2.7051879
[5,] 4.3622269 -1.6545075
[6,] 4.4118986 4.3622269
[7,] 5.5953015 4.4118986
[8,] -2.1916415 5.5953015
[9,] -3.8479940 -2.1916415
[10,] -1.3484059 -3.8479940
[11,] 3.7062689 -1.3484059
[12,] -0.2671701 3.7062689
[13,] 1.4972538 -0.2671701
[14,] 3.5891224 1.4972538
[15,] 7.3768119 3.5891224
[16,] 3.0123880 7.3768119
[17,] 1.2587941 3.0123880
[18,] -2.8433254 1.2587941
[19,] 7.7560180 -2.8433254
[20,] 0.2551941 7.7560180
[21,] -0.1073374 0.2551941
[22,] 0.4502209 -0.1073374
[23,] -0.8240894 0.4502209
[24,] 3.4355761 -0.8240894
[25,] 3.0993134 3.4355761
[26,] 1.7877493 3.0993134
[27,] 4.1092298 1.7877493
[28,] 3.4034627 4.1092298
[29,] 7.1250031 3.4034627
[30,] 2.3932118 7.1250031
[31,] 0.7843165 2.3932118
[32,] 5.8951642 0.7843165
[33,] 8.3906029 5.8951642
[34,] -1.5235402 8.3906029
[35,] 1.9537910 -1.5235402
[36,] -1.4030209 1.9537910
[37,] -1.6006866 -1.4030209
[38,] 1.7711222 -1.6006866
[39,] 0.4430209 1.7711222
[40,] 1.5351941 0.4430209
[41,] -7.5592061 1.5351941
[42,] 4.7932118 -7.5592061
[43,] -3.2998926 4.7932118
[44,] 4.6716715 -3.2998926
[45,] 4.8540657 4.6716715
[46,] 6.3219224 4.8540657
[47,] -2.7021196 6.3219224
[48,] -5.2374984 -2.7021196
[49,] -5.0365373 -5.2374984
[50,] -9.2805193 -5.0365373
[51,] -9.2238747 -9.2805193
[52,] -6.2965373 -9.2238747
[53,] -5.1868181 -6.2965373
[54,] -8.7549969 -5.1868181
[55,] -10.8357433 -8.7549969
[56,] -8.6303882 -10.8357433
[57,] -9.2893372 -8.6303882
[58,] -3.9001972 -9.2893372
[59,] -2.1338509 -3.9001972
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 2.0406566 3.4721134
2 2.1325253 2.0406566
3 -2.7051879 2.1325253
4 -1.6545075 -2.7051879
5 4.3622269 -1.6545075
6 4.4118986 4.3622269
7 5.5953015 4.4118986
8 -2.1916415 5.5953015
9 -3.8479940 -2.1916415
10 -1.3484059 -3.8479940
11 3.7062689 -1.3484059
12 -0.2671701 3.7062689
13 1.4972538 -0.2671701
14 3.5891224 1.4972538
15 7.3768119 3.5891224
16 3.0123880 7.3768119
17 1.2587941 3.0123880
18 -2.8433254 1.2587941
19 7.7560180 -2.8433254
20 0.2551941 7.7560180
21 -0.1073374 0.2551941
22 0.4502209 -0.1073374
23 -0.8240894 0.4502209
24 3.4355761 -0.8240894
25 3.0993134 3.4355761
26 1.7877493 3.0993134
27 4.1092298 1.7877493
28 3.4034627 4.1092298
29 7.1250031 3.4034627
30 2.3932118 7.1250031
31 0.7843165 2.3932118
32 5.8951642 0.7843165
33 8.3906029 5.8951642
34 -1.5235402 8.3906029
35 1.9537910 -1.5235402
36 -1.4030209 1.9537910
37 -1.6006866 -1.4030209
38 1.7711222 -1.6006866
39 0.4430209 1.7711222
40 1.5351941 0.4430209
41 -7.5592061 1.5351941
42 4.7932118 -7.5592061
43 -3.2998926 4.7932118
44 4.6716715 -3.2998926
45 4.8540657 4.6716715
46 6.3219224 4.8540657
47 -2.7021196 6.3219224
48 -5.2374984 -2.7021196
49 -5.0365373 -5.2374984
50 -9.2805193 -5.0365373
51 -9.2238747 -9.2805193
52 -6.2965373 -9.2238747
53 -5.1868181 -6.2965373
54 -8.7549969 -5.1868181
55 -10.8357433 -8.7549969
56 -8.6303882 -10.8357433
57 -9.2893372 -8.6303882
58 -3.9001972 -9.2893372
59 -2.1338509 -3.9001972
> 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/7izkt1258908969.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/8xmiq1258908969.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/9kaei1258908969.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/10ojpl1258908969.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/11c3861258908969.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/12c97z1258908969.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/13b4i41258908969.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/14gfvr1258908969.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/151t6q1258908969.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/16hv5i1258908969.tab")
+ }
>
> system("convert tmp/18css1258908969.ps tmp/18css1258908969.png")
> system("convert tmp/2ldyk1258908969.ps tmp/2ldyk1258908969.png")
> system("convert tmp/3zyhs1258908969.ps tmp/3zyhs1258908969.png")
> system("convert tmp/43v7x1258908969.ps tmp/43v7x1258908969.png")
> system("convert tmp/5d46d1258908969.ps tmp/5d46d1258908969.png")
> system("convert tmp/6ajdl1258908969.ps tmp/6ajdl1258908969.png")
> system("convert tmp/7izkt1258908969.ps tmp/7izkt1258908969.png")
> system("convert tmp/8xmiq1258908969.ps tmp/8xmiq1258908969.png")
> system("convert tmp/9kaei1258908969.ps tmp/9kaei1258908969.png")
> system("convert tmp/10ojpl1258908969.ps tmp/10ojpl1258908969.png")
>
>
> proc.time()
user system elapsed
2.422 1.595 4.101