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(3,4,4,4,4,3,4,3,4,4,4,2,4,4,4,2,4,4,4,2,3,4,5,2,5,4,4,3,4,4,3,2,3,2,4,1,3,4,4,2,4,3,4,2,4,2,4,4,4,2,4,2,4,3,2,2,4,4,3,2,4,5,4,1,4,4,3,2,5,2,2,2,4,4,4,3,4,3,3,4,4,4,3,4,4,2,4,4,5,2,3,4,4,4,3,4,4,4,4,2,4,4,4,2,4,4,4,4,4,3,4,2,4,4,4,3,4,5,4,2,4,4,5,4,3,4,4,3,4,4,4,4,4,4,4,2,3,4,3,2,3,4,4,4,2,4,3,5,3,4,4,2,4,4,4,4,4,5,3,4,4,4,5,5,4,4,4,3,5,2,3,2,4,4,3,3,4,4,3,2,4,4,4,1,3,4,4,2,4,4,4,4,4,4,4,4,3,4,4,4,4,3,4,4,3,4,4,2,3,4,5,2,5,4,3,1,2,3,3,4,4,3,5,2,4,4,5,4,4,4,4,2,3,5,4,2,4,3,3,1,3,4,4,2,4,4,4,2,4,4,5,2,4,4,4,2,4,4,4,1,4,4,5,5,5,4,4,3,5,4,3,2,3,4,4,1,4,4,4,2,3,4,4,4,4,4,4,2,5,4,4,5,5,3,4,4,4,4,4,3,4,4,3,2,4,3,4,2,4,4,3,2,4,4,5,2,4,4,4,4,4,4,5,2,5,4,5,2,4,2,4,4,4,4,4,4,4,3,4,2,4,3,4,2,4,4,4,3,4,4,5,2,4,4,4,4,4,3,3,2,3,2,4,4,4,5,3,1,4,2,4,2,4,4,4,3,4,4,4,2,4,4,4,4,4,3,4,2,4,4,3,3,4,3,3,2,4,4,3,2,4,4,3,2,5,3,3,2,5,2,2,2,4,4,3,2,4,3,5,3,3,2,2,2,4,3,2,2,4,4,3,4,4,4,3,3),dim=c(4,109),dimnames=list(c('Competence','Focus','Neatness','Upset'),1:109))
> y <- array(NA,dim=c(4,109),dimnames=list(c('Competence','Focus','Neatness','Upset'),1:109))
> 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 = '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
Competence Focus Neatness Upset
1 3 4 4 4
2 4 3 4 3
3 4 4 4 2
4 4 4 4 2
5 4 4 4 2
6 3 4 5 2
7 5 4 4 3
8 4 4 3 2
9 3 2 4 1
10 3 4 4 2
11 4 3 4 2
12 4 2 4 4
13 4 2 4 2
14 4 3 2 2
15 4 4 3 2
16 4 5 4 1
17 4 4 3 2
18 5 2 2 2
19 4 4 4 3
20 4 3 3 4
21 4 4 3 4
22 4 2 4 4
23 5 2 3 4
24 4 4 3 4
25 4 4 4 2
26 4 4 4 2
27 4 4 4 4
28 4 3 4 2
29 4 4 4 3
30 4 5 4 2
31 4 4 5 4
32 3 4 4 3
33 4 4 4 4
34 4 4 4 2
35 3 4 3 2
36 3 4 4 4
37 2 4 3 5
38 3 4 4 2
39 4 4 4 4
40 4 5 3 4
41 4 4 5 5
42 4 4 4 3
43 5 2 3 2
44 4 4 3 3
45 4 4 3 2
46 4 4 4 1
47 3 4 4 2
48 4 4 4 4
49 4 4 4 4
50 3 4 4 4
51 4 3 4 4
52 3 4 4 2
53 3 4 5 2
54 5 4 3 1
55 2 3 3 4
56 4 3 5 2
57 4 4 5 4
58 4 4 4 2
59 3 5 4 2
60 4 3 3 1
61 3 4 4 2
62 4 4 4 2
63 4 4 5 2
64 4 4 4 2
65 4 4 4 1
66 4 4 5 5
67 5 4 4 3
68 5 4 3 2
69 3 4 4 1
70 4 4 4 2
71 3 4 4 4
72 4 4 4 2
73 5 4 4 5
74 5 3 4 4
75 4 4 4 3
76 4 4 3 2
77 4 3 4 2
78 4 4 3 2
79 4 4 5 2
80 4 4 4 4
81 4 4 5 2
82 5 4 5 2
83 4 2 4 4
84 4 4 4 4
85 4 3 4 2
86 4 3 4 2
87 4 4 4 3
88 4 4 5 2
89 4 4 4 4
90 4 3 3 2
91 3 2 4 4
92 4 5 3 1
93 4 2 4 2
94 4 4 4 3
95 4 4 4 2
96 4 4 4 4
97 4 3 4 2
98 4 4 3 3
99 4 3 3 2
100 4 4 3 2
101 4 4 3 2
102 5 3 3 2
103 5 2 2 2
104 4 4 3 2
105 4 3 5 3
106 3 2 2 2
107 4 3 2 2
108 4 4 3 4
109 4 4 3 3
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Focus Neatness Upset
4.59400 -0.09601 -0.06810 -0.02950
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.98368 -0.01159 0.11233 0.18043 1.20993
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.59400 0.38759 11.853 <2e-16 ***
Focus -0.09601 0.07848 -1.223 0.224
Neatness -0.06810 0.08135 -0.837 0.404
Upset -0.02950 0.05410 -0.545 0.587
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.5853 on 105 degrees of freedom
Multiple R-squared: 0.03003, Adjusted R-squared: 0.002319
F-statistic: 1.084 on 3 and 105 DF, p-value: 0.3594
> 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.81884794 0.362304111 0.1811520553
[2,] 0.83325098 0.333498037 0.1667490186
[3,] 0.82454253 0.350914934 0.1754574668
[4,] 0.86286110 0.274277804 0.1371389021
[5,] 0.82288289 0.354234219 0.1771171094
[6,] 0.75661353 0.486772948 0.2433864741
[7,] 0.69844072 0.603118555 0.3015592777
[8,] 0.64477350 0.710453008 0.3552265041
[9,] 0.55433330 0.891333392 0.4456666959
[10,] 0.48759578 0.975191556 0.5124042221
[11,] 0.40057357 0.801147147 0.5994264266
[12,] 0.42893624 0.857872471 0.5710637643
[13,] 0.35477908 0.709558163 0.6452209184
[14,] 0.29570558 0.591411164 0.7042944181
[15,] 0.23854118 0.477082369 0.7614588154
[16,] 0.18498136 0.369962711 0.8150186446
[17,] 0.22846749 0.456934973 0.7715325137
[18,] 0.18511564 0.370231277 0.8148843617
[19,] 0.14819765 0.296395301 0.8518023493
[20,] 0.11610612 0.232212248 0.8838938758
[21,] 0.08625116 0.172502317 0.9137488414
[22,] 0.06349767 0.126995334 0.9365023332
[23,] 0.04583633 0.091672666 0.9541636671
[24,] 0.03412801 0.068256024 0.9658719879
[25,] 0.02682668 0.053653361 0.9731733196
[26,] 0.04897896 0.097957915 0.9510210427
[27,] 0.03492152 0.069843035 0.9650784823
[28,] 0.02523943 0.050478860 0.9747605699
[29,] 0.05993722 0.119874445 0.9400627773
[30,] 0.09167786 0.183355721 0.9083221393
[31,] 0.55424537 0.891509251 0.4457546255
[32,] 0.60925349 0.781493027 0.3907465134
[33,] 0.56523242 0.869535159 0.4347675794
[34,] 0.51897619 0.962047622 0.4810238108
[35,] 0.48507749 0.970154983 0.5149225085
[36,] 0.43378593 0.867571853 0.5662140736
[37,] 0.49359024 0.987180473 0.5064097633
[38,] 0.43699804 0.873996084 0.5630019579
[39,] 0.38117066 0.762341326 0.6188293370
[40,] 0.33039742 0.660794845 0.6696025777
[41,] 0.38844548 0.776890959 0.6115545204
[42,] 0.34228410 0.684568194 0.6577159031
[43,] 0.29782960 0.595659195 0.7021704025
[44,] 0.34463898 0.689277962 0.6553610188
[45,] 0.29497952 0.589959041 0.7050204797
[46,] 0.35340327 0.706806549 0.6465967254
[47,] 0.39651583 0.793031669 0.6034841657
[48,] 0.50917788 0.981644242 0.4908221209
[49,] 0.94801820 0.103963606 0.0519818028
[50,] 0.93240260 0.135194810 0.0675974048
[51,] 0.91853603 0.162927935 0.0814639674
[52,] 0.89612694 0.207746114 0.1038730572
[53,] 0.92892919 0.142141623 0.0710708116
[54,] 0.90771592 0.184568169 0.0922840845
[55,] 0.94524344 0.109513127 0.0547565636
[56,] 0.92869679 0.142606418 0.0713032092
[57,] 0.91011803 0.179763946 0.0898819731
[58,] 0.88588477 0.228230452 0.1141152262
[59,] 0.85603947 0.287921061 0.1439605304
[60,] 0.83152634 0.336947316 0.1684736579
[61,] 0.90469322 0.190613562 0.0953067811
[62,] 0.94869391 0.102612186 0.0513060930
[63,] 0.97582662 0.048346759 0.0241733794
[64,] 0.96626491 0.067470180 0.0337350898
[65,] 0.98785793 0.024284131 0.0121420654
[66,] 0.98232960 0.035340801 0.0176704004
[67,] 0.99427923 0.011441543 0.0057207713
[68,] 0.99909374 0.001812520 0.0009062602
[69,] 0.99844211 0.003115773 0.0015578867
[70,] 0.99740169 0.005196617 0.0025983083
[71,] 0.99568901 0.008621976 0.0043109882
[72,] 0.99311506 0.013769888 0.0068849438
[73,] 0.98974571 0.020508585 0.0102542926
[74,] 0.98417902 0.031641968 0.0158209838
[75,] 0.97750229 0.044995417 0.0224977087
[76,] 0.99199817 0.016003657 0.0080018283
[77,] 0.98826373 0.023472547 0.0117362735
[78,] 0.98177637 0.036447264 0.0182236319
[79,] 0.97123762 0.057524760 0.0287623801
[80,] 0.95579278 0.088414433 0.0442072166
[81,] 0.93427640 0.131447200 0.0657236000
[82,] 0.90504776 0.189904486 0.0949522428
[83,] 0.87022717 0.259545652 0.1297728260
[84,] 0.82103183 0.357936336 0.1789681678
[85,] 0.89345813 0.213083748 0.1065418739
[86,] 0.84724635 0.305507298 0.1527536488
[87,] 0.78925575 0.421488509 0.2107442544
[88,] 0.71491610 0.570167800 0.2850839001
[89,] 0.62910149 0.741797026 0.3708985129
[90,] 0.53114149 0.937717024 0.4688585122
[91,] 0.43353567 0.867071349 0.5664643255
[92,] 0.32911500 0.658229998 0.6708850009
[93,] 0.23667280 0.473345594 0.7633272031
[94,] 0.15596428 0.311928557 0.8440357216
[95,] 0.09456479 0.189129589 0.9054352053
[96,] 0.12930302 0.258606049 0.8706969753
> postscript(file="/var/www/html/rcomp/tmp/1p5sw1291285886.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/2p5sw1291285886.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/3ixsh1291285886.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/4ixsh1291285886.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/5ixsh1291285886.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 = 109
Frequency = 1
1 2 3 4 5 6
-0.81956964 0.05492003 0.12143001 0.12143001 0.12143001 -0.81047389
7 8 9 10 11 12
1.15093019 0.05333392 -1.10009047 -0.87856999 0.02541986 -0.01158994
13 14 15 16 17 18
-0.07059030 -0.11077233 0.05333392 0.18793999 0.05333392 0.79321751
19 20 21 22 23 24
0.15093019 0.01632411 0.11233427 -0.01158994 0.92031396 0.11233427
25 26 27 28 29 30
0.12143001 0.12143001 0.18043036 0.02541986 0.15093019 0.21744017
31 32 33 34 35 36
0.24852646 -0.84906981 0.18043036 0.12143001 -0.94666608 -0.81956964
37 38 39 40 41 42
-1.85816556 -0.87856999 0.18043036 0.20834442 0.27802664 0.15093019
43 44 45 46 47 48
0.86131361 0.08283409 0.05333392 0.09192984 -0.87856999 0.18043036
49 50 51 52 53 54
0.18043036 -0.81956964 0.08442021 -0.87856999 -0.81047389 1.02383374
55 56 57 58 59 60
-1.98367589 0.09351596 0.24852646 0.12143001 -0.78255983 -0.07217641
61 62 63 64 65 66
-0.87856999 0.12143001 0.18952611 0.12143001 0.09192984 0.27802664
67 68 69 70 71 72
1.15093019 1.05333392 -0.90807016 0.12143001 -0.81956964 0.12143001
73 74 75 76 77 78
1.20993054 1.08442021 0.15093019 0.05333392 0.02541986 0.05333392
79 80 81 82 83 84
0.18952611 0.18043036 0.18952611 1.18952611 -0.01158994 0.18043036
85 86 87 88 89 90
0.02541986 0.02541986 0.15093019 0.18952611 0.18043036 -0.04267624
91 92 93 94 95 96
-1.01158994 0.11984389 -0.07059030 0.15093019 0.12143001 0.18043036
97 98 99 100 101 102
0.02541986 0.08283409 -0.04267624 0.05333392 0.05333392 0.95732376
103 104 105 106 107 108
0.79321751 0.05333392 0.12301613 -1.20678249 -0.11077233 0.11233427
109
0.08283409
> postscript(file="/var/www/html/rcomp/tmp/6bork1291285886.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 = 109
Frequency = 1
lag(myerror, k = 1) myerror
0 -0.81956964 NA
1 0.05492003 -0.81956964
2 0.12143001 0.05492003
3 0.12143001 0.12143001
4 0.12143001 0.12143001
5 -0.81047389 0.12143001
6 1.15093019 -0.81047389
7 0.05333392 1.15093019
8 -1.10009047 0.05333392
9 -0.87856999 -1.10009047
10 0.02541986 -0.87856999
11 -0.01158994 0.02541986
12 -0.07059030 -0.01158994
13 -0.11077233 -0.07059030
14 0.05333392 -0.11077233
15 0.18793999 0.05333392
16 0.05333392 0.18793999
17 0.79321751 0.05333392
18 0.15093019 0.79321751
19 0.01632411 0.15093019
20 0.11233427 0.01632411
21 -0.01158994 0.11233427
22 0.92031396 -0.01158994
23 0.11233427 0.92031396
24 0.12143001 0.11233427
25 0.12143001 0.12143001
26 0.18043036 0.12143001
27 0.02541986 0.18043036
28 0.15093019 0.02541986
29 0.21744017 0.15093019
30 0.24852646 0.21744017
31 -0.84906981 0.24852646
32 0.18043036 -0.84906981
33 0.12143001 0.18043036
34 -0.94666608 0.12143001
35 -0.81956964 -0.94666608
36 -1.85816556 -0.81956964
37 -0.87856999 -1.85816556
38 0.18043036 -0.87856999
39 0.20834442 0.18043036
40 0.27802664 0.20834442
41 0.15093019 0.27802664
42 0.86131361 0.15093019
43 0.08283409 0.86131361
44 0.05333392 0.08283409
45 0.09192984 0.05333392
46 -0.87856999 0.09192984
47 0.18043036 -0.87856999
48 0.18043036 0.18043036
49 -0.81956964 0.18043036
50 0.08442021 -0.81956964
51 -0.87856999 0.08442021
52 -0.81047389 -0.87856999
53 1.02383374 -0.81047389
54 -1.98367589 1.02383374
55 0.09351596 -1.98367589
56 0.24852646 0.09351596
57 0.12143001 0.24852646
58 -0.78255983 0.12143001
59 -0.07217641 -0.78255983
60 -0.87856999 -0.07217641
61 0.12143001 -0.87856999
62 0.18952611 0.12143001
63 0.12143001 0.18952611
64 0.09192984 0.12143001
65 0.27802664 0.09192984
66 1.15093019 0.27802664
67 1.05333392 1.15093019
68 -0.90807016 1.05333392
69 0.12143001 -0.90807016
70 -0.81956964 0.12143001
71 0.12143001 -0.81956964
72 1.20993054 0.12143001
73 1.08442021 1.20993054
74 0.15093019 1.08442021
75 0.05333392 0.15093019
76 0.02541986 0.05333392
77 0.05333392 0.02541986
78 0.18952611 0.05333392
79 0.18043036 0.18952611
80 0.18952611 0.18043036
81 1.18952611 0.18952611
82 -0.01158994 1.18952611
83 0.18043036 -0.01158994
84 0.02541986 0.18043036
85 0.02541986 0.02541986
86 0.15093019 0.02541986
87 0.18952611 0.15093019
88 0.18043036 0.18952611
89 -0.04267624 0.18043036
90 -1.01158994 -0.04267624
91 0.11984389 -1.01158994
92 -0.07059030 0.11984389
93 0.15093019 -0.07059030
94 0.12143001 0.15093019
95 0.18043036 0.12143001
96 0.02541986 0.18043036
97 0.08283409 0.02541986
98 -0.04267624 0.08283409
99 0.05333392 -0.04267624
100 0.05333392 0.05333392
101 0.95732376 0.05333392
102 0.79321751 0.95732376
103 0.05333392 0.79321751
104 0.12301613 0.05333392
105 -1.20678249 0.12301613
106 -0.11077233 -1.20678249
107 0.11233427 -0.11077233
108 0.08283409 0.11233427
109 NA 0.08283409
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.05492003 -0.81956964
[2,] 0.12143001 0.05492003
[3,] 0.12143001 0.12143001
[4,] 0.12143001 0.12143001
[5,] -0.81047389 0.12143001
[6,] 1.15093019 -0.81047389
[7,] 0.05333392 1.15093019
[8,] -1.10009047 0.05333392
[9,] -0.87856999 -1.10009047
[10,] 0.02541986 -0.87856999
[11,] -0.01158994 0.02541986
[12,] -0.07059030 -0.01158994
[13,] -0.11077233 -0.07059030
[14,] 0.05333392 -0.11077233
[15,] 0.18793999 0.05333392
[16,] 0.05333392 0.18793999
[17,] 0.79321751 0.05333392
[18,] 0.15093019 0.79321751
[19,] 0.01632411 0.15093019
[20,] 0.11233427 0.01632411
[21,] -0.01158994 0.11233427
[22,] 0.92031396 -0.01158994
[23,] 0.11233427 0.92031396
[24,] 0.12143001 0.11233427
[25,] 0.12143001 0.12143001
[26,] 0.18043036 0.12143001
[27,] 0.02541986 0.18043036
[28,] 0.15093019 0.02541986
[29,] 0.21744017 0.15093019
[30,] 0.24852646 0.21744017
[31,] -0.84906981 0.24852646
[32,] 0.18043036 -0.84906981
[33,] 0.12143001 0.18043036
[34,] -0.94666608 0.12143001
[35,] -0.81956964 -0.94666608
[36,] -1.85816556 -0.81956964
[37,] -0.87856999 -1.85816556
[38,] 0.18043036 -0.87856999
[39,] 0.20834442 0.18043036
[40,] 0.27802664 0.20834442
[41,] 0.15093019 0.27802664
[42,] 0.86131361 0.15093019
[43,] 0.08283409 0.86131361
[44,] 0.05333392 0.08283409
[45,] 0.09192984 0.05333392
[46,] -0.87856999 0.09192984
[47,] 0.18043036 -0.87856999
[48,] 0.18043036 0.18043036
[49,] -0.81956964 0.18043036
[50,] 0.08442021 -0.81956964
[51,] -0.87856999 0.08442021
[52,] -0.81047389 -0.87856999
[53,] 1.02383374 -0.81047389
[54,] -1.98367589 1.02383374
[55,] 0.09351596 -1.98367589
[56,] 0.24852646 0.09351596
[57,] 0.12143001 0.24852646
[58,] -0.78255983 0.12143001
[59,] -0.07217641 -0.78255983
[60,] -0.87856999 -0.07217641
[61,] 0.12143001 -0.87856999
[62,] 0.18952611 0.12143001
[63,] 0.12143001 0.18952611
[64,] 0.09192984 0.12143001
[65,] 0.27802664 0.09192984
[66,] 1.15093019 0.27802664
[67,] 1.05333392 1.15093019
[68,] -0.90807016 1.05333392
[69,] 0.12143001 -0.90807016
[70,] -0.81956964 0.12143001
[71,] 0.12143001 -0.81956964
[72,] 1.20993054 0.12143001
[73,] 1.08442021 1.20993054
[74,] 0.15093019 1.08442021
[75,] 0.05333392 0.15093019
[76,] 0.02541986 0.05333392
[77,] 0.05333392 0.02541986
[78,] 0.18952611 0.05333392
[79,] 0.18043036 0.18952611
[80,] 0.18952611 0.18043036
[81,] 1.18952611 0.18952611
[82,] -0.01158994 1.18952611
[83,] 0.18043036 -0.01158994
[84,] 0.02541986 0.18043036
[85,] 0.02541986 0.02541986
[86,] 0.15093019 0.02541986
[87,] 0.18952611 0.15093019
[88,] 0.18043036 0.18952611
[89,] -0.04267624 0.18043036
[90,] -1.01158994 -0.04267624
[91,] 0.11984389 -1.01158994
[92,] -0.07059030 0.11984389
[93,] 0.15093019 -0.07059030
[94,] 0.12143001 0.15093019
[95,] 0.18043036 0.12143001
[96,] 0.02541986 0.18043036
[97,] 0.08283409 0.02541986
[98,] -0.04267624 0.08283409
[99,] 0.05333392 -0.04267624
[100,] 0.05333392 0.05333392
[101,] 0.95732376 0.05333392
[102,] 0.79321751 0.95732376
[103,] 0.05333392 0.79321751
[104,] 0.12301613 0.05333392
[105,] -1.20678249 0.12301613
[106,] -0.11077233 -1.20678249
[107,] 0.11233427 -0.11077233
[108,] 0.08283409 0.11233427
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.05492003 -0.81956964
2 0.12143001 0.05492003
3 0.12143001 0.12143001
4 0.12143001 0.12143001
5 -0.81047389 0.12143001
6 1.15093019 -0.81047389
7 0.05333392 1.15093019
8 -1.10009047 0.05333392
9 -0.87856999 -1.10009047
10 0.02541986 -0.87856999
11 -0.01158994 0.02541986
12 -0.07059030 -0.01158994
13 -0.11077233 -0.07059030
14 0.05333392 -0.11077233
15 0.18793999 0.05333392
16 0.05333392 0.18793999
17 0.79321751 0.05333392
18 0.15093019 0.79321751
19 0.01632411 0.15093019
20 0.11233427 0.01632411
21 -0.01158994 0.11233427
22 0.92031396 -0.01158994
23 0.11233427 0.92031396
24 0.12143001 0.11233427
25 0.12143001 0.12143001
26 0.18043036 0.12143001
27 0.02541986 0.18043036
28 0.15093019 0.02541986
29 0.21744017 0.15093019
30 0.24852646 0.21744017
31 -0.84906981 0.24852646
32 0.18043036 -0.84906981
33 0.12143001 0.18043036
34 -0.94666608 0.12143001
35 -0.81956964 -0.94666608
36 -1.85816556 -0.81956964
37 -0.87856999 -1.85816556
38 0.18043036 -0.87856999
39 0.20834442 0.18043036
40 0.27802664 0.20834442
41 0.15093019 0.27802664
42 0.86131361 0.15093019
43 0.08283409 0.86131361
44 0.05333392 0.08283409
45 0.09192984 0.05333392
46 -0.87856999 0.09192984
47 0.18043036 -0.87856999
48 0.18043036 0.18043036
49 -0.81956964 0.18043036
50 0.08442021 -0.81956964
51 -0.87856999 0.08442021
52 -0.81047389 -0.87856999
53 1.02383374 -0.81047389
54 -1.98367589 1.02383374
55 0.09351596 -1.98367589
56 0.24852646 0.09351596
57 0.12143001 0.24852646
58 -0.78255983 0.12143001
59 -0.07217641 -0.78255983
60 -0.87856999 -0.07217641
61 0.12143001 -0.87856999
62 0.18952611 0.12143001
63 0.12143001 0.18952611
64 0.09192984 0.12143001
65 0.27802664 0.09192984
66 1.15093019 0.27802664
67 1.05333392 1.15093019
68 -0.90807016 1.05333392
69 0.12143001 -0.90807016
70 -0.81956964 0.12143001
71 0.12143001 -0.81956964
72 1.20993054 0.12143001
73 1.08442021 1.20993054
74 0.15093019 1.08442021
75 0.05333392 0.15093019
76 0.02541986 0.05333392
77 0.05333392 0.02541986
78 0.18952611 0.05333392
79 0.18043036 0.18952611
80 0.18952611 0.18043036
81 1.18952611 0.18952611
82 -0.01158994 1.18952611
83 0.18043036 -0.01158994
84 0.02541986 0.18043036
85 0.02541986 0.02541986
86 0.15093019 0.02541986
87 0.18952611 0.15093019
88 0.18043036 0.18952611
89 -0.04267624 0.18043036
90 -1.01158994 -0.04267624
91 0.11984389 -1.01158994
92 -0.07059030 0.11984389
93 0.15093019 -0.07059030
94 0.12143001 0.15093019
95 0.18043036 0.12143001
96 0.02541986 0.18043036
97 0.08283409 0.02541986
98 -0.04267624 0.08283409
99 0.05333392 -0.04267624
100 0.05333392 0.05333392
101 0.95732376 0.05333392
102 0.79321751 0.95732376
103 0.05333392 0.79321751
104 0.12301613 0.05333392
105 -1.20678249 0.12301613
106 -0.11077233 -1.20678249
107 0.11233427 -0.11077233
108 0.08283409 0.11233427
> 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/7mfqn1291285886.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/8mfqn1291285886.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/9mfqn1291285886.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/10wo7q1291285886.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/11z7ov1291285886.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/12ag5g1291285886.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/13zhka1291285886.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/14a9jd1291285886.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/15vr011291285886.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/169jga1291285886.tab")
+ }
>
> try(system("convert tmp/1p5sw1291285886.ps tmp/1p5sw1291285886.png",intern=TRUE))
character(0)
> try(system("convert tmp/2p5sw1291285886.ps tmp/2p5sw1291285886.png",intern=TRUE))
character(0)
> try(system("convert tmp/3ixsh1291285886.ps tmp/3ixsh1291285886.png",intern=TRUE))
character(0)
> try(system("convert tmp/4ixsh1291285886.ps tmp/4ixsh1291285886.png",intern=TRUE))
character(0)
> try(system("convert tmp/5ixsh1291285886.ps tmp/5ixsh1291285886.png",intern=TRUE))
character(0)
> try(system("convert tmp/6bork1291285886.ps tmp/6bork1291285886.png",intern=TRUE))
character(0)
> try(system("convert tmp/7mfqn1291285886.ps tmp/7mfqn1291285886.png",intern=TRUE))
character(0)
> try(system("convert tmp/8mfqn1291285886.ps tmp/8mfqn1291285886.png",intern=TRUE))
character(0)
> try(system("convert tmp/9mfqn1291285886.ps tmp/9mfqn1291285886.png",intern=TRUE))
character(0)
> try(system("convert tmp/10wo7q1291285886.ps tmp/10wo7q1291285886.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
3.132 1.701 7.402