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(2.0
+ ,4.5
+ ,1000.00
+ ,6600.00
+ ,42.0
+ ,3.00
+ ,1.00
+ ,3.00
+ ,1.8
+ ,69.0
+ ,2547000.00
+ ,4603000.00
+ ,624.0
+ ,3.00
+ ,5.00
+ ,4.00
+ ,0.7
+ ,27.0
+ ,10550.00
+ ,179500.00
+ ,180.0
+ ,4.00
+ ,4.00
+ ,4.00
+ ,3.9
+ ,19.0
+ ,0.023
+ ,0.300
+ ,35.0
+ ,1.00
+ ,1.00
+ ,1.00
+ ,1.0
+ ,30.4
+ ,160000.00
+ ,169000.00
+ ,392.0
+ ,4.00
+ ,5.00
+ ,4.00
+ ,3.6
+ ,28.0
+ ,3300.00
+ ,25600.00
+ ,63.0
+ ,1.00
+ ,2.00
+ ,1.00
+ ,1.4
+ ,50.0
+ ,52160.00
+ ,440000.00
+ ,230.0
+ ,1.00
+ ,1.00
+ ,1.00
+ ,1.5
+ ,7.0
+ ,0.425
+ ,6400.00
+ ,112.0
+ ,5.00
+ ,4.00
+ ,4.00
+ ,0.7
+ ,30.0
+ ,465000.00
+ ,423000.00
+ ,281.0
+ ,5.00
+ ,5.00
+ ,5.00
+ ,2.1
+ ,3.5
+ ,0.075
+ ,1200.00
+ ,42.0
+ ,1.00
+ ,1.00
+ ,1.00
+ ,4.1
+ ,6.0
+ ,0.785
+ ,3500.00
+ ,42.0
+ ,2.00
+ ,2.00
+ ,2.00
+ ,1.2
+ ,10.4
+ ,0.200
+ ,5000.00
+ ,120.0
+ ,2.00
+ ,2.00
+ ,2.00
+ ,0.5
+ ,20.0
+ ,27660.00
+ ,115000.00
+ ,148.0
+ ,5.00
+ ,5.00
+ ,5.00
+ ,3.4
+ ,3.9
+ ,0.120
+ ,1000.00
+ ,16.0
+ ,3.00
+ ,1.00
+ ,2.00
+ ,1.5
+ ,41.0
+ ,85000.00
+ ,325000.00
+ ,310.0
+ ,1.00
+ ,3.00
+ ,1.00
+ ,3.4
+ ,9.0
+ ,0.101
+ ,4000.00
+ ,28.0
+ ,5.00
+ ,1.00
+ ,3.00
+ ,0.8
+ ,7.6
+ ,1040.00
+ ,5500.00
+ ,68.0
+ ,5.00
+ ,3.00
+ ,4.00
+ ,0.8
+ ,46.0
+ ,521000.00
+ ,655000.00
+ ,336.0
+ ,5.00
+ ,5.00
+ ,5.00
+ ,2.0
+ ,24.0
+ ,0.010
+ ,0.250
+ ,50.0
+ ,1.00
+ ,1.00
+ ,1.00
+ ,1.9
+ ,100.0
+ ,62000.00
+ ,1320000.00
+ ,267.0
+ ,1.00
+ ,1.00
+ ,1.00
+ ,1.3
+ ,3.2
+ ,.023
+ ,0.400
+ ,19.0
+ ,4.00
+ ,1.00
+ ,3.00
+ ,5.6
+ ,5.0
+ ,1700.00
+ ,6300.00
+ ,12.0
+ ,2.00
+ ,1.00
+ ,1.00
+ ,3.1
+ ,6.5
+ ,3500.00
+ ,10800.00
+ ,120.0
+ ,2.00
+ ,1.00
+ ,1.00
+ ,1.8
+ ,12.0
+ ,0.480
+ ,15500.00
+ ,140.0
+ ,2.00
+ ,2.00
+ ,2.00
+ ,0.9
+ ,20.2
+ ,10000.00
+ ,115000.00
+ ,170.0
+ ,4.00
+ ,4.00
+ ,4.00
+ ,1.8
+ ,13.0
+ ,1620.00
+ ,11400.00
+ ,17.0
+ ,2.00
+ ,1.00
+ ,2.00
+ ,1.9
+ ,27.0
+ ,192000.00
+ ,180000.00
+ ,115.0
+ ,4.00
+ ,4.00
+ ,4.00
+ ,0.9
+ ,18.0
+ ,2500.00
+ ,12100.00
+ ,31.0
+ ,5.00
+ ,5.00
+ ,5.00
+ ,2.6
+ ,4.7
+ ,0.280
+ ,1900.00
+ ,21.0
+ ,3.00
+ ,1.00
+ ,3.00
+ ,2.4
+ ,9.8
+ ,4235.00
+ ,50400.00
+ ,52.0
+ ,1.00
+ ,1.00
+ ,1.00
+ ,1.2
+ ,29.0
+ ,6800.00
+ ,179000.00
+ ,164.0
+ ,2.00
+ ,3.00
+ ,2.00
+ ,0.9
+ ,7.0
+ ,0.750
+ ,12300.00
+ ,225.0
+ ,2.00
+ ,2.00
+ ,2.00
+ ,0.5
+ ,6.0
+ ,3600.00
+ ,21000.00
+ ,225.0
+ ,3.00
+ ,2.00
+ ,3.00
+ ,0.6
+ ,20.0
+ ,55500.00
+ ,175000.00
+ ,151.0
+ ,5.00
+ ,5.00
+ ,5.00
+ ,2.3
+ ,4.5
+ ,0.900
+ ,2600.00
+ ,60.0
+ ,2.00
+ ,1.00
+ ,2.00
+ ,0.5
+ ,7.5
+ ,2000.00
+ ,12300.00
+ ,200.0
+ ,3.00
+ ,1.00
+ ,3.00
+ ,2.6
+ ,2.3
+ ,0.104
+ ,2500.00
+ ,46.0
+ ,3.00
+ ,2.00
+ ,2.00
+ ,0.6
+ ,24.0
+ ,4190.00
+ ,58000.00
+ ,210.0
+ ,4.00
+ ,3.00
+ ,4.00
+ ,6.6
+ ,3.0
+ ,3500.00
+ ,3900.00
+ ,14.0
+ ,2.00
+ ,1.00
+ ,1.00)
+ ,dim=c(8
+ ,39)
+ ,dimnames=list(c('SP'
+ ,'L'
+ ,'Wb'
+ ,'Wbr'
+ ,'Tg'
+ ,'P'
+ ,'S'
+ ,'D')
+ ,1:39))
> y <- array(NA,dim=c(8,39),dimnames=list(c('SP','L','Wb','Wbr','Tg','P','S','D'),1:39))
> 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
SP L Wb Wbr Tg P S D
1 2.0 4.5 1.000e+03 6.600e+03 42 3 1 3
2 1.8 69.0 2.547e+06 4.603e+06 624 3 5 4
3 0.7 27.0 1.055e+04 1.795e+05 180 4 4 4
4 3.9 19.0 2.300e-02 3.000e-01 35 1 1 1
5 1.0 30.4 1.600e+05 1.690e+05 392 4 5 4
6 3.6 28.0 3.300e+03 2.560e+04 63 1 2 1
7 1.4 50.0 5.216e+04 4.400e+05 230 1 1 1
8 1.5 7.0 4.250e-01 6.400e+03 112 5 4 4
9 0.7 30.0 4.650e+05 4.230e+05 281 5 5 5
10 2.1 3.5 7.500e-02 1.200e+03 42 1 1 1
11 4.1 6.0 7.850e-01 3.500e+03 42 2 2 2
12 1.2 10.4 2.000e-01 5.000e+03 120 2 2 2
13 0.5 20.0 2.766e+04 1.150e+05 148 5 5 5
14 3.4 3.9 1.200e-01 1.000e+03 16 3 1 2
15 1.5 41.0 8.500e+04 3.250e+05 310 1 3 1
16 3.4 9.0 1.010e-01 4.000e+03 28 5 1 3
17 0.8 7.6 1.040e+03 5.500e+03 68 5 3 4
18 0.8 46.0 5.210e+05 6.550e+05 336 5 5 5
19 2.0 24.0 1.000e-02 2.500e-01 50 1 1 1
20 1.9 100.0 6.200e+04 1.320e+06 267 1 1 1
21 1.3 3.2 2.300e-02 4.000e-01 19 4 1 3
22 5.6 5.0 1.700e+03 6.300e+03 12 2 1 1
23 3.1 6.5 3.500e+03 1.080e+04 120 2 1 1
24 1.8 12.0 4.800e-01 1.550e+04 140 2 2 2
25 0.9 20.2 1.000e+04 1.150e+05 170 4 4 4
26 1.8 13.0 1.620e+03 1.140e+04 17 2 1 2
27 1.9 27.0 1.920e+05 1.800e+05 115 4 4 4
28 0.9 18.0 2.500e+03 1.210e+04 31 5 5 5
29 2.6 4.7 2.800e-01 1.900e+03 21 3 1 3
30 2.4 9.8 4.235e+03 5.040e+04 52 1 1 1
31 1.2 29.0 6.800e+03 1.790e+05 164 2 3 2
32 0.9 7.0 7.500e-01 1.230e+04 225 2 2 2
33 0.5 6.0 3.600e+03 2.100e+04 225 3 2 3
34 0.6 20.0 5.550e+04 1.750e+05 151 5 5 5
35 2.3 4.5 9.000e-01 2.600e+03 60 2 1 2
36 0.5 7.5 2.000e+03 1.230e+04 200 3 1 3
37 2.6 2.3 1.040e-01 2.500e+03 46 3 2 2
38 0.6 24.0 4.190e+03 5.800e+04 210 4 3 4
39 6.6 3.0 3.500e+03 3.900e+03 14 2 1 1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) L Wb Wbr Tg P
3.801e+00 1.163e-02 3.562e-06 -9.877e-07 -7.280e-03 9.041e-01
S D
2.613e-01 -1.675e+00
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.25115 -0.53213 0.04849 0.23571 2.46343
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.801e+00 3.819e-01 9.952 3.59e-11 ***
L 1.163e-02 1.575e-02 0.738 0.465813
Wb 3.562e-06 1.853e-06 1.922 0.063797 .
Wbr -9.877e-07 1.112e-06 -0.888 0.381240
Tg -7.280e-03 2.130e-03 -3.418 0.001782 **
P 9.041e-01 3.168e-01 2.854 0.007624 **
S 2.613e-01 2.016e-01 1.296 0.204516
D -1.675e+00 3.869e-01 -4.331 0.000144 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.865 on 31 degrees of freedom
Multiple R-squared: 0.6911, Adjusted R-squared: 0.6213
F-statistic: 9.907 on 7 and 31 DF, p-value: 1.953e-06
> 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.7898815 0.4202371 0.2101185
[2,] 0.7942504 0.4114991 0.2057496
[3,] 0.6974966 0.6050068 0.3025034
[4,] 0.5914139 0.8171722 0.4085861
[5,] 0.4664453 0.9328905 0.5335547
[6,] 0.3539977 0.7079954 0.6460023
[7,] 0.4075017 0.8150033 0.5924983
[8,] 0.3015905 0.6031810 0.6984095
[9,] 0.3086953 0.6173907 0.6913047
[10,] 0.2413223 0.4826446 0.7586777
[11,] 0.4395566 0.8791131 0.5604434
[12,] 0.5493263 0.9013474 0.4506737
[13,] 0.4868740 0.9737480 0.5131260
[14,] 0.3727540 0.7455080 0.6272460
[15,] 0.2675478 0.5350956 0.7324522
[16,] 0.2324642 0.4649284 0.7675358
[17,] 0.2473124 0.4946248 0.7526876
[18,] 0.1530491 0.3060982 0.8469509
> postscript(file="/var/www/html/rcomp/tmp/1kuf81292079711.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/2kuf81292079711.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/3dlxt1292079711.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/4dlxt1292079711.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/5dlxt1292079711.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 = 39
Frequency = 1
1 2 3 4 5 6
0.50827301 -0.10420851 0.07540419 0.64301162 1.07518606 0.19439062
7 8 9 10 11 12
-0.54903880 -0.42460941 -0.09253081 -0.92459801 1.55862309 -0.82319830
13 14 15 16 17 18
0.10920083 0.04849468 -0.51521407 -0.05325607 -1.19517005 0.25148687
19 20 21 22 23 24
-1.20592749 0.47303597 -1.25114744 1.43439751 -0.29874390 -0.08582873
25 26 27 28 29 30
0.21992781 -0.74140863 0.15630087 -0.33134164 0.95198070 -0.59154618
31 32 33 34 35 36
-0.83286004 -0.31202445 0.06673969 0.19113004 0.16756206 0.12573717
37 38 39
-0.77435040 0.39268753 2.46343264
> postscript(file="/var/www/html/rcomp/tmp/65cev1292079711.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 = 39
Frequency = 1
lag(myerror, k = 1) myerror
0 0.50827301 NA
1 -0.10420851 0.50827301
2 0.07540419 -0.10420851
3 0.64301162 0.07540419
4 1.07518606 0.64301162
5 0.19439062 1.07518606
6 -0.54903880 0.19439062
7 -0.42460941 -0.54903880
8 -0.09253081 -0.42460941
9 -0.92459801 -0.09253081
10 1.55862309 -0.92459801
11 -0.82319830 1.55862309
12 0.10920083 -0.82319830
13 0.04849468 0.10920083
14 -0.51521407 0.04849468
15 -0.05325607 -0.51521407
16 -1.19517005 -0.05325607
17 0.25148687 -1.19517005
18 -1.20592749 0.25148687
19 0.47303597 -1.20592749
20 -1.25114744 0.47303597
21 1.43439751 -1.25114744
22 -0.29874390 1.43439751
23 -0.08582873 -0.29874390
24 0.21992781 -0.08582873
25 -0.74140863 0.21992781
26 0.15630087 -0.74140863
27 -0.33134164 0.15630087
28 0.95198070 -0.33134164
29 -0.59154618 0.95198070
30 -0.83286004 -0.59154618
31 -0.31202445 -0.83286004
32 0.06673969 -0.31202445
33 0.19113004 0.06673969
34 0.16756206 0.19113004
35 0.12573717 0.16756206
36 -0.77435040 0.12573717
37 0.39268753 -0.77435040
38 2.46343264 0.39268753
39 NA 2.46343264
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.10420851 0.50827301
[2,] 0.07540419 -0.10420851
[3,] 0.64301162 0.07540419
[4,] 1.07518606 0.64301162
[5,] 0.19439062 1.07518606
[6,] -0.54903880 0.19439062
[7,] -0.42460941 -0.54903880
[8,] -0.09253081 -0.42460941
[9,] -0.92459801 -0.09253081
[10,] 1.55862309 -0.92459801
[11,] -0.82319830 1.55862309
[12,] 0.10920083 -0.82319830
[13,] 0.04849468 0.10920083
[14,] -0.51521407 0.04849468
[15,] -0.05325607 -0.51521407
[16,] -1.19517005 -0.05325607
[17,] 0.25148687 -1.19517005
[18,] -1.20592749 0.25148687
[19,] 0.47303597 -1.20592749
[20,] -1.25114744 0.47303597
[21,] 1.43439751 -1.25114744
[22,] -0.29874390 1.43439751
[23,] -0.08582873 -0.29874390
[24,] 0.21992781 -0.08582873
[25,] -0.74140863 0.21992781
[26,] 0.15630087 -0.74140863
[27,] -0.33134164 0.15630087
[28,] 0.95198070 -0.33134164
[29,] -0.59154618 0.95198070
[30,] -0.83286004 -0.59154618
[31,] -0.31202445 -0.83286004
[32,] 0.06673969 -0.31202445
[33,] 0.19113004 0.06673969
[34,] 0.16756206 0.19113004
[35,] 0.12573717 0.16756206
[36,] -0.77435040 0.12573717
[37,] 0.39268753 -0.77435040
[38,] 2.46343264 0.39268753
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.10420851 0.50827301
2 0.07540419 -0.10420851
3 0.64301162 0.07540419
4 1.07518606 0.64301162
5 0.19439062 1.07518606
6 -0.54903880 0.19439062
7 -0.42460941 -0.54903880
8 -0.09253081 -0.42460941
9 -0.92459801 -0.09253081
10 1.55862309 -0.92459801
11 -0.82319830 1.55862309
12 0.10920083 -0.82319830
13 0.04849468 0.10920083
14 -0.51521407 0.04849468
15 -0.05325607 -0.51521407
16 -1.19517005 -0.05325607
17 0.25148687 -1.19517005
18 -1.20592749 0.25148687
19 0.47303597 -1.20592749
20 -1.25114744 0.47303597
21 1.43439751 -1.25114744
22 -0.29874390 1.43439751
23 -0.08582873 -0.29874390
24 0.21992781 -0.08582873
25 -0.74140863 0.21992781
26 0.15630087 -0.74140863
27 -0.33134164 0.15630087
28 0.95198070 -0.33134164
29 -0.59154618 0.95198070
30 -0.83286004 -0.59154618
31 -0.31202445 -0.83286004
32 0.06673969 -0.31202445
33 0.19113004 0.06673969
34 0.16756206 0.19113004
35 0.12573717 0.16756206
36 -0.77435040 0.12573717
37 0.39268753 -0.77435040
38 2.46343264 0.39268753
> 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/7ylvh1292079711.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/8ylvh1292079711.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/9ylvh1292079711.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')
Warning messages:
1: In sqrt(crit * p * (1 - hh)/hh) : NaNs produced
2: In sqrt(crit * p * (1 - hh)/hh) : NaNs produced
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/www/html/rcomp/tmp/10rdu21292079711.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/11vdbq1292079711.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/12gesd1292079711.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/13u5741292079711.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/14fooa1292079711.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/151o4g1292079711.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/16mpl41292079711.tab")
+ }
>
> try(system("convert tmp/1kuf81292079711.ps tmp/1kuf81292079711.png",intern=TRUE))
character(0)
> try(system("convert tmp/2kuf81292079711.ps tmp/2kuf81292079711.png",intern=TRUE))
character(0)
> try(system("convert tmp/3dlxt1292079711.ps tmp/3dlxt1292079711.png",intern=TRUE))
character(0)
> try(system("convert tmp/4dlxt1292079711.ps tmp/4dlxt1292079711.png",intern=TRUE))
character(0)
> try(system("convert tmp/5dlxt1292079711.ps tmp/5dlxt1292079711.png",intern=TRUE))
character(0)
> try(system("convert tmp/65cev1292079711.ps tmp/65cev1292079711.png",intern=TRUE))
character(0)
> try(system("convert tmp/7ylvh1292079711.ps tmp/7ylvh1292079711.png",intern=TRUE))
character(0)
> try(system("convert tmp/8ylvh1292079711.ps tmp/8ylvh1292079711.png",intern=TRUE))
character(0)
> try(system("convert tmp/9ylvh1292079711.ps tmp/9ylvh1292079711.png",intern=TRUE))
character(0)
> try(system("convert tmp/10rdu21292079711.ps tmp/10rdu21292079711.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.278 1.645 7.254