R version 2.12.0 (2010-10-15)
Copyright (C) 2010 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i486-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(2
+ ,1
+ ,2
+ ,1
+ ,2
+ ,3
+ ,1
+ ,1
+ ,3
+ ,1
+ ,2
+ ,1
+ ,2
+ ,1
+ ,2
+ ,3
+ ,2
+ ,4
+ ,2
+ ,1
+ ,1
+ ,2
+ ,1
+ ,3
+ ,1
+ ,2
+ ,3
+ ,3
+ ,3
+ ,2
+ ,1
+ ,1
+ ,2
+ ,2
+ ,2
+ ,1
+ ,2
+ ,4
+ ,1
+ ,3
+ ,3
+ ,2
+ ,3
+ ,1
+ ,1
+ ,2
+ ,1
+ ,1
+ ,2
+ ,1
+ ,2
+ ,2
+ ,1
+ ,2
+ ,2
+ ,2
+ ,2
+ ,2
+ ,2
+ ,2
+ ,2
+ ,1
+ ,1
+ ,1
+ ,3
+ ,2
+ ,1
+ ,1
+ ,1
+ ,1
+ ,1
+ ,3
+ ,4
+ ,2
+ ,2
+ ,3
+ ,1
+ ,2
+ ,2
+ ,1
+ ,2
+ ,3
+ ,2
+ ,3
+ ,2
+ ,1
+ ,2
+ ,2
+ ,1
+ ,1
+ ,3
+ ,1
+ ,1
+ ,3
+ ,2
+ ,3
+ ,3
+ ,1
+ ,2
+ ,1
+ ,3
+ ,2
+ ,1
+ ,1
+ ,2
+ ,1
+ ,3
+ ,1
+ ,1
+ ,1
+ ,2
+ ,2
+ ,1
+ ,2
+ ,2
+ ,2
+ ,1
+ ,1
+ ,4
+ ,3
+ ,1
+ ,1
+ ,1
+ ,1
+ ,2
+ ,3
+ ,2
+ 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'
+ ,'belong')
+ ,1:162))
> y <- array(NA,dim=c(6,162),dimnames=list(c('stress','depression','effort','focus','sleep','belong'),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'
> #'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
> 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
stress depression effort focus sleep belong
1 2 1 2 1 2 3
2 1 1 3 1 2 1
3 2 1 2 3 2 4
4 2 1 1 2 1 3
5 1 2 3 3 3 2
6 1 1 2 2 2 1
7 2 4 1 3 3 2
8 3 1 1 2 1 1
9 2 1 2 2 1 2
10 2 2 2 2 2 2
11 2 1 1 1 3 2
12 1 1 1 1 1 3
13 4 2 2 3 1 2
14 2 1 2 3 2 3
15 2 1 2 2 1 1
16 3 1 1 3 2 3
17 3 1 2 1 3 2
18 1 1 2 1 3 1
19 1 1 2 2 1 2
20 2 2 1 1 4 3
21 1 1 1 1 2 3
22 2 1 2 2 2 2
23 1 2 2 1 3 3
24 2 2 2 2 4 2
25 1 1 1 3 2 4
26 1 1 2 1 1 2
27 1 2 2 2 2 2
28 2 2 3 3 4 2
29 1 3 3 2 1 2
30 1 1 1 2 3 2
31 1 1 2 1 2 3
32 2 3 1 3 3 2
33 1 2 1 1 2 2
34 1 2 1 2 2 3
35 1 1 2 3 2 2
36 1 1 1 1 2 4
37 2 3 2 4 3 2
38 1 1 2 2 2 2
39 1 2 2 1 1 4
40 1 2 1 1 2 3
41 1 1 1 1 1 2
42 1 1 3 3 1 3
43 1 1 1 1 3 4
44 1 3 2 2 3 2
45 1 2 2 1 2 3
46 1 2 1 2 2 3
47 1 1 1 1 4 2
48 1 2 2 1 1 1
49 1 3 3 3 2 2
50 1 2 1 2 2 1
51 1 1 1 1 2 2
52 1 2 3 1 2 3
53 2 4 3 2 3 4
54 2 2 2 2 4 5
55 1 1 3 2 2 3
56 1 3 2 1 2 1
57 3 2 1 2 2 2
58 1 1 1 3 3 1
59 1 1 3 3 2 1
60 3 3 2 2 4 2
61 2 3 3 4 3 1
62 3 2 1 1 2 1
63 3 1 1 1 2 1
64 3 2 1 4 2 1
65 2 2 2 3 3 1
66 1 1 2 1 4 2
67 3 2 2 4 3 1
68 3 1 3 2 2 1
69 3 2 1 3 2 2
70 2 2 1 2 3 1
71 1 2 2 3 1 1
72 2 4 2 3 3 1
73 3 3 1 1 2 1
74 1 1 2 1 3 1
75 2 2 2 1 4 3
76 3 3 2 1 2 2
77 1 2 2 3 2 2
78 2 2 2 2 2 1
79 2 2 3 2 3 1
80 1 2 1 3 3 1
81 1 1 1 2 2 1
82 3 1 1 2 1 2
83 1 1 2 2 1 1
84 4 1 3 2 1 2
85 2 1 2 2 1 2
86 2 4 2 2 1 1
87 3 2 1 2 1 3
88 2 2 3 3 1 3
89 3 1 3 5 3 3
90 4 4 2 2 1 2
91 1 4 1 1 1 1
92 3 3 3 2 1 1
93 1 3 2 3 1 2
94 2 2 1 4 1 2
95 1 3 1 2 1 1
96 1 3 2 3 1 2
97 3 3 2 3 1 2
98 2 2 1 1 1 2
99 2 1 2 2 1 1
100 2 1 2 1 1 1
101 2 1 2 3 2 3
102 2 3 3 2 1 2
103 2 2 1 3 1 1
104 1 4 2 3 1 3
105 2 4 2 4 2 2
106 3 3 3 2 1 2
107 2 2 1 3 2 3
108 2 1 3 3 2 2
109 1 1 3 4 3 3
110 4 4 5 2 2 2
111 2 1 1 4 2 2
112 2 2 2 3 1 1
113 1 2 1 3 1 1
114 2 4 1 2 1 2
115 2 2 1 1 1 1
116 3 1 1 3 1 2
117 2 2 3 3 1 3
118 4 1 2 2 1 1
119 2 1 2 4 1 3
120 4 3 1 3 2 3
121 1 1 3 2 1 2
122 2 3 2 2 1 1
123 2 3 1 2 1 1
124 1 1 1 3 1 1
125 1 2 3 2 1 1
126 1 2 1 1 1 1
127 1 1 1 2 1 1
128 1 3 1 1 1 2
129 2 2 2 3 1 1
130 2 3 2 2 2 1
131 1 2 2 4 2 3
132 3 4 4 3 1 2
133 2 1 2 2 1 2
134 2 3 2 3 1 1
135 3 1 3 3 1 2
136 3 3 1 3 4 3
137 2 2 3 3 1 2
138 2 2 3 3 2 2
139 2 3 4 2 1 1
140 2 3 3 2 1 2
141 2 3 2 1 1 1
142 1 2 3 5 1 4
143 1 4 1 2 1 1
144 3 2 1 2 1 2
145 2 1 2 3 1 2
146 2 1 1 2 1 1
147 3 2 1 3 1 1
148 3 3 3 4 1 2
149 1 2 3 4 2 4
150 3 4 2 2 1 1
151 2 3 2 4 2 1
152 1 4 1 2 1 1
153 1 2 2 3 1 2
154 2 3 2 3 3 2
155 2 2 2 4 1 1
156 3 2 1 1 1 1
157 3 3 3 3 1 2
158 1 4 3 1 1 2
159 2 2 2 4 1 1
160 2 1 1 3 2 3
161 3 3 1 4 1 3
162 4 1 4 2 1 2
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) depression effort focus sleep belong
1.46853 0.09805 0.07169 0.13495 -0.04881 -0.07560
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-1.20328 -0.73009 -0.04368 0.47937 2.14843
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.46853 0.30298 4.847 3.00e-06 ***
depression 0.09805 0.07044 1.392 0.1659
effort 0.07169 0.08279 0.866 0.3878
focus 0.13495 0.06989 1.931 0.0553 .
sleep -0.04881 0.07640 -0.639 0.5239
belong -0.07560 0.07747 -0.976 0.3307
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.8476 on 156 degrees of freedom
Multiple R-squared: 0.06243, Adjusted R-squared: 0.03238
F-statistic: 2.078 on 5 and 156 DF, p-value: 0.07102
> 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.32393216 0.64786433 0.6760678
[2,] 0.19042857 0.38085715 0.8095714
[3,] 0.10307580 0.20615161 0.8969242
[4,] 0.27341663 0.54683326 0.7265834
[5,] 0.60792288 0.78415424 0.3920771
[6,] 0.50042475 0.99915050 0.4995753
[7,] 0.40656081 0.81312163 0.5934392
[8,] 0.35663164 0.71326327 0.6433684
[9,] 0.64543232 0.70913535 0.3545677
[10,] 0.59438456 0.81123088 0.4056154
[11,] 0.61752024 0.76495952 0.3824798
[12,] 0.54606389 0.90787221 0.4539361
[13,] 0.54105069 0.91789862 0.4589493
[14,] 0.46649694 0.93299388 0.5335031
[15,] 0.39968500 0.79937000 0.6003150
[16,] 0.33471333 0.66942666 0.6652867
[17,] 0.42254891 0.84509783 0.5774511
[18,] 0.37754821 0.75509642 0.6224518
[19,] 0.36659582 0.73319165 0.6334042
[20,] 0.30744586 0.61489172 0.6925541
[21,] 0.26470135 0.52940270 0.7352987
[22,] 0.31149567 0.62299135 0.6885043
[23,] 0.26229365 0.52458730 0.7377064
[24,] 0.21945617 0.43891233 0.7805438
[25,] 0.19539824 0.39079647 0.8046018
[26,] 0.18469916 0.36939833 0.8153008
[27,] 0.21539687 0.43079374 0.7846031
[28,] 0.17845372 0.35690744 0.8215463
[29,] 0.14452649 0.28905298 0.8554735
[30,] 0.13548661 0.27097322 0.8645134
[31,] 0.10988761 0.21977522 0.8901124
[32,] 0.09080327 0.18160655 0.9091967
[33,] 0.07870645 0.15741291 0.9212935
[34,] 0.07252973 0.14505946 0.9274703
[35,] 0.05761751 0.11523503 0.9423825
[36,] 0.05135150 0.10270300 0.9486485
[37,] 0.04125192 0.08250385 0.9587481
[38,] 0.03770516 0.07541033 0.9622948
[39,] 0.03280212 0.06560424 0.9671979
[40,] 0.02762459 0.05524918 0.9723754
[41,] 0.02600414 0.05200827 0.9739959
[42,] 0.02753049 0.05506097 0.9724695
[43,] 0.02357833 0.04715666 0.9764217
[44,] 0.02055735 0.04111470 0.9794427
[45,] 0.02254346 0.04508692 0.9774565
[46,] 0.01879697 0.03759393 0.9812030
[47,] 0.01764211 0.03528423 0.9823579
[48,] 0.01521459 0.03042917 0.9847854
[49,] 0.02635298 0.05270597 0.9736470
[50,] 0.03176101 0.06352202 0.9682390
[51,] 0.03160283 0.06320565 0.9683972
[52,] 0.04832574 0.09665148 0.9516743
[53,] 0.03725089 0.07450178 0.9627491
[54,] 0.06379211 0.12758422 0.9362079
[55,] 0.09842167 0.19684333 0.9015783
[56,] 0.10057068 0.20114136 0.8994293
[57,] 0.08093650 0.16187301 0.9190635
[58,] 0.07682610 0.15365220 0.9231739
[59,] 0.08054639 0.16109278 0.9194536
[60,] 0.12027997 0.24055994 0.8797200
[61,] 0.13157022 0.26314043 0.8684298
[62,] 0.10875370 0.21750741 0.8912463
[63,] 0.11781834 0.23563667 0.8821817
[64,] 0.09668466 0.19336931 0.9033153
[65,] 0.12138727 0.24277453 0.8786127
[66,] 0.11594643 0.23189286 0.8840536
[67,] 0.10376123 0.20752246 0.8962388
[68,] 0.13350489 0.26700977 0.8664951
[69,] 0.14160061 0.28320123 0.8583994
[70,] 0.11793046 0.23586092 0.8820695
[71,] 0.09963503 0.19927006 0.9003650
[72,] 0.11562357 0.23124715 0.8843764
[73,] 0.11907767 0.23815534 0.8809223
[74,] 0.14793327 0.29586655 0.8520667
[75,] 0.15010855 0.30021711 0.8498914
[76,] 0.37217170 0.74434340 0.6278283
[77,] 0.33356874 0.66713748 0.6664313
[78,] 0.29275259 0.58550519 0.7072474
[79,] 0.33143848 0.66287695 0.6685615
[80,] 0.29287559 0.58575118 0.7071244
[81,] 0.29262203 0.58524406 0.7073780
[82,] 0.47813418 0.95626836 0.5218658
[83,] 0.49564878 0.99129757 0.5043512
[84,] 0.49970032 0.99940063 0.5002997
[85,] 0.52852451 0.94295098 0.4714755
[86,] 0.48622263 0.97244526 0.5137774
[87,] 0.50063522 0.99872956 0.4993648
[88,] 0.52440874 0.95118252 0.4755913
[89,] 0.53651174 0.92697652 0.4634883
[90,] 0.49266038 0.98532077 0.5073396
[91,] 0.44705959 0.89411919 0.5529404
[92,] 0.40546507 0.81093013 0.5945349
[93,] 0.36081916 0.72163832 0.6391808
[94,] 0.31882269 0.63764539 0.6811773
[95,] 0.27781521 0.55563041 0.7221848
[96,] 0.29893298 0.59786597 0.7010670
[97,] 0.26048031 0.52096063 0.7395197
[98,] 0.26516207 0.53032414 0.7348379
[99,] 0.22698396 0.45396793 0.7730160
[100,] 0.19329352 0.38658704 0.8067065
[101,] 0.23293711 0.46587423 0.7670629
[102,] 0.32979089 0.65958179 0.6702091
[103,] 0.28678575 0.57357150 0.7132142
[104,] 0.24565807 0.49131613 0.7543419
[105,] 0.25827108 0.51654215 0.7417289
[106,] 0.21935396 0.43870793 0.7806460
[107,] 0.18461729 0.36923457 0.8153827
[108,] 0.20268834 0.40537669 0.7973117
[109,] 0.16808824 0.33617648 0.8319118
[110,] 0.35560860 0.71121720 0.6443914
[111,] 0.30741088 0.61482175 0.6925891
[112,] 0.54872362 0.90255276 0.4512764
[113,] 0.56968758 0.86062484 0.4303124
[114,] 0.51478161 0.97043678 0.4852184
[115,] 0.46174608 0.92349216 0.5382539
[116,] 0.47363285 0.94726570 0.5263672
[117,] 0.53893470 0.92213061 0.4610653
[118,] 0.54741328 0.90517344 0.4525867
[119,] 0.59887425 0.80225150 0.4011258
[120,] 0.59770786 0.80458428 0.4022921
[121,] 0.54490863 0.91018273 0.4550914
[122,] 0.49242466 0.98484932 0.5075753
[123,] 0.52137091 0.95725817 0.4786291
[124,] 0.54763947 0.90472107 0.4523605
[125,] 0.50327159 0.99345682 0.4967284
[126,] 0.43944616 0.87889231 0.5605538
[127,] 0.40953217 0.81906434 0.5904678
[128,] 0.47201921 0.94403841 0.5279808
[129,] 0.41139670 0.82279341 0.5886033
[130,] 0.34649275 0.69298549 0.6535073
[131,] 0.30128899 0.60257797 0.6987110
[132,] 0.24291628 0.48583256 0.7570837
[133,] 0.19605021 0.39210043 0.8039498
[134,] 0.21184431 0.42368863 0.7881557
[135,] 0.21555763 0.43111526 0.7844424
[136,] 0.21099702 0.42199404 0.7890030
[137,] 0.17184729 0.34369458 0.8281527
[138,] 0.14493609 0.28987219 0.8550639
[139,] 0.11615309 0.23230617 0.8838469
[140,] 0.10018722 0.20037445 0.8998128
[141,] 0.11709382 0.23418764 0.8829062
[142,] 0.16360639 0.32721277 0.8363936
[143,] 0.10586177 0.21172354 0.8941382
[144,] 0.06325278 0.12650555 0.9367472
[145,] 0.14224497 0.28448994 0.8577550
> postscript(file="/var/www/rcomp/tmp/1zfxg1322142799.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(x[,1], type='l', main='Actuals and Interpolation', ylab='value of Actuals and Interpolation (dots)', xlab='time or index')
> points(x[,1]-mysum$resid)
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/2xnkl1322142799.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> plot(mysum$resid, type='b', pch=19, main='Residuals', ylab='value of Residuals', xlab='time or index')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/3ihwd1322142799.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> hist(mysum$resid, main='Residual Histogram', xlab='values of Residuals')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/4hltw1322142799.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> densityplot(~mysum$resid,col='black',main='Residual Density Plot', xlab='values of Residuals')
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/5ttgb1322142799.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
0.479482462 -0.743409118 0.285176536 0.367416481 -0.986962937 -0.806668251
7 8 9 10 11 12
-0.039685660 1.216218281 0.220124001 0.170876108 0.524383589 -0.497631007
13 14 15 16 17 18
1.987116747 0.209577436 0.144524901 1.281270816 1.452690210 -0.622908890
19 20 21 22 23 24
-0.779875999 0.550734796 -0.448824159 0.268930849 -0.569765431 0.268489804
25 26 27 28 29 30
-0.643130084 -0.644923486 -0.829123892 0.061843911 -1.047678861 -0.610568923
31 32 33 34 35 36
-0.520517538 0.058369081 -0.622478000 -0.681831413 -0.866021664 -0.373225059
37 38 39 40 41 42
-0.148276811 -0.731069151 -0.591780027 -0.546878900 -0.573230106 -0.910922792
43 44 45 46 47 48
-0.324418211 -0.878371785 -0.618572279 -0.681831413 -0.426809563 -0.818577327
49 50 51 52 53 54
-1.133824526 -0.833029613 -0.524423259 -0.690265659 0.103078294 0.495287104
55 56 57 58 59 60
-0.727163431 -0.867825221 1.242569487 -0.821120536 -1.013314143 1.170435062
61 62 63 64 65 66
-0.295569291 1.301922900 1.399977642 0.897065362 0.009131343 -0.498502942
67 68 69 70 71 72
0.874178830 1.121638369 1.107616975 0.215777235 -1.088482353 -0.186978140
73 74 75 76 77 78
1.203868159 -0.622908890 0.479041416 1.207773879 -0.964076405 0.095277008
79 80 81 82 83 84
0.072390476 -0.919175277 -0.734974871 1.291817381 -0.855475099 2.148430621
85 86 87 88 89 90
0.220124001 -0.149639323 1.269361739 -0.008977533 0.916785879 1.925959777
91 92 93 94 95 96
-0.942993430 0.876722039 -1.110937994 -0.076142386 -0.979891202 -1.110937994
97 98 99 100 101 102
0.889062006 0.328715152 0.144524901 0.279477414 0.209577436 -0.047678861
103 104 105 106 107 108
-0.016788973 -1.133393636 -0.295138400 0.952321139 0.183216075 0.062284956
109 110 111 112 113 114
-0.948261608 1.759686486 0.070719203 -0.088482353 -1.016788973 -0.002346843
115 116 117 118 119 120
0.253116052 1.156864868 -0.008977533 2.144524901 0.025818075 2.085161333
121 122 123 124 125 126
-0.851569379 -0.051584581 0.020108798 -0.918734232 -1.025223220 -0.746883948
127 128 129 130 131 132
-0.783781719 -0.769339589 -0.088482353 -0.002777733 -1.023429818 0.647620505
133 134 135 136 137 138
0.220124001 -0.186537094 1.013478109 1.182775029 -0.084576633 -0.035769785
139 140 141 142 143 144
-0.194971341 -0.047678861 0.083367932 -1.203283458 -1.077945943 1.193762639
145 146 147 148 149 150
0.085171488 0.216218281 0.983211027 0.682416113 -1.019524098 0.850360677
151 152 153 154 155 156
-0.272682759 -1.077945943 -1.012883253 -0.013324298 -0.223434866 1.253116052
157 158 159 160 161 162
0.817368626 -1.010781089 -0.223434866 0.281270816 0.901401973 2.076737242
> postscript(file="/var/www/rcomp/tmp/6ka3m1322142799.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 0.479482462 NA
1 -0.743409118 0.479482462
2 0.285176536 -0.743409118
3 0.367416481 0.285176536
4 -0.986962937 0.367416481
5 -0.806668251 -0.986962937
6 -0.039685660 -0.806668251
7 1.216218281 -0.039685660
8 0.220124001 1.216218281
9 0.170876108 0.220124001
10 0.524383589 0.170876108
11 -0.497631007 0.524383589
12 1.987116747 -0.497631007
13 0.209577436 1.987116747
14 0.144524901 0.209577436
15 1.281270816 0.144524901
16 1.452690210 1.281270816
17 -0.622908890 1.452690210
18 -0.779875999 -0.622908890
19 0.550734796 -0.779875999
20 -0.448824159 0.550734796
21 0.268930849 -0.448824159
22 -0.569765431 0.268930849
23 0.268489804 -0.569765431
24 -0.643130084 0.268489804
25 -0.644923486 -0.643130084
26 -0.829123892 -0.644923486
27 0.061843911 -0.829123892
28 -1.047678861 0.061843911
29 -0.610568923 -1.047678861
30 -0.520517538 -0.610568923
31 0.058369081 -0.520517538
32 -0.622478000 0.058369081
33 -0.681831413 -0.622478000
34 -0.866021664 -0.681831413
35 -0.373225059 -0.866021664
36 -0.148276811 -0.373225059
37 -0.731069151 -0.148276811
38 -0.591780027 -0.731069151
39 -0.546878900 -0.591780027
40 -0.573230106 -0.546878900
41 -0.910922792 -0.573230106
42 -0.324418211 -0.910922792
43 -0.878371785 -0.324418211
44 -0.618572279 -0.878371785
45 -0.681831413 -0.618572279
46 -0.426809563 -0.681831413
47 -0.818577327 -0.426809563
48 -1.133824526 -0.818577327
49 -0.833029613 -1.133824526
50 -0.524423259 -0.833029613
51 -0.690265659 -0.524423259
52 0.103078294 -0.690265659
53 0.495287104 0.103078294
54 -0.727163431 0.495287104
55 -0.867825221 -0.727163431
56 1.242569487 -0.867825221
57 -0.821120536 1.242569487
58 -1.013314143 -0.821120536
59 1.170435062 -1.013314143
60 -0.295569291 1.170435062
61 1.301922900 -0.295569291
62 1.399977642 1.301922900
63 0.897065362 1.399977642
64 0.009131343 0.897065362
65 -0.498502942 0.009131343
66 0.874178830 -0.498502942
67 1.121638369 0.874178830
68 1.107616975 1.121638369
69 0.215777235 1.107616975
70 -1.088482353 0.215777235
71 -0.186978140 -1.088482353
72 1.203868159 -0.186978140
73 -0.622908890 1.203868159
74 0.479041416 -0.622908890
75 1.207773879 0.479041416
76 -0.964076405 1.207773879
77 0.095277008 -0.964076405
78 0.072390476 0.095277008
79 -0.919175277 0.072390476
80 -0.734974871 -0.919175277
81 1.291817381 -0.734974871
82 -0.855475099 1.291817381
83 2.148430621 -0.855475099
84 0.220124001 2.148430621
85 -0.149639323 0.220124001
86 1.269361739 -0.149639323
87 -0.008977533 1.269361739
88 0.916785879 -0.008977533
89 1.925959777 0.916785879
90 -0.942993430 1.925959777
91 0.876722039 -0.942993430
92 -1.110937994 0.876722039
93 -0.076142386 -1.110937994
94 -0.979891202 -0.076142386
95 -1.110937994 -0.979891202
96 0.889062006 -1.110937994
97 0.328715152 0.889062006
98 0.144524901 0.328715152
99 0.279477414 0.144524901
100 0.209577436 0.279477414
101 -0.047678861 0.209577436
102 -0.016788973 -0.047678861
103 -1.133393636 -0.016788973
104 -0.295138400 -1.133393636
105 0.952321139 -0.295138400
106 0.183216075 0.952321139
107 0.062284956 0.183216075
108 -0.948261608 0.062284956
109 1.759686486 -0.948261608
110 0.070719203 1.759686486
111 -0.088482353 0.070719203
112 -1.016788973 -0.088482353
113 -0.002346843 -1.016788973
114 0.253116052 -0.002346843
115 1.156864868 0.253116052
116 -0.008977533 1.156864868
117 2.144524901 -0.008977533
118 0.025818075 2.144524901
119 2.085161333 0.025818075
120 -0.851569379 2.085161333
121 -0.051584581 -0.851569379
122 0.020108798 -0.051584581
123 -0.918734232 0.020108798
124 -1.025223220 -0.918734232
125 -0.746883948 -1.025223220
126 -0.783781719 -0.746883948
127 -0.769339589 -0.783781719
128 -0.088482353 -0.769339589
129 -0.002777733 -0.088482353
130 -1.023429818 -0.002777733
131 0.647620505 -1.023429818
132 0.220124001 0.647620505
133 -0.186537094 0.220124001
134 1.013478109 -0.186537094
135 1.182775029 1.013478109
136 -0.084576633 1.182775029
137 -0.035769785 -0.084576633
138 -0.194971341 -0.035769785
139 -0.047678861 -0.194971341
140 0.083367932 -0.047678861
141 -1.203283458 0.083367932
142 -1.077945943 -1.203283458
143 1.193762639 -1.077945943
144 0.085171488 1.193762639
145 0.216218281 0.085171488
146 0.983211027 0.216218281
147 0.682416113 0.983211027
148 -1.019524098 0.682416113
149 0.850360677 -1.019524098
150 -0.272682759 0.850360677
151 -1.077945943 -0.272682759
152 -1.012883253 -1.077945943
153 -0.013324298 -1.012883253
154 -0.223434866 -0.013324298
155 1.253116052 -0.223434866
156 0.817368626 1.253116052
157 -1.010781089 0.817368626
158 -0.223434866 -1.010781089
159 0.281270816 -0.223434866
160 0.901401973 0.281270816
161 2.076737242 0.901401973
162 NA 2.076737242
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] -0.743409118 0.479482462
[2,] 0.285176536 -0.743409118
[3,] 0.367416481 0.285176536
[4,] -0.986962937 0.367416481
[5,] -0.806668251 -0.986962937
[6,] -0.039685660 -0.806668251
[7,] 1.216218281 -0.039685660
[8,] 0.220124001 1.216218281
[9,] 0.170876108 0.220124001
[10,] 0.524383589 0.170876108
[11,] -0.497631007 0.524383589
[12,] 1.987116747 -0.497631007
[13,] 0.209577436 1.987116747
[14,] 0.144524901 0.209577436
[15,] 1.281270816 0.144524901
[16,] 1.452690210 1.281270816
[17,] -0.622908890 1.452690210
[18,] -0.779875999 -0.622908890
[19,] 0.550734796 -0.779875999
[20,] -0.448824159 0.550734796
[21,] 0.268930849 -0.448824159
[22,] -0.569765431 0.268930849
[23,] 0.268489804 -0.569765431
[24,] -0.643130084 0.268489804
[25,] -0.644923486 -0.643130084
[26,] -0.829123892 -0.644923486
[27,] 0.061843911 -0.829123892
[28,] -1.047678861 0.061843911
[29,] -0.610568923 -1.047678861
[30,] -0.520517538 -0.610568923
[31,] 0.058369081 -0.520517538
[32,] -0.622478000 0.058369081
[33,] -0.681831413 -0.622478000
[34,] -0.866021664 -0.681831413
[35,] -0.373225059 -0.866021664
[36,] -0.148276811 -0.373225059
[37,] -0.731069151 -0.148276811
[38,] -0.591780027 -0.731069151
[39,] -0.546878900 -0.591780027
[40,] -0.573230106 -0.546878900
[41,] -0.910922792 -0.573230106
[42,] -0.324418211 -0.910922792
[43,] -0.878371785 -0.324418211
[44,] -0.618572279 -0.878371785
[45,] -0.681831413 -0.618572279
[46,] -0.426809563 -0.681831413
[47,] -0.818577327 -0.426809563
[48,] -1.133824526 -0.818577327
[49,] -0.833029613 -1.133824526
[50,] -0.524423259 -0.833029613
[51,] -0.690265659 -0.524423259
[52,] 0.103078294 -0.690265659
[53,] 0.495287104 0.103078294
[54,] -0.727163431 0.495287104
[55,] -0.867825221 -0.727163431
[56,] 1.242569487 -0.867825221
[57,] -0.821120536 1.242569487
[58,] -1.013314143 -0.821120536
[59,] 1.170435062 -1.013314143
[60,] -0.295569291 1.170435062
[61,] 1.301922900 -0.295569291
[62,] 1.399977642 1.301922900
[63,] 0.897065362 1.399977642
[64,] 0.009131343 0.897065362
[65,] -0.498502942 0.009131343
[66,] 0.874178830 -0.498502942
[67,] 1.121638369 0.874178830
[68,] 1.107616975 1.121638369
[69,] 0.215777235 1.107616975
[70,] -1.088482353 0.215777235
[71,] -0.186978140 -1.088482353
[72,] 1.203868159 -0.186978140
[73,] -0.622908890 1.203868159
[74,] 0.479041416 -0.622908890
[75,] 1.207773879 0.479041416
[76,] -0.964076405 1.207773879
[77,] 0.095277008 -0.964076405
[78,] 0.072390476 0.095277008
[79,] -0.919175277 0.072390476
[80,] -0.734974871 -0.919175277
[81,] 1.291817381 -0.734974871
[82,] -0.855475099 1.291817381
[83,] 2.148430621 -0.855475099
[84,] 0.220124001 2.148430621
[85,] -0.149639323 0.220124001
[86,] 1.269361739 -0.149639323
[87,] -0.008977533 1.269361739
[88,] 0.916785879 -0.008977533
[89,] 1.925959777 0.916785879
[90,] -0.942993430 1.925959777
[91,] 0.876722039 -0.942993430
[92,] -1.110937994 0.876722039
[93,] -0.076142386 -1.110937994
[94,] -0.979891202 -0.076142386
[95,] -1.110937994 -0.979891202
[96,] 0.889062006 -1.110937994
[97,] 0.328715152 0.889062006
[98,] 0.144524901 0.328715152
[99,] 0.279477414 0.144524901
[100,] 0.209577436 0.279477414
[101,] -0.047678861 0.209577436
[102,] -0.016788973 -0.047678861
[103,] -1.133393636 -0.016788973
[104,] -0.295138400 -1.133393636
[105,] 0.952321139 -0.295138400
[106,] 0.183216075 0.952321139
[107,] 0.062284956 0.183216075
[108,] -0.948261608 0.062284956
[109,] 1.759686486 -0.948261608
[110,] 0.070719203 1.759686486
[111,] -0.088482353 0.070719203
[112,] -1.016788973 -0.088482353
[113,] -0.002346843 -1.016788973
[114,] 0.253116052 -0.002346843
[115,] 1.156864868 0.253116052
[116,] -0.008977533 1.156864868
[117,] 2.144524901 -0.008977533
[118,] 0.025818075 2.144524901
[119,] 2.085161333 0.025818075
[120,] -0.851569379 2.085161333
[121,] -0.051584581 -0.851569379
[122,] 0.020108798 -0.051584581
[123,] -0.918734232 0.020108798
[124,] -1.025223220 -0.918734232
[125,] -0.746883948 -1.025223220
[126,] -0.783781719 -0.746883948
[127,] -0.769339589 -0.783781719
[128,] -0.088482353 -0.769339589
[129,] -0.002777733 -0.088482353
[130,] -1.023429818 -0.002777733
[131,] 0.647620505 -1.023429818
[132,] 0.220124001 0.647620505
[133,] -0.186537094 0.220124001
[134,] 1.013478109 -0.186537094
[135,] 1.182775029 1.013478109
[136,] -0.084576633 1.182775029
[137,] -0.035769785 -0.084576633
[138,] -0.194971341 -0.035769785
[139,] -0.047678861 -0.194971341
[140,] 0.083367932 -0.047678861
[141,] -1.203283458 0.083367932
[142,] -1.077945943 -1.203283458
[143,] 1.193762639 -1.077945943
[144,] 0.085171488 1.193762639
[145,] 0.216218281 0.085171488
[146,] 0.983211027 0.216218281
[147,] 0.682416113 0.983211027
[148,] -1.019524098 0.682416113
[149,] 0.850360677 -1.019524098
[150,] -0.272682759 0.850360677
[151,] -1.077945943 -0.272682759
[152,] -1.012883253 -1.077945943
[153,] -0.013324298 -1.012883253
[154,] -0.223434866 -0.013324298
[155,] 1.253116052 -0.223434866
[156,] 0.817368626 1.253116052
[157,] -1.010781089 0.817368626
[158,] -0.223434866 -1.010781089
[159,] 0.281270816 -0.223434866
[160,] 0.901401973 0.281270816
[161,] 2.076737242 0.901401973
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 -0.743409118 0.479482462
2 0.285176536 -0.743409118
3 0.367416481 0.285176536
4 -0.986962937 0.367416481
5 -0.806668251 -0.986962937
6 -0.039685660 -0.806668251
7 1.216218281 -0.039685660
8 0.220124001 1.216218281
9 0.170876108 0.220124001
10 0.524383589 0.170876108
11 -0.497631007 0.524383589
12 1.987116747 -0.497631007
13 0.209577436 1.987116747
14 0.144524901 0.209577436
15 1.281270816 0.144524901
16 1.452690210 1.281270816
17 -0.622908890 1.452690210
18 -0.779875999 -0.622908890
19 0.550734796 -0.779875999
20 -0.448824159 0.550734796
21 0.268930849 -0.448824159
22 -0.569765431 0.268930849
23 0.268489804 -0.569765431
24 -0.643130084 0.268489804
25 -0.644923486 -0.643130084
26 -0.829123892 -0.644923486
27 0.061843911 -0.829123892
28 -1.047678861 0.061843911
29 -0.610568923 -1.047678861
30 -0.520517538 -0.610568923
31 0.058369081 -0.520517538
32 -0.622478000 0.058369081
33 -0.681831413 -0.622478000
34 -0.866021664 -0.681831413
35 -0.373225059 -0.866021664
36 -0.148276811 -0.373225059
37 -0.731069151 -0.148276811
38 -0.591780027 -0.731069151
39 -0.546878900 -0.591780027
40 -0.573230106 -0.546878900
41 -0.910922792 -0.573230106
42 -0.324418211 -0.910922792
43 -0.878371785 -0.324418211
44 -0.618572279 -0.878371785
45 -0.681831413 -0.618572279
46 -0.426809563 -0.681831413
47 -0.818577327 -0.426809563
48 -1.133824526 -0.818577327
49 -0.833029613 -1.133824526
50 -0.524423259 -0.833029613
51 -0.690265659 -0.524423259
52 0.103078294 -0.690265659
53 0.495287104 0.103078294
54 -0.727163431 0.495287104
55 -0.867825221 -0.727163431
56 1.242569487 -0.867825221
57 -0.821120536 1.242569487
58 -1.013314143 -0.821120536
59 1.170435062 -1.013314143
60 -0.295569291 1.170435062
61 1.301922900 -0.295569291
62 1.399977642 1.301922900
63 0.897065362 1.399977642
64 0.009131343 0.897065362
65 -0.498502942 0.009131343
66 0.874178830 -0.498502942
67 1.121638369 0.874178830
68 1.107616975 1.121638369
69 0.215777235 1.107616975
70 -1.088482353 0.215777235
71 -0.186978140 -1.088482353
72 1.203868159 -0.186978140
73 -0.622908890 1.203868159
74 0.479041416 -0.622908890
75 1.207773879 0.479041416
76 -0.964076405 1.207773879
77 0.095277008 -0.964076405
78 0.072390476 0.095277008
79 -0.919175277 0.072390476
80 -0.734974871 -0.919175277
81 1.291817381 -0.734974871
82 -0.855475099 1.291817381
83 2.148430621 -0.855475099
84 0.220124001 2.148430621
85 -0.149639323 0.220124001
86 1.269361739 -0.149639323
87 -0.008977533 1.269361739
88 0.916785879 -0.008977533
89 1.925959777 0.916785879
90 -0.942993430 1.925959777
91 0.876722039 -0.942993430
92 -1.110937994 0.876722039
93 -0.076142386 -1.110937994
94 -0.979891202 -0.076142386
95 -1.110937994 -0.979891202
96 0.889062006 -1.110937994
97 0.328715152 0.889062006
98 0.144524901 0.328715152
99 0.279477414 0.144524901
100 0.209577436 0.279477414
101 -0.047678861 0.209577436
102 -0.016788973 -0.047678861
103 -1.133393636 -0.016788973
104 -0.295138400 -1.133393636
105 0.952321139 -0.295138400
106 0.183216075 0.952321139
107 0.062284956 0.183216075
108 -0.948261608 0.062284956
109 1.759686486 -0.948261608
110 0.070719203 1.759686486
111 -0.088482353 0.070719203
112 -1.016788973 -0.088482353
113 -0.002346843 -1.016788973
114 0.253116052 -0.002346843
115 1.156864868 0.253116052
116 -0.008977533 1.156864868
117 2.144524901 -0.008977533
118 0.025818075 2.144524901
119 2.085161333 0.025818075
120 -0.851569379 2.085161333
121 -0.051584581 -0.851569379
122 0.020108798 -0.051584581
123 -0.918734232 0.020108798
124 -1.025223220 -0.918734232
125 -0.746883948 -1.025223220
126 -0.783781719 -0.746883948
127 -0.769339589 -0.783781719
128 -0.088482353 -0.769339589
129 -0.002777733 -0.088482353
130 -1.023429818 -0.002777733
131 0.647620505 -1.023429818
132 0.220124001 0.647620505
133 -0.186537094 0.220124001
134 1.013478109 -0.186537094
135 1.182775029 1.013478109
136 -0.084576633 1.182775029
137 -0.035769785 -0.084576633
138 -0.194971341 -0.035769785
139 -0.047678861 -0.194971341
140 0.083367932 -0.047678861
141 -1.203283458 0.083367932
142 -1.077945943 -1.203283458
143 1.193762639 -1.077945943
144 0.085171488 1.193762639
145 0.216218281 0.085171488
146 0.983211027 0.216218281
147 0.682416113 0.983211027
148 -1.019524098 0.682416113
149 0.850360677 -1.019524098
150 -0.272682759 0.850360677
151 -1.077945943 -0.272682759
152 -1.012883253 -1.077945943
153 -0.013324298 -1.012883253
154 -0.223434866 -0.013324298
155 1.253116052 -0.223434866
156 0.817368626 1.253116052
157 -1.010781089 0.817368626
158 -0.223434866 -1.010781089
159 0.281270816 -0.223434866
160 0.901401973 0.281270816
161 2.076737242 0.901401973
> 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/rcomp/tmp/7shwk1322142799.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> acf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/8ue5t1322142799.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> pacf(mysum$resid, lag.max=length(mysum$resid)/2, main='Residual Partial Autocorrelation Function')
> grid()
> dev.off()
null device
1
> postscript(file="/var/www/rcomp/tmp/9u39r1322142799.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0))
> plot(mylm, las = 1, sub='Residual Diagnostics')
> par(opar)
> dev.off()
null device
1
> if (n > n25) {
+ postscript(file="/var/www/rcomp/tmp/10quc81322142799.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
+ plot(kp3:nmkm3,gqarr[,2], main='Goldfeld-Quandt test',ylab='2-sided p-value',xlab='breakpoint')
+ grid()
+ dev.off()
+ }
null device
1
>
> #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/www/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/rcomp/tmp/11b9ms1322142799.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/rcomp/tmp/12ugpo1322142799.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/rcomp/tmp/1396zu1322142799.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/rcomp/tmp/14g3h81322142799.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/rcomp/tmp/15ldsf1322142799.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/rcomp/tmp/16sy8m1322142799.tab")
+ }
>
> try(system("convert tmp/1zfxg1322142799.ps tmp/1zfxg1322142799.png",intern=TRUE))
character(0)
> try(system("convert tmp/2xnkl1322142799.ps tmp/2xnkl1322142799.png",intern=TRUE))
character(0)
> try(system("convert tmp/3ihwd1322142799.ps tmp/3ihwd1322142799.png",intern=TRUE))
character(0)
> try(system("convert tmp/4hltw1322142799.ps tmp/4hltw1322142799.png",intern=TRUE))
character(0)
> try(system("convert tmp/5ttgb1322142799.ps tmp/5ttgb1322142799.png",intern=TRUE))
character(0)
> try(system("convert tmp/6ka3m1322142799.ps tmp/6ka3m1322142799.png",intern=TRUE))
character(0)
> try(system("convert tmp/7shwk1322142799.ps tmp/7shwk1322142799.png",intern=TRUE))
character(0)
> try(system("convert tmp/8ue5t1322142799.ps tmp/8ue5t1322142799.png",intern=TRUE))
character(0)
> try(system("convert tmp/9u39r1322142799.ps tmp/9u39r1322142799.png",intern=TRUE))
character(0)
> try(system("convert tmp/10quc81322142799.ps tmp/10quc81322142799.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
5.460 0.390 5.834