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(93.0,0,99.2,0,112.2,0,112.1,0,103.3,0,108.2,0,90.4,0,72.8,0,111.0,0,117.9,0,111.3,0,110.5,0,94.8,0,100.4,0,132.1,0,114.6,0,101.9,0,130.2,0,84.0,0,86.4,0,122.3,0,120.9,0,110.2,0,112.6,0,102.0,0,105.0,0,130.5,0,115.5,0,103.7,0,130.9,0,89.1,0,93.8,0,123.8,0,111.9,0,118.3,0,116.9,0,103.6,1,116.6,1,141.3,1,107.0,1,125.2,1,136.4,1,91.6,1,95.3,1,132.3,1,130.6,1,131.9,1,118.6,1,114.3,1,111.3,1,126.5,1,112.1,1,119.3,1,142.4,1,101.1,1,97.4,1,129.1,1,136.9,1,129.8,1,123.9,1),dim=c(2,60),dimnames=list(c('INV','INVA'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('INV','INVA'),1:60))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = 'Linear Trend'
> par2 = 'Include Monthly Dummies'
> par1 = '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from package:base :
as.Date.numeric
> n25 <- 25 #minimum number of obs. for Goldfeld-Quandt test
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
INV INVA M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 93.0 0 1 0 0 0 0 0 0 0 0 0 0 1
2 99.2 0 0 1 0 0 0 0 0 0 0 0 0 2
3 112.2 0 0 0 1 0 0 0 0 0 0 0 0 3
4 112.1 0 0 0 0 1 0 0 0 0 0 0 0 4
5 103.3 0 0 0 0 0 1 0 0 0 0 0 0 5
6 108.2 0 0 0 0 0 0 1 0 0 0 0 0 6
7 90.4 0 0 0 0 0 0 0 1 0 0 0 0 7
8 72.8 0 0 0 0 0 0 0 0 1 0 0 0 8
9 111.0 0 0 0 0 0 0 0 0 0 1 0 0 9
10 117.9 0 0 0 0 0 0 0 0 0 0 1 0 10
11 111.3 0 0 0 0 0 0 0 0 0 0 0 1 11
12 110.5 0 0 0 0 0 0 0 0 0 0 0 0 12
13 94.8 0 1 0 0 0 0 0 0 0 0 0 0 13
14 100.4 0 0 1 0 0 0 0 0 0 0 0 0 14
15 132.1 0 0 0 1 0 0 0 0 0 0 0 0 15
16 114.6 0 0 0 0 1 0 0 0 0 0 0 0 16
17 101.9 0 0 0 0 0 1 0 0 0 0 0 0 17
18 130.2 0 0 0 0 0 0 1 0 0 0 0 0 18
19 84.0 0 0 0 0 0 0 0 1 0 0 0 0 19
20 86.4 0 0 0 0 0 0 0 0 1 0 0 0 20
21 122.3 0 0 0 0 0 0 0 0 0 1 0 0 21
22 120.9 0 0 0 0 0 0 0 0 0 0 1 0 22
23 110.2 0 0 0 0 0 0 0 0 0 0 0 1 23
24 112.6 0 0 0 0 0 0 0 0 0 0 0 0 24
25 102.0 0 1 0 0 0 0 0 0 0 0 0 0 25
26 105.0 0 0 1 0 0 0 0 0 0 0 0 0 26
27 130.5 0 0 0 1 0 0 0 0 0 0 0 0 27
28 115.5 0 0 0 0 1 0 0 0 0 0 0 0 28
29 103.7 0 0 0 0 0 1 0 0 0 0 0 0 29
30 130.9 0 0 0 0 0 0 1 0 0 0 0 0 30
31 89.1 0 0 0 0 0 0 0 1 0 0 0 0 31
32 93.8 0 0 0 0 0 0 0 0 1 0 0 0 32
33 123.8 0 0 0 0 0 0 0 0 0 1 0 0 33
34 111.9 0 0 0 0 0 0 0 0 0 0 1 0 34
35 118.3 0 0 0 0 0 0 0 0 0 0 0 1 35
36 116.9 0 0 0 0 0 0 0 0 0 0 0 0 36
37 103.6 1 1 0 0 0 0 0 0 0 0 0 0 37
38 116.6 1 0 1 0 0 0 0 0 0 0 0 0 38
39 141.3 1 0 0 1 0 0 0 0 0 0 0 0 39
40 107.0 1 0 0 0 1 0 0 0 0 0 0 0 40
41 125.2 1 0 0 0 0 1 0 0 0 0 0 0 41
42 136.4 1 0 0 0 0 0 1 0 0 0 0 0 42
43 91.6 1 0 0 0 0 0 0 1 0 0 0 0 43
44 95.3 1 0 0 0 0 0 0 0 1 0 0 0 44
45 132.3 1 0 0 0 0 0 0 0 0 1 0 0 45
46 130.6 1 0 0 0 0 0 0 0 0 0 1 0 46
47 131.9 1 0 0 0 0 0 0 0 0 0 0 1 47
48 118.6 1 0 0 0 0 0 0 0 0 0 0 0 48
49 114.3 1 1 0 0 0 0 0 0 0 0 0 0 49
50 111.3 1 0 1 0 0 0 0 0 0 0 0 0 50
51 126.5 1 0 0 1 0 0 0 0 0 0 0 0 51
52 112.1 1 0 0 0 1 0 0 0 0 0 0 0 52
53 119.3 1 0 0 0 0 1 0 0 0 0 0 0 53
54 142.4 1 0 0 0 0 0 1 0 0 0 0 0 54
55 101.1 1 0 0 0 0 0 0 1 0 0 0 0 55
56 97.4 1 0 0 0 0 0 0 0 1 0 0 0 56
57 129.1 1 0 0 0 0 0 0 0 0 1 0 0 57
58 136.9 1 0 0 0 0 0 0 0 0 0 1 0 58
59 129.8 1 0 0 0 0 0 0 0 0 0 0 1 59
60 123.9 1 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) INVA M1 M2 M3 M4
104.7650 2.7500 -11.7104 -7.0458 14.6788 -1.8767
M5 M6 M7 M8 M9 M10
-3.7521 14.8925 -23.7829 -26.1783 8.0863 7.7308
M11 t
4.0954 0.2954
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-13.230 -3.105 0.850 3.285 9.325
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 104.76500 3.42105 30.624 < 2e-16 ***
INVA 2.75000 3.07219 0.895 0.375379
M1 -11.71042 3.81352 -3.071 0.003578 **
M2 -7.04583 3.79180 -1.858 0.069550 .
M3 14.67875 3.77204 3.891 0.000319 ***
M4 -1.87667 3.75428 -0.500 0.619547
M5 -3.75208 3.73853 -1.004 0.320810
M6 14.89250 3.72483 3.998 0.000229 ***
M7 -23.78292 3.71320 -6.405 7.14e-08 ***
M8 -26.17833 3.70366 -7.068 7.20e-09 ***
M9 8.08625 3.69622 2.188 0.033810 *
M10 7.73083 3.69089 2.095 0.041746 *
M11 4.09542 3.68769 1.111 0.272528
t 0.29542 0.08869 3.331 0.001713 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.829 on 46 degrees of freedom
Multiple R-squared: 0.8887, Adjusted R-squared: 0.8572
F-statistic: 28.25 on 13 and 46 DF, p-value: < 2.2e-16
> if (n > n25) {
+ kp3 <- k + 3
+ nmkm3 <- n - k - 3
+ gqarr <- array(NA, dim=c(nmkm3-kp3+1,3))
+ numgqtests <- 0
+ numsignificant1 <- 0
+ numsignificant5 <- 0
+ numsignificant10 <- 0
+ for (mypoint in kp3:nmkm3) {
+ j <- 0
+ numgqtests <- numgqtests + 1
+ for (myalt in c('greater', 'two.sided', 'less')) {
+ j <- j + 1
+ gqarr[mypoint-kp3+1,j] <- gqtest(mylm, point=mypoint, alternative=myalt)$p.value
+ }
+ if (gqarr[mypoint-kp3+1,2] < 0.01) numsignificant1 <- numsignificant1 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.05) numsignificant5 <- numsignificant5 + 1
+ if (gqarr[mypoint-kp3+1,2] < 0.10) numsignificant10 <- numsignificant10 + 1
+ }
+ gqarr
+ }
[,1] [,2] [,3]
[1,] 0.8354381 0.3291238 0.16456188
[2,] 0.9294529 0.1410941 0.07054707
[3,] 0.9433582 0.1132835 0.05664176
[4,] 0.9188046 0.1623907 0.08119537
[5,] 0.8726616 0.2546768 0.12733839
[6,] 0.8128164 0.3743671 0.18718356
[7,] 0.8133739 0.3732522 0.18662609
[8,] 0.7408370 0.5183260 0.25916301
[9,] 0.6470808 0.7058384 0.35291922
[10,] 0.5548260 0.8903479 0.44517396
[11,] 0.4673876 0.9347752 0.53261241
[12,] 0.5988165 0.8023670 0.40118348
[13,] 0.6137622 0.7724755 0.38623776
[14,] 0.5386115 0.9227770 0.46138851
[15,] 0.4667273 0.9334545 0.53327275
[16,] 0.4881401 0.9762802 0.51185992
[17,] 0.4184997 0.8369995 0.58150027
[18,] 0.6398797 0.7202405 0.36012027
[19,] 0.5870358 0.8259284 0.41296421
[20,] 0.4782503 0.9565006 0.52174968
[21,] 0.4904743 0.9809486 0.50952571
[22,] 0.4446500 0.8893000 0.55534998
[23,] 0.8047708 0.3904584 0.19522921
[24,] 0.8212418 0.3575163 0.17875817
[25,] 0.8896632 0.2206735 0.11033677
[26,] 0.8053638 0.3892724 0.19463619
[27,] 0.8134530 0.3730940 0.18654698
> postscript(file="/var/www/html/freestat/rcomp/tmp/19i751229619687.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/2ba3r1229619687.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/3fz4u1229619687.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/4hagy1229619687.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/535ka1229619687.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 60
Frequency = 1
1 2 3 4 5 6 7 8 9 10
-0.350 0.890 -8.130 8.030 0.810 -13.230 7.350 -8.150 -4.510 2.450
11 12 13 14 15 16 17 18 19 20
-0.810 2.190 -2.095 -1.455 8.225 6.985 -4.135 5.225 -2.595 1.905
21 22 23 24 25 26 27 28 29 30
3.245 1.905 -5.455 0.745 1.560 -0.400 3.080 4.340 -5.880 2.380
31 32 33 34 35 36 37 38 39 40
-1.040 5.760 1.200 -10.640 -0.900 1.500 -3.135 4.905 7.585 -10.455
41 42 43 44 45 46 47 48 49 50
9.325 1.585 -4.835 0.965 3.405 1.765 6.405 -3.095 4.020 -3.940
51 52 53 54 55 56 57 58 59 60
-10.760 -8.900 -0.120 4.040 1.120 -0.480 -3.340 4.520 0.760 -1.340
> postscript(file="/var/www/html/freestat/rcomp/tmp/6lo7s1229619687.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.350 NA
1 0.890 -0.350
2 -8.130 0.890
3 8.030 -8.130
4 0.810 8.030
5 -13.230 0.810
6 7.350 -13.230
7 -8.150 7.350
8 -4.510 -8.150
9 2.450 -4.510
10 -0.810 2.450
11 2.190 -0.810
12 -2.095 2.190
13 -1.455 -2.095
14 8.225 -1.455
15 6.985 8.225
16 -4.135 6.985
17 5.225 -4.135
18 -2.595 5.225
19 1.905 -2.595
20 3.245 1.905
21 1.905 3.245
22 -5.455 1.905
23 0.745 -5.455
24 1.560 0.745
25 -0.400 1.560
26 3.080 -0.400
27 4.340 3.080
28 -5.880 4.340
29 2.380 -5.880
30 -1.040 2.380
31 5.760 -1.040
32 1.200 5.760
33 -10.640 1.200
34 -0.900 -10.640
35 1.500 -0.900
36 -3.135 1.500
37 4.905 -3.135
38 7.585 4.905
39 -10.455 7.585
40 9.325 -10.455
41 1.585 9.325
42 -4.835 1.585
43 0.965 -4.835
44 3.405 0.965
45 1.765 3.405
46 6.405 1.765
47 -3.095 6.405
48 4.020 -3.095
49 -3.940 4.020
50 -10.760 -3.940
51 -8.900 -10.760
52 -0.120 -8.900
53 4.040 -0.120
54 1.120 4.040
55 -0.480 1.120
56 -3.340 -0.480
57 4.520 -3.340
58 0.760 4.520
59 -1.340 0.760
60 NA -1.340
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.890 -0.350
[2,] -8.130 0.890
[3,] 8.030 -8.130
[4,] 0.810 8.030
[5,] -13.230 0.810
[6,] 7.350 -13.230
[7,] -8.150 7.350
[8,] -4.510 -8.150
[9,] 2.450 -4.510
[10,] -0.810 2.450
[11,] 2.190 -0.810
[12,] -2.095 2.190
[13,] -1.455 -2.095
[14,] 8.225 -1.455
[15,] 6.985 8.225
[16,] -4.135 6.985
[17,] 5.225 -4.135
[18,] -2.595 5.225
[19,] 1.905 -2.595
[20,] 3.245 1.905
[21,] 1.905 3.245
[22,] -5.455 1.905
[23,] 0.745 -5.455
[24,] 1.560 0.745
[25,] -0.400 1.560
[26,] 3.080 -0.400
[27,] 4.340 3.080
[28,] -5.880 4.340
[29,] 2.380 -5.880
[30,] -1.040 2.380
[31,] 5.760 -1.040
[32,] 1.200 5.760
[33,] -10.640 1.200
[34,] -0.900 -10.640
[35,] 1.500 -0.900
[36,] -3.135 1.500
[37,] 4.905 -3.135
[38,] 7.585 4.905
[39,] -10.455 7.585
[40,] 9.325 -10.455
[41,] 1.585 9.325
[42,] -4.835 1.585
[43,] 0.965 -4.835
[44,] 3.405 0.965
[45,] 1.765 3.405
[46,] 6.405 1.765
[47,] -3.095 6.405
[48,] 4.020 -3.095
[49,] -3.940 4.020
[50,] -10.760 -3.940
[51,] -8.900 -10.760
[52,] -0.120 -8.900
[53,] 4.040 -0.120
[54,] 1.120 4.040
[55,] -0.480 1.120
[56,] -3.340 -0.480
[57,] 4.520 -3.340
[58,] 0.760 4.520
[59,] -1.340 0.760
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.890 -0.350
2 -8.130 0.890
3 8.030 -8.130
4 0.810 8.030
5 -13.230 0.810
6 7.350 -13.230
7 -8.150 7.350
8 -4.510 -8.150
9 2.450 -4.510
10 -0.810 2.450
11 2.190 -0.810
12 -2.095 2.190
13 -1.455 -2.095
14 8.225 -1.455
15 6.985 8.225
16 -4.135 6.985
17 5.225 -4.135
18 -2.595 5.225
19 1.905 -2.595
20 3.245 1.905
21 1.905 3.245
22 -5.455 1.905
23 0.745 -5.455
24 1.560 0.745
25 -0.400 1.560
26 3.080 -0.400
27 4.340 3.080
28 -5.880 4.340
29 2.380 -5.880
30 -1.040 2.380
31 5.760 -1.040
32 1.200 5.760
33 -10.640 1.200
34 -0.900 -10.640
35 1.500 -0.900
36 -3.135 1.500
37 4.905 -3.135
38 7.585 4.905
39 -10.455 7.585
40 9.325 -10.455
41 1.585 9.325
42 -4.835 1.585
43 0.965 -4.835
44 3.405 0.965
45 1.765 3.405
46 6.405 1.765
47 -3.095 6.405
48 4.020 -3.095
49 -3.940 4.020
50 -10.760 -3.940
51 -8.900 -10.760
52 -0.120 -8.900
53 4.040 -0.120
54 1.120 4.040
55 -0.480 1.120
56 -3.340 -0.480
57 4.520 -3.340
58 0.760 4.520
59 -1.340 0.760
> 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/7ofnl1229619687.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/8skpq1229619687.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/9yx931229619687.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/10mtal1229619687.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/11q8sl1229619687.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/12ddfg1229619687.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/13c2sr1229619688.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/14hy4m1229619688.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/15i9me1229619688.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/16q9z71229619688.tab")
+ }
>
> system("convert tmp/19i751229619687.ps tmp/19i751229619687.png")
> system("convert tmp/2ba3r1229619687.ps tmp/2ba3r1229619687.png")
> system("convert tmp/3fz4u1229619687.ps tmp/3fz4u1229619687.png")
> system("convert tmp/4hagy1229619687.ps tmp/4hagy1229619687.png")
> system("convert tmp/535ka1229619687.ps tmp/535ka1229619687.png")
> system("convert tmp/6lo7s1229619687.ps tmp/6lo7s1229619687.png")
> system("convert tmp/7ofnl1229619687.ps tmp/7ofnl1229619687.png")
> system("convert tmp/8skpq1229619687.ps tmp/8skpq1229619687.png")
> system("convert tmp/9yx931229619687.ps tmp/9yx931229619687.png")
> system("convert tmp/10mtal1229619687.ps tmp/10mtal1229619687.png")
>
>
> proc.time()
user system elapsed
3.593 2.459 3.911