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.
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(377.2,0,332.2,0,364.8,0,352.4,0,341.6,0,298.2,0,355.3,0,330.9,0,314.5,0,418.9,0,433.2,0,367,0,422.9,0,352.1,0,419.8,0,432.7,0,414.2,0,387.7,0,297.2,0,357.4,0,384.2,0,425.2,0,385.3,0,355.4,0,409.8,1,421.2,1,421.8,1,464.2,1,494,1,404.2,1,411.4,1,403.4,1,403.3,1,520.9,1,439.8,1,434.8,1,476.5,1,454.3,1,522,1,498.4,1,439.9,1,450.7,1,447.1,1,451.3,1,466.8,1,498,1,533.6,1,451.9,1,477.1,1,410.4,1,469.5,1,485.4,1,406.7,1,439.7,1,412.2,1,440.2,1,411.1,1,477.7,1,463.2,1,320.5,1),dim=c(2,60),dimnames=list(c('invoer','1euro>125yen'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('invoer','1euro>125yen'),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
invoer 1euro>125yen M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 377.2 0 1 0 0 0 0 0 0 0 0 0 0 1
2 332.2 0 0 1 0 0 0 0 0 0 0 0 0 2
3 364.8 0 0 0 1 0 0 0 0 0 0 0 0 3
4 352.4 0 0 0 0 1 0 0 0 0 0 0 0 4
5 341.6 0 0 0 0 0 1 0 0 0 0 0 0 5
6 298.2 0 0 0 0 0 0 1 0 0 0 0 0 6
7 355.3 0 0 0 0 0 0 0 1 0 0 0 0 7
8 330.9 0 0 0 0 0 0 0 0 1 0 0 0 8
9 314.5 0 0 0 0 0 0 0 0 0 1 0 0 9
10 418.9 0 0 0 0 0 0 0 0 0 0 1 0 10
11 433.2 0 0 0 0 0 0 0 0 0 0 0 1 11
12 367.0 0 0 0 0 0 0 0 0 0 0 0 0 12
13 422.9 0 1 0 0 0 0 0 0 0 0 0 0 13
14 352.1 0 0 1 0 0 0 0 0 0 0 0 0 14
15 419.8 0 0 0 1 0 0 0 0 0 0 0 0 15
16 432.7 0 0 0 0 1 0 0 0 0 0 0 0 16
17 414.2 0 0 0 0 0 1 0 0 0 0 0 0 17
18 387.7 0 0 0 0 0 0 1 0 0 0 0 0 18
19 297.2 0 0 0 0 0 0 0 1 0 0 0 0 19
20 357.4 0 0 0 0 0 0 0 0 1 0 0 0 20
21 384.2 0 0 0 0 0 0 0 0 0 1 0 0 21
22 425.2 0 0 0 0 0 0 0 0 0 0 1 0 22
23 385.3 0 0 0 0 0 0 0 0 0 0 0 1 23
24 355.4 0 0 0 0 0 0 0 0 0 0 0 0 24
25 409.8 1 1 0 0 0 0 0 0 0 0 0 0 25
26 421.2 1 0 1 0 0 0 0 0 0 0 0 0 26
27 421.8 1 0 0 1 0 0 0 0 0 0 0 0 27
28 464.2 1 0 0 0 1 0 0 0 0 0 0 0 28
29 494.0 1 0 0 0 0 1 0 0 0 0 0 0 29
30 404.2 1 0 0 0 0 0 1 0 0 0 0 0 30
31 411.4 1 0 0 0 0 0 0 1 0 0 0 0 31
32 403.4 1 0 0 0 0 0 0 0 1 0 0 0 32
33 403.3 1 0 0 0 0 0 0 0 0 1 0 0 33
34 520.9 1 0 0 0 0 0 0 0 0 0 1 0 34
35 439.8 1 0 0 0 0 0 0 0 0 0 0 1 35
36 434.8 1 0 0 0 0 0 0 0 0 0 0 0 36
37 476.5 1 1 0 0 0 0 0 0 0 0 0 0 37
38 454.3 1 0 1 0 0 0 0 0 0 0 0 0 38
39 522.0 1 0 0 1 0 0 0 0 0 0 0 0 39
40 498.4 1 0 0 0 1 0 0 0 0 0 0 0 40
41 439.9 1 0 0 0 0 1 0 0 0 0 0 0 41
42 450.7 1 0 0 0 0 0 1 0 0 0 0 0 42
43 447.1 1 0 0 0 0 0 0 1 0 0 0 0 43
44 451.3 1 0 0 0 0 0 0 0 1 0 0 0 44
45 466.8 1 0 0 0 0 0 0 0 0 1 0 0 45
46 498.0 1 0 0 0 0 0 0 0 0 0 1 0 46
47 533.6 1 0 0 0 0 0 0 0 0 0 0 1 47
48 451.9 1 0 0 0 0 0 0 0 0 0 0 0 48
49 477.1 1 1 0 0 0 0 0 0 0 0 0 0 49
50 410.4 1 0 1 0 0 0 0 0 0 0 0 0 50
51 469.5 1 0 0 1 0 0 0 0 0 0 0 0 51
52 485.4 1 0 0 0 1 0 0 0 0 0 0 0 52
53 406.7 1 0 0 0 0 1 0 0 0 0 0 0 53
54 439.7 1 0 0 0 0 0 1 0 0 0 0 0 54
55 412.2 1 0 0 0 0 0 0 1 0 0 0 0 55
56 440.2 1 0 0 0 0 0 0 0 1 0 0 0 56
57 411.1 1 0 0 0 0 0 0 0 0 1 0 0 57
58 477.7 1 0 0 0 0 0 0 0 0 0 1 0 58
59 463.2 1 0 0 0 0 0 0 0 0 0 0 1 59
60 320.5 1 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) `1euro>125yen` M1 M2 M3
332.1017 63.2222 51.6337 12.5325 57.6313
M4 M5 M6 M7 M8
64.2300 36.4487 12.8275 0.9262 12.4850
M9 M10 M11 t
11.3837 83.1025 65.5412 0.4412
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-101.299 -19.829 1.380 24.925 51.996
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 332.1017 19.1100 17.378 < 2e-16 ***
`1euro>125yen` 63.2222 18.3886 3.438 0.001254 **
M1 51.6337 22.8258 2.262 0.028462 *
M2 12.5325 22.6959 0.552 0.583489
M3 57.6313 22.5776 2.553 0.014077 *
M4 64.2300 22.4713 2.858 0.006378 **
M5 36.4487 22.3770 1.629 0.110176
M6 12.8275 22.2950 0.575 0.567857
M7 0.9262 22.2254 0.042 0.966938
M8 12.4850 22.1683 0.563 0.576039
M9 11.3837 22.1237 0.515 0.609332
M10 83.1025 22.0919 3.762 0.000476 ***
M11 65.5412 22.0727 2.969 0.004728 **
t 0.4412 0.5308 0.831 0.410132
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 34.89 on 46 degrees of freedom
Multiple R-squared: 0.7009, Adjusted R-squared: 0.6164
F-statistic: 8.293 on 13 and 46 DF, p-value: 3.018e-08
> 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.1594467 0.3188935 0.8405533
[2,] 0.1221602 0.2443203 0.8778398
[3,] 0.6343850 0.7312300 0.3656150
[4,] 0.5086730 0.9826539 0.4913270
[5,] 0.4127274 0.8254549 0.5872726
[6,] 0.3402851 0.6805702 0.6597149
[7,] 0.4598293 0.9196587 0.5401707
[8,] 0.3961663 0.7923327 0.6038337
[9,] 0.3576797 0.7153593 0.6423203
[10,] 0.3390220 0.6780439 0.6609780
[11,] 0.3564075 0.7128150 0.6435925
[12,] 0.3161399 0.6322799 0.6838601
[13,] 0.3912470 0.7824940 0.6087530
[14,] 0.3597052 0.7194104 0.6402948
[15,] 0.3094699 0.6189398 0.6905301
[16,] 0.3262086 0.6524171 0.6737914
[17,] 0.3720462 0.7440924 0.6279538
[18,] 0.3064526 0.6129053 0.6935474
[19,] 0.7374848 0.5250304 0.2625152
[20,] 0.6470816 0.7058368 0.3529184
[21,] 0.6259683 0.7480634 0.3740317
[22,] 0.5138283 0.9723434 0.4861717
[23,] 0.4411438 0.8822876 0.5588562
[24,] 0.3670521 0.7341041 0.6329479
[25,] 0.3040822 0.6081643 0.6959178
[26,] 0.2564273 0.5128546 0.7435727
[27,] 0.1615470 0.3230941 0.8384530
> postscript(file="/var/www/html/rcomp/tmp/1rnlu1227457504.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/2yi5i1227457504.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/3iqzi1227457504.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/4pcds1227457504.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/5qssp1227457504.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
-6.9766667 -13.3166667 -26.2566667 -45.6966667 -29.1566667 -49.3766667
7 8 9 10 11 12
19.1833333 -17.2166667 -32.9566667 -0.7166667 30.7033333 29.6033333
13 14 15 16 17 18
33.4283333 1.2883333 23.4483333 29.3083333 38.1483333 34.8283333
19 20 21 22 23 24
-44.2116667 3.9883333 31.4483333 0.2883333 -22.4916667 12.7083333
25 26 27 28 29 30
-48.1888889 1.8711111 -43.0688889 -7.7088889 49.4311111 -17.1888889
31 32 33 34 35 36
1.4711111 -18.5288889 -17.9688889 27.4711111 -36.5088889 23.5911111
37 38 39 40 41 42
13.2161111 29.6761111 51.8361111 21.1961111 -9.9638889 24.0161111
43 44 45 46 47 48
31.8761111 24.0761111 40.2361111 -0.7238889 51.9961111 35.3961111
49 50 51 52 53 54
8.5211111 -19.5188889 -5.9588889 2.9011111 -48.4588889 7.7211111
55 56 57 58 59 60
-8.3188889 7.6811111 -20.7588889 -26.3188889 -23.6988889 -101.2988889
> postscript(file="/var/www/html/rcomp/tmp/6trog1227457504.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 -6.9766667 NA
1 -13.3166667 -6.9766667
2 -26.2566667 -13.3166667
3 -45.6966667 -26.2566667
4 -29.1566667 -45.6966667
5 -49.3766667 -29.1566667
6 19.1833333 -49.3766667
7 -17.2166667 19.1833333
8 -32.9566667 -17.2166667
9 -0.7166667 -32.9566667
10 30.7033333 -0.7166667
11 29.6033333 30.7033333
12 33.4283333 29.6033333
13 1.2883333 33.4283333
14 23.4483333 1.2883333
15 29.3083333 23.4483333
16 38.1483333 29.3083333
17 34.8283333 38.1483333
18 -44.2116667 34.8283333
19 3.9883333 -44.2116667
20 31.4483333 3.9883333
21 0.2883333 31.4483333
22 -22.4916667 0.2883333
23 12.7083333 -22.4916667
24 -48.1888889 12.7083333
25 1.8711111 -48.1888889
26 -43.0688889 1.8711111
27 -7.7088889 -43.0688889
28 49.4311111 -7.7088889
29 -17.1888889 49.4311111
30 1.4711111 -17.1888889
31 -18.5288889 1.4711111
32 -17.9688889 -18.5288889
33 27.4711111 -17.9688889
34 -36.5088889 27.4711111
35 23.5911111 -36.5088889
36 13.2161111 23.5911111
37 29.6761111 13.2161111
38 51.8361111 29.6761111
39 21.1961111 51.8361111
40 -9.9638889 21.1961111
41 24.0161111 -9.9638889
42 31.8761111 24.0161111
43 24.0761111 31.8761111
44 40.2361111 24.0761111
45 -0.7238889 40.2361111
46 51.9961111 -0.7238889
47 35.3961111 51.9961111
48 8.5211111 35.3961111
49 -19.5188889 8.5211111
50 -5.9588889 -19.5188889
51 2.9011111 -5.9588889
52 -48.4588889 2.9011111
53 7.7211111 -48.4588889
54 -8.3188889 7.7211111
55 7.6811111 -8.3188889
56 -20.7588889 7.6811111
57 -26.3188889 -20.7588889
58 -23.6988889 -26.3188889
59 -101.2988889 -23.6988889
60 NA -101.2988889
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -13.3166667 -6.9766667
[2,] -26.2566667 -13.3166667
[3,] -45.6966667 -26.2566667
[4,] -29.1566667 -45.6966667
[5,] -49.3766667 -29.1566667
[6,] 19.1833333 -49.3766667
[7,] -17.2166667 19.1833333
[8,] -32.9566667 -17.2166667
[9,] -0.7166667 -32.9566667
[10,] 30.7033333 -0.7166667
[11,] 29.6033333 30.7033333
[12,] 33.4283333 29.6033333
[13,] 1.2883333 33.4283333
[14,] 23.4483333 1.2883333
[15,] 29.3083333 23.4483333
[16,] 38.1483333 29.3083333
[17,] 34.8283333 38.1483333
[18,] -44.2116667 34.8283333
[19,] 3.9883333 -44.2116667
[20,] 31.4483333 3.9883333
[21,] 0.2883333 31.4483333
[22,] -22.4916667 0.2883333
[23,] 12.7083333 -22.4916667
[24,] -48.1888889 12.7083333
[25,] 1.8711111 -48.1888889
[26,] -43.0688889 1.8711111
[27,] -7.7088889 -43.0688889
[28,] 49.4311111 -7.7088889
[29,] -17.1888889 49.4311111
[30,] 1.4711111 -17.1888889
[31,] -18.5288889 1.4711111
[32,] -17.9688889 -18.5288889
[33,] 27.4711111 -17.9688889
[34,] -36.5088889 27.4711111
[35,] 23.5911111 -36.5088889
[36,] 13.2161111 23.5911111
[37,] 29.6761111 13.2161111
[38,] 51.8361111 29.6761111
[39,] 21.1961111 51.8361111
[40,] -9.9638889 21.1961111
[41,] 24.0161111 -9.9638889
[42,] 31.8761111 24.0161111
[43,] 24.0761111 31.8761111
[44,] 40.2361111 24.0761111
[45,] -0.7238889 40.2361111
[46,] 51.9961111 -0.7238889
[47,] 35.3961111 51.9961111
[48,] 8.5211111 35.3961111
[49,] -19.5188889 8.5211111
[50,] -5.9588889 -19.5188889
[51,] 2.9011111 -5.9588889
[52,] -48.4588889 2.9011111
[53,] 7.7211111 -48.4588889
[54,] -8.3188889 7.7211111
[55,] 7.6811111 -8.3188889
[56,] -20.7588889 7.6811111
[57,] -26.3188889 -20.7588889
[58,] -23.6988889 -26.3188889
[59,] -101.2988889 -23.6988889
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -13.3166667 -6.9766667
2 -26.2566667 -13.3166667
3 -45.6966667 -26.2566667
4 -29.1566667 -45.6966667
5 -49.3766667 -29.1566667
6 19.1833333 -49.3766667
7 -17.2166667 19.1833333
8 -32.9566667 -17.2166667
9 -0.7166667 -32.9566667
10 30.7033333 -0.7166667
11 29.6033333 30.7033333
12 33.4283333 29.6033333
13 1.2883333 33.4283333
14 23.4483333 1.2883333
15 29.3083333 23.4483333
16 38.1483333 29.3083333
17 34.8283333 38.1483333
18 -44.2116667 34.8283333
19 3.9883333 -44.2116667
20 31.4483333 3.9883333
21 0.2883333 31.4483333
22 -22.4916667 0.2883333
23 12.7083333 -22.4916667
24 -48.1888889 12.7083333
25 1.8711111 -48.1888889
26 -43.0688889 1.8711111
27 -7.7088889 -43.0688889
28 49.4311111 -7.7088889
29 -17.1888889 49.4311111
30 1.4711111 -17.1888889
31 -18.5288889 1.4711111
32 -17.9688889 -18.5288889
33 27.4711111 -17.9688889
34 -36.5088889 27.4711111
35 23.5911111 -36.5088889
36 13.2161111 23.5911111
37 29.6761111 13.2161111
38 51.8361111 29.6761111
39 21.1961111 51.8361111
40 -9.9638889 21.1961111
41 24.0161111 -9.9638889
42 31.8761111 24.0161111
43 24.0761111 31.8761111
44 40.2361111 24.0761111
45 -0.7238889 40.2361111
46 51.9961111 -0.7238889
47 35.3961111 51.9961111
48 8.5211111 35.3961111
49 -19.5188889 8.5211111
50 -5.9588889 -19.5188889
51 2.9011111 -5.9588889
52 -48.4588889 2.9011111
53 7.7211111 -48.4588889
54 -8.3188889 7.7211111
55 7.6811111 -8.3188889
56 -20.7588889 7.6811111
57 -26.3188889 -20.7588889
58 -23.6988889 -26.3188889
59 -101.2988889 -23.6988889
> 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/7eh5l1227457504.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/8uo9v1227457504.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/94w3b1227457504.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/10mrkd1227457504.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/11vl1c1227457504.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/12odj01227457504.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/13itlw1227457504.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/146b2v1227457504.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/15n3sd1227457504.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/16b8pe1227457504.tab")
+ }
>
> system("convert tmp/1rnlu1227457504.ps tmp/1rnlu1227457504.png")
> system("convert tmp/2yi5i1227457504.ps tmp/2yi5i1227457504.png")
> system("convert tmp/3iqzi1227457504.ps tmp/3iqzi1227457504.png")
> system("convert tmp/4pcds1227457504.ps tmp/4pcds1227457504.png")
> system("convert tmp/5qssp1227457504.ps tmp/5qssp1227457504.png")
> system("convert tmp/6trog1227457504.ps tmp/6trog1227457504.png")
> system("convert tmp/7eh5l1227457504.ps tmp/7eh5l1227457504.png")
> system("convert tmp/8uo9v1227457504.ps tmp/8uo9v1227457504.png")
> system("convert tmp/94w3b1227457504.ps tmp/94w3b1227457504.png")
> system("convert tmp/10mrkd1227457504.ps tmp/10mrkd1227457504.png")
>
>
> proc.time()
user system elapsed
2.504 1.566 3.166