R version 2.12.0 (2010-10-15)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-pc-linux-gnu (32-bit)
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(6654000
+ ,5712000
+ ,-999
+ ,-999
+ ,3.3
+ ,38.6
+ ,645
+ ,3
+ ,5
+ ,3
+ ,1000
+ ,6600
+ ,6.3
+ ,2
+ ,8.3
+ ,4.5
+ ,42
+ ,3
+ ,1
+ ,3
+ ,3385
+ ,44500
+ ,-999
+ ,-999
+ ,12.5
+ ,14
+ ,60
+ ,1
+ ,1
+ ,1
+ ,0.92
+ ,5700
+ ,-999
+ ,-999
+ ,16.5
+ ,-999
+ ,25
+ ,5
+ ,2
+ ,3
+ ,2547000
+ ,4603000
+ ,2.1
+ ,1.8
+ ,3.9
+ ,69
+ ,624
+ ,3
+ ,5
+ ,4
+ ,10550
+ ,179500
+ ,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
+ ,160000
+ ,169000
+ ,5.2
+ ,1
+ ,6.2
+ ,30.4
+ ,392
+ ,4
+ ,5
+ ,4
+ ,3300
+ ,25600
+ ,10.9
+ ,3.6
+ ,14.5
+ ,28
+ ,63
+ ,1
+ ,2
+ ,1
+ ,52160
+ ,440000
+ ,8.3
+ ,1.4
+ ,9.7
+ ,50
+ ,230
+ ,1
+ ,1
+ ,1
+ ,0.425
+ ,6400
+ ,11
+ ,1.5
+ ,12.5
+ ,7
+ ,112
+ ,5
+ ,4
+ ,4
+ ,465000
+ ,423000
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9
+ ,2600
+ ,11
+ ,2.3
+ ,13.3
+ ,4.5
+ ,60
+ ,2
+ ,1
+ ,2
+ ,2000
+ ,12300
+ ,4.9
+ ,0.5
+ ,5.4
+ ,7.5
+ ,200
+ ,3
+ ,1
+ ,3
+ ,0.104
+ ,2500
+ ,13.2
+ ,2.6
+ ,15.8
+ ,2.3
+ ,46
+ ,3
+ ,2
+ ,2
+ ,4190
+ ,58000
+ ,9.7
+ ,0.6
+ ,10.3
+ ,24
+ ,210
+ ,4
+ ,3
+ ,4
+ ,3500
+ ,3900
+ ,12.8
+ ,6.6
+ ,19.4
+ ,3
+ ,14
+ ,2
+ ,1
+ ,1
+ ,4050
+ ,17000
+ ,-999
+ ,-999
+ ,-999
+ ,13
+ ,38
+ ,3
+ ,1
+ ,1)
+ ,dim=c(10
+ ,62)
+ ,dimnames=list(c('gewicht'
+ ,'brein'
+ ,'nietdroomslaap'
+ ,'droomslaap'
+ ,'totaleslaap'
+ ,'levensduur'
+ ,'zwangerschapstijd'
+ ,'prooi'
+ ,'blootgesteldheidslaap'
+ ,'algemeengevaar')
+ ,1:62))
> y <- array(NA,dim=c(10,62),dimnames=list(c('gewicht','brein','nietdroomslaap','droomslaap','totaleslaap','levensduur','zwangerschapstijd','prooi','blootgesteldheidslaap','algemeengevaar'),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 = '5'
> #'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
> 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
totaleslaap gewicht brein nietdroomslaap droomslaap levensduur
1 3.3 6.654e+06 5.712e+06 -999.0 -999.0 38.6
2 8.3 1.000e+03 6.600e+03 6.3 2.0 4.5
3 12.5 3.385e+03 4.450e+04 -999.0 -999.0 14.0
4 16.5 9.200e-01 5.700e+03 -999.0 -999.0 -999.0
5 3.9 2.547e+06 4.603e+06 2.1 1.8 69.0
6 9.8 1.055e+04 1.795e+05 9.1 0.7 27.0
7 19.7 2.300e-02 3.000e-01 15.8 3.9 19.0
8 6.2 1.600e+05 1.690e+05 5.2 1.0 30.4
9 14.5 3.300e+03 2.560e+04 10.9 3.6 28.0
10 9.7 5.216e+04 4.400e+05 8.3 1.4 50.0
11 12.5 4.250e-01 6.400e+03 11.0 1.5 7.0
12 3.9 4.650e+05 4.230e+05 3.2 0.7 30.0
13 10.3 5.500e-01 2.400e+03 7.6 2.7 -999.0
14 3.1 1.871e+05 4.190e+05 -999.0 -999.0 40.0
15 8.4 7.500e-02 1.200e+03 6.3 2.1 3.5
16 8.6 3.000e+03 2.500e+04 8.6 0.0 50.0
17 10.7 7.850e-01 3.500e+03 6.6 4.1 6.0
18 10.7 2.000e-01 5.000e+03 9.5 1.2 10.4
19 6.1 1.410e+03 1.750e+04 4.8 1.3 34.0
20 18.1 6.000e+04 8.100e+04 12.0 6.1 7.0
21 -999.0 5.290e+05 6.800e+05 -999.0 0.3 28.0
22 3.8 2.766e+04 1.150e+05 3.3 0.5 20.0
23 14.4 1.200e-01 1.000e+03 11.0 3.4 3.9
24 12.0 2.070e+05 4.060e+05 -999.0 -999.0 39.3
25 6.2 8.500e+04 3.250e+05 4.7 1.5 41.0
26 13.0 3.633e+04 1.195e+05 -999.0 -999.0 16.2
27 13.8 1.010e-01 4.000e+03 10.4 3.4 9.0
28 8.2 1.040e+03 5.500e+03 7.4 0.8 7.6
29 2.9 5.210e+05 6.550e+05 2.1 0.8 46.0
30 10.8 1.000e+05 1.570e+05 -999.0 -999.0 22.4
31 -999.0 3.500e+04 5.600e+04 -999.0 -999.0 16.3
32 9.1 5.000e-03 1.400e-01 7.7 1.4 2.6
33 19.9 1.000e-02 2.500e-01 17.9 2.0 24.0
34 8.0 6.200e+04 1.320e+06 6.1 1.9 100.0
35 10.6 1.220e-01 3.000e+03 8.2 2.4 -999.0
36 11.2 1.350e+03 8.100e+03 8.4 2.8 -999.0
37 13.2 2.300e-02 4.000e-01 11.9 1.3 3.2
38 12.8 4.800e-02 3.300e-01 10.8 2.0 2.0
39 19.4 1.700e+03 6.300e+03 13.8 5.6 5.0
40 17.4 3.500e+03 1.080e+04 14.3 3.1 6.5
41 -999.0 2.500e+05 4.900e+05 -999.0 1.0 23.6
42 17.0 4.800e-01 1.550e+04 15.2 1.8 12.0
43 10.9 1.000e+04 1.150e+05 10.0 0.9 20.2
44 13.7 1.620e+03 1.140e+04 11.9 1.8 13.0
45 8.4 1.920e+05 1.800e+05 6.5 1.9 27.0
46 8.4 2.500e+03 1.210e+04 7.5 0.9 18.0
47 12.5 4.288e+03 3.920e+04 -999.0 -999.0 13.7
48 13.2 2.800e-01 1.900e+03 10.6 2.6 4.7
49 9.8 4.235e+03 5.040e+04 7.4 2.4 9.8
50 9.6 6.800e+03 1.790e+05 8.4 1.2 29.0
51 6.6 7.500e-01 1.230e+04 5.7 0.9 7.0
52 5.4 3.600e+03 2.100e+04 4.9 0.5 6.0
53 2.6 1.483e+04 9.820e+04 -999.0 -999.0 17.0
54 3.8 5.550e+04 1.750e+05 3.2 0.6 20.0
55 11.0 1.400e+03 1.250e+04 -999.0 -999.0 12.7
56 10.3 6.000e-02 1.000e+03 8.1 2.2 3.5
57 13.3 9.000e-01 2.600e+03 11.0 2.3 4.5
58 5.4 2.000e+03 1.230e+04 4.9 0.5 7.5
59 15.8 1.040e-01 2.500e+03 13.2 2.6 2.3
60 10.3 4.190e+03 5.800e+04 9.7 0.6 24.0
61 19.4 3.500e+03 3.900e+03 12.8 6.6 3.0
62 -999.0 4.050e+03 1.700e+04 -999.0 -999.0 13.0
zwangerschapstijd prooi blootgesteldheidslaap algemeengevaar
1 645.0 3 5 3
2 42.0 3 1 3
3 60.0 1 1 1
4 25.0 5 2 3
5 624.0 3 5 4
6 180.0 4 4 4
7 35.0 1 1 1
8 392.0 4 5 4
9 63.0 1 2 1
10 230.0 1 1 1
11 112.0 5 4 4
12 281.0 5 5 5
13 -999.0 2 1 2
14 365.0 5 5 5
15 42.0 1 1 1
16 28.0 2 2 2
17 42.0 2 2 2
18 120.0 2 2 2
19 -999.0 1 2 1
20 -999.0 1 1 1
21 400.0 5 5 5
22 148.0 5 5 5
23 16.0 3 1 2
24 252.0 1 4 1
25 310.0 1 3 1
26 63.0 1 1 1
27 28.0 5 1 3
28 68.0 5 3 4
29 336.0 5 5 5
30 100.0 1 1 1
31 33.0 3 5 4
32 21.5 5 2 4
33 50.0 1 1 1
34 267.0 1 1 1
35 30.0 2 1 1
36 45.0 3 1 3
37 19.0 4 1 3
38 30.0 4 1 3
39 12.0 2 1 1
40 120.0 2 1 1
41 440.0 5 5 5
42 140.0 2 2 2
43 170.0 4 4 4
44 17.0 2 1 2
45 115.0 4 4 4
46 31.0 5 5 5
47 63.0 2 2 2
48 21.0 3 1 3
49 52.0 1 1 1
50 164.0 2 3 2
51 225.0 2 2 2
52 225.0 3 2 3
53 150.0 5 5 5
54 151.0 5 5 5
55 90.0 2 2 2
56 -999.0 3 1 2
57 60.0 2 1 2
58 200.0 3 1 3
59 46.0 3 2 2
60 210.0 4 3 4
61 14.0 2 1 1
62 38.0 3 1 1
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) gewicht brein
3.443e+01 4.287e-05 -1.826e-05
nietdroomslaap droomslaap levensduur
9.969e-01 -8.248e-01 -6.224e-02
zwangerschapstijd prooi blootgesteldheidslaap
5.326e-02 -3.642e+01 -2.015e+01
algemeengevaar
4.379e+01
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-827.96 -18.63 5.97 30.55 210.21
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.443e+01 5.531e+01 0.622 0.536
gewicht 4.287e-05 7.429e-05 0.577 0.566
brein -1.826e-05 7.421e-05 -0.246 0.807
nietdroomslaap 9.969e-01 1.348e-01 7.396 1.16e-09 ***
droomslaap -8.248e-01 1.429e-01 -5.773 4.38e-07 ***
levensduur -6.224e-02 9.664e-02 -0.644 0.522
zwangerschapstijd 5.326e-02 8.712e-02 0.611 0.544
prooi -3.642e+01 4.389e+01 -0.830 0.410
blootgesteldheidslaap -2.015e+01 2.881e+01 -0.699 0.488
algemeengevaar 4.379e+01 5.707e+01 0.767 0.446
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 176.5 on 52 degrees of freedom
Multiple R-squared: 0.5753, Adjusted R-squared: 0.5017
F-statistic: 7.825 on 9 and 52 DF, p-value: 3.509e-07
> 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.345787e-06 8.691573e-06 0.9999957
[2,] 1.109693e-07 2.219386e-07 0.9999999
[3,] 1.915995e-09 3.831990e-09 1.0000000
[4,] 5.958171e-11 1.191634e-10 1.0000000
[5,] 1.429126e-12 2.858252e-12 1.0000000
[6,] 2.087979e-14 4.175958e-14 1.0000000
[7,] 2.977659e-16 5.955318e-16 1.0000000
[8,] 5.760746e-17 1.152149e-16 1.0000000
[9,] 1.120616e-18 2.241232e-18 1.0000000
[10,] 1.693746e-20 3.387493e-20 1.0000000
[11,] 2.390810e-22 4.781620e-22 1.0000000
[12,] 5.493076e-24 1.098615e-23 1.0000000
[13,] 9.468506e-26 1.893701e-25 1.0000000
[14,] 1.893949e-27 3.787898e-27 1.0000000
[15,] 2.665992e-29 5.331984e-29 1.0000000
[16,] 4.289495e-31 8.578990e-31 1.0000000
[17,] 6.172199e-33 1.234440e-32 1.0000000
[18,] 1.677201e-34 3.354402e-34 1.0000000
[19,] 7.476601e-01 5.046799e-01 0.2523399
[20,] 6.982512e-01 6.034976e-01 0.3017488
[21,] 6.297723e-01 7.404554e-01 0.3702277
[22,] 5.846942e-01 8.306116e-01 0.4153058
[23,] 5.505036e-01 8.989928e-01 0.4494964
[24,] 6.716569e-01 6.566863e-01 0.3283431
[25,] 6.537436e-01 6.925128e-01 0.3462564
[26,] 6.946531e-01 6.106938e-01 0.3053469
[27,] 6.873218e-01 6.253563e-01 0.3126782
[28,] 7.791283e-01 4.417434e-01 0.2208717
[29,] 7.293214e-01 5.413571e-01 0.2706786
[30,] 7.223504e-01 5.552992e-01 0.2776496
[31,] 6.597448e-01 6.805104e-01 0.3402552
[32,] 5.712278e-01 8.575444e-01 0.4287722
[33,] 4.573415e-01 9.146829e-01 0.5426585
[34,] 4.377451e-01 8.754902e-01 0.5622549
[35,] 3.780504e-01 7.561009e-01 0.6219496
[36,] 2.566436e-01 5.132872e-01 0.7433564
[37,] 1.526604e-01 3.053208e-01 0.8473396
> postscript(file="/var/www/rcomp/tmp/1z7uf1321987508.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/rcomp/tmp/2z9z81321987508.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/rcomp/tmp/31lt91321987508.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/rcomp/tmp/45sqt1321987508.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/rcomp/tmp/5uxet1321987508.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
6.430237 -34.600454 161.046163 181.542201 -50.382156 12.904541
7 8 9 10 11 12
-15.164425 15.908156 3.814525 -22.407845 50.456653 5.432753
13 14 15 16 17 18
-32.993696 187.087424 -19.794561 -6.897583 -3.170141 -12.306049
19 20 21 22 23 24
56.466634 42.068768 -3.259084 24.654875 13.045809 210.207483
25 26 27 28 29 30
9.728357 161.480428 41.824324 31.340786 5.513934 155.650765
31 32 33 34 35 36
-827.960436 14.399237 -19.112722 -4.713419 -44.543856 -95.736337
37 38 39 40 41 42
1.624198 2.237581 24.745337 14.531129 3.405985 -11.967129
43 44 45 46 47 48
12.227476 -25.655554 10.777939 30.704556 173.508463 -32.404107
49 50 51 52 53 54
-18.667288 9.537477 -18.536037 -26.696855 198.134414 24.579340
55 56 57 58 59 60
170.144464 64.880649 -27.656429 -45.509218 30.069813 -11.153523
61 62
26.215038 -777.039008
> postscript(file="/var/www/rcomp/tmp/6dsrd1321987508.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 6.430237 NA
1 -34.600454 6.430237
2 161.046163 -34.600454
3 181.542201 161.046163
4 -50.382156 181.542201
5 12.904541 -50.382156
6 -15.164425 12.904541
7 15.908156 -15.164425
8 3.814525 15.908156
9 -22.407845 3.814525
10 50.456653 -22.407845
11 5.432753 50.456653
12 -32.993696 5.432753
13 187.087424 -32.993696
14 -19.794561 187.087424
15 -6.897583 -19.794561
16 -3.170141 -6.897583
17 -12.306049 -3.170141
18 56.466634 -12.306049
19 42.068768 56.466634
20 -3.259084 42.068768
21 24.654875 -3.259084
22 13.045809 24.654875
23 210.207483 13.045809
24 9.728357 210.207483
25 161.480428 9.728357
26 41.824324 161.480428
27 31.340786 41.824324
28 5.513934 31.340786
29 155.650765 5.513934
30 -827.960436 155.650765
31 14.399237 -827.960436
32 -19.112722 14.399237
33 -4.713419 -19.112722
34 -44.543856 -4.713419
35 -95.736337 -44.543856
36 1.624198 -95.736337
37 2.237581 1.624198
38 24.745337 2.237581
39 14.531129 24.745337
40 3.405985 14.531129
41 -11.967129 3.405985
42 12.227476 -11.967129
43 -25.655554 12.227476
44 10.777939 -25.655554
45 30.704556 10.777939
46 173.508463 30.704556
47 -32.404107 173.508463
48 -18.667288 -32.404107
49 9.537477 -18.667288
50 -18.536037 9.537477
51 -26.696855 -18.536037
52 198.134414 -26.696855
53 24.579340 198.134414
54 170.144464 24.579340
55 64.880649 170.144464
56 -27.656429 64.880649
57 -45.509218 -27.656429
58 30.069813 -45.509218
59 -11.153523 30.069813
60 26.215038 -11.153523
61 -777.039008 26.215038
62 NA -777.039008
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -34.600454 6.430237
[2,] 161.046163 -34.600454
[3,] 181.542201 161.046163
[4,] -50.382156 181.542201
[5,] 12.904541 -50.382156
[6,] -15.164425 12.904541
[7,] 15.908156 -15.164425
[8,] 3.814525 15.908156
[9,] -22.407845 3.814525
[10,] 50.456653 -22.407845
[11,] 5.432753 50.456653
[12,] -32.993696 5.432753
[13,] 187.087424 -32.993696
[14,] -19.794561 187.087424
[15,] -6.897583 -19.794561
[16,] -3.170141 -6.897583
[17,] -12.306049 -3.170141
[18,] 56.466634 -12.306049
[19,] 42.068768 56.466634
[20,] -3.259084 42.068768
[21,] 24.654875 -3.259084
[22,] 13.045809 24.654875
[23,] 210.207483 13.045809
[24,] 9.728357 210.207483
[25,] 161.480428 9.728357
[26,] 41.824324 161.480428
[27,] 31.340786 41.824324
[28,] 5.513934 31.340786
[29,] 155.650765 5.513934
[30,] -827.960436 155.650765
[31,] 14.399237 -827.960436
[32,] -19.112722 14.399237
[33,] -4.713419 -19.112722
[34,] -44.543856 -4.713419
[35,] -95.736337 -44.543856
[36,] 1.624198 -95.736337
[37,] 2.237581 1.624198
[38,] 24.745337 2.237581
[39,] 14.531129 24.745337
[40,] 3.405985 14.531129
[41,] -11.967129 3.405985
[42,] 12.227476 -11.967129
[43,] -25.655554 12.227476
[44,] 10.777939 -25.655554
[45,] 30.704556 10.777939
[46,] 173.508463 30.704556
[47,] -32.404107 173.508463
[48,] -18.667288 -32.404107
[49,] 9.537477 -18.667288
[50,] -18.536037 9.537477
[51,] -26.696855 -18.536037
[52,] 198.134414 -26.696855
[53,] 24.579340 198.134414
[54,] 170.144464 24.579340
[55,] 64.880649 170.144464
[56,] -27.656429 64.880649
[57,] -45.509218 -27.656429
[58,] 30.069813 -45.509218
[59,] -11.153523 30.069813
[60,] 26.215038 -11.153523
[61,] -777.039008 26.215038
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -34.600454 6.430237
2 161.046163 -34.600454
3 181.542201 161.046163
4 -50.382156 181.542201
5 12.904541 -50.382156
6 -15.164425 12.904541
7 15.908156 -15.164425
8 3.814525 15.908156
9 -22.407845 3.814525
10 50.456653 -22.407845
11 5.432753 50.456653
12 -32.993696 5.432753
13 187.087424 -32.993696
14 -19.794561 187.087424
15 -6.897583 -19.794561
16 -3.170141 -6.897583
17 -12.306049 -3.170141
18 56.466634 -12.306049
19 42.068768 56.466634
20 -3.259084 42.068768
21 24.654875 -3.259084
22 13.045809 24.654875
23 210.207483 13.045809
24 9.728357 210.207483
25 161.480428 9.728357
26 41.824324 161.480428
27 31.340786 41.824324
28 5.513934 31.340786
29 155.650765 5.513934
30 -827.960436 155.650765
31 14.399237 -827.960436
32 -19.112722 14.399237
33 -4.713419 -19.112722
34 -44.543856 -4.713419
35 -95.736337 -44.543856
36 1.624198 -95.736337
37 2.237581 1.624198
38 24.745337 2.237581
39 14.531129 24.745337
40 3.405985 14.531129
41 -11.967129 3.405985
42 12.227476 -11.967129
43 -25.655554 12.227476
44 10.777939 -25.655554
45 30.704556 10.777939
46 173.508463 30.704556
47 -32.404107 173.508463
48 -18.667288 -32.404107
49 9.537477 -18.667288
50 -18.536037 9.537477
51 -26.696855 -18.536037
52 198.134414 -26.696855
53 24.579340 198.134414
54 170.144464 24.579340
55 64.880649 170.144464
56 -27.656429 64.880649
57 -45.509218 -27.656429
58 30.069813 -45.509218
59 -11.153523 30.069813
60 26.215038 -11.153523
61 -777.039008 26.215038
> 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/rcomp/tmp/7wg3i1321987508.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/rcomp/tmp/8z4ay1321987508.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/rcomp/tmp/9c5eb1321987508.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/rcomp/tmp/10edkg1321987508.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/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/rcomp/tmp/11yep41321987508.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/rcomp/tmp/127gy11321987508.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/rcomp/tmp/13dcvq1321987508.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/rcomp/tmp/145m421321987508.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/rcomp/tmp/1527k21321987508.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/rcomp/tmp/16cv1o1321987508.tab")
+ }
>
> try(system("convert tmp/1z7uf1321987508.ps tmp/1z7uf1321987508.png",intern=TRUE))
character(0)
> try(system("convert tmp/2z9z81321987508.ps tmp/2z9z81321987508.png",intern=TRUE))
character(0)
> try(system("convert tmp/31lt91321987508.ps tmp/31lt91321987508.png",intern=TRUE))
character(0)
> try(system("convert tmp/45sqt1321987508.ps tmp/45sqt1321987508.png",intern=TRUE))
character(0)
> try(system("convert tmp/5uxet1321987508.ps tmp/5uxet1321987508.png",intern=TRUE))
character(0)
> try(system("convert tmp/6dsrd1321987508.ps tmp/6dsrd1321987508.png",intern=TRUE))
character(0)
> try(system("convert tmp/7wg3i1321987508.ps tmp/7wg3i1321987508.png",intern=TRUE))
character(0)
> try(system("convert tmp/8z4ay1321987508.ps tmp/8z4ay1321987508.png",intern=TRUE))
character(0)
> try(system("convert tmp/9c5eb1321987508.ps tmp/9c5eb1321987508.png",intern=TRUE))
character(0)
> try(system("convert tmp/10edkg1321987508.ps tmp/10edkg1321987508.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.160 0.260 4.394