R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-pc-linux-gnu (32-bit)
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(2564,2820,3508,3088,3299,2939,3320,3418,3604,3495,4163,4882,2211,3260,2992,2425,2707,3244,3965,3315,3333,3583,4021,4904,2252,2952,3573,3048,3059,2731,3563,3092,3478,3478,4308,5029,2075,3264,3308,3688,3136,2824,3644,4694,2914,3686,4358,5587,2265,3685,3754,3708,3210,3517,3905,3670,4221,4404,5086,5725),dim=c(1,60),dimnames=list(c('Sales'),1:60))
> y <- array(NA,dim=c(1,60),dimnames=list(c('Sales'),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
> 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
Sales M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 2564 1 0 0 0 0 0 0 0 0 0 0 1
2 2820 0 1 0 0 0 0 0 0 0 0 0 2
3 3508 0 0 1 0 0 0 0 0 0 0 0 3
4 3088 0 0 0 1 0 0 0 0 0 0 0 4
5 3299 0 0 0 0 1 0 0 0 0 0 0 5
6 2939 0 0 0 0 0 1 0 0 0 0 0 6
7 3320 0 0 0 0 0 0 1 0 0 0 0 7
8 3418 0 0 0 0 0 0 0 1 0 0 0 8
9 3604 0 0 0 0 0 0 0 0 1 0 0 9
10 3495 0 0 0 0 0 0 0 0 0 1 0 10
11 4163 0 0 0 0 0 0 0 0 0 0 1 11
12 4882 0 0 0 0 0 0 0 0 0 0 0 12
13 2211 1 0 0 0 0 0 0 0 0 0 0 13
14 3260 0 1 0 0 0 0 0 0 0 0 0 14
15 2992 0 0 1 0 0 0 0 0 0 0 0 15
16 2425 0 0 0 1 0 0 0 0 0 0 0 16
17 2707 0 0 0 0 1 0 0 0 0 0 0 17
18 3244 0 0 0 0 0 1 0 0 0 0 0 18
19 3965 0 0 0 0 0 0 1 0 0 0 0 19
20 3315 0 0 0 0 0 0 0 1 0 0 0 20
21 3333 0 0 0 0 0 0 0 0 1 0 0 21
22 3583 0 0 0 0 0 0 0 0 0 1 0 22
23 4021 0 0 0 0 0 0 0 0 0 0 1 23
24 4904 0 0 0 0 0 0 0 0 0 0 0 24
25 2252 1 0 0 0 0 0 0 0 0 0 0 25
26 2952 0 1 0 0 0 0 0 0 0 0 0 26
27 3573 0 0 1 0 0 0 0 0 0 0 0 27
28 3048 0 0 0 1 0 0 0 0 0 0 0 28
29 3059 0 0 0 0 1 0 0 0 0 0 0 29
30 2731 0 0 0 0 0 1 0 0 0 0 0 30
31 3563 0 0 0 0 0 0 1 0 0 0 0 31
32 3092 0 0 0 0 0 0 0 1 0 0 0 32
33 3478 0 0 0 0 0 0 0 0 1 0 0 33
34 3478 0 0 0 0 0 0 0 0 0 1 0 34
35 4308 0 0 0 0 0 0 0 0 0 0 1 35
36 5029 0 0 0 0 0 0 0 0 0 0 0 36
37 2075 1 0 0 0 0 0 0 0 0 0 0 37
38 3264 0 1 0 0 0 0 0 0 0 0 0 38
39 3308 0 0 1 0 0 0 0 0 0 0 0 39
40 3688 0 0 0 1 0 0 0 0 0 0 0 40
41 3136 0 0 0 0 1 0 0 0 0 0 0 41
42 2824 0 0 0 0 0 1 0 0 0 0 0 42
43 3644 0 0 0 0 0 0 1 0 0 0 0 43
44 4694 0 0 0 0 0 0 0 1 0 0 0 44
45 2914 0 0 0 0 0 0 0 0 1 0 0 45
46 3686 0 0 0 0 0 0 0 0 0 1 0 46
47 4358 0 0 0 0 0 0 0 0 0 0 1 47
48 5587 0 0 0 0 0 0 0 0 0 0 0 48
49 2265 1 0 0 0 0 0 0 0 0 0 0 49
50 3685 0 1 0 0 0 0 0 0 0 0 0 50
51 3754 0 0 1 0 0 0 0 0 0 0 0 51
52 3708 0 0 0 1 0 0 0 0 0 0 0 52
53 3210 0 0 0 0 1 0 0 0 0 0 0 53
54 3517 0 0 0 0 0 1 0 0 0 0 0 54
55 3905 0 0 0 0 0 0 1 0 0 0 0 55
56 3670 0 0 0 0 0 0 0 1 0 0 0 56
57 4221 0 0 0 0 0 0 0 0 1 0 0 57
58 4404 0 0 0 0 0 0 0 0 0 1 0 58
59 5086 0 0 0 0 0 0 0 0 0 0 1 59
60 5725 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) M1 M2 M3 M4 M5
4842.45 -2834.99 -1922.82 -1702.66 -1948.90 -2068.74
M6 M7 M8 M9 M10 M11
-2110.57 -1492.81 -1545.05 -1683.49 -1474.93 -827.56
t
10.64
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-723.65 -195.46 -40.68 216.40 928.55
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4842.450 177.459 27.288 < 2e-16 ***
M1 -2834.987 215.889 -13.132 < 2e-16 ***
M2 -1922.825 215.567 -8.920 1.12e-11 ***
M3 -1702.663 215.274 -7.909 3.48e-10 ***
M4 -1948.900 215.013 -9.064 6.92e-12 ***
M5 -2068.737 214.781 -9.632 1.06e-12 ***
M6 -2110.575 214.581 -9.836 5.45e-13 ***
M7 -1492.812 214.411 -6.962 9.32e-09 ***
M8 -1545.050 214.272 -7.211 3.92e-09 ***
M9 -1683.487 214.163 -7.861 4.11e-10 ***
M10 -1474.925 214.086 -6.889 1.20e-08 ***
M11 -827.562 214.040 -3.866 0.000338 ***
t 10.637 2.574 4.132 0.000147 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 338.4 on 47 degrees of freedom
Multiple R-squared: 0.8545, Adjusted R-squared: 0.8173
F-statistic: 22.99 on 12 and 47 DF, p-value: 1.09e-15
> 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.631629269 0.736741462 0.3683707
[2,] 0.511884107 0.976231785 0.4881159
[3,] 0.599795289 0.800409422 0.4002047
[4,] 0.798803148 0.402393704 0.2011969
[5,] 0.700347385 0.599305229 0.2996526
[6,] 0.615815375 0.768369249 0.3841846
[7,] 0.531433572 0.937132856 0.4685664
[8,] 0.420522687 0.841045375 0.5794773
[9,] 0.322525829 0.645051657 0.6774742
[10,] 0.273483314 0.546966629 0.7265167
[11,] 0.194962776 0.389925552 0.8050372
[12,] 0.224067724 0.448135448 0.7759323
[13,] 0.194384822 0.388769644 0.8056152
[14,] 0.151603449 0.303206897 0.8483966
[15,] 0.123636918 0.247273836 0.8763631
[16,] 0.088734771 0.177469543 0.9112652
[17,] 0.095238600 0.190477201 0.9047614
[18,] 0.075596992 0.151193984 0.9244030
[19,] 0.046146958 0.092293916 0.9538530
[20,] 0.032078283 0.064156566 0.9679217
[21,] 0.019520923 0.039041846 0.9804791
[22,] 0.011935164 0.023870329 0.9880648
[23,] 0.007850982 0.015701963 0.9921490
[24,] 0.003735002 0.007470003 0.9962650
[25,] 0.011481730 0.022963460 0.9885183
[26,] 0.006173824 0.012347648 0.9938262
[27,] 0.003260928 0.006521856 0.9967391
[28,] 0.001218093 0.002436187 0.9987819
[29,] 0.381012442 0.762024884 0.6189876
> postscript(file="/var/wessaorg/rcomp/tmp/1iprb1322503230.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/wessaorg/rcomp/tmp/2m81i1322503230.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/wessaorg/rcomp/tmp/35ntc1322503230.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/wessaorg/rcomp/tmp/4zdot1322503230.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/wessaorg/rcomp/tmp/5zr3k1322503230.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 60
Frequency = 1
1 2 3 4 5 6 7 8 9 10
545.90 -120.90 336.30 151.90 472.10 143.30 -104.10 35.50 349.30 21.10
11 12 13 14 15 16 17 18 19 20
31.10 -88.10 65.25 191.45 -307.35 -638.75 -247.55 320.65 413.25 -195.15
21 22 23 24 25 26 27 28 29 30
-49.35 -18.55 -238.55 -193.75 -21.40 -244.20 146.00 -143.40 -23.20 -320.00
31 32 33 34 35 36 37 38 39 40
-116.40 -545.80 -32.00 -251.20 -79.20 -196.40 -326.05 -59.85 -246.65 368.95
41 42 43 44 45 46 47 48 49 50
-73.85 -354.65 -163.05 928.55 -723.65 -170.85 -156.85 233.95 -263.70 233.50
51 52 53 54 55 56 57 58 59 60
71.70 261.30 -127.50 210.70 -29.70 -223.10 455.70 419.50 443.50 244.30
> postscript(file="/var/wessaorg/rcomp/tmp/6c6hc1322503230.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 545.90 NA
1 -120.90 545.90
2 336.30 -120.90
3 151.90 336.30
4 472.10 151.90
5 143.30 472.10
6 -104.10 143.30
7 35.50 -104.10
8 349.30 35.50
9 21.10 349.30
10 31.10 21.10
11 -88.10 31.10
12 65.25 -88.10
13 191.45 65.25
14 -307.35 191.45
15 -638.75 -307.35
16 -247.55 -638.75
17 320.65 -247.55
18 413.25 320.65
19 -195.15 413.25
20 -49.35 -195.15
21 -18.55 -49.35
22 -238.55 -18.55
23 -193.75 -238.55
24 -21.40 -193.75
25 -244.20 -21.40
26 146.00 -244.20
27 -143.40 146.00
28 -23.20 -143.40
29 -320.00 -23.20
30 -116.40 -320.00
31 -545.80 -116.40
32 -32.00 -545.80
33 -251.20 -32.00
34 -79.20 -251.20
35 -196.40 -79.20
36 -326.05 -196.40
37 -59.85 -326.05
38 -246.65 -59.85
39 368.95 -246.65
40 -73.85 368.95
41 -354.65 -73.85
42 -163.05 -354.65
43 928.55 -163.05
44 -723.65 928.55
45 -170.85 -723.65
46 -156.85 -170.85
47 233.95 -156.85
48 -263.70 233.95
49 233.50 -263.70
50 71.70 233.50
51 261.30 71.70
52 -127.50 261.30
53 210.70 -127.50
54 -29.70 210.70
55 -223.10 -29.70
56 455.70 -223.10
57 419.50 455.70
58 443.50 419.50
59 244.30 443.50
60 NA 244.30
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -120.90 545.90
[2,] 336.30 -120.90
[3,] 151.90 336.30
[4,] 472.10 151.90
[5,] 143.30 472.10
[6,] -104.10 143.30
[7,] 35.50 -104.10
[8,] 349.30 35.50
[9,] 21.10 349.30
[10,] 31.10 21.10
[11,] -88.10 31.10
[12,] 65.25 -88.10
[13,] 191.45 65.25
[14,] -307.35 191.45
[15,] -638.75 -307.35
[16,] -247.55 -638.75
[17,] 320.65 -247.55
[18,] 413.25 320.65
[19,] -195.15 413.25
[20,] -49.35 -195.15
[21,] -18.55 -49.35
[22,] -238.55 -18.55
[23,] -193.75 -238.55
[24,] -21.40 -193.75
[25,] -244.20 -21.40
[26,] 146.00 -244.20
[27,] -143.40 146.00
[28,] -23.20 -143.40
[29,] -320.00 -23.20
[30,] -116.40 -320.00
[31,] -545.80 -116.40
[32,] -32.00 -545.80
[33,] -251.20 -32.00
[34,] -79.20 -251.20
[35,] -196.40 -79.20
[36,] -326.05 -196.40
[37,] -59.85 -326.05
[38,] -246.65 -59.85
[39,] 368.95 -246.65
[40,] -73.85 368.95
[41,] -354.65 -73.85
[42,] -163.05 -354.65
[43,] 928.55 -163.05
[44,] -723.65 928.55
[45,] -170.85 -723.65
[46,] -156.85 -170.85
[47,] 233.95 -156.85
[48,] -263.70 233.95
[49,] 233.50 -263.70
[50,] 71.70 233.50
[51,] 261.30 71.70
[52,] -127.50 261.30
[53,] 210.70 -127.50
[54,] -29.70 210.70
[55,] -223.10 -29.70
[56,] 455.70 -223.10
[57,] 419.50 455.70
[58,] 443.50 419.50
[59,] 244.30 443.50
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -120.90 545.90
2 336.30 -120.90
3 151.90 336.30
4 472.10 151.90
5 143.30 472.10
6 -104.10 143.30
7 35.50 -104.10
8 349.30 35.50
9 21.10 349.30
10 31.10 21.10
11 -88.10 31.10
12 65.25 -88.10
13 191.45 65.25
14 -307.35 191.45
15 -638.75 -307.35
16 -247.55 -638.75
17 320.65 -247.55
18 413.25 320.65
19 -195.15 413.25
20 -49.35 -195.15
21 -18.55 -49.35
22 -238.55 -18.55
23 -193.75 -238.55
24 -21.40 -193.75
25 -244.20 -21.40
26 146.00 -244.20
27 -143.40 146.00
28 -23.20 -143.40
29 -320.00 -23.20
30 -116.40 -320.00
31 -545.80 -116.40
32 -32.00 -545.80
33 -251.20 -32.00
34 -79.20 -251.20
35 -196.40 -79.20
36 -326.05 -196.40
37 -59.85 -326.05
38 -246.65 -59.85
39 368.95 -246.65
40 -73.85 368.95
41 -354.65 -73.85
42 -163.05 -354.65
43 928.55 -163.05
44 -723.65 928.55
45 -170.85 -723.65
46 -156.85 -170.85
47 233.95 -156.85
48 -263.70 233.95
49 233.50 -263.70
50 71.70 233.50
51 261.30 71.70
52 -127.50 261.30
53 210.70 -127.50
54 -29.70 210.70
55 -223.10 -29.70
56 455.70 -223.10
57 419.50 455.70
58 443.50 419.50
59 244.30 443.50
> 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/wessaorg/rcomp/tmp/7iuee1322503230.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/wessaorg/rcomp/tmp/8n7e61322503230.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/wessaorg/rcomp/tmp/9w6ij1322503230.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/wessaorg/rcomp/tmp/10fj1k1322503230.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/117vx61322503230.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/wessaorg/rcomp/tmp/128m081322503230.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/wessaorg/rcomp/tmp/13d3tq1322503230.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/wessaorg/rcomp/tmp/149a3s1322503230.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/wessaorg/rcomp/tmp/155i6t1322503230.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/wessaorg/rcomp/tmp/16pl0m1322503230.tab")
+ }
>
> try(system("convert tmp/1iprb1322503230.ps tmp/1iprb1322503230.png",intern=TRUE))
character(0)
> try(system("convert tmp/2m81i1322503230.ps tmp/2m81i1322503230.png",intern=TRUE))
character(0)
> try(system("convert tmp/35ntc1322503230.ps tmp/35ntc1322503230.png",intern=TRUE))
character(0)
> try(system("convert tmp/4zdot1322503230.ps tmp/4zdot1322503230.png",intern=TRUE))
character(0)
> try(system("convert tmp/5zr3k1322503230.ps tmp/5zr3k1322503230.png",intern=TRUE))
character(0)
> try(system("convert tmp/6c6hc1322503230.ps tmp/6c6hc1322503230.png",intern=TRUE))
character(0)
> try(system("convert tmp/7iuee1322503230.ps tmp/7iuee1322503230.png",intern=TRUE))
character(0)
> try(system("convert tmp/8n7e61322503230.ps tmp/8n7e61322503230.png",intern=TRUE))
character(0)
> try(system("convert tmp/9w6ij1322503230.ps tmp/9w6ij1322503230.png",intern=TRUE))
character(0)
> try(system("convert tmp/10fj1k1322503230.ps tmp/10fj1k1322503230.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.265 0.529 3.818