R version 2.8.0 (2008-10-20)
Copyright (C) 2008 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.57,0,97.74,0,97.92,0,98.19,0,98.23,0,98.41,0,98.59,0,98.71,0,99.14,0,99.62,0,100.18,1,100.66,1,101.19,1,101.75,1,102.2,1,102.87,1,98.81,0,97.6,0,96.68,0,95.96,0,98.89,0,99.05,0,99.2,0,99.11,0,99.19,0,99.77,0,100.6956867,0,100.7751938,0,100.5267342,0,101.013715,0,100.9242695,0,101.1031604,0,103.1107136,0,102.991453,0,102.3057046,0,102.6137945,0,103.6772014,0,104.7207315,0,107.6624925,0,108.8749752,0,108.1196581,0,107.6128006,0,106.4201948,0,105.6052475,0,105.7145697,0,105.4859869,0,105.5654939,0,105.177897,0,106.0922282,0,106.3406877,0,108.4675015,1,116.8654343,1,121.0793083,1,123.2657523,1,124.1800835,1,125.6012721,1,126.5652952,1,127.1814749,1,128.0361757,1,128.5529716,1,129.6660704,1),dim=c(2,61),dimnames=list(c('elektrictietsindex','dumivariable'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('elektrictietsindex','dumivariable'),1:61))
> 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
elektrictietsindex dumivariable
1 97.5700 0
2 97.7400 0
3 97.9200 0
4 98.1900 0
5 98.2300 0
6 98.4100 0
7 98.5900 0
8 98.7100 0
9 99.1400 0
10 99.6200 0
11 100.1800 1
12 100.6600 1
13 101.1900 1
14 101.7500 1
15 102.2000 1
16 102.8700 1
17 98.8100 0
18 97.6000 0
19 96.6800 0
20 95.9600 0
21 98.8900 0
22 99.0500 0
23 99.2000 0
24 99.1100 0
25 99.1900 0
26 99.7700 0
27 100.6957 0
28 100.7752 0
29 100.5267 0
30 101.0137 0
31 100.9243 0
32 101.1032 0
33 103.1107 0
34 102.9915 0
35 102.3057 0
36 102.6138 0
37 103.6772 0
38 104.7207 0
39 107.6625 0
40 108.8750 0
41 108.1197 0
42 107.6128 0
43 106.4202 0
44 105.6052 0
45 105.7146 0
46 105.4860 0
47 105.5655 0
48 105.1779 0
49 106.0922 0
50 106.3407 0
51 108.4675 1
52 116.8654 1
53 121.0793 1
54 123.2658 1
55 124.1801 1
56 125.6013 1
57 126.5653 1
58 127.1815 1
59 128.0362 1
60 128.5530 1
61 129.6661 1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) dumivariable
101.63 14.16
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-15.603 -3.215 -0.701 4.467 13.883
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 101.625 1.047 97.070 < 2e-16 ***
dumivariable 14.158 1.983 7.139 1.57e-09 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 6.945 on 59 degrees of freedom
Multiple R-squared: 0.4635, Adjusted R-squared: 0.4544
F-statistic: 50.97 on 1 and 59 DF, p-value: 1.573e-09
> 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,] 1.348537e-04 2.697074e-04 0.99986515
[2,] 1.271620e-05 2.543240e-05 0.99998728
[3,] 1.629145e-06 3.258291e-06 0.99999837
[4,] 2.223819e-07 4.447639e-07 0.99999978
[5,] 8.080171e-08 1.616034e-07 0.99999992
[6,] 5.714068e-08 1.142814e-07 0.99999994
[7,] 7.279875e-09 1.455975e-08 0.99999999
[8,] 1.241936e-09 2.483872e-09 1.00000000
[9,] 3.943951e-10 7.887903e-10 1.00000000
[10,] 3.292685e-10 6.585370e-10 1.00000000
[11,] 7.511886e-10 1.502377e-09 1.00000000
[12,] 1.218921e-08 2.437841e-08 0.99999999
[13,] 2.642265e-09 5.284530e-09 1.00000000
[14,] 9.916133e-10 1.983227e-09 1.00000000
[15,] 1.934266e-09 3.868531e-09 1.00000000
[16,] 1.196649e-08 2.393298e-08 0.99999999
[17,] 4.672574e-09 9.345149e-09 1.00000000
[18,] 2.035373e-09 4.070745e-09 1.00000000
[19,] 9.923461e-10 1.984692e-09 1.00000000
[20,] 4.538603e-10 9.077207e-10 1.00000000
[21,] 2.250929e-10 4.501859e-10 1.00000000
[22,] 1.938661e-10 3.877321e-10 1.00000000
[23,] 5.448302e-10 1.089660e-09 1.00000000
[24,] 1.171161e-09 2.342322e-09 1.00000000
[25,] 1.500346e-09 3.000691e-09 1.00000000
[26,] 2.875255e-09 5.750511e-09 1.00000000
[27,] 4.304221e-09 8.608441e-09 1.00000000
[28,] 6.942209e-09 1.388442e-08 0.99999999
[29,] 8.473892e-08 1.694778e-07 0.99999992
[30,] 3.766227e-07 7.532453e-07 0.99999962
[31,] 6.789207e-07 1.357841e-06 0.99999932
[32,] 1.291444e-06 2.582887e-06 0.99999871
[33,] 3.917606e-06 7.835212e-06 0.99999608
[34,] 1.623286e-05 3.246573e-05 0.99998377
[35,] 2.985394e-04 5.970788e-04 0.99970146
[36,] 2.986896e-03 5.973792e-03 0.99701310
[37,] 8.030476e-03 1.606095e-02 0.99196952
[38,] 1.284378e-02 2.568757e-02 0.98715622
[39,] 1.310362e-02 2.620724e-02 0.98689638
[40,] 1.088845e-02 2.177691e-02 0.98911155
[41,] 8.741808e-03 1.748362e-02 0.99125819
[42,] 6.490849e-03 1.298170e-02 0.99350915
[43,] 4.636044e-03 9.272089e-03 0.99536396
[44,] 3.044894e-03 6.089787e-03 0.99695511
[45,] 2.091124e-03 4.182247e-03 0.99790888
[46,] 1.391773e-03 2.783546e-03 0.99860823
[47,] 2.250071e-01 4.500142e-01 0.77499291
[48,] 7.870901e-01 4.258198e-01 0.21290991
[49,] 9.456039e-01 1.087923e-01 0.05439615
[50,] 9.741457e-01 5.170867e-02 0.02585433
[51,] 9.848067e-01 3.038650e-02 0.01519325
[52,] 9.811521e-01 3.769571e-02 0.01884785
> postscript(file="/var/www/html/freestat/rcomp/tmp/1q43u1229947697.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/freestat/rcomp/tmp/2sgln1229947697.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/freestat/rcomp/tmp/3ncw91229947697.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/freestat/rcomp/tmp/4phmk1229947697.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/freestat/rcomp/tmp/5hrbx1229947697.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 = 61
Frequency = 1
1 2 3 4 5 6
-4.0552407 -3.8852407 -3.7052407 -3.4352407 -3.3952407 -3.2152407
7 8 9 10 11 12
-3.0352407 -2.9152407 -2.4852407 -2.0052407 -15.6030200 -15.1230200
13 14 15 16 17 18
-14.5930200 -14.0330200 -13.5830200 -12.9130200 -2.8152407 -4.0252407
19 20 21 22 23 24
-4.9452407 -5.6652407 -2.7352407 -2.5752407 -2.4252407 -2.5152407
25 26 27 28 29 30
-2.4352407 -1.8552407 -0.9295540 -0.8500469 -1.0985065 -0.6115257
31 32 33 34 35 36
-0.7009712 -0.5220803 1.4854729 1.3662123 0.6804639 0.9885538
37 38 39 40 41 42
2.0519607 3.0954908 6.0372518 7.2497345 6.4944174 5.9875599
43 44 45 46 47 48
4.7949541 3.9800068 4.0893290 3.8607462 3.9402532 3.5526563
49 50 51 52 53 54
4.4669875 4.7154470 -7.3155185 1.0824143 5.2962883 7.4827323
55 56 57 58 59 60
8.3970635 9.8182521 10.7822752 11.3984549 12.2531557 12.7699516
61
13.8830504
> postscript(file="/var/www/html/freestat/rcomp/tmp/63r951229947697.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 = 61
Frequency = 1
lag(myerror, k = 1) myerror
0 -4.0552407 NA
1 -3.8852407 -4.0552407
2 -3.7052407 -3.8852407
3 -3.4352407 -3.7052407
4 -3.3952407 -3.4352407
5 -3.2152407 -3.3952407
6 -3.0352407 -3.2152407
7 -2.9152407 -3.0352407
8 -2.4852407 -2.9152407
9 -2.0052407 -2.4852407
10 -15.6030200 -2.0052407
11 -15.1230200 -15.6030200
12 -14.5930200 -15.1230200
13 -14.0330200 -14.5930200
14 -13.5830200 -14.0330200
15 -12.9130200 -13.5830200
16 -2.8152407 -12.9130200
17 -4.0252407 -2.8152407
18 -4.9452407 -4.0252407
19 -5.6652407 -4.9452407
20 -2.7352407 -5.6652407
21 -2.5752407 -2.7352407
22 -2.4252407 -2.5752407
23 -2.5152407 -2.4252407
24 -2.4352407 -2.5152407
25 -1.8552407 -2.4352407
26 -0.9295540 -1.8552407
27 -0.8500469 -0.9295540
28 -1.0985065 -0.8500469
29 -0.6115257 -1.0985065
30 -0.7009712 -0.6115257
31 -0.5220803 -0.7009712
32 1.4854729 -0.5220803
33 1.3662123 1.4854729
34 0.6804639 1.3662123
35 0.9885538 0.6804639
36 2.0519607 0.9885538
37 3.0954908 2.0519607
38 6.0372518 3.0954908
39 7.2497345 6.0372518
40 6.4944174 7.2497345
41 5.9875599 6.4944174
42 4.7949541 5.9875599
43 3.9800068 4.7949541
44 4.0893290 3.9800068
45 3.8607462 4.0893290
46 3.9402532 3.8607462
47 3.5526563 3.9402532
48 4.4669875 3.5526563
49 4.7154470 4.4669875
50 -7.3155185 4.7154470
51 1.0824143 -7.3155185
52 5.2962883 1.0824143
53 7.4827323 5.2962883
54 8.3970635 7.4827323
55 9.8182521 8.3970635
56 10.7822752 9.8182521
57 11.3984549 10.7822752
58 12.2531557 11.3984549
59 12.7699516 12.2531557
60 13.8830504 12.7699516
61 NA 13.8830504
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -3.8852407 -4.0552407
[2,] -3.7052407 -3.8852407
[3,] -3.4352407 -3.7052407
[4,] -3.3952407 -3.4352407
[5,] -3.2152407 -3.3952407
[6,] -3.0352407 -3.2152407
[7,] -2.9152407 -3.0352407
[8,] -2.4852407 -2.9152407
[9,] -2.0052407 -2.4852407
[10,] -15.6030200 -2.0052407
[11,] -15.1230200 -15.6030200
[12,] -14.5930200 -15.1230200
[13,] -14.0330200 -14.5930200
[14,] -13.5830200 -14.0330200
[15,] -12.9130200 -13.5830200
[16,] -2.8152407 -12.9130200
[17,] -4.0252407 -2.8152407
[18,] -4.9452407 -4.0252407
[19,] -5.6652407 -4.9452407
[20,] -2.7352407 -5.6652407
[21,] -2.5752407 -2.7352407
[22,] -2.4252407 -2.5752407
[23,] -2.5152407 -2.4252407
[24,] -2.4352407 -2.5152407
[25,] -1.8552407 -2.4352407
[26,] -0.9295540 -1.8552407
[27,] -0.8500469 -0.9295540
[28,] -1.0985065 -0.8500469
[29,] -0.6115257 -1.0985065
[30,] -0.7009712 -0.6115257
[31,] -0.5220803 -0.7009712
[32,] 1.4854729 -0.5220803
[33,] 1.3662123 1.4854729
[34,] 0.6804639 1.3662123
[35,] 0.9885538 0.6804639
[36,] 2.0519607 0.9885538
[37,] 3.0954908 2.0519607
[38,] 6.0372518 3.0954908
[39,] 7.2497345 6.0372518
[40,] 6.4944174 7.2497345
[41,] 5.9875599 6.4944174
[42,] 4.7949541 5.9875599
[43,] 3.9800068 4.7949541
[44,] 4.0893290 3.9800068
[45,] 3.8607462 4.0893290
[46,] 3.9402532 3.8607462
[47,] 3.5526563 3.9402532
[48,] 4.4669875 3.5526563
[49,] 4.7154470 4.4669875
[50,] -7.3155185 4.7154470
[51,] 1.0824143 -7.3155185
[52,] 5.2962883 1.0824143
[53,] 7.4827323 5.2962883
[54,] 8.3970635 7.4827323
[55,] 9.8182521 8.3970635
[56,] 10.7822752 9.8182521
[57,] 11.3984549 10.7822752
[58,] 12.2531557 11.3984549
[59,] 12.7699516 12.2531557
[60,] 13.8830504 12.7699516
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -3.8852407 -4.0552407
2 -3.7052407 -3.8852407
3 -3.4352407 -3.7052407
4 -3.3952407 -3.4352407
5 -3.2152407 -3.3952407
6 -3.0352407 -3.2152407
7 -2.9152407 -3.0352407
8 -2.4852407 -2.9152407
9 -2.0052407 -2.4852407
10 -15.6030200 -2.0052407
11 -15.1230200 -15.6030200
12 -14.5930200 -15.1230200
13 -14.0330200 -14.5930200
14 -13.5830200 -14.0330200
15 -12.9130200 -13.5830200
16 -2.8152407 -12.9130200
17 -4.0252407 -2.8152407
18 -4.9452407 -4.0252407
19 -5.6652407 -4.9452407
20 -2.7352407 -5.6652407
21 -2.5752407 -2.7352407
22 -2.4252407 -2.5752407
23 -2.5152407 -2.4252407
24 -2.4352407 -2.5152407
25 -1.8552407 -2.4352407
26 -0.9295540 -1.8552407
27 -0.8500469 -0.9295540
28 -1.0985065 -0.8500469
29 -0.6115257 -1.0985065
30 -0.7009712 -0.6115257
31 -0.5220803 -0.7009712
32 1.4854729 -0.5220803
33 1.3662123 1.4854729
34 0.6804639 1.3662123
35 0.9885538 0.6804639
36 2.0519607 0.9885538
37 3.0954908 2.0519607
38 6.0372518 3.0954908
39 7.2497345 6.0372518
40 6.4944174 7.2497345
41 5.9875599 6.4944174
42 4.7949541 5.9875599
43 3.9800068 4.7949541
44 4.0893290 3.9800068
45 3.8607462 4.0893290
46 3.9402532 3.8607462
47 3.5526563 3.9402532
48 4.4669875 3.5526563
49 4.7154470 4.4669875
50 -7.3155185 4.7154470
51 1.0824143 -7.3155185
52 5.2962883 1.0824143
53 7.4827323 5.2962883
54 8.3970635 7.4827323
55 9.8182521 8.3970635
56 10.7822752 9.8182521
57 11.3984549 10.7822752
58 12.2531557 11.3984549
59 12.7699516 12.2531557
60 13.8830504 12.7699516
> 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/freestat/rcomp/tmp/73c3b1229947697.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/freestat/rcomp/tmp/8ps1j1229947697.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/freestat/rcomp/tmp/9xgcz1229947697.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/freestat/rcomp/tmp/10k9ls1229947697.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/11wisu1229947697.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/freestat/rcomp/tmp/12r2p11229947697.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/freestat/rcomp/tmp/1333nh1229947698.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/freestat/rcomp/tmp/14dybb1229947698.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/freestat/rcomp/tmp/151pvl1229947698.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/freestat/rcomp/tmp/16oq8l1229947698.tab")
+ }
>
> system("convert tmp/1q43u1229947697.ps tmp/1q43u1229947697.png")
> system("convert tmp/2sgln1229947697.ps tmp/2sgln1229947697.png")
> system("convert tmp/3ncw91229947697.ps tmp/3ncw91229947697.png")
> system("convert tmp/4phmk1229947697.ps tmp/4phmk1229947697.png")
> system("convert tmp/5hrbx1229947697.ps tmp/5hrbx1229947697.png")
> system("convert tmp/63r951229947697.ps tmp/63r951229947697.png")
> system("convert tmp/73c3b1229947697.ps tmp/73c3b1229947697.png")
> system("convert tmp/8ps1j1229947697.ps tmp/8ps1j1229947697.png")
> system("convert tmp/9xgcz1229947697.ps tmp/9xgcz1229947697.png")
> system("convert tmp/10k9ls1229947697.ps tmp/10k9ls1229947697.png")
>
>
> proc.time()
user system elapsed
3.752 2.515 4.404