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(1332.7,0,1343.8,0,1421.6,0,1329.8,0,1306.8,0,1412.8,0,1358.1,0,1163.9,0,1467.9,0,1433.7,0,1362.2,0,1299,0,1291.5,0,1452.7,0,1555.4,0,1402.5,0,1242.9,0,1514.6,0,1308.6,0,1239.3,0,1519.9,0,1659.4,0,1597.6,0,1340.6,0,1427.2,0,1438.1,0,1616.2,0,1392.8,0,1318.7,0,1420.9,0,1221,0,1310,0,1466.7,0,1299.3,0,1640,0,1506.3,0,1530.2,0,1661.9,0,1880.3,1,1230.8,0,1406.5,0,1523.5,0,1323.2,0,1319.2,0,1500.7,0,1483,0,1497,0,1219.8,0,1472.9,0,1423.9,0,1629.6,0,1353.4,0,1366.8,0,1527.1,0,1487.6,0,1478.6,0,1536.7,0,1682.1,0,1576.5,0,1280.5,0),dim=c(2,60),dimnames=list(c('y','x'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('y','x'),1:60))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par3 = '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)
> par1 <- as.numeric(par1)
> x <- t(y)
> k <- length(x[1,])
> n <- length(x[,1])
> x1 <- cbind(x[,par1], x[,1:k!=par1])
> mycolnames <- c(colnames(x)[par1], colnames(x)[1:k!=par1])
> colnames(x1) <- mycolnames #colnames(x)[par1]
> x <- x1
> if (par3 == 'First Differences'){
+ x2 <- array(0, dim=c(n-1,k), dimnames=list(1:(n-1), paste('(1-B)',colnames(x),sep='')))
+ for (i in 1:n-1) {
+ for (j in 1:k) {
+ x2[i,j] <- x[i+1,j] - x[i,j]
+ }
+ }
+ x <- x2
+ }
> if (par2 == 'Include Monthly Dummies'){
+ x2 <- array(0, dim=c(n,11), dimnames=list(1:n, paste('M', seq(1:11), sep ='')))
+ for (i in 1:11){
+ x2[seq(i,n,12),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> if (par2 == 'Include Quarterly Dummies'){
+ x2 <- array(0, dim=c(n,3), dimnames=list(1:n, paste('Q', seq(1:3), sep ='')))
+ for (i in 1:3){
+ x2[seq(i,n,4),i] <- 1
+ }
+ x <- cbind(x, x2)
+ }
> k <- length(x[1,])
> if (par3 == 'Linear Trend'){
+ x <- cbind(x, c(1:n))
+ colnames(x)[k+1] <- 't'
+ }
> x
y x M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 1332.7 0 1 0 0 0 0 0 0 0 0 0 0 1
2 1343.8 0 0 1 0 0 0 0 0 0 0 0 0 2
3 1421.6 0 0 0 1 0 0 0 0 0 0 0 0 3
4 1329.8 0 0 0 0 1 0 0 0 0 0 0 0 4
5 1306.8 0 0 0 0 0 1 0 0 0 0 0 0 5
6 1412.8 0 0 0 0 0 0 1 0 0 0 0 0 6
7 1358.1 0 0 0 0 0 0 0 1 0 0 0 0 7
8 1163.9 0 0 0 0 0 0 0 0 1 0 0 0 8
9 1467.9 0 0 0 0 0 0 0 0 0 1 0 0 9
10 1433.7 0 0 0 0 0 0 0 0 0 0 1 0 10
11 1362.2 0 0 0 0 0 0 0 0 0 0 0 1 11
12 1299.0 0 0 0 0 0 0 0 0 0 0 0 0 12
13 1291.5 0 1 0 0 0 0 0 0 0 0 0 0 13
14 1452.7 0 0 1 0 0 0 0 0 0 0 0 0 14
15 1555.4 0 0 0 1 0 0 0 0 0 0 0 0 15
16 1402.5 0 0 0 0 1 0 0 0 0 0 0 0 16
17 1242.9 0 0 0 0 0 1 0 0 0 0 0 0 17
18 1514.6 0 0 0 0 0 0 1 0 0 0 0 0 18
19 1308.6 0 0 0 0 0 0 0 1 0 0 0 0 19
20 1239.3 0 0 0 0 0 0 0 0 1 0 0 0 20
21 1519.9 0 0 0 0 0 0 0 0 0 1 0 0 21
22 1659.4 0 0 0 0 0 0 0 0 0 0 1 0 22
23 1597.6 0 0 0 0 0 0 0 0 0 0 0 1 23
24 1340.6 0 0 0 0 0 0 0 0 0 0 0 0 24
25 1427.2 0 1 0 0 0 0 0 0 0 0 0 0 25
26 1438.1 0 0 1 0 0 0 0 0 0 0 0 0 26
27 1616.2 0 0 0 1 0 0 0 0 0 0 0 0 27
28 1392.8 0 0 0 0 1 0 0 0 0 0 0 0 28
29 1318.7 0 0 0 0 0 1 0 0 0 0 0 0 29
30 1420.9 0 0 0 0 0 0 1 0 0 0 0 0 30
31 1221.0 0 0 0 0 0 0 0 1 0 0 0 0 31
32 1310.0 0 0 0 0 0 0 0 0 1 0 0 0 32
33 1466.7 0 0 0 0 0 0 0 0 0 1 0 0 33
34 1299.3 0 0 0 0 0 0 0 0 0 0 1 0 34
35 1640.0 0 0 0 0 0 0 0 0 0 0 0 1 35
36 1506.3 0 0 0 0 0 0 0 0 0 0 0 0 36
37 1530.2 0 1 0 0 0 0 0 0 0 0 0 0 37
38 1661.9 0 0 1 0 0 0 0 0 0 0 0 0 38
39 1880.3 1 0 0 1 0 0 0 0 0 0 0 0 39
40 1230.8 0 0 0 0 1 0 0 0 0 0 0 0 40
41 1406.5 0 0 0 0 0 1 0 0 0 0 0 0 41
42 1523.5 0 0 0 0 0 0 1 0 0 0 0 0 42
43 1323.2 0 0 0 0 0 0 0 1 0 0 0 0 43
44 1319.2 0 0 0 0 0 0 0 0 1 0 0 0 44
45 1500.7 0 0 0 0 0 0 0 0 0 1 0 0 45
46 1483.0 0 0 0 0 0 0 0 0 0 0 1 0 46
47 1497.0 0 0 0 0 0 0 0 0 0 0 0 1 47
48 1219.8 0 0 0 0 0 0 0 0 0 0 0 0 48
49 1472.9 0 1 0 0 0 0 0 0 0 0 0 0 49
50 1423.9 0 0 1 0 0 0 0 0 0 0 0 0 50
51 1629.6 0 0 0 1 0 0 0 0 0 0 0 0 51
52 1353.4 0 0 0 0 1 0 0 0 0 0 0 0 52
53 1366.8 0 0 0 0 0 1 0 0 0 0 0 0 53
54 1527.1 0 0 0 0 0 0 1 0 0 0 0 0 54
55 1487.6 0 0 0 0 0 0 0 1 0 0 0 0 55
56 1478.6 0 0 0 0 0 0 0 0 1 0 0 0 56
57 1536.7 0 0 0 0 0 0 0 0 0 1 0 0 57
58 1682.1 0 0 0 0 0 0 0 0 0 0 1 0 58
59 1576.5 0 0 0 0 0 0 0 0 0 0 0 1 59
60 1280.5 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) x M1 M2 M3 M4
1246.041 289.934 107.082 157.951 254.193 31.109
M5 M6 M7 M8 M9 M10
15.278 164.407 22.015 -17.796 176.073 186.882
M11 t
207.731 2.311
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-212.200 -47.233 -5.757 49.547 177.060
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1246.0408 47.2070 26.395 < 2e-16 ***
x 289.9337 101.0291 2.870 0.006186 **
M1 107.0820 57.3529 1.867 0.068272 .
M2 157.9509 57.2663 2.758 0.008311 **
M3 254.1931 60.8625 4.177 0.000131 ***
M4 31.1087 57.1176 0.545 0.588630
M5 15.2776 57.0555 0.268 0.790075
M6 164.4065 57.0017 2.884 0.005951 **
M7 22.0154 56.9560 0.387 0.700884
M8 -17.7956 56.9187 -0.313 0.755959
M9 176.0733 56.8896 3.095 0.003345 **
M10 186.8822 56.8689 3.286 0.001949 **
M11 207.7311 56.8564 3.654 0.000661 ***
t 2.3111 0.6874 3.362 0.001566 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 89.89 on 46 degrees of freedom
Multiple R-squared: 0.6693, Adjusted R-squared: 0.5759
F-statistic: 7.163 on 13 and 46 DF, p-value: 2.396e-07
> postscript(file="/var/www/html/rcomp/tmp/11dc01227122354.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/2qf741227122354.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/39yxn1227122354.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/4lpo51227122354.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/5qtw21227122354.ps",horizontal=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 60
Frequency = 1
1 2 3 4 5
-2.273389e+01 -6.481389e+01 -8.556716e+01 4.340611e+01 3.392611e+01
6 7 8 9 10
-1.151389e+01 7.386611e+01 -8.283389e+01 2.498611e+01 -2.233389e+01
11 12 13 14 15
-1.169939e+02 2.522611e+01 -9.166695e+01 1.635305e+01 2.049979e+01
16 17 18 19 20
8.837305e+01 -5.770695e+01 6.255305e+01 -3.366947e+00 -3.516695e+01
21 22 23 24 25
4.925305e+01 1.756331e+02 9.067305e+01 3.909305e+01 1.630000e+01
26 27 28 29 30
-2.598000e+01 5.356674e+01 5.094000e+01 -9.640000e+00 -5.888000e+01
31 32 33 34 35
-1.187000e+02 7.800000e+00 -3.168000e+01 -2.122000e+02 1.053400e+02
36 37 38 39 40
1.770600e+02 9.156695e+01 1.700869e+02 -2.708944e-14 -1.387931e+02
41 42 43 44 45
5.042695e+01 1.598695e+01 -4.423305e+01 -1.073305e+01 -2.541305e+01
46 47 48 49 50
-5.623305e+01 -6.539305e+01 -1.371731e+02 6.533895e+00 -9.564611e+01
51 52 53 54 55
1.150063e+01 -4.392611e+01 -1.700611e+01 -8.146105e+00 9.243389e+01
56 57 58 59 60
1.209339e+02 -1.714611e+01 1.151339e+02 -1.362611e+01 -1.042061e+02
> postscript(file="/var/www/html/rcomp/tmp/6sim91227122355.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 -2.273389e+01 NA
1 -6.481389e+01 -2.273389e+01
2 -8.556716e+01 -6.481389e+01
3 4.340611e+01 -8.556716e+01
4 3.392611e+01 4.340611e+01
5 -1.151389e+01 3.392611e+01
6 7.386611e+01 -1.151389e+01
7 -8.283389e+01 7.386611e+01
8 2.498611e+01 -8.283389e+01
9 -2.233389e+01 2.498611e+01
10 -1.169939e+02 -2.233389e+01
11 2.522611e+01 -1.169939e+02
12 -9.166695e+01 2.522611e+01
13 1.635305e+01 -9.166695e+01
14 2.049979e+01 1.635305e+01
15 8.837305e+01 2.049979e+01
16 -5.770695e+01 8.837305e+01
17 6.255305e+01 -5.770695e+01
18 -3.366947e+00 6.255305e+01
19 -3.516695e+01 -3.366947e+00
20 4.925305e+01 -3.516695e+01
21 1.756331e+02 4.925305e+01
22 9.067305e+01 1.756331e+02
23 3.909305e+01 9.067305e+01
24 1.630000e+01 3.909305e+01
25 -2.598000e+01 1.630000e+01
26 5.356674e+01 -2.598000e+01
27 5.094000e+01 5.356674e+01
28 -9.640000e+00 5.094000e+01
29 -5.888000e+01 -9.640000e+00
30 -1.187000e+02 -5.888000e+01
31 7.800000e+00 -1.187000e+02
32 -3.168000e+01 7.800000e+00
33 -2.122000e+02 -3.168000e+01
34 1.053400e+02 -2.122000e+02
35 1.770600e+02 1.053400e+02
36 9.156695e+01 1.770600e+02
37 1.700869e+02 9.156695e+01
38 -2.708944e-14 1.700869e+02
39 -1.387931e+02 -2.708944e-14
40 5.042695e+01 -1.387931e+02
41 1.598695e+01 5.042695e+01
42 -4.423305e+01 1.598695e+01
43 -1.073305e+01 -4.423305e+01
44 -2.541305e+01 -1.073305e+01
45 -5.623305e+01 -2.541305e+01
46 -6.539305e+01 -5.623305e+01
47 -1.371731e+02 -6.539305e+01
48 6.533895e+00 -1.371731e+02
49 -9.564611e+01 6.533895e+00
50 1.150063e+01 -9.564611e+01
51 -4.392611e+01 1.150063e+01
52 -1.700611e+01 -4.392611e+01
53 -8.146105e+00 -1.700611e+01
54 9.243389e+01 -8.146105e+00
55 1.209339e+02 9.243389e+01
56 -1.714611e+01 1.209339e+02
57 1.151339e+02 -1.714611e+01
58 -1.362611e+01 1.151339e+02
59 -1.042061e+02 -1.362611e+01
60 NA -1.042061e+02
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -6.481389e+01 -2.273389e+01
[2,] -8.556716e+01 -6.481389e+01
[3,] 4.340611e+01 -8.556716e+01
[4,] 3.392611e+01 4.340611e+01
[5,] -1.151389e+01 3.392611e+01
[6,] 7.386611e+01 -1.151389e+01
[7,] -8.283389e+01 7.386611e+01
[8,] 2.498611e+01 -8.283389e+01
[9,] -2.233389e+01 2.498611e+01
[10,] -1.169939e+02 -2.233389e+01
[11,] 2.522611e+01 -1.169939e+02
[12,] -9.166695e+01 2.522611e+01
[13,] 1.635305e+01 -9.166695e+01
[14,] 2.049979e+01 1.635305e+01
[15,] 8.837305e+01 2.049979e+01
[16,] -5.770695e+01 8.837305e+01
[17,] 6.255305e+01 -5.770695e+01
[18,] -3.366947e+00 6.255305e+01
[19,] -3.516695e+01 -3.366947e+00
[20,] 4.925305e+01 -3.516695e+01
[21,] 1.756331e+02 4.925305e+01
[22,] 9.067305e+01 1.756331e+02
[23,] 3.909305e+01 9.067305e+01
[24,] 1.630000e+01 3.909305e+01
[25,] -2.598000e+01 1.630000e+01
[26,] 5.356674e+01 -2.598000e+01
[27,] 5.094000e+01 5.356674e+01
[28,] -9.640000e+00 5.094000e+01
[29,] -5.888000e+01 -9.640000e+00
[30,] -1.187000e+02 -5.888000e+01
[31,] 7.800000e+00 -1.187000e+02
[32,] -3.168000e+01 7.800000e+00
[33,] -2.122000e+02 -3.168000e+01
[34,] 1.053400e+02 -2.122000e+02
[35,] 1.770600e+02 1.053400e+02
[36,] 9.156695e+01 1.770600e+02
[37,] 1.700869e+02 9.156695e+01
[38,] -2.708944e-14 1.700869e+02
[39,] -1.387931e+02 -2.708944e-14
[40,] 5.042695e+01 -1.387931e+02
[41,] 1.598695e+01 5.042695e+01
[42,] -4.423305e+01 1.598695e+01
[43,] -1.073305e+01 -4.423305e+01
[44,] -2.541305e+01 -1.073305e+01
[45,] -5.623305e+01 -2.541305e+01
[46,] -6.539305e+01 -5.623305e+01
[47,] -1.371731e+02 -6.539305e+01
[48,] 6.533895e+00 -1.371731e+02
[49,] -9.564611e+01 6.533895e+00
[50,] 1.150063e+01 -9.564611e+01
[51,] -4.392611e+01 1.150063e+01
[52,] -1.700611e+01 -4.392611e+01
[53,] -8.146105e+00 -1.700611e+01
[54,] 9.243389e+01 -8.146105e+00
[55,] 1.209339e+02 9.243389e+01
[56,] -1.714611e+01 1.209339e+02
[57,] 1.151339e+02 -1.714611e+01
[58,] -1.362611e+01 1.151339e+02
[59,] -1.042061e+02 -1.362611e+01
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -6.481389e+01 -2.273389e+01
2 -8.556716e+01 -6.481389e+01
3 4.340611e+01 -8.556716e+01
4 3.392611e+01 4.340611e+01
5 -1.151389e+01 3.392611e+01
6 7.386611e+01 -1.151389e+01
7 -8.283389e+01 7.386611e+01
8 2.498611e+01 -8.283389e+01
9 -2.233389e+01 2.498611e+01
10 -1.169939e+02 -2.233389e+01
11 2.522611e+01 -1.169939e+02
12 -9.166695e+01 2.522611e+01
13 1.635305e+01 -9.166695e+01
14 2.049979e+01 1.635305e+01
15 8.837305e+01 2.049979e+01
16 -5.770695e+01 8.837305e+01
17 6.255305e+01 -5.770695e+01
18 -3.366947e+00 6.255305e+01
19 -3.516695e+01 -3.366947e+00
20 4.925305e+01 -3.516695e+01
21 1.756331e+02 4.925305e+01
22 9.067305e+01 1.756331e+02
23 3.909305e+01 9.067305e+01
24 1.630000e+01 3.909305e+01
25 -2.598000e+01 1.630000e+01
26 5.356674e+01 -2.598000e+01
27 5.094000e+01 5.356674e+01
28 -9.640000e+00 5.094000e+01
29 -5.888000e+01 -9.640000e+00
30 -1.187000e+02 -5.888000e+01
31 7.800000e+00 -1.187000e+02
32 -3.168000e+01 7.800000e+00
33 -2.122000e+02 -3.168000e+01
34 1.053400e+02 -2.122000e+02
35 1.770600e+02 1.053400e+02
36 9.156695e+01 1.770600e+02
37 1.700869e+02 9.156695e+01
38 -2.708944e-14 1.700869e+02
39 -1.387931e+02 -2.708944e-14
40 5.042695e+01 -1.387931e+02
41 1.598695e+01 5.042695e+01
42 -4.423305e+01 1.598695e+01
43 -1.073305e+01 -4.423305e+01
44 -2.541305e+01 -1.073305e+01
45 -5.623305e+01 -2.541305e+01
46 -6.539305e+01 -5.623305e+01
47 -1.371731e+02 -6.539305e+01
48 6.533895e+00 -1.371731e+02
49 -9.564611e+01 6.533895e+00
50 1.150063e+01 -9.564611e+01
51 -4.392611e+01 1.150063e+01
52 -1.700611e+01 -4.392611e+01
53 -8.146105e+00 -1.700611e+01
54 9.243389e+01 -8.146105e+00
55 1.209339e+02 9.243389e+01
56 -1.714611e+01 1.209339e+02
57 1.151339e+02 -1.714611e+01
58 -1.362611e+01 1.151339e+02
59 -1.042061e+02 -1.362611e+01
> 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/7vvj11227122355.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/8hno11227122355.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/90zov1227122355.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')
Warning message:
In dropInf(r.w/(s * sqrt(1 - hii))) :
Not plotting observations with leverage one:
39
> par(opar)
> 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/103muw1227122355.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/11s1t81227122355.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/12jl331227122355.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/13ec0e1227122355.tab")
>
> system("convert tmp/11dc01227122354.ps tmp/11dc01227122354.png")
> system("convert tmp/2qf741227122354.ps tmp/2qf741227122354.png")
> system("convert tmp/39yxn1227122354.ps tmp/39yxn1227122354.png")
> system("convert tmp/4lpo51227122354.ps tmp/4lpo51227122354.png")
> system("convert tmp/5qtw21227122354.ps tmp/5qtw21227122354.png")
> system("convert tmp/6sim91227122355.ps tmp/6sim91227122355.png")
> system("convert tmp/7vvj11227122355.ps tmp/7vvj11227122355.png")
> system("convert tmp/8hno11227122355.ps tmp/8hno11227122355.png")
> system("convert tmp/90zov1227122355.ps tmp/90zov1227122355.png")
>
>
> proc.time()
user system elapsed
1.942 1.414 2.569