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(97.4,116.7,97,109,105.4,119.5,102.7,115.1,98.1,107.1,104.5,109.7,87.4,110.4,89.9,105,109.8,115.8,111.7,116.4,98.6,111.1,96.9,119.5,95.1,110.9,97,115.1,112.7,125.2,102.9,116,97.4,112.9,111.4,121.7,87.4,123.2,96.8,116.6,114.1,136.2,110.3,120.9,103.9,119.6,101.6,125.9,94.6,116.1,95.9,107.5,104.7,116.7,102.8,112.5,98.1,113,113.9,126.4,80.9,114.1,95.7,112.5,113.2,112.4,105.9,113.1,108.8,116.3,102.3,111.7,99,118.8,100.7,116.5,115.5,125.1,100.7,113.1,109.9,119.6,114.6,114.4,85.4,114,100.5,117.8,114.8,117,116.5,120.9,112.9,115,102,117.3,106,119.4,105.3,114.9,118.8,125.8,106.1,117.6,109.3,117.6,117.2,114.9,92.5,121.9,104.2,117,112.5,106.4,122.4,110.5,113.3,113.6,100,114.2),dim=c(2,60),dimnames=list(c('Tip','ipchn'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Tip','ipchn'),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 = '2'
> #'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
ipchn Tip M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 116.7 97.4 1 0 0 0 0 0 0 0 0 0 0 1
2 109.0 97.0 0 1 0 0 0 0 0 0 0 0 0 2
3 119.5 105.4 0 0 1 0 0 0 0 0 0 0 0 3
4 115.1 102.7 0 0 0 1 0 0 0 0 0 0 0 4
5 107.1 98.1 0 0 0 0 1 0 0 0 0 0 0 5
6 109.7 104.5 0 0 0 0 0 1 0 0 0 0 0 6
7 110.4 87.4 0 0 0 0 0 0 1 0 0 0 0 7
8 105.0 89.9 0 0 0 0 0 0 0 1 0 0 0 8
9 115.8 109.8 0 0 0 0 0 0 0 0 1 0 0 9
10 116.4 111.7 0 0 0 0 0 0 0 0 0 1 0 10
11 111.1 98.6 0 0 0 0 0 0 0 0 0 0 1 11
12 119.5 96.9 0 0 0 0 0 0 0 0 0 0 0 12
13 110.9 95.1 1 0 0 0 0 0 0 0 0 0 0 13
14 115.1 97.0 0 1 0 0 0 0 0 0 0 0 0 14
15 125.2 112.7 0 0 1 0 0 0 0 0 0 0 0 15
16 116.0 102.9 0 0 0 1 0 0 0 0 0 0 0 16
17 112.9 97.4 0 0 0 0 1 0 0 0 0 0 0 17
18 121.7 111.4 0 0 0 0 0 1 0 0 0 0 0 18
19 123.2 87.4 0 0 0 0 0 0 1 0 0 0 0 19
20 116.6 96.8 0 0 0 0 0 0 0 1 0 0 0 20
21 136.2 114.1 0 0 0 0 0 0 0 0 1 0 0 21
22 120.9 110.3 0 0 0 0 0 0 0 0 0 1 0 22
23 119.6 103.9 0 0 0 0 0 0 0 0 0 0 1 23
24 125.9 101.6 0 0 0 0 0 0 0 0 0 0 0 24
25 116.1 94.6 1 0 0 0 0 0 0 0 0 0 0 25
26 107.5 95.9 0 1 0 0 0 0 0 0 0 0 0 26
27 116.7 104.7 0 0 1 0 0 0 0 0 0 0 0 27
28 112.5 102.8 0 0 0 1 0 0 0 0 0 0 0 28
29 113.0 98.1 0 0 0 0 1 0 0 0 0 0 0 29
30 126.4 113.9 0 0 0 0 0 1 0 0 0 0 0 30
31 114.1 80.9 0 0 0 0 0 0 1 0 0 0 0 31
32 112.5 95.7 0 0 0 0 0 0 0 1 0 0 0 32
33 112.4 113.2 0 0 0 0 0 0 0 0 1 0 0 33
34 113.1 105.9 0 0 0 0 0 0 0 0 0 1 0 34
35 116.3 108.8 0 0 0 0 0 0 0 0 0 0 1 35
36 111.7 102.3 0 0 0 0 0 0 0 0 0 0 0 36
37 118.8 99.0 1 0 0 0 0 0 0 0 0 0 0 37
38 116.5 100.7 0 1 0 0 0 0 0 0 0 0 0 38
39 125.1 115.5 0 0 1 0 0 0 0 0 0 0 0 39
40 113.1 100.7 0 0 0 1 0 0 0 0 0 0 0 40
41 119.6 109.9 0 0 0 0 1 0 0 0 0 0 0 41
42 114.4 114.6 0 0 0 0 0 1 0 0 0 0 0 42
43 114.0 85.4 0 0 0 0 0 0 1 0 0 0 0 43
44 117.8 100.5 0 0 0 0 0 0 0 1 0 0 0 44
45 117.0 114.8 0 0 0 0 0 0 0 0 1 0 0 45
46 120.9 116.5 0 0 0 0 0 0 0 0 0 1 0 46
47 115.0 112.9 0 0 0 0 0 0 0 0 0 0 1 47
48 117.3 102.0 0 0 0 0 0 0 0 0 0 0 0 48
49 119.4 106.0 1 0 0 0 0 0 0 0 0 0 0 49
50 114.9 105.3 0 1 0 0 0 0 0 0 0 0 0 50
51 125.8 118.8 0 0 1 0 0 0 0 0 0 0 0 51
52 117.6 106.1 0 0 0 1 0 0 0 0 0 0 0 52
53 117.6 109.3 0 0 0 0 1 0 0 0 0 0 0 53
54 114.9 117.2 0 0 0 0 0 1 0 0 0 0 0 54
55 121.9 92.5 0 0 0 0 0 0 1 0 0 0 0 55
56 117.0 104.2 0 0 0 0 0 0 0 1 0 0 0 56
57 106.4 112.5 0 0 0 0 0 0 0 0 1 0 0 57
58 110.5 122.4 0 0 0 0 0 0 0 0 0 1 0 58
59 113.6 113.3 0 0 0 0 0 0 0 0 0 0 1 59
60 114.2 100.0 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) Tip M1 M2 M3 M4
46.4147 0.7465 -0.8923 -5.1351 -4.3078 -5.5476
M5 M6 M7 M8 M9 M10
-5.9047 -9.7061 8.8090 -2.0141 -9.6705 -11.1243
M11 t
-7.8853 -0.1045
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-10.0997 -2.2985 0.1624 2.3746 16.4749
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 46.41468 19.95348 2.326 0.0245 *
Tip 0.74650 0.21024 3.551 0.0009 ***
M1 -0.89230 3.15432 -0.283 0.7785
M2 -5.13512 3.15061 -1.630 0.1100
M3 -4.30779 4.09514 -1.052 0.2983
M4 -5.54756 3.24736 -1.708 0.0943 .
M5 -5.90471 3.21172 -1.838 0.0725 .
M6 -9.70605 4.13659 -2.346 0.0233 *
M7 8.80896 4.14941 2.123 0.0392 *
M8 -2.01410 3.17165 -0.635 0.5286
M9 -9.67051 4.13497 -2.339 0.0238 *
M10 -11.12430 4.17572 -2.664 0.0106 *
M11 -7.88526 3.46686 -2.274 0.0276 *
t -0.10453 0.05326 -1.963 0.0558 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 4.944 on 46 degrees of freedom
Multiple R-squared: 0.3772, Adjusted R-squared: 0.2012
F-statistic: 2.143 on 13 and 46 DF, p-value: 0.02917
> 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.3897958 0.7795917 0.61020415
[2,] 0.2849677 0.5699354 0.71503228
[3,] 0.4635851 0.9271702 0.53641491
[4,] 0.3451864 0.6903727 0.65481364
[5,] 0.7813738 0.4372523 0.21862617
[6,] 0.7048866 0.5902267 0.29511337
[7,] 0.6498762 0.7002476 0.35012380
[8,] 0.6523587 0.6952825 0.34764127
[9,] 0.5696265 0.8607470 0.43037348
[10,] 0.7050780 0.5898440 0.29492199
[11,] 0.6682814 0.6634371 0.33171856
[12,] 0.6963913 0.6072175 0.30360874
[13,] 0.6124182 0.7751636 0.38758178
[14,] 0.7563929 0.4872143 0.24360715
[15,] 0.7045757 0.5908486 0.29542431
[16,] 0.6942551 0.6114899 0.30574493
[17,] 0.8975611 0.2048778 0.10243892
[18,] 0.8404864 0.3190273 0.15951363
[19,] 0.8242331 0.3515337 0.17576687
[20,] 0.9424515 0.1150970 0.05754848
[21,] 0.9007201 0.1985598 0.09927988
[22,] 0.8416429 0.3167142 0.15835708
[23,] 0.7606108 0.4787784 0.23938920
[24,] 0.6823663 0.6352674 0.31763370
[25,] 0.5645712 0.8708576 0.43542879
[26,] 0.4736244 0.9472488 0.52637562
[27,] 0.6142792 0.7714415 0.38572077
> postscript(file="/var/www/html/rcomp/tmp/1ov8b1259063866.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/2x0j71259063866.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/3fsnv1259063866.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/4phff1259063866.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/52rh11259063866.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.427263127 -4.481319374 -0.974746952 -2.014885326 -6.119291999
6 7 8 9 10
-4.391041129 -9.336318626 -5.674992100 -1.969466463 -1.229501056
11 12 13 14 15
0.115182364 2.003505413 -4.255957473 2.873028839 0.530127646
16 17 18 19 20
-0.009837760 1.457608479 3.712434763 4.718029587 2.028483793
21 22 23 24 25
16.474917840 5.569951686 5.913063433 6.149288423 2.571642357
26 27 28 29 30
-2.651469390 -0.743498262 -2.180839224 2.289404428 7.800524889
31 32 33 34 35
1.724648827 0.003985564 -5.398881035 2.308914132 0.209545795
36 37 38 39 40
-7.318915629 3.241376337 4.019663296 0.848615015 1.241165783
41 42 43 44 45
1.335014469 -3.467679162 -0.480267517 2.975118250 -0.738937998
46 47 48 49 50
3.450328056 -2.896769255 -0.240616445 -0.129798094 0.240096629
51 52 53 54 55
0.339502553 2.964396527 1.037264623 -3.654239360 3.373907729
56 57 58 59 60
0.667404494 -8.367632345 -10.099692817 -3.341022336 -0.593261762
> postscript(file="/var/www/html/rcomp/tmp/69gfc1259063866.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.427263127 NA
1 -4.481319374 -1.427263127
2 -0.974746952 -4.481319374
3 -2.014885326 -0.974746952
4 -6.119291999 -2.014885326
5 -4.391041129 -6.119291999
6 -9.336318626 -4.391041129
7 -5.674992100 -9.336318626
8 -1.969466463 -5.674992100
9 -1.229501056 -1.969466463
10 0.115182364 -1.229501056
11 2.003505413 0.115182364
12 -4.255957473 2.003505413
13 2.873028839 -4.255957473
14 0.530127646 2.873028839
15 -0.009837760 0.530127646
16 1.457608479 -0.009837760
17 3.712434763 1.457608479
18 4.718029587 3.712434763
19 2.028483793 4.718029587
20 16.474917840 2.028483793
21 5.569951686 16.474917840
22 5.913063433 5.569951686
23 6.149288423 5.913063433
24 2.571642357 6.149288423
25 -2.651469390 2.571642357
26 -0.743498262 -2.651469390
27 -2.180839224 -0.743498262
28 2.289404428 -2.180839224
29 7.800524889 2.289404428
30 1.724648827 7.800524889
31 0.003985564 1.724648827
32 -5.398881035 0.003985564
33 2.308914132 -5.398881035
34 0.209545795 2.308914132
35 -7.318915629 0.209545795
36 3.241376337 -7.318915629
37 4.019663296 3.241376337
38 0.848615015 4.019663296
39 1.241165783 0.848615015
40 1.335014469 1.241165783
41 -3.467679162 1.335014469
42 -0.480267517 -3.467679162
43 2.975118250 -0.480267517
44 -0.738937998 2.975118250
45 3.450328056 -0.738937998
46 -2.896769255 3.450328056
47 -0.240616445 -2.896769255
48 -0.129798094 -0.240616445
49 0.240096629 -0.129798094
50 0.339502553 0.240096629
51 2.964396527 0.339502553
52 1.037264623 2.964396527
53 -3.654239360 1.037264623
54 3.373907729 -3.654239360
55 0.667404494 3.373907729
56 -8.367632345 0.667404494
57 -10.099692817 -8.367632345
58 -3.341022336 -10.099692817
59 -0.593261762 -3.341022336
60 NA -0.593261762
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -4.481319374 -1.427263127
[2,] -0.974746952 -4.481319374
[3,] -2.014885326 -0.974746952
[4,] -6.119291999 -2.014885326
[5,] -4.391041129 -6.119291999
[6,] -9.336318626 -4.391041129
[7,] -5.674992100 -9.336318626
[8,] -1.969466463 -5.674992100
[9,] -1.229501056 -1.969466463
[10,] 0.115182364 -1.229501056
[11,] 2.003505413 0.115182364
[12,] -4.255957473 2.003505413
[13,] 2.873028839 -4.255957473
[14,] 0.530127646 2.873028839
[15,] -0.009837760 0.530127646
[16,] 1.457608479 -0.009837760
[17,] 3.712434763 1.457608479
[18,] 4.718029587 3.712434763
[19,] 2.028483793 4.718029587
[20,] 16.474917840 2.028483793
[21,] 5.569951686 16.474917840
[22,] 5.913063433 5.569951686
[23,] 6.149288423 5.913063433
[24,] 2.571642357 6.149288423
[25,] -2.651469390 2.571642357
[26,] -0.743498262 -2.651469390
[27,] -2.180839224 -0.743498262
[28,] 2.289404428 -2.180839224
[29,] 7.800524889 2.289404428
[30,] 1.724648827 7.800524889
[31,] 0.003985564 1.724648827
[32,] -5.398881035 0.003985564
[33,] 2.308914132 -5.398881035
[34,] 0.209545795 2.308914132
[35,] -7.318915629 0.209545795
[36,] 3.241376337 -7.318915629
[37,] 4.019663296 3.241376337
[38,] 0.848615015 4.019663296
[39,] 1.241165783 0.848615015
[40,] 1.335014469 1.241165783
[41,] -3.467679162 1.335014469
[42,] -0.480267517 -3.467679162
[43,] 2.975118250 -0.480267517
[44,] -0.738937998 2.975118250
[45,] 3.450328056 -0.738937998
[46,] -2.896769255 3.450328056
[47,] -0.240616445 -2.896769255
[48,] -0.129798094 -0.240616445
[49,] 0.240096629 -0.129798094
[50,] 0.339502553 0.240096629
[51,] 2.964396527 0.339502553
[52,] 1.037264623 2.964396527
[53,] -3.654239360 1.037264623
[54,] 3.373907729 -3.654239360
[55,] 0.667404494 3.373907729
[56,] -8.367632345 0.667404494
[57,] -10.099692817 -8.367632345
[58,] -3.341022336 -10.099692817
[59,] -0.593261762 -3.341022336
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -4.481319374 -1.427263127
2 -0.974746952 -4.481319374
3 -2.014885326 -0.974746952
4 -6.119291999 -2.014885326
5 -4.391041129 -6.119291999
6 -9.336318626 -4.391041129
7 -5.674992100 -9.336318626
8 -1.969466463 -5.674992100
9 -1.229501056 -1.969466463
10 0.115182364 -1.229501056
11 2.003505413 0.115182364
12 -4.255957473 2.003505413
13 2.873028839 -4.255957473
14 0.530127646 2.873028839
15 -0.009837760 0.530127646
16 1.457608479 -0.009837760
17 3.712434763 1.457608479
18 4.718029587 3.712434763
19 2.028483793 4.718029587
20 16.474917840 2.028483793
21 5.569951686 16.474917840
22 5.913063433 5.569951686
23 6.149288423 5.913063433
24 2.571642357 6.149288423
25 -2.651469390 2.571642357
26 -0.743498262 -2.651469390
27 -2.180839224 -0.743498262
28 2.289404428 -2.180839224
29 7.800524889 2.289404428
30 1.724648827 7.800524889
31 0.003985564 1.724648827
32 -5.398881035 0.003985564
33 2.308914132 -5.398881035
34 0.209545795 2.308914132
35 -7.318915629 0.209545795
36 3.241376337 -7.318915629
37 4.019663296 3.241376337
38 0.848615015 4.019663296
39 1.241165783 0.848615015
40 1.335014469 1.241165783
41 -3.467679162 1.335014469
42 -0.480267517 -3.467679162
43 2.975118250 -0.480267517
44 -0.738937998 2.975118250
45 3.450328056 -0.738937998
46 -2.896769255 3.450328056
47 -0.240616445 -2.896769255
48 -0.129798094 -0.240616445
49 0.240096629 -0.129798094
50 0.339502553 0.240096629
51 2.964396527 0.339502553
52 1.037264623 2.964396527
53 -3.654239360 1.037264623
54 3.373907729 -3.654239360
55 0.667404494 3.373907729
56 -8.367632345 0.667404494
57 -10.099692817 -8.367632345
58 -3.341022336 -10.099692817
59 -0.593261762 -3.341022336
> 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/7k3v91259063866.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/8kzae1259063866.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/9waiv1259063866.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/10dnas1259063866.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/11a7dx1259063866.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/122obb1259063866.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/13ptn61259063866.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/14rq1t1259063866.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/15ikj91259063866.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/166atj1259063866.tab")
+ }
>
> system("convert tmp/1ov8b1259063866.ps tmp/1ov8b1259063866.png")
> system("convert tmp/2x0j71259063866.ps tmp/2x0j71259063866.png")
> system("convert tmp/3fsnv1259063866.ps tmp/3fsnv1259063866.png")
> system("convert tmp/4phff1259063866.ps tmp/4phff1259063866.png")
> system("convert tmp/52rh11259063866.ps tmp/52rh11259063866.png")
> system("convert tmp/69gfc1259063866.ps tmp/69gfc1259063866.png")
> system("convert tmp/7k3v91259063866.ps tmp/7k3v91259063866.png")
> system("convert tmp/8kzae1259063866.ps tmp/8kzae1259063866.png")
> system("convert tmp/9waiv1259063866.ps tmp/9waiv1259063866.png")
> system("convert tmp/10dnas1259063866.ps tmp/10dnas1259063866.png")
>
>
> proc.time()
user system elapsed
2.379 1.572 3.322