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(2120.88,0,2174.56,0,2196.72,0,2350.44,0,2440.25,0,2408.64,0,2472.81,0,2407.6,0,2454.62,0,2448.05,0,2497.84,0,2645.64,0,2756.76,0,2849.27,0,2921.44,0,2981.85,0,3080.58,0,3106.22,0,3119.31,0,3061.26,0,3097.31,0,3161.69,0,3257.16,0,3277.01,0,3295.32,0,3363.99,0,3494.17,0,3667.03,0,3813.06,0,3917.96,0,3895.51,0,3801.06,0,3570.12,0,3701.61,0,3862.27,0,3970.1,0,4138.52,0,4199.75,0,4290.89,0,4443.91,0,4502.64,1,4356.98,1,4591.27,1,4696.96,1,4621.4,1,4562.84,1,4202.52,1,4296.49,1,4435.23,1,4105.18,1,4116.68,1,3844.49,1,3720.98,1,3674.4,1,3857.62,1,3801.06,1,3504.37,1,3032.6,1,3047.03,1,2962.34,1,2197.82,1),dim=c(2,61),dimnames=list(c('Bel20','dummy'),1:61))
> y <- array(NA,dim=c(2,61),dimnames=list(c('Bel20','dummy'),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 = '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
Bel20 dummy M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 2120.88 0 1 0 0 0 0 0 0 0 0 0 0
2 2174.56 0 0 1 0 0 0 0 0 0 0 0 0
3 2196.72 0 0 0 1 0 0 0 0 0 0 0 0
4 2350.44 0 0 0 0 1 0 0 0 0 0 0 0
5 2440.25 0 0 0 0 0 1 0 0 0 0 0 0
6 2408.64 0 0 0 0 0 0 1 0 0 0 0 0
7 2472.81 0 0 0 0 0 0 0 1 0 0 0 0
8 2407.60 0 0 0 0 0 0 0 0 1 0 0 0
9 2454.62 0 0 0 0 0 0 0 0 0 1 0 0
10 2448.05 0 0 0 0 0 0 0 0 0 0 1 0
11 2497.84 0 0 0 0 0 0 0 0 0 0 0 1
12 2645.64 0 0 0 0 0 0 0 0 0 0 0 0
13 2756.76 0 1 0 0 0 0 0 0 0 0 0 0
14 2849.27 0 0 1 0 0 0 0 0 0 0 0 0
15 2921.44 0 0 0 1 0 0 0 0 0 0 0 0
16 2981.85 0 0 0 0 1 0 0 0 0 0 0 0
17 3080.58 0 0 0 0 0 1 0 0 0 0 0 0
18 3106.22 0 0 0 0 0 0 1 0 0 0 0 0
19 3119.31 0 0 0 0 0 0 0 1 0 0 0 0
20 3061.26 0 0 0 0 0 0 0 0 1 0 0 0
21 3097.31 0 0 0 0 0 0 0 0 0 1 0 0
22 3161.69 0 0 0 0 0 0 0 0 0 0 1 0
23 3257.16 0 0 0 0 0 0 0 0 0 0 0 1
24 3277.01 0 0 0 0 0 0 0 0 0 0 0 0
25 3295.32 0 1 0 0 0 0 0 0 0 0 0 0
26 3363.99 0 0 1 0 0 0 0 0 0 0 0 0
27 3494.17 0 0 0 1 0 0 0 0 0 0 0 0
28 3667.03 0 0 0 0 1 0 0 0 0 0 0 0
29 3813.06 0 0 0 0 0 1 0 0 0 0 0 0
30 3917.96 0 0 0 0 0 0 1 0 0 0 0 0
31 3895.51 0 0 0 0 0 0 0 1 0 0 0 0
32 3801.06 0 0 0 0 0 0 0 0 1 0 0 0
33 3570.12 0 0 0 0 0 0 0 0 0 1 0 0
34 3701.61 0 0 0 0 0 0 0 0 0 0 1 0
35 3862.27 0 0 0 0 0 0 0 0 0 0 0 1
36 3970.10 0 0 0 0 0 0 0 0 0 0 0 0
37 4138.52 0 1 0 0 0 0 0 0 0 0 0 0
38 4199.75 0 0 1 0 0 0 0 0 0 0 0 0
39 4290.89 0 0 0 1 0 0 0 0 0 0 0 0
40 4443.91 0 0 0 0 1 0 0 0 0 0 0 0
41 4502.64 1 0 0 0 0 1 0 0 0 0 0 0
42 4356.98 1 0 0 0 0 0 1 0 0 0 0 0
43 4591.27 1 0 0 0 0 0 0 1 0 0 0 0
44 4696.96 1 0 0 0 0 0 0 0 1 0 0 0
45 4621.40 1 0 0 0 0 0 0 0 0 1 0 0
46 4562.84 1 0 0 0 0 0 0 0 0 0 1 0
47 4202.52 1 0 0 0 0 0 0 0 0 0 0 1
48 4296.49 1 0 0 0 0 0 0 0 0 0 0 0
49 4435.23 1 1 0 0 0 0 0 0 0 0 0 0
50 4105.18 1 0 1 0 0 0 0 0 0 0 0 0
51 4116.68 1 0 0 1 0 0 0 0 0 0 0 0
52 3844.49 1 0 0 0 1 0 0 0 0 0 0 0
53 3720.98 1 0 0 0 0 1 0 0 0 0 0 0
54 3674.40 1 0 0 0 0 0 1 0 0 0 0 0
55 3857.62 1 0 0 0 0 0 0 1 0 0 0 0
56 3801.06 1 0 0 0 0 0 0 0 1 0 0 0
57 3504.37 1 0 0 0 0 0 0 0 0 1 0 0
58 3032.60 1 0 0 0 0 0 0 0 0 0 1 0
59 3047.03 1 0 0 0 0 0 0 0 0 0 0 1
60 2962.34 1 0 0 0 0 0 0 0 0 0 0 0
61 2197.82 1 1 0 0 0 0 0 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) dummy M1 M2 M3 M4
3128.63 754.22 -222.61 59.08 124.51 178.07
M5 M6 M7 M8 M9 M10
81.19 62.52 156.99 123.27 19.25 -48.96
M11
-56.95
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1462.42 -482.99 -50.56 549.16 1232.51
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3128.63 331.20 9.446 1.58e-12 ***
dummy 754.22 197.00 3.829 0.000373 ***
M1 -222.61 435.77 -0.511 0.611800
M2 59.08 456.65 0.129 0.897601
M3 124.51 456.65 0.273 0.786285
M4 178.07 456.65 0.390 0.698292
M5 81.19 454.94 0.178 0.859118
M6 62.52 454.94 0.137 0.891264
M7 156.99 454.94 0.345 0.731548
M8 123.27 454.94 0.271 0.787582
M9 19.25 454.94 0.042 0.966428
M10 -48.96 454.94 -0.108 0.914751
M11 -56.95 454.94 -0.125 0.900900
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 719.3 on 48 degrees of freedom
Multiple R-squared: 0.2518, Adjusted R-squared: 0.06479
F-statistic: 1.346 on 12 and 48 DF, p-value: 0.2249
> 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.49862348 0.99724695 0.5013765
[2,] 0.42930378 0.85860757 0.5706962
[3,] 0.38937384 0.77874768 0.6106262
[4,] 0.35360771 0.70721541 0.6463923
[5,] 0.33341479 0.66682959 0.6665852
[6,] 0.30387646 0.60775292 0.6961235
[7,] 0.28179887 0.56359774 0.7182011
[8,] 0.26247363 0.52494727 0.7375264
[9,] 0.22556009 0.45112018 0.7744399
[10,] 0.23896601 0.47793202 0.7610340
[11,] 0.26719470 0.53438940 0.7328053
[12,] 0.30320484 0.60640967 0.6967952
[13,] 0.33045507 0.66091013 0.6695449
[14,] 0.35016152 0.70032304 0.6498385
[15,] 0.37238241 0.74476483 0.6276176
[16,] 0.38148546 0.76297093 0.6185145
[17,] 0.38949985 0.77899971 0.6105001
[18,] 0.37362061 0.74724122 0.6263794
[19,] 0.34136699 0.68273398 0.6586330
[20,] 0.30368727 0.60737454 0.6963127
[21,] 0.26447865 0.52895729 0.7355214
[22,] 0.27964832 0.55929664 0.7203517
[23,] 0.27014710 0.54029421 0.7298529
[24,] 0.25208760 0.50417519 0.7479124
[25,] 0.22266997 0.44533993 0.7773300
[26,] 0.16496620 0.32993240 0.8350338
[27,] 0.11233404 0.22466809 0.8876660
[28,] 0.07219927 0.14439854 0.9278007
[29,] 0.04598191 0.09196383 0.9540181
[30,] 0.03033971 0.06067941 0.9696603
> postscript(file="/var/www/html/rcomp/tmp/1gp0a1227826047.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/2v0q11227826047.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/3oui31227826047.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/46ibe1227826047.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/5a0iw1227826047.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
-785.13390 -1013.14534 -1056.41534 -956.25934 -769.56268 -782.51068
7 8 9 10 11 12
-812.80468 -844.29868 -693.25468 -631.61868 -573.83468 -482.98668
13 14 15 16 17 18
-149.25390 -338.43534 -331.69534 -324.84934 -129.23268 -84.93068
19 20 21 22 23 24
-166.30468 -190.63868 -50.56468 82.02132 185.48532 148.38332
25 26 27 28 29 30
389.30610 176.28466 241.03466 360.33066 603.24732 726.80932
31 32 33 34 35 36
609.89532 549.16132 422.24532 621.94132 790.59532 841.47332
37 38 39 40 41 42
1232.50610 1012.04466 1037.75466 1137.21066 538.60402 411.60602
43 44 45 46 47 48
551.43202 690.83802 719.30202 728.94802 376.62202 413.64002
49 50 51 52 53 54
774.99280 163.25136 109.32136 -216.43264 -243.05598 -270.97398
55 56 57 58 59 60
-182.21798 -205.06198 -397.72798 -801.29198 -778.86798 -920.50998
61
-1462.41720
> postscript(file="/var/www/html/rcomp/tmp/6sy8l1227826047.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 -785.13390 NA
1 -1013.14534 -785.13390
2 -1056.41534 -1013.14534
3 -956.25934 -1056.41534
4 -769.56268 -956.25934
5 -782.51068 -769.56268
6 -812.80468 -782.51068
7 -844.29868 -812.80468
8 -693.25468 -844.29868
9 -631.61868 -693.25468
10 -573.83468 -631.61868
11 -482.98668 -573.83468
12 -149.25390 -482.98668
13 -338.43534 -149.25390
14 -331.69534 -338.43534
15 -324.84934 -331.69534
16 -129.23268 -324.84934
17 -84.93068 -129.23268
18 -166.30468 -84.93068
19 -190.63868 -166.30468
20 -50.56468 -190.63868
21 82.02132 -50.56468
22 185.48532 82.02132
23 148.38332 185.48532
24 389.30610 148.38332
25 176.28466 389.30610
26 241.03466 176.28466
27 360.33066 241.03466
28 603.24732 360.33066
29 726.80932 603.24732
30 609.89532 726.80932
31 549.16132 609.89532
32 422.24532 549.16132
33 621.94132 422.24532
34 790.59532 621.94132
35 841.47332 790.59532
36 1232.50610 841.47332
37 1012.04466 1232.50610
38 1037.75466 1012.04466
39 1137.21066 1037.75466
40 538.60402 1137.21066
41 411.60602 538.60402
42 551.43202 411.60602
43 690.83802 551.43202
44 719.30202 690.83802
45 728.94802 719.30202
46 376.62202 728.94802
47 413.64002 376.62202
48 774.99280 413.64002
49 163.25136 774.99280
50 109.32136 163.25136
51 -216.43264 109.32136
52 -243.05598 -216.43264
53 -270.97398 -243.05598
54 -182.21798 -270.97398
55 -205.06198 -182.21798
56 -397.72798 -205.06198
57 -801.29198 -397.72798
58 -778.86798 -801.29198
59 -920.50998 -778.86798
60 -1462.41720 -920.50998
61 NA -1462.41720
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1013.14534 -785.13390
[2,] -1056.41534 -1013.14534
[3,] -956.25934 -1056.41534
[4,] -769.56268 -956.25934
[5,] -782.51068 -769.56268
[6,] -812.80468 -782.51068
[7,] -844.29868 -812.80468
[8,] -693.25468 -844.29868
[9,] -631.61868 -693.25468
[10,] -573.83468 -631.61868
[11,] -482.98668 -573.83468
[12,] -149.25390 -482.98668
[13,] -338.43534 -149.25390
[14,] -331.69534 -338.43534
[15,] -324.84934 -331.69534
[16,] -129.23268 -324.84934
[17,] -84.93068 -129.23268
[18,] -166.30468 -84.93068
[19,] -190.63868 -166.30468
[20,] -50.56468 -190.63868
[21,] 82.02132 -50.56468
[22,] 185.48532 82.02132
[23,] 148.38332 185.48532
[24,] 389.30610 148.38332
[25,] 176.28466 389.30610
[26,] 241.03466 176.28466
[27,] 360.33066 241.03466
[28,] 603.24732 360.33066
[29,] 726.80932 603.24732
[30,] 609.89532 726.80932
[31,] 549.16132 609.89532
[32,] 422.24532 549.16132
[33,] 621.94132 422.24532
[34,] 790.59532 621.94132
[35,] 841.47332 790.59532
[36,] 1232.50610 841.47332
[37,] 1012.04466 1232.50610
[38,] 1037.75466 1012.04466
[39,] 1137.21066 1037.75466
[40,] 538.60402 1137.21066
[41,] 411.60602 538.60402
[42,] 551.43202 411.60602
[43,] 690.83802 551.43202
[44,] 719.30202 690.83802
[45,] 728.94802 719.30202
[46,] 376.62202 728.94802
[47,] 413.64002 376.62202
[48,] 774.99280 413.64002
[49,] 163.25136 774.99280
[50,] 109.32136 163.25136
[51,] -216.43264 109.32136
[52,] -243.05598 -216.43264
[53,] -270.97398 -243.05598
[54,] -182.21798 -270.97398
[55,] -205.06198 -182.21798
[56,] -397.72798 -205.06198
[57,] -801.29198 -397.72798
[58,] -778.86798 -801.29198
[59,] -920.50998 -778.86798
[60,] -1462.41720 -920.50998
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1013.14534 -785.13390
2 -1056.41534 -1013.14534
3 -956.25934 -1056.41534
4 -769.56268 -956.25934
5 -782.51068 -769.56268
6 -812.80468 -782.51068
7 -844.29868 -812.80468
8 -693.25468 -844.29868
9 -631.61868 -693.25468
10 -573.83468 -631.61868
11 -482.98668 -573.83468
12 -149.25390 -482.98668
13 -338.43534 -149.25390
14 -331.69534 -338.43534
15 -324.84934 -331.69534
16 -129.23268 -324.84934
17 -84.93068 -129.23268
18 -166.30468 -84.93068
19 -190.63868 -166.30468
20 -50.56468 -190.63868
21 82.02132 -50.56468
22 185.48532 82.02132
23 148.38332 185.48532
24 389.30610 148.38332
25 176.28466 389.30610
26 241.03466 176.28466
27 360.33066 241.03466
28 603.24732 360.33066
29 726.80932 603.24732
30 609.89532 726.80932
31 549.16132 609.89532
32 422.24532 549.16132
33 621.94132 422.24532
34 790.59532 621.94132
35 841.47332 790.59532
36 1232.50610 841.47332
37 1012.04466 1232.50610
38 1037.75466 1012.04466
39 1137.21066 1037.75466
40 538.60402 1137.21066
41 411.60602 538.60402
42 551.43202 411.60602
43 690.83802 551.43202
44 719.30202 690.83802
45 728.94802 719.30202
46 376.62202 728.94802
47 413.64002 376.62202
48 774.99280 413.64002
49 163.25136 774.99280
50 109.32136 163.25136
51 -216.43264 109.32136
52 -243.05598 -216.43264
53 -270.97398 -243.05598
54 -182.21798 -270.97398
55 -205.06198 -182.21798
56 -397.72798 -205.06198
57 -801.29198 -397.72798
58 -778.86798 -801.29198
59 -920.50998 -778.86798
60 -1462.41720 -920.50998
> 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/7s8vm1227826047.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/8bihx1227826047.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/9acce1227826047.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/10e49d1227826047.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/11u1ss1227826047.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/12tzl51227826047.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/136frk1227826047.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/140awe1227826047.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/15hp1i1227826047.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/16kuuu1227826047.tab")
+ }
>
> system("convert tmp/1gp0a1227826047.ps tmp/1gp0a1227826047.png")
> system("convert tmp/2v0q11227826047.ps tmp/2v0q11227826047.png")
> system("convert tmp/3oui31227826047.ps tmp/3oui31227826047.png")
> system("convert tmp/46ibe1227826047.ps tmp/46ibe1227826047.png")
> system("convert tmp/5a0iw1227826047.ps tmp/5a0iw1227826047.png")
> system("convert tmp/6sy8l1227826047.ps tmp/6sy8l1227826047.png")
> system("convert tmp/7s8vm1227826047.ps tmp/7s8vm1227826047.png")
> system("convert tmp/8bihx1227826047.ps tmp/8bihx1227826047.png")
> system("convert tmp/9acce1227826047.ps tmp/9acce1227826047.png")
> system("convert tmp/10e49d1227826047.ps tmp/10e49d1227826047.png")
>
>
> proc.time()
user system elapsed
2.669 1.694 3.237