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(1,2,1.2,1.4,1.7,2,1,1.2,2.4,2,1.7,1,2,2,2.4,1.7,2.1,2,2,2.4,2,2,2.1,2,1.8,2,2,2.1,2.7,2,1.8,2,2.3,2,2.7,1.8,1.9,2,2.3,2.7,2,2,1.9,2.3,2.3,2,2,1.9,2.8,2,2.3,2,2.4,2,2.8,2.3,2.3,2,2.4,2.8,2.7,2,2.3,2.4,2.7,2,2.7,2.3,2.9,2,2.7,2.7,3,2,2.9,2.7,2.2,2,3,2.9,2.3,2,2.2,3,2.8,2.21,2.3,2.2,2.8,2.25,2.8,2.3,2.8,2.25,2.8,2.8,2.2,2.45,2.8,2.8,2.6,2.5,2.2,2.8,2.8,2.5,2.6,2.2,2.5,2.64,2.8,2.6,2.4,2.75,2.5,2.8,2.3,2.93,2.4,2.5,1.9,3,2.3,2.4,1.7,3.17,1.9,2.3,2,3.25,1.7,1.9,2.1,3.39,2,1.7,1.7,3.5,2.1,2,1.8,3.5,1.7,2.1,1.8,3.65,1.8,1.7,1.8,3.75,1.8,1.8,1.3,3.75,1.8,1.8,1.3,3.9,1.3,1.8,1.3,4,1.3,1.3,1.2,4,1.3,1.3,1.4,4,1.2,1.3,2.2,4,1.4,1.2,2.9,4,2.2,1.4,3.1,4,2.9,2.2,3.5,4,3.1,2.9,3.6,4,3.5,3.1,4.4,4,3.6,3.5,4.1,4,4.4,3.6,5.1,4,4.1,4.4,5.8,4,5.1,4.1,5.9,4.18,5.8,5.1,5.4,4.25,5.9,5.8,5.5,4.25,5.4,5.9,4.8,3.97,5.5,5.4,3.2,3.42,4.8,5.5,2.7,2.75,3.2,4.8),dim=c(4,58),dimnames=list(c('Y','X','Y1','Y2'),1:58))
> y <- array(NA,dim=c(4,58),dimnames=list(c('Y','X','Y1','Y2'),1:58))
> 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',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2.2 1.4 0 0 0 0 0 0 0 0 1 0 0 45
46 3.1 4.00 2.9 2.2 0 0 0 0 0 0 0 0 0 1 0 46
47 3.5 4.00 3.1 2.9 0 0 0 0 0 0 0 0 0 0 1 47
48 3.6 4.00 3.5 3.1 0 0 0 0 0 0 0 0 0 0 0 48
49 4.4 4.00 3.6 3.5 1 0 0 0 0 0 0 0 0 0 0 49
50 4.1 4.00 4.4 3.6 0 1 0 0 0 0 0 0 0 0 0 50
51 5.1 4.00 4.1 4.4 0 0 1 0 0 0 0 0 0 0 0 51
52 5.8 4.00 5.1 4.1 0 0 0 1 0 0 0 0 0 0 0 52
53 5.9 4.18 5.8 5.1 0 0 0 0 1 0 0 0 0 0 0 53
54 5.4 4.25 5.9 5.8 0 0 0 0 0 1 0 0 0 0 0 54
55 5.5 4.25 5.4 5.9 0 0 0 0 0 0 1 0 0 0 0 55
56 4.8 3.97 5.5 5.4 0 0 0 0 0 0 0 1 0 0 0 56
57 3.2 3.42 4.8 5.5 0 0 0 0 0 0 0 0 1 0 0 57
58 2.7 2.75 3.2 4.8 0 0 0 0 0 0 0 0 0 1 0 58
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) X Y1 Y2 M1 M2
-0.07343 0.24021 1.06847 -0.15188 -0.06585 -0.08071
M3 M4 M5 M6 M7 M8
0.11909 -0.07042 -0.10506 -0.23621 -0.13823 -0.09835
M9 M10 M11 t
-0.25177 -0.05398 -0.12356 -0.01008
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.01496 -0.25737 -0.02596 0.34659 0.89523
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.07343 0.51694 -0.142 0.888
X 0.24021 0.24562 0.978 0.334
Y1 1.06847 0.15559 6.867 2.25e-08 ***
Y2 -0.15188 0.17641 -0.861 0.394
M1 -0.06585 0.33384 -0.197 0.845
M2 -0.08071 0.33338 -0.242 0.810
M3 0.11909 0.33272 0.358 0.722
M4 -0.07042 0.33444 -0.211 0.834
M5 -0.10506 0.33532 -0.313 0.756
M6 -0.23621 0.33589 -0.703 0.486
M7 -0.13823 0.33571 -0.412 0.683
M8 -0.09835 0.33260 -0.296 0.769
M9 -0.25177 0.33354 -0.755 0.455
M10 -0.05398 0.33748 -0.160 0.874
M11 -0.12356 0.35014 -0.353 0.726
t -0.01008 0.01467 -0.687 0.496
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.4948 on 42 degrees of freedom
Multiple R-squared: 0.866, Adjusted R-squared: 0.8182
F-statistic: 18.1 on 15 and 42 DF, p-value: 1.148e-13
> 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.459441795 0.918883590 0.5405582
[2,] 0.655118094 0.689763812 0.3448819
[3,] 0.531802581 0.936394837 0.4681974
[4,] 0.410558377 0.821116754 0.5894416
[5,] 0.288902371 0.577804742 0.7110976
[6,] 0.198229878 0.396459756 0.8017701
[7,] 0.139448752 0.278897504 0.8605512
[8,] 0.132048984 0.264097968 0.8679510
[9,] 0.089209561 0.178419121 0.9107904
[10,] 0.054323235 0.108646470 0.9456768
[11,] 0.032196958 0.064393917 0.9678030
[12,] 0.022109487 0.044218974 0.9778905
[13,] 0.012591872 0.025183744 0.9874081
[14,] 0.006524950 0.013049900 0.9934751
[15,] 0.010795942 0.021591885 0.9892041
[16,] 0.006705601 0.013411202 0.9932944
[17,] 0.002868791 0.005737583 0.9971312
[18,] 0.004807719 0.009615439 0.9951923
[19,] 0.002372675 0.004745350 0.9976273
[20,] 0.081436148 0.162872297 0.9185639
[21,] 0.197217968 0.394435936 0.8027820
> postscript(file="/var/www/html/rcomp/tmp/15npo1258725737.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/2g5zl1258725737.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/3wuqu1258725737.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/4t0061258725737.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/5it2t1258725737.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 = 58
Frequency = 1
1 2 3 4 5
-0.4006018362 0.5076576021 0.2396425650 -0.6023880745 0.0760405755
6 7 8 9 10
-0.0503276046 -0.2161838283 0.8525243254 -0.3759796992 -0.3996000677
11 12 13 14 15
0.1466940275 0.1656199778 0.4361975680 -0.4275336756 -0.2139167749
16 17 18 19 20
0.4317638260 0.0339139740 0.4358948609 0.2343097002 -0.6719600807
21 22 23 24 25
0.4614992030 0.4950069388 0.0460076899 0.0084704579 -0.5636412062
26 27 28 29 30
0.4903713094 -0.0178535437 -0.3048420074 -0.0356226520 0.0236526217
31 32 33 34 35
-0.3893940446 -0.2478280532 0.3493930286 -0.1228519147 -0.5309023553
36 37 38 39 40
-0.1018023412 -0.2295013974 -0.2133941765 -0.9031042774 -0.2053164430
41 42 43 44 45
-0.2605503939 -0.2193205095 -0.0003644837 0.5409554214 0.5800494615
46 47 48 49 50
-0.0340763412 0.3382006379 -0.0722880945 0.7575468718 -0.3571010594
51 52 53 54 55
0.8952320310 0.6807826989 0.1862184964 -0.1898993685 0.3716326564
56 57 58
-0.4736916129 -1.0149619939 0.0615213848
> postscript(file="/var/www/html/rcomp/tmp/6izax1258725737.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 = 58
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.4006018362 NA
1 0.5076576021 -0.4006018362
2 0.2396425650 0.5076576021
3 -0.6023880745 0.2396425650
4 0.0760405755 -0.6023880745
5 -0.0503276046 0.0760405755
6 -0.2161838283 -0.0503276046
7 0.8525243254 -0.2161838283
8 -0.3759796992 0.8525243254
9 -0.3996000677 -0.3759796992
10 0.1466940275 -0.3996000677
11 0.1656199778 0.1466940275
12 0.4361975680 0.1656199778
13 -0.4275336756 0.4361975680
14 -0.2139167749 -0.4275336756
15 0.4317638260 -0.2139167749
16 0.0339139740 0.4317638260
17 0.4358948609 0.0339139740
18 0.2343097002 0.4358948609
19 -0.6719600807 0.2343097002
20 0.4614992030 -0.6719600807
21 0.4950069388 0.4614992030
22 0.0460076899 0.4950069388
23 0.0084704579 0.0460076899
24 -0.5636412062 0.0084704579
25 0.4903713094 -0.5636412062
26 -0.0178535437 0.4903713094
27 -0.3048420074 -0.0178535437
28 -0.0356226520 -0.3048420074
29 0.0236526217 -0.0356226520
30 -0.3893940446 0.0236526217
31 -0.2478280532 -0.3893940446
32 0.3493930286 -0.2478280532
33 -0.1228519147 0.3493930286
34 -0.5309023553 -0.1228519147
35 -0.1018023412 -0.5309023553
36 -0.2295013974 -0.1018023412
37 -0.2133941765 -0.2295013974
38 -0.9031042774 -0.2133941765
39 -0.2053164430 -0.9031042774
40 -0.2605503939 -0.2053164430
41 -0.2193205095 -0.2605503939
42 -0.0003644837 -0.2193205095
43 0.5409554214 -0.0003644837
44 0.5800494615 0.5409554214
45 -0.0340763412 0.5800494615
46 0.3382006379 -0.0340763412
47 -0.0722880945 0.3382006379
48 0.7575468718 -0.0722880945
49 -0.3571010594 0.7575468718
50 0.8952320310 -0.3571010594
51 0.6807826989 0.8952320310
52 0.1862184964 0.6807826989
53 -0.1898993685 0.1862184964
54 0.3716326564 -0.1898993685
55 -0.4736916129 0.3716326564
56 -1.0149619939 -0.4736916129
57 0.0615213848 -1.0149619939
58 NA 0.0615213848
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.5076576021 -0.4006018362
[2,] 0.2396425650 0.5076576021
[3,] -0.6023880745 0.2396425650
[4,] 0.0760405755 -0.6023880745
[5,] -0.0503276046 0.0760405755
[6,] -0.2161838283 -0.0503276046
[7,] 0.8525243254 -0.2161838283
[8,] -0.3759796992 0.8525243254
[9,] -0.3996000677 -0.3759796992
[10,] 0.1466940275 -0.3996000677
[11,] 0.1656199778 0.1466940275
[12,] 0.4361975680 0.1656199778
[13,] -0.4275336756 0.4361975680
[14,] -0.2139167749 -0.4275336756
[15,] 0.4317638260 -0.2139167749
[16,] 0.0339139740 0.4317638260
[17,] 0.4358948609 0.0339139740
[18,] 0.2343097002 0.4358948609
[19,] -0.6719600807 0.2343097002
[20,] 0.4614992030 -0.6719600807
[21,] 0.4950069388 0.4614992030
[22,] 0.0460076899 0.4950069388
[23,] 0.0084704579 0.0460076899
[24,] -0.5636412062 0.0084704579
[25,] 0.4903713094 -0.5636412062
[26,] -0.0178535437 0.4903713094
[27,] -0.3048420074 -0.0178535437
[28,] -0.0356226520 -0.3048420074
[29,] 0.0236526217 -0.0356226520
[30,] -0.3893940446 0.0236526217
[31,] -0.2478280532 -0.3893940446
[32,] 0.3493930286 -0.2478280532
[33,] -0.1228519147 0.3493930286
[34,] -0.5309023553 -0.1228519147
[35,] -0.1018023412 -0.5309023553
[36,] -0.2295013974 -0.1018023412
[37,] -0.2133941765 -0.2295013974
[38,] -0.9031042774 -0.2133941765
[39,] -0.2053164430 -0.9031042774
[40,] -0.2605503939 -0.2053164430
[41,] -0.2193205095 -0.2605503939
[42,] -0.0003644837 -0.2193205095
[43,] 0.5409554214 -0.0003644837
[44,] 0.5800494615 0.5409554214
[45,] -0.0340763412 0.5800494615
[46,] 0.3382006379 -0.0340763412
[47,] -0.0722880945 0.3382006379
[48,] 0.7575468718 -0.0722880945
[49,] -0.3571010594 0.7575468718
[50,] 0.8952320310 -0.3571010594
[51,] 0.6807826989 0.8952320310
[52,] 0.1862184964 0.6807826989
[53,] -0.1898993685 0.1862184964
[54,] 0.3716326564 -0.1898993685
[55,] -0.4736916129 0.3716326564
[56,] -1.0149619939 -0.4736916129
[57,] 0.0615213848 -1.0149619939
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.5076576021 -0.4006018362
2 0.2396425650 0.5076576021
3 -0.6023880745 0.2396425650
4 0.0760405755 -0.6023880745
5 -0.0503276046 0.0760405755
6 -0.2161838283 -0.0503276046
7 0.8525243254 -0.2161838283
8 -0.3759796992 0.8525243254
9 -0.3996000677 -0.3759796992
10 0.1466940275 -0.3996000677
11 0.1656199778 0.1466940275
12 0.4361975680 0.1656199778
13 -0.4275336756 0.4361975680
14 -0.2139167749 -0.4275336756
15 0.4317638260 -0.2139167749
16 0.0339139740 0.4317638260
17 0.4358948609 0.0339139740
18 0.2343097002 0.4358948609
19 -0.6719600807 0.2343097002
20 0.4614992030 -0.6719600807
21 0.4950069388 0.4614992030
22 0.0460076899 0.4950069388
23 0.0084704579 0.0460076899
24 -0.5636412062 0.0084704579
25 0.4903713094 -0.5636412062
26 -0.0178535437 0.4903713094
27 -0.3048420074 -0.0178535437
28 -0.0356226520 -0.3048420074
29 0.0236526217 -0.0356226520
30 -0.3893940446 0.0236526217
31 -0.2478280532 -0.3893940446
32 0.3493930286 -0.2478280532
33 -0.1228519147 0.3493930286
34 -0.5309023553 -0.1228519147
35 -0.1018023412 -0.5309023553
36 -0.2295013974 -0.1018023412
37 -0.2133941765 -0.2295013974
38 -0.9031042774 -0.2133941765
39 -0.2053164430 -0.9031042774
40 -0.2605503939 -0.2053164430
41 -0.2193205095 -0.2605503939
42 -0.0003644837 -0.2193205095
43 0.5409554214 -0.0003644837
44 0.5800494615 0.5409554214
45 -0.0340763412 0.5800494615
46 0.3382006379 -0.0340763412
47 -0.0722880945 0.3382006379
48 0.7575468718 -0.0722880945
49 -0.3571010594 0.7575468718
50 0.8952320310 -0.3571010594
51 0.6807826989 0.8952320310
52 0.1862184964 0.6807826989
53 -0.1898993685 0.1862184964
54 0.3716326564 -0.1898993685
55 -0.4736916129 0.3716326564
56 -1.0149619939 -0.4736916129
57 0.0615213848 -1.0149619939
> 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/7exsu1258725737.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/8arzl1258725737.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/9r1df1258725737.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/10g4bm1258725737.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/112vfz1258725738.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/12a54l1258725738.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/13bh6x1258725738.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/14zh881258725738.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/15307z1258725738.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/16tk4b1258725738.tab")
+ }
>
> system("convert tmp/15npo1258725737.ps tmp/15npo1258725737.png")
> system("convert tmp/2g5zl1258725737.ps tmp/2g5zl1258725737.png")
> system("convert tmp/3wuqu1258725737.ps tmp/3wuqu1258725737.png")
> system("convert tmp/4t0061258725737.ps tmp/4t0061258725737.png")
> system("convert tmp/5it2t1258725737.ps tmp/5it2t1258725737.png")
> system("convert tmp/6izax1258725737.ps tmp/6izax1258725737.png")
> system("convert tmp/7exsu1258725737.ps tmp/7exsu1258725737.png")
> system("convert tmp/8arzl1258725737.ps tmp/8arzl1258725737.png")
> system("convert tmp/9r1df1258725737.ps tmp/9r1df1258725737.png")
> system("convert tmp/10g4bm1258725737.ps tmp/10g4bm1258725737.png")
>
>
> proc.time()
user system elapsed
2.319 1.539 2.751