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(9
+ ,15
+ ,6
+ ,25
+ ,68
+ ,0
+ ,14
+ ,10
+ ,8
+ ,23
+ ,48
+ ,0
+ ,8
+ ,10
+ ,7
+ ,17
+ ,44
+ ,0
+ ,8
+ ,12
+ ,9
+ ,19
+ ,67
+ ,1
+ ,14
+ ,9
+ ,8
+ ,29
+ ,46
+ ,1
+ ,15
+ ,18
+ ,11
+ ,23
+ ,54
+ ,1
+ ,9
+ ,14
+ ,9
+ ,23
+ ,61
+ ,0
+ ,11
+ ,11
+ ,11
+ ,21
+ ,52
+ ,0
+ ,14
+ ,11
+ ,12
+ ,26
+ ,46
+ ,1
+ ,14
+ ,9
+ ,6
+ ,24
+ ,55
+ ,0
+ ,6
+ ,17
+ ,8
+ ,25
+ ,52
+ ,0
+ ,10
+ ,21
+ ,12
+ ,26
+ ,76
+ ,0
+ ,9
+ ,16
+ ,9
+ ,23
+ ,49
+ ,0
+ ,11
+ ,21
+ ,7
+ ,29
+ ,30
+ ,1
+ ,14
+ ,14
+ ,8
+ ,24
+ ,75
+ ,1
+ ,8
+ ,24
+ ,20
+ ,20
+ ,51
+ ,1
+ ,11
+ ,7
+ ,8
+ ,23
+ ,50
+ ,1
+ ,10
+ ,9
+ ,6
+ ,29
+ ,38
+ ,0
+ ,16
+ ,18
+ ,16
+ ,24
+ ,47
+ ,0
+ ,8
+ ,14
+ ,6
+ ,22
+ ,52
+ ,1
+ ,11
+ ,13
+ ,6
+ ,22
+ ,66
+ ,0
+ ,11
+ ,13
+ ,6
+ ,22
+ ,66
+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41
+ ,1
+ ,11
+ ,11
+ ,8
+ ,25
+ ,54
+ ,1
+ ,12
+ ,10
+ ,8
+ ,15
+ ,42
+ ,1
+ ,12
+ ,11
+ ,8
+ ,25
+ ,70
+ ,0
+ ,14
+ ,17
+ ,7
+ ,21
+ ,51
+ ,0
+ ,9
+ ,16
+ ,5
+ ,23
+ ,60
+ ,0
+ ,11
+ ,13
+ ,7
+ ,25
+ ,49
+ ,1
+ ,8
+ ,15
+ ,9
+ ,24
+ ,52
+ ,0)
+ ,dim=c(6
+ ,86)
+ ,dimnames=list(c('Doubts'
+ ,'Parentalexpectations'
+ ,'Parentalcriticism'
+ ,'organization'
+ ,'intrinsic'
+ ,'geslacht')
+ ,1:86))
> y <- array(NA,dim=c(6,86),dimnames=list(c('Doubts','Parentalexpectations','Parentalcriticism','organization','intrinsic','geslacht'),1:86))
> 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
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
intrinsic Doubts Parentalexpectations Parentalcriticism organization
1 68 9 15 6 25
2 48 14 10 8 23
3 44 8 10 7 17
4 67 8 12 9 19
5 46 14 9 8 29
6 54 15 18 11 23
7 61 9 14 9 23
8 52 11 11 11 21
9 46 14 11 12 26
10 55 14 9 6 24
11 52 6 17 8 25
12 76 10 21 12 26
13 49 9 16 9 23
14 30 11 21 7 29
15 75 14 14 8 24
16 51 8 24 20 20
17 50 11 7 8 23
18 38 10 9 6 29
19 47 16 18 16 24
20 52 8 14 6 22
21 66 11 13 6 22
22 66 11 13 6 22
23 33 7 18 11 17
24 48 13 14 12 24
25 57 10 12 8 21
26 64 9 12 8 24
27 58 9 9 7 23
28 59 15 11 9 21
29 42 13 8 9 24
30 39 16 5 4 24
31 59 11 9 6 19
32 37 6 11 8 26
33 49 14 11 8 24
34 80 4 15 4 28
35 62 12 16 14 22
36 44 10 12 8 23
37 53 14 14 10 24
38 58 9 13 6 23
39 69 10 10 8 23
40 63 14 18 10 30
41 36 14 17 11 20
42 38 10 12 8 23
43 46 9 13 8 21
44 56 14 13 10 27
45 37 8 11 8 12
46 51 9 13 10 15
47 44 8 12 7 22
48 58 10 12 8 27
49 37 9 12 8 21
50 65 9 12 7 21
51 48 9 13 6 21
52 53 9 17 9 21
53 51 11 18 5 18
54 39 15 7 5 24
55 64 8 17 7 24
56 47 12 14 7 28
57 47 8 12 7 25
58 64 14 9 9 14
59 59 11 9 5 30
60 54 10 13 8 19
61 55 12 10 8 29
62 72 9 12 9 25
63 58 13 10 6 25
64 59 14 11 8 25
65 36 15 13 8 16
66 62 8 6 6 25
67 63 7 7 4 28
68 50 10 13 6 24
69 70 10 11 5 24
70 59 11 9 6 22
71 73 8 9 11 20
72 62 9 11 10 27
73 41 10 15 10 21
74 56 11 11 8 26
75 52 10 14 9 26
76 54 16 14 9 25
77 73 11 8 4 13
78 40 16 12 7 22
79 41 6 8 11 23
80 54 11 11 8 25
81 42 12 10 8 15
82 70 12 11 8 25
83 51 14 17 7 21
84 60 9 16 5 23
85 49 11 13 7 25
86 52 8 15 9 24
geslacht
1 0
2 0
3 0
4 1
5 1
6 1
7 0
8 0
9 1
10 0
11 0
12 0
13 0
14 1
15 1
16 1
17 1
18 0
19 0
20 1
21 0
22 1
23 0
24 0
25 0
26 1
27 1
28 1
29 0
30 0
31 0
32 1
33 1
34 1
35 0
36 0
37 1
38 1
39 1
40 1
41 1
42 0
43 0
44 0
45 1
46 0
47 1
48 1
49 0
50 0
51 0
52 1
53 1
54 1
55 1
56 1
57 1
58 0
59 0
60 1
61 0
62 1
63 0
64 0
65 0
66 0
67 1
68 1
69 0
70 1
71 0
72 1
73 0
74 1
75 1
76 0
77 0
78 1
79 1
80 1
81 1
82 0
83 0
84 0
85 1
86 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Doubts Parentalexpectations
54.3925 -0.6069 0.0642
Parentalcriticism organization geslacht
-0.4291 0.3967 -1.2392
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-26.3269 -7.4679 0.1486 5.9115 23.3559
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 54.3925 10.0485 5.413 6.31e-07 ***
Doubts -0.6069 0.4558 -1.331 0.187
Parentalexpectations 0.0642 0.3979 0.161 0.872
Parentalcriticism -0.4291 0.5496 -0.781 0.437
organization 0.3967 0.3306 1.200 0.234
geslacht -1.2392 2.4261 -0.511 0.611
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 11.06 on 80 degrees of freedom
Multiple R-squared: 0.05145, Adjusted R-squared: -0.007836
F-statistic: 0.8678 on 5 and 80 DF, p-value: 0.5065
> 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.2908505 0.58170092 0.70914954
[2,] 0.2770462 0.55409246 0.72295377
[3,] 0.3650751 0.73015024 0.63492488
[4,] 0.4277062 0.85541233 0.57229383
[5,] 0.4332563 0.86651253 0.56674374
[6,] 0.7788293 0.44234133 0.22117066
[7,] 0.9368773 0.12624532 0.06312266
[8,] 0.9238371 0.15232581 0.07616290
[9,] 0.8862075 0.22758495 0.11379248
[10,] 0.8934840 0.21303193 0.10651597
[11,] 0.8684369 0.26312614 0.13156307
[12,] 0.8242887 0.35142253 0.17571126
[13,] 0.7987835 0.40243304 0.20121652
[14,] 0.7798916 0.44021671 0.22010836
[15,] 0.9193620 0.16127600 0.08063800
[16,] 0.8899636 0.22007277 0.11003639
[17,] 0.8530626 0.29387486 0.14693743
[18,] 0.8461208 0.30775844 0.15387922
[19,] 0.8045694 0.39086118 0.19543059
[20,] 0.7753604 0.44927929 0.22463965
[21,] 0.7569139 0.48617226 0.24308613
[22,] 0.7894939 0.42101219 0.21050610
[23,] 0.7436439 0.51271226 0.25635613
[24,] 0.8055063 0.38898744 0.19449372
[25,] 0.7623814 0.47523725 0.23761863
[26,] 0.8754141 0.24917177 0.12458588
[27,] 0.8833811 0.23323772 0.11661886
[28,] 0.8785329 0.24293422 0.12146711
[29,] 0.8451754 0.30964911 0.15482455
[30,] 0.8056503 0.38869940 0.19434970
[31,] 0.8470534 0.30589317 0.15294659
[32,] 0.8564961 0.28700782 0.14350391
[33,] 0.8816058 0.23678850 0.11839425
[34,] 0.9215110 0.15697809 0.07848904
[35,] 0.9155454 0.16890922 0.08445461
[36,] 0.8918350 0.21633007 0.10816503
[37,] 0.9088778 0.18224447 0.09112224
[38,] 0.8818135 0.23637295 0.11818648
[39,] 0.8819164 0.23616725 0.11808363
[40,] 0.8510152 0.29796967 0.14898483
[41,] 0.9320327 0.13593458 0.06796729
[42,] 0.9220558 0.15588833 0.07794416
[43,] 0.9306237 0.13875256 0.06937628
[44,] 0.9058017 0.18839659 0.09419829
[45,] 0.8757803 0.24843936 0.12421968
[46,] 0.8889127 0.22217465 0.11108732
[47,] 0.9019945 0.19601108 0.09800554
[48,] 0.8753638 0.24927245 0.12463623
[49,] 0.8601406 0.27971872 0.13985936
[50,] 0.8753967 0.24920667 0.12460333
[51,] 0.8572842 0.28543166 0.14271583
[52,] 0.8206347 0.35873065 0.17936532
[53,] 0.7982440 0.40351200 0.20175600
[54,] 0.9245154 0.15096910 0.07548455
[55,] 0.9070822 0.18583566 0.09291783
[56,] 0.8711978 0.25760432 0.12880216
[57,] 0.9212260 0.15754791 0.07877395
[58,] 0.9671552 0.06568961 0.03284481
[59,] 0.9751704 0.04965913 0.02482957
[60,] 0.9572897 0.08542063 0.04271032
[61,] 0.9495228 0.10095443 0.05047721
[62,] 0.9170047 0.16599061 0.08299530
[63,] 0.9644898 0.07102039 0.03551019
[64,] 0.9848650 0.03026998 0.01513499
[65,] 0.9712658 0.05746837 0.02873418
[66,] 0.9433218 0.11335632 0.05667816
[67,] 0.9769543 0.04609130 0.02304565
[68,] 0.9413283 0.11734332 0.05867166
[69,] 0.8673001 0.26539984 0.13269992
> postscript(file="/var/www/html/rcomp/tmp/172id1290422793.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/20t0g1290422793.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/30t0g1290422793.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/40t0g1290422793.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/5t3z11290422793.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 = 86
Frequency = 1
1 2 3 4 5 6
10.76311092 -4.22977332 -9.91989184 14.25571309 -7.30666249 4.39006130
7 8 9 10 11 12
5.90807509 -0.03388330 -4.52847538 1.57949392 -6.32775034 21.16270811
13 14 15 16 17 18
-6.22032830 -26.32686000 23.35593692 1.80874207 -2.61860043 -19.83167496
19 20 21 22 23 24
-1.49347638 -3.35017435 11.29545953 12.53469811 -20.32396986 -3.77376614
25 26 27 28 29 30
3.00770543 9.44988903 3.61010924 9.77470341 -10.67587532 -13.80813169
31 32 33 34 35 36
5.74243102 -20.10002318 -2.45145801 18.91952062 11.14259625 -10.78573772
37 38 39 40 41 42
2.21414980 2.92419603 15.58190424 9.57701359 -12.96246254 -16.78573772
43 44 45 46 47 48
-8.66338652 2.84894820 -13.33214065 -0.42484419 -10.79266452 2.86661457
49 50 51 52 53 54
-17.59918482 9.97170873 -7.52159940 -0.25184827 -1.62853050 -12.87508031
55 56 57 58 59 60
8.09288387 -7.87383633 -8.98282924 15.83402898 0.94938728 1.97618546
61 62 63 64 65 66
-0.82388326 17.48227390 3.51168040 5.91258185 -13.03843713 4.73403590
67 68 69 70 71 72
4.25380492 -4.86563529 13.59442308 5.79150488 19.67057090 7.18213889
73 74 75 76 77 78
-12.32668676 1.93442808 -2.43596080 2.36286372 21.32874927 -9.93754249
79 80 81 82 83 84
-13.42993406 0.33114966 -7.03054267 15.69880134 -1.31484846 3.06324593
85 86
-5.22636017 -4.15973843
> postscript(file="/var/www/html/rcomp/tmp/6t3z11290422793.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 = 86
Frequency = 1
lag(myerror, k = 1) myerror
0 10.76311092 NA
1 -4.22977332 10.76311092
2 -9.91989184 -4.22977332
3 14.25571309 -9.91989184
4 -7.30666249 14.25571309
5 4.39006130 -7.30666249
6 5.90807509 4.39006130
7 -0.03388330 5.90807509
8 -4.52847538 -0.03388330
9 1.57949392 -4.52847538
10 -6.32775034 1.57949392
11 21.16270811 -6.32775034
12 -6.22032830 21.16270811
13 -26.32686000 -6.22032830
14 23.35593692 -26.32686000
15 1.80874207 23.35593692
16 -2.61860043 1.80874207
17 -19.83167496 -2.61860043
18 -1.49347638 -19.83167496
19 -3.35017435 -1.49347638
20 11.29545953 -3.35017435
21 12.53469811 11.29545953
22 -20.32396986 12.53469811
23 -3.77376614 -20.32396986
24 3.00770543 -3.77376614
25 9.44988903 3.00770543
26 3.61010924 9.44988903
27 9.77470341 3.61010924
28 -10.67587532 9.77470341
29 -13.80813169 -10.67587532
30 5.74243102 -13.80813169
31 -20.10002318 5.74243102
32 -2.45145801 -20.10002318
33 18.91952062 -2.45145801
34 11.14259625 18.91952062
35 -10.78573772 11.14259625
36 2.21414980 -10.78573772
37 2.92419603 2.21414980
38 15.58190424 2.92419603
39 9.57701359 15.58190424
40 -12.96246254 9.57701359
41 -16.78573772 -12.96246254
42 -8.66338652 -16.78573772
43 2.84894820 -8.66338652
44 -13.33214065 2.84894820
45 -0.42484419 -13.33214065
46 -10.79266452 -0.42484419
47 2.86661457 -10.79266452
48 -17.59918482 2.86661457
49 9.97170873 -17.59918482
50 -7.52159940 9.97170873
51 -0.25184827 -7.52159940
52 -1.62853050 -0.25184827
53 -12.87508031 -1.62853050
54 8.09288387 -12.87508031
55 -7.87383633 8.09288387
56 -8.98282924 -7.87383633
57 15.83402898 -8.98282924
58 0.94938728 15.83402898
59 1.97618546 0.94938728
60 -0.82388326 1.97618546
61 17.48227390 -0.82388326
62 3.51168040 17.48227390
63 5.91258185 3.51168040
64 -13.03843713 5.91258185
65 4.73403590 -13.03843713
66 4.25380492 4.73403590
67 -4.86563529 4.25380492
68 13.59442308 -4.86563529
69 5.79150488 13.59442308
70 19.67057090 5.79150488
71 7.18213889 19.67057090
72 -12.32668676 7.18213889
73 1.93442808 -12.32668676
74 -2.43596080 1.93442808
75 2.36286372 -2.43596080
76 21.32874927 2.36286372
77 -9.93754249 21.32874927
78 -13.42993406 -9.93754249
79 0.33114966 -13.42993406
80 -7.03054267 0.33114966
81 15.69880134 -7.03054267
82 -1.31484846 15.69880134
83 3.06324593 -1.31484846
84 -5.22636017 3.06324593
85 -4.15973843 -5.22636017
86 NA -4.15973843
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -4.22977332 10.76311092
[2,] -9.91989184 -4.22977332
[3,] 14.25571309 -9.91989184
[4,] -7.30666249 14.25571309
[5,] 4.39006130 -7.30666249
[6,] 5.90807509 4.39006130
[7,] -0.03388330 5.90807509
[8,] -4.52847538 -0.03388330
[9,] 1.57949392 -4.52847538
[10,] -6.32775034 1.57949392
[11,] 21.16270811 -6.32775034
[12,] -6.22032830 21.16270811
[13,] -26.32686000 -6.22032830
[14,] 23.35593692 -26.32686000
[15,] 1.80874207 23.35593692
[16,] -2.61860043 1.80874207
[17,] -19.83167496 -2.61860043
[18,] -1.49347638 -19.83167496
[19,] -3.35017435 -1.49347638
[20,] 11.29545953 -3.35017435
[21,] 12.53469811 11.29545953
[22,] -20.32396986 12.53469811
[23,] -3.77376614 -20.32396986
[24,] 3.00770543 -3.77376614
[25,] 9.44988903 3.00770543
[26,] 3.61010924 9.44988903
[27,] 9.77470341 3.61010924
[28,] -10.67587532 9.77470341
[29,] -13.80813169 -10.67587532
[30,] 5.74243102 -13.80813169
[31,] -20.10002318 5.74243102
[32,] -2.45145801 -20.10002318
[33,] 18.91952062 -2.45145801
[34,] 11.14259625 18.91952062
[35,] -10.78573772 11.14259625
[36,] 2.21414980 -10.78573772
[37,] 2.92419603 2.21414980
[38,] 15.58190424 2.92419603
[39,] 9.57701359 15.58190424
[40,] -12.96246254 9.57701359
[41,] -16.78573772 -12.96246254
[42,] -8.66338652 -16.78573772
[43,] 2.84894820 -8.66338652
[44,] -13.33214065 2.84894820
[45,] -0.42484419 -13.33214065
[46,] -10.79266452 -0.42484419
[47,] 2.86661457 -10.79266452
[48,] -17.59918482 2.86661457
[49,] 9.97170873 -17.59918482
[50,] -7.52159940 9.97170873
[51,] -0.25184827 -7.52159940
[52,] -1.62853050 -0.25184827
[53,] -12.87508031 -1.62853050
[54,] 8.09288387 -12.87508031
[55,] -7.87383633 8.09288387
[56,] -8.98282924 -7.87383633
[57,] 15.83402898 -8.98282924
[58,] 0.94938728 15.83402898
[59,] 1.97618546 0.94938728
[60,] -0.82388326 1.97618546
[61,] 17.48227390 -0.82388326
[62,] 3.51168040 17.48227390
[63,] 5.91258185 3.51168040
[64,] -13.03843713 5.91258185
[65,] 4.73403590 -13.03843713
[66,] 4.25380492 4.73403590
[67,] -4.86563529 4.25380492
[68,] 13.59442308 -4.86563529
[69,] 5.79150488 13.59442308
[70,] 19.67057090 5.79150488
[71,] 7.18213889 19.67057090
[72,] -12.32668676 7.18213889
[73,] 1.93442808 -12.32668676
[74,] -2.43596080 1.93442808
[75,] 2.36286372 -2.43596080
[76,] 21.32874927 2.36286372
[77,] -9.93754249 21.32874927
[78,] -13.42993406 -9.93754249
[79,] 0.33114966 -13.42993406
[80,] -7.03054267 0.33114966
[81,] 15.69880134 -7.03054267
[82,] -1.31484846 15.69880134
[83,] 3.06324593 -1.31484846
[84,] -5.22636017 3.06324593
[85,] -4.15973843 -5.22636017
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -4.22977332 10.76311092
2 -9.91989184 -4.22977332
3 14.25571309 -9.91989184
4 -7.30666249 14.25571309
5 4.39006130 -7.30666249
6 5.90807509 4.39006130
7 -0.03388330 5.90807509
8 -4.52847538 -0.03388330
9 1.57949392 -4.52847538
10 -6.32775034 1.57949392
11 21.16270811 -6.32775034
12 -6.22032830 21.16270811
13 -26.32686000 -6.22032830
14 23.35593692 -26.32686000
15 1.80874207 23.35593692
16 -2.61860043 1.80874207
17 -19.83167496 -2.61860043
18 -1.49347638 -19.83167496
19 -3.35017435 -1.49347638
20 11.29545953 -3.35017435
21 12.53469811 11.29545953
22 -20.32396986 12.53469811
23 -3.77376614 -20.32396986
24 3.00770543 -3.77376614
25 9.44988903 3.00770543
26 3.61010924 9.44988903
27 9.77470341 3.61010924
28 -10.67587532 9.77470341
29 -13.80813169 -10.67587532
30 5.74243102 -13.80813169
31 -20.10002318 5.74243102
32 -2.45145801 -20.10002318
33 18.91952062 -2.45145801
34 11.14259625 18.91952062
35 -10.78573772 11.14259625
36 2.21414980 -10.78573772
37 2.92419603 2.21414980
38 15.58190424 2.92419603
39 9.57701359 15.58190424
40 -12.96246254 9.57701359
41 -16.78573772 -12.96246254
42 -8.66338652 -16.78573772
43 2.84894820 -8.66338652
44 -13.33214065 2.84894820
45 -0.42484419 -13.33214065
46 -10.79266452 -0.42484419
47 2.86661457 -10.79266452
48 -17.59918482 2.86661457
49 9.97170873 -17.59918482
50 -7.52159940 9.97170873
51 -0.25184827 -7.52159940
52 -1.62853050 -0.25184827
53 -12.87508031 -1.62853050
54 8.09288387 -12.87508031
55 -7.87383633 8.09288387
56 -8.98282924 -7.87383633
57 15.83402898 -8.98282924
58 0.94938728 15.83402898
59 1.97618546 0.94938728
60 -0.82388326 1.97618546
61 17.48227390 -0.82388326
62 3.51168040 17.48227390
63 5.91258185 3.51168040
64 -13.03843713 5.91258185
65 4.73403590 -13.03843713
66 4.25380492 4.73403590
67 -4.86563529 4.25380492
68 13.59442308 -4.86563529
69 5.79150488 13.59442308
70 19.67057090 5.79150488
71 7.18213889 19.67057090
72 -12.32668676 7.18213889
73 1.93442808 -12.32668676
74 -2.43596080 1.93442808
75 2.36286372 -2.43596080
76 21.32874927 2.36286372
77 -9.93754249 21.32874927
78 -13.42993406 -9.93754249
79 0.33114966 -13.42993406
80 -7.03054267 0.33114966
81 15.69880134 -7.03054267
82 -1.31484846 15.69880134
83 3.06324593 -1.31484846
84 -5.22636017 3.06324593
85 -4.15973843 -5.22636017
> 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/7mug41290422793.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/8mug41290422793.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/9mug41290422793.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/10wlf71290422793.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/110mev1290422793.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/12l4ci1290422793.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/13an9c1290422793.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/14kerf1290422793.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/156fpl1290422793.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/16k75u1290422793.tab")
+ }
>
> try(system("convert tmp/172id1290422793.ps tmp/172id1290422793.png",intern=TRUE))
character(0)
> try(system("convert tmp/20t0g1290422793.ps tmp/20t0g1290422793.png",intern=TRUE))
character(0)
> try(system("convert tmp/30t0g1290422793.ps tmp/30t0g1290422793.png",intern=TRUE))
character(0)
> try(system("convert tmp/40t0g1290422793.ps tmp/40t0g1290422793.png",intern=TRUE))
character(0)
> try(system("convert tmp/5t3z11290422793.ps tmp/5t3z11290422793.png",intern=TRUE))
character(0)
> try(system("convert tmp/6t3z11290422793.ps tmp/6t3z11290422793.png",intern=TRUE))
character(0)
> try(system("convert tmp/7mug41290422793.ps tmp/7mug41290422793.png",intern=TRUE))
character(0)
> try(system("convert tmp/8mug41290422793.ps tmp/8mug41290422793.png",intern=TRUE))
character(0)
> try(system("convert tmp/9mug41290422793.ps tmp/9mug41290422793.png",intern=TRUE))
character(0)
> try(system("convert tmp/10wlf71290422793.ps tmp/10wlf71290422793.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.958 1.713 8.586