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(6654
+ ,5712
+ ,-999
+ ,-999
+ ,3.3
+ ,38.6
+ ,645
+ ,3
+ ,5
+ ,3
+ ,1
+ ,6.6
+ ,6.3
+ ,2
+ ,8.3
+ ,4.5
+ ,42
+ ,3
+ ,1
+ ,3
+ ,3.385
+ ,44.5
+ ,-999
+ ,-999
+ ,12.5
+ ,14
+ ,60
+ ,1
+ ,1
+ ,1
+ ,0.92
+ ,5.7
+ ,-999
+ ,-999
+ ,16.5
+ ,-999
+ ,25
+ ,5
+ ,2
+ ,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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3
+ ,13.3
+ ,4.5
+ ,60
+ ,2
+ ,1
+ ,2
+ ,2
+ ,12.3
+ ,4.9
+ ,0.5
+ ,5.4
+ ,7.5
+ ,200
+ ,3
+ ,1
+ ,3
+ ,0.104
+ ,2.5
+ ,13.2
+ ,2.6
+ ,15.8
+ ,2.3
+ ,46
+ ,3
+ ,2
+ ,2
+ ,4.19
+ ,58
+ ,9.7
+ ,0.6
+ ,10.3
+ ,24
+ ,210
+ ,4
+ ,3
+ ,4
+ ,3.5
+ ,3.9
+ ,12.8
+ ,6.6
+ ,19.4
+ ,3
+ ,14
+ ,2
+ ,1
+ ,1
+ ,4.05
+ ,17
+ ,-999
+ ,-999
+ ,-999
+ ,13
+ ,38
+ ,3
+ ,1
+ ,1)
+ ,dim=c(10
+ ,62)
+ ,dimnames=list(c('bodyweight'
+ ,'brainweight'
+ ,'sws'
+ ,'ps'
+ ,'total'
+ ,'lifespan'
+ ,'gesttime'
+ ,'pindex'
+ ,'expindex'
+ ,'dangindex')
+ ,1:62))
> y <- array(NA,dim=c(10,62),dimnames=list(c('bodyweight','brainweight','sws','ps','total','lifespan','gesttime','pindex','expindex','dangindex'),1:62))
> 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 bodyweight brainweight ps total lifespan gesttime pindex
1 -999.0 6654.000 5712.00 -999.0 3.3 38.6 645.0 3
2 6.3 1.000 6.60 2.0 8.3 4.5 42.0 3
3 -999.0 3.385 44.50 -999.0 12.5 14.0 60.0 1
4 -999.0 0.920 5.70 -999.0 16.5 -999.0 25.0 5
5 2.1 2547.000 4603.00 1.8 3.9 69.0 624.0 3
6 9.1 10.550 179.50 0.7 9.8 27.0 180.0 4
7 15.8 0.023 0.30 3.9 19.7 19.0 35.0 1
8 5.2 160.000 169.00 1.0 6.2 30.4 392.0 4
9 10.9 3.300 25.60 3.6 14.5 28.0 63.0 1
10 8.3 52.160 440.00 1.4 9.7 50.0 230.0 1
11 11.0 0.425 6.40 1.5 12.5 7.0 112.0 5
12 3.2 465.000 423.00 0.7 3.9 30.0 281.0 5
13 7.6 0.550 2.40 2.7 10.3 -999.0 -999.0 2
14 -999.0 187.100 419.00 -999.0 3.1 40.0 365.0 5
15 6.3 0.075 1.20 2.1 8.4 3.5 42.0 1
16 8.6 3.000 25.00 0.0 8.6 50.0 28.0 2
17 6.6 0.785 3.50 4.1 10.7 6.0 42.0 2
18 9.5 0.200 5.00 1.2 10.7 10.4 120.0 2
19 4.8 1.410 17.50 1.3 6.1 34.0 -999.0 1
20 12.0 60.000 81.00 6.1 18.1 7.0 -999.0 1
21 -999.0 529.000 680.00 0.3 -999.0 28.0 400.0 5
22 3.3 27.660 115.00 0.5 3.8 20.0 148.0 5
23 11.0 0.120 1.00 3.4 14.4 3.9 16.0 3
24 -999.0 207.000 406.00 -999.0 12.0 39.3 252.0 1
25 4.7 85.000 325.00 1.5 6.2 41.0 310.0 1
26 -999.0 36.330 119.50 -999.0 13.0 16.2 63.0 1
27 10.4 0.101 4.00 3.4 13.8 9.0 28.0 5
28 7.4 1.040 5.50 0.8 8.2 7.6 68.0 5
29 2.1 521.000 655.00 0.8 2.9 46.0 336.0 5
30 -999.0 100.000 157.00 -999.0 10.8 22.4 100.0 1
31 -999.0 35.000 56.00 -999.0 -999.0 16.3 33.0 3
32 7.7 0.005 0.14 1.4 9.1 2.6 21.5 5
33 17.9 0.010 0.25 2.0 19.9 24.0 50.0 1
34 6.1 62.000 1320.00 1.9 8.0 100.0 267.0 1
35 8.2 0.122 3.00 2.4 10.6 -999.0 30.0 2
36 8.4 1.350 8.10 2.8 11.2 -999.0 45.0 3
37 11.9 0.023 0.40 1.3 13.2 3.2 19.0 4
38 10.8 0.048 0.33 2.0 12.8 2.0 30.0 4
39 13.8 1.700 6.30 5.6 19.4 5.0 12.0 2
40 14.3 3.500 10.80 3.1 17.4 6.5 120.0 2
41 -999.0 250.000 490.00 1.0 -999.0 23.6 440.0 5
42 15.2 0.480 15.50 1.8 17.0 12.0 140.0 2
43 10.0 10.000 115.00 0.9 10.9 20.2 170.0 4
44 11.9 1.620 11.40 1.8 13.7 13.0 17.0 2
45 6.5 192.000 180.00 1.9 8.4 27.0 115.0 4
46 7.5 2.500 12.10 0.9 8.4 18.0 31.0 5
47 -999.0 4.288 39.20 -999.0 12.5 13.7 63.0 2
48 10.6 0.280 1.90 2.6 13.2 4.7 21.0 3
49 7.4 4.235 50.40 2.4 9.8 9.8 52.0 1
50 8.4 6.800 179.00 1.2 9.6 29.0 164.0 2
51 5.7 0.750 12.30 0.9 6.6 7.0 225.0 2
52 4.9 3.600 21.00 0.5 5.4 6.0 225.0 3
53 -999.0 14.830 98.20 -999.0 2.6 17.0 150.0 5
54 3.2 55.500 175.00 0.6 3.8 20.0 151.0 5
55 -999.0 1.400 12.50 -999.0 11.0 12.7 90.0 2
56 8.1 0.060 1.00 2.2 10.3 3.5 -999.0 3
57 11.0 0.900 2.60 2.3 13.3 4.5 60.0 2
58 4.9 2.000 12.30 0.5 5.4 7.5 200.0 3
59 13.2 0.104 2.50 2.6 15.8 2.3 46.0 3
60 9.7 4.190 58.00 0.6 10.3 24.0 210.0 4
61 12.8 3.500 3.90 6.6 19.4 3.0 14.0 2
62 -999.0 4.050 17.00 -999.0 -999.0 13.0 38.0 3
expindex dangindex
1 5 3
2 1 3
3 1 1
4 2 3
5 5 4
6 4 4
7 1 1
8 5 4
9 2 1
10 1 1
11 4 4
12 5 5
13 1 2
14 5 5
15 1 1
16 2 2
17 2 2
18 2 2
19 2 1
20 1 1
21 5 5
22 5 5
23 1 2
24 4 1
25 3 1
26 1 1
27 1 3
28 3 4
29 5 5
30 1 1
31 5 4
32 2 4
33 1 1
34 1 1
35 1 1
36 1 3
37 1 3
38 1 3
39 1 1
40 1 1
41 5 5
42 2 2
43 4 4
44 1 2
45 4 4
46 5 5
47 2 2
48 1 3
49 1 1
50 3 2
51 2 2
52 2 3
53 5 5
54 5 5
55 2 2
56 1 2
57 1 2
58 1 3
59 2 2
60 3 4
61 1 1
62 1 1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) bodyweight brainweight ps total lifespan
11.504755 -0.017007 0.009475 0.889923 0.514277 0.041955
gesttime pindex expindex dangindex
-0.059925 16.838049 -0.744570 -27.339938
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-416.41 -16.18 10.45 32.31 456.22
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 11.504755 39.841086 0.289 0.774
bodyweight -0.017007 0.053476 -0.318 0.752
brainweight 0.009475 0.053318 0.178 0.860
ps 0.889923 0.045272 19.657 < 2e-16 ***
total 0.514277 0.069534 7.396 1.16e-09 ***
lifespan 0.041955 0.069446 0.604 0.548
gesttime -0.059925 0.062245 -0.963 0.340
pindex 16.838049 31.647525 0.532 0.597
expindex -0.744570 20.792592 -0.036 0.972
dangindex -27.339938 41.048110 -0.666 0.508
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 126.8 on 52 degrees of freedom
Multiple R-squared: 0.9241, Adjusted R-squared: 0.9109
F-statistic: 70.3 on 9 and 52 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,] 5.855305e-06 1.171061e-05 9.999941e-01
[2,] 2.492121e-07 4.984242e-07 9.999998e-01
[3,] 3.985434e-09 7.970868e-09 1.000000e+00
[4,] 1.217122e-10 2.434244e-10 1.000000e+00
[5,] 9.927267e-12 1.985453e-11 1.000000e+00
[6,] 2.482474e-13 4.964948e-13 1.000000e+00
[7,] 6.355391e-15 1.271078e-14 1.000000e+00
[8,] 2.343356e-16 4.686711e-16 1.000000e+00
[9,] 3.333502e-16 6.667003e-16 1.000000e+00
[10,] 8.355290e-18 1.671058e-17 1.000000e+00
[11,] 1.976426e-19 3.952852e-19 1.000000e+00
[12,] 5.040587e-21 1.008117e-20 1.000000e+00
[13,] 1.400806e-22 2.801612e-22 1.000000e+00
[14,] 3.839304e-24 7.678608e-24 1.000000e+00
[15,] 8.456286e-26 1.691257e-25 1.000000e+00
[16,] 2.122076e-27 4.244152e-27 1.000000e+00
[17,] 3.616298e-27 7.232596e-27 1.000000e+00
[18,] 9.359304e-29 1.871861e-28 1.000000e+00
[19,] 9.026207e-01 1.947587e-01 9.737933e-02
[20,] 8.650030e-01 2.699940e-01 1.349970e-01
[21,] 8.119842e-01 3.760315e-01 1.880158e-01
[22,] 9.146707e-01 1.706585e-01 8.532927e-02
[23,] 8.887595e-01 2.224809e-01 1.112405e-01
[24,] 9.878636e-01 2.427290e-02 1.213645e-02
[25,] 9.789153e-01 4.216930e-02 2.108465e-02
[26,] 9.643500e-01 7.129996e-02 3.564998e-02
[27,] 9.478934e-01 1.042131e-01 5.210656e-02
[28,] 9.408548e-01 1.182905e-01 5.914525e-02
[29,] 1.000000e+00 5.274681e-17 2.637340e-17
[30,] 1.000000e+00 2.400055e-16 1.200028e-16
[31,] 1.000000e+00 6.452798e-15 3.226399e-15
[32,] 1.000000e+00 2.081118e-13 1.040559e-13
[33,] 1.000000e+00 6.950010e-12 3.475005e-12
[34,] 1.000000e+00 3.912409e-10 1.956205e-10
[35,] 1.000000e+00 2.083719e-08 1.041860e-08
[36,] 9.999996e-01 7.466744e-07 3.733372e-07
[37,] 9.999805e-01 3.893345e-05 1.946673e-05
> postscript(file="/var/www/html/rcomp/tmp/1nozi1292670767.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/2nozi1292670767.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/3xxh31292670767.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/4xxh31292670767.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/5xxh31292670767.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 = 62
Frequency = 1
1 2 3 4 5 6
8.1366454 23.2796674 -114.0093433 -87.2657496 83.7591462 45.0506759
7 8 9 10 11 12
3.2375370 58.6822973 3.1396554 10.2105829 26.2442002 64.7796288
13 14 15 16 17 18
-7.8220201 -47.4268274 2.2128575 14.5597015 10.6820290 20.6282007
19 20 21 22 23 24
-60.4411549 -62.9011091 -415.4277673 53.0389639 -5.2380382 -101.0365718
25 26 27 28 29 30
16.6303907 -114.3293155 -11.3892485 22.0910768 65.4837791 -110.5132702
31 32 33 34 35 36
456.2178625 18.1061433 7.6148910 0.3890239 27.2006772 65.4494075
37 38 39 40 41 42
8.8629997 8.0563740 -17.7783369 -7.6280226 -416.4138410 23.5909549
43 44 45 46 47 48
45.4947904 13.8889929 41.2887856 48.1370470 -102.5049505 23.2912256
49 50 51 52 53 54
2.2654240 21.1584740 25.5786804 36.2616648 -58.9789231 52.9347381
55 56 57 58 59 60
-99.8697457 -65.7697877 15.7542676 34.0112543 -0.4511213 47.7045847
61 62
-19.4111490 371.5009948
> postscript(file="/var/www/html/rcomp/tmp/68oy51292670767.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 = 62
Frequency = 1
lag(myerror, k = 1) myerror
0 8.1366454 NA
1 23.2796674 8.1366454
2 -114.0093433 23.2796674
3 -87.2657496 -114.0093433
4 83.7591462 -87.2657496
5 45.0506759 83.7591462
6 3.2375370 45.0506759
7 58.6822973 3.2375370
8 3.1396554 58.6822973
9 10.2105829 3.1396554
10 26.2442002 10.2105829
11 64.7796288 26.2442002
12 -7.8220201 64.7796288
13 -47.4268274 -7.8220201
14 2.2128575 -47.4268274
15 14.5597015 2.2128575
16 10.6820290 14.5597015
17 20.6282007 10.6820290
18 -60.4411549 20.6282007
19 -62.9011091 -60.4411549
20 -415.4277673 -62.9011091
21 53.0389639 -415.4277673
22 -5.2380382 53.0389639
23 -101.0365718 -5.2380382
24 16.6303907 -101.0365718
25 -114.3293155 16.6303907
26 -11.3892485 -114.3293155
27 22.0910768 -11.3892485
28 65.4837791 22.0910768
29 -110.5132702 65.4837791
30 456.2178625 -110.5132702
31 18.1061433 456.2178625
32 7.6148910 18.1061433
33 0.3890239 7.6148910
34 27.2006772 0.3890239
35 65.4494075 27.2006772
36 8.8629997 65.4494075
37 8.0563740 8.8629997
38 -17.7783369 8.0563740
39 -7.6280226 -17.7783369
40 -416.4138410 -7.6280226
41 23.5909549 -416.4138410
42 45.4947904 23.5909549
43 13.8889929 45.4947904
44 41.2887856 13.8889929
45 48.1370470 41.2887856
46 -102.5049505 48.1370470
47 23.2912256 -102.5049505
48 2.2654240 23.2912256
49 21.1584740 2.2654240
50 25.5786804 21.1584740
51 36.2616648 25.5786804
52 -58.9789231 36.2616648
53 52.9347381 -58.9789231
54 -99.8697457 52.9347381
55 -65.7697877 -99.8697457
56 15.7542676 -65.7697877
57 34.0112543 15.7542676
58 -0.4511213 34.0112543
59 47.7045847 -0.4511213
60 -19.4111490 47.7045847
61 371.5009948 -19.4111490
62 NA 371.5009948
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 23.2796674 8.1366454
[2,] -114.0093433 23.2796674
[3,] -87.2657496 -114.0093433
[4,] 83.7591462 -87.2657496
[5,] 45.0506759 83.7591462
[6,] 3.2375370 45.0506759
[7,] 58.6822973 3.2375370
[8,] 3.1396554 58.6822973
[9,] 10.2105829 3.1396554
[10,] 26.2442002 10.2105829
[11,] 64.7796288 26.2442002
[12,] -7.8220201 64.7796288
[13,] -47.4268274 -7.8220201
[14,] 2.2128575 -47.4268274
[15,] 14.5597015 2.2128575
[16,] 10.6820290 14.5597015
[17,] 20.6282007 10.6820290
[18,] -60.4411549 20.6282007
[19,] -62.9011091 -60.4411549
[20,] -415.4277673 -62.9011091
[21,] 53.0389639 -415.4277673
[22,] -5.2380382 53.0389639
[23,] -101.0365718 -5.2380382
[24,] 16.6303907 -101.0365718
[25,] -114.3293155 16.6303907
[26,] -11.3892485 -114.3293155
[27,] 22.0910768 -11.3892485
[28,] 65.4837791 22.0910768
[29,] -110.5132702 65.4837791
[30,] 456.2178625 -110.5132702
[31,] 18.1061433 456.2178625
[32,] 7.6148910 18.1061433
[33,] 0.3890239 7.6148910
[34,] 27.2006772 0.3890239
[35,] 65.4494075 27.2006772
[36,] 8.8629997 65.4494075
[37,] 8.0563740 8.8629997
[38,] -17.7783369 8.0563740
[39,] -7.6280226 -17.7783369
[40,] -416.4138410 -7.6280226
[41,] 23.5909549 -416.4138410
[42,] 45.4947904 23.5909549
[43,] 13.8889929 45.4947904
[44,] 41.2887856 13.8889929
[45,] 48.1370470 41.2887856
[46,] -102.5049505 48.1370470
[47,] 23.2912256 -102.5049505
[48,] 2.2654240 23.2912256
[49,] 21.1584740 2.2654240
[50,] 25.5786804 21.1584740
[51,] 36.2616648 25.5786804
[52,] -58.9789231 36.2616648
[53,] 52.9347381 -58.9789231
[54,] -99.8697457 52.9347381
[55,] -65.7697877 -99.8697457
[56,] 15.7542676 -65.7697877
[57,] 34.0112543 15.7542676
[58,] -0.4511213 34.0112543
[59,] 47.7045847 -0.4511213
[60,] -19.4111490 47.7045847
[61,] 371.5009948 -19.4111490
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 23.2796674 8.1366454
2 -114.0093433 23.2796674
3 -87.2657496 -114.0093433
4 83.7591462 -87.2657496
5 45.0506759 83.7591462
6 3.2375370 45.0506759
7 58.6822973 3.2375370
8 3.1396554 58.6822973
9 10.2105829 3.1396554
10 26.2442002 10.2105829
11 64.7796288 26.2442002
12 -7.8220201 64.7796288
13 -47.4268274 -7.8220201
14 2.2128575 -47.4268274
15 14.5597015 2.2128575
16 10.6820290 14.5597015
17 20.6282007 10.6820290
18 -60.4411549 20.6282007
19 -62.9011091 -60.4411549
20 -415.4277673 -62.9011091
21 53.0389639 -415.4277673
22 -5.2380382 53.0389639
23 -101.0365718 -5.2380382
24 16.6303907 -101.0365718
25 -114.3293155 16.6303907
26 -11.3892485 -114.3293155
27 22.0910768 -11.3892485
28 65.4837791 22.0910768
29 -110.5132702 65.4837791
30 456.2178625 -110.5132702
31 18.1061433 456.2178625
32 7.6148910 18.1061433
33 0.3890239 7.6148910
34 27.2006772 0.3890239
35 65.4494075 27.2006772
36 8.8629997 65.4494075
37 8.0563740 8.8629997
38 -17.7783369 8.0563740
39 -7.6280226 -17.7783369
40 -416.4138410 -7.6280226
41 23.5909549 -416.4138410
42 45.4947904 23.5909549
43 13.8889929 45.4947904
44 41.2887856 13.8889929
45 48.1370470 41.2887856
46 -102.5049505 48.1370470
47 23.2912256 -102.5049505
48 2.2654240 23.2912256
49 21.1584740 2.2654240
50 25.5786804 21.1584740
51 36.2616648 25.5786804
52 -58.9789231 36.2616648
53 52.9347381 -58.9789231
54 -99.8697457 52.9347381
55 -65.7697877 -99.8697457
56 15.7542676 -65.7697877
57 34.0112543 15.7542676
58 -0.4511213 34.0112543
59 47.7045847 -0.4511213
60 -19.4111490 47.7045847
61 371.5009948 -19.4111490
> 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/78oy51292670767.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/8jff81292670767.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/9jff81292670767.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')
Warning messages:
1: In sqrt(crit * p * (1 - hh)/hh) : NaNs produced
2: In sqrt(crit * p * (1 - hh)/hh) : NaNs produced
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/www/html/rcomp/tmp/10tpeb1292670767.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/11x7dh1292670767.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/12iqb51292670767.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/13wzrw1292670767.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/14pr8h1292670767.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/15s9p41292670767.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/16oj5v1292670767.tab")
+ }
>
> try(system("convert tmp/1nozi1292670767.ps tmp/1nozi1292670767.png",intern=TRUE))
character(0)
> try(system("convert tmp/2nozi1292670767.ps tmp/2nozi1292670767.png",intern=TRUE))
character(0)
> try(system("convert tmp/3xxh31292670767.ps tmp/3xxh31292670767.png",intern=TRUE))
character(0)
> try(system("convert tmp/4xxh31292670767.ps tmp/4xxh31292670767.png",intern=TRUE))
character(0)
> try(system("convert tmp/5xxh31292670767.ps tmp/5xxh31292670767.png",intern=TRUE))
character(0)
> try(system("convert tmp/68oy51292670767.ps tmp/68oy51292670767.png",intern=TRUE))
character(0)
> try(system("convert tmp/78oy51292670767.ps tmp/78oy51292670767.png",intern=TRUE))
character(0)
> try(system("convert tmp/8jff81292670767.ps tmp/8jff81292670767.png",intern=TRUE))
character(0)
> try(system("convert tmp/9jff81292670767.ps tmp/9jff81292670767.png",intern=TRUE))
character(0)
> try(system("convert tmp/10tpeb1292670767.ps tmp/10tpeb1292670767.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.576 1.633 6.223