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(108.01,102.9,101.21,97.4,119.93,111.4,94.76,87.4,95.26,96.8,117.96,114.1,115.86,110.3,111.44,103.9,108.16,101.6,108.77,94.6,109.45,95.9,124.83,104.7,115.31,102.8,109.49,98.1,124.24,113.9,92.85,80.9,98.42,95.7,120.88,113.2,111.72,105.9,116.1,108.8,109.37,102.3,111.65,99,114.29,100.7,133.68,115.5,114.27,100.7,126.49,109.9,131,114.6,104,85.4,108.88,100.5,128.48,114.8,132.44,116.5,128.04,112.9,116.35,102,120.93,106,118.59,105.3,133.1,118.8,121.05,106.1,127.62,109.3,135.44,117.2,114.88,92.5,114.34,104.2,128.85,112.5,138.9,122.4,129.44,113.3,114.96,100,127.98,110.7,127.03,112.8,128.75,109.8,137.91,117.3,128.37,109.1,135.9,115.9,122.19,96,113.08,99.8,136.2,116.8,138,115.7,115.24,99.4,110.95,94.3,99.23,91,102.39,93.2,112.67,103.1),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 108.01 102.9 1 0 0 0 0 0 0 0 0 0 0 1
2 101.21 97.4 0 1 0 0 0 0 0 0 0 0 0 2
3 119.93 111.4 0 0 1 0 0 0 0 0 0 0 0 3
4 94.76 87.4 0 0 0 1 0 0 0 0 0 0 0 4
5 95.26 96.8 0 0 0 0 1 0 0 0 0 0 0 5
6 117.96 114.1 0 0 0 0 0 1 0 0 0 0 0 6
7 115.86 110.3 0 0 0 0 0 0 1 0 0 0 0 7
8 111.44 103.9 0 0 0 0 0 0 0 1 0 0 0 8
9 108.16 101.6 0 0 0 0 0 0 0 0 1 0 0 9
10 108.77 94.6 0 0 0 0 0 0 0 0 0 1 0 10
11 109.45 95.9 0 0 0 0 0 0 0 0 0 0 1 11
12 124.83 104.7 0 0 0 0 0 0 0 0 0 0 0 12
13 115.31 102.8 1 0 0 0 0 0 0 0 0 0 0 13
14 109.49 98.1 0 1 0 0 0 0 0 0 0 0 0 14
15 124.24 113.9 0 0 1 0 0 0 0 0 0 0 0 15
16 92.85 80.9 0 0 0 1 0 0 0 0 0 0 0 16
17 98.42 95.7 0 0 0 0 1 0 0 0 0 0 0 17
18 120.88 113.2 0 0 0 0 0 1 0 0 0 0 0 18
19 111.72 105.9 0 0 0 0 0 0 1 0 0 0 0 19
20 116.10 108.8 0 0 0 0 0 0 0 1 0 0 0 20
21 109.37 102.3 0 0 0 0 0 0 0 0 1 0 0 21
22 111.65 99.0 0 0 0 0 0 0 0 0 0 1 0 22
23 114.29 100.7 0 0 0 0 0 0 0 0 0 0 1 23
24 133.68 115.5 0 0 0 0 0 0 0 0 0 0 0 24
25 114.27 100.7 1 0 0 0 0 0 0 0 0 0 0 25
26 126.49 109.9 0 1 0 0 0 0 0 0 0 0 0 26
27 131.00 114.6 0 0 1 0 0 0 0 0 0 0 0 27
28 104.00 85.4 0 0 0 1 0 0 0 0 0 0 0 28
29 108.88 100.5 0 0 0 0 1 0 0 0 0 0 0 29
30 128.48 114.8 0 0 0 0 0 1 0 0 0 0 0 30
31 132.44 116.5 0 0 0 0 0 0 1 0 0 0 0 31
32 128.04 112.9 0 0 0 0 0 0 0 1 0 0 0 32
33 116.35 102.0 0 0 0 0 0 0 0 0 1 0 0 33
34 120.93 106.0 0 0 0 0 0 0 0 0 0 1 0 34
35 118.59 105.3 0 0 0 0 0 0 0 0 0 0 1 35
36 133.10 118.8 0 0 0 0 0 0 0 0 0 0 0 36
37 121.05 106.1 1 0 0 0 0 0 0 0 0 0 0 37
38 127.62 109.3 0 1 0 0 0 0 0 0 0 0 0 38
39 135.44 117.2 0 0 1 0 0 0 0 0 0 0 0 39
40 114.88 92.5 0 0 0 1 0 0 0 0 0 0 0 40
41 114.34 104.2 0 0 0 0 1 0 0 0 0 0 0 41
42 128.85 112.5 0 0 0 0 0 1 0 0 0 0 0 42
43 138.90 122.4 0 0 0 0 0 0 1 0 0 0 0 43
44 129.44 113.3 0 0 0 0 0 0 0 1 0 0 0 44
45 114.96 100.0 0 0 0 0 0 0 0 0 1 0 0 45
46 127.98 110.7 0 0 0 0 0 0 0 0 0 1 0 46
47 127.03 112.8 0 0 0 0 0 0 0 0 0 0 1 47
48 128.75 109.8 0 0 0 0 0 0 0 0 0 0 0 48
49 137.91 117.3 1 0 0 0 0 0 0 0 0 0 0 49
50 128.37 109.1 0 1 0 0 0 0 0 0 0 0 0 50
51 135.90 115.9 0 0 1 0 0 0 0 0 0 0 0 51
52 122.19 96.0 0 0 0 1 0 0 0 0 0 0 0 52
53 113.08 99.8 0 0 0 0 1 0 0 0 0 0 0 53
54 136.20 116.8 0 0 0 0 0 1 0 0 0 0 0 54
55 138.00 115.7 0 0 0 0 0 0 1 0 0 0 0 55
56 115.24 99.4 0 0 0 0 0 0 0 1 0 0 0 56
57 110.95 94.3 0 0 0 0 0 0 0 0 1 0 0 57
58 99.23 91.0 0 0 0 0 0 0 0 0 0 1 0 58
59 102.39 93.2 0 0 0 0 0 0 0 0 0 0 1 59
60 112.67 103.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) X M1 M2 M3 M4
-24.6220 1.3142 0.3962 1.1280 -1.3092 9.3338
M5 M6 M7 M8 M9 M10
-4.9813 -4.2303 -3.3338 -2.2945 -0.5453 0.7484
M11 t
-0.5196 0.1712
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-8.4774 -2.0957 0.5525 1.8883 9.7978
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -24.62196 10.45678 -2.355 0.02286 *
X 1.31423 0.09608 13.678 < 2e-16 ***
M1 0.39615 2.34609 0.169 0.86665
M2 1.12802 2.36314 0.477 0.63538
M3 -1.30919 2.36736 -0.553 0.58293
M4 9.33382 3.08210 3.028 0.00402 **
M5 -4.98133 2.51530 -1.980 0.05366 .
M6 -4.23026 2.34881 -1.801 0.07826 .
M7 -3.33376 2.34334 -1.423 0.16158
M8 -2.29448 2.31698 -0.990 0.32721
M9 -0.54526 2.49925 -0.218 0.82826
M10 0.74841 2.49382 0.300 0.76545
M11 -0.51958 2.45069 -0.212 0.83303
t 0.17121 0.02914 5.876 4.44e-07 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 3.642 on 46 degrees of freedom
Multiple R-squared: 0.926, Adjusted R-squared: 0.905
F-statistic: 44.25 on 13 and 46 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.2927931 0.5855861 0.7072069
[2,] 0.1837975 0.3675950 0.8162025
[3,] 0.2594641 0.5189283 0.7405359
[4,] 0.3654817 0.7309634 0.6345183
[5,] 0.4570432 0.9140863 0.5429568
[6,] 0.4533857 0.9067714 0.5466143
[7,] 0.4324202 0.8648404 0.5675798
[8,] 0.4459074 0.8918147 0.5540926
[9,] 0.3595590 0.7191180 0.6404410
[10,] 0.7077360 0.5845280 0.2922640
[11,] 0.6448163 0.7103675 0.3551837
[12,] 0.6282826 0.7434348 0.3717174
[13,] 0.5632103 0.8735793 0.4367897
[14,] 0.5011339 0.9977321 0.4988661
[15,] 0.5084081 0.9831839 0.4915919
[16,] 0.4209806 0.8419613 0.5790194
[17,] 0.3331063 0.6662126 0.6668937
[18,] 0.3544028 0.7088057 0.6455972
[19,] 0.4549208 0.9098417 0.5450792
[20,] 0.6006761 0.7986478 0.3993239
[21,] 0.5075552 0.9848895 0.4924448
[22,] 0.4071426 0.8142852 0.5928574
[23,] 0.2960896 0.5921792 0.7039104
[24,] 0.2191144 0.4382288 0.7808856
[25,] 0.1514889 0.3029778 0.8485111
[26,] 0.0855601 0.1711202 0.9144399
[27,] 0.1401417 0.2802835 0.8598583
> postscript(file="/var/www/html/rcomp/tmp/1f34e1258659833.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/2x20b1258659833.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/39hjr1258659833.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/4h7221258659833.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/5y3bv1258659833.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.16952225 -3.64433922 -1.05753025 -5.50026405 -3.21006741 -4.16850066
7 8 9 10 11 12
-2.34213936 0.43843778 -1.73925844 6.60547214 6.67375671 9.79775671
13 14 15 16 17 18
2.20743151 1.66123165 -2.08757087 -0.92224717 -0.65888504 -2.12016400
19 20 21 22 23 24
-2.75400257 -3.39575152 -3.50368757 1.64839715 3.15099028 2.39961860
25 26 27 28 29 30
1.87284250 1.09886494 1.69800000 2.25925498 1.43834853 1.32260112
31 32 33 34 35 36
1.98070505 1.10144207 1.81611192 -0.32567223 -0.64893044 -4.57180491
37 38 39 40 41 42
-0.49846110 0.96293300 0.66653651 1.75376274 -0.01876643 2.66085783
43 44 45 46 47 48
-1.36771286 -0.07871847 1.00010005 -1.50701580 -4.12011412 0.85178350
49 50 51 52 53 54
-0.41229065 -0.07869037 0.78056461 2.40949350 2.44937036 2.30520570
55 56 57 58 59 60
4.48314974 1.93459014 2.42673404 -6.42118125 -5.05570243 -8.47735390
> postscript(file="/var/www/html/rcomp/tmp/6mo3t1258659833.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.16952225 NA
1 -3.64433922 -3.16952225
2 -1.05753025 -3.64433922
3 -5.50026405 -1.05753025
4 -3.21006741 -5.50026405
5 -4.16850066 -3.21006741
6 -2.34213936 -4.16850066
7 0.43843778 -2.34213936
8 -1.73925844 0.43843778
9 6.60547214 -1.73925844
10 6.67375671 6.60547214
11 9.79775671 6.67375671
12 2.20743151 9.79775671
13 1.66123165 2.20743151
14 -2.08757087 1.66123165
15 -0.92224717 -2.08757087
16 -0.65888504 -0.92224717
17 -2.12016400 -0.65888504
18 -2.75400257 -2.12016400
19 -3.39575152 -2.75400257
20 -3.50368757 -3.39575152
21 1.64839715 -3.50368757
22 3.15099028 1.64839715
23 2.39961860 3.15099028
24 1.87284250 2.39961860
25 1.09886494 1.87284250
26 1.69800000 1.09886494
27 2.25925498 1.69800000
28 1.43834853 2.25925498
29 1.32260112 1.43834853
30 1.98070505 1.32260112
31 1.10144207 1.98070505
32 1.81611192 1.10144207
33 -0.32567223 1.81611192
34 -0.64893044 -0.32567223
35 -4.57180491 -0.64893044
36 -0.49846110 -4.57180491
37 0.96293300 -0.49846110
38 0.66653651 0.96293300
39 1.75376274 0.66653651
40 -0.01876643 1.75376274
41 2.66085783 -0.01876643
42 -1.36771286 2.66085783
43 -0.07871847 -1.36771286
44 1.00010005 -0.07871847
45 -1.50701580 1.00010005
46 -4.12011412 -1.50701580
47 0.85178350 -4.12011412
48 -0.41229065 0.85178350
49 -0.07869037 -0.41229065
50 0.78056461 -0.07869037
51 2.40949350 0.78056461
52 2.44937036 2.40949350
53 2.30520570 2.44937036
54 4.48314974 2.30520570
55 1.93459014 4.48314974
56 2.42673404 1.93459014
57 -6.42118125 2.42673404
58 -5.05570243 -6.42118125
59 -8.47735390 -5.05570243
60 NA -8.47735390
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -3.64433922 -3.16952225
[2,] -1.05753025 -3.64433922
[3,] -5.50026405 -1.05753025
[4,] -3.21006741 -5.50026405
[5,] -4.16850066 -3.21006741
[6,] -2.34213936 -4.16850066
[7,] 0.43843778 -2.34213936
[8,] -1.73925844 0.43843778
[9,] 6.60547214 -1.73925844
[10,] 6.67375671 6.60547214
[11,] 9.79775671 6.67375671
[12,] 2.20743151 9.79775671
[13,] 1.66123165 2.20743151
[14,] -2.08757087 1.66123165
[15,] -0.92224717 -2.08757087
[16,] -0.65888504 -0.92224717
[17,] -2.12016400 -0.65888504
[18,] -2.75400257 -2.12016400
[19,] -3.39575152 -2.75400257
[20,] -3.50368757 -3.39575152
[21,] 1.64839715 -3.50368757
[22,] 3.15099028 1.64839715
[23,] 2.39961860 3.15099028
[24,] 1.87284250 2.39961860
[25,] 1.09886494 1.87284250
[26,] 1.69800000 1.09886494
[27,] 2.25925498 1.69800000
[28,] 1.43834853 2.25925498
[29,] 1.32260112 1.43834853
[30,] 1.98070505 1.32260112
[31,] 1.10144207 1.98070505
[32,] 1.81611192 1.10144207
[33,] -0.32567223 1.81611192
[34,] -0.64893044 -0.32567223
[35,] -4.57180491 -0.64893044
[36,] -0.49846110 -4.57180491
[37,] 0.96293300 -0.49846110
[38,] 0.66653651 0.96293300
[39,] 1.75376274 0.66653651
[40,] -0.01876643 1.75376274
[41,] 2.66085783 -0.01876643
[42,] -1.36771286 2.66085783
[43,] -0.07871847 -1.36771286
[44,] 1.00010005 -0.07871847
[45,] -1.50701580 1.00010005
[46,] -4.12011412 -1.50701580
[47,] 0.85178350 -4.12011412
[48,] -0.41229065 0.85178350
[49,] -0.07869037 -0.41229065
[50,] 0.78056461 -0.07869037
[51,] 2.40949350 0.78056461
[52,] 2.44937036 2.40949350
[53,] 2.30520570 2.44937036
[54,] 4.48314974 2.30520570
[55,] 1.93459014 4.48314974
[56,] 2.42673404 1.93459014
[57,] -6.42118125 2.42673404
[58,] -5.05570243 -6.42118125
[59,] -8.47735390 -5.05570243
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -3.64433922 -3.16952225
2 -1.05753025 -3.64433922
3 -5.50026405 -1.05753025
4 -3.21006741 -5.50026405
5 -4.16850066 -3.21006741
6 -2.34213936 -4.16850066
7 0.43843778 -2.34213936
8 -1.73925844 0.43843778
9 6.60547214 -1.73925844
10 6.67375671 6.60547214
11 9.79775671 6.67375671
12 2.20743151 9.79775671
13 1.66123165 2.20743151
14 -2.08757087 1.66123165
15 -0.92224717 -2.08757087
16 -0.65888504 -0.92224717
17 -2.12016400 -0.65888504
18 -2.75400257 -2.12016400
19 -3.39575152 -2.75400257
20 -3.50368757 -3.39575152
21 1.64839715 -3.50368757
22 3.15099028 1.64839715
23 2.39961860 3.15099028
24 1.87284250 2.39961860
25 1.09886494 1.87284250
26 1.69800000 1.09886494
27 2.25925498 1.69800000
28 1.43834853 2.25925498
29 1.32260112 1.43834853
30 1.98070505 1.32260112
31 1.10144207 1.98070505
32 1.81611192 1.10144207
33 -0.32567223 1.81611192
34 -0.64893044 -0.32567223
35 -4.57180491 -0.64893044
36 -0.49846110 -4.57180491
37 0.96293300 -0.49846110
38 0.66653651 0.96293300
39 1.75376274 0.66653651
40 -0.01876643 1.75376274
41 2.66085783 -0.01876643
42 -1.36771286 2.66085783
43 -0.07871847 -1.36771286
44 1.00010005 -0.07871847
45 -1.50701580 1.00010005
46 -4.12011412 -1.50701580
47 0.85178350 -4.12011412
48 -0.41229065 0.85178350
49 -0.07869037 -0.41229065
50 0.78056461 -0.07869037
51 2.40949350 0.78056461
52 2.44937036 2.40949350
53 2.30520570 2.44937036
54 4.48314974 2.30520570
55 1.93459014 4.48314974
56 2.42673404 1.93459014
57 -6.42118125 2.42673404
58 -5.05570243 -6.42118125
59 -8.47735390 -5.05570243
> 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/72ea61258659833.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/832j31258659833.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/9xlft1258659833.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/10lgil1258659833.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/11t1bs1258659833.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/12p86k1258659833.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/13ixww1258659833.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/14xv0a1258659833.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/15oy5r1258659833.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/160ivn1258659833.tab")
+ }
>
> system("convert tmp/1f34e1258659833.ps tmp/1f34e1258659833.png")
> system("convert tmp/2x20b1258659833.ps tmp/2x20b1258659833.png")
> system("convert tmp/39hjr1258659833.ps tmp/39hjr1258659833.png")
> system("convert tmp/4h7221258659833.ps tmp/4h7221258659833.png")
> system("convert tmp/5y3bv1258659833.ps tmp/5y3bv1258659833.png")
> system("convert tmp/6mo3t1258659833.ps tmp/6mo3t1258659833.png")
> system("convert tmp/72ea61258659833.ps tmp/72ea61258659833.png")
> system("convert tmp/832j31258659833.ps tmp/832j31258659833.png")
> system("convert tmp/9xlft1258659833.ps tmp/9xlft1258659833.png")
> system("convert tmp/10lgil1258659833.ps tmp/10lgil1258659833.png")
>
>
> proc.time()
user system elapsed
2.398 1.564 2.993