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.05,1.00,2.11,1.00,2.09,1.00,2.05,1.00,2.08,1.00,2.06,1.00,2.06,1.00,2.08,1.00,2.07,1.00,2.06,1.00,2.07,1.00,2.06,1.00,2.09,1.00,2.07,1.00,2.09,1.00,2.28,1.25,2.33,1.25,2.35,1.25,2.52,1.50,2.63,1.50,2.58,1.50,2.70,1.75,2.81,1.75,2.97,2.00,3.04,2.00,3.28,2.25,3.33,2.25,3.50,2.50,3.56,2.50,3.57,2.50,3.69,2.75,3.82,2.75,3.79,2.75,3.96,3.00,4.06,3.00,4.05,3.00,4.03,3.00,3.94,3.00,4.02,3.00,3.88,3.00,4.02,3.00,4.03,3.00,4.09,3.00,3.99,3.00,4.01,3.00,4.01,3.00,4.19,3.25,4.30,3.25,4.27,3.25,3.82,3.25,3.15,2.75,2.49,2.00,1.81,1.00,1.26,1.00,1.06,0.50,0.84,0.25,0.78,0.25,0.70,0.25,0.36,0.25,0.35,0.25),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 2.05 1.00 1 0 0 0 0 0 0 0 0 0 0 1
2 2.11 1.00 0 1 0 0 0 0 0 0 0 0 0 2
3 2.09 1.00 0 0 1 0 0 0 0 0 0 0 0 3
4 2.05 1.00 0 0 0 1 0 0 0 0 0 0 0 4
5 2.08 1.00 0 0 0 0 1 0 0 0 0 0 0 5
6 2.06 1.00 0 0 0 0 0 1 0 0 0 0 0 6
7 2.06 1.00 0 0 0 0 0 0 1 0 0 0 0 7
8 2.08 1.00 0 0 0 0 0 0 0 1 0 0 0 8
9 2.07 1.00 0 0 0 0 0 0 0 0 1 0 0 9
10 2.06 1.00 0 0 0 0 0 0 0 0 0 1 0 10
11 2.07 1.00 0 0 0 0 0 0 0 0 0 0 1 11
12 2.06 1.00 0 0 0 0 0 0 0 0 0 0 0 12
13 2.09 1.00 1 0 0 0 0 0 0 0 0 0 0 13
14 2.07 1.00 0 1 0 0 0 0 0 0 0 0 0 14
15 2.09 1.00 0 0 1 0 0 0 0 0 0 0 0 15
16 2.28 1.25 0 0 0 1 0 0 0 0 0 0 0 16
17 2.33 1.25 0 0 0 0 1 0 0 0 0 0 0 17
18 2.35 1.25 0 0 0 0 0 1 0 0 0 0 0 18
19 2.52 1.50 0 0 0 0 0 0 1 0 0 0 0 19
20 2.63 1.50 0 0 0 0 0 0 0 1 0 0 0 20
21 2.58 1.50 0 0 0 0 0 0 0 0 1 0 0 21
22 2.70 1.75 0 0 0 0 0 0 0 0 0 1 0 22
23 2.81 1.75 0 0 0 0 0 0 0 0 0 0 1 23
24 2.97 2.00 0 0 0 0 0 0 0 0 0 0 0 24
25 3.04 2.00 1 0 0 0 0 0 0 0 0 0 0 25
26 3.28 2.25 0 1 0 0 0 0 0 0 0 0 0 26
27 3.33 2.25 0 0 1 0 0 0 0 0 0 0 0 27
28 3.50 2.50 0 0 0 1 0 0 0 0 0 0 0 28
29 3.56 2.50 0 0 0 0 1 0 0 0 0 0 0 29
30 3.57 2.50 0 0 0 0 0 1 0 0 0 0 0 30
31 3.69 2.75 0 0 0 0 0 0 1 0 0 0 0 31
32 3.82 2.75 0 0 0 0 0 0 0 1 0 0 0 32
33 3.79 2.75 0 0 0 0 0 0 0 0 1 0 0 33
34 3.96 3.00 0 0 0 0 0 0 0 0 0 1 0 34
35 4.06 3.00 0 0 0 0 0 0 0 0 0 0 1 35
36 4.05 3.00 0 0 0 0 0 0 0 0 0 0 0 36
37 4.03 3.00 1 0 0 0 0 0 0 0 0 0 0 37
38 3.94 3.00 0 1 0 0 0 0 0 0 0 0 0 38
39 4.02 3.00 0 0 1 0 0 0 0 0 0 0 0 39
40 3.88 3.00 0 0 0 1 0 0 0 0 0 0 0 40
41 4.02 3.00 0 0 0 0 1 0 0 0 0 0 0 41
42 4.03 3.00 0 0 0 0 0 1 0 0 0 0 0 42
43 4.09 3.00 0 0 0 0 0 0 1 0 0 0 0 43
44 3.99 3.00 0 0 0 0 0 0 0 1 0 0 0 44
45 4.01 3.00 0 0 0 0 0 0 0 0 1 0 0 45
46 4.01 3.00 0 0 0 0 0 0 0 0 0 1 0 46
47 4.19 3.25 0 0 0 0 0 0 0 0 0 0 1 47
48 4.30 3.25 0 0 0 0 0 0 0 0 0 0 0 48
49 4.27 3.25 1 0 0 0 0 0 0 0 0 0 0 49
50 3.82 3.25 0 1 0 0 0 0 0 0 0 0 0 50
51 3.15 2.75 0 0 1 0 0 0 0 0 0 0 0 51
52 2.49 2.00 0 0 0 1 0 0 0 0 0 0 0 52
53 1.81 1.00 0 0 0 0 1 0 0 0 0 0 0 53
54 1.26 1.00 0 0 0 0 0 1 0 0 0 0 0 54
55 1.06 0.50 0 0 0 0 0 0 1 0 0 0 0 55
56 0.84 0.25 0 0 0 0 0 0 0 1 0 0 0 56
57 0.78 0.25 0 0 0 0 0 0 0 0 1 0 0 57
58 0.70 0.25 0 0 0 0 0 0 0 0 0 1 0 58
59 0.36 0.25 0 0 0 0 0 0 0 0 0 0 1 59
60 0.35 0.25 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
1.025319 1.147010 0.037809 -0.058801 -0.039360 -0.065270
M5 M6 M7 M8 M9 M10
0.096872 0.003612 0.046352 0.104442 0.091182 0.029221
M11 t
-0.003389 -0.012740
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-0.34050 -0.06028 0.01355 0.08991 0.21602
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.0253189 0.0682239 15.029 <2e-16 ***
X 1.1470099 0.0171660 66.819 <2e-16 ***
M1 0.0378093 0.0789675 0.479 0.634
M2 -0.0588013 0.0788937 -0.745 0.460
M3 -0.0393604 0.0786463 -0.500 0.619
M4 -0.0652700 0.0784931 -0.832 0.410
M5 0.0968719 0.0783399 1.237 0.223
M6 0.0036119 0.0782690 0.046 0.963
M7 0.0463518 0.0782105 0.593 0.556
M8 0.1044422 0.0781840 1.336 0.188
M9 0.0911822 0.0781538 1.167 0.249
M10 0.0292211 0.0780929 0.374 0.710
M11 -0.0033894 0.0780701 -0.043 0.966
t -0.0127399 0.0009878 -12.897 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.1234 on 46 degrees of freedom
Multiple R-squared: 0.9901, Adjusted R-squared: 0.9874
F-statistic: 355.5 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,] 7.138354e-03 1.427671e-02 0.9928616
[2,] 2.228301e-03 4.456601e-03 0.9977717
[3,] 5.437709e-04 1.087542e-03 0.9994562
[4,] 2.612320e-04 5.224640e-04 0.9997388
[5,] 4.390609e-05 8.781217e-05 0.9999561
[6,] 8.979288e-05 1.795858e-04 0.9999102
[7,] 2.193618e-05 4.387236e-05 0.9999781
[8,] 5.777024e-06 1.155405e-05 0.9999942
[9,] 1.317415e-06 2.634830e-06 0.9999987
[10,] 2.665498e-07 5.330995e-07 0.9999997
[11,] 1.645035e-07 3.290071e-07 0.9999998
[12,] 3.524797e-08 7.049594e-08 1.0000000
[13,] 1.034528e-08 2.069056e-08 1.0000000
[14,] 3.285292e-09 6.570583e-09 1.0000000
[15,] 3.545686e-09 7.091371e-09 1.0000000
[16,] 9.631047e-10 1.926209e-09 1.0000000
[17,] 3.182370e-10 6.364739e-10 1.0000000
[18,] 3.835747e-10 7.671495e-10 1.0000000
[19,] 1.505859e-10 3.011718e-10 1.0000000
[20,] 2.444804e-10 4.889607e-10 1.0000000
[21,] 3.689564e-10 7.379128e-10 1.0000000
[22,] 1.049197e-09 2.098394e-09 1.0000000
[23,] 1.806435e-09 3.612870e-09 1.0000000
[24,] 8.306574e-09 1.661315e-08 1.0000000
[25,] 3.148114e-08 6.296228e-08 1.0000000
[26,] 4.433101e-05 8.866201e-05 0.9999557
[27,] 1.193462e-01 2.386924e-01 0.8806538
> postscript(file="/var/www/html/rcomp/tmp/1k1qj1258736941.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/265bp1258736941.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/3sk1v1258736941.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/4kgnp1258736941.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/5b1p51258736941.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
-0.147398044 0.021952450 -0.004748537 -0.006099030 -0.125501002 -0.039501002
7 8 9 10 11 12
-0.069501002 -0.094851496 -0.078851496 -0.014150509 0.041199984 0.040550477
13 14 15 16 17 18
0.045481156 0.134831649 0.148130663 0.090027704 -0.009374268 0.116625732
19 20 21 22 23 24
-0.030126734 0.034522773 0.010522773 -0.081528707 0.073821787 -0.043580186
25 26 27 28 29 30
0.001350493 0.063948521 0.107247534 0.029144576 -0.060257397 0.055742603
31 32 33 34 35 36
-0.141009863 -0.056360356 -0.060360356 -0.102411835 0.042938658 0.042289151
37 38 39 40 41 42
-0.002780170 0.016570323 0.089869337 -0.011481156 -0.020883129 0.095116871
43 44 45 46 47 48
0.125116871 -0.020233622 0.025766378 0.100467364 0.039065392 0.158415885
49 50 51 52 53 54
0.103346564 -0.237302943 -0.340498998 -0.101592094 0.216015796 -0.227984204
55 56 57 58 59 60
0.115520728 0.136922700 0.102922700 0.097623687 -0.197025820 -0.197675327
> postscript(file="/var/www/html/rcomp/tmp/6cjfh1258736941.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 -0.147398044 NA
1 0.021952450 -0.147398044
2 -0.004748537 0.021952450
3 -0.006099030 -0.004748537
4 -0.125501002 -0.006099030
5 -0.039501002 -0.125501002
6 -0.069501002 -0.039501002
7 -0.094851496 -0.069501002
8 -0.078851496 -0.094851496
9 -0.014150509 -0.078851496
10 0.041199984 -0.014150509
11 0.040550477 0.041199984
12 0.045481156 0.040550477
13 0.134831649 0.045481156
14 0.148130663 0.134831649
15 0.090027704 0.148130663
16 -0.009374268 0.090027704
17 0.116625732 -0.009374268
18 -0.030126734 0.116625732
19 0.034522773 -0.030126734
20 0.010522773 0.034522773
21 -0.081528707 0.010522773
22 0.073821787 -0.081528707
23 -0.043580186 0.073821787
24 0.001350493 -0.043580186
25 0.063948521 0.001350493
26 0.107247534 0.063948521
27 0.029144576 0.107247534
28 -0.060257397 0.029144576
29 0.055742603 -0.060257397
30 -0.141009863 0.055742603
31 -0.056360356 -0.141009863
32 -0.060360356 -0.056360356
33 -0.102411835 -0.060360356
34 0.042938658 -0.102411835
35 0.042289151 0.042938658
36 -0.002780170 0.042289151
37 0.016570323 -0.002780170
38 0.089869337 0.016570323
39 -0.011481156 0.089869337
40 -0.020883129 -0.011481156
41 0.095116871 -0.020883129
42 0.125116871 0.095116871
43 -0.020233622 0.125116871
44 0.025766378 -0.020233622
45 0.100467364 0.025766378
46 0.039065392 0.100467364
47 0.158415885 0.039065392
48 0.103346564 0.158415885
49 -0.237302943 0.103346564
50 -0.340498998 -0.237302943
51 -0.101592094 -0.340498998
52 0.216015796 -0.101592094
53 -0.227984204 0.216015796
54 0.115520728 -0.227984204
55 0.136922700 0.115520728
56 0.102922700 0.136922700
57 0.097623687 0.102922700
58 -0.197025820 0.097623687
59 -0.197675327 -0.197025820
60 NA -0.197675327
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.021952450 -0.147398044
[2,] -0.004748537 0.021952450
[3,] -0.006099030 -0.004748537
[4,] -0.125501002 -0.006099030
[5,] -0.039501002 -0.125501002
[6,] -0.069501002 -0.039501002
[7,] -0.094851496 -0.069501002
[8,] -0.078851496 -0.094851496
[9,] -0.014150509 -0.078851496
[10,] 0.041199984 -0.014150509
[11,] 0.040550477 0.041199984
[12,] 0.045481156 0.040550477
[13,] 0.134831649 0.045481156
[14,] 0.148130663 0.134831649
[15,] 0.090027704 0.148130663
[16,] -0.009374268 0.090027704
[17,] 0.116625732 -0.009374268
[18,] -0.030126734 0.116625732
[19,] 0.034522773 -0.030126734
[20,] 0.010522773 0.034522773
[21,] -0.081528707 0.010522773
[22,] 0.073821787 -0.081528707
[23,] -0.043580186 0.073821787
[24,] 0.001350493 -0.043580186
[25,] 0.063948521 0.001350493
[26,] 0.107247534 0.063948521
[27,] 0.029144576 0.107247534
[28,] -0.060257397 0.029144576
[29,] 0.055742603 -0.060257397
[30,] -0.141009863 0.055742603
[31,] -0.056360356 -0.141009863
[32,] -0.060360356 -0.056360356
[33,] -0.102411835 -0.060360356
[34,] 0.042938658 -0.102411835
[35,] 0.042289151 0.042938658
[36,] -0.002780170 0.042289151
[37,] 0.016570323 -0.002780170
[38,] 0.089869337 0.016570323
[39,] -0.011481156 0.089869337
[40,] -0.020883129 -0.011481156
[41,] 0.095116871 -0.020883129
[42,] 0.125116871 0.095116871
[43,] -0.020233622 0.125116871
[44,] 0.025766378 -0.020233622
[45,] 0.100467364 0.025766378
[46,] 0.039065392 0.100467364
[47,] 0.158415885 0.039065392
[48,] 0.103346564 0.158415885
[49,] -0.237302943 0.103346564
[50,] -0.340498998 -0.237302943
[51,] -0.101592094 -0.340498998
[52,] 0.216015796 -0.101592094
[53,] -0.227984204 0.216015796
[54,] 0.115520728 -0.227984204
[55,] 0.136922700 0.115520728
[56,] 0.102922700 0.136922700
[57,] 0.097623687 0.102922700
[58,] -0.197025820 0.097623687
[59,] -0.197675327 -0.197025820
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.021952450 -0.147398044
2 -0.004748537 0.021952450
3 -0.006099030 -0.004748537
4 -0.125501002 -0.006099030
5 -0.039501002 -0.125501002
6 -0.069501002 -0.039501002
7 -0.094851496 -0.069501002
8 -0.078851496 -0.094851496
9 -0.014150509 -0.078851496
10 0.041199984 -0.014150509
11 0.040550477 0.041199984
12 0.045481156 0.040550477
13 0.134831649 0.045481156
14 0.148130663 0.134831649
15 0.090027704 0.148130663
16 -0.009374268 0.090027704
17 0.116625732 -0.009374268
18 -0.030126734 0.116625732
19 0.034522773 -0.030126734
20 0.010522773 0.034522773
21 -0.081528707 0.010522773
22 0.073821787 -0.081528707
23 -0.043580186 0.073821787
24 0.001350493 -0.043580186
25 0.063948521 0.001350493
26 0.107247534 0.063948521
27 0.029144576 0.107247534
28 -0.060257397 0.029144576
29 0.055742603 -0.060257397
30 -0.141009863 0.055742603
31 -0.056360356 -0.141009863
32 -0.060360356 -0.056360356
33 -0.102411835 -0.060360356
34 0.042938658 -0.102411835
35 0.042289151 0.042938658
36 -0.002780170 0.042289151
37 0.016570323 -0.002780170
38 0.089869337 0.016570323
39 -0.011481156 0.089869337
40 -0.020883129 -0.011481156
41 0.095116871 -0.020883129
42 0.125116871 0.095116871
43 -0.020233622 0.125116871
44 0.025766378 -0.020233622
45 0.100467364 0.025766378
46 0.039065392 0.100467364
47 0.158415885 0.039065392
48 0.103346564 0.158415885
49 -0.237302943 0.103346564
50 -0.340498998 -0.237302943
51 -0.101592094 -0.340498998
52 0.216015796 -0.101592094
53 -0.227984204 0.216015796
54 0.115520728 -0.227984204
55 0.136922700 0.115520728
56 0.102922700 0.136922700
57 0.097623687 0.102922700
58 -0.197025820 0.097623687
59 -0.197675327 -0.197025820
> 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/7rief1258736941.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/8fgly1258736941.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/9q3to1258736941.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/10wa4g1258736941.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/115cfi1258736941.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/12e2931258736941.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/13spe81258736941.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/14wy671258736941.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/156p381258736942.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/16wedr1258736942.tab")
+ }
>
> system("convert tmp/1k1qj1258736941.ps tmp/1k1qj1258736941.png")
> system("convert tmp/265bp1258736941.ps tmp/265bp1258736941.png")
> system("convert tmp/3sk1v1258736941.ps tmp/3sk1v1258736941.png")
> system("convert tmp/4kgnp1258736941.ps tmp/4kgnp1258736941.png")
> system("convert tmp/5b1p51258736941.ps tmp/5b1p51258736941.png")
> system("convert tmp/6cjfh1258736941.ps tmp/6cjfh1258736941.png")
> system("convert tmp/7rief1258736941.ps tmp/7rief1258736941.png")
> system("convert tmp/8fgly1258736941.ps tmp/8fgly1258736941.png")
> system("convert tmp/9q3to1258736941.ps tmp/9q3to1258736941.png")
> system("convert tmp/10wa4g1258736941.ps tmp/10wa4g1258736941.png")
>
>
> proc.time()
user system elapsed
2.434 1.602 2.837