R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-pc-linux-gnu (32-bit)
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(13
+ ,14
+ ,12
+ ,16
+ ,18
+ ,11
+ ,19
+ ,11
+ ,14
+ ,15
+ ,12
+ ,12
+ ,14
+ ,16
+ ,21
+ ,13
+ ,18
+ ,12
+ ,19
+ ,14
+ ,22
+ ,15
+ ,14
+ ,11
+ ,14
+ ,15
+ ,10
+ ,15
+ ,15
+ ,13
+ ,16
+ ,17
+ ,10
+ ,16
+ ,19
+ ,8
+ ,16
+ ,10
+ ,15
+ ,16
+ ,16
+ ,14
+ ,17
+ ,18
+ ,10
+ ,15
+ ,14
+ ,14
+ ,15
+ ,14
+ ,14
+ ,20
+ ,17
+ ,11
+ ,18
+ ,14
+ ,10
+ ,16
+ ,16
+ ,13
+ ,16
+ ,18
+ ,7
+ ,16
+ ,11
+ ,14
+ ,19
+ ,14
+ ,12
+ ,16
+ ,12
+ ,14
+ ,17
+ ,17
+ ,11
+ ,17
+ ,9
+ ,9
+ ,16
+ ,16
+ ,11
+ ,15
+ ,14
+ ,15
+ ,16
+ ,15
+ ,14
+ ,14
+ ,11
+ ,13
+ ,15
+ ,16
+ ,9
+ ,12
+ ,13
+ ,15
+ ,14
+ ,17
+ ,10
+ ,16
+ ,15
+ ,11
+ ,14
+ ,14
+ ,13
+ ,7
+ ,16
+ ,8
+ ,10
+ ,9
+ ,20
+ ,14
+ ,15
+ ,12
+ ,16
+ ,17
+ ,10
+ ,16
+ ,13
+ ,10
+ ,16
+ ,15
+ ,9
+ ,14
+ ,16
+ ,14
+ ,20
+ ,16
+ ,8
+ ,14
+ ,12
+ ,14
+ ,14
+ ,12
+ ,11
+ ,11
+ ,11
+ ,13
+ ,14
+ ,15
+ ,9
+ ,15
+ ,15
+ ,11
+ ,16
+ ,17
+ ,15
+ ,14
+ ,13
+ ,11
+ ,16
+ ,16
+ ,10
+ ,14
+ ,14
+ ,14
+ ,12
+ ,11
+ ,18
+ ,16
+ ,12
+ ,14
+ ,9
+ ,12
+ ,11
+ ,14
+ ,15
+ ,12
+ ,16
+ ,16
+ ,13
+ ,16
+ ,15
+ ,9
+ ,15
+ ,12
+ ,10
+ ,16
+ ,12
+ ,15
+ ,12
+ ,8
+ ,20
+ ,16
+ ,13
+ ,12
+ ,16
+ ,11
+ ,12
+ ,14
+ ,14
+ ,14
+ ,16
+ ,15
+ ,13
+ ,17
+ ,10
+ ,11
+ ,18
+ ,11
+ ,17
+ ,18
+ ,12
+ ,12
+ ,12
+ ,15
+ ,13
+ ,16
+ ,15
+ ,14
+ ,10
+ ,14
+ ,13
+ ,14
+ ,16
+ ,15
+ ,18
+ ,15
+ ,13
+ ,18
+ ,15
+ ,10
+ ,16
+ ,13
+ ,11
+ ,17
+ ,12
+ ,19
+ ,16
+ ,17
+ ,13
+ ,16
+ ,13
+ ,17
+ ,13
+ ,15
+ ,13
+ ,16
+ ,13
+ ,9
+ ,16
+ ,15
+ ,11
+ ,20
+ ,16
+ ,10
+ ,16
+ ,15
+ ,9
+ ,15
+ ,16
+ ,12
+ ,15
+ ,15
+ ,12
+ ,16
+ ,14
+ ,13
+ ,14
+ ,15
+ ,13
+ ,16
+ ,14
+ ,12
+ ,16
+ ,13
+ ,15
+ ,15
+ ,7
+ ,22
+ ,12
+ ,17
+ ,13
+ ,17
+ ,13
+ ,15
+ ,16
+ ,15
+ ,13
+ ,15
+ ,14
+ ,15
+ ,13
+ ,13
+ ,10
+ ,16
+ ,16
+ ,11
+ ,16
+ ,12
+ ,16
+ ,16
+ ,14
+ ,11
+ ,16
+ ,17
+ ,11
+ ,14
+ ,15
+ ,10
+ ,16
+ ,17
+ ,10
+ ,16
+ ,12
+ ,16
+ ,20
+ ,16
+ ,12
+ ,15
+ ,11
+ ,11
+ ,16
+ ,15
+ ,16
+ ,13
+ ,9
+ ,19
+ ,17
+ ,16
+ ,11
+ ,16
+ ,15
+ ,16
+ ,16
+ ,10
+ ,15
+ ,12
+ ,10
+ ,24
+ ,16
+ ,15
+ ,14
+ ,16
+ ,11
+ ,15
+ ,17
+ ,13
+ ,11
+ ,13
+ ,14
+ ,15
+ ,12
+ ,18
+ ,12
+ ,18
+ ,16
+ ,10
+ ,14
+ ,14
+ ,14
+ ,14
+ ,14
+ ,13
+ ,13
+ ,14
+ ,9
+ ,16
+ ,14
+ ,15
+ ,13
+ ,12
+ ,15
+ ,16
+ ,14
+ ,14
+ ,13
+ ,15
+ ,11
+ ,16
+ ,15
+ ,8
+ ,15
+ ,15
+ ,11
+ ,16
+ ,13
+ ,11
+ ,15
+ ,17
+ ,8
+ ,17
+ ,17
+ ,10
+ ,15
+ ,19
+ ,11
+ ,12
+ ,15
+ ,13
+ ,16
+ ,13
+ ,11
+ ,10
+ ,9
+ ,20
+ ,16
+ ,15
+ ,10
+ ,12
+ ,15
+ ,15
+ ,14
+ ,15
+ ,12
+ ,15
+ ,16
+ ,14
+ ,13
+ ,11
+ ,23
+ ,15
+ ,14
+ ,14
+ ,11
+ ,11
+ ,16
+ ,12
+ ,15
+ ,11
+ ,8
+ ,13
+ ,12
+ ,16
+ ,15
+ ,10
+ ,15
+ ,16
+ ,14
+ ,17
+ ,14
+ ,12
+ ,16
+ ,15
+ ,12
+ ,10
+ ,16
+ ,11
+ ,18
+ ,16
+ ,12
+ ,13
+ ,11
+ ,13
+ ,16
+ ,12
+ ,11
+ ,13
+ ,9
+ ,19
+ ,10
+ ,16
+ ,12
+ ,15
+ ,13
+ ,17
+ ,16
+ ,16
+ ,9
+ ,16
+ ,12
+ ,12
+ ,14
+ ,9
+ ,19
+ ,10
+ ,13
+ ,18
+ ,17
+ ,13
+ ,15
+ ,13
+ ,14
+ ,14
+ ,15
+ ,19
+ ,11
+ ,16
+ ,13
+ ,9
+ ,12
+ ,12
+ ,18
+ ,13
+ ,13
+ ,16)
+ ,dim=c(3
+ ,162)
+ ,dimnames=list(c('Learning'
+ ,'Happiness'
+ ,'Depression')
+ ,1:162))
> y <- array(NA,dim=c(3,162),dimnames=list(c('Learning','Happiness','Depression'),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 = 'Do not include Seasonal Dummies'
> par1 = '1'
> par3 <- 'No Linear Trend'
> par2 <- 'Do not include Seasonal Dummies'
> par1 <- '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Prof. Dr. P. Wessa
> #To cite this work: AUTHOR(S), (YEAR), YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication: Office for Research, Development, and Education
> #Technical description: Write here your technical program description (don't use hard returns!)
> library(lattice)
> library(lmtest)
Loading required package: zoo
Attaching package: 'zoo'
The following object(s) are masked from 'package:base':
as.Date, 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
Learning Happiness Depression
1 13 14 12
2 16 18 11
3 19 11 14
4 15 12 12
5 14 16 21
6 13 18 12
7 19 14 22
8 15 14 11
9 14 15 10
10 15 15 13
11 16 17 10
12 16 19 8
13 16 10 15
14 16 16 14
15 17 18 10
16 15 14 14
17 15 14 14
18 20 17 11
19 18 14 10
20 16 16 13
21 16 18 7
22 16 11 14
23 19 14 12
24 16 12 14
25 17 17 11
26 17 9 9
27 16 16 11
28 15 14 15
29 16 15 14
30 14 11 13
31 15 16 9
32 12 13 15
33 14 17 10
34 16 15 11
35 14 14 13
36 7 16 8
37 10 9 20
38 14 15 12
39 16 17 10
40 16 13 10
41 16 15 9
42 14 16 14
43 20 16 8
44 14 12 14
45 14 12 11
46 11 11 13
47 14 15 9
48 15 15 11
49 16 17 15
50 14 13 11
51 16 16 10
52 14 14 14
53 12 11 18
54 16 12 14
55 9 12 11
56 14 15 12
57 16 16 13
58 16 15 9
59 15 12 10
60 16 12 15
61 12 8 20
62 16 13 12
63 16 11 12
64 14 14 14
65 16 15 13
66 17 10 11
67 18 11 17
68 18 12 12
69 12 15 13
70 16 15 14
71 10 14 13
72 14 16 15
73 18 15 13
74 18 15 10
75 16 13 11
76 17 12 19
77 16 17 13
78 16 13 17
79 13 15 13
80 16 13 9
81 16 15 11
82 20 16 10
83 16 15 9
84 15 16 12
85 15 15 12
86 16 14 13
87 14 15 13
88 16 14 12
89 16 13 15
90 15 7 22
91 12 17 13
92 17 13 15
93 16 15 13
94 15 14 15
95 13 13 10
96 16 16 11
97 16 12 16
98 16 14 11
99 16 17 11
100 14 15 10
101 16 17 10
102 16 12 16
103 20 16 12
104 15 11 11
105 16 15 16
106 13 9 19
107 17 16 11
108 16 15 16
109 16 10 15
110 12 10 24
111 16 15 14
112 16 11 15
113 17 13 11
114 13 14 15
115 12 18 12
116 18 16 10
117 14 14 14
118 14 14 13
119 13 14 9
120 16 14 15
121 13 12 15
122 16 14 14
123 13 15 11
124 16 15 8
125 15 15 11
126 16 13 11
127 15 17 8
128 17 17 10
129 15 19 11
130 12 15 13
131 16 13 11
132 10 9 20
133 16 15 10
134 12 15 15
135 14 15 12
136 15 16 14
137 13 11 23
138 15 14 14
139 11 11 16
140 12 15 11
141 8 13 12
142 16 15 10
143 15 16 14
144 17 14 12
145 16 15 12
146 10 16 11
147 18 16 12
148 13 11 13
149 16 12 11
150 13 9 19
151 10 16 12
152 15 13 17
153 16 16 9
154 16 12 12
155 14 9 19
156 10 13 18
157 17 13 15
158 13 14 14
159 15 19 11
160 16 13 9
161 12 12 18
162 13 13 16
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Happiness Depression
15.61018 0.07712 -0.13484
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-8.7654 -1.1102 0.3983 1.1883 5.2766
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 15.61018 1.85184 8.430 1.97e-14 ***
Happiness 0.07712 0.08853 0.871 0.3850
Depression -0.13484 0.06536 -2.063 0.0407 *
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.203 on 159 degrees of freedom
Multiple R-squared: 0.05864, Adjusted R-squared: 0.0468
F-statistic: 4.953 on 2 and 159 DF, p-value: 0.008192
> 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.71919058 0.56161884 0.28080942
[2,] 0.75499113 0.49001774 0.24500887
[3,] 0.63404722 0.73190555 0.36595278
[4,] 0.51483545 0.97032910 0.48516455
[5,] 0.39492753 0.78985506 0.60507247
[6,] 0.39684640 0.79369280 0.60315360
[7,] 0.41407486 0.82814973 0.58592514
[8,] 0.32893288 0.65786577 0.67106712
[9,] 0.25385048 0.50770097 0.74614952
[10,] 0.25956317 0.51912635 0.74043683
[11,] 0.20098424 0.40196848 0.79901576
[12,] 0.15161651 0.30323303 0.84838349
[13,] 0.41444405 0.82888809 0.58555595
[14,] 0.42478445 0.84956891 0.57521555
[15,] 0.35381201 0.70762402 0.64618799
[16,] 0.28894140 0.57788280 0.71105860
[17,] 0.23251692 0.46503384 0.76748308
[18,] 0.30283476 0.60566951 0.69716524
[19,] 0.24867914 0.49735828 0.75132086
[20,] 0.21309627 0.42619254 0.78690373
[21,] 0.17345046 0.34690091 0.82654954
[22,] 0.13458232 0.26916464 0.86541768
[23,] 0.11065264 0.22130529 0.88934736
[24,] 0.08419390 0.16838781 0.91580610
[25,] 0.08723561 0.17447123 0.91276439
[26,] 0.06906816 0.13813632 0.93093184
[27,] 0.13409016 0.26818032 0.86590984
[28,] 0.12570628 0.25141255 0.87429372
[29,] 0.09817325 0.19634649 0.90182675
[30,] 0.08985140 0.17970281 0.91014860
[31,] 0.76788010 0.46423980 0.23211990
[32,] 0.90069653 0.19860693 0.09930347
[33,] 0.88373036 0.23253928 0.11626964
[34,] 0.85707697 0.28584607 0.14292303
[35,] 0.82865978 0.34268044 0.17134022
[36,] 0.79534954 0.40930093 0.20465046
[37,] 0.76871380 0.46257239 0.23128620
[38,] 0.85792719 0.28414561 0.14207281
[39,] 0.83375801 0.33248397 0.16624199
[40,] 0.81025562 0.37948877 0.18974438
[41,] 0.86768134 0.26463732 0.13231866
[42,] 0.85214354 0.29571292 0.14785646
[43,] 0.82226719 0.35546561 0.17773281
[44,] 0.79425636 0.41148727 0.20574364
[45,] 0.76696716 0.46606568 0.23303284
[46,] 0.72984580 0.54030840 0.27015420
[47,] 0.69629353 0.60741293 0.30370647
[48,] 0.69668898 0.60662203 0.30331102
[49,] 0.66818433 0.66363134 0.33181567
[50,] 0.87693414 0.24613172 0.12306586
[51,] 0.85835031 0.28329938 0.14164969
[52,] 0.83444615 0.33110770 0.16555385
[53,] 0.80560936 0.38878128 0.19439064
[54,] 0.77364355 0.45271290 0.22635645
[55,] 0.75251639 0.49496722 0.24748361
[56,] 0.73402017 0.53195967 0.26597983
[57,] 0.70337176 0.59325647 0.29662824
[58,] 0.67614438 0.64771124 0.32385562
[59,] 0.63993670 0.72012661 0.36006330
[60,] 0.60374350 0.79251300 0.39625650
[61,] 0.60308137 0.79383726 0.39691863
[62,] 0.68015924 0.63968152 0.31984076
[63,] 0.71444673 0.57110654 0.28555327
[64,] 0.74889853 0.50220294 0.25110147
[65,] 0.72017157 0.55965686 0.27982843
[66,] 0.85087067 0.29825865 0.14912933
[67,] 0.82750635 0.34498730 0.17249365
[68,] 0.84923038 0.30153924 0.15076962
[69,] 0.85810486 0.28379028 0.14189514
[70,] 0.83499375 0.33001249 0.16500625
[71,] 0.85706307 0.28587386 0.14293693
[72,] 0.83490051 0.33019898 0.16509949
[73,] 0.82353698 0.35292604 0.17646302
[74,] 0.81867948 0.36264104 0.18132052
[75,] 0.78939304 0.42121391 0.21060696
[76,] 0.75884071 0.48231858 0.24115929
[77,] 0.85809461 0.28381078 0.14190539
[78,] 0.83215654 0.33568691 0.16784346
[79,] 0.80276938 0.39446125 0.19723062
[80,] 0.77007874 0.45984251 0.22992126
[81,] 0.74360868 0.51278265 0.25639132
[82,] 0.71363749 0.57272502 0.28636251
[83,] 0.68157433 0.63685134 0.31842567
[84,] 0.65887452 0.68225096 0.34112548
[85,] 0.64787387 0.70425227 0.35212613
[86,] 0.68883691 0.62232618 0.31116309
[87,] 0.70200052 0.59599896 0.29799948
[88,] 0.67182943 0.65634114 0.32817057
[89,] 0.63276794 0.73446412 0.36723206
[90,] 0.63491509 0.73016981 0.36508491
[91,] 0.59573038 0.80853924 0.40426962
[92,] 0.58193384 0.83613232 0.41806616
[93,] 0.54326497 0.91347005 0.45673503
[94,] 0.50196326 0.99607348 0.49803674
[95,] 0.47295339 0.94590678 0.52704661
[96,] 0.42948808 0.85897615 0.57051192
[97,] 0.41700016 0.83400033 0.58299984
[98,] 0.61624823 0.76750354 0.38375177
[99,] 0.56999919 0.86000161 0.43000081
[100,] 0.56208235 0.87583531 0.43791765
[101,] 0.52195193 0.95609613 0.47804807
[102,] 0.51295785 0.97408430 0.48704215
[103,] 0.51218863 0.97562275 0.48781137
[104,] 0.49775112 0.99550225 0.50224888
[105,] 0.46941392 0.93882785 0.53058608
[106,] 0.45393274 0.90786547 0.54606726
[107,] 0.44611476 0.89222952 0.55388524
[108,] 0.44331117 0.88662235 0.55668883
[109,] 0.41147420 0.82294841 0.58852580
[110,] 0.45257282 0.90514563 0.54742718
[111,] 0.48830911 0.97661822 0.51169089
[112,] 0.44176308 0.88352616 0.55823692
[113,] 0.39625747 0.79251494 0.60374253
[114,] 0.40074483 0.80148965 0.59925517
[115,] 0.39774541 0.79549082 0.60225459
[116,] 0.36009450 0.72018900 0.63990550
[117,] 0.34898476 0.69796952 0.65101524
[118,] 0.33734741 0.67469482 0.66265259
[119,] 0.29102399 0.58204798 0.70897601
[120,] 0.24736877 0.49473755 0.75263123
[121,] 0.21835216 0.43670431 0.78164784
[122,] 0.18265199 0.36530397 0.81734801
[123,] 0.17364488 0.34728976 0.82635512
[124,] 0.14228877 0.28457755 0.85771123
[125,] 0.14583783 0.29167566 0.85416217
[126,] 0.12521399 0.25042799 0.87478601
[127,] 0.14331225 0.28662450 0.85668775
[128,] 0.12057201 0.24114403 0.87942799
[129,] 0.11343059 0.22686119 0.88656941
[130,] 0.08883967 0.17767934 0.91116033
[131,] 0.07074375 0.14148750 0.92925625
[132,] 0.05604531 0.11209062 0.94395469
[133,] 0.04381374 0.08762748 0.95618626
[134,] 0.04768478 0.09536956 0.95231522
[135,] 0.05241439 0.10482878 0.94758561
[136,] 0.37112672 0.74225344 0.62887328
[137,] 0.30986824 0.61973648 0.69013176
[138,] 0.27061006 0.54122013 0.72938994
[139,] 0.26879909 0.53759819 0.73120091
[140,] 0.23858159 0.47716318 0.76141841
[141,] 0.47745275 0.95490550 0.52254725
[142,] 0.63851787 0.72296426 0.36148213
[143,] 0.64784418 0.70431164 0.35215582
[144,] 0.55741434 0.88517132 0.44258566
[145,] 0.46517989 0.93035978 0.53482011
[146,] 0.77672928 0.44654143 0.22327072
[147,] 0.78189085 0.43621830 0.21810915
[148,] 0.67829053 0.64341894 0.32170947
[149,] 0.55153168 0.89693663 0.44846832
[150,] 0.47431486 0.94862972 0.52568514
[151,] 0.48937094 0.97874188 0.51062906
> postscript(file="/var/fisher/rcomp/tmp/1yyng1352148816.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/fisher/rcomp/tmp/2nrt51352148816.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/fisher/rcomp/tmp/3gxet1352148816.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/fisher/rcomp/tmp/486eg1352148816.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/fisher/rcomp/tmp/5ondk1352148816.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(mysum$resid, main='Residual Normal Q-Q Plot')
> qqline(mysum$resid)
> grid()
> dev.off()
null device
1
> (myerror <- as.ts(mysum$resid))
Time Series:
Start = 1
End = 162
Frequency = 1
1 2 3 4 5 6
-2.071781357 0.484893297 4.429263881 0.082460824 -0.012454694 -2.380265721
7 8 9 10 11 12
5.276628470 -0.206622340 -1.418584414 -0.014061465 0.427173405 0.003249257
13 14 15 16 17 18
1.641225954 1.043658427 1.350052314 0.197900608 0.197900608 4.562014387
19 20 21 22 23 24
2.658536677 0.908817444 -0.054470635 1.429263881 3.928218643 1.352142790
25 26 27 28 29 30
1.562014387 1.909301148 0.639135478 0.332741591 1.120779517 -0.705577102
31 32 33 34 35 36
-0.630546487 -2.590137318 -1.572826595 0.716256569 -0.936940375 -8.765387470
37 38 39 40 41 42
-3.607448041 -1.148902448 0.427173405 0.735657768 0.446574604 -0.956341573
43 44 45 46 47 48
4.234612530 -0.647857210 -1.052380158 -3.705577102 -1.553425396 -0.283743431
49 50 51 52 53 54
1.101378318 -1.129501249 0.504294495 -0.802099392 -2.031372188 1.352142790
55 56 57 58 59 60
-6.052380158 -1.148902448 0.908817444 0.446574604 -0.187221141 1.486983773
61 62 63 64 65 66
-1.530326950 1.005339733 1.159581915 -0.802099392 0.985938535 2.101862023
67 68 69 70 71 72
3.833786829 3.082460824 -3.014061465 1.120779517 -4.936940375 -0.821500591
73 74 75 76 77 78
2.985938535 2.581415586 0.870498751 3.026347704 0.831696353 1.679544647
79 80 81 82 83 84
-2.014061465 0.600816785 0.716256569 4.504294495 0.446574604 -0.226023539
85 86 87 88 89 90
-0.148902448 1.063059625 -1.014061465 0.928218643 1.409862682 1.816476106
91 92 93 94 95 96
-3.168303647 2.409862682 0.985938535 0.332741591 -2.264342232 0.639135478
97 98 99 100 101 102
1.621824755 0.793377660 0.562014387 -1.418584414 0.427173405 1.621824755
103 104 105 106 107 108
4.773976461 0.024740932 1.390461483 -0.742289024 1.639135478 1.390461483
109 110 111 112 113 114
1.641225954 -1.145205201 1.120779517 1.564104863 1.870498751 -1.667258409
115 116 117 118 119 120
-3.380265721 2.504294495 -0.802099392 -0.936940375 -2.476304306 1.332741591
121 122 123 124 125 126
-1.513016227 1.197900608 -2.283743431 0.311733621 -0.283743431 0.870498751
127 128 129 130 131 132
-0.842508561 1.427173405 -0.592227794 -3.014061465 0.870498751 -3.607448041
133 134 135 136 137 138
0.581415586 -2.744379500 -1.148902448 0.043658427 -0.357167274 0.197900608
139 140 141 142 143 144
-3.301054154 -3.283743431 -6.994660267 0.581415586 0.043658427 1.928218643
145 146 147 148 149 150
0.851097552 -5.360864522 2.773976461 -1.705577102 0.947619842 -0.742289024
151 152 153 154 155 156
-5.226023539 0.679544647 0.369453513 1.082460824 0.257710976 -4.185614370
157 158 159 160 161 162
2.409862682 -1.802099392 -0.592227794 0.600816785 -2.108493279 -1.455296335
> postscript(file="/var/fisher/rcomp/tmp/6dpne1352148816.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> dum <- cbind(lag(myerror,k=1),myerror)
> dum
Time Series:
Start = 0
End = 162
Frequency = 1
lag(myerror, k = 1) myerror
0 -2.071781357 NA
1 0.484893297 -2.071781357
2 4.429263881 0.484893297
3 0.082460824 4.429263881
4 -0.012454694 0.082460824
5 -2.380265721 -0.012454694
6 5.276628470 -2.380265721
7 -0.206622340 5.276628470
8 -1.418584414 -0.206622340
9 -0.014061465 -1.418584414
10 0.427173405 -0.014061465
11 0.003249257 0.427173405
12 1.641225954 0.003249257
13 1.043658427 1.641225954
14 1.350052314 1.043658427
15 0.197900608 1.350052314
16 0.197900608 0.197900608
17 4.562014387 0.197900608
18 2.658536677 4.562014387
19 0.908817444 2.658536677
20 -0.054470635 0.908817444
21 1.429263881 -0.054470635
22 3.928218643 1.429263881
23 1.352142790 3.928218643
24 1.562014387 1.352142790
25 1.909301148 1.562014387
26 0.639135478 1.909301148
27 0.332741591 0.639135478
28 1.120779517 0.332741591
29 -0.705577102 1.120779517
30 -0.630546487 -0.705577102
31 -2.590137318 -0.630546487
32 -1.572826595 -2.590137318
33 0.716256569 -1.572826595
34 -0.936940375 0.716256569
35 -8.765387470 -0.936940375
36 -3.607448041 -8.765387470
37 -1.148902448 -3.607448041
38 0.427173405 -1.148902448
39 0.735657768 0.427173405
40 0.446574604 0.735657768
41 -0.956341573 0.446574604
42 4.234612530 -0.956341573
43 -0.647857210 4.234612530
44 -1.052380158 -0.647857210
45 -3.705577102 -1.052380158
46 -1.553425396 -3.705577102
47 -0.283743431 -1.553425396
48 1.101378318 -0.283743431
49 -1.129501249 1.101378318
50 0.504294495 -1.129501249
51 -0.802099392 0.504294495
52 -2.031372188 -0.802099392
53 1.352142790 -2.031372188
54 -6.052380158 1.352142790
55 -1.148902448 -6.052380158
56 0.908817444 -1.148902448
57 0.446574604 0.908817444
58 -0.187221141 0.446574604
59 1.486983773 -0.187221141
60 -1.530326950 1.486983773
61 1.005339733 -1.530326950
62 1.159581915 1.005339733
63 -0.802099392 1.159581915
64 0.985938535 -0.802099392
65 2.101862023 0.985938535
66 3.833786829 2.101862023
67 3.082460824 3.833786829
68 -3.014061465 3.082460824
69 1.120779517 -3.014061465
70 -4.936940375 1.120779517
71 -0.821500591 -4.936940375
72 2.985938535 -0.821500591
73 2.581415586 2.985938535
74 0.870498751 2.581415586
75 3.026347704 0.870498751
76 0.831696353 3.026347704
77 1.679544647 0.831696353
78 -2.014061465 1.679544647
79 0.600816785 -2.014061465
80 0.716256569 0.600816785
81 4.504294495 0.716256569
82 0.446574604 4.504294495
83 -0.226023539 0.446574604
84 -0.148902448 -0.226023539
85 1.063059625 -0.148902448
86 -1.014061465 1.063059625
87 0.928218643 -1.014061465
88 1.409862682 0.928218643
89 1.816476106 1.409862682
90 -3.168303647 1.816476106
91 2.409862682 -3.168303647
92 0.985938535 2.409862682
93 0.332741591 0.985938535
94 -2.264342232 0.332741591
95 0.639135478 -2.264342232
96 1.621824755 0.639135478
97 0.793377660 1.621824755
98 0.562014387 0.793377660
99 -1.418584414 0.562014387
100 0.427173405 -1.418584414
101 1.621824755 0.427173405
102 4.773976461 1.621824755
103 0.024740932 4.773976461
104 1.390461483 0.024740932
105 -0.742289024 1.390461483
106 1.639135478 -0.742289024
107 1.390461483 1.639135478
108 1.641225954 1.390461483
109 -1.145205201 1.641225954
110 1.120779517 -1.145205201
111 1.564104863 1.120779517
112 1.870498751 1.564104863
113 -1.667258409 1.870498751
114 -3.380265721 -1.667258409
115 2.504294495 -3.380265721
116 -0.802099392 2.504294495
117 -0.936940375 -0.802099392
118 -2.476304306 -0.936940375
119 1.332741591 -2.476304306
120 -1.513016227 1.332741591
121 1.197900608 -1.513016227
122 -2.283743431 1.197900608
123 0.311733621 -2.283743431
124 -0.283743431 0.311733621
125 0.870498751 -0.283743431
126 -0.842508561 0.870498751
127 1.427173405 -0.842508561
128 -0.592227794 1.427173405
129 -3.014061465 -0.592227794
130 0.870498751 -3.014061465
131 -3.607448041 0.870498751
132 0.581415586 -3.607448041
133 -2.744379500 0.581415586
134 -1.148902448 -2.744379500
135 0.043658427 -1.148902448
136 -0.357167274 0.043658427
137 0.197900608 -0.357167274
138 -3.301054154 0.197900608
139 -3.283743431 -3.301054154
140 -6.994660267 -3.283743431
141 0.581415586 -6.994660267
142 0.043658427 0.581415586
143 1.928218643 0.043658427
144 0.851097552 1.928218643
145 -5.360864522 0.851097552
146 2.773976461 -5.360864522
147 -1.705577102 2.773976461
148 0.947619842 -1.705577102
149 -0.742289024 0.947619842
150 -5.226023539 -0.742289024
151 0.679544647 -5.226023539
152 0.369453513 0.679544647
153 1.082460824 0.369453513
154 0.257710976 1.082460824
155 -4.185614370 0.257710976
156 2.409862682 -4.185614370
157 -1.802099392 2.409862682
158 -0.592227794 -1.802099392
159 0.600816785 -0.592227794
160 -2.108493279 0.600816785
161 -1.455296335 -2.108493279
162 NA -1.455296335
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 0.484893297 -2.071781357
[2,] 4.429263881 0.484893297
[3,] 0.082460824 4.429263881
[4,] -0.012454694 0.082460824
[5,] -2.380265721 -0.012454694
[6,] 5.276628470 -2.380265721
[7,] -0.206622340 5.276628470
[8,] -1.418584414 -0.206622340
[9,] -0.014061465 -1.418584414
[10,] 0.427173405 -0.014061465
[11,] 0.003249257 0.427173405
[12,] 1.641225954 0.003249257
[13,] 1.043658427 1.641225954
[14,] 1.350052314 1.043658427
[15,] 0.197900608 1.350052314
[16,] 0.197900608 0.197900608
[17,] 4.562014387 0.197900608
[18,] 2.658536677 4.562014387
[19,] 0.908817444 2.658536677
[20,] -0.054470635 0.908817444
[21,] 1.429263881 -0.054470635
[22,] 3.928218643 1.429263881
[23,] 1.352142790 3.928218643
[24,] 1.562014387 1.352142790
[25,] 1.909301148 1.562014387
[26,] 0.639135478 1.909301148
[27,] 0.332741591 0.639135478
[28,] 1.120779517 0.332741591
[29,] -0.705577102 1.120779517
[30,] -0.630546487 -0.705577102
[31,] -2.590137318 -0.630546487
[32,] -1.572826595 -2.590137318
[33,] 0.716256569 -1.572826595
[34,] -0.936940375 0.716256569
[35,] -8.765387470 -0.936940375
[36,] -3.607448041 -8.765387470
[37,] -1.148902448 -3.607448041
[38,] 0.427173405 -1.148902448
[39,] 0.735657768 0.427173405
[40,] 0.446574604 0.735657768
[41,] -0.956341573 0.446574604
[42,] 4.234612530 -0.956341573
[43,] -0.647857210 4.234612530
[44,] -1.052380158 -0.647857210
[45,] -3.705577102 -1.052380158
[46,] -1.553425396 -3.705577102
[47,] -0.283743431 -1.553425396
[48,] 1.101378318 -0.283743431
[49,] -1.129501249 1.101378318
[50,] 0.504294495 -1.129501249
[51,] -0.802099392 0.504294495
[52,] -2.031372188 -0.802099392
[53,] 1.352142790 -2.031372188
[54,] -6.052380158 1.352142790
[55,] -1.148902448 -6.052380158
[56,] 0.908817444 -1.148902448
[57,] 0.446574604 0.908817444
[58,] -0.187221141 0.446574604
[59,] 1.486983773 -0.187221141
[60,] -1.530326950 1.486983773
[61,] 1.005339733 -1.530326950
[62,] 1.159581915 1.005339733
[63,] -0.802099392 1.159581915
[64,] 0.985938535 -0.802099392
[65,] 2.101862023 0.985938535
[66,] 3.833786829 2.101862023
[67,] 3.082460824 3.833786829
[68,] -3.014061465 3.082460824
[69,] 1.120779517 -3.014061465
[70,] -4.936940375 1.120779517
[71,] -0.821500591 -4.936940375
[72,] 2.985938535 -0.821500591
[73,] 2.581415586 2.985938535
[74,] 0.870498751 2.581415586
[75,] 3.026347704 0.870498751
[76,] 0.831696353 3.026347704
[77,] 1.679544647 0.831696353
[78,] -2.014061465 1.679544647
[79,] 0.600816785 -2.014061465
[80,] 0.716256569 0.600816785
[81,] 4.504294495 0.716256569
[82,] 0.446574604 4.504294495
[83,] -0.226023539 0.446574604
[84,] -0.148902448 -0.226023539
[85,] 1.063059625 -0.148902448
[86,] -1.014061465 1.063059625
[87,] 0.928218643 -1.014061465
[88,] 1.409862682 0.928218643
[89,] 1.816476106 1.409862682
[90,] -3.168303647 1.816476106
[91,] 2.409862682 -3.168303647
[92,] 0.985938535 2.409862682
[93,] 0.332741591 0.985938535
[94,] -2.264342232 0.332741591
[95,] 0.639135478 -2.264342232
[96,] 1.621824755 0.639135478
[97,] 0.793377660 1.621824755
[98,] 0.562014387 0.793377660
[99,] -1.418584414 0.562014387
[100,] 0.427173405 -1.418584414
[101,] 1.621824755 0.427173405
[102,] 4.773976461 1.621824755
[103,] 0.024740932 4.773976461
[104,] 1.390461483 0.024740932
[105,] -0.742289024 1.390461483
[106,] 1.639135478 -0.742289024
[107,] 1.390461483 1.639135478
[108,] 1.641225954 1.390461483
[109,] -1.145205201 1.641225954
[110,] 1.120779517 -1.145205201
[111,] 1.564104863 1.120779517
[112,] 1.870498751 1.564104863
[113,] -1.667258409 1.870498751
[114,] -3.380265721 -1.667258409
[115,] 2.504294495 -3.380265721
[116,] -0.802099392 2.504294495
[117,] -0.936940375 -0.802099392
[118,] -2.476304306 -0.936940375
[119,] 1.332741591 -2.476304306
[120,] -1.513016227 1.332741591
[121,] 1.197900608 -1.513016227
[122,] -2.283743431 1.197900608
[123,] 0.311733621 -2.283743431
[124,] -0.283743431 0.311733621
[125,] 0.870498751 -0.283743431
[126,] -0.842508561 0.870498751
[127,] 1.427173405 -0.842508561
[128,] -0.592227794 1.427173405
[129,] -3.014061465 -0.592227794
[130,] 0.870498751 -3.014061465
[131,] -3.607448041 0.870498751
[132,] 0.581415586 -3.607448041
[133,] -2.744379500 0.581415586
[134,] -1.148902448 -2.744379500
[135,] 0.043658427 -1.148902448
[136,] -0.357167274 0.043658427
[137,] 0.197900608 -0.357167274
[138,] -3.301054154 0.197900608
[139,] -3.283743431 -3.301054154
[140,] -6.994660267 -3.283743431
[141,] 0.581415586 -6.994660267
[142,] 0.043658427 0.581415586
[143,] 1.928218643 0.043658427
[144,] 0.851097552 1.928218643
[145,] -5.360864522 0.851097552
[146,] 2.773976461 -5.360864522
[147,] -1.705577102 2.773976461
[148,] 0.947619842 -1.705577102
[149,] -0.742289024 0.947619842
[150,] -5.226023539 -0.742289024
[151,] 0.679544647 -5.226023539
[152,] 0.369453513 0.679544647
[153,] 1.082460824 0.369453513
[154,] 0.257710976 1.082460824
[155,] -4.185614370 0.257710976
[156,] 2.409862682 -4.185614370
[157,] -1.802099392 2.409862682
[158,] -0.592227794 -1.802099392
[159,] 0.600816785 -0.592227794
[160,] -2.108493279 0.600816785
[161,] -1.455296335 -2.108493279
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 0.484893297 -2.071781357
2 4.429263881 0.484893297
3 0.082460824 4.429263881
4 -0.012454694 0.082460824
5 -2.380265721 -0.012454694
6 5.276628470 -2.380265721
7 -0.206622340 5.276628470
8 -1.418584414 -0.206622340
9 -0.014061465 -1.418584414
10 0.427173405 -0.014061465
11 0.003249257 0.427173405
12 1.641225954 0.003249257
13 1.043658427 1.641225954
14 1.350052314 1.043658427
15 0.197900608 1.350052314
16 0.197900608 0.197900608
17 4.562014387 0.197900608
18 2.658536677 4.562014387
19 0.908817444 2.658536677
20 -0.054470635 0.908817444
21 1.429263881 -0.054470635
22 3.928218643 1.429263881
23 1.352142790 3.928218643
24 1.562014387 1.352142790
25 1.909301148 1.562014387
26 0.639135478 1.909301148
27 0.332741591 0.639135478
28 1.120779517 0.332741591
29 -0.705577102 1.120779517
30 -0.630546487 -0.705577102
31 -2.590137318 -0.630546487
32 -1.572826595 -2.590137318
33 0.716256569 -1.572826595
34 -0.936940375 0.716256569
35 -8.765387470 -0.936940375
36 -3.607448041 -8.765387470
37 -1.148902448 -3.607448041
38 0.427173405 -1.148902448
39 0.735657768 0.427173405
40 0.446574604 0.735657768
41 -0.956341573 0.446574604
42 4.234612530 -0.956341573
43 -0.647857210 4.234612530
44 -1.052380158 -0.647857210
45 -3.705577102 -1.052380158
46 -1.553425396 -3.705577102
47 -0.283743431 -1.553425396
48 1.101378318 -0.283743431
49 -1.129501249 1.101378318
50 0.504294495 -1.129501249
51 -0.802099392 0.504294495
52 -2.031372188 -0.802099392
53 1.352142790 -2.031372188
54 -6.052380158 1.352142790
55 -1.148902448 -6.052380158
56 0.908817444 -1.148902448
57 0.446574604 0.908817444
58 -0.187221141 0.446574604
59 1.486983773 -0.187221141
60 -1.530326950 1.486983773
61 1.005339733 -1.530326950
62 1.159581915 1.005339733
63 -0.802099392 1.159581915
64 0.985938535 -0.802099392
65 2.101862023 0.985938535
66 3.833786829 2.101862023
67 3.082460824 3.833786829
68 -3.014061465 3.082460824
69 1.120779517 -3.014061465
70 -4.936940375 1.120779517
71 -0.821500591 -4.936940375
72 2.985938535 -0.821500591
73 2.581415586 2.985938535
74 0.870498751 2.581415586
75 3.026347704 0.870498751
76 0.831696353 3.026347704
77 1.679544647 0.831696353
78 -2.014061465 1.679544647
79 0.600816785 -2.014061465
80 0.716256569 0.600816785
81 4.504294495 0.716256569
82 0.446574604 4.504294495
83 -0.226023539 0.446574604
84 -0.148902448 -0.226023539
85 1.063059625 -0.148902448
86 -1.014061465 1.063059625
87 0.928218643 -1.014061465
88 1.409862682 0.928218643
89 1.816476106 1.409862682
90 -3.168303647 1.816476106
91 2.409862682 -3.168303647
92 0.985938535 2.409862682
93 0.332741591 0.985938535
94 -2.264342232 0.332741591
95 0.639135478 -2.264342232
96 1.621824755 0.639135478
97 0.793377660 1.621824755
98 0.562014387 0.793377660
99 -1.418584414 0.562014387
100 0.427173405 -1.418584414
101 1.621824755 0.427173405
102 4.773976461 1.621824755
103 0.024740932 4.773976461
104 1.390461483 0.024740932
105 -0.742289024 1.390461483
106 1.639135478 -0.742289024
107 1.390461483 1.639135478
108 1.641225954 1.390461483
109 -1.145205201 1.641225954
110 1.120779517 -1.145205201
111 1.564104863 1.120779517
112 1.870498751 1.564104863
113 -1.667258409 1.870498751
114 -3.380265721 -1.667258409
115 2.504294495 -3.380265721
116 -0.802099392 2.504294495
117 -0.936940375 -0.802099392
118 -2.476304306 -0.936940375
119 1.332741591 -2.476304306
120 -1.513016227 1.332741591
121 1.197900608 -1.513016227
122 -2.283743431 1.197900608
123 0.311733621 -2.283743431
124 -0.283743431 0.311733621
125 0.870498751 -0.283743431
126 -0.842508561 0.870498751
127 1.427173405 -0.842508561
128 -0.592227794 1.427173405
129 -3.014061465 -0.592227794
130 0.870498751 -3.014061465
131 -3.607448041 0.870498751
132 0.581415586 -3.607448041
133 -2.744379500 0.581415586
134 -1.148902448 -2.744379500
135 0.043658427 -1.148902448
136 -0.357167274 0.043658427
137 0.197900608 -0.357167274
138 -3.301054154 0.197900608
139 -3.283743431 -3.301054154
140 -6.994660267 -3.283743431
141 0.581415586 -6.994660267
142 0.043658427 0.581415586
143 1.928218643 0.043658427
144 0.851097552 1.928218643
145 -5.360864522 0.851097552
146 2.773976461 -5.360864522
147 -1.705577102 2.773976461
148 0.947619842 -1.705577102
149 -0.742289024 0.947619842
150 -5.226023539 -0.742289024
151 0.679544647 -5.226023539
152 0.369453513 0.679544647
153 1.082460824 0.369453513
154 0.257710976 1.082460824
155 -4.185614370 0.257710976
156 2.409862682 -4.185614370
157 -1.802099392 2.409862682
158 -0.592227794 -1.802099392
159 0.600816785 -0.592227794
160 -2.108493279 0.600816785
161 -1.455296335 -2.108493279
> 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/fisher/rcomp/tmp/7epnv1352148816.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/fisher/rcomp/tmp/8qwi51352148816.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/fisher/rcomp/tmp/93pxz1352148816.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/fisher/rcomp/tmp/102ooc1352148816.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/fisher/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/fisher/rcomp/tmp/11pmfq1352148816.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/fisher/rcomp/tmp/12wwdt1352148816.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/fisher/rcomp/tmp/134j3p1352148816.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/fisher/rcomp/tmp/14nv0x1352148816.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/fisher/rcomp/tmp/15u9471352148816.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/fisher/rcomp/tmp/16prsk1352148816.tab")
+ }
>
> try(system("convert tmp/1yyng1352148816.ps tmp/1yyng1352148816.png",intern=TRUE))
character(0)
> try(system("convert tmp/2nrt51352148816.ps tmp/2nrt51352148816.png",intern=TRUE))
character(0)
> try(system("convert tmp/3gxet1352148816.ps tmp/3gxet1352148816.png",intern=TRUE))
character(0)
> try(system("convert tmp/486eg1352148816.ps tmp/486eg1352148816.png",intern=TRUE))
character(0)
> try(system("convert tmp/5ondk1352148816.ps tmp/5ondk1352148816.png",intern=TRUE))
character(0)
> try(system("convert tmp/6dpne1352148816.ps tmp/6dpne1352148816.png",intern=TRUE))
character(0)
> try(system("convert tmp/7epnv1352148816.ps tmp/7epnv1352148816.png",intern=TRUE))
character(0)
> try(system("convert tmp/8qwi51352148816.ps tmp/8qwi51352148816.png",intern=TRUE))
character(0)
> try(system("convert tmp/93pxz1352148816.ps tmp/93pxz1352148816.png",intern=TRUE))
character(0)
> try(system("convert tmp/102ooc1352148816.ps tmp/102ooc1352148816.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
7.764 1.151 8.920