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(10
+ ,24
+ ,14
+ ,11
+ ,12
+ ,24
+ ,26
+ ,14
+ ,25
+ ,11
+ ,7
+ ,8
+ ,25
+ ,23
+ ,18
+ ,17
+ ,6
+ ,17
+ ,8
+ ,30
+ ,25
+ ,15
+ ,18
+ ,12
+ ,10
+ ,8
+ ,19
+ ,23
+ ,18
+ ,18
+ ,8
+ ,12
+ ,9
+ ,22
+ ,19
+ ,11
+ ,16
+ ,10
+ ,12
+ ,7
+ ,22
+ ,29
+ ,17
+ ,20
+ ,10
+ ,11
+ ,4
+ ,25
+ ,25
+ ,19
+ ,16
+ ,11
+ ,11
+ ,11
+ ,23
+ ,21
+ ,7
+ ,18
+ ,16
+ ,12
+ ,7
+ ,17
+ ,22
+ ,12
+ ,17
+ ,11
+ ,13
+ ,7
+ ,21
+ ,25
+ ,13
+ ,23
+ ,13
+ ,14
+ ,12
+ ,19
+ ,24
+ ,15
+ ,30
+ ,12
+ ,16
+ ,10
+ ,19
+ ,18
+ ,14
+ ,23
+ ,8
+ ,11
+ ,10
+ ,15
+ ,22
+ ,14
+ ,18
+ ,12
+ ,10
+ ,8
+ ,16
+ ,15
+ ,16
+ ,15
+ ,11
+ ,11
+ ,8
+ ,23
+ ,22
+ ,16
+ ,12
+ ,4
+ ,15
+ ,4
+ ,27
+ ,28
+ ,12
+ ,21
+ ,9
+ ,9
+ ,9
+ ,22
+ ,20
+ ,12
+ ,15
+ ,8
+ ,11
+ ,8
+ ,14
+ ,12
+ ,13
+ ,20
+ ,8
+ ,17
+ ,7
+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13
+ ,5
+ ,21
+ ,24
+ ,13
+ ,25
+ ,14
+ ,15
+ ,9
+ ,22
+ ,24
+ ,14
+ ,29
+ ,11
+ ,7
+ ,4
+ ,26
+ ,22
+ ,15
+ ,14
+ ,11
+ ,12
+ ,7
+ ,17
+ ,16
+ ,11
+ ,22
+ ,14
+ ,14
+ ,11
+ ,25
+ ,19
+ ,14
+ ,20
+ ,11
+ ,17
+ ,8
+ ,21
+ ,23
+ ,17
+ ,15
+ ,8
+ ,10
+ ,4
+ ,22
+ ,24
+ ,13
+ ,22
+ ,11
+ ,13
+ ,11
+ ,24
+ ,18
+ ,12
+ ,16
+ ,8
+ ,9
+ ,4
+ ,18
+ ,23
+ ,13
+ ,22
+ ,13
+ ,12
+ ,13
+ ,22
+ ,15
+ ,16
+ ,30
+ ,12
+ ,15
+ ,10
+ ,29
+ ,22
+ ,13
+ ,16
+ ,9
+ ,12
+ ,9
+ ,10
+ ,13
+ ,19
+ ,20
+ ,7
+ ,11
+ ,9
+ ,26
+ ,22)
+ ,dim=c(7
+ ,80)
+ ,dimnames=list(c('Perceived_happiness'
+ ,'Concern_over_mistakes'
+ ,'Doubts_about_actions'
+ ,'Parental_expectations'
+ ,'Parental_criticism'
+ ,'Personal_standards'
+ ,'Organization')
+ ,1:80))
> y <- array(NA,dim=c(7,80),dimnames=list(c('Perceived_happiness','Concern_over_mistakes','Doubts_about_actions','Parental_expectations','Parental_criticism','Personal_standards','Organization'),1:80))
> 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 = '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
Perceived_happiness Concern_over_mistakes Doubts_about_actions
1 10 24 14
2 14 25 11
3 18 17 6
4 15 18 12
5 18 18 8
6 11 16 10
7 17 20 10
8 19 16 11
9 7 18 16
10 12 17 11
11 13 23 13
12 15 30 12
13 14 23 8
14 14 18 12
15 16 15 11
16 16 12 4
17 12 21 9
18 12 15 8
19 13 20 8
20 16 31 14
21 9 27 15
22 11 19 11
23 14 16 8
24 11 21 9
25 17 17 9
26 14 25 8
27 15 17 9
28 11 32 16
29 15 33 11
30 14 13 16
31 11 32 12
32 12 25 12
33 9 18 10
34 16 17 9
35 13 20 10
36 15 15 12
37 10 33 14
38 13 23 14
39 16 20 10
40 15 11 6
41 13 26 13
42 16 15 11
43 15 12 7
44 16 14 15
45 15 17 9
46 13 21 10
47 11 16 10
48 17 10 10
49 10 29 11
50 17 31 8
51 14 9 13
52 15 20 11
53 16 30 9
54 12 21 12
55 11 21 12
56 16 20 8
57 9 23 14
58 15 21 11
59 15 19 10
60 13 16 11
61 15 22 10
62 15 30 12
63 18 18 8
64 16 23 14
65 12 25 14
66 15 28 8
67 13 9 6
68 13 16 8
69 13 25 14
70 14 29 11
71 15 14 11
72 11 22 14
73 14 20 11
74 17 15 8
75 13 22 11
76 12 16 8
77 13 22 13
78 16 30 12
79 13 16 9
80 19 20 7
Parental_expectations Parental_criticism Personal_standards Organization t
1 11 12 24 26 1
2 7 8 25 23 2
3 17 8 30 25 3
4 10 8 19 23 4
5 12 9 22 19 5
6 12 7 22 29 6
7 11 4 25 25 7
8 11 11 23 21 8
9 12 7 17 22 9
10 13 7 21 25 10
11 14 12 19 24 11
12 16 10 19 18 12
13 11 10 15 22 13
14 10 8 16 15 14
15 11 8 23 22 15
16 15 4 27 28 16
17 9 9 22 20 17
18 11 8 14 12 18
19 17 7 22 24 19
20 17 11 23 20 20
21 11 9 23 21 21
22 11 8 20 28 22
23 15 9 23 24 23
24 13 9 19 24 24
25 13 6 22 23 25
26 12 7 32 25 26
27 17 9 25 21 27
28 9 6 29 26 28
29 9 6 28 22 29
30 12 5 17 22 30
31 18 12 28 22 31
32 12 7 29 23 32
33 15 8 14 17 33
34 16 5 25 23 34
35 10 8 26 23 35
36 11 8 20 25 36
37 9 6 32 24 37
38 17 7 25 21 38
39 12 8 20 28 39
40 6 4 15 16 40
41 12 8 24 29 41
42 11 8 23 22 42
43 7 4 22 28 43
44 13 8 14 16 44
45 12 9 24 25 45
46 13 6 24 24 46
47 12 7 22 29 47
48 11 5 19 23 48
49 9 5 31 30 49
50 11 8 22 24 50
51 10 6 19 25 51
52 11 8 25 25 52
53 15 9 27 26 53
54 14 9 22 24 54
55 13 8 19 22 55
56 16 10 25 24 56
57 8 5 19 27 57
58 16 7 20 24 58
59 12 7 17 21 59
60 9 5 17 23 60
61 15 6 22 20 61
62 16 10 19 18 62
63 15 10 21 22 63
64 11 10 20 29 64
65 11 5 17 15 65
66 16 12 18 24 66
67 8 11 29 23 67
68 13 5 21 24 68
69 15 9 22 24 69
70 7 4 26 22 70
71 12 7 17 16 71
72 14 11 25 19 72
73 17 8 21 23 73
74 10 4 22 24 74
75 13 11 24 18 75
76 9 4 18 23 76
77 12 13 22 15 77
78 15 10 29 22 78
79 12 9 10 13 79
80 11 9 26 22 80
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Concern_over_mistakes Doubts_about_actions
16.765323 -0.058976 -0.366096
Parental_expectations Parental_criticism Personal_standards
0.119755 0.037938 0.081720
Organization t
-0.071443 0.006393
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-5.2832 -1.7774 0.2187 1.7719 5.0403
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 16.765323 2.593310 6.465 1.06e-08 ***
Concern_over_mistakes -0.058976 0.055125 -1.070 0.28826
Doubts_about_actions -0.366096 0.112500 -3.254 0.00173 **
Parental_expectations 0.119755 0.101328 1.182 0.24115
Parental_criticism 0.037938 0.132266 0.287 0.77506
Personal_standards 0.081720 0.073945 1.105 0.27278
Organization -0.071443 0.079607 -0.897 0.37247
t 0.006393 0.011177 0.572 0.56911
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.276 on 72 degrees of freedom
Multiple R-squared: 0.2318, Adjusted R-squared: 0.1572
F-statistic: 3.104 on 7 and 72 DF, p-value: 0.00643
> 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.8424468 0.3151063 0.1575532
[2,] 0.7424652 0.5150697 0.2575348
[3,] 0.7064647 0.5870707 0.2935353
[4,] 0.7357770 0.5284459 0.2642230
[5,] 0.6627027 0.6745947 0.3372973
[6,] 0.6326612 0.7346777 0.3673388
[7,] 0.7937150 0.4125699 0.2062850
[8,] 0.8900564 0.2198873 0.1099436
[9,] 0.8518671 0.2962659 0.1481329
[10,] 0.8641877 0.2716246 0.1358123
[11,] 0.8716654 0.2566692 0.1283346
[12,] 0.8481516 0.3036968 0.1518484
[13,] 0.7975598 0.4048804 0.2024402
[14,] 0.7797044 0.4405913 0.2202956
[15,] 0.8529872 0.2940256 0.1470128
[16,] 0.8262909 0.3474182 0.1737091
[17,] 0.7741152 0.4517697 0.2258848
[18,] 0.7224966 0.5550067 0.2775034
[19,] 0.7134168 0.5731664 0.2865832
[20,] 0.7882980 0.4234040 0.2117020
[21,] 0.8014766 0.3970468 0.1985234
[22,] 0.7640739 0.4718522 0.2359261
[23,] 0.9072273 0.1855454 0.0927727
[24,] 0.8857705 0.2284590 0.1142295
[25,] 0.8531189 0.2937621 0.1468811
[26,] 0.8775486 0.2449028 0.1224514
[27,] 0.8662087 0.2675826 0.1337913
[28,] 0.8296832 0.3406337 0.1703168
[29,] 0.8749990 0.2500019 0.1250010
[30,] 0.8369297 0.3261406 0.1630703
[31,] 0.8018792 0.3962416 0.1981208
[32,] 0.7807725 0.4384551 0.2192275
[33,] 0.7276151 0.5447698 0.2723849
[34,] 0.7944867 0.4110266 0.2055133
[35,] 0.7413832 0.5172337 0.2586168
[36,] 0.6915722 0.6168555 0.3084278
[37,] 0.7295749 0.5408502 0.2704251
[38,] 0.7813402 0.4373196 0.2186598
[39,] 0.8508555 0.2982889 0.1491445
[40,] 0.8737661 0.2524678 0.1262339
[41,] 0.8760920 0.2478161 0.1239080
[42,] 0.8599927 0.2800146 0.1400073
[43,] 0.8223189 0.3553621 0.1776811
[44,] 0.7844670 0.4310661 0.2155330
[45,] 0.7736651 0.4526697 0.2263349
[46,] 0.7064864 0.5870273 0.2935136
[47,] 0.7700676 0.4598647 0.2299324
[48,] 0.7070021 0.5859959 0.2929979
[49,] 0.6409161 0.7181678 0.3590839
[50,] 0.5519242 0.8961516 0.4480758
[51,] 0.4618254 0.9236508 0.5381746
[52,] 0.3839614 0.7679227 0.6160386
[53,] 0.5262403 0.9475195 0.4737597
[54,] 0.6971632 0.6056736 0.3028368
[55,] 0.5904056 0.8191889 0.4095944
[56,] 0.5423622 0.9152756 0.4576378
[57,] 0.4590893 0.9181786 0.5409107
[58,] 0.4570108 0.9140215 0.5429892
[59,] 0.6507264 0.6985471 0.3492736
> postscript(file="/var/www/html/rcomp/tmp/1u30n1290528234.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/2nczq1290528234.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/3nczq1290528234.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/4nczq1290528234.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/5x3gb1290528234.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 = 80
Frequency = 1
1 2 3 4 5 6
-2.10729701 1.18172279 1.40978491 2.25325958 2.97410569 -2.62774381
7 8 9 10 11 12
3.30440390 5.04030578 -4.42389691 -1.55205001 0.31015326 1.75820467
13 14 15 16 17 18
0.08602554 0.86294868 2.12183695 -0.84964153 -2.12888040 -2.97457462
19 20 21 22 23 24
-2.16312807 3.15653973 -2.85381244 -2.01319464 -1.34268933 -3.12171884
25 26 27 28 29 30
2.43319746 -1.05998529 -0.56046788 -0.01737242 2.00068195 2.22284964
31 32 33 34 35 36
-3.01040617 -1.53168607 -5.28315642 0.80917460 -1.13120234 1.81316904
37 38 39 40 41 42
-2.13617011 -0.37058270 2.45125060 -0.12873544 0.63516712 1.94922738
43 44 45 46 47 48
0.44267394 3.40916305 0.29072380 -1.19105402 -2.88985465 2.76203402
49 50 51 52 53 54
-2.99875975 2.96801246 1.00686804 1.23106385 1.47328119 -1.58013581
55 56 57 58 59 60
-2.32656089 0.36111263 -2.41940255 1.02800407 1.04741558 -0.19178252
61 62 63 64 65 66
0.41018722 1.43855731 2.50216053 4.04805675 -0.40573157 0.26515225
67 68 69 70 71 72
-3.56835580 -2.07566932 0.17230865 0.98149488 0.68470412 -2.58229262
73 74 75 76 77 78
-0.43772154 2.14247976 -1.56972584 -2.43613807 -0.85733037 1.92459471
79 80
-1.69884313 3.25369282
> postscript(file="/var/www/html/rcomp/tmp/6x3gb1290528234.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 = 80
Frequency = 1
lag(myerror, k = 1) myerror
0 -2.10729701 NA
1 1.18172279 -2.10729701
2 1.40978491 1.18172279
3 2.25325958 1.40978491
4 2.97410569 2.25325958
5 -2.62774381 2.97410569
6 3.30440390 -2.62774381
7 5.04030578 3.30440390
8 -4.42389691 5.04030578
9 -1.55205001 -4.42389691
10 0.31015326 -1.55205001
11 1.75820467 0.31015326
12 0.08602554 1.75820467
13 0.86294868 0.08602554
14 2.12183695 0.86294868
15 -0.84964153 2.12183695
16 -2.12888040 -0.84964153
17 -2.97457462 -2.12888040
18 -2.16312807 -2.97457462
19 3.15653973 -2.16312807
20 -2.85381244 3.15653973
21 -2.01319464 -2.85381244
22 -1.34268933 -2.01319464
23 -3.12171884 -1.34268933
24 2.43319746 -3.12171884
25 -1.05998529 2.43319746
26 -0.56046788 -1.05998529
27 -0.01737242 -0.56046788
28 2.00068195 -0.01737242
29 2.22284964 2.00068195
30 -3.01040617 2.22284964
31 -1.53168607 -3.01040617
32 -5.28315642 -1.53168607
33 0.80917460 -5.28315642
34 -1.13120234 0.80917460
35 1.81316904 -1.13120234
36 -2.13617011 1.81316904
37 -0.37058270 -2.13617011
38 2.45125060 -0.37058270
39 -0.12873544 2.45125060
40 0.63516712 -0.12873544
41 1.94922738 0.63516712
42 0.44267394 1.94922738
43 3.40916305 0.44267394
44 0.29072380 3.40916305
45 -1.19105402 0.29072380
46 -2.88985465 -1.19105402
47 2.76203402 -2.88985465
48 -2.99875975 2.76203402
49 2.96801246 -2.99875975
50 1.00686804 2.96801246
51 1.23106385 1.00686804
52 1.47328119 1.23106385
53 -1.58013581 1.47328119
54 -2.32656089 -1.58013581
55 0.36111263 -2.32656089
56 -2.41940255 0.36111263
57 1.02800407 -2.41940255
58 1.04741558 1.02800407
59 -0.19178252 1.04741558
60 0.41018722 -0.19178252
61 1.43855731 0.41018722
62 2.50216053 1.43855731
63 4.04805675 2.50216053
64 -0.40573157 4.04805675
65 0.26515225 -0.40573157
66 -3.56835580 0.26515225
67 -2.07566932 -3.56835580
68 0.17230865 -2.07566932
69 0.98149488 0.17230865
70 0.68470412 0.98149488
71 -2.58229262 0.68470412
72 -0.43772154 -2.58229262
73 2.14247976 -0.43772154
74 -1.56972584 2.14247976
75 -2.43613807 -1.56972584
76 -0.85733037 -2.43613807
77 1.92459471 -0.85733037
78 -1.69884313 1.92459471
79 3.25369282 -1.69884313
80 NA 3.25369282
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 1.18172279 -2.10729701
[2,] 1.40978491 1.18172279
[3,] 2.25325958 1.40978491
[4,] 2.97410569 2.25325958
[5,] -2.62774381 2.97410569
[6,] 3.30440390 -2.62774381
[7,] 5.04030578 3.30440390
[8,] -4.42389691 5.04030578
[9,] -1.55205001 -4.42389691
[10,] 0.31015326 -1.55205001
[11,] 1.75820467 0.31015326
[12,] 0.08602554 1.75820467
[13,] 0.86294868 0.08602554
[14,] 2.12183695 0.86294868
[15,] -0.84964153 2.12183695
[16,] -2.12888040 -0.84964153
[17,] -2.97457462 -2.12888040
[18,] -2.16312807 -2.97457462
[19,] 3.15653973 -2.16312807
[20,] -2.85381244 3.15653973
[21,] -2.01319464 -2.85381244
[22,] -1.34268933 -2.01319464
[23,] -3.12171884 -1.34268933
[24,] 2.43319746 -3.12171884
[25,] -1.05998529 2.43319746
[26,] -0.56046788 -1.05998529
[27,] -0.01737242 -0.56046788
[28,] 2.00068195 -0.01737242
[29,] 2.22284964 2.00068195
[30,] -3.01040617 2.22284964
[31,] -1.53168607 -3.01040617
[32,] -5.28315642 -1.53168607
[33,] 0.80917460 -5.28315642
[34,] -1.13120234 0.80917460
[35,] 1.81316904 -1.13120234
[36,] -2.13617011 1.81316904
[37,] -0.37058270 -2.13617011
[38,] 2.45125060 -0.37058270
[39,] -0.12873544 2.45125060
[40,] 0.63516712 -0.12873544
[41,] 1.94922738 0.63516712
[42,] 0.44267394 1.94922738
[43,] 3.40916305 0.44267394
[44,] 0.29072380 3.40916305
[45,] -1.19105402 0.29072380
[46,] -2.88985465 -1.19105402
[47,] 2.76203402 -2.88985465
[48,] -2.99875975 2.76203402
[49,] 2.96801246 -2.99875975
[50,] 1.00686804 2.96801246
[51,] 1.23106385 1.00686804
[52,] 1.47328119 1.23106385
[53,] -1.58013581 1.47328119
[54,] -2.32656089 -1.58013581
[55,] 0.36111263 -2.32656089
[56,] -2.41940255 0.36111263
[57,] 1.02800407 -2.41940255
[58,] 1.04741558 1.02800407
[59,] -0.19178252 1.04741558
[60,] 0.41018722 -0.19178252
[61,] 1.43855731 0.41018722
[62,] 2.50216053 1.43855731
[63,] 4.04805675 2.50216053
[64,] -0.40573157 4.04805675
[65,] 0.26515225 -0.40573157
[66,] -3.56835580 0.26515225
[67,] -2.07566932 -3.56835580
[68,] 0.17230865 -2.07566932
[69,] 0.98149488 0.17230865
[70,] 0.68470412 0.98149488
[71,] -2.58229262 0.68470412
[72,] -0.43772154 -2.58229262
[73,] 2.14247976 -0.43772154
[74,] -1.56972584 2.14247976
[75,] -2.43613807 -1.56972584
[76,] -0.85733037 -2.43613807
[77,] 1.92459471 -0.85733037
[78,] -1.69884313 1.92459471
[79,] 3.25369282 -1.69884313
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 1.18172279 -2.10729701
2 1.40978491 1.18172279
3 2.25325958 1.40978491
4 2.97410569 2.25325958
5 -2.62774381 2.97410569
6 3.30440390 -2.62774381
7 5.04030578 3.30440390
8 -4.42389691 5.04030578
9 -1.55205001 -4.42389691
10 0.31015326 -1.55205001
11 1.75820467 0.31015326
12 0.08602554 1.75820467
13 0.86294868 0.08602554
14 2.12183695 0.86294868
15 -0.84964153 2.12183695
16 -2.12888040 -0.84964153
17 -2.97457462 -2.12888040
18 -2.16312807 -2.97457462
19 3.15653973 -2.16312807
20 -2.85381244 3.15653973
21 -2.01319464 -2.85381244
22 -1.34268933 -2.01319464
23 -3.12171884 -1.34268933
24 2.43319746 -3.12171884
25 -1.05998529 2.43319746
26 -0.56046788 -1.05998529
27 -0.01737242 -0.56046788
28 2.00068195 -0.01737242
29 2.22284964 2.00068195
30 -3.01040617 2.22284964
31 -1.53168607 -3.01040617
32 -5.28315642 -1.53168607
33 0.80917460 -5.28315642
34 -1.13120234 0.80917460
35 1.81316904 -1.13120234
36 -2.13617011 1.81316904
37 -0.37058270 -2.13617011
38 2.45125060 -0.37058270
39 -0.12873544 2.45125060
40 0.63516712 -0.12873544
41 1.94922738 0.63516712
42 0.44267394 1.94922738
43 3.40916305 0.44267394
44 0.29072380 3.40916305
45 -1.19105402 0.29072380
46 -2.88985465 -1.19105402
47 2.76203402 -2.88985465
48 -2.99875975 2.76203402
49 2.96801246 -2.99875975
50 1.00686804 2.96801246
51 1.23106385 1.00686804
52 1.47328119 1.23106385
53 -1.58013581 1.47328119
54 -2.32656089 -1.58013581
55 0.36111263 -2.32656089
56 -2.41940255 0.36111263
57 1.02800407 -2.41940255
58 1.04741558 1.02800407
59 -0.19178252 1.04741558
60 0.41018722 -0.19178252
61 1.43855731 0.41018722
62 2.50216053 1.43855731
63 4.04805675 2.50216053
64 -0.40573157 4.04805675
65 0.26515225 -0.40573157
66 -3.56835580 0.26515225
67 -2.07566932 -3.56835580
68 0.17230865 -2.07566932
69 0.98149488 0.17230865
70 0.68470412 0.98149488
71 -2.58229262 0.68470412
72 -0.43772154 -2.58229262
73 2.14247976 -0.43772154
74 -1.56972584 2.14247976
75 -2.43613807 -1.56972584
76 -0.85733037 -2.43613807
77 1.92459471 -0.85733037
78 -1.69884313 1.92459471
79 3.25369282 -1.69884313
> 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/78cfw1290528234.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/88cfw1290528234.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/9jmez1290528234.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/10jmez1290528234.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/114mvn1290528234.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/1285ca1290528234.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/13worm1290528234.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/14067s1290528234.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/15lp6y1290528234.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/167p441290528234.tab")
+ }
> try(system("convert tmp/1u30n1290528234.ps tmp/1u30n1290528234.png",intern=TRUE))
character(0)
> try(system("convert tmp/2nczq1290528234.ps tmp/2nczq1290528234.png",intern=TRUE))
character(0)
> try(system("convert tmp/3nczq1290528234.ps tmp/3nczq1290528234.png",intern=TRUE))
character(0)
> try(system("convert tmp/4nczq1290528234.ps tmp/4nczq1290528234.png",intern=TRUE))
character(0)
> try(system("convert tmp/5x3gb1290528234.ps tmp/5x3gb1290528234.png",intern=TRUE))
character(0)
> try(system("convert tmp/6x3gb1290528234.ps tmp/6x3gb1290528234.png",intern=TRUE))
character(0)
> try(system("convert tmp/78cfw1290528234.ps tmp/78cfw1290528234.png",intern=TRUE))
character(0)
> try(system("convert tmp/88cfw1290528234.ps tmp/88cfw1290528234.png",intern=TRUE))
character(0)
> try(system("convert tmp/9jmez1290528234.ps tmp/9jmez1290528234.png",intern=TRUE))
character(0)
> try(system("convert tmp/10jmez1290528234.ps tmp/10jmez1290528234.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
2.753 1.687 13.818