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(9492.49,0,9682.35,0,9762.12,0,10124.63,0,10540.05,0,10601.61,0,10323.73,0,10418.4,0,10092.96,0,10364.91,0,10152.09,0,10032.8,0,10204.59,0,10001.6,0,10411.75,0,10673.38,0,10539.51,0,10723.78,0,10682.06,0,10283.19,0,10377.18,0,10486.64,0,10545.38,0,10554.27,0,10532.54,0,10324.31,0,10695.25,0,10827.81,0,10872.48,0,10971.19,0,11145.65,0,11234.68,0,11333.88,0,10997.97,0,11036.89,0,11257.35,0,11533.59,0,11963.12,0,12185.15,0,12377.62,0,12512.89,0,12631.48,0,12268.53,0,12754.8,0,13407.75,1,13480.21,1,13673.28,1,13239.71,1,13557.69,1,13901.28,1,13200.58,1,13406.97,1,12538.12,1,12419.57,1,12193.88,1,12656.63,1,12812.48,1,12056.67,1,11322.38,1,11530.75,1,11114.08,1),dim=c(2,61),dimnames=list(c('X','Y'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('X','Y'),1:61))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'No Linear Trend'
> par2 = 'Include Monthly Dummies'
> par1 = '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
X Y M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 9492.49 0 1 0 0 0 0 0 0 0 0 0 0
2 9682.35 0 0 1 0 0 0 0 0 0 0 0 0
3 9762.12 0 0 0 1 0 0 0 0 0 0 0 0
4 10124.63 0 0 0 0 1 0 0 0 0 0 0 0
5 10540.05 0 0 0 0 0 1 0 0 0 0 0 0
6 10601.61 0 0 0 0 0 0 1 0 0 0 0 0
7 10323.73 0 0 0 0 0 0 0 1 0 0 0 0
8 10418.40 0 0 0 0 0 0 0 0 1 0 0 0
9 10092.96 0 0 0 0 0 0 0 0 0 1 0 0
10 10364.91 0 0 0 0 0 0 0 0 0 0 1 0
11 10152.09 0 0 0 0 0 0 0 0 0 0 0 1
12 10032.80 0 0 0 0 0 0 0 0 0 0 0 0
13 10204.59 0 1 0 0 0 0 0 0 0 0 0 0
14 10001.60 0 0 1 0 0 0 0 0 0 0 0 0
15 10411.75 0 0 0 1 0 0 0 0 0 0 0 0
16 10673.38 0 0 0 0 1 0 0 0 0 0 0 0
17 10539.51 0 0 0 0 0 1 0 0 0 0 0 0
18 10723.78 0 0 0 0 0 0 1 0 0 0 0 0
19 10682.06 0 0 0 0 0 0 0 1 0 0 0 0
20 10283.19 0 0 0 0 0 0 0 0 1 0 0 0
21 10377.18 0 0 0 0 0 0 0 0 0 1 0 0
22 10486.64 0 0 0 0 0 0 0 0 0 0 1 0
23 10545.38 0 0 0 0 0 0 0 0 0 0 0 1
24 10554.27 0 0 0 0 0 0 0 0 0 0 0 0
25 10532.54 0 1 0 0 0 0 0 0 0 0 0 0
26 10324.31 0 0 1 0 0 0 0 0 0 0 0 0
27 10695.25 0 0 0 1 0 0 0 0 0 0 0 0
28 10827.81 0 0 0 0 1 0 0 0 0 0 0 0
29 10872.48 0 0 0 0 0 1 0 0 0 0 0 0
30 10971.19 0 0 0 0 0 0 1 0 0 0 0 0
31 11145.65 0 0 0 0 0 0 0 1 0 0 0 0
32 11234.68 0 0 0 0 0 0 0 0 1 0 0 0
33 11333.88 0 0 0 0 0 0 0 0 0 1 0 0
34 10997.97 0 0 0 0 0 0 0 0 0 0 1 0
35 11036.89 0 0 0 0 0 0 0 0 0 0 0 1
36 11257.35 0 0 0 0 0 0 0 0 0 0 0 0
37 11533.59 0 1 0 0 0 0 0 0 0 0 0 0
38 11963.12 0 0 1 0 0 0 0 0 0 0 0 0
39 12185.15 0 0 0 1 0 0 0 0 0 0 0 0
40 12377.62 0 0 0 0 1 0 0 0 0 0 0 0
41 12512.89 0 0 0 0 0 1 0 0 0 0 0 0
42 12631.48 0 0 0 0 0 0 1 0 0 0 0 0
43 12268.53 0 0 0 0 0 0 0 1 0 0 0 0
44 12754.80 0 0 0 0 0 0 0 0 1 0 0 0
45 13407.75 1 0 0 0 0 0 0 0 0 1 0 0
46 13480.21 1 0 0 0 0 0 0 0 0 0 1 0
47 13673.28 1 0 0 0 0 0 0 0 0 0 0 1
48 13239.71 1 0 0 0 0 0 0 0 0 0 0 0
49 13557.69 1 1 0 0 0 0 0 0 0 0 0 0
50 13901.28 1 0 1 0 0 0 0 0 0 0 0 0
51 13200.58 1 0 0 1 0 0 0 0 0 0 0 0
52 13406.97 1 0 0 0 1 0 0 0 0 0 0 0
53 12538.12 1 0 0 0 0 1 0 0 0 0 0 0
54 12419.57 1 0 0 0 0 0 1 0 0 0 0 0
55 12193.88 1 0 0 0 0 0 0 1 0 0 0 0
56 12656.63 1 0 0 0 0 0 0 0 1 0 0 0
57 12812.48 1 0 0 0 0 0 0 0 0 1 0 0
58 12056.67 1 0 0 0 0 0 0 0 0 0 1 0
59 11322.38 1 0 0 0 0 0 0 0 0 0 0 1
60 11530.75 1 0 0 0 0 0 0 0 0 0 0 0
61 11114.08 1 1 0 0 0 0 0 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Y M1 M2 M3 M4
10528.84 1985.35 -118.12 248.63 325.06 556.18
M5 M6 M7 M8 M9 M10
474.70 543.62 396.86 543.63 281.87 154.30
M11
23.03
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1282.0 -496.0 -206.1 523.2 1682.3
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 10528.84 406.64 25.892 < 2e-16 ***
Y 1985.35 256.84 7.730 5.65e-10 ***
M1 -118.12 533.00 -0.222 0.826
M2 248.63 558.78 0.445 0.658
M3 325.06 558.78 0.582 0.563
M4 556.18 558.78 0.995 0.325
M5 474.70 558.78 0.850 0.400
M6 543.62 558.78 0.973 0.335
M7 396.86 558.78 0.710 0.481
M8 543.63 558.78 0.973 0.335
M9 281.87 556.42 0.507 0.615
M10 154.30 556.42 0.277 0.783
M11 23.03 556.42 0.041 0.967
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 879.8 on 48 degrees of freedom
Multiple R-squared: 0.5614, Adjusted R-squared: 0.4518
F-statistic: 5.121 on 12 and 48 DF, p-value: 1.998e-05
> 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.1641074881 0.3282149762 0.8358925
[2,] 0.0703120746 0.1406241493 0.9296879
[3,] 0.0279623990 0.0559247981 0.9720376
[4,] 0.0127019529 0.0254039058 0.9872980
[5,] 0.0053872427 0.0107744853 0.9946128
[6,] 0.0024395998 0.0048791996 0.9975604
[7,] 0.0008541238 0.0017082475 0.9991459
[8,] 0.0003995446 0.0007990893 0.9996005
[9,] 0.0002482039 0.0004964079 0.9997518
[10,] 0.0003228521 0.0006457043 0.9996771
[11,] 0.0004039870 0.0008079741 0.9995960
[12,] 0.0005162475 0.0010324950 0.9994838
[13,] 0.0004965994 0.0009931987 0.9995034
[14,] 0.0003358093 0.0006716186 0.9996642
[15,] 0.0002160323 0.0004320646 0.9997840
[16,] 0.0002141512 0.0004283023 0.9997858
[17,] 0.0004713618 0.0009427235 0.9995286
[18,] 0.0013694434 0.0027388867 0.9986306
[19,] 0.0012576076 0.0025152152 0.9987424
[20,] 0.0011787262 0.0023574525 0.9988213
[21,] 0.0014630628 0.0029261256 0.9985369
[22,] 0.0042674385 0.0085348769 0.9957326
[23,] 0.0303162066 0.0606324133 0.9696838
[24,] 0.0601630293 0.1203260585 0.9398370
[25,] 0.0902551658 0.1805103315 0.9097448
[26,] 0.0949454436 0.1898908872 0.9050546
[27,] 0.0884006895 0.1768013790 0.9115993
[28,] 0.0649961414 0.1299922827 0.9350039
[29,] 0.0534266913 0.1068533827 0.9465733
[30,] 0.0254953754 0.0509907507 0.9745046
> postscript(file="/var/www/html/freestat/rcomp/tmp/1xaws1227780247.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/freestat/rcomp/tmp/2970j1227780247.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/freestat/rcomp/tmp/3yzfp1227780247.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/freestat/rcomp/tmp/4xh0c1227780247.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/freestat/rcomp/tmp/5i7dk1227780247.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 = 61
Frequency = 1
1 2 3 4 5 6
-918.222955 -1095.111773 -1091.779773 -960.381773 -463.489773 -470.845773
7 8 9 10 11 12
-601.969773 -654.069773 -717.749545 -318.229545 -399.773545 -496.035545
13 14 15 16 17 18
-206.122955 -775.861773 -442.149773 -411.631773 -464.029773 -348.675773
19 20 21 22 23 24
-243.639773 -789.279773 -433.529545 -196.499545 -6.483545 25.434455
25 26 27 28 29 30
121.827045 -453.151773 -158.649773 -257.201773 -131.059773 -101.265773
31 32 33 34 35 36
219.950227 162.210227 523.170455 314.830455 485.026455 728.514455
37 38 39 40 41 42
1122.877045 1185.658227 1331.250227 1292.608227 1509.350227 1559.024227
43 44 45 46 47 48
1342.830227 1682.330227 611.689318 811.719318 1136.065318 725.523318
49 50 51 52 53 54
1161.625909 1138.467091 361.329091 336.607091 -450.770909 -638.236909
55 56 57 58 59 60
-717.170909 -401.190909 16.419318 -611.820682 -1214.834682 -983.436682
61
-1281.984091
> postscript(file="/var/www/html/freestat/rcomp/tmp/6cbuc1227780247.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 = 61
Frequency = 1
lag(myerror, k = 1) myerror
0 -918.222955 NA
1 -1095.111773 -918.222955
2 -1091.779773 -1095.111773
3 -960.381773 -1091.779773
4 -463.489773 -960.381773
5 -470.845773 -463.489773
6 -601.969773 -470.845773
7 -654.069773 -601.969773
8 -717.749545 -654.069773
9 -318.229545 -717.749545
10 -399.773545 -318.229545
11 -496.035545 -399.773545
12 -206.122955 -496.035545
13 -775.861773 -206.122955
14 -442.149773 -775.861773
15 -411.631773 -442.149773
16 -464.029773 -411.631773
17 -348.675773 -464.029773
18 -243.639773 -348.675773
19 -789.279773 -243.639773
20 -433.529545 -789.279773
21 -196.499545 -433.529545
22 -6.483545 -196.499545
23 25.434455 -6.483545
24 121.827045 25.434455
25 -453.151773 121.827045
26 -158.649773 -453.151773
27 -257.201773 -158.649773
28 -131.059773 -257.201773
29 -101.265773 -131.059773
30 219.950227 -101.265773
31 162.210227 219.950227
32 523.170455 162.210227
33 314.830455 523.170455
34 485.026455 314.830455
35 728.514455 485.026455
36 1122.877045 728.514455
37 1185.658227 1122.877045
38 1331.250227 1185.658227
39 1292.608227 1331.250227
40 1509.350227 1292.608227
41 1559.024227 1509.350227
42 1342.830227 1559.024227
43 1682.330227 1342.830227
44 611.689318 1682.330227
45 811.719318 611.689318
46 1136.065318 811.719318
47 725.523318 1136.065318
48 1161.625909 725.523318
49 1138.467091 1161.625909
50 361.329091 1138.467091
51 336.607091 361.329091
52 -450.770909 336.607091
53 -638.236909 -450.770909
54 -717.170909 -638.236909
55 -401.190909 -717.170909
56 16.419318 -401.190909
57 -611.820682 16.419318
58 -1214.834682 -611.820682
59 -983.436682 -1214.834682
60 -1281.984091 -983.436682
61 NA -1281.984091
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1095.111773 -918.222955
[2,] -1091.779773 -1095.111773
[3,] -960.381773 -1091.779773
[4,] -463.489773 -960.381773
[5,] -470.845773 -463.489773
[6,] -601.969773 -470.845773
[7,] -654.069773 -601.969773
[8,] -717.749545 -654.069773
[9,] -318.229545 -717.749545
[10,] -399.773545 -318.229545
[11,] -496.035545 -399.773545
[12,] -206.122955 -496.035545
[13,] -775.861773 -206.122955
[14,] -442.149773 -775.861773
[15,] -411.631773 -442.149773
[16,] -464.029773 -411.631773
[17,] -348.675773 -464.029773
[18,] -243.639773 -348.675773
[19,] -789.279773 -243.639773
[20,] -433.529545 -789.279773
[21,] -196.499545 -433.529545
[22,] -6.483545 -196.499545
[23,] 25.434455 -6.483545
[24,] 121.827045 25.434455
[25,] -453.151773 121.827045
[26,] -158.649773 -453.151773
[27,] -257.201773 -158.649773
[28,] -131.059773 -257.201773
[29,] -101.265773 -131.059773
[30,] 219.950227 -101.265773
[31,] 162.210227 219.950227
[32,] 523.170455 162.210227
[33,] 314.830455 523.170455
[34,] 485.026455 314.830455
[35,] 728.514455 485.026455
[36,] 1122.877045 728.514455
[37,] 1185.658227 1122.877045
[38,] 1331.250227 1185.658227
[39,] 1292.608227 1331.250227
[40,] 1509.350227 1292.608227
[41,] 1559.024227 1509.350227
[42,] 1342.830227 1559.024227
[43,] 1682.330227 1342.830227
[44,] 611.689318 1682.330227
[45,] 811.719318 611.689318
[46,] 1136.065318 811.719318
[47,] 725.523318 1136.065318
[48,] 1161.625909 725.523318
[49,] 1138.467091 1161.625909
[50,] 361.329091 1138.467091
[51,] 336.607091 361.329091
[52,] -450.770909 336.607091
[53,] -638.236909 -450.770909
[54,] -717.170909 -638.236909
[55,] -401.190909 -717.170909
[56,] 16.419318 -401.190909
[57,] -611.820682 16.419318
[58,] -1214.834682 -611.820682
[59,] -983.436682 -1214.834682
[60,] -1281.984091 -983.436682
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1095.111773 -918.222955
2 -1091.779773 -1095.111773
3 -960.381773 -1091.779773
4 -463.489773 -960.381773
5 -470.845773 -463.489773
6 -601.969773 -470.845773
7 -654.069773 -601.969773
8 -717.749545 -654.069773
9 -318.229545 -717.749545
10 -399.773545 -318.229545
11 -496.035545 -399.773545
12 -206.122955 -496.035545
13 -775.861773 -206.122955
14 -442.149773 -775.861773
15 -411.631773 -442.149773
16 -464.029773 -411.631773
17 -348.675773 -464.029773
18 -243.639773 -348.675773
19 -789.279773 -243.639773
20 -433.529545 -789.279773
21 -196.499545 -433.529545
22 -6.483545 -196.499545
23 25.434455 -6.483545
24 121.827045 25.434455
25 -453.151773 121.827045
26 -158.649773 -453.151773
27 -257.201773 -158.649773
28 -131.059773 -257.201773
29 -101.265773 -131.059773
30 219.950227 -101.265773
31 162.210227 219.950227
32 523.170455 162.210227
33 314.830455 523.170455
34 485.026455 314.830455
35 728.514455 485.026455
36 1122.877045 728.514455
37 1185.658227 1122.877045
38 1331.250227 1185.658227
39 1292.608227 1331.250227
40 1509.350227 1292.608227
41 1559.024227 1509.350227
42 1342.830227 1559.024227
43 1682.330227 1342.830227
44 611.689318 1682.330227
45 811.719318 611.689318
46 1136.065318 811.719318
47 725.523318 1136.065318
48 1161.625909 725.523318
49 1138.467091 1161.625909
50 361.329091 1138.467091
51 336.607091 361.329091
52 -450.770909 336.607091
53 -638.236909 -450.770909
54 -717.170909 -638.236909
55 -401.190909 -717.170909
56 16.419318 -401.190909
57 -611.820682 16.419318
58 -1214.834682 -611.820682
59 -983.436682 -1214.834682
60 -1281.984091 -983.436682
> 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/freestat/rcomp/tmp/7bkn01227780247.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/freestat/rcomp/tmp/8sp8t1227780247.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/freestat/rcomp/tmp/9svmi1227780247.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/freestat/rcomp/tmp/10agk01227780247.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/118his1227780247.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/freestat/rcomp/tmp/12hxll1227780247.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/freestat/rcomp/tmp/13g4ss1227780247.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/freestat/rcomp/tmp/14qcup1227780247.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/freestat/rcomp/tmp/15saba1227780247.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/freestat/rcomp/tmp/16s6m21227780247.tab")
+ }
>
> system("convert tmp/1xaws1227780247.ps tmp/1xaws1227780247.png")
> system("convert tmp/2970j1227780247.ps tmp/2970j1227780247.png")
> system("convert tmp/3yzfp1227780247.ps tmp/3yzfp1227780247.png")
> system("convert tmp/4xh0c1227780247.ps tmp/4xh0c1227780247.png")
> system("convert tmp/5i7dk1227780247.ps tmp/5i7dk1227780247.png")
> system("convert tmp/6cbuc1227780247.ps tmp/6cbuc1227780247.png")
> system("convert tmp/7bkn01227780247.ps tmp/7bkn01227780247.png")
> system("convert tmp/8sp8t1227780247.ps tmp/8sp8t1227780247.png")
> system("convert tmp/9svmi1227780247.ps tmp/9svmi1227780247.png")
> system("convert tmp/10agk01227780247.ps tmp/10agk01227780247.png")
>
>
> proc.time()
user system elapsed
3.644 2.508 4.140