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
+ ,6.6
+ ,6.3
+ ,2
+ ,8.3
+ ,4.5
+ ,42
+ ,3
+ ,1
+ ,3
+ ,2547
+ ,4603
+ ,2.1
+ ,1.8
+ ,3.9
+ ,69
+ ,624
+ ,3
+ ,5
+ ,4
+ ,10.55
+ ,179.5
+ ,9.1
+ ,0.7
+ ,9.8
+ ,27
+ ,180
+ ,4
+ ,4
+ ,4
+ ,0.023
+ ,0.3
+ ,15.8
+ ,3.9
+ ,19.7
+ ,19
+ ,35
+ ,1
+ ,1
+ ,1
+ ,160
+ ,169
+ ,5.2
+ ,1
+ ,6.2
+ ,30.4
+ ,392
+ ,4
+ ,5
+ ,4
+ ,3.3
+ ,25.6
+ ,10.9
+ ,3.6
+ ,14.5
+ ,28
+ ,63
+ ,1
+ ,2
+ ,1
+ ,52.16
+ ,440
+ ,8.3
+ ,1.4
+ ,9.7
+ ,50
+ ,230
+ ,1
+ ,1
+ ,1
+ ,0.425
+ ,6.4
+ ,11
+ ,1.5
+ ,12.5
+ ,7
+ ,112
+ ,5
+ ,4
+ ,4
+ ,465
+ ,423
+ ,3.2
+ ,0.7
+ ,3.9
+ ,30
+ ,281
+ ,5
+ ,5
+ ,5
+ ,0.075
+ ,1.2
+ ,6.3
+ ,2.1
+ ,8.4
+ ,3.5
+ ,42
+ ,1
+ ,1
+ ,1
+ ,3
+ ,25
+ ,8.6
+ ,0
+ ,8.6
+ ,50
+ ,28
+ ,2
+ ,2
+ ,2
+ ,0.785
+ ,3.5
+ ,6.6
+ ,4.1
+ ,10.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,3.9
+ ,12.8
+ ,6.6
+ ,19.4
+ ,3
+ ,14
+ ,2
+ ,1
+ ,1)
+ ,dim=c(10
+ ,60)
+ ,dimnames=list(c('BodyW'
+ ,'BrainW'
+ ,'SWS'
+ ,'PS'
+ ,'TS'
+ ,'LifeSpan'
+ ,'GT'
+ ,'PI'
+ ,'SEI'
+ ,'ODI')
+ ,1:60))
> y <- array(NA,dim=c(10,60),dimnames=list(c('BodyW','BrainW','SWS','PS','TS','LifeSpan','GT','PI','SEI','ODI'),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 = 'No Linear Trend'
> par2 = 'Do not include Seasonal Dummies'
> par1 = '3'
> #'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
SWS BodyW BrainW PS TS LifeSpan GT PI SEI ODI
1 6.3 1.000 6.60 2.0 8.3 4.5 42.0 3 1 3
2 2.1 2547.000 4603.00 1.8 3.9 69.0 624.0 3 5 4
3 9.1 10.550 179.50 0.7 9.8 27.0 180.0 4 4 4
4 15.8 0.023 0.30 3.9 19.7 19.0 35.0 1 1 1
5 5.2 160.000 169.00 1.0 6.2 30.4 392.0 4 5 4
6 10.9 3.300 25.60 3.6 14.5 28.0 63.0 1 2 1
7 8.3 52.160 440.00 1.4 9.7 50.0 230.0 1 1 1
8 11.0 0.425 6.40 1.5 12.5 7.0 112.0 5 4 4
9 3.2 465.000 423.00 0.7 3.9 30.0 281.0 5 5 5
10 6.3 0.075 1.20 2.1 8.4 3.5 42.0 1 1 1
11 8.6 3.000 25.00 0.0 8.6 50.0 28.0 2 2 2
12 6.6 0.785 3.50 4.1 10.7 6.0 42.0 2 2 2
13 9.5 0.200 5.00 1.2 10.7 10.4 120.0 2 2 2
14 3.3 27.660 115.00 0.5 3.8 20.0 148.0 5 5 5
15 11.0 0.120 1.00 3.4 14.4 3.9 16.0 3 1 2
16 4.7 85.000 325.00 1.5 6.2 41.0 310.0 1 3 1
17 10.4 0.101 4.00 3.4 13.8 9.0 28.0 5 1 3
18 7.4 1.040 5.50 0.8 8.2 7.6 68.0 5 3 4
19 2.1 521.000 655.00 0.8 2.9 46.0 336.0 5 5 5
20 7.7 0.005 0.14 1.4 9.1 2.6 21.5 5 2 4
21 17.9 0.010 0.25 2.0 19.9 24.0 50.0 1 1 1
22 6.1 62.000 1320.00 1.9 8.0 100.0 267.0 1 1 1
23 11.9 0.023 0.40 1.3 13.2 3.2 19.0 4 1 3
24 10.8 0.048 0.33 2.0 12.8 2.0 30.0 4 1 3
25 13.8 1.700 6.30 5.6 19.4 5.0 12.0 2 1 1
26 14.3 3.500 10.80 3.1 17.4 6.5 120.0 2 1 1
27 15.2 0.480 15.50 1.8 17.0 12.0 140.0 2 2 2
28 10.0 10.000 115.00 0.9 10.9 20.2 170.0 4 4 4
29 11.9 1.620 11.40 1.8 13.7 13.0 17.0 2 1 2
30 6.5 192.000 180.00 1.9 8.4 27.0 115.0 4 4 4
31 7.5 2.500 12.10 0.9 8.4 18.0 31.0 5 5 5
32 10.6 0.280 1.90 2.6 13.2 4.7 21.0 3 1 3
33 7.4 4.235 50.40 2.4 9.8 9.8 52.0 1 1 1
34 8.4 6.800 179.00 1.2 9.6 29.0 164.0 2 3 2
35 5.7 0.750 12.30 0.9 6.6 7.0 225.0 2 2 2
36 4.9 3.600 21.00 0.5 5.4 6.0 225.0 3 2 3
37 3.2 55.500 175.00 0.6 3.8 20.0 151.0 5 5 5
38 11.0 0.900 2.60 2.3 13.3 4.5 60.0 2 1 2
39 4.9 2.000 12.30 0.5 5.4 7.5 200.0 3 1 3
40 13.2 0.104 2.50 2.6 15.8 2.3 46.0 3 2 2
41 9.7 4.190 58.00 0.6 10.3 24.0 210.0 4 3 4
42 12.8 3.500 3.90 6.6 19.4 3.0 14.0 2 1 1
43 6.3 1.000 6.60 2.0 8.3 4.5 42.0 3 1 3
44 2.1 2547.000 4603.00 1.8 3.9 69.0 624.0 3 5 4
45 9.1 10.550 179.50 0.7 9.8 27.0 180.0 4 4 4
46 15.8 0.023 0.30 3.9 19.7 19.0 35.0 1 1 1
47 5.2 160.000 169.00 1.0 6.2 30.4 392.0 4 5 4
48 10.9 3.300 25.60 3.6 14.5 28.0 63.0 1 2 1
49 8.3 52.160 440.00 1.4 9.7 50.0 230.0 1 1 1
50 11.0 0.425 6.40 1.5 12.5 7.0 112.0 5 4 4
51 3.2 465.000 423.00 0.7 3.9 30.0 281.0 5 5 5
52 6.3 0.075 1.20 2.1 8.4 3.5 42.0 1 1 1
53 8.6 3.000 25.00 0.0 8.6 50.0 28.0 2 2 2
54 6.6 0.785 3.50 4.1 10.7 6.0 42.0 2 2 2
55 9.5 0.200 5.00 1.2 10.7 10.4 120.0 2 2 2
56 3.3 27.660 115.00 0.5 3.8 20.0 148.0 5 5 5
57 11.0 0.120 1.00 3.4 14.4 3.9 16.0 3 1 2
58 4.7 85.000 325.00 1.5 6.2 41.0 310.0 1 3 1
59 10.4 0.101 4.00 3.4 13.8 9.0 28.0 5 1 3
60 7.4 1.040 5.50 0.8 8.2 7.6 68.0 5 3 4
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) BodyW BrainW PS TS LifeSpan
3.903e-15 -2.608e-18 3.736e-19 -1.000e+00 1.000e+00 -6.560e-18
GT PI SEI ODI
-1.181e-18 -1.807e-15 -1.419e-15 3.097e-15
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-5.385e-15 -1.571e-15 -4.512e-16 9.110e-16 2.830e-14
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.903e-15 4.105e-15 9.510e-01 0.346
BodyW -2.608e-18 7.423e-18 -3.510e-01 0.727
BrainW 3.736e-19 4.372e-18 8.500e-02 0.932
PS -1.000e+00 7.432e-16 -1.345e+15 <2e-16 ***
TS 1.000e+00 2.298e-16 4.352e+15 <2e-16 ***
LifeSpan -6.560e-18 5.666e-17 -1.160e-01 0.908
GT -1.181e-18 9.578e-18 -1.230e-01 0.902
PI -1.807e-15 1.459e-15 -1.238e+00 0.221
SEI -1.419e-15 9.077e-16 -1.563e+00 0.124
ODI 3.097e-15 2.115e-15 1.464e+00 0.149
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 4.487e-15 on 50 degrees of freedom
Multiple R-squared: 1, Adjusted R-squared: 1
F-statistic: 4.518e+30 on 9 and 50 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,] 4.174571e-01 8.349143e-01 5.825429e-01
[2,] 2.356975e-02 4.713950e-02 9.764302e-01
[3,] 9.398484e-01 1.203031e-01 6.015155e-02
[4,] 7.387722e-05 1.477544e-04 9.999261e-01
[5,] 1.657093e-02 3.314186e-02 9.834291e-01
[6,] 6.862309e-01 6.275381e-01 3.137691e-01
[7,] 9.786099e-06 1.957220e-05 9.999902e-01
[8,] 1.326751e-01 2.653501e-01 8.673249e-01
[9,] 9.999671e-01 6.578913e-05 3.289457e-05
[10,] 5.166807e-02 1.033361e-01 9.483319e-01
[11,] 4.688525e-01 9.377050e-01 5.311475e-01
[12,] 4.392792e-05 8.785583e-05 9.999561e-01
[13,] 9.999989e-01 2.252494e-06 1.126247e-06
[14,] 2.048848e-08 4.097696e-08 1.000000e+00
[15,] 1.493341e-01 2.986682e-01 8.506659e-01
[16,] 3.735690e-01 7.471381e-01 6.264310e-01
[17,] 9.985621e-01 2.875860e-03 1.437930e-03
[18,] 5.855557e-01 8.288887e-01 4.144443e-01
[19,] 9.999348e-01 1.304997e-04 6.524986e-05
[20,] 3.922199e-04 7.844397e-04 9.996078e-01
[21,] 5.352289e-01 9.295423e-01 4.647711e-01
[22,] 2.268273e-04 4.536547e-04 9.997732e-01
[23,] 4.889702e-01 9.779404e-01 5.110298e-01
[24,] 1.465521e-01 2.931042e-01 8.534479e-01
[25,] 9.480447e-01 1.039107e-01 5.195534e-02
[26,] 7.946171e-01 4.107659e-01 2.053829e-01
[27,] 7.220148e-03 1.444030e-02 9.927799e-01
[28,] 4.500608e-02 9.001217e-02 9.549939e-01
[29,] 3.888476e-01 7.776952e-01 6.111524e-01
[30,] 9.140193e-03 1.828039e-02 9.908598e-01
[31,] 9.529764e-01 9.404728e-02 4.702364e-02
[32,] 7.324238e-01 5.351524e-01 2.675762e-01
[33,] 5.456317e-01 9.087367e-01 4.543683e-01
[34,] 2.463897e-01 4.927794e-01 7.536103e-01
[35,] 2.958929e-01 5.917857e-01 7.041071e-01
> postscript(file="/var/www/html/rcomp/tmp/182kw1291664871.ps",horizontal=F,onefile=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/282kw1291664871.ps",horizontal=F,onefile=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/31cji1291664871.ps",horizontal=F,onefile=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/41cji1291664871.ps",horizontal=F,onefile=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/51cji1291664871.ps",horizontal=F,onefile=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
2.829843e-14 -1.550574e-15 -6.740024e-16 3.786048e-15 -8.716750e-16
6 7 8 9 10
-1.074969e-15 9.109757e-16 2.612965e-15 -1.310665e-17 -2.410506e-15
11 12 13 14 15
3.597454e-16 -2.917074e-15 2.854172e-16 -1.502510e-16 -1.632366e-15
16 17 18 19 20
1.936241e-15 -1.830672e-15 1.085100e-15 -9.896008e-16 -1.361653e-15
21 22 23 24 25
-7.191018e-16 -1.117433e-15 -5.046168e-16 -1.265731e-15 2.123539e-15
26 27 28 29 30
3.232148e-15 -1.361799e-15 -6.801582e-16 -3.978630e-16 -1.057199e-15
31 32 33 34 35
-8.162367e-17 -3.489397e-15 -2.119765e-15 1.583030e-15 -2.285560e-16
36 37 38 39 40
-2.224853e-15 -2.861329e-16 -3.623118e-15 -3.640653e-15 9.110096e-17
41 42 43 44 45
-2.656005e-15 9.984542e-16 -5.384755e-15 1.672525e-15 -1.030606e-15
46 47 48 49 50
-3.472487e-16 1.555851e-15 -1.074969e-15 9.109757e-16 2.612965e-15
51 52 53 54 55
-1.310665e-17 -2.410506e-15 3.597454e-16 -2.917074e-15 2.854172e-16
56 57 58 59 60
-1.502510e-16 -1.632366e-15 1.936241e-15 -1.830672e-15 1.085100e-15
> postscript(file="/var/www/html/rcomp/tmp/6ulj21291664871.ps",horizontal=F,onefile=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.829843e-14 NA
1 -1.550574e-15 2.829843e-14
2 -6.740024e-16 -1.550574e-15
3 3.786048e-15 -6.740024e-16
4 -8.716750e-16 3.786048e-15
5 -1.074969e-15 -8.716750e-16
6 9.109757e-16 -1.074969e-15
7 2.612965e-15 9.109757e-16
8 -1.310665e-17 2.612965e-15
9 -2.410506e-15 -1.310665e-17
10 3.597454e-16 -2.410506e-15
11 -2.917074e-15 3.597454e-16
12 2.854172e-16 -2.917074e-15
13 -1.502510e-16 2.854172e-16
14 -1.632366e-15 -1.502510e-16
15 1.936241e-15 -1.632366e-15
16 -1.830672e-15 1.936241e-15
17 1.085100e-15 -1.830672e-15
18 -9.896008e-16 1.085100e-15
19 -1.361653e-15 -9.896008e-16
20 -7.191018e-16 -1.361653e-15
21 -1.117433e-15 -7.191018e-16
22 -5.046168e-16 -1.117433e-15
23 -1.265731e-15 -5.046168e-16
24 2.123539e-15 -1.265731e-15
25 3.232148e-15 2.123539e-15
26 -1.361799e-15 3.232148e-15
27 -6.801582e-16 -1.361799e-15
28 -3.978630e-16 -6.801582e-16
29 -1.057199e-15 -3.978630e-16
30 -8.162367e-17 -1.057199e-15
31 -3.489397e-15 -8.162367e-17
32 -2.119765e-15 -3.489397e-15
33 1.583030e-15 -2.119765e-15
34 -2.285560e-16 1.583030e-15
35 -2.224853e-15 -2.285560e-16
36 -2.861329e-16 -2.224853e-15
37 -3.623118e-15 -2.861329e-16
38 -3.640653e-15 -3.623118e-15
39 9.110096e-17 -3.640653e-15
40 -2.656005e-15 9.110096e-17
41 9.984542e-16 -2.656005e-15
42 -5.384755e-15 9.984542e-16
43 1.672525e-15 -5.384755e-15
44 -1.030606e-15 1.672525e-15
45 -3.472487e-16 -1.030606e-15
46 1.555851e-15 -3.472487e-16
47 -1.074969e-15 1.555851e-15
48 9.109757e-16 -1.074969e-15
49 2.612965e-15 9.109757e-16
50 -1.310665e-17 2.612965e-15
51 -2.410506e-15 -1.310665e-17
52 3.597454e-16 -2.410506e-15
53 -2.917074e-15 3.597454e-16
54 2.854172e-16 -2.917074e-15
55 -1.502510e-16 2.854172e-16
56 -1.632366e-15 -1.502510e-16
57 1.936241e-15 -1.632366e-15
58 -1.830672e-15 1.936241e-15
59 1.085100e-15 -1.830672e-15
60 NA 1.085100e-15
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -1.550574e-15 2.829843e-14
[2,] -6.740024e-16 -1.550574e-15
[3,] 3.786048e-15 -6.740024e-16
[4,] -8.716750e-16 3.786048e-15
[5,] -1.074969e-15 -8.716750e-16
[6,] 9.109757e-16 -1.074969e-15
[7,] 2.612965e-15 9.109757e-16
[8,] -1.310665e-17 2.612965e-15
[9,] -2.410506e-15 -1.310665e-17
[10,] 3.597454e-16 -2.410506e-15
[11,] -2.917074e-15 3.597454e-16
[12,] 2.854172e-16 -2.917074e-15
[13,] -1.502510e-16 2.854172e-16
[14,] -1.632366e-15 -1.502510e-16
[15,] 1.936241e-15 -1.632366e-15
[16,] -1.830672e-15 1.936241e-15
[17,] 1.085100e-15 -1.830672e-15
[18,] -9.896008e-16 1.085100e-15
[19,] -1.361653e-15 -9.896008e-16
[20,] -7.191018e-16 -1.361653e-15
[21,] -1.117433e-15 -7.191018e-16
[22,] -5.046168e-16 -1.117433e-15
[23,] -1.265731e-15 -5.046168e-16
[24,] 2.123539e-15 -1.265731e-15
[25,] 3.232148e-15 2.123539e-15
[26,] -1.361799e-15 3.232148e-15
[27,] -6.801582e-16 -1.361799e-15
[28,] -3.978630e-16 -6.801582e-16
[29,] -1.057199e-15 -3.978630e-16
[30,] -8.162367e-17 -1.057199e-15
[31,] -3.489397e-15 -8.162367e-17
[32,] -2.119765e-15 -3.489397e-15
[33,] 1.583030e-15 -2.119765e-15
[34,] -2.285560e-16 1.583030e-15
[35,] -2.224853e-15 -2.285560e-16
[36,] -2.861329e-16 -2.224853e-15
[37,] -3.623118e-15 -2.861329e-16
[38,] -3.640653e-15 -3.623118e-15
[39,] 9.110096e-17 -3.640653e-15
[40,] -2.656005e-15 9.110096e-17
[41,] 9.984542e-16 -2.656005e-15
[42,] -5.384755e-15 9.984542e-16
[43,] 1.672525e-15 -5.384755e-15
[44,] -1.030606e-15 1.672525e-15
[45,] -3.472487e-16 -1.030606e-15
[46,] 1.555851e-15 -3.472487e-16
[47,] -1.074969e-15 1.555851e-15
[48,] 9.109757e-16 -1.074969e-15
[49,] 2.612965e-15 9.109757e-16
[50,] -1.310665e-17 2.612965e-15
[51,] -2.410506e-15 -1.310665e-17
[52,] 3.597454e-16 -2.410506e-15
[53,] -2.917074e-15 3.597454e-16
[54,] 2.854172e-16 -2.917074e-15
[55,] -1.502510e-16 2.854172e-16
[56,] -1.632366e-15 -1.502510e-16
[57,] 1.936241e-15 -1.632366e-15
[58,] -1.830672e-15 1.936241e-15
[59,] 1.085100e-15 -1.830672e-15
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -1.550574e-15 2.829843e-14
2 -6.740024e-16 -1.550574e-15
3 3.786048e-15 -6.740024e-16
4 -8.716750e-16 3.786048e-15
5 -1.074969e-15 -8.716750e-16
6 9.109757e-16 -1.074969e-15
7 2.612965e-15 9.109757e-16
8 -1.310665e-17 2.612965e-15
9 -2.410506e-15 -1.310665e-17
10 3.597454e-16 -2.410506e-15
11 -2.917074e-15 3.597454e-16
12 2.854172e-16 -2.917074e-15
13 -1.502510e-16 2.854172e-16
14 -1.632366e-15 -1.502510e-16
15 1.936241e-15 -1.632366e-15
16 -1.830672e-15 1.936241e-15
17 1.085100e-15 -1.830672e-15
18 -9.896008e-16 1.085100e-15
19 -1.361653e-15 -9.896008e-16
20 -7.191018e-16 -1.361653e-15
21 -1.117433e-15 -7.191018e-16
22 -5.046168e-16 -1.117433e-15
23 -1.265731e-15 -5.046168e-16
24 2.123539e-15 -1.265731e-15
25 3.232148e-15 2.123539e-15
26 -1.361799e-15 3.232148e-15
27 -6.801582e-16 -1.361799e-15
28 -3.978630e-16 -6.801582e-16
29 -1.057199e-15 -3.978630e-16
30 -8.162367e-17 -1.057199e-15
31 -3.489397e-15 -8.162367e-17
32 -2.119765e-15 -3.489397e-15
33 1.583030e-15 -2.119765e-15
34 -2.285560e-16 1.583030e-15
35 -2.224853e-15 -2.285560e-16
36 -2.861329e-16 -2.224853e-15
37 -3.623118e-15 -2.861329e-16
38 -3.640653e-15 -3.623118e-15
39 9.110096e-17 -3.640653e-15
40 -2.656005e-15 9.110096e-17
41 9.984542e-16 -2.656005e-15
42 -5.384755e-15 9.984542e-16
43 1.672525e-15 -5.384755e-15
44 -1.030606e-15 1.672525e-15
45 -3.472487e-16 -1.030606e-15
46 1.555851e-15 -3.472487e-16
47 -1.074969e-15 1.555851e-15
48 9.109757e-16 -1.074969e-15
49 2.612965e-15 9.109757e-16
50 -1.310665e-17 2.612965e-15
51 -2.410506e-15 -1.310665e-17
52 3.597454e-16 -2.410506e-15
53 -2.917074e-15 3.597454e-16
54 2.854172e-16 -2.917074e-15
55 -1.502510e-16 2.854172e-16
56 -1.632366e-15 -1.502510e-16
57 1.936241e-15 -1.632366e-15
58 -1.830672e-15 1.936241e-15
59 1.085100e-15 -1.830672e-15
> 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/7mu0n1291664871.ps",horizontal=F,onefile=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/8mu0n1291664871.ps",horizontal=F,onefile=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/9flz81291664871.ps",horizontal=F,onefile=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/10flz81291664871.ps",horizontal=F,onefile=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/11tvfz1291664871.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/12wevn1291664871.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/13t5be1291664871.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/14w6a21291664871.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/15ho8p1291664871.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/16vyog1291664871.tab")
+ }
>
> try(system("convert tmp/182kw1291664871.ps tmp/182kw1291664871.png",intern=TRUE))
character(0)
> try(system("convert tmp/282kw1291664871.ps tmp/282kw1291664871.png",intern=TRUE))
character(0)
> try(system("convert tmp/31cji1291664871.ps tmp/31cji1291664871.png",intern=TRUE))
character(0)
> try(system("convert tmp/41cji1291664871.ps tmp/41cji1291664871.png",intern=TRUE))
character(0)
> try(system("convert tmp/51cji1291664871.ps tmp/51cji1291664871.png",intern=TRUE))
character(0)
> try(system("convert tmp/6ulj21291664871.ps tmp/6ulj21291664871.png",intern=TRUE))
character(0)
> try(system("convert tmp/7mu0n1291664871.ps tmp/7mu0n1291664871.png",intern=TRUE))
character(0)
> try(system("convert tmp/8mu0n1291664871.ps tmp/8mu0n1291664871.png",intern=TRUE))
character(0)
> try(system("convert tmp/9flz81291664871.ps tmp/9flz81291664871.png",intern=TRUE))
character(0)
> try(system("convert tmp/10flz81291664871.ps tmp/10flz81291664871.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.530 1.631 5.731