R version 2.8.0 (2008-10-20)
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.
Natural language support but running in an English locale
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(14
+ ,12
+ ,53
+ ,18
+ ,11
+ ,86
+ ,11
+ ,14
+ ,66
+ ,12
+ ,12
+ ,67
+ ,16
+ ,21
+ ,76
+ ,18
+ ,12
+ ,78
+ ,14
+ ,22
+ ,53
+ ,14
+ ,11
+ ,80
+ ,15
+ ,10
+ ,74
+ ,15
+ ,13
+ ,76
+ ,17
+ ,10
+ ,79
+ ,19
+ ,8
+ ,54
+ ,10
+ ,15
+ ,67
+ ,16
+ ,14
+ ,54
+ ,18
+ ,10
+ ,87
+ ,14
+ ,14
+ ,58
+ ,14
+ ,14
+ ,75
+ ,17
+ ,11
+ ,88
+ ,14
+ ,10
+ ,64
+ ,16
+ ,13
+ ,57
+ ,18
+ ,7
+ ,66
+ ,11
+ ,14
+ ,68
+ ,14
+ ,12
+ ,54
+ ,12
+ ,14
+ ,56
+ ,17
+ ,11
+ ,86
+ ,9
+ ,9
+ ,80
+ ,16
+ ,11
+ ,76
+ ,14
+ ,15
+ ,69
+ ,15
+ ,14
+ ,78
+ ,11
+ ,13
+ ,67
+ ,16
+ ,9
+ ,80
+ ,13
+ ,15
+ ,54
+ ,17
+ ,10
+ ,71
+ ,15
+ ,11
+ ,84
+ ,14
+ ,13
+ ,74
+ ,16
+ ,8
+ ,71
+ ,9
+ ,20
+ ,63
+ ,15
+ ,12
+ ,71
+ ,17
+ ,10
+ ,76
+ ,13
+ ,10
+ ,69
+ ,15
+ ,9
+ ,74
+ ,16
+ ,14
+ ,75
+ ,16
+ ,8
+ ,54
+ ,12
+ ,14
+ ,52
+ ,12
+ ,11
+ ,69
+ ,11
+ ,13
+ ,68
+ ,15
+ ,9
+ ,65
+ ,15
+ ,11
+ ,75
+ ,17
+ ,15
+ ,74
+ ,13
+ ,11
+ ,75
+ ,16
+ ,10
+ ,72
+ ,14
+ ,14
+ ,67
+ ,11
+ ,18
+ ,63
+ ,12
+ ,14
+ ,62
+ ,12
+ ,11
+ ,63
+ ,15
+ ,12
+ ,76
+ ,16
+ ,13
+ ,74
+ ,15
+ ,9
+ ,67
+ ,12
+ ,10
+ ,73
+ ,12
+ ,15
+ ,70
+ ,8
+ ,20
+ ,53
+ ,13
+ ,12
+ ,77
+ ,11
+ ,12
+ ,77
+ ,14
+ ,14
+ ,52
+ ,15
+ ,13
+ ,54
+ ,10
+ ,11
+ ,80
+ ,11
+ ,17
+ ,66
+ ,12
+ ,12
+ ,73
+ ,15
+ ,13
+ ,63
+ ,15
+ ,14
+ ,69
+ ,14
+ ,13
+ ,67
+ ,16
+ ,15
+ ,54
+ ,15
+ ,13
+ ,81
+ ,15
+ ,10
+ ,69
+ ,13
+ ,11
+ ,84
+ ,12
+ ,19
+ ,80
+ ,17
+ ,13
+ ,70
+ ,13
+ ,17
+ ,69
+ ,15
+ ,13
+ ,77
+ ,13
+ ,9
+ ,54
+ ,15
+ ,11
+ ,79
+ ,16
+ ,10
+ ,30
+ ,15
+ ,9
+ ,71
+ ,16
+ ,12
+ ,73
+ ,15
+ ,12
+ ,72
+ ,14
+ ,13
+ ,77
+ ,15
+ ,13
+ ,75
+ ,14
+ ,12
+ ,69
+ ,13
+ ,15
+ ,54
+ ,7
+ ,22
+ ,70
+ ,17
+ ,13
+ ,73
+ ,13
+ ,15
+ ,54
+ ,15
+ ,13
+ ,77
+ ,14
+ ,15
+ ,82
+ ,13
+ ,10
+ ,80
+ ,16
+ ,11
+ ,80
+ ,12
+ ,16
+ ,69
+ ,14
+ ,11
+ ,78
+ ,17
+ ,11
+ ,81
+ ,15
+ ,10
+ ,76
+ ,17
+ ,10
+ ,76
+ ,12
+ ,16
+ ,73
+ ,16
+ ,12
+ ,85
+ ,11
+ ,11
+ ,66
+ ,15
+ ,16
+ ,79
+ ,9
+ ,19
+ ,68
+ ,16
+ ,11
+ ,76
+ ,15
+ ,16
+ ,71
+ ,10
+ ,15
+ ,54
+ ,10
+ ,24
+ ,46
+ ,15
+ ,14
+ ,82
+ ,11
+ ,15
+ ,74
+ ,13
+ ,11
+ ,88
+ ,14
+ ,15
+ ,38
+ ,18
+ ,12
+ ,76
+ ,16
+ ,10
+ ,86
+ ,14
+ ,14
+ ,54
+ ,14
+ ,13
+ ,70
+ ,14
+ ,9
+ ,69
+ ,14
+ ,15
+ ,90
+ ,12
+ ,15
+ ,54
+ ,14
+ ,14
+ ,76
+ ,15
+ ,11
+ ,89
+ ,15
+ ,8
+ ,76
+ ,15
+ ,11
+ ,73
+ ,13
+ ,11
+ ,79
+ ,17
+ ,8
+ ,90
+ ,17
+ ,10
+ ,74
+ ,19
+ ,11
+ ,81
+ ,15
+ ,13
+ ,72
+ ,13
+ ,11
+ ,71
+ ,9
+ ,20
+ ,66
+ ,15
+ ,10
+ ,77
+ ,15
+ ,15
+ ,65
+ ,15
+ ,12
+ ,74
+ ,16
+ ,14
+ ,82
+ ,11
+ ,23
+ ,54
+ ,14
+ ,14
+ ,63
+ ,11
+ ,16
+ ,54
+ ,15
+ ,11
+ ,64
+ ,13
+ ,12
+ ,69
+ ,15
+ ,10
+ ,54
+ ,16
+ ,14
+ ,84
+ ,14
+ ,12
+ ,86
+ ,15
+ ,12
+ ,77
+ ,16
+ ,11
+ ,89
+ ,16
+ ,12
+ ,76
+ ,11
+ ,13
+ ,60
+ ,12
+ ,11
+ ,75
+ ,9
+ ,19
+ ,73
+ ,16
+ ,12
+ ,85
+ ,13
+ ,17
+ ,79
+ ,16
+ ,9
+ ,71
+ ,12
+ ,12
+ ,72
+ ,9
+ ,19
+ ,69
+ ,13
+ ,18
+ ,78
+ ,13
+ ,15
+ ,54
+ ,14
+ ,14
+ ,69
+ ,19
+ ,11
+ ,81
+ ,13
+ ,9
+ ,84
+ ,12
+ ,18
+ ,84
+ ,13
+ ,16
+ ,69)
+ ,dim=c(3
+ ,162)
+ ,dimnames=list(c('Happiness'
+ ,'Depression'
+ ,'Belonging')
+ ,1:162))
> y <- array(NA,dim=c(3,162),dimnames=list(c('Happiness','Depression','Belonging'),1:162))
> 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 = 'Include Monthly Dummies'
> par1 = '3'
> #'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
Belonging Happiness Depression M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 M11
1 53 14 12 1 0 0 0 0 0 0 0 0 0 0
2 86 18 11 0 1 0 0 0 0 0 0 0 0 0
3 66 11 14 0 0 1 0 0 0 0 0 0 0 0
4 67 12 12 0 0 0 1 0 0 0 0 0 0 0
5 76 16 21 0 0 0 0 1 0 0 0 0 0 0
6 78 18 12 0 0 0 0 0 1 0 0 0 0 0
7 53 14 22 0 0 0 0 0 0 1 0 0 0 0
8 80 14 11 0 0 0 0 0 0 0 1 0 0 0
9 74 15 10 0 0 0 0 0 0 0 0 1 0 0
10 76 15 13 0 0 0 0 0 0 0 0 0 1 0
11 79 17 10 0 0 0 0 0 0 0 0 0 0 1
12 54 19 8 0 0 0 0 0 0 0 0 0 0 0
13 67 10 15 1 0 0 0 0 0 0 0 0 0 0
14 54 16 14 0 1 0 0 0 0 0 0 0 0 0
15 87 18 10 0 0 1 0 0 0 0 0 0 0 0
16 58 14 14 0 0 0 1 0 0 0 0 0 0 0
17 75 14 14 0 0 0 0 1 0 0 0 0 0 0
18 88 17 11 0 0 0 0 0 1 0 0 0 0 0
19 64 14 10 0 0 0 0 0 0 1 0 0 0 0
20 57 16 13 0 0 0 0 0 0 0 1 0 0 0
21 66 18 7 0 0 0 0 0 0 0 0 1 0 0
22 68 11 14 0 0 0 0 0 0 0 0 0 1 0
23 54 14 12 0 0 0 0 0 0 0 0 0 0 1
24 56 12 14 0 0 0 0 0 0 0 0 0 0 0
25 86 17 11 1 0 0 0 0 0 0 0 0 0 0
26 80 9 9 0 1 0 0 0 0 0 0 0 0 0
27 76 16 11 0 0 1 0 0 0 0 0 0 0 0
28 69 14 15 0 0 0 1 0 0 0 0 0 0 0
29 78 15 14 0 0 0 0 1 0 0 0 0 0 0
30 67 11 13 0 0 0 0 0 1 0 0 0 0 0
31 80 16 9 0 0 0 0 0 0 1 0 0 0 0
32 54 13 15 0 0 0 0 0 0 0 1 0 0 0
33 71 17 10 0 0 0 0 0 0 0 0 1 0 0
34 84 15 11 0 0 0 0 0 0 0 0 0 1 0
35 74 14 13 0 0 0 0 0 0 0 0 0 0 1
36 71 16 8 0 0 0 0 0 0 0 0 0 0 0
37 63 9 20 1 0 0 0 0 0 0 0 0 0 0
38 71 15 12 0 1 0 0 0 0 0 0 0 0 0
39 76 17 10 0 0 1 0 0 0 0 0 0 0 0
40 69 13 10 0 0 0 1 0 0 0 0 0 0 0
41 74 15 9 0 0 0 0 1 0 0 0 0 0 0
42 75 16 14 0 0 0 0 0 1 0 0 0 0 0
43 54 16 8 0 0 0 0 0 0 1 0 0 0 0
44 52 12 14 0 0 0 0 0 0 0 1 0 0 0
45 69 12 11 0 0 0 0 0 0 0 0 1 0 0
46 68 11 13 0 0 0 0 0 0 0 0 0 1 0
47 65 15 9 0 0 0 0 0 0 0 0 0 0 1
48 75 15 11 0 0 0 0 0 0 0 0 0 0 0
49 74 17 15 1 0 0 0 0 0 0 0 0 0 0
50 75 13 11 0 1 0 0 0 0 0 0 0 0 0
51 72 16 10 0 0 1 0 0 0 0 0 0 0 0
52 67 14 14 0 0 0 1 0 0 0 0 0 0 0
53 63 11 18 0 0 0 0 1 0 0 0 0 0 0
54 62 12 14 0 0 0 0 0 1 0 0 0 0 0
55 63 12 11 0 0 0 0 0 0 1 0 0 0 0
56 76 15 12 0 0 0 0 0 0 0 1 0 0 0
57 74 16 13 0 0 0 0 0 0 0 0 1 0 0
58 67 15 9 0 0 0 0 0 0 0 0 0 1 0
59 73 12 10 0 0 0 0 0 0 0 0 0 0 1
60 70 12 15 0 0 0 0 0 0 0 0 0 0 0
61 53 8 20 1 0 0 0 0 0 0 0 0 0 0
62 77 13 12 0 1 0 0 0 0 0 0 0 0 0
63 77 11 12 0 0 1 0 0 0 0 0 0 0 0
64 52 14 14 0 0 0 1 0 0 0 0 0 0 0
65 54 15 13 0 0 0 0 1 0 0 0 0 0 0
66 80 10 11 0 0 0 0 0 1 0 0 0 0 0
67 66 11 17 0 0 0 0 0 0 1 0 0 0 0
68 73 12 12 0 0 0 0 0 0 0 1 0 0 0
69 63 15 13 0 0 0 0 0 0 0 0 1 0 0
70 69 15 14 0 0 0 0 0 0 0 0 0 1 0
71 67 14 13 0 0 0 0 0 0 0 0 0 0 1
72 54 16 15 0 0 0 0 0 0 0 0 0 0 0
73 81 15 13 1 0 0 0 0 0 0 0 0 0 0
74 69 15 10 0 1 0 0 0 0 0 0 0 0 0
75 84 13 11 0 0 1 0 0 0 0 0 0 0 0
76 80 12 19 0 0 0 1 0 0 0 0 0 0 0
77 70 17 13 0 0 0 0 1 0 0 0 0 0 0
78 69 13 17 0 0 0 0 0 1 0 0 0 0 0
79 77 15 13 0 0 0 0 0 0 1 0 0 0 0
80 54 13 9 0 0 0 0 0 0 0 1 0 0 0
81 79 15 11 0 0 0 0 0 0 0 0 1 0 0
82 30 16 10 0 0 0 0 0 0 0 0 0 1 0
83 71 15 9 0 0 0 0 0 0 0 0 0 0 1
84 73 16 12 0 0 0 0 0 0 0 0 0 0 0
85 72 15 12 1 0 0 0 0 0 0 0 0 0 0
86 77 14 13 0 1 0 0 0 0 0 0 0 0 0
87 75 15 13 0 0 1 0 0 0 0 0 0 0 0
88 69 14 12 0 0 0 1 0 0 0 0 0 0 0
89 54 13 15 0 0 0 0 1 0 0 0 0 0 0
90 70 7 22 0 0 0 0 0 1 0 0 0 0 0
91 73 17 13 0 0 0 0 0 0 1 0 0 0 0
92 54 13 15 0 0 0 0 0 0 0 1 0 0 0
93 77 15 13 0 0 0 0 0 0 0 0 1 0 0
94 82 14 15 0 0 0 0 0 0 0 0 0 1 0
95 80 13 10 0 0 0 0 0 0 0 0 0 0 1
96 80 16 11 0 0 0 0 0 0 0 0 0 0 0
97 69 12 16 1 0 0 0 0 0 0 0 0 0 0
98 78 14 11 0 1 0 0 0 0 0 0 0 0 0
99 81 17 11 0 0 1 0 0 0 0 0 0 0 0
100 76 15 10 0 0 0 1 0 0 0 0 0 0 0
101 76 17 10 0 0 0 0 1 0 0 0 0 0 0
102 73 12 16 0 0 0 0 0 1 0 0 0 0 0
103 85 16 12 0 0 0 0 0 0 1 0 0 0 0
104 66 11 11 0 0 0 0 0 0 0 1 0 0 0
105 79 15 16 0 0 0 0 0 0 0 0 1 0 0
106 68 9 19 0 0 0 0 0 0 0 0 0 1 0
107 76 16 11 0 0 0 0 0 0 0 0 0 0 1
108 71 15 16 0 0 0 0 0 0 0 0 0 0 0
109 54 10 15 1 0 0 0 0 0 0 0 0 0 0
110 46 10 24 0 1 0 0 0 0 0 0 0 0 0
111 82 15 14 0 0 1 0 0 0 0 0 0 0 0
112 74 11 15 0 0 0 1 0 0 0 0 0 0 0
113 88 13 11 0 0 0 0 1 0 0 0 0 0 0
114 38 14 15 0 0 0 0 0 1 0 0 0 0 0
115 76 18 12 0 0 0 0 0 0 1 0 0 0 0
116 86 16 10 0 0 0 0 0 0 0 1 0 0 0
117 54 14 14 0 0 0 0 0 0 0 0 1 0 0
118 70 14 13 0 0 0 0 0 0 0 0 0 1 0
119 69 14 9 0 0 0 0 0 0 0 0 0 0 1
120 90 14 15 0 0 0 0 0 0 0 0 0 0 0
121 54 12 15 1 0 0 0 0 0 0 0 0 0 0
122 76 14 14 0 1 0 0 0 0 0 0 0 0 0
123 89 15 11 0 0 1 0 0 0 0 0 0 0 0
124 76 15 8 0 0 0 1 0 0 0 0 0 0 0
125 73 15 11 0 0 0 0 1 0 0 0 0 0 0
126 79 13 11 0 0 0 0 0 1 0 0 0 0 0
127 90 17 8 0 0 0 0 0 0 1 0 0 0 0
128 74 17 10 0 0 0 0 0 0 0 1 0 0 0
129 81 19 11 0 0 0 0 0 0 0 0 1 0 0
130 72 15 13 0 0 0 0 0 0 0 0 0 1 0
131 71 13 11 0 0 0 0 0 0 0 0 0 0 1
132 66 9 20 0 0 0 0 0 0 0 0 0 0 0
133 77 15 10 1 0 0 0 0 0 0 0 0 0 0
134 65 15 15 0 1 0 0 0 0 0 0 0 0 0
135 74 15 12 0 0 1 0 0 0 0 0 0 0 0
136 82 16 14 0 0 0 1 0 0 0 0 0 0 0
137 54 11 23 0 0 0 0 1 0 0 0 0 0 0
138 63 14 14 0 0 0 0 0 1 0 0 0 0 0
139 54 11 16 0 0 0 0 0 0 1 0 0 0 0
140 64 15 11 0 0 0 0 0 0 0 1 0 0 0
141 69 13 12 0 0 0 0 0 0 0 0 1 0 0
142 54 15 10 0 0 0 0 0 0 0 0 0 1 0
143 84 16 14 0 0 0 0 0 0 0 0 0 0 1
144 86 14 12 0 0 0 0 0 0 0 0 0 0 0
145 77 15 12 1 0 0 0 0 0 0 0 0 0 0
146 89 16 11 0 1 0 0 0 0 0 0 0 0 0
147 76 16 12 0 0 1 0 0 0 0 0 0 0 0
148 60 11 13 0 0 0 1 0 0 0 0 0 0 0
149 75 12 11 0 0 0 0 1 0 0 0 0 0 0
150 73 9 19 0 0 0 0 0 1 0 0 0 0 0
151 85 16 12 0 0 0 0 0 0 1 0 0 0 0
152 79 13 17 0 0 0 0 0 0 0 1 0 0 0
153 71 16 9 0 0 0 0 0 0 0 0 1 0 0
154 72 12 12 0 0 0 0 0 0 0 0 0 1 0
155 69 9 19 0 0 0 0 0 0 0 0 0 0 1
156 78 13 18 0 0 0 0 0 0 0 0 0 0 0
157 54 13 15 1 0 0 0 0 0 0 0 0 0 0
158 69 14 14 0 1 0 0 0 0 0 0 0 0 0
159 81 19 11 0 0 1 0 0 0 0 0 0 0 0
160 84 13 9 0 0 0 1 0 0 0 0 0 0 0
161 84 12 18 0 0 0 0 1 0 0 0 0 0 0
162 69 13 16 0 0 0 0 0 1 0 0 0 0 0
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Happiness Depression M1 M2 M3
68.6906 0.7387 -0.6121 -2.7917 1.1667 5.3863
M4 M5 M6 M7 M8 M9
-0.5701 0.7554 1.1129 -1.2136 -4.5392 -1.6850
M10 M11
-3.2401 -0.2776
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-41.149 -4.588 1.770 6.381 20.149
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 68.6906 9.6529 7.116 4.44e-11 ***
Happiness 0.7387 0.4322 1.709 0.0895 .
Depression -0.6121 0.3192 -1.917 0.0571 .
M1 -2.7917 3.9940 -0.699 0.4857
M2 1.1667 3.9721 0.294 0.7694
M3 5.3863 3.9951 1.348 0.1797
M4 -0.5701 4.0002 -0.143 0.8869
M5 0.7554 3.9687 0.190 0.8493
M6 1.1129 4.0048 0.278 0.7815
M7 -1.2136 4.0420 -0.300 0.7644
M8 -4.5392 4.0684 -1.116 0.2663
M9 -1.6850 4.0692 -0.414 0.6794
M10 -3.2401 4.0631 -0.797 0.4265
M11 -0.2776 4.0968 -0.068 0.9461
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 10.28 on 148 degrees of freedom
Multiple R-squared: 0.1544, Adjusted R-squared: 0.08018
F-statistic: 2.08 on 13 and 148 DF, p-value: 0.01847
> 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.90867730 0.18264539 0.0913227
[2,] 0.86231263 0.27537474 0.1376874
[3,] 0.78298010 0.43403980 0.2170199
[4,] 0.84751646 0.30496708 0.1524835
[5,] 0.82381912 0.35236176 0.1761809
[6,] 0.75745262 0.48509476 0.2425474
[7,] 0.81031467 0.37937067 0.1896853
[8,] 0.80202528 0.39594944 0.1979747
[9,] 0.85797653 0.28404695 0.1420235
[10,] 0.83960213 0.32079574 0.1603979
[11,] 0.78710805 0.42578390 0.2128920
[12,] 0.75039283 0.49921434 0.2496072
[13,] 0.69036491 0.61927017 0.3096351
[14,] 0.65614903 0.68770193 0.3438510
[15,] 0.62111795 0.75776410 0.3788821
[16,] 0.58541210 0.82917580 0.4145879
[17,] 0.51903038 0.96193925 0.4809696
[18,] 0.48777668 0.97555337 0.5122233
[19,] 0.47454040 0.94908081 0.5254596
[20,] 0.45409705 0.90819410 0.5459030
[21,] 0.42752639 0.85505278 0.5724736
[22,] 0.36609499 0.73218998 0.6339050
[23,] 0.31577754 0.63155508 0.6842225
[24,] 0.26275805 0.52551610 0.7372419
[25,] 0.26239820 0.52479640 0.7376018
[26,] 0.21498445 0.42996891 0.7850155
[27,] 0.32857119 0.65714238 0.6714288
[28,] 0.32090653 0.64181307 0.6790935
[29,] 0.27591173 0.55182345 0.7240883
[30,] 0.23933954 0.47867909 0.7606605
[31,] 0.21757390 0.43514780 0.7824261
[32,] 0.24475577 0.48951153 0.7552442
[33,] 0.20813423 0.41626846 0.7918658
[34,] 0.17212543 0.34425085 0.8278746
[35,] 0.15200977 0.30401953 0.8479902
[36,] 0.12327553 0.24655105 0.8767245
[37,] 0.10297961 0.20595922 0.8970204
[38,] 0.09820133 0.19640265 0.9017987
[39,] 0.08427652 0.16855304 0.9157235
[40,] 0.08796685 0.17593370 0.9120332
[41,] 0.07391605 0.14783209 0.9260840
[42,] 0.07367184 0.14734367 0.9263282
[43,] 0.06200536 0.12401073 0.9379946
[44,] 0.06374103 0.12748207 0.9362590
[45,] 0.05398276 0.10796552 0.9460172
[46,] 0.04382426 0.08764852 0.9561757
[47,] 0.03580285 0.07160570 0.9641972
[48,] 0.05307835 0.10615670 0.9469216
[49,] 0.10560600 0.21121200 0.8943940
[50,] 0.09881427 0.19762854 0.9011857
[51,] 0.09029713 0.18059427 0.9097029
[52,] 0.08317973 0.16635946 0.9168203
[53,] 0.07207917 0.14415834 0.9279208
[54,] 0.05787013 0.11574027 0.9421299
[55,] 0.04623307 0.09246615 0.9537669
[56,] 0.06505398 0.13010797 0.9349460
[57,] 0.07123736 0.14247471 0.9287626
[58,] 0.06134693 0.12269387 0.9386531
[59,] 0.05558611 0.11117222 0.9444139
[60,] 0.09192873 0.18385746 0.9080713
[61,] 0.07564854 0.15129708 0.9243515
[62,] 0.06012375 0.12024749 0.9398763
[63,] 0.05895305 0.11790611 0.9410469
[64,] 0.07645167 0.15290333 0.9235483
[65,] 0.07028750 0.14057500 0.9297125
[66,] 0.68225077 0.63549846 0.3177492
[67,] 0.65108799 0.69782401 0.3489120
[68,] 0.64498420 0.71003159 0.3550158
[69,] 0.60237041 0.79525917 0.3976296
[70,] 0.56333824 0.87332353 0.4366618
[71,] 0.51726066 0.96547868 0.4827393
[72,] 0.47757546 0.95515092 0.5224245
[73,] 0.56230877 0.87538245 0.4376912
[74,] 0.57711209 0.84577583 0.4228879
[75,] 0.54273148 0.91453704 0.4572685
[76,] 0.56373098 0.87253803 0.4362690
[77,] 0.53722957 0.92554085 0.4627704
[78,] 0.59864753 0.80270494 0.4013525
[79,] 0.57638901 0.84722198 0.4236110
[80,] 0.57169751 0.85660499 0.4283025
[81,] 0.54523127 0.90953746 0.4547687
[82,] 0.50272413 0.99455174 0.4972759
[83,] 0.45396220 0.90792440 0.5460378
[84,] 0.41422635 0.82845270 0.5857737
[85,] 0.38672783 0.77345565 0.6132722
[86,] 0.36535756 0.73071512 0.6346424
[87,] 0.37929262 0.75858524 0.6207074
[88,] 0.34204628 0.68409256 0.6579537
[89,] 0.37092421 0.74184843 0.6290758
[90,] 0.38427037 0.76854073 0.6157296
[91,] 0.34106087 0.68212174 0.6589391
[92,] 0.33794925 0.67589850 0.6620507
[93,] 0.31601433 0.63202867 0.6839857
[94,] 0.34942030 0.69884061 0.6505797
[95,] 0.31542594 0.63085188 0.6845741
[96,] 0.28853461 0.57706921 0.7114654
[97,] 0.31184197 0.62368393 0.6881580
[98,] 0.80032639 0.39934722 0.1996736
[99,] 0.77239889 0.45520221 0.2276011
[100,] 0.78662220 0.42675560 0.2133778
[101,] 0.81135044 0.37729912 0.1886496
[102,] 0.77463525 0.45072950 0.2253647
[103,] 0.77137412 0.45725177 0.2286259
[104,] 0.79251601 0.41496798 0.2074840
[105,] 0.78205508 0.43588984 0.2179449
[106,] 0.73934631 0.52130738 0.2606537
[107,] 0.76364876 0.47270249 0.2363512
[108,] 0.72055205 0.55889590 0.2794480
[109,] 0.69442188 0.61115623 0.3055781
[110,] 0.64422241 0.71155517 0.3557776
[111,] 0.63154707 0.73690586 0.3684529
[112,] 0.57939765 0.84120470 0.4206023
[113,] 0.51577402 0.96845197 0.4842260
[114,] 0.46696683 0.93393366 0.5330332
[115,] 0.44461746 0.88923492 0.5553825
[116,] 0.37981017 0.75962034 0.6201898
[117,] 0.32578944 0.65157888 0.6742106
[118,] 0.30590576 0.61181153 0.6940942
[119,] 0.24014285 0.48028570 0.7598571
[120,] 0.20272924 0.40545848 0.7972708
[121,] 0.25780729 0.51561457 0.7421927
[122,] 0.26378271 0.52756541 0.7362173
[123,] 0.32528195 0.65056391 0.6747180
[124,] 0.38510395 0.77020789 0.6148961
[125,] 0.29337950 0.58675900 0.7066205
[126,] 0.47792033 0.95584067 0.5220797
[127,] 0.37987328 0.75974656 0.6201267
[128,] 0.26547957 0.53095915 0.7345204
[129,] 0.26022406 0.52044813 0.7397759
> postscript(file="/var/www/html/freestat/rcomp/tmp/1krjf1290559253.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/freestat/rcomp/tmp/2krjf1290559253.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/freestat/rcomp/tmp/3krjf1290559253.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/freestat/rcomp/tmp/4d1001290559253.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/freestat/rcomp/tmp/5d1001290559253.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 = 162
Frequency = 1
1 2 3 4 5
-15.895690658 9.579147229 -7.633491642 -2.639932917 7.588490349
6 7 8 9 10
2.244987228 -11.353123238 12.239811121 2.034779064 7.426147074
11 12 13 14 15
4.150008362 -23.829037797 2.895230869 -19.107295750 5.747475901
16 17 18 19 20
-11.893169079 3.781405653 12.371605309 -7.697893299 -11.013425041
21 22 23 24 25
-10.017460210 2.992940257 -17.409816536 -12.985876997 14.276198412
26 27 28 29 30
9.003159161 -3.163095422 -0.281104907 6.042723400 -2.972172831
31 32 33 34 35
6.212678024 -10.573249939 -2.442585442 14.202018731 3.202247636
36 37 38 39 40
-4.612991039 2.694233980 -2.592741841 -4.513841846 -2.602743513
41 42 43 44 45
-1.017597458 1.946480077 -20.399386148 -12.446631858 -0.137110006
46 47 48 49 50
2.380876085 -8.984691304 1.961883729 4.724455099 2.272558493
51 52 53 54 55
-7.775159593 -2.893169079 -3.554290902 -8.098790912 -6.608464622
56 57 58 59 60
8.113193040 3.132289326 -4.022109613 1.843419626 1.626187175
61 62 63 64 65
-6.567083767 4.884622665 2.142380014 -17.893169079 -18.569340772
66 67 68 69 70
9.542381079 0.802602662 7.329239799 -7.129028421 1.038211246
71 72 73 74 75
-3.797752364 -17.328541837 11.977691261 -5.816870184 7.052951337
76 77 78 79 80
14.644516285 -4.046705277 -0.001280649 6.399616963 -14.245634969
81 82 83 84 85
7.646843236 -41.148727694 -2.984691304 -0.164734352 2.365627090
86 87 88 89 90
4.758004584 -2.200284825 -2.117297422 -15.867847922 8.491133726
91 92 93 94 95
0.922252458 -10.573249939 6.870971579 15.388957670 8.104737373
96 97 98 99 100
6.223201477 4.029930535 4.533876240 1.098222326 2.919891981
101 102 103 104 105
0.117102208 4.125337432 13.048870539 0.455857880 10.707164094
106 107 108 109 110
7.530625621 2.500754786 1.022204588 -10.104769131 -16.554560516
111 112 113 114 115
5.411779346 6.934941851 15.683895391 -32.964091246 2.571506033
116 117 118 119 120
16.150382444 -14.778281996 2.164829327 -4.246009051 20.148822669
121 122 123 124 125
-11.582133637 4.370068755 10.575586831 1.695763638 -0.793469115
126 127 128 129 130
6.326334320 14.861931599 3.411700191 6.692114224 3.426147074
131 132 133 134 135
-0.283198455 2.902554792 6.141498746 -6.756549326 -3.812348997
136 137 138 139 140
10.629466416 -9.493970043 -8.576155417 -11.809461510 -4.498871132
141 142 143 144 145
-0.263728087 -16.410045441 12.336947302 14.312630154 7.365627090
146 147 148 149 150
14.056511735 -2.551031250 -8.289186492 3.422577643 8.177576705
151 152 153 154 155
13.048870539 15.650878404 -2.315967361 5.030129661 5.568043930
156 157 158 159 160
10.723697437 -12.320815890 -2.629931245 -0.379142180 11.785192315
161 162
16.707026845 -0.613344821
> postscript(file="/var/www/html/freestat/rcomp/tmp/6d1001290559253.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 = 162
Frequency = 1
lag(myerror, k = 1) myerror
0 -15.895690658 NA
1 9.579147229 -15.895690658
2 -7.633491642 9.579147229
3 -2.639932917 -7.633491642
4 7.588490349 -2.639932917
5 2.244987228 7.588490349
6 -11.353123238 2.244987228
7 12.239811121 -11.353123238
8 2.034779064 12.239811121
9 7.426147074 2.034779064
10 4.150008362 7.426147074
11 -23.829037797 4.150008362
12 2.895230869 -23.829037797
13 -19.107295750 2.895230869
14 5.747475901 -19.107295750
15 -11.893169079 5.747475901
16 3.781405653 -11.893169079
17 12.371605309 3.781405653
18 -7.697893299 12.371605309
19 -11.013425041 -7.697893299
20 -10.017460210 -11.013425041
21 2.992940257 -10.017460210
22 -17.409816536 2.992940257
23 -12.985876997 -17.409816536
24 14.276198412 -12.985876997
25 9.003159161 14.276198412
26 -3.163095422 9.003159161
27 -0.281104907 -3.163095422
28 6.042723400 -0.281104907
29 -2.972172831 6.042723400
30 6.212678024 -2.972172831
31 -10.573249939 6.212678024
32 -2.442585442 -10.573249939
33 14.202018731 -2.442585442
34 3.202247636 14.202018731
35 -4.612991039 3.202247636
36 2.694233980 -4.612991039
37 -2.592741841 2.694233980
38 -4.513841846 -2.592741841
39 -2.602743513 -4.513841846
40 -1.017597458 -2.602743513
41 1.946480077 -1.017597458
42 -20.399386148 1.946480077
43 -12.446631858 -20.399386148
44 -0.137110006 -12.446631858
45 2.380876085 -0.137110006
46 -8.984691304 2.380876085
47 1.961883729 -8.984691304
48 4.724455099 1.961883729
49 2.272558493 4.724455099
50 -7.775159593 2.272558493
51 -2.893169079 -7.775159593
52 -3.554290902 -2.893169079
53 -8.098790912 -3.554290902
54 -6.608464622 -8.098790912
55 8.113193040 -6.608464622
56 3.132289326 8.113193040
57 -4.022109613 3.132289326
58 1.843419626 -4.022109613
59 1.626187175 1.843419626
60 -6.567083767 1.626187175
61 4.884622665 -6.567083767
62 2.142380014 4.884622665
63 -17.893169079 2.142380014
64 -18.569340772 -17.893169079
65 9.542381079 -18.569340772
66 0.802602662 9.542381079
67 7.329239799 0.802602662
68 -7.129028421 7.329239799
69 1.038211246 -7.129028421
70 -3.797752364 1.038211246
71 -17.328541837 -3.797752364
72 11.977691261 -17.328541837
73 -5.816870184 11.977691261
74 7.052951337 -5.816870184
75 14.644516285 7.052951337
76 -4.046705277 14.644516285
77 -0.001280649 -4.046705277
78 6.399616963 -0.001280649
79 -14.245634969 6.399616963
80 7.646843236 -14.245634969
81 -41.148727694 7.646843236
82 -2.984691304 -41.148727694
83 -0.164734352 -2.984691304
84 2.365627090 -0.164734352
85 4.758004584 2.365627090
86 -2.200284825 4.758004584
87 -2.117297422 -2.200284825
88 -15.867847922 -2.117297422
89 8.491133726 -15.867847922
90 0.922252458 8.491133726
91 -10.573249939 0.922252458
92 6.870971579 -10.573249939
93 15.388957670 6.870971579
94 8.104737373 15.388957670
95 6.223201477 8.104737373
96 4.029930535 6.223201477
97 4.533876240 4.029930535
98 1.098222326 4.533876240
99 2.919891981 1.098222326
100 0.117102208 2.919891981
101 4.125337432 0.117102208
102 13.048870539 4.125337432
103 0.455857880 13.048870539
104 10.707164094 0.455857880
105 7.530625621 10.707164094
106 2.500754786 7.530625621
107 1.022204588 2.500754786
108 -10.104769131 1.022204588
109 -16.554560516 -10.104769131
110 5.411779346 -16.554560516
111 6.934941851 5.411779346
112 15.683895391 6.934941851
113 -32.964091246 15.683895391
114 2.571506033 -32.964091246
115 16.150382444 2.571506033
116 -14.778281996 16.150382444
117 2.164829327 -14.778281996
118 -4.246009051 2.164829327
119 20.148822669 -4.246009051
120 -11.582133637 20.148822669
121 4.370068755 -11.582133637
122 10.575586831 4.370068755
123 1.695763638 10.575586831
124 -0.793469115 1.695763638
125 6.326334320 -0.793469115
126 14.861931599 6.326334320
127 3.411700191 14.861931599
128 6.692114224 3.411700191
129 3.426147074 6.692114224
130 -0.283198455 3.426147074
131 2.902554792 -0.283198455
132 6.141498746 2.902554792
133 -6.756549326 6.141498746
134 -3.812348997 -6.756549326
135 10.629466416 -3.812348997
136 -9.493970043 10.629466416
137 -8.576155417 -9.493970043
138 -11.809461510 -8.576155417
139 -4.498871132 -11.809461510
140 -0.263728087 -4.498871132
141 -16.410045441 -0.263728087
142 12.336947302 -16.410045441
143 14.312630154 12.336947302
144 7.365627090 14.312630154
145 14.056511735 7.365627090
146 -2.551031250 14.056511735
147 -8.289186492 -2.551031250
148 3.422577643 -8.289186492
149 8.177576705 3.422577643
150 13.048870539 8.177576705
151 15.650878404 13.048870539
152 -2.315967361 15.650878404
153 5.030129661 -2.315967361
154 5.568043930 5.030129661
155 10.723697437 5.568043930
156 -12.320815890 10.723697437
157 -2.629931245 -12.320815890
158 -0.379142180 -2.629931245
159 11.785192315 -0.379142180
160 16.707026845 11.785192315
161 -0.613344821 16.707026845
162 NA -0.613344821
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 9.579147229 -15.895690658
[2,] -7.633491642 9.579147229
[3,] -2.639932917 -7.633491642
[4,] 7.588490349 -2.639932917
[5,] 2.244987228 7.588490349
[6,] -11.353123238 2.244987228
[7,] 12.239811121 -11.353123238
[8,] 2.034779064 12.239811121
[9,] 7.426147074 2.034779064
[10,] 4.150008362 7.426147074
[11,] -23.829037797 4.150008362
[12,] 2.895230869 -23.829037797
[13,] -19.107295750 2.895230869
[14,] 5.747475901 -19.107295750
[15,] -11.893169079 5.747475901
[16,] 3.781405653 -11.893169079
[17,] 12.371605309 3.781405653
[18,] -7.697893299 12.371605309
[19,] -11.013425041 -7.697893299
[20,] -10.017460210 -11.013425041
[21,] 2.992940257 -10.017460210
[22,] -17.409816536 2.992940257
[23,] -12.985876997 -17.409816536
[24,] 14.276198412 -12.985876997
[25,] 9.003159161 14.276198412
[26,] -3.163095422 9.003159161
[27,] -0.281104907 -3.163095422
[28,] 6.042723400 -0.281104907
[29,] -2.972172831 6.042723400
[30,] 6.212678024 -2.972172831
[31,] -10.573249939 6.212678024
[32,] -2.442585442 -10.573249939
[33,] 14.202018731 -2.442585442
[34,] 3.202247636 14.202018731
[35,] -4.612991039 3.202247636
[36,] 2.694233980 -4.612991039
[37,] -2.592741841 2.694233980
[38,] -4.513841846 -2.592741841
[39,] -2.602743513 -4.513841846
[40,] -1.017597458 -2.602743513
[41,] 1.946480077 -1.017597458
[42,] -20.399386148 1.946480077
[43,] -12.446631858 -20.399386148
[44,] -0.137110006 -12.446631858
[45,] 2.380876085 -0.137110006
[46,] -8.984691304 2.380876085
[47,] 1.961883729 -8.984691304
[48,] 4.724455099 1.961883729
[49,] 2.272558493 4.724455099
[50,] -7.775159593 2.272558493
[51,] -2.893169079 -7.775159593
[52,] -3.554290902 -2.893169079
[53,] -8.098790912 -3.554290902
[54,] -6.608464622 -8.098790912
[55,] 8.113193040 -6.608464622
[56,] 3.132289326 8.113193040
[57,] -4.022109613 3.132289326
[58,] 1.843419626 -4.022109613
[59,] 1.626187175 1.843419626
[60,] -6.567083767 1.626187175
[61,] 4.884622665 -6.567083767
[62,] 2.142380014 4.884622665
[63,] -17.893169079 2.142380014
[64,] -18.569340772 -17.893169079
[65,] 9.542381079 -18.569340772
[66,] 0.802602662 9.542381079
[67,] 7.329239799 0.802602662
[68,] -7.129028421 7.329239799
[69,] 1.038211246 -7.129028421
[70,] -3.797752364 1.038211246
[71,] -17.328541837 -3.797752364
[72,] 11.977691261 -17.328541837
[73,] -5.816870184 11.977691261
[74,] 7.052951337 -5.816870184
[75,] 14.644516285 7.052951337
[76,] -4.046705277 14.644516285
[77,] -0.001280649 -4.046705277
[78,] 6.399616963 -0.001280649
[79,] -14.245634969 6.399616963
[80,] 7.646843236 -14.245634969
[81,] -41.148727694 7.646843236
[82,] -2.984691304 -41.148727694
[83,] -0.164734352 -2.984691304
[84,] 2.365627090 -0.164734352
[85,] 4.758004584 2.365627090
[86,] -2.200284825 4.758004584
[87,] -2.117297422 -2.200284825
[88,] -15.867847922 -2.117297422
[89,] 8.491133726 -15.867847922
[90,] 0.922252458 8.491133726
[91,] -10.573249939 0.922252458
[92,] 6.870971579 -10.573249939
[93,] 15.388957670 6.870971579
[94,] 8.104737373 15.388957670
[95,] 6.223201477 8.104737373
[96,] 4.029930535 6.223201477
[97,] 4.533876240 4.029930535
[98,] 1.098222326 4.533876240
[99,] 2.919891981 1.098222326
[100,] 0.117102208 2.919891981
[101,] 4.125337432 0.117102208
[102,] 13.048870539 4.125337432
[103,] 0.455857880 13.048870539
[104,] 10.707164094 0.455857880
[105,] 7.530625621 10.707164094
[106,] 2.500754786 7.530625621
[107,] 1.022204588 2.500754786
[108,] -10.104769131 1.022204588
[109,] -16.554560516 -10.104769131
[110,] 5.411779346 -16.554560516
[111,] 6.934941851 5.411779346
[112,] 15.683895391 6.934941851
[113,] -32.964091246 15.683895391
[114,] 2.571506033 -32.964091246
[115,] 16.150382444 2.571506033
[116,] -14.778281996 16.150382444
[117,] 2.164829327 -14.778281996
[118,] -4.246009051 2.164829327
[119,] 20.148822669 -4.246009051
[120,] -11.582133637 20.148822669
[121,] 4.370068755 -11.582133637
[122,] 10.575586831 4.370068755
[123,] 1.695763638 10.575586831
[124,] -0.793469115 1.695763638
[125,] 6.326334320 -0.793469115
[126,] 14.861931599 6.326334320
[127,] 3.411700191 14.861931599
[128,] 6.692114224 3.411700191
[129,] 3.426147074 6.692114224
[130,] -0.283198455 3.426147074
[131,] 2.902554792 -0.283198455
[132,] 6.141498746 2.902554792
[133,] -6.756549326 6.141498746
[134,] -3.812348997 -6.756549326
[135,] 10.629466416 -3.812348997
[136,] -9.493970043 10.629466416
[137,] -8.576155417 -9.493970043
[138,] -11.809461510 -8.576155417
[139,] -4.498871132 -11.809461510
[140,] -0.263728087 -4.498871132
[141,] -16.410045441 -0.263728087
[142,] 12.336947302 -16.410045441
[143,] 14.312630154 12.336947302
[144,] 7.365627090 14.312630154
[145,] 14.056511735 7.365627090
[146,] -2.551031250 14.056511735
[147,] -8.289186492 -2.551031250
[148,] 3.422577643 -8.289186492
[149,] 8.177576705 3.422577643
[150,] 13.048870539 8.177576705
[151,] 15.650878404 13.048870539
[152,] -2.315967361 15.650878404
[153,] 5.030129661 -2.315967361
[154,] 5.568043930 5.030129661
[155,] 10.723697437 5.568043930
[156,] -12.320815890 10.723697437
[157,] -2.629931245 -12.320815890
[158,] -0.379142180 -2.629931245
[159,] 11.785192315 -0.379142180
[160,] 16.707026845 11.785192315
[161,] -0.613344821 16.707026845
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 9.579147229 -15.895690658
2 -7.633491642 9.579147229
3 -2.639932917 -7.633491642
4 7.588490349 -2.639932917
5 2.244987228 7.588490349
6 -11.353123238 2.244987228
7 12.239811121 -11.353123238
8 2.034779064 12.239811121
9 7.426147074 2.034779064
10 4.150008362 7.426147074
11 -23.829037797 4.150008362
12 2.895230869 -23.829037797
13 -19.107295750 2.895230869
14 5.747475901 -19.107295750
15 -11.893169079 5.747475901
16 3.781405653 -11.893169079
17 12.371605309 3.781405653
18 -7.697893299 12.371605309
19 -11.013425041 -7.697893299
20 -10.017460210 -11.013425041
21 2.992940257 -10.017460210
22 -17.409816536 2.992940257
23 -12.985876997 -17.409816536
24 14.276198412 -12.985876997
25 9.003159161 14.276198412
26 -3.163095422 9.003159161
27 -0.281104907 -3.163095422
28 6.042723400 -0.281104907
29 -2.972172831 6.042723400
30 6.212678024 -2.972172831
31 -10.573249939 6.212678024
32 -2.442585442 -10.573249939
33 14.202018731 -2.442585442
34 3.202247636 14.202018731
35 -4.612991039 3.202247636
36 2.694233980 -4.612991039
37 -2.592741841 2.694233980
38 -4.513841846 -2.592741841
39 -2.602743513 -4.513841846
40 -1.017597458 -2.602743513
41 1.946480077 -1.017597458
42 -20.399386148 1.946480077
43 -12.446631858 -20.399386148
44 -0.137110006 -12.446631858
45 2.380876085 -0.137110006
46 -8.984691304 2.380876085
47 1.961883729 -8.984691304
48 4.724455099 1.961883729
49 2.272558493 4.724455099
50 -7.775159593 2.272558493
51 -2.893169079 -7.775159593
52 -3.554290902 -2.893169079
53 -8.098790912 -3.554290902
54 -6.608464622 -8.098790912
55 8.113193040 -6.608464622
56 3.132289326 8.113193040
57 -4.022109613 3.132289326
58 1.843419626 -4.022109613
59 1.626187175 1.843419626
60 -6.567083767 1.626187175
61 4.884622665 -6.567083767
62 2.142380014 4.884622665
63 -17.893169079 2.142380014
64 -18.569340772 -17.893169079
65 9.542381079 -18.569340772
66 0.802602662 9.542381079
67 7.329239799 0.802602662
68 -7.129028421 7.329239799
69 1.038211246 -7.129028421
70 -3.797752364 1.038211246
71 -17.328541837 -3.797752364
72 11.977691261 -17.328541837
73 -5.816870184 11.977691261
74 7.052951337 -5.816870184
75 14.644516285 7.052951337
76 -4.046705277 14.644516285
77 -0.001280649 -4.046705277
78 6.399616963 -0.001280649
79 -14.245634969 6.399616963
80 7.646843236 -14.245634969
81 -41.148727694 7.646843236
82 -2.984691304 -41.148727694
83 -0.164734352 -2.984691304
84 2.365627090 -0.164734352
85 4.758004584 2.365627090
86 -2.200284825 4.758004584
87 -2.117297422 -2.200284825
88 -15.867847922 -2.117297422
89 8.491133726 -15.867847922
90 0.922252458 8.491133726
91 -10.573249939 0.922252458
92 6.870971579 -10.573249939
93 15.388957670 6.870971579
94 8.104737373 15.388957670
95 6.223201477 8.104737373
96 4.029930535 6.223201477
97 4.533876240 4.029930535
98 1.098222326 4.533876240
99 2.919891981 1.098222326
100 0.117102208 2.919891981
101 4.125337432 0.117102208
102 13.048870539 4.125337432
103 0.455857880 13.048870539
104 10.707164094 0.455857880
105 7.530625621 10.707164094
106 2.500754786 7.530625621
107 1.022204588 2.500754786
108 -10.104769131 1.022204588
109 -16.554560516 -10.104769131
110 5.411779346 -16.554560516
111 6.934941851 5.411779346
112 15.683895391 6.934941851
113 -32.964091246 15.683895391
114 2.571506033 -32.964091246
115 16.150382444 2.571506033
116 -14.778281996 16.150382444
117 2.164829327 -14.778281996
118 -4.246009051 2.164829327
119 20.148822669 -4.246009051
120 -11.582133637 20.148822669
121 4.370068755 -11.582133637
122 10.575586831 4.370068755
123 1.695763638 10.575586831
124 -0.793469115 1.695763638
125 6.326334320 -0.793469115
126 14.861931599 6.326334320
127 3.411700191 14.861931599
128 6.692114224 3.411700191
129 3.426147074 6.692114224
130 -0.283198455 3.426147074
131 2.902554792 -0.283198455
132 6.141498746 2.902554792
133 -6.756549326 6.141498746
134 -3.812348997 -6.756549326
135 10.629466416 -3.812348997
136 -9.493970043 10.629466416
137 -8.576155417 -9.493970043
138 -11.809461510 -8.576155417
139 -4.498871132 -11.809461510
140 -0.263728087 -4.498871132
141 -16.410045441 -0.263728087
142 12.336947302 -16.410045441
143 14.312630154 12.336947302
144 7.365627090 14.312630154
145 14.056511735 7.365627090
146 -2.551031250 14.056511735
147 -8.289186492 -2.551031250
148 3.422577643 -8.289186492
149 8.177576705 3.422577643
150 13.048870539 8.177576705
151 15.650878404 13.048870539
152 -2.315967361 15.650878404
153 5.030129661 -2.315967361
154 5.568043930 5.030129661
155 10.723697437 5.568043930
156 -12.320815890 10.723697437
157 -2.629931245 -12.320815890
158 -0.379142180 -2.629931245
159 11.785192315 -0.379142180
160 16.707026845 11.785192315
161 -0.613344821 16.707026845
> 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/freestat/rcomp/tmp/7nah31290559253.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/freestat/rcomp/tmp/8yjyo1290559253.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/freestat/rcomp/tmp/9yjyo1290559253.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/freestat/rcomp/tmp/10yjyo1290559253.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/freestat/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/html/freestat/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/freestat/rcomp/tmp/11cbwx1290559253.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/freestat/rcomp/tmp/12xtul1290559253.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/freestat/rcomp/tmp/13b3ab1290559253.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/freestat/rcomp/tmp/14fmrh1290559253.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/freestat/rcomp/tmp/158d821290559253.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/freestat/rcomp/tmp/1645ob1290559253.tab")
+ }
>
> try(system("convert tmp/1krjf1290559253.ps tmp/1krjf1290559253.png",intern=TRUE))
character(0)
> try(system("convert tmp/2krjf1290559253.ps tmp/2krjf1290559253.png",intern=TRUE))
character(0)
> try(system("convert tmp/3krjf1290559253.ps tmp/3krjf1290559253.png",intern=TRUE))
character(0)
> try(system("convert tmp/4d1001290559253.ps tmp/4d1001290559253.png",intern=TRUE))
character(0)
> try(system("convert tmp/5d1001290559253.ps tmp/5d1001290559253.png",intern=TRUE))
character(0)
> try(system("convert tmp/6d1001290559253.ps tmp/6d1001290559253.png",intern=TRUE))
character(0)
> try(system("convert tmp/7nah31290559253.ps tmp/7nah31290559253.png",intern=TRUE))
character(0)
> try(system("convert tmp/8yjyo1290559253.ps tmp/8yjyo1290559253.png",intern=TRUE))
character(0)
> try(system("convert tmp/9yjyo1290559253.ps tmp/9yjyo1290559253.png",intern=TRUE))
character(0)
> try(system("convert tmp/10yjyo1290559253.ps tmp/10yjyo1290559253.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
5.789 2.734 6.257