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(8.9,1.4,8.8,1.2,8.3,1,7.5,1.7,7.2,2.4,7.4,2,8.8,2.1,9.3,2,9.3,1.8,8.7,2.7,8.2,2.3,8.3,1.9,8.5,2,8.6,2.3,8.5,2.8,8.2,2.4,8.1,2.3,7.9,2.7,8.6,2.7,8.7,2.9,8.7,3,8.5,2.2,8.4,2.3,8.5,2.8,8.7,2.8,8.7,2.8,8.6,2.2,8.5,2.6,8.3,2.8,8,2.5,8.2,2.4,8.1,2.3,8.1,1.9,8,1.7,7.9,2,7.9,2.1,8,1.7,8,1.8,7.9,1.8,8,1.8,7.7,1.3,7.2,1.3,7.5,1.3,7.3,1.2,7,1.4,7,2.2,7,2.9,7.2,3.1,7.3,3.5,7.1,3.6,6.8,4.4,6.4,4.1,6.1,5.1,6.5,5.8,7.7,5.9,7.9,5.4,7.5,5.5,6.9,4.8,6.6,3.2,6.9,2.7),dim=c(2,60),dimnames=list(c('Y','X'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Y','X'),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
Y X M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 8.9 1.4 1 0 0 0 0 0 0 0 0 0 0 1
2 8.8 1.2 0 1 0 0 0 0 0 0 0 0 0 2
3 8.3 1.0 0 0 1 0 0 0 0 0 0 0 0 3
4 7.5 1.7 0 0 0 1 0 0 0 0 0 0 0 4
5 7.2 2.4 0 0 0 0 1 0 0 0 0 0 0 5
6 7.4 2.0 0 0 0 0 0 1 0 0 0 0 0 6
7 8.8 2.1 0 0 0 0 0 0 1 0 0 0 0 7
8 9.3 2.0 0 0 0 0 0 0 0 1 0 0 0 8
9 9.3 1.8 0 0 0 0 0 0 0 0 1 0 0 9
10 8.7 2.7 0 0 0 0 0 0 0 0 0 1 0 10
11 8.2 2.3 0 0 0 0 0 0 0 0 0 0 1 11
12 8.3 1.9 0 0 0 0 0 0 0 0 0 0 0 12
13 8.5 2.0 1 0 0 0 0 0 0 0 0 0 0 13
14 8.6 2.3 0 1 0 0 0 0 0 0 0 0 0 14
15 8.5 2.8 0 0 1 0 0 0 0 0 0 0 0 15
16 8.2 2.4 0 0 0 1 0 0 0 0 0 0 0 16
17 8.1 2.3 0 0 0 0 1 0 0 0 0 0 0 17
18 7.9 2.7 0 0 0 0 0 1 0 0 0 0 0 18
19 8.6 2.7 0 0 0 0 0 0 1 0 0 0 0 19
20 8.7 2.9 0 0 0 0 0 0 0 1 0 0 0 20
21 8.7 3.0 0 0 0 0 0 0 0 0 1 0 0 21
22 8.5 2.2 0 0 0 0 0 0 0 0 0 1 0 22
23 8.4 2.3 0 0 0 0 0 0 0 0 0 0 1 23
24 8.5 2.8 0 0 0 0 0 0 0 0 0 0 0 24
25 8.7 2.8 1 0 0 0 0 0 0 0 0 0 0 25
26 8.7 2.8 0 1 0 0 0 0 0 0 0 0 0 26
27 8.6 2.2 0 0 1 0 0 0 0 0 0 0 0 27
28 8.5 2.6 0 0 0 1 0 0 0 0 0 0 0 28
29 8.3 2.8 0 0 0 0 1 0 0 0 0 0 0 29
30 8.0 2.5 0 0 0 0 0 1 0 0 0 0 0 30
31 8.2 2.4 0 0 0 0 0 0 1 0 0 0 0 31
32 8.1 2.3 0 0 0 0 0 0 0 1 0 0 0 32
33 8.1 1.9 0 0 0 0 0 0 0 0 1 0 0 33
34 8.0 1.7 0 0 0 0 0 0 0 0 0 1 0 34
35 7.9 2.0 0 0 0 0 0 0 0 0 0 0 1 35
36 7.9 2.1 0 0 0 0 0 0 0 0 0 0 0 36
37 8.0 1.7 1 0 0 0 0 0 0 0 0 0 0 37
38 8.0 1.8 0 1 0 0 0 0 0 0 0 0 0 38
39 7.9 1.8 0 0 1 0 0 0 0 0 0 0 0 39
40 8.0 1.8 0 0 0 1 0 0 0 0 0 0 0 40
41 7.7 1.3 0 0 0 0 1 0 0 0 0 0 0 41
42 7.2 1.3 0 0 0 0 0 1 0 0 0 0 0 42
43 7.5 1.3 0 0 0 0 0 0 1 0 0 0 0 43
44 7.3 1.2 0 0 0 0 0 0 0 1 0 0 0 44
45 7.0 1.4 0 0 0 0 0 0 0 0 1 0 0 45
46 7.0 2.2 0 0 0 0 0 0 0 0 0 1 0 46
47 7.0 2.9 0 0 0 0 0 0 0 0 0 0 1 47
48 7.2 3.1 0 0 0 0 0 0 0 0 0 0 0 48
49 7.3 3.5 1 0 0 0 0 0 0 0 0 0 0 49
50 7.1 3.6 0 1 0 0 0 0 0 0 0 0 0 50
51 6.8 4.4 0 0 1 0 0 0 0 0 0 0 0 51
52 6.4 4.1 0 0 0 1 0 0 0 0 0 0 0 52
53 6.1 5.1 0 0 0 0 1 0 0 0 0 0 0 53
54 6.5 5.8 0 0 0 0 0 1 0 0 0 0 0 54
55 7.7 5.9 0 0 0 0 0 0 1 0 0 0 0 55
56 7.9 5.4 0 0 0 0 0 0 0 1 0 0 0 56
57 7.5 5.5 0 0 0 0 0 0 0 0 1 0 0 57
58 6.9 4.8 0 0 0 0 0 0 0 0 0 1 0 58
59 6.6 3.2 0 0 0 0 0 0 0 0 0 0 1 59
60 6.9 2.7 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) X M1 M2 M3 M4
8.8948409 0.0001371 0.1731704 0.1646951 -0.0237857 -0.2922637
M5 M6 M7 M8 M9 M10
-0.5007664 -0.5492444 0.2422858 0.3738353 0.2653737 -0.0030933
M11 t
-0.1715357 -0.0315330
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.03674 -0.21837 0.06161 0.28088 0.82000
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 8.8948409 0.2555444 34.807 < 2e-16 ***
X 0.0001371 0.0637842 0.002 0.9983
M1 0.1731704 0.2977784 0.582 0.5637
M2 0.1646951 0.2973909 0.554 0.5824
M3 -0.0237857 0.2971835 -0.080 0.9366
M4 -0.2922637 0.2969858 -0.984 0.3302
M5 -0.5007664 0.2979246 -1.681 0.0996 .
M6 -0.5492444 0.2979645 -1.843 0.0717 .
M7 0.2422858 0.2975965 0.814 0.4198
M8 0.3738353 0.2963899 1.261 0.2136
M9 0.2653737 0.2958647 0.897 0.3744
M10 -0.0030933 0.2956052 -0.010 0.9917
M11 -0.1715357 0.2950413 -0.581 0.5638
t -0.0315330 0.0042891 -7.352 2.71e-09 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.4664 on 46 degrees of freedom
Multiple R-squared: 0.693, Adjusted R-squared: 0.6062
F-statistic: 7.987 on 13 and 46 DF, p-value: 5.195e-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.68807013 0.62385973 0.31192987
[2,] 0.57240592 0.85518816 0.42759408
[3,] 0.56249510 0.87500980 0.43750490
[4,] 0.64110427 0.71779146 0.35889573
[5,] 0.60727789 0.78544422 0.39272211
[6,] 0.59650306 0.80699387 0.40349694
[7,] 0.48442318 0.96884636 0.51557682
[8,] 0.39848754 0.79697507 0.60151246
[9,] 0.29726796 0.59453591 0.70273204
[10,] 0.21052982 0.42105963 0.78947018
[11,] 0.14590609 0.29181218 0.85409391
[12,] 0.13921089 0.27842178 0.86078911
[13,] 0.12481675 0.24963350 0.87518325
[14,] 0.08321247 0.16642495 0.91678753
[15,] 0.13552220 0.27104440 0.86447780
[16,] 0.26070043 0.52140085 0.73929957
[17,] 0.27633308 0.55266616 0.72366692
[18,] 0.20975504 0.41951009 0.79024496
[19,] 0.14604567 0.29209134 0.85395433
[20,] 0.10026765 0.20053529 0.89973235
[21,] 0.06626166 0.13252331 0.93373834
[22,] 0.04373036 0.08746071 0.95626964
[23,] 0.03369013 0.06738026 0.96630987
[24,] 0.08244185 0.16488370 0.91755815
[25,] 0.54053215 0.91893569 0.45946785
[26,] 0.94444050 0.11111900 0.05555950
[27,] 0.93414254 0.13171492 0.06585746
> postscript(file="/var/www/html/rcomp/tmp/1wvnd1258654744.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/2d7yn1258654744.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/315im1258654744.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/45rxy1258654744.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/5tdo11258654744.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
-0.13667032 -0.19663467 -0.47659353 -0.97667855 -1.03673889 -0.75667307
7 8 9 10 11 12
-0.11668404 0.28331322 0.42333516 0.12321174 -0.17675809 -0.21670598
13 14 15 16 17 18
-0.15835710 -0.01839002 0.10155513 0.10162095 0.24167032 0.12162644
19 20 21 22 23 24
0.06162918 0.06158530 0.20156610 0.30167581 0.40163741 0.36156610
25 26 27 28 29 30
0.41992869 0.45993692 0.58003291 0.77998903 0.81999726 0.60004937
31 32 33 34 35 36
0.04006583 -0.15993692 -0.01988755 0.18013988 0.28007405 0.14005760
37 38 39 40 41 42
0.09847504 0.13846956 0.25848327 0.65849424 0.59859846 0.17860943
43 44 45 46 47 48
-0.28138782 -0.58139057 -0.74142348 -0.44153319 -0.24165387 -0.18168404
49 50 51 52 53 54
-0.22337630 -0.38338179 -0.46347778 -0.56342567 -0.62352715 -0.14361218
55 56 57 58 59 60
0.29637685 0.39642896 0.13640976 -0.16349424 -0.26329951 -0.10323368
> postscript(file="/var/www/html/rcomp/tmp/6gxtv1258654744.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 -0.13667032 NA
1 -0.19663467 -0.13667032
2 -0.47659353 -0.19663467
3 -0.97667855 -0.47659353
4 -1.03673889 -0.97667855
5 -0.75667307 -1.03673889
6 -0.11668404 -0.75667307
7 0.28331322 -0.11668404
8 0.42333516 0.28331322
9 0.12321174 0.42333516
10 -0.17675809 0.12321174
11 -0.21670598 -0.17675809
12 -0.15835710 -0.21670598
13 -0.01839002 -0.15835710
14 0.10155513 -0.01839002
15 0.10162095 0.10155513
16 0.24167032 0.10162095
17 0.12162644 0.24167032
18 0.06162918 0.12162644
19 0.06158530 0.06162918
20 0.20156610 0.06158530
21 0.30167581 0.20156610
22 0.40163741 0.30167581
23 0.36156610 0.40163741
24 0.41992869 0.36156610
25 0.45993692 0.41992869
26 0.58003291 0.45993692
27 0.77998903 0.58003291
28 0.81999726 0.77998903
29 0.60004937 0.81999726
30 0.04006583 0.60004937
31 -0.15993692 0.04006583
32 -0.01988755 -0.15993692
33 0.18013988 -0.01988755
34 0.28007405 0.18013988
35 0.14005760 0.28007405
36 0.09847504 0.14005760
37 0.13846956 0.09847504
38 0.25848327 0.13846956
39 0.65849424 0.25848327
40 0.59859846 0.65849424
41 0.17860943 0.59859846
42 -0.28138782 0.17860943
43 -0.58139057 -0.28138782
44 -0.74142348 -0.58139057
45 -0.44153319 -0.74142348
46 -0.24165387 -0.44153319
47 -0.18168404 -0.24165387
48 -0.22337630 -0.18168404
49 -0.38338179 -0.22337630
50 -0.46347778 -0.38338179
51 -0.56342567 -0.46347778
52 -0.62352715 -0.56342567
53 -0.14361218 -0.62352715
54 0.29637685 -0.14361218
55 0.39642896 0.29637685
56 0.13640976 0.39642896
57 -0.16349424 0.13640976
58 -0.26329951 -0.16349424
59 -0.10323368 -0.26329951
60 NA -0.10323368
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.19663467 -0.13667032
[2,] -0.47659353 -0.19663467
[3,] -0.97667855 -0.47659353
[4,] -1.03673889 -0.97667855
[5,] -0.75667307 -1.03673889
[6,] -0.11668404 -0.75667307
[7,] 0.28331322 -0.11668404
[8,] 0.42333516 0.28331322
[9,] 0.12321174 0.42333516
[10,] -0.17675809 0.12321174
[11,] -0.21670598 -0.17675809
[12,] -0.15835710 -0.21670598
[13,] -0.01839002 -0.15835710
[14,] 0.10155513 -0.01839002
[15,] 0.10162095 0.10155513
[16,] 0.24167032 0.10162095
[17,] 0.12162644 0.24167032
[18,] 0.06162918 0.12162644
[19,] 0.06158530 0.06162918
[20,] 0.20156610 0.06158530
[21,] 0.30167581 0.20156610
[22,] 0.40163741 0.30167581
[23,] 0.36156610 0.40163741
[24,] 0.41992869 0.36156610
[25,] 0.45993692 0.41992869
[26,] 0.58003291 0.45993692
[27,] 0.77998903 0.58003291
[28,] 0.81999726 0.77998903
[29,] 0.60004937 0.81999726
[30,] 0.04006583 0.60004937
[31,] -0.15993692 0.04006583
[32,] -0.01988755 -0.15993692
[33,] 0.18013988 -0.01988755
[34,] 0.28007405 0.18013988
[35,] 0.14005760 0.28007405
[36,] 0.09847504 0.14005760
[37,] 0.13846956 0.09847504
[38,] 0.25848327 0.13846956
[39,] 0.65849424 0.25848327
[40,] 0.59859846 0.65849424
[41,] 0.17860943 0.59859846
[42,] -0.28138782 0.17860943
[43,] -0.58139057 -0.28138782
[44,] -0.74142348 -0.58139057
[45,] -0.44153319 -0.74142348
[46,] -0.24165387 -0.44153319
[47,] -0.18168404 -0.24165387
[48,] -0.22337630 -0.18168404
[49,] -0.38338179 -0.22337630
[50,] -0.46347778 -0.38338179
[51,] -0.56342567 -0.46347778
[52,] -0.62352715 -0.56342567
[53,] -0.14361218 -0.62352715
[54,] 0.29637685 -0.14361218
[55,] 0.39642896 0.29637685
[56,] 0.13640976 0.39642896
[57,] -0.16349424 0.13640976
[58,] -0.26329951 -0.16349424
[59,] -0.10323368 -0.26329951
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.19663467 -0.13667032
2 -0.47659353 -0.19663467
3 -0.97667855 -0.47659353
4 -1.03673889 -0.97667855
5 -0.75667307 -1.03673889
6 -0.11668404 -0.75667307
7 0.28331322 -0.11668404
8 0.42333516 0.28331322
9 0.12321174 0.42333516
10 -0.17675809 0.12321174
11 -0.21670598 -0.17675809
12 -0.15835710 -0.21670598
13 -0.01839002 -0.15835710
14 0.10155513 -0.01839002
15 0.10162095 0.10155513
16 0.24167032 0.10162095
17 0.12162644 0.24167032
18 0.06162918 0.12162644
19 0.06158530 0.06162918
20 0.20156610 0.06158530
21 0.30167581 0.20156610
22 0.40163741 0.30167581
23 0.36156610 0.40163741
24 0.41992869 0.36156610
25 0.45993692 0.41992869
26 0.58003291 0.45993692
27 0.77998903 0.58003291
28 0.81999726 0.77998903
29 0.60004937 0.81999726
30 0.04006583 0.60004937
31 -0.15993692 0.04006583
32 -0.01988755 -0.15993692
33 0.18013988 -0.01988755
34 0.28007405 0.18013988
35 0.14005760 0.28007405
36 0.09847504 0.14005760
37 0.13846956 0.09847504
38 0.25848327 0.13846956
39 0.65849424 0.25848327
40 0.59859846 0.65849424
41 0.17860943 0.59859846
42 -0.28138782 0.17860943
43 -0.58139057 -0.28138782
44 -0.74142348 -0.58139057
45 -0.44153319 -0.74142348
46 -0.24165387 -0.44153319
47 -0.18168404 -0.24165387
48 -0.22337630 -0.18168404
49 -0.38338179 -0.22337630
50 -0.46347778 -0.38338179
51 -0.56342567 -0.46347778
52 -0.62352715 -0.56342567
53 -0.14361218 -0.62352715
54 0.29637685 -0.14361218
55 0.39642896 0.29637685
56 0.13640976 0.39642896
57 -0.16349424 0.13640976
58 -0.26329951 -0.16349424
59 -0.10323368 -0.26329951
> 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/7rlj01258654744.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/8pi421258654744.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/9ddhl1258654744.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/10iz9b1258654744.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/11l8bn1258654744.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/1221b11258654744.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/13mkm21258654745.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/14en5c1258654745.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/15szkq1258654745.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/16k8av1258654745.tab")
+ }
>
> system("convert tmp/1wvnd1258654744.ps tmp/1wvnd1258654744.png")
> system("convert tmp/2d7yn1258654744.ps tmp/2d7yn1258654744.png")
> system("convert tmp/315im1258654744.ps tmp/315im1258654744.png")
> system("convert tmp/45rxy1258654744.ps tmp/45rxy1258654744.png")
> system("convert tmp/5tdo11258654744.ps tmp/5tdo11258654744.png")
> system("convert tmp/6gxtv1258654744.ps tmp/6gxtv1258654744.png")
> system("convert tmp/7rlj01258654744.ps tmp/7rlj01258654744.png")
> system("convert tmp/8pi421258654744.ps tmp/8pi421258654744.png")
> system("convert tmp/9ddhl1258654744.ps tmp/9ddhl1258654744.png")
> system("convert tmp/10iz9b1258654744.ps tmp/10iz9b1258654744.png")
>
>
> proc.time()
user system elapsed
2.369 1.546 3.178