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(6.3
+ ,0
+ ,3
+ ,2.1
+ ,3.40602894496361
+ ,4
+ ,9.1
+ ,1.02325245963371
+ ,4
+ ,15.8
+ ,-1.63827216398241
+ ,1
+ ,5.2
+ ,2.20411998265592
+ ,4
+ ,10.9
+ ,0.51851393987789
+ ,1
+ ,8.3
+ ,1.71733758272386
+ ,1
+ ,11
+ ,-0.37161106994969
+ ,4
+ ,3.2
+ ,2.66745295288995
+ ,5
+ ,7.6
+ ,-0.25963731050576
+ ,2
+ ,6.3
+ ,-1.1249387366083
+ ,1
+ ,8.6
+ ,0.47712125471966
+ ,2
+ ,6.6
+ ,-0.10513034325475
+ ,2
+ ,9.5
+ ,-0.69897000433602
+ ,2
+ ,4.8
+ ,0.14921911265538
+ ,1
+ ,12
+ ,1.77815125038364
+ ,1
+ ,3.3
+ ,1.44185217577329
+ ,5
+ ,11
+ ,-0.92081875395238
+ ,2
+ ,4.7
+ ,1.92941892571429
+ ,1
+ ,10.4
+ ,-0.99567862621736
+ ,3
+ ,7.4
+ ,0.01703333929878
+ ,4
+ ,2.1
+ ,2.71683772329952
+ ,5
+ ,7.7
+ ,-2.30102999566398
+ ,4
+ ,17.9
+ ,-2
+ ,1
+ ,6.1
+ ,1.79239168949825
+ ,1
+ ,8.2
+ ,-0.91364016932525
+ ,1
+ ,8.4
+ ,0.13033376849501
+ ,3
+ ,11.9
+ ,-1.63827216398241
+ ,3
+ ,10.8
+ ,-1.31875876262441
+ ,3
+ ,13.8
+ ,0.23044892137827
+ ,1
+ ,14.3
+ ,0.54406804435028
+ ,1
+ ,15.2
+ ,-0.31875876262441
+ ,2
+ ,10
+ ,1
+ ,4
+ ,11.9
+ ,0.20951501454263
+ ,2
+ ,6.5
+ ,2.28330122870355
+ ,4
+ ,7.5
+ ,0.39794000867204
+ ,5
+ ,10.6
+ ,-0.55284196865778
+ ,3
+ ,7.4
+ ,0.62685341466673
+ ,1
+ ,8.4
+ ,0.83250891270624
+ ,2
+ ,5.7
+ ,-0.1249387366083
+ ,2
+ ,4.9
+ ,0.55630250076729
+ ,3
+ ,3.2
+ ,1.74429298312268
+ ,5
+ ,8.1
+ ,-1.22184874961636
+ ,2
+ ,11
+ ,-0.04575749056068
+ ,2
+ ,4.9
+ ,0.30102999566398
+ ,3
+ ,13.2
+ ,-0.98296666070122
+ ,2
+ ,9.7
+ ,0.6222140229663
+ ,4
+ ,12.8
+ ,0.54406804435028
+ ,1)
+ ,dim=c(3
+ ,60)
+ ,dimnames=list(c('a'
+ ,'d'
+ ,'c')
+ ,1:60))
> y <- array(NA,dim=c(3,60),dimnames=list(c('a','d','c'),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 = 'No Linear Trend'
> par2 = 'Do not include Seasonal 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
a d c
1 6.3 0.00000000 3
2 2.1 3.40602894 4
3 9.1 1.02325246 4
4 15.8 -1.63827216 1
5 5.2 2.20411998 4
6 10.9 0.51851394 1
7 8.3 1.71733758 1
8 11.0 -0.37161107 4
9 3.2 2.66745295 5
10 7.6 -0.25963731 2
11 6.3 -1.12493874 1
12 8.6 0.47712125 2
13 6.6 -0.10513034 2
14 9.5 -0.69897000 2
15 4.8 0.14921911 1
16 12.0 1.77815125 1
17 3.3 1.44185218 5
18 11.0 -0.92081875 2
19 4.7 1.92941893 1
20 10.4 -0.99567863 3
21 7.4 0.01703334 4
22 2.1 2.71683772 5
23 7.7 -2.30103000 4
24 17.9 -2.00000000 1
25 6.1 1.79239169 1
26 8.2 -0.91364017 1
27 8.4 0.13033377 3
28 11.9 -1.63827216 3
29 10.8 -1.31875876 3
30 13.8 0.23044892 1
31 14.3 0.54406804 1
32 15.2 -0.31875876 2
33 10.0 1.00000000 4
34 11.9 0.20951501 2
35 6.5 2.28330123 4
36 7.5 0.39794001 5
37 10.6 -0.55284197 3
38 7.4 0.62685341 1
39 8.4 0.83250891 2
40 5.7 -0.12493874 2
41 4.9 0.55630250 3
42 3.2 1.74429298 5
43 8.1 -1.22184875 2
44 11.0 -0.04575749 2
45 4.9 0.30103000 3
46 13.2 -0.98296666 2
47 9.7 0.62221402 4
48 12.8 0.54406804 1
49 6.3 0.00000000 3
50 2.1 3.40602894 4
51 9.1 1.02325246 4
52 15.8 -1.63827216 1
53 5.2 2.20411998 4
54 10.9 0.51851394 1
55 8.3 1.71733758 1
56 11.0 -0.37161107 4
57 3.2 2.66745295 5
58 7.6 -0.25963731 2
59 6.3 -1.12493874 1
60 8.6 0.47712125 2
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) d c
11.0994 -1.3667 -0.7994
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-5.537 -2.096 0.139 2.414 5.264
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 11.0994 0.7710 14.395 < 2e-16 ***
d -1.3667 0.2863 -4.774 1.30e-05 ***
c -0.7994 0.2791 -2.864 0.00584 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.728 on 57 degrees of freedom
Multiple R-squared: 0.4625, Adjusted R-squared: 0.4436
F-statistic: 24.52 on 2 and 57 DF, p-value: 2.073e-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.4925181 0.9850362 0.5074819
[2,] 0.3215978 0.6431955 0.6784022
[3,] 0.2221115 0.4442230 0.7778885
[4,] 0.1277741 0.2555481 0.8722259
[5,] 0.2122779 0.4245558 0.7877221
[6,] 0.6016179 0.7967642 0.3983821
[7,] 0.4939962 0.9879924 0.5060038
[8,] 0.4891698 0.9783396 0.5108302
[9,] 0.3946780 0.7893560 0.6053220
[10,] 0.5359891 0.9280218 0.4640109
[11,] 0.7083600 0.5832800 0.2916400
[12,] 0.6604053 0.6791895 0.3395947
[13,] 0.5878070 0.8243861 0.4121930
[14,] 0.5858098 0.8283805 0.4141902
[15,] 0.5074560 0.9850879 0.4925440
[16,] 0.4254904 0.8509808 0.5745096
[17,] 0.3631769 0.7263538 0.6368231
[18,] 0.3762347 0.7524694 0.6237653
[19,] 0.5767518 0.8464964 0.4232482
[20,] 0.5264012 0.9471975 0.4735988
[21,] 0.5541287 0.8917425 0.4458713
[22,] 0.4782753 0.9565507 0.5217247
[23,] 0.4140109 0.8280218 0.5859891
[24,] 0.3419691 0.6839381 0.6580309
[25,] 0.4106767 0.8213535 0.5893233
[26,] 0.5553039 0.8893923 0.4446961
[27,] 0.7383509 0.5232983 0.2616491
[28,] 0.7694357 0.4611286 0.2305643
[29,] 0.7707792 0.4584416 0.2292208
[30,] 0.7319829 0.5360341 0.2680171
[31,] 0.6690816 0.6618368 0.3309184
[32,] 0.6098672 0.7802655 0.3901328
[33,] 0.5669858 0.8660285 0.4330142
[34,] 0.4854000 0.9708000 0.5146000
[35,] 0.5560501 0.8878997 0.4439499
[36,] 0.5672233 0.8655534 0.4327767
[37,] 0.5098446 0.9803107 0.4901554
[38,] 0.5361968 0.9276065 0.4638032
[39,] 0.4639597 0.9279193 0.5360403
[40,] 0.5338320 0.9323360 0.4661680
[41,] 0.4847469 0.9694939 0.5152531
[42,] 0.4506289 0.9012577 0.5493711
[43,] 0.5060038 0.9879924 0.4939962
[44,] 0.4959175 0.9918349 0.5040825
[45,] 0.4053841 0.8107682 0.5946159
[46,] 0.3452109 0.6904218 0.6547891
[47,] 0.5094132 0.9811737 0.4905868
[48,] 0.3716602 0.7433204 0.6283398
[49,] 0.3491860 0.6983719 0.6508140
> postscript(file="/var/www/html/rcomp/tmp/15mqz1293049469.ps",horizontal=F,onefile=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/23he91293049469.ps",horizontal=F,onefile=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/33he91293049469.ps",horizontal=F,onefile=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/43he91293049469.ps",horizontal=F,onefile=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/5w8wu1293049469.ps",horizontal=F,onefile=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
-2.40130028 -1.14690893 2.59653948 3.26095378 0.31043656 1.30864327
7 8 9 10 11 12
0.34708106 2.59017308 -0.25696822 -2.25550371 -5.53747106 -0.24857238
13 14 15 16 17 18
-3.04433832 -0.95594172 -5.29607367 4.13019538 -1.83200244 0.24085657
19 20 21 22 23 24
-2.96306639 0.33790116 -0.47866482 -1.28947382 -3.34677265 4.86657868
25 26 27 28 29 30
-1.75034214 -3.34868834 -0.12317252 0.95966561 0.29634605 3.81494349
31 32 33 34 35 36
4.74356818 5.26369473 3.46476024 2.68568894 1.71865393 0.94127800
37 38 39 40 41 42
1.14312806 -2.04328867 0.03713756 -3.97141054 -3.04099909 -1.51865520
43 44 45 46 47 48
-3.07056251 1.43680683 -3.38988120 2.35591874 2.64843841 3.24356818
49 50 51 52 53 54
-2.40130028 -1.14690893 2.59653948 3.26095378 0.31043656 1.30864327
55 56 57 58 59 60
0.34708106 2.59017308 -0.25696822 -2.25550371 -5.53747106 -0.24857238
> postscript(file="/var/www/html/rcomp/tmp/6w8wu1293049469.ps",horizontal=F,onefile=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 -2.40130028 NA
1 -1.14690893 -2.40130028
2 2.59653948 -1.14690893
3 3.26095378 2.59653948
4 0.31043656 3.26095378
5 1.30864327 0.31043656
6 0.34708106 1.30864327
7 2.59017308 0.34708106
8 -0.25696822 2.59017308
9 -2.25550371 -0.25696822
10 -5.53747106 -2.25550371
11 -0.24857238 -5.53747106
12 -3.04433832 -0.24857238
13 -0.95594172 -3.04433832
14 -5.29607367 -0.95594172
15 4.13019538 -5.29607367
16 -1.83200244 4.13019538
17 0.24085657 -1.83200244
18 -2.96306639 0.24085657
19 0.33790116 -2.96306639
20 -0.47866482 0.33790116
21 -1.28947382 -0.47866482
22 -3.34677265 -1.28947382
23 4.86657868 -3.34677265
24 -1.75034214 4.86657868
25 -3.34868834 -1.75034214
26 -0.12317252 -3.34868834
27 0.95966561 -0.12317252
28 0.29634605 0.95966561
29 3.81494349 0.29634605
30 4.74356818 3.81494349
31 5.26369473 4.74356818
32 3.46476024 5.26369473
33 2.68568894 3.46476024
34 1.71865393 2.68568894
35 0.94127800 1.71865393
36 1.14312806 0.94127800
37 -2.04328867 1.14312806
38 0.03713756 -2.04328867
39 -3.97141054 0.03713756
40 -3.04099909 -3.97141054
41 -1.51865520 -3.04099909
42 -3.07056251 -1.51865520
43 1.43680683 -3.07056251
44 -3.38988120 1.43680683
45 2.35591874 -3.38988120
46 2.64843841 2.35591874
47 3.24356818 2.64843841
48 -2.40130028 3.24356818
49 -1.14690893 -2.40130028
50 2.59653948 -1.14690893
51 3.26095378 2.59653948
52 0.31043656 3.26095378
53 1.30864327 0.31043656
54 0.34708106 1.30864327
55 2.59017308 0.34708106
56 -0.25696822 2.59017308
57 -2.25550371 -0.25696822
58 -5.53747106 -2.25550371
59 -0.24857238 -5.53747106
60 NA -0.24857238
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.14690893 -2.40130028
[2,] 2.59653948 -1.14690893
[3,] 3.26095378 2.59653948
[4,] 0.31043656 3.26095378
[5,] 1.30864327 0.31043656
[6,] 0.34708106 1.30864327
[7,] 2.59017308 0.34708106
[8,] -0.25696822 2.59017308
[9,] -2.25550371 -0.25696822
[10,] -5.53747106 -2.25550371
[11,] -0.24857238 -5.53747106
[12,] -3.04433832 -0.24857238
[13,] -0.95594172 -3.04433832
[14,] -5.29607367 -0.95594172
[15,] 4.13019538 -5.29607367
[16,] -1.83200244 4.13019538
[17,] 0.24085657 -1.83200244
[18,] -2.96306639 0.24085657
[19,] 0.33790116 -2.96306639
[20,] -0.47866482 0.33790116
[21,] -1.28947382 -0.47866482
[22,] -3.34677265 -1.28947382
[23,] 4.86657868 -3.34677265
[24,] -1.75034214 4.86657868
[25,] -3.34868834 -1.75034214
[26,] -0.12317252 -3.34868834
[27,] 0.95966561 -0.12317252
[28,] 0.29634605 0.95966561
[29,] 3.81494349 0.29634605
[30,] 4.74356818 3.81494349
[31,] 5.26369473 4.74356818
[32,] 3.46476024 5.26369473
[33,] 2.68568894 3.46476024
[34,] 1.71865393 2.68568894
[35,] 0.94127800 1.71865393
[36,] 1.14312806 0.94127800
[37,] -2.04328867 1.14312806
[38,] 0.03713756 -2.04328867
[39,] -3.97141054 0.03713756
[40,] -3.04099909 -3.97141054
[41,] -1.51865520 -3.04099909
[42,] -3.07056251 -1.51865520
[43,] 1.43680683 -3.07056251
[44,] -3.38988120 1.43680683
[45,] 2.35591874 -3.38988120
[46,] 2.64843841 2.35591874
[47,] 3.24356818 2.64843841
[48,] -2.40130028 3.24356818
[49,] -1.14690893 -2.40130028
[50,] 2.59653948 -1.14690893
[51,] 3.26095378 2.59653948
[52,] 0.31043656 3.26095378
[53,] 1.30864327 0.31043656
[54,] 0.34708106 1.30864327
[55,] 2.59017308 0.34708106
[56,] -0.25696822 2.59017308
[57,] -2.25550371 -0.25696822
[58,] -5.53747106 -2.25550371
[59,] -0.24857238 -5.53747106
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.14690893 -2.40130028
2 2.59653948 -1.14690893
3 3.26095378 2.59653948
4 0.31043656 3.26095378
5 1.30864327 0.31043656
6 0.34708106 1.30864327
7 2.59017308 0.34708106
8 -0.25696822 2.59017308
9 -2.25550371 -0.25696822
10 -5.53747106 -2.25550371
11 -0.24857238 -5.53747106
12 -3.04433832 -0.24857238
13 -0.95594172 -3.04433832
14 -5.29607367 -0.95594172
15 4.13019538 -5.29607367
16 -1.83200244 4.13019538
17 0.24085657 -1.83200244
18 -2.96306639 0.24085657
19 0.33790116 -2.96306639
20 -0.47866482 0.33790116
21 -1.28947382 -0.47866482
22 -3.34677265 -1.28947382
23 4.86657868 -3.34677265
24 -1.75034214 4.86657868
25 -3.34868834 -1.75034214
26 -0.12317252 -3.34868834
27 0.95966561 -0.12317252
28 0.29634605 0.95966561
29 3.81494349 0.29634605
30 4.74356818 3.81494349
31 5.26369473 4.74356818
32 3.46476024 5.26369473
33 2.68568894 3.46476024
34 1.71865393 2.68568894
35 0.94127800 1.71865393
36 1.14312806 0.94127800
37 -2.04328867 1.14312806
38 0.03713756 -2.04328867
39 -3.97141054 0.03713756
40 -3.04099909 -3.97141054
41 -1.51865520 -3.04099909
42 -3.07056251 -1.51865520
43 1.43680683 -3.07056251
44 -3.38988120 1.43680683
45 2.35591874 -3.38988120
46 2.64843841 2.35591874
47 3.24356818 2.64843841
48 -2.40130028 3.24356818
49 -1.14690893 -2.40130028
50 2.59653948 -1.14690893
51 3.26095378 2.59653948
52 0.31043656 3.26095378
53 1.30864327 0.31043656
54 0.34708106 1.30864327
55 2.59017308 0.34708106
56 -0.25696822 2.59017308
57 -2.25550371 -0.25696822
58 -5.53747106 -2.25550371
59 -0.24857238 -5.53747106
> 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/71eoq1293049469.ps",horizontal=F,onefile=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/81eoq1293049469.ps",horizontal=F,onefile=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/9unnt1293049469.ps",horizontal=F,onefile=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/10unnt1293049469.ps",horizontal=F,onefile=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/11fomh1293049469.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/12jokn1293049469.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/13xg0e1293049469.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/140gg11293049469.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/15lhx71293049469.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/16pied1293049469.tab")
+ }
>
> try(system("convert tmp/15mqz1293049469.ps tmp/15mqz1293049469.png",intern=TRUE))
character(0)
> try(system("convert tmp/23he91293049469.ps tmp/23he91293049469.png",intern=TRUE))
character(0)
> try(system("convert tmp/33he91293049469.ps tmp/33he91293049469.png",intern=TRUE))
character(0)
> try(system("convert tmp/43he91293049469.ps tmp/43he91293049469.png",intern=TRUE))
character(0)
> try(system("convert tmp/5w8wu1293049469.ps tmp/5w8wu1293049469.png",intern=TRUE))
character(0)
> try(system("convert tmp/6w8wu1293049469.ps tmp/6w8wu1293049469.png",intern=TRUE))
character(0)
> try(system("convert tmp/71eoq1293049469.ps tmp/71eoq1293049469.png",intern=TRUE))
character(0)
> try(system("convert tmp/81eoq1293049469.ps tmp/81eoq1293049469.png",intern=TRUE))
character(0)
> try(system("convert tmp/9unnt1293049469.ps tmp/9unnt1293049469.png",intern=TRUE))
character(0)
> try(system("convert tmp/10unnt1293049469.ps tmp/10unnt1293049469.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.534 1.684 7.994