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(103.63,100.30,103.64,98.50,103.66,95.10,103.77,93.10,103.88,92.20,103.91,89.00,103.91,86.40,103.92,84.50,104.05,82.70,104.23,80.80,104.30,81.80,104.31,81.80,104.31,82.90,104.34,83.80,104.55,86.20,104.65,86.10,104.73,86.20,104.75,88.80,104.75,89.60,104.76,87.80,104.94,88.30,105.29,88.60,105.38,91.00,105.43,91.50,105.43,95.40,105.42,98.70,105.52,99.90,105.69,98.60,105.72,100.30,105.74,100.20,105.74,100.40,105.74,101.40,105.95,103.00,106.17,109.10,106.34,111.40,106.37,114.10,106.37,121.80,106.36,127.60,106.44,129.90,106.29,128.00,106.23,123.50,106.23,124.00,106.23,127.40,106.23,127.60,106.34,128.40,106.44,131.40,106.44,135.10,106.48,134.00,106.50,144.50,106.57,147.30,106.40,150.90,106.37,148.70,106.25,141.40,106.21,138.90,106.21,139.80,106.24,145.60,106.19,147.90,106.08,148.50,106.13,151.10,106.09,157.50),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 = '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
Y X
1 103.63 100.3
2 103.64 98.5
3 103.66 95.1
4 103.77 93.1
5 103.88 92.2
6 103.91 89.0
7 103.91 86.4
8 103.92 84.5
9 104.05 82.7
10 104.23 80.8
11 104.30 81.8
12 104.31 81.8
13 104.31 82.9
14 104.34 83.8
15 104.55 86.2
16 104.65 86.1
17 104.73 86.2
18 104.75 88.8
19 104.75 89.6
20 104.76 87.8
21 104.94 88.3
22 105.29 88.6
23 105.38 91.0
24 105.43 91.5
25 105.43 95.4
26 105.42 98.7
27 105.52 99.9
28 105.69 98.6
29 105.72 100.3
30 105.74 100.2
31 105.74 100.4
32 105.74 101.4
33 105.95 103.0
34 106.17 109.1
35 106.34 111.4
36 106.37 114.1
37 106.37 121.8
38 106.36 127.6
39 106.44 129.9
40 106.29 128.0
41 106.23 123.5
42 106.23 124.0
43 106.23 127.4
44 106.23 127.6
45 106.34 128.4
46 106.44 131.4
47 106.44 135.1
48 106.48 134.0
49 106.50 144.5
50 106.57 147.3
51 106.40 150.9
52 106.37 148.7
53 106.25 141.4
54 106.21 138.9
55 106.21 139.8
56 106.24 145.6
57 106.19 147.9
58 106.08 148.5
59 106.13 151.1
60 106.09 157.5
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X
101.8460 0.0324
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.46587 -0.30151 0.04795 0.39805 0.88447
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.018e+02 3.609e-01 282.22 < 2e-16 ***
X 3.240e-02 3.184e-03 10.18 1.61e-14 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.5846 on 58 degrees of freedom
Multiple R-squared: 0.641, Adjusted R-squared: 0.6348
F-statistic: 103.6 on 1 and 58 DF, p-value: 1.614e-14
> 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,] 3.531901e-03 7.063802e-03 9.964681e-01
[2,] 4.759627e-04 9.519255e-04 9.995240e-01
[3,] 9.764895e-05 1.952979e-04 9.999024e-01
[4,] 2.540178e-05 5.080357e-05 9.999746e-01
[5,] 5.459452e-06 1.091890e-05 9.999945e-01
[6,] 1.300483e-05 2.600966e-05 9.999870e-01
[7,] 4.605621e-05 9.211242e-05 9.999539e-01
[8,] 5.608904e-05 1.121781e-04 9.999439e-01
[9,] 7.942114e-05 1.588423e-04 9.999206e-01
[10,] 1.932006e-04 3.864013e-04 9.998068e-01
[11,] 8.790908e-03 1.758182e-02 9.912091e-01
[12,] 7.227006e-02 1.445401e-01 9.277299e-01
[13,] 2.498708e-01 4.997416e-01 7.501292e-01
[14,] 5.837189e-01 8.325621e-01 4.162811e-01
[15,] 8.513619e-01 2.972761e-01 1.486381e-01
[16,] 9.612342e-01 7.753163e-02 3.876581e-02
[17,] 9.953437e-01 9.312678e-03 4.656339e-03
[18,] 9.996900e-01 6.199980e-04 3.099990e-04
[19,] 9.999811e-01 3.775828e-05 1.887914e-05
[20,] 9.999980e-01 4.044062e-06 2.022031e-06
[21,] 9.999998e-01 4.464179e-07 2.232090e-07
[22,] 1.000000e+00 4.739038e-08 2.369519e-08
[23,] 1.000000e+00 8.116364e-09 4.058182e-09
[24,] 1.000000e+00 3.629951e-09 1.814976e-09
[25,] 1.000000e+00 2.036640e-09 1.018320e-09
[26,] 1.000000e+00 1.096743e-09 5.483713e-10
[27,] 1.000000e+00 3.346702e-10 1.673351e-10
[28,] 1.000000e+00 1.926457e-11 9.632285e-12
[29,] 1.000000e+00 3.474883e-12 1.737442e-12
[30,] 1.000000e+00 6.227130e-12 3.113565e-12
[31,] 1.000000e+00 2.852492e-11 1.426246e-11
[32,] 1.000000e+00 1.405258e-10 7.026288e-11
[33,] 1.000000e+00 6.230167e-10 3.115084e-10
[34,] 1.000000e+00 2.314731e-09 1.157366e-09
[35,] 1.000000e+00 6.368044e-09 3.184022e-09
[36,] 1.000000e+00 2.583149e-08 1.291575e-08
[37,] 1.000000e+00 8.901132e-08 4.450566e-08
[38,] 9.999999e-01 2.690361e-07 1.345180e-07
[39,] 9.999996e-01 7.059392e-07 3.529696e-07
[40,] 9.999993e-01 1.426236e-06 7.131178e-07
[41,] 9.999977e-01 4.653361e-06 2.326680e-06
[42,] 9.999907e-01 1.863050e-05 9.315250e-06
[43,] 9.999670e-01 6.608829e-05 3.304415e-05
[44,] 9.999025e-01 1.949537e-04 9.747687e-05
[45,] 9.998752e-01 2.495477e-04 1.247739e-04
[46,] 9.999763e-01 4.739332e-05 2.369666e-05
[47,] 9.999869e-01 2.623612e-05 1.311806e-05
[48,] 9.999988e-01 2.377401e-06 1.188701e-06
[49,] 9.999890e-01 2.207029e-05 1.103515e-05
[50,] 9.998669e-01 2.662965e-04 1.331482e-04
[51,] 9.985760e-01 2.847933e-03 1.423967e-03
> postscript(file="/var/www/html/rcomp/tmp/1byzl1258203663.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/2naan1258203663.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/3luek1258203663.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/45sy81258203663.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/5xky61258203663.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
-1.4658724951 -1.3975492774 -1.2673831996 -1.0925796244 -0.9534180155
6 7 8 9 10
-0.8197322952 -0.7354876475 -0.6639242511 -0.4756010334 -0.2340376370
11 12 13 14 15
-0.1964394246 -0.1864394246 -0.2220813909 -0.2212429998 -0.0890072900
16 17 18 19 20
0.0142328888 0.0909927100 0.0267480623 0.0008266322 0.0691498499
21 22 23 24 25
0.2329489561 0.5732284198 0.5854641296 0.6192632358 0.4928962641
26 27 28 29 30
0.3759703651 0.4370882200 0.6492105438 0.6241275049 0.6473676837
31 32 33 34 35
0.6408873262 0.6084855386 0.7666426784 0.7889917741 0.8844676626
36 37 38 39 40
0.8269828361 0.5774890716 0.3795587036 0.3850345921 0.2965979886
41 42 43 44 45
0.3824060327 0.3662051389 0.2560390611 0.2495587036 0.3336372735
46 47 48 49 50
0.3364319107 0.2165452966 0.2921872630 -0.0280315067 -0.0487565120
51 52 53 54 55
-0.3354029474 -0.2941190146 -0.1775859652 -0.1365814962 -0.1657431051
56 57 58 59 60
-0.3236734731 -0.4481975846 -0.5776386571 -0.6118833049 -0.8592547455
> postscript(file="/var/www/html/rcomp/tmp/6w30j1258203663.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 -1.4658724951 NA
1 -1.3975492774 -1.4658724951
2 -1.2673831996 -1.3975492774
3 -1.0925796244 -1.2673831996
4 -0.9534180155 -1.0925796244
5 -0.8197322952 -0.9534180155
6 -0.7354876475 -0.8197322952
7 -0.6639242511 -0.7354876475
8 -0.4756010334 -0.6639242511
9 -0.2340376370 -0.4756010334
10 -0.1964394246 -0.2340376370
11 -0.1864394246 -0.1964394246
12 -0.2220813909 -0.1864394246
13 -0.2212429998 -0.2220813909
14 -0.0890072900 -0.2212429998
15 0.0142328888 -0.0890072900
16 0.0909927100 0.0142328888
17 0.0267480623 0.0909927100
18 0.0008266322 0.0267480623
19 0.0691498499 0.0008266322
20 0.2329489561 0.0691498499
21 0.5732284198 0.2329489561
22 0.5854641296 0.5732284198
23 0.6192632358 0.5854641296
24 0.4928962641 0.6192632358
25 0.3759703651 0.4928962641
26 0.4370882200 0.3759703651
27 0.6492105438 0.4370882200
28 0.6241275049 0.6492105438
29 0.6473676837 0.6241275049
30 0.6408873262 0.6473676837
31 0.6084855386 0.6408873262
32 0.7666426784 0.6084855386
33 0.7889917741 0.7666426784
34 0.8844676626 0.7889917741
35 0.8269828361 0.8844676626
36 0.5774890716 0.8269828361
37 0.3795587036 0.5774890716
38 0.3850345921 0.3795587036
39 0.2965979886 0.3850345921
40 0.3824060327 0.2965979886
41 0.3662051389 0.3824060327
42 0.2560390611 0.3662051389
43 0.2495587036 0.2560390611
44 0.3336372735 0.2495587036
45 0.3364319107 0.3336372735
46 0.2165452966 0.3364319107
47 0.2921872630 0.2165452966
48 -0.0280315067 0.2921872630
49 -0.0487565120 -0.0280315067
50 -0.3354029474 -0.0487565120
51 -0.2941190146 -0.3354029474
52 -0.1775859652 -0.2941190146
53 -0.1365814962 -0.1775859652
54 -0.1657431051 -0.1365814962
55 -0.3236734731 -0.1657431051
56 -0.4481975846 -0.3236734731
57 -0.5776386571 -0.4481975846
58 -0.6118833049 -0.5776386571
59 -0.8592547455 -0.6118833049
60 NA -0.8592547455
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.3975492774 -1.4658724951
[2,] -1.2673831996 -1.3975492774
[3,] -1.0925796244 -1.2673831996
[4,] -0.9534180155 -1.0925796244
[5,] -0.8197322952 -0.9534180155
[6,] -0.7354876475 -0.8197322952
[7,] -0.6639242511 -0.7354876475
[8,] -0.4756010334 -0.6639242511
[9,] -0.2340376370 -0.4756010334
[10,] -0.1964394246 -0.2340376370
[11,] -0.1864394246 -0.1964394246
[12,] -0.2220813909 -0.1864394246
[13,] -0.2212429998 -0.2220813909
[14,] -0.0890072900 -0.2212429998
[15,] 0.0142328888 -0.0890072900
[16,] 0.0909927100 0.0142328888
[17,] 0.0267480623 0.0909927100
[18,] 0.0008266322 0.0267480623
[19,] 0.0691498499 0.0008266322
[20,] 0.2329489561 0.0691498499
[21,] 0.5732284198 0.2329489561
[22,] 0.5854641296 0.5732284198
[23,] 0.6192632358 0.5854641296
[24,] 0.4928962641 0.6192632358
[25,] 0.3759703651 0.4928962641
[26,] 0.4370882200 0.3759703651
[27,] 0.6492105438 0.4370882200
[28,] 0.6241275049 0.6492105438
[29,] 0.6473676837 0.6241275049
[30,] 0.6408873262 0.6473676837
[31,] 0.6084855386 0.6408873262
[32,] 0.7666426784 0.6084855386
[33,] 0.7889917741 0.7666426784
[34,] 0.8844676626 0.7889917741
[35,] 0.8269828361 0.8844676626
[36,] 0.5774890716 0.8269828361
[37,] 0.3795587036 0.5774890716
[38,] 0.3850345921 0.3795587036
[39,] 0.2965979886 0.3850345921
[40,] 0.3824060327 0.2965979886
[41,] 0.3662051389 0.3824060327
[42,] 0.2560390611 0.3662051389
[43,] 0.2495587036 0.2560390611
[44,] 0.3336372735 0.2495587036
[45,] 0.3364319107 0.3336372735
[46,] 0.2165452966 0.3364319107
[47,] 0.2921872630 0.2165452966
[48,] -0.0280315067 0.2921872630
[49,] -0.0487565120 -0.0280315067
[50,] -0.3354029474 -0.0487565120
[51,] -0.2941190146 -0.3354029474
[52,] -0.1775859652 -0.2941190146
[53,] -0.1365814962 -0.1775859652
[54,] -0.1657431051 -0.1365814962
[55,] -0.3236734731 -0.1657431051
[56,] -0.4481975846 -0.3236734731
[57,] -0.5776386571 -0.4481975846
[58,] -0.6118833049 -0.5776386571
[59,] -0.8592547455 -0.6118833049
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.3975492774 -1.4658724951
2 -1.2673831996 -1.3975492774
3 -1.0925796244 -1.2673831996
4 -0.9534180155 -1.0925796244
5 -0.8197322952 -0.9534180155
6 -0.7354876475 -0.8197322952
7 -0.6639242511 -0.7354876475
8 -0.4756010334 -0.6639242511
9 -0.2340376370 -0.4756010334
10 -0.1964394246 -0.2340376370
11 -0.1864394246 -0.1964394246
12 -0.2220813909 -0.1864394246
13 -0.2212429998 -0.2220813909
14 -0.0890072900 -0.2212429998
15 0.0142328888 -0.0890072900
16 0.0909927100 0.0142328888
17 0.0267480623 0.0909927100
18 0.0008266322 0.0267480623
19 0.0691498499 0.0008266322
20 0.2329489561 0.0691498499
21 0.5732284198 0.2329489561
22 0.5854641296 0.5732284198
23 0.6192632358 0.5854641296
24 0.4928962641 0.6192632358
25 0.3759703651 0.4928962641
26 0.4370882200 0.3759703651
27 0.6492105438 0.4370882200
28 0.6241275049 0.6492105438
29 0.6473676837 0.6241275049
30 0.6408873262 0.6473676837
31 0.6084855386 0.6408873262
32 0.7666426784 0.6084855386
33 0.7889917741 0.7666426784
34 0.8844676626 0.7889917741
35 0.8269828361 0.8844676626
36 0.5774890716 0.8269828361
37 0.3795587036 0.5774890716
38 0.3850345921 0.3795587036
39 0.2965979886 0.3850345921
40 0.3824060327 0.2965979886
41 0.3662051389 0.3824060327
42 0.2560390611 0.3662051389
43 0.2495587036 0.2560390611
44 0.3336372735 0.2495587036
45 0.3364319107 0.3336372735
46 0.2165452966 0.3364319107
47 0.2921872630 0.2165452966
48 -0.0280315067 0.2921872630
49 -0.0487565120 -0.0280315067
50 -0.3354029474 -0.0487565120
51 -0.2941190146 -0.3354029474
52 -0.1775859652 -0.2941190146
53 -0.1365814962 -0.1775859652
54 -0.1657431051 -0.1365814962
55 -0.3236734731 -0.1657431051
56 -0.4481975846 -0.3236734731
57 -0.5776386571 -0.4481975846
58 -0.6118833049 -0.5776386571
59 -0.8592547455 -0.6118833049
> 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/705ef1258203663.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/8xsuu1258203663.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/90foy1258203663.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/10udlw1258203663.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/11iw761258203663.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/126syk1258203663.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/13aiix1258203663.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/148ko71258203663.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/15r9vy1258203663.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/168rbk1258203664.tab")
+ }
>
> system("convert tmp/1byzl1258203663.ps tmp/1byzl1258203663.png")
> system("convert tmp/2naan1258203663.ps tmp/2naan1258203663.png")
> system("convert tmp/3luek1258203663.ps tmp/3luek1258203663.png")
> system("convert tmp/45sy81258203663.ps tmp/45sy81258203663.png")
> system("convert tmp/5xky61258203663.ps tmp/5xky61258203663.png")
> system("convert tmp/6w30j1258203663.ps tmp/6w30j1258203663.png")
> system("convert tmp/705ef1258203663.ps tmp/705ef1258203663.png")
> system("convert tmp/8xsuu1258203663.ps tmp/8xsuu1258203663.png")
> system("convert tmp/90foy1258203663.ps tmp/90foy1258203663.png")
> system("convert tmp/10udlw1258203663.ps tmp/10udlw1258203663.png")
>
>
> proc.time()
user system elapsed
2.448 1.535 3.542