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(79,75,74,78,84,79,79,75,74,78,82,79,79,75,74,88,82,79,79,75,81,88,82,79,79,69,81,88,82,79,62,69,81,88,82,62,62,69,81,88,68,62,62,69,81,57,68,62,62,69,67,57,68,62,62,72,67,57,68,62,75,72,67,57,68,81,75,72,67,57,80,81,75,72,67,79,80,81,75,72,81,79,80,81,75,83,81,79,80,81,84,83,81,79,80,90,84,83,81,79,84,90,84,83,81,90,84,90,84,83,92,90,84,90,84,93,92,90,84,90,85,93,92,90,84,93,85,93,92,90,94,93,85,93,92,94,94,93,85,93,102,94,94,93,85,96,102,94,94,93,96,96,102,94,94,92,96,96,102,94,90,92,96,96,102,84,90,92,96,96,86,84,90,92,96,70,86,84,90,92,67,70,86,84,90,60,67,70,86,84,62,60,67,70,86,61,62,60,67,70,54,61,62,60,67,50,54,61,62,60,45,50,54,61,62,34,45,50,54,61,37,34,45,50,54,44,37,34,45,50,34,44,37,34,45,37,34,44,37,34,31,37,34,44,37,31,31,37,34,44,28,31,31,37,34,31,28,31,31,37,33,31,28,31,31,36,33,31,28,31,39,36,33,31,28,42,39,36,33,31),dim=c(5,56),dimnames=list(c('Y(t)','Y(t-1)','Y(t-2)','Y(t-3)','Y(t-4)
'),1:56))
> y <- array(NA,dim=c(5,56),dimnames=list(c('Y(t)','Y(t-1)','Y(t-2)','Y(t-3)','Y(t-4)
'),1:56))
> 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(t) Y(t-1) Y(t-2) Y(t-3) Y(t-4)\r\r M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 79 75 74 78 84 1 0 0 0 0 0 0 0 0 0 0 1
2 79 79 75 74 78 0 1 0 0 0 0 0 0 0 0 0 2
3 82 79 79 75 74 0 0 1 0 0 0 0 0 0 0 0 3
4 88 82 79 79 75 0 0 0 1 0 0 0 0 0 0 0 4
5 81 88 82 79 79 0 0 0 0 1 0 0 0 0 0 0 5
6 69 81 88 82 79 0 0 0 0 0 1 0 0 0 0 0 6
7 62 69 81 88 82 0 0 0 0 0 0 1 0 0 0 0 7
8 62 62 69 81 88 0 0 0 0 0 0 0 1 0 0 0 8
9 68 62 62 69 81 0 0 0 0 0 0 0 0 1 0 0 9
10 57 68 62 62 69 0 0 0 0 0 0 0 0 0 1 0 10
11 67 57 68 62 62 0 0 0 0 0 0 0 0 0 0 1 11
12 72 67 57 68 62 0 0 0 0 0 0 0 0 0 0 0 12
13 75 72 67 57 68 1 0 0 0 0 0 0 0 0 0 0 13
14 81 75 72 67 57 0 1 0 0 0 0 0 0 0 0 0 14
15 80 81 75 72 67 0 0 1 0 0 0 0 0 0 0 0 15
16 79 80 81 75 72 0 0 0 1 0 0 0 0 0 0 0 16
17 81 79 80 81 75 0 0 0 0 1 0 0 0 0 0 0 17
18 83 81 79 80 81 0 0 0 0 0 1 0 0 0 0 0 18
19 84 83 81 79 80 0 0 0 0 0 0 1 0 0 0 0 19
20 90 84 83 81 79 0 0 0 0 0 0 0 1 0 0 0 20
21 84 90 84 83 81 0 0 0 0 0 0 0 0 1 0 0 21
22 90 84 90 84 83 0 0 0 0 0 0 0 0 0 1 0 22
23 92 90 84 90 84 0 0 0 0 0 0 0 0 0 0 1 23
24 93 92 90 84 90 0 0 0 0 0 0 0 0 0 0 0 24
25 85 93 92 90 84 1 0 0 0 0 0 0 0 0 0 0 25
26 93 85 93 92 90 0 1 0 0 0 0 0 0 0 0 0 26
27 94 93 85 93 92 0 0 1 0 0 0 0 0 0 0 0 27
28 94 94 93 85 93 0 0 0 1 0 0 0 0 0 0 0 28
29 102 94 94 93 85 0 0 0 0 1 0 0 0 0 0 0 29
30 96 102 94 94 93 0 0 0 0 0 1 0 0 0 0 0 30
31 96 96 102 94 94 0 0 0 0 0 0 1 0 0 0 0 31
32 92 96 96 102 94 0 0 0 0 0 0 0 1 0 0 0 32
33 90 92 96 96 102 0 0 0 0 0 0 0 0 1 0 0 33
34 84 90 92 96 96 0 0 0 0 0 0 0 0 0 1 0 34
35 86 84 90 92 96 0 0 0 0 0 0 0 0 0 0 1 35
36 70 86 84 90 92 0 0 0 0 0 0 0 0 0 0 0 36
37 67 70 86 84 90 1 0 0 0 0 0 0 0 0 0 0 37
38 60 67 70 86 84 0 1 0 0 0 0 0 0 0 0 0 38
39 62 60 67 70 86 0 0 1 0 0 0 0 0 0 0 0 39
40 61 62 60 67 70 0 0 0 1 0 0 0 0 0 0 0 40
41 54 61 62 60 67 0 0 0 0 1 0 0 0 0 0 0 41
42 50 54 61 62 60 0 0 0 0 0 1 0 0 0 0 0 42
43 45 50 54 61 62 0 0 0 0 0 0 1 0 0 0 0 43
44 34 45 50 54 61 0 0 0 0 0 0 0 1 0 0 0 44
45 37 34 45 50 54 0 0 0 0 0 0 0 0 1 0 0 45
46 44 37 34 45 50 0 0 0 0 0 0 0 0 0 1 0 46
47 34 44 37 34 45 0 0 0 0 0 0 0 0 0 0 1 47
48 37 34 44 37 34 0 0 0 0 0 0 0 0 0 0 0 48
49 31 37 34 44 37 1 0 0 0 0 0 0 0 0 0 0 49
50 31 31 37 34 44 0 1 0 0 0 0 0 0 0 0 0 50
51 28 31 31 37 34 0 0 1 0 0 0 0 0 0 0 0 51
52 31 28 31 31 37 0 0 0 1 0 0 0 0 0 0 0 52
53 33 31 28 31 31 0 0 0 0 1 0 0 0 0 0 0 53
54 36 33 31 28 31 0 0 0 0 0 1 0 0 0 0 0 54
55 39 36 33 31 28 0 0 0 0 0 0 1 0 0 0 0 55
56 42 39 36 33 31 0 0 0 0 0 0 0 1 0 0 0 56
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) `Y(t-1)` `Y(t-2)` `Y(t-3)` `Y(t-4)\r\r`
6.64321 0.87270 0.25892 -0.04488 -0.16713
M1 M2 M3 M4 M5
-0.64551 2.56199 2.28982 2.77358 0.86245
M6 M7 M8 M9 M10
-2.21339 -0.52731 0.85100 2.81895 1.30992
M11 t
2.64296 -0.08564
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-11.5065 -3.4296 0.9476 3.7174 9.2690
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 6.64321 5.95737 1.115 0.272
`Y(t-1)` 0.87270 0.15881 5.495 2.6e-06 ***
`Y(t-2)` 0.25892 0.20961 1.235 0.224
`Y(t-3)` -0.04488 0.20937 -0.214 0.831
`Y(t-4)\r\r` -0.16713 0.16176 -1.033 0.308
M1 -0.64551 4.20810 -0.153 0.879
M2 2.56199 4.20762 0.609 0.546
M3 2.28982 4.18425 0.547 0.587
M4 2.77358 4.19696 0.661 0.513
M5 0.86245 4.17836 0.206 0.838
M6 -2.21339 4.18808 -0.528 0.600
M7 -0.52731 4.23085 -0.125 0.901
M8 0.85100 4.20575 0.202 0.841
M9 2.81895 4.51871 0.624 0.536
M10 1.30992 4.42998 0.296 0.769
M11 2.64296 4.42005 0.598 0.553
t -0.08564 0.06696 -1.279 0.208
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 6.212 on 39 degrees of freedom
Multiple R-squared: 0.944, Adjusted R-squared: 0.9211
F-statistic: 41.12 on 16 and 39 DF, p-value: < 2.2e-16
> 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.6783014 0.6433972 0.3216986
[2,] 0.7459480 0.5081039 0.2540520
[3,] 0.8693060 0.2613880 0.1306940
[4,] 0.8365066 0.3269869 0.1634934
[5,] 0.8379788 0.3240424 0.1620212
[6,] 0.8656823 0.2686355 0.1343177
[7,] 0.8031307 0.3937386 0.1968693
[8,] 0.7323832 0.5352336 0.2676168
[9,] 0.6414467 0.7171067 0.3585533
[10,] 0.6863163 0.6273673 0.3136837
[11,] 0.5970398 0.8059204 0.4029602
[12,] 0.5047634 0.9904732 0.4952366
[13,] 0.5670061 0.8659878 0.4329939
[14,] 0.5051870 0.9896260 0.4948130
[15,] 0.5766882 0.8466237 0.4233118
[16,] 0.5165525 0.9668950 0.4834475
[17,] 0.8954103 0.2091795 0.1045897
> postscript(file="/var/www/html/rcomp/tmp/1enz11261289316.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/267801261289316.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/3ib0b1261289316.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/4eycy1261289316.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/5crj01261289316.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 = 56
Frequency = 1
1 2 3 4 5 6
6.01456284 -2.03930246 -0.34079653 2.98962812 -7.35807149 -11.50654632
7 8 9 10 11 12
-7.05145876 1.56039919 5.78206806 -11.17916536 4.44977464 6.56874138
13 14 15 16 17 18
3.85624893 1.43212019 -3.32738331 -4.43603982 1.46301591 6.09588006
19 20 21 22 23 24
3.02018977 6.25961451 -6.69381172 4.96268414 2.46900222 3.63214732
25 26 27 28 29 30
-5.76071130 6.93265160 3.75931873 0.22522148 8.98511554 0.54685997
31 32 33 34 35 36
2.27840964 -1.10169831 -0.42547609 -3.05248954 3.27464424 -10.94691711
37 38 39 40 41 42
-0.37390544 -4.64794423 4.21168382 0.07193478 -5.39197836 -0.94278317
43 44 45 46 47 48
-1.95061098 -9.32538982 1.33721975 9.26897076 -10.19342111 0.74602841
49 50 51 52 53 54
-3.73619504 -1.67752509 -4.30282271 1.14925544 2.30191840 5.80658946
55 56
3.70347032 2.60707443
> postscript(file="/var/www/html/rcomp/tmp/68sye1261289316.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 = 56
Frequency = 1
lag(myerror, k = 1) myerror
0 6.01456284 NA
1 -2.03930246 6.01456284
2 -0.34079653 -2.03930246
3 2.98962812 -0.34079653
4 -7.35807149 2.98962812
5 -11.50654632 -7.35807149
6 -7.05145876 -11.50654632
7 1.56039919 -7.05145876
8 5.78206806 1.56039919
9 -11.17916536 5.78206806
10 4.44977464 -11.17916536
11 6.56874138 4.44977464
12 3.85624893 6.56874138
13 1.43212019 3.85624893
14 -3.32738331 1.43212019
15 -4.43603982 -3.32738331
16 1.46301591 -4.43603982
17 6.09588006 1.46301591
18 3.02018977 6.09588006
19 6.25961451 3.02018977
20 -6.69381172 6.25961451
21 4.96268414 -6.69381172
22 2.46900222 4.96268414
23 3.63214732 2.46900222
24 -5.76071130 3.63214732
25 6.93265160 -5.76071130
26 3.75931873 6.93265160
27 0.22522148 3.75931873
28 8.98511554 0.22522148
29 0.54685997 8.98511554
30 2.27840964 0.54685997
31 -1.10169831 2.27840964
32 -0.42547609 -1.10169831
33 -3.05248954 -0.42547609
34 3.27464424 -3.05248954
35 -10.94691711 3.27464424
36 -0.37390544 -10.94691711
37 -4.64794423 -0.37390544
38 4.21168382 -4.64794423
39 0.07193478 4.21168382
40 -5.39197836 0.07193478
41 -0.94278317 -5.39197836
42 -1.95061098 -0.94278317
43 -9.32538982 -1.95061098
44 1.33721975 -9.32538982
45 9.26897076 1.33721975
46 -10.19342111 9.26897076
47 0.74602841 -10.19342111
48 -3.73619504 0.74602841
49 -1.67752509 -3.73619504
50 -4.30282271 -1.67752509
51 1.14925544 -4.30282271
52 2.30191840 1.14925544
53 5.80658946 2.30191840
54 3.70347032 5.80658946
55 2.60707443 3.70347032
56 NA 2.60707443
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -2.03930246 6.01456284
[2,] -0.34079653 -2.03930246
[3,] 2.98962812 -0.34079653
[4,] -7.35807149 2.98962812
[5,] -11.50654632 -7.35807149
[6,] -7.05145876 -11.50654632
[7,] 1.56039919 -7.05145876
[8,] 5.78206806 1.56039919
[9,] -11.17916536 5.78206806
[10,] 4.44977464 -11.17916536
[11,] 6.56874138 4.44977464
[12,] 3.85624893 6.56874138
[13,] 1.43212019 3.85624893
[14,] -3.32738331 1.43212019
[15,] -4.43603982 -3.32738331
[16,] 1.46301591 -4.43603982
[17,] 6.09588006 1.46301591
[18,] 3.02018977 6.09588006
[19,] 6.25961451 3.02018977
[20,] -6.69381172 6.25961451
[21,] 4.96268414 -6.69381172
[22,] 2.46900222 4.96268414
[23,] 3.63214732 2.46900222
[24,] -5.76071130 3.63214732
[25,] 6.93265160 -5.76071130
[26,] 3.75931873 6.93265160
[27,] 0.22522148 3.75931873
[28,] 8.98511554 0.22522148
[29,] 0.54685997 8.98511554
[30,] 2.27840964 0.54685997
[31,] -1.10169831 2.27840964
[32,] -0.42547609 -1.10169831
[33,] -3.05248954 -0.42547609
[34,] 3.27464424 -3.05248954
[35,] -10.94691711 3.27464424
[36,] -0.37390544 -10.94691711
[37,] -4.64794423 -0.37390544
[38,] 4.21168382 -4.64794423
[39,] 0.07193478 4.21168382
[40,] -5.39197836 0.07193478
[41,] -0.94278317 -5.39197836
[42,] -1.95061098 -0.94278317
[43,] -9.32538982 -1.95061098
[44,] 1.33721975 -9.32538982
[45,] 9.26897076 1.33721975
[46,] -10.19342111 9.26897076
[47,] 0.74602841 -10.19342111
[48,] -3.73619504 0.74602841
[49,] -1.67752509 -3.73619504
[50,] -4.30282271 -1.67752509
[51,] 1.14925544 -4.30282271
[52,] 2.30191840 1.14925544
[53,] 5.80658946 2.30191840
[54,] 3.70347032 5.80658946
[55,] 2.60707443 3.70347032
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -2.03930246 6.01456284
2 -0.34079653 -2.03930246
3 2.98962812 -0.34079653
4 -7.35807149 2.98962812
5 -11.50654632 -7.35807149
6 -7.05145876 -11.50654632
7 1.56039919 -7.05145876
8 5.78206806 1.56039919
9 -11.17916536 5.78206806
10 4.44977464 -11.17916536
11 6.56874138 4.44977464
12 3.85624893 6.56874138
13 1.43212019 3.85624893
14 -3.32738331 1.43212019
15 -4.43603982 -3.32738331
16 1.46301591 -4.43603982
17 6.09588006 1.46301591
18 3.02018977 6.09588006
19 6.25961451 3.02018977
20 -6.69381172 6.25961451
21 4.96268414 -6.69381172
22 2.46900222 4.96268414
23 3.63214732 2.46900222
24 -5.76071130 3.63214732
25 6.93265160 -5.76071130
26 3.75931873 6.93265160
27 0.22522148 3.75931873
28 8.98511554 0.22522148
29 0.54685997 8.98511554
30 2.27840964 0.54685997
31 -1.10169831 2.27840964
32 -0.42547609 -1.10169831
33 -3.05248954 -0.42547609
34 3.27464424 -3.05248954
35 -10.94691711 3.27464424
36 -0.37390544 -10.94691711
37 -4.64794423 -0.37390544
38 4.21168382 -4.64794423
39 0.07193478 4.21168382
40 -5.39197836 0.07193478
41 -0.94278317 -5.39197836
42 -1.95061098 -0.94278317
43 -9.32538982 -1.95061098
44 1.33721975 -9.32538982
45 9.26897076 1.33721975
46 -10.19342111 9.26897076
47 0.74602841 -10.19342111
48 -3.73619504 0.74602841
49 -1.67752509 -3.73619504
50 -4.30282271 -1.67752509
51 1.14925544 -4.30282271
52 2.30191840 1.14925544
53 5.80658946 2.30191840
54 3.70347032 5.80658946
55 2.60707443 3.70347032
> 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/7g5ve1261289316.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/80e0i1261289316.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/96u6f1261289316.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/1059u01261289316.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/11w4ch1261289316.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/12cnq81261289316.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/13tp9z1261289316.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/14kjut1261289316.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/15a38q1261289316.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/16cuha1261289316.tab")
+ }
>
> try(system("convert tmp/1enz11261289316.ps tmp/1enz11261289316.png",intern=TRUE))
character(0)
> try(system("convert tmp/267801261289316.ps tmp/267801261289316.png",intern=TRUE))
character(0)
> try(system("convert tmp/3ib0b1261289316.ps tmp/3ib0b1261289316.png",intern=TRUE))
character(0)
> try(system("convert tmp/4eycy1261289316.ps tmp/4eycy1261289316.png",intern=TRUE))
character(0)
> try(system("convert tmp/5crj01261289316.ps tmp/5crj01261289316.png",intern=TRUE))
character(0)
> try(system("convert tmp/68sye1261289316.ps tmp/68sye1261289316.png",intern=TRUE))
character(0)
> try(system("convert tmp/7g5ve1261289316.ps tmp/7g5ve1261289316.png",intern=TRUE))
character(0)
> try(system("convert tmp/80e0i1261289316.ps tmp/80e0i1261289316.png",intern=TRUE))
character(0)
> try(system("convert tmp/96u6f1261289316.ps tmp/96u6f1261289316.png",intern=TRUE))
character(0)
> try(system("convert tmp/1059u01261289316.ps tmp/1059u01261289316.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.336 1.552 7.265