R version 2.7.0 (2008-04-22)
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(25,0,23.6,0,22.3,0,21.8,0,20.8,0,19.7,0,18.3,0,17.4,0,17,0,18.1,0,23.9,0,25.6,0,25.3,0,23.6,0,21.9,0,21.4,0,20.6,0,20.5,0,20.2,0,20.6,0,19.7,0,19.3,0,22.8,0,23.5,0,23.8,0,22.6,0,22,0,21.7,0,20.7,0,20.2,0,19.1,0,19.5,0,18.7,0,18.6,0,22.2,0,23.2,0,23.5,0,21.3,0,20,0,18.7,0,18.9,0,18.3,0,18.4,0,19.9,0,19.2,0,18.5,0,20.9,1,20.5,1,19.4,1,18.1,1,17,1,17,1,17.3,1,16.7,1,15.5,1,15.3,1,13.7,1,14.1,1,17.3,1,18.1,1),dim=c(2,60),dimnames=list(c('Werklozen','Jobtonic'),1:60))
> y <- array(NA,dim=c(2,60),dimnames=list(c('Werklozen','Jobtonic'),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 = '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
Werklozen Jobtonic M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11 t
1 25.0 0 1 0 0 0 0 0 0 0 0 0 0 1
2 23.6 0 0 1 0 0 0 0 0 0 0 0 0 2
3 22.3 0 0 0 1 0 0 0 0 0 0 0 0 3
4 21.8 0 0 0 0 1 0 0 0 0 0 0 0 4
5 20.8 0 0 0 0 0 1 0 0 0 0 0 0 5
6 19.7 0 0 0 0 0 0 1 0 0 0 0 0 6
7 18.3 0 0 0 0 0 0 0 1 0 0 0 0 7
8 17.4 0 0 0 0 0 0 0 0 1 0 0 0 8
9 17.0 0 0 0 0 0 0 0 0 0 1 0 0 9
10 18.1 0 0 0 0 0 0 0 0 0 0 1 0 10
11 23.9 0 0 0 0 0 0 0 0 0 0 0 1 11
12 25.6 0 0 0 0 0 0 0 0 0 0 0 0 12
13 25.3 0 1 0 0 0 0 0 0 0 0 0 0 13
14 23.6 0 0 1 0 0 0 0 0 0 0 0 0 14
15 21.9 0 0 0 1 0 0 0 0 0 0 0 0 15
16 21.4 0 0 0 0 1 0 0 0 0 0 0 0 16
17 20.6 0 0 0 0 0 1 0 0 0 0 0 0 17
18 20.5 0 0 0 0 0 0 1 0 0 0 0 0 18
19 20.2 0 0 0 0 0 0 0 1 0 0 0 0 19
20 20.6 0 0 0 0 0 0 0 0 1 0 0 0 20
21 19.7 0 0 0 0 0 0 0 0 0 1 0 0 21
22 19.3 0 0 0 0 0 0 0 0 0 0 1 0 22
23 22.8 0 0 0 0 0 0 0 0 0 0 0 1 23
24 23.5 0 0 0 0 0 0 0 0 0 0 0 0 24
25 23.8 0 1 0 0 0 0 0 0 0 0 0 0 25
26 22.6 0 0 1 0 0 0 0 0 0 0 0 0 26
27 22.0 0 0 0 1 0 0 0 0 0 0 0 0 27
28 21.7 0 0 0 0 1 0 0 0 0 0 0 0 28
29 20.7 0 0 0 0 0 1 0 0 0 0 0 0 29
30 20.2 0 0 0 0 0 0 1 0 0 0 0 0 30
31 19.1 0 0 0 0 0 0 0 1 0 0 0 0 31
32 19.5 0 0 0 0 0 0 0 0 1 0 0 0 32
33 18.7 0 0 0 0 0 0 0 0 0 1 0 0 33
34 18.6 0 0 0 0 0 0 0 0 0 0 1 0 34
35 22.2 0 0 0 0 0 0 0 0 0 0 0 1 35
36 23.2 0 0 0 0 0 0 0 0 0 0 0 0 36
37 23.5 0 1 0 0 0 0 0 0 0 0 0 0 37
38 21.3 0 0 1 0 0 0 0 0 0 0 0 0 38
39 20.0 0 0 0 1 0 0 0 0 0 0 0 0 39
40 18.7 0 0 0 0 1 0 0 0 0 0 0 0 40
41 18.9 0 0 0 0 0 1 0 0 0 0 0 0 41
42 18.3 0 0 0 0 0 0 1 0 0 0 0 0 42
43 18.4 0 0 0 0 0 0 0 1 0 0 0 0 43
44 19.9 0 0 0 0 0 0 0 0 1 0 0 0 44
45 19.2 0 0 0 0 0 0 0 0 0 1 0 0 45
46 18.5 0 0 0 0 0 0 0 0 0 0 1 0 46
47 20.9 1 0 0 0 0 0 0 0 0 0 0 1 47
48 20.5 1 0 0 0 0 0 0 0 0 0 0 0 48
49 19.4 1 1 0 0 0 0 0 0 0 0 0 0 49
50 18.1 1 0 1 0 0 0 0 0 0 0 0 0 50
51 17.0 1 0 0 1 0 0 0 0 0 0 0 0 51
52 17.0 1 0 0 0 1 0 0 0 0 0 0 0 52
53 17.3 1 0 0 0 0 1 0 0 0 0 0 0 53
54 16.7 1 0 0 0 0 0 1 0 0 0 0 0 54
55 15.5 1 0 0 0 0 0 0 1 0 0 0 0 55
56 15.3 1 0 0 0 0 0 0 0 1 0 0 0 56
57 13.7 1 0 0 0 0 0 0 0 0 1 0 0 57
58 14.1 1 0 0 0 0 0 0 0 0 0 1 0 58
59 17.3 1 0 0 0 0 0 0 0 0 0 0 1 59
60 18.1 1 0 0 0 0 0 0 0 0 0 0 0 60
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Jobtonic M1 M2 M3 M4
24.61294 -3.19825 0.22785 -1.30010 -2.46806 -2.95601
M5 M6 M7 M8 M9 M10
-3.38397 -3.93192 -4.67988 -4.40783 -5.25579 -5.16374
M11 t
-0.79205 -0.03205
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-2.5487 -0.4341 0.1995 0.5347 1.7835
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 24.61294 0.52996 46.443 < 2e-16 ***
Jobtonic -3.19825 0.45223 -7.072 7.10e-09 ***
M1 0.22785 0.62989 0.362 0.719209
M2 -1.30010 0.62901 -2.067 0.044396 *
M3 -2.46806 0.62832 -3.928 0.000285 ***
M4 -2.95601 0.62783 -4.708 2.32e-05 ***
M5 -3.38397 0.62754 -5.392 2.33e-06 ***
M6 -3.93192 0.62744 -6.267 1.15e-07 ***
M7 -4.67988 0.62754 -7.458 1.88e-09 ***
M8 -4.40783 0.62783 -7.021 8.48e-09 ***
M9 -5.25579 0.62832 -8.365 8.62e-11 ***
M10 -5.16374 0.62901 -8.209 1.46e-10 ***
M11 -0.79205 0.62454 -1.268 0.211107
t -0.03205 0.01109 -2.888 0.005884 **
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.9873 on 46 degrees of freedom
Multiple R-squared: 0.8949, Adjusted R-squared: 0.8652
F-statistic: 30.14 on 13 and 46 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,] 0.04186408 0.08372816 0.95813592
[2,] 0.08191334 0.16382668 0.91808666
[3,] 0.35722540 0.71445080 0.64277460
[4,] 0.79409993 0.41180015 0.20590007
[5,] 0.84061286 0.31877428 0.15938714
[6,] 0.77203691 0.45592618 0.22796309
[7,] 0.82549114 0.34901773 0.17450886
[8,] 0.91219443 0.17561114 0.08780557
[9,] 0.92373768 0.15252464 0.07626232
[10,] 0.90097407 0.19805186 0.09902593
[11,] 0.85627031 0.28745938 0.14372969
[12,] 0.81852177 0.36295647 0.18147823
[13,] 0.74381750 0.51236500 0.25618250
[14,] 0.65498301 0.69003397 0.34501699
[15,] 0.57532361 0.84935277 0.42467639
[16,] 0.52844144 0.94311712 0.47155856
[17,] 0.47184760 0.94369520 0.52815240
[18,] 0.45765803 0.91531605 0.54234197
[19,] 0.48186379 0.96372759 0.51813621
[20,] 0.45018421 0.90036842 0.54981579
[21,] 0.40172250 0.80344501 0.59827750
[22,] 0.35800420 0.71600841 0.64199580
[23,] 0.30209937 0.60419873 0.69790063
[24,] 0.37541931 0.75083862 0.62458069
[25,] 0.44838252 0.89676504 0.55161748
[26,] 0.73010892 0.53978217 0.26989108
[27,] 0.87164102 0.25671797 0.12835898
> postscript(file="/var/www/html/rcomp/tmp/1u55p1229459794.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/23w7h1229459794.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/3xsfu1229459794.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/4nivx1229459794.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/5e2i11229459794.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 = 60
Frequency = 1
1 2 3 4 5 6 7
0.1912587 0.3512587 0.2512587 0.2712587 -0.2687413 -0.7887413 -1.4087413
8 9 10 11 12 13 14
-2.5487413 -2.0687413 -1.0287413 0.4316084 1.3716084 0.8758042 0.7358042
15 16 17 18 19 20 21
0.2358042 0.2558042 -0.0841958 0.3958042 0.8758042 1.0358042 1.0158042
22 23 24 25 26 27 28
0.5558042 -0.2838462 -0.3438462 -0.2396503 0.1203497 0.7203497 0.9403497
29 30 31 32 33 34 35
0.4003497 0.4803497 0.1603497 0.3203497 0.4003497 0.2403497 -0.4993007
36 37 38 39 40 41 42
-0.2593007 -0.1551049 -0.7951049 -0.8951049 -1.6751049 -1.0151049 -1.0351049
43 44 45 46 47 48 49
-0.1551049 1.1048951 1.2848951 0.5248951 1.7834965 0.6234965 -0.6723077
50 51 52 53 54 55 56
-0.4123077 -0.3123077 0.2076923 0.9676923 0.9476923 0.5276923 0.0876923
57 58 59 60
-0.6323077 -0.2923077 -1.4319580 -1.3919580
> postscript(file="/var/www/html/rcomp/tmp/6n3o61229459794.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 = 60
Frequency = 1
lag(myerror, k = 1) myerror
0 0.1912587 NA
1 0.3512587 0.1912587
2 0.2512587 0.3512587
3 0.2712587 0.2512587
4 -0.2687413 0.2712587
5 -0.7887413 -0.2687413
6 -1.4087413 -0.7887413
7 -2.5487413 -1.4087413
8 -2.0687413 -2.5487413
9 -1.0287413 -2.0687413
10 0.4316084 -1.0287413
11 1.3716084 0.4316084
12 0.8758042 1.3716084
13 0.7358042 0.8758042
14 0.2358042 0.7358042
15 0.2558042 0.2358042
16 -0.0841958 0.2558042
17 0.3958042 -0.0841958
18 0.8758042 0.3958042
19 1.0358042 0.8758042
20 1.0158042 1.0358042
21 0.5558042 1.0158042
22 -0.2838462 0.5558042
23 -0.3438462 -0.2838462
24 -0.2396503 -0.3438462
25 0.1203497 -0.2396503
26 0.7203497 0.1203497
27 0.9403497 0.7203497
28 0.4003497 0.9403497
29 0.4803497 0.4003497
30 0.1603497 0.4803497
31 0.3203497 0.1603497
32 0.4003497 0.3203497
33 0.2403497 0.4003497
34 -0.4993007 0.2403497
35 -0.2593007 -0.4993007
36 -0.1551049 -0.2593007
37 -0.7951049 -0.1551049
38 -0.8951049 -0.7951049
39 -1.6751049 -0.8951049
40 -1.0151049 -1.6751049
41 -1.0351049 -1.0151049
42 -0.1551049 -1.0351049
43 1.1048951 -0.1551049
44 1.2848951 1.1048951
45 0.5248951 1.2848951
46 1.7834965 0.5248951
47 0.6234965 1.7834965
48 -0.6723077 0.6234965
49 -0.4123077 -0.6723077
50 -0.3123077 -0.4123077
51 0.2076923 -0.3123077
52 0.9676923 0.2076923
53 0.9476923 0.9676923
54 0.5276923 0.9476923
55 0.0876923 0.5276923
56 -0.6323077 0.0876923
57 -0.2923077 -0.6323077
58 -1.4319580 -0.2923077
59 -1.3919580 -1.4319580
60 NA -1.3919580
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.3512587 0.1912587
[2,] 0.2512587 0.3512587
[3,] 0.2712587 0.2512587
[4,] -0.2687413 0.2712587
[5,] -0.7887413 -0.2687413
[6,] -1.4087413 -0.7887413
[7,] -2.5487413 -1.4087413
[8,] -2.0687413 -2.5487413
[9,] -1.0287413 -2.0687413
[10,] 0.4316084 -1.0287413
[11,] 1.3716084 0.4316084
[12,] 0.8758042 1.3716084
[13,] 0.7358042 0.8758042
[14,] 0.2358042 0.7358042
[15,] 0.2558042 0.2358042
[16,] -0.0841958 0.2558042
[17,] 0.3958042 -0.0841958
[18,] 0.8758042 0.3958042
[19,] 1.0358042 0.8758042
[20,] 1.0158042 1.0358042
[21,] 0.5558042 1.0158042
[22,] -0.2838462 0.5558042
[23,] -0.3438462 -0.2838462
[24,] -0.2396503 -0.3438462
[25,] 0.1203497 -0.2396503
[26,] 0.7203497 0.1203497
[27,] 0.9403497 0.7203497
[28,] 0.4003497 0.9403497
[29,] 0.4803497 0.4003497
[30,] 0.1603497 0.4803497
[31,] 0.3203497 0.1603497
[32,] 0.4003497 0.3203497
[33,] 0.2403497 0.4003497
[34,] -0.4993007 0.2403497
[35,] -0.2593007 -0.4993007
[36,] -0.1551049 -0.2593007
[37,] -0.7951049 -0.1551049
[38,] -0.8951049 -0.7951049
[39,] -1.6751049 -0.8951049
[40,] -1.0151049 -1.6751049
[41,] -1.0351049 -1.0151049
[42,] -0.1551049 -1.0351049
[43,] 1.1048951 -0.1551049
[44,] 1.2848951 1.1048951
[45,] 0.5248951 1.2848951
[46,] 1.7834965 0.5248951
[47,] 0.6234965 1.7834965
[48,] -0.6723077 0.6234965
[49,] -0.4123077 -0.6723077
[50,] -0.3123077 -0.4123077
[51,] 0.2076923 -0.3123077
[52,] 0.9676923 0.2076923
[53,] 0.9476923 0.9676923
[54,] 0.5276923 0.9476923
[55,] 0.0876923 0.5276923
[56,] -0.6323077 0.0876923
[57,] -0.2923077 -0.6323077
[58,] -1.4319580 -0.2923077
[59,] -1.3919580 -1.4319580
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.3512587 0.1912587
2 0.2512587 0.3512587
3 0.2712587 0.2512587
4 -0.2687413 0.2712587
5 -0.7887413 -0.2687413
6 -1.4087413 -0.7887413
7 -2.5487413 -1.4087413
8 -2.0687413 -2.5487413
9 -1.0287413 -2.0687413
10 0.4316084 -1.0287413
11 1.3716084 0.4316084
12 0.8758042 1.3716084
13 0.7358042 0.8758042
14 0.2358042 0.7358042
15 0.2558042 0.2358042
16 -0.0841958 0.2558042
17 0.3958042 -0.0841958
18 0.8758042 0.3958042
19 1.0358042 0.8758042
20 1.0158042 1.0358042
21 0.5558042 1.0158042
22 -0.2838462 0.5558042
23 -0.3438462 -0.2838462
24 -0.2396503 -0.3438462
25 0.1203497 -0.2396503
26 0.7203497 0.1203497
27 0.9403497 0.7203497
28 0.4003497 0.9403497
29 0.4803497 0.4003497
30 0.1603497 0.4803497
31 0.3203497 0.1603497
32 0.4003497 0.3203497
33 0.2403497 0.4003497
34 -0.4993007 0.2403497
35 -0.2593007 -0.4993007
36 -0.1551049 -0.2593007
37 -0.7951049 -0.1551049
38 -0.8951049 -0.7951049
39 -1.6751049 -0.8951049
40 -1.0151049 -1.6751049
41 -1.0351049 -1.0151049
42 -0.1551049 -1.0351049
43 1.1048951 -0.1551049
44 1.2848951 1.1048951
45 0.5248951 1.2848951
46 1.7834965 0.5248951
47 0.6234965 1.7834965
48 -0.6723077 0.6234965
49 -0.4123077 -0.6723077
50 -0.3123077 -0.4123077
51 0.2076923 -0.3123077
52 0.9676923 0.2076923
53 0.9476923 0.9676923
54 0.5276923 0.9476923
55 0.0876923 0.5276923
56 -0.6323077 0.0876923
57 -0.2923077 -0.6323077
58 -1.4319580 -0.2923077
59 -1.3919580 -1.4319580
> 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/75ep01229459794.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/8stht1229459794.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/9auwx1229459794.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/10tmi61229459794.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/11aw1x1229459794.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/12uegt1229459794.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/13f0ru1229459794.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/140ckv1229459794.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/15tt9b1229459794.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/16301m1229459794.tab")
+ }
>
> system("convert tmp/1u55p1229459794.ps tmp/1u55p1229459794.png")
> system("convert tmp/23w7h1229459794.ps tmp/23w7h1229459794.png")
> system("convert tmp/3xsfu1229459794.ps tmp/3xsfu1229459794.png")
> system("convert tmp/4nivx1229459794.ps tmp/4nivx1229459794.png")
> system("convert tmp/5e2i11229459794.ps tmp/5e2i11229459794.png")
> system("convert tmp/6n3o61229459794.ps tmp/6n3o61229459794.png")
> system("convert tmp/75ep01229459794.ps tmp/75ep01229459794.png")
> system("convert tmp/8stht1229459794.ps tmp/8stht1229459794.png")
> system("convert tmp/9auwx1229459794.ps tmp/9auwx1229459794.png")
> system("convert tmp/10tmi61229459794.ps tmp/10tmi61229459794.png")
>
>
> proc.time()
user system elapsed
4.908 2.685 5.334