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(41
+ ,38
+ ,14
+ ,12
+ ,39
+ ,32
+ ,18
+ ,11
+ ,30
+ ,35
+ ,11
+ ,14
+ ,31
+ ,33
+ ,12
+ ,12
+ ,34
+ ,37
+ ,16
+ ,21
+ ,35
+ ,29
+ ,18
+ ,12
+ ,39
+ ,31
+ ,14
+ ,22
+ ,34
+ ,36
+ ,14
+ ,11
+ ,36
+ ,35
+ ,15
+ ,10
+ ,37
+ ,38
+ ,15
+ ,13
+ ,38
+ ,31
+ ,17
+ ,10
+ ,36
+ ,34
+ ,19
+ ,8
+ ,38
+ ,35
+ ,10
+ ,15
+ ,39
+ ,38
+ ,16
+ ,14
+ ,33
+ ,37
+ ,18
+ ,10
+ ,32
+ ,33
+ ,14
+ ,14
+ ,36
+ ,32
+ ,14
+ ,14
+ ,38
+ ,38
+ ,17
+ ,11
+ ,39
+ ,38
+ ,14
+ ,10
+ ,32
+ ,32
+ ,16
+ ,13
+ ,32
+ ,33
+ ,18
+ ,7
+ ,31
+ ,31
+ ,11
+ ,14
+ ,39
+ ,38
+ ,14
+ ,12
+ ,37
+ ,39
+ ,12
+ ,14
+ ,39
+ ,32
+ ,17
+ ,11
+ ,41
+ ,32
+ ,9
+ ,9
+ ,36
+ ,35
+ ,16
+ ,11
+ ,33
+ ,37
+ ,14
+ ,15
+ ,33
+ ,33
+ ,15
+ ,14
+ ,34
+ ,33
+ ,11
+ ,13
+ ,31
+ ,28
+ ,16
+ ,9
+ ,27
+ ,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32
+ ,13
+ ,9
+ ,32
+ ,35
+ ,12
+ ,18
+ ,34
+ ,36
+ ,13
+ ,16)
+ ,dim=c(4
+ ,162)
+ ,dimnames=list(c('Connected'
+ ,'Separate'
+ ,'Happiness'
+ ,'Depression
')
+ ,1:162))
> y <- array(NA,dim=c(4,162),dimnames=list(c('Connected','Separate','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 = '4'
> par3 <- 'No Linear Trend'
> par2 <- 'Do not include Seasonal Dummies'
> par1 <- '4'
> #'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
Depression\r Connected Separate Happiness
1 12 41 38 14
2 11 39 32 18
3 14 30 35 11
4 12 31 33 12
5 21 34 37 16
6 12 35 29 18
7 22 39 31 14
8 11 34 36 14
9 10 36 35 15
10 13 37 38 15
11 10 38 31 17
12 8 36 34 19
13 15 38 35 10
14 14 39 38 16
15 10 33 37 18
16 14 32 33 14
17 14 36 32 14
18 11 38 38 17
19 10 39 38 14
20 13 32 32 16
21 7 32 33 18
22 14 31 31 11
23 12 39 38 14
24 14 37 39 12
25 11 39 32 17
26 9 41 32 9
27 11 36 35 16
28 15 33 37 14
29 14 33 33 15
30 13 34 33 11
31 9 31 28 16
32 15 27 32 13
33 10 37 31 17
34 11 34 37 15
35 13 34 30 14
36 8 32 33 16
37 20 29 31 9
38 12 36 33 15
39 10 29 31 17
40 10 35 33 13
41 9 37 32 15
42 14 34 33 16
43 8 38 32 16
44 14 35 33 12
45 11 38 28 12
46 13 37 35 11
47 9 38 39 15
48 11 33 34 15
49 15 36 38 17
50 11 38 32 13
51 10 32 38 16
52 14 32 30 14
53 18 32 33 11
54 14 34 38 12
55 11 32 32 12
56 12 37 32 15
57 13 39 34 16
58 9 29 34 15
59 10 37 36 12
60 15 35 34 12
61 20 30 28 8
62 12 38 34 13
63 12 34 35 11
64 14 31 35 14
65 13 34 31 15
66 11 35 37 10
67 17 36 35 11
68 12 30 27 12
69 13 39 40 15
70 14 35 37 15
71 13 38 36 14
72 15 31 38 16
73 13 34 39 15
74 10 38 41 15
75 11 34 27 13
76 19 39 30 12
77 13 37 37 17
78 17 34 31 13
79 13 28 31 15
80 9 37 27 13
81 11 33 36 15
82 10 37 38 16
83 9 35 37 15
84 12 37 33 16
85 12 32 34 15
86 13 33 31 14
87 13 38 39 15
88 12 33 34 14
89 15 29 32 13
90 22 33 33 7
91 13 31 36 17
92 15 36 32 13
93 13 35 41 15
94 15 32 28 14
95 10 29 30 13
96 11 39 36 16
97 16 37 35 12
98 11 35 31 14
99 11 37 34 17
100 10 32 36 15
101 10 38 36 17
102 16 37 35 12
103 12 36 37 16
104 11 32 28 11
105 16 33 39 15
106 19 40 32 9
107 11 38 35 16
108 16 41 39 15
109 15 36 35 10
110 24 43 42 10
111 14 30 34 15
112 15 31 33 11
113 11 32 41 13
114 15 32 33 14
115 12 37 34 18
116 10 37 32 16
117 14 33 40 14
118 13 34 40 14
119 9 33 35 14
120 15 38 36 14
121 15 33 37 12
122 14 31 27 14
123 11 38 39 15
124 8 37 38 15
125 11 33 31 15
126 11 31 33 13
127 8 39 32 17
128 10 44 39 17
129 11 33 36 19
130 13 35 33 15
131 11 32 33 13
132 20 28 32 9
133 10 40 37 15
134 15 27 30 15
135 12 37 38 15
136 14 32 29 16
137 23 28 22 11
138 14 34 35 14
139 16 30 35 11
140 11 35 34 15
141 12 31 35 13
142 10 32 34 15
143 14 30 34 16
144 12 30 35 14
145 12 31 23 15
146 11 40 31 16
147 12 32 27 16
148 13 36 36 11
149 11 32 31 12
150 19 35 32 9
151 12 38 39 16
152 17 42 37 13
153 9 34 38 16
154 12 35 39 12
155 19 35 34 9
156 18 33 31 13
157 15 36 32 13
158 14 32 37 14
159 11 33 36 19
160 9 34 32 13
161 18 32 35 12
162 16 34 36 13
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Connected Separate Happiness
24.15687 -0.04870 0.02127 -0.73207
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-7.2522 -2.0170 -0.1137 1.6625 9.4251
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 24.15687 2.67531 9.030 5.69e-16 ***
Connected -0.04870 0.06752 -0.721 0.472
Separate 0.02127 0.06426 0.331 0.741
Happiness -0.73207 0.09174 -7.980 2.80e-13 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 2.677 on 158 degrees of freedom
Multiple R-squared: 0.2985, Adjusted R-squared: 0.2852
F-statistic: 22.41 on 3 and 158 DF, p-value: 3.815e-12
> 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.99975151 0.0004969797 0.0002484899
[2,] 0.99968706 0.0006258809 0.0003129405
[3,] 0.99970527 0.0005894559 0.0002947279
[4,] 0.99929017 0.0014196590 0.0007098295
[5,] 0.99920640 0.0015871965 0.0007935983
[6,] 0.99896947 0.0020610595 0.0010305297
[7,] 0.99817979 0.0036404160 0.0018202080
[8,] 0.99704244 0.0059151276 0.0029575638
[9,] 0.99474655 0.0105068973 0.0052534486
[10,] 0.99136390 0.0172722066 0.0086361033
[11,] 0.98598979 0.0280204105 0.0140102052
[12,] 0.97860937 0.0427812592 0.0213906296
[13,] 0.98031019 0.0393796109 0.0196898054
[14,] 0.97112857 0.0577428502 0.0288714251
[15,] 0.97586647 0.0482670560 0.0241335280
[16,] 0.96630023 0.0673995447 0.0336997723
[17,] 0.95437533 0.0912493395 0.0456246697
[18,] 0.93654702 0.1269059624 0.0634529812
[19,] 0.91887682 0.1622463512 0.0811231756
[20,] 0.98235073 0.0352985486 0.0176492743
[21,] 0.97536144 0.0492771186 0.0246385593
[22,] 0.97060367 0.0587926577 0.0293963289
[23,] 0.96269393 0.0746121376 0.0373060688
[24,] 0.95288184 0.0942363184 0.0471181592
[25,] 0.95186047 0.0962790680 0.0481395340
[26,] 0.94022760 0.1195448072 0.0597724036
[27,] 0.92399683 0.1520063388 0.0760031694
[28,] 0.90935000 0.1812999985 0.0906499992
[29,] 0.88519414 0.2296117221 0.1148058611
[30,] 0.90637894 0.1872421142 0.0936210571
[31,] 0.93207284 0.1358543146 0.0679271573
[32,] 0.91259094 0.1748181131 0.0874090566
[33,] 0.89515158 0.2096968433 0.1048484216
[34,] 0.90516164 0.1896767175 0.0948383587
[35,] 0.90623894 0.1875221242 0.0937610621
[36,] 0.90103432 0.1979313622 0.0989656811
[37,] 0.90654982 0.1869003516 0.0934501758
[38,] 0.88411119 0.2317776278 0.1158888139
[39,] 0.87745993 0.2450801448 0.1225400724
[40,] 0.85984048 0.2803190348 0.1401595174
[41,] 0.86933435 0.2613313069 0.1306656534
[42,] 0.84737051 0.3052589768 0.1526294884
[43,] 0.87660919 0.2467816158 0.1233908079
[44,] 0.86522981 0.2695403846 0.1347701923
[45,] 0.85505830 0.2898833905 0.1449416952
[46,] 0.83271696 0.3345660783 0.1672830392
[47,] 0.84483101 0.3103379741 0.1551689870
[48,] 0.81499096 0.3700180828 0.1850090414
[49,] 0.82759472 0.3448105544 0.1724052772
[50,] 0.79609909 0.4078018286 0.2039009143
[51,] 0.77766543 0.4446691304 0.2223345652
[52,] 0.80274315 0.3945136998 0.1972568499
[53,] 0.84087144 0.3182571256 0.1591285628
[54,] 0.81724523 0.3655095421 0.1827547711
[55,] 0.83373774 0.3325245208 0.1662622604
[56,] 0.81184384 0.3763123114 0.1881561557
[57,] 0.81962367 0.3607526572 0.1803763286
[58,] 0.79118607 0.4176278586 0.2088139293
[59,] 0.75995654 0.4800869194 0.2400434597
[60,] 0.83015164 0.3396967196 0.1698483598
[61,] 0.82488450 0.3502309977 0.1751154989
[62,] 0.82085548 0.3582890438 0.1791445219
[63,] 0.79378768 0.4124246442 0.2062123221
[64,] 0.77485693 0.4502861372 0.2251430686
[65,] 0.74047422 0.5190515625 0.2595257813
[66,] 0.75773854 0.4845229222 0.2422614611
[67,] 0.72256855 0.5548629034 0.2774314517
[68,] 0.71139715 0.5772056927 0.2886028464
[69,] 0.71031350 0.5793730018 0.2896865009
[70,] 0.80455974 0.3908805116 0.1954402558
[71,] 0.79710773 0.4057845383 0.2028922691
[72,] 0.81616096 0.3676780717 0.1838390358
[73,] 0.78610427 0.4277914550 0.2138957275
[74,] 0.84978177 0.3004364616 0.1502182308
[75,] 0.82853421 0.3429315843 0.1714657921
[76,] 0.80723980 0.3855204012 0.1927602006
[77,] 0.82284587 0.3543082553 0.1771541276
[78,] 0.79303683 0.4139263441 0.2069631720
[79,] 0.75917787 0.4816442536 0.2408221268
[80,] 0.72257907 0.5548418612 0.2774209306
[81,] 0.68704637 0.6259072552 0.3129536276
[82,] 0.65224561 0.6955087869 0.3477543935
[83,] 0.61672134 0.7665573251 0.3832786625
[84,] 0.66464627 0.6707074517 0.3353537259
[85,] 0.65477847 0.6904430681 0.3452215340
[86,] 0.62255888 0.7548822347 0.3774411173
[87,] 0.58219222 0.8356155697 0.4178077849
[88,] 0.56005518 0.8798896390 0.4399448195
[89,] 0.61408040 0.7718391959 0.3859195980
[90,] 0.56975301 0.8604939849 0.4302469925
[91,] 0.53928879 0.9214224195 0.4607112097
[92,] 0.52278867 0.9544226512 0.4772113256
[93,] 0.47664882 0.9532976491 0.5233511754
[94,] 0.46406508 0.9281301658 0.5359349171
[95,] 0.41997584 0.8399516829 0.5800241586
[96,] 0.38863868 0.7772773650 0.6113613175
[97,] 0.34581630 0.6916325927 0.6541837037
[98,] 0.44948593 0.8989718609 0.5505140695
[99,] 0.50632719 0.9873456210 0.4936728105
[100,] 0.49162910 0.9832582045 0.5083708978
[101,] 0.44476544 0.8895308854 0.5552345573
[102,] 0.50084677 0.9983064605 0.4991532302
[103,] 0.47487382 0.9497476441 0.5251261779
[104,] 0.84939438 0.3012112349 0.1506056175
[105,] 0.82951760 0.3409648096 0.1704824048
[106,] 0.79975164 0.4004967182 0.2002483591
[107,] 0.79716627 0.4056674644 0.2028337322
[108,] 0.77663737 0.4467252569 0.2233626285
[109,] 0.77427072 0.4514585548 0.2257292774
[110,] 0.74400305 0.5119938952 0.2559969476
[111,] 0.71608517 0.5678296549 0.2839148274
[112,] 0.67524216 0.6495156796 0.3247578398
[113,] 0.73705480 0.5258904015 0.2629452008
[114,] 0.73167358 0.5366528414 0.2683264207
[115,] 0.68718887 0.6256222559 0.3128111279
[116,] 0.64479728 0.7104054370 0.3552027185
[117,] 0.59701483 0.8059703363 0.4029851681
[118,] 0.64413682 0.7117263658 0.3558631829
[119,] 0.61399900 0.7720020064 0.3860010032
[120,] 0.64997901 0.7000419782 0.3500209891
[121,] 0.65191065 0.6961787081 0.3480893541
[122,] 0.60286666 0.7942666805 0.3971333402
[123,] 0.58743385 0.8251323039 0.4125661520
[124,] 0.53212597 0.9357480583 0.4678740292
[125,] 0.57304774 0.8539045139 0.4269522570
[126,] 0.54396628 0.9120674462 0.4560337231
[127,] 0.50712810 0.9857438036 0.4928719018
[128,] 0.47502060 0.9500412084 0.5249793958
[129,] 0.41294369 0.8258873866 0.5870563067
[130,] 0.37846660 0.7569332080 0.6215333960
[131,] 0.67842060 0.6431587954 0.3215793977
[132,] 0.62155107 0.7568978613 0.3784489306
[133,] 0.55936826 0.8812634720 0.4406317360
[134,] 0.50763903 0.9847219490 0.4923609745
[135,] 0.46377564 0.9275512804 0.5362243598
[136,] 0.44593144 0.8918628774 0.5540685613
[137,] 0.43854788 0.8770957615 0.5614521193
[138,] 0.36905905 0.7381180998 0.6309409501
[139,] 0.29736260 0.5947252016 0.7026373992
[140,] 0.25158313 0.5031662615 0.7484168693
[141,] 0.18935981 0.3787196137 0.8106401931
[142,] 0.19076595 0.3815318982 0.8092340509
[143,] 0.28600269 0.5720053774 0.7139973113
[144,] 0.21301369 0.4260273859 0.7869863071
[145,] 0.14607355 0.2921470931 0.8539264534
[146,] 0.23409540 0.4681908008 0.7659045996
[147,] 0.18033196 0.3606639146 0.8196680427
[148,] 0.15686170 0.3137233915 0.8431383042
[149,] 0.09036735 0.1807347086 0.9096326457
> postscript(file="/var/wessaorg/rcomp/tmp/1892q1353346181.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/wessaorg/rcomp/tmp/22tpj1353346181.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/wessaorg/rcomp/tmp/3ucrw1353346181.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/wessaorg/rcomp/tmp/4ntv01353346181.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/wessaorg/rcomp/tmp/5989z1353346181.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.71944518 1.23906512 -1.38754228 -2.56423139 9.42507673 2.10807834
7 8 9 10 11 12
9.33204480 -2.01779858 -2.16705843 0.81783143 -0.52043666 -1.21749870
13 14 15 16 17 18
-0.73002301 2.64730188 -0.15947724 0.94861259 1.16467818 0.33067542
19 20 21 22 23 24
-2.81684313 1.43402730 -3.12309739 -1.25376449 -0.81684313 -0.39965578
25 26 27 28 29 30
0.50699261 -7.25218948 -0.43498592 1.91223275 1.72938407 -2.15020698
31 32 33 34 35 36
-2.52959285 0.99431493 -0.56913563 -1.30699578 0.10981965 -3.58724240
37 38 39 40 41 42
3.18469256 -0.12451902 -0.95872740 -3.63736300 -3.05455034 2.51015554
43 44 45 46 47 48
-3.27377887 -0.36943550 -3.11699007 -2.04664947 -3.15473930 -1.29188564
49 50 51 52 53 54
4.23327747 -2.46999638 -1.69359092 1.01242170 2.75239508 -0.52448300
55 56 57 58 59 60
-3.49426272 -0.05455034 1.73238070 -3.48668153 -4.33584667 0.60929479
61 62 63 64 65 66
2.56512814 -1.51253579 -3.19274639 0.85737421 0.82062245 -4.91865933
67 68 69 70 71 72
1.90465155 -2.48531214 0.87268997 1.74170319 0.17699731 3.25771011
73 74 75 76 77 78
0.65046481 -2.19727871 -2.55844375 4.88916950 2.30324615 3.35647744
79 80 81 82 83 84
0.52842861 -4.41234683 -1.33442505 -1.45009606 -3.25829681 0.65625246
85 86 87 88 89 90
-0.34058461 0.03985097 0.84526070 -1.02395814 1.09171287 3.87280403
91 92 93 94 95 96
2.03232202 1.43260568 0.65662438 2.05496111 -3.86574772 -0.31015871
97 98 99 100 101 102
1.68542303 -1.86275109 0.36705526 -2.38312402 -0.62678518 1.68542303
103 104 105 106 107 108
0.52247467 -4.14125640 3.60176584 2.69911154 -0.33758798 3.99135762
109 110 111 112 113 114
-0.82742095 8.36458393 1.56201745 -0.29630390 -2.95361755 1.94861259
115 116 117 118 119 120
2.09912776 -1.32247784 0.84842363 -0.10287739 -4.04522785 2.17699731
121 122 123 124 125 126
0.44808774 1.02753184 -1.15473930 -4.18216857 -1.22807653 -2.83215889
127 128 129 130 131 132
-2.49300739 -0.39840046 1.59386497 0.82678201 -2.78345992 3.11472388
133 134 135 136 137 138
-2.01480195 2.50099935 -0.18216857 2.49783642 7.79156593 1.00347113
139 140 141 142 143 144
0.61245772 -1.19448769 -1.87469830 -2.34058461 2.29408995 -1.19132476
145 146 147 148 149 150
-0.15531684 -0.15511122 0.54037582 -2.11661815 -3.47299301 2.45561669
151 152 153 154 155 156
0.57733321 3.61845099 -2.59619298 -2.49705373 2.41307728 4.30777846
157 158 159 160 161 162
1.43260568 0.86353377 1.59386497 -4.66479227 3.44192817 2.25012892
> postscript(file="/var/wessaorg/rcomp/tmp/6q03j1353346181.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.71944518 NA
1 1.23906512 -0.71944518
2 -1.38754228 1.23906512
3 -2.56423139 -1.38754228
4 9.42507673 -2.56423139
5 2.10807834 9.42507673
6 9.33204480 2.10807834
7 -2.01779858 9.33204480
8 -2.16705843 -2.01779858
9 0.81783143 -2.16705843
10 -0.52043666 0.81783143
11 -1.21749870 -0.52043666
12 -0.73002301 -1.21749870
13 2.64730188 -0.73002301
14 -0.15947724 2.64730188
15 0.94861259 -0.15947724
16 1.16467818 0.94861259
17 0.33067542 1.16467818
18 -2.81684313 0.33067542
19 1.43402730 -2.81684313
20 -3.12309739 1.43402730
21 -1.25376449 -3.12309739
22 -0.81684313 -1.25376449
23 -0.39965578 -0.81684313
24 0.50699261 -0.39965578
25 -7.25218948 0.50699261
26 -0.43498592 -7.25218948
27 1.91223275 -0.43498592
28 1.72938407 1.91223275
29 -2.15020698 1.72938407
30 -2.52959285 -2.15020698
31 0.99431493 -2.52959285
32 -0.56913563 0.99431493
33 -1.30699578 -0.56913563
34 0.10981965 -1.30699578
35 -3.58724240 0.10981965
36 3.18469256 -3.58724240
37 -0.12451902 3.18469256
38 -0.95872740 -0.12451902
39 -3.63736300 -0.95872740
40 -3.05455034 -3.63736300
41 2.51015554 -3.05455034
42 -3.27377887 2.51015554
43 -0.36943550 -3.27377887
44 -3.11699007 -0.36943550
45 -2.04664947 -3.11699007
46 -3.15473930 -2.04664947
47 -1.29188564 -3.15473930
48 4.23327747 -1.29188564
49 -2.46999638 4.23327747
50 -1.69359092 -2.46999638
51 1.01242170 -1.69359092
52 2.75239508 1.01242170
53 -0.52448300 2.75239508
54 -3.49426272 -0.52448300
55 -0.05455034 -3.49426272
56 1.73238070 -0.05455034
57 -3.48668153 1.73238070
58 -4.33584667 -3.48668153
59 0.60929479 -4.33584667
60 2.56512814 0.60929479
61 -1.51253579 2.56512814
62 -3.19274639 -1.51253579
63 0.85737421 -3.19274639
64 0.82062245 0.85737421
65 -4.91865933 0.82062245
66 1.90465155 -4.91865933
67 -2.48531214 1.90465155
68 0.87268997 -2.48531214
69 1.74170319 0.87268997
70 0.17699731 1.74170319
71 3.25771011 0.17699731
72 0.65046481 3.25771011
73 -2.19727871 0.65046481
74 -2.55844375 -2.19727871
75 4.88916950 -2.55844375
76 2.30324615 4.88916950
77 3.35647744 2.30324615
78 0.52842861 3.35647744
79 -4.41234683 0.52842861
80 -1.33442505 -4.41234683
81 -1.45009606 -1.33442505
82 -3.25829681 -1.45009606
83 0.65625246 -3.25829681
84 -0.34058461 0.65625246
85 0.03985097 -0.34058461
86 0.84526070 0.03985097
87 -1.02395814 0.84526070
88 1.09171287 -1.02395814
89 3.87280403 1.09171287
90 2.03232202 3.87280403
91 1.43260568 2.03232202
92 0.65662438 1.43260568
93 2.05496111 0.65662438
94 -3.86574772 2.05496111
95 -0.31015871 -3.86574772
96 1.68542303 -0.31015871
97 -1.86275109 1.68542303
98 0.36705526 -1.86275109
99 -2.38312402 0.36705526
100 -0.62678518 -2.38312402
101 1.68542303 -0.62678518
102 0.52247467 1.68542303
103 -4.14125640 0.52247467
104 3.60176584 -4.14125640
105 2.69911154 3.60176584
106 -0.33758798 2.69911154
107 3.99135762 -0.33758798
108 -0.82742095 3.99135762
109 8.36458393 -0.82742095
110 1.56201745 8.36458393
111 -0.29630390 1.56201745
112 -2.95361755 -0.29630390
113 1.94861259 -2.95361755
114 2.09912776 1.94861259
115 -1.32247784 2.09912776
116 0.84842363 -1.32247784
117 -0.10287739 0.84842363
118 -4.04522785 -0.10287739
119 2.17699731 -4.04522785
120 0.44808774 2.17699731
121 1.02753184 0.44808774
122 -1.15473930 1.02753184
123 -4.18216857 -1.15473930
124 -1.22807653 -4.18216857
125 -2.83215889 -1.22807653
126 -2.49300739 -2.83215889
127 -0.39840046 -2.49300739
128 1.59386497 -0.39840046
129 0.82678201 1.59386497
130 -2.78345992 0.82678201
131 3.11472388 -2.78345992
132 -2.01480195 3.11472388
133 2.50099935 -2.01480195
134 -0.18216857 2.50099935
135 2.49783642 -0.18216857
136 7.79156593 2.49783642
137 1.00347113 7.79156593
138 0.61245772 1.00347113
139 -1.19448769 0.61245772
140 -1.87469830 -1.19448769
141 -2.34058461 -1.87469830
142 2.29408995 -2.34058461
143 -1.19132476 2.29408995
144 -0.15531684 -1.19132476
145 -0.15511122 -0.15531684
146 0.54037582 -0.15511122
147 -2.11661815 0.54037582
148 -3.47299301 -2.11661815
149 2.45561669 -3.47299301
150 0.57733321 2.45561669
151 3.61845099 0.57733321
152 -2.59619298 3.61845099
153 -2.49705373 -2.59619298
154 2.41307728 -2.49705373
155 4.30777846 2.41307728
156 1.43260568 4.30777846
157 0.86353377 1.43260568
158 1.59386497 0.86353377
159 -4.66479227 1.59386497
160 3.44192817 -4.66479227
161 2.25012892 3.44192817
162 NA 2.25012892
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 1.23906512 -0.71944518
[2,] -1.38754228 1.23906512
[3,] -2.56423139 -1.38754228
[4,] 9.42507673 -2.56423139
[5,] 2.10807834 9.42507673
[6,] 9.33204480 2.10807834
[7,] -2.01779858 9.33204480
[8,] -2.16705843 -2.01779858
[9,] 0.81783143 -2.16705843
[10,] -0.52043666 0.81783143
[11,] -1.21749870 -0.52043666
[12,] -0.73002301 -1.21749870
[13,] 2.64730188 -0.73002301
[14,] -0.15947724 2.64730188
[15,] 0.94861259 -0.15947724
[16,] 1.16467818 0.94861259
[17,] 0.33067542 1.16467818
[18,] -2.81684313 0.33067542
[19,] 1.43402730 -2.81684313
[20,] -3.12309739 1.43402730
[21,] -1.25376449 -3.12309739
[22,] -0.81684313 -1.25376449
[23,] -0.39965578 -0.81684313
[24,] 0.50699261 -0.39965578
[25,] -7.25218948 0.50699261
[26,] -0.43498592 -7.25218948
[27,] 1.91223275 -0.43498592
[28,] 1.72938407 1.91223275
[29,] -2.15020698 1.72938407
[30,] -2.52959285 -2.15020698
[31,] 0.99431493 -2.52959285
[32,] -0.56913563 0.99431493
[33,] -1.30699578 -0.56913563
[34,] 0.10981965 -1.30699578
[35,] -3.58724240 0.10981965
[36,] 3.18469256 -3.58724240
[37,] -0.12451902 3.18469256
[38,] -0.95872740 -0.12451902
[39,] -3.63736300 -0.95872740
[40,] -3.05455034 -3.63736300
[41,] 2.51015554 -3.05455034
[42,] -3.27377887 2.51015554
[43,] -0.36943550 -3.27377887
[44,] -3.11699007 -0.36943550
[45,] -2.04664947 -3.11699007
[46,] -3.15473930 -2.04664947
[47,] -1.29188564 -3.15473930
[48,] 4.23327747 -1.29188564
[49,] -2.46999638 4.23327747
[50,] -1.69359092 -2.46999638
[51,] 1.01242170 -1.69359092
[52,] 2.75239508 1.01242170
[53,] -0.52448300 2.75239508
[54,] -3.49426272 -0.52448300
[55,] -0.05455034 -3.49426272
[56,] 1.73238070 -0.05455034
[57,] -3.48668153 1.73238070
[58,] -4.33584667 -3.48668153
[59,] 0.60929479 -4.33584667
[60,] 2.56512814 0.60929479
[61,] -1.51253579 2.56512814
[62,] -3.19274639 -1.51253579
[63,] 0.85737421 -3.19274639
[64,] 0.82062245 0.85737421
[65,] -4.91865933 0.82062245
[66,] 1.90465155 -4.91865933
[67,] -2.48531214 1.90465155
[68,] 0.87268997 -2.48531214
[69,] 1.74170319 0.87268997
[70,] 0.17699731 1.74170319
[71,] 3.25771011 0.17699731
[72,] 0.65046481 3.25771011
[73,] -2.19727871 0.65046481
[74,] -2.55844375 -2.19727871
[75,] 4.88916950 -2.55844375
[76,] 2.30324615 4.88916950
[77,] 3.35647744 2.30324615
[78,] 0.52842861 3.35647744
[79,] -4.41234683 0.52842861
[80,] -1.33442505 -4.41234683
[81,] -1.45009606 -1.33442505
[82,] -3.25829681 -1.45009606
[83,] 0.65625246 -3.25829681
[84,] -0.34058461 0.65625246
[85,] 0.03985097 -0.34058461
[86,] 0.84526070 0.03985097
[87,] -1.02395814 0.84526070
[88,] 1.09171287 -1.02395814
[89,] 3.87280403 1.09171287
[90,] 2.03232202 3.87280403
[91,] 1.43260568 2.03232202
[92,] 0.65662438 1.43260568
[93,] 2.05496111 0.65662438
[94,] -3.86574772 2.05496111
[95,] -0.31015871 -3.86574772
[96,] 1.68542303 -0.31015871
[97,] -1.86275109 1.68542303
[98,] 0.36705526 -1.86275109
[99,] -2.38312402 0.36705526
[100,] -0.62678518 -2.38312402
[101,] 1.68542303 -0.62678518
[102,] 0.52247467 1.68542303
[103,] -4.14125640 0.52247467
[104,] 3.60176584 -4.14125640
[105,] 2.69911154 3.60176584
[106,] -0.33758798 2.69911154
[107,] 3.99135762 -0.33758798
[108,] -0.82742095 3.99135762
[109,] 8.36458393 -0.82742095
[110,] 1.56201745 8.36458393
[111,] -0.29630390 1.56201745
[112,] -2.95361755 -0.29630390
[113,] 1.94861259 -2.95361755
[114,] 2.09912776 1.94861259
[115,] -1.32247784 2.09912776
[116,] 0.84842363 -1.32247784
[117,] -0.10287739 0.84842363
[118,] -4.04522785 -0.10287739
[119,] 2.17699731 -4.04522785
[120,] 0.44808774 2.17699731
[121,] 1.02753184 0.44808774
[122,] -1.15473930 1.02753184
[123,] -4.18216857 -1.15473930
[124,] -1.22807653 -4.18216857
[125,] -2.83215889 -1.22807653
[126,] -2.49300739 -2.83215889
[127,] -0.39840046 -2.49300739
[128,] 1.59386497 -0.39840046
[129,] 0.82678201 1.59386497
[130,] -2.78345992 0.82678201
[131,] 3.11472388 -2.78345992
[132,] -2.01480195 3.11472388
[133,] 2.50099935 -2.01480195
[134,] -0.18216857 2.50099935
[135,] 2.49783642 -0.18216857
[136,] 7.79156593 2.49783642
[137,] 1.00347113 7.79156593
[138,] 0.61245772 1.00347113
[139,] -1.19448769 0.61245772
[140,] -1.87469830 -1.19448769
[141,] -2.34058461 -1.87469830
[142,] 2.29408995 -2.34058461
[143,] -1.19132476 2.29408995
[144,] -0.15531684 -1.19132476
[145,] -0.15511122 -0.15531684
[146,] 0.54037582 -0.15511122
[147,] -2.11661815 0.54037582
[148,] -3.47299301 -2.11661815
[149,] 2.45561669 -3.47299301
[150,] 0.57733321 2.45561669
[151,] 3.61845099 0.57733321
[152,] -2.59619298 3.61845099
[153,] -2.49705373 -2.59619298
[154,] 2.41307728 -2.49705373
[155,] 4.30777846 2.41307728
[156,] 1.43260568 4.30777846
[157,] 0.86353377 1.43260568
[158,] 1.59386497 0.86353377
[159,] -4.66479227 1.59386497
[160,] 3.44192817 -4.66479227
[161,] 2.25012892 3.44192817
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 1.23906512 -0.71944518
2 -1.38754228 1.23906512
3 -2.56423139 -1.38754228
4 9.42507673 -2.56423139
5 2.10807834 9.42507673
6 9.33204480 2.10807834
7 -2.01779858 9.33204480
8 -2.16705843 -2.01779858
9 0.81783143 -2.16705843
10 -0.52043666 0.81783143
11 -1.21749870 -0.52043666
12 -0.73002301 -1.21749870
13 2.64730188 -0.73002301
14 -0.15947724 2.64730188
15 0.94861259 -0.15947724
16 1.16467818 0.94861259
17 0.33067542 1.16467818
18 -2.81684313 0.33067542
19 1.43402730 -2.81684313
20 -3.12309739 1.43402730
21 -1.25376449 -3.12309739
22 -0.81684313 -1.25376449
23 -0.39965578 -0.81684313
24 0.50699261 -0.39965578
25 -7.25218948 0.50699261
26 -0.43498592 -7.25218948
27 1.91223275 -0.43498592
28 1.72938407 1.91223275
29 -2.15020698 1.72938407
30 -2.52959285 -2.15020698
31 0.99431493 -2.52959285
32 -0.56913563 0.99431493
33 -1.30699578 -0.56913563
34 0.10981965 -1.30699578
35 -3.58724240 0.10981965
36 3.18469256 -3.58724240
37 -0.12451902 3.18469256
38 -0.95872740 -0.12451902
39 -3.63736300 -0.95872740
40 -3.05455034 -3.63736300
41 2.51015554 -3.05455034
42 -3.27377887 2.51015554
43 -0.36943550 -3.27377887
44 -3.11699007 -0.36943550
45 -2.04664947 -3.11699007
46 -3.15473930 -2.04664947
47 -1.29188564 -3.15473930
48 4.23327747 -1.29188564
49 -2.46999638 4.23327747
50 -1.69359092 -2.46999638
51 1.01242170 -1.69359092
52 2.75239508 1.01242170
53 -0.52448300 2.75239508
54 -3.49426272 -0.52448300
55 -0.05455034 -3.49426272
56 1.73238070 -0.05455034
57 -3.48668153 1.73238070
58 -4.33584667 -3.48668153
59 0.60929479 -4.33584667
60 2.56512814 0.60929479
61 -1.51253579 2.56512814
62 -3.19274639 -1.51253579
63 0.85737421 -3.19274639
64 0.82062245 0.85737421
65 -4.91865933 0.82062245
66 1.90465155 -4.91865933
67 -2.48531214 1.90465155
68 0.87268997 -2.48531214
69 1.74170319 0.87268997
70 0.17699731 1.74170319
71 3.25771011 0.17699731
72 0.65046481 3.25771011
73 -2.19727871 0.65046481
74 -2.55844375 -2.19727871
75 4.88916950 -2.55844375
76 2.30324615 4.88916950
77 3.35647744 2.30324615
78 0.52842861 3.35647744
79 -4.41234683 0.52842861
80 -1.33442505 -4.41234683
81 -1.45009606 -1.33442505
82 -3.25829681 -1.45009606
83 0.65625246 -3.25829681
84 -0.34058461 0.65625246
85 0.03985097 -0.34058461
86 0.84526070 0.03985097
87 -1.02395814 0.84526070
88 1.09171287 -1.02395814
89 3.87280403 1.09171287
90 2.03232202 3.87280403
91 1.43260568 2.03232202
92 0.65662438 1.43260568
93 2.05496111 0.65662438
94 -3.86574772 2.05496111
95 -0.31015871 -3.86574772
96 1.68542303 -0.31015871
97 -1.86275109 1.68542303
98 0.36705526 -1.86275109
99 -2.38312402 0.36705526
100 -0.62678518 -2.38312402
101 1.68542303 -0.62678518
102 0.52247467 1.68542303
103 -4.14125640 0.52247467
104 3.60176584 -4.14125640
105 2.69911154 3.60176584
106 -0.33758798 2.69911154
107 3.99135762 -0.33758798
108 -0.82742095 3.99135762
109 8.36458393 -0.82742095
110 1.56201745 8.36458393
111 -0.29630390 1.56201745
112 -2.95361755 -0.29630390
113 1.94861259 -2.95361755
114 2.09912776 1.94861259
115 -1.32247784 2.09912776
116 0.84842363 -1.32247784
117 -0.10287739 0.84842363
118 -4.04522785 -0.10287739
119 2.17699731 -4.04522785
120 0.44808774 2.17699731
121 1.02753184 0.44808774
122 -1.15473930 1.02753184
123 -4.18216857 -1.15473930
124 -1.22807653 -4.18216857
125 -2.83215889 -1.22807653
126 -2.49300739 -2.83215889
127 -0.39840046 -2.49300739
128 1.59386497 -0.39840046
129 0.82678201 1.59386497
130 -2.78345992 0.82678201
131 3.11472388 -2.78345992
132 -2.01480195 3.11472388
133 2.50099935 -2.01480195
134 -0.18216857 2.50099935
135 2.49783642 -0.18216857
136 7.79156593 2.49783642
137 1.00347113 7.79156593
138 0.61245772 1.00347113
139 -1.19448769 0.61245772
140 -1.87469830 -1.19448769
141 -2.34058461 -1.87469830
142 2.29408995 -2.34058461
143 -1.19132476 2.29408995
144 -0.15531684 -1.19132476
145 -0.15511122 -0.15531684
146 0.54037582 -0.15511122
147 -2.11661815 0.54037582
148 -3.47299301 -2.11661815
149 2.45561669 -3.47299301
150 0.57733321 2.45561669
151 3.61845099 0.57733321
152 -2.59619298 3.61845099
153 -2.49705373 -2.59619298
154 2.41307728 -2.49705373
155 4.30777846 2.41307728
156 1.43260568 4.30777846
157 0.86353377 1.43260568
158 1.59386497 0.86353377
159 -4.66479227 1.59386497
160 3.44192817 -4.66479227
161 2.25012892 3.44192817
> 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/wessaorg/rcomp/tmp/7dfyt1353346181.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/wessaorg/rcomp/tmp/8e4vq1353346181.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/wessaorg/rcomp/tmp/9zz5y1353346181.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/wessaorg/rcomp/tmp/10siuk1353346181.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/wessaorg/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/wessaorg/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/wessaorg/rcomp/tmp/11enig1353346181.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/wessaorg/rcomp/tmp/12mke81353346181.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/wessaorg/rcomp/tmp/136k5c1353346181.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/wessaorg/rcomp/tmp/14ei0r1353346181.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/wessaorg/rcomp/tmp/1593p81353346181.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/wessaorg/rcomp/tmp/16nv5w1353346181.tab")
+ }
>
> try(system("convert tmp/1892q1353346181.ps tmp/1892q1353346181.png",intern=TRUE))
character(0)
> try(system("convert tmp/22tpj1353346181.ps tmp/22tpj1353346181.png",intern=TRUE))
character(0)
> try(system("convert tmp/3ucrw1353346181.ps tmp/3ucrw1353346181.png",intern=TRUE))
character(0)
> try(system("convert tmp/4ntv01353346181.ps tmp/4ntv01353346181.png",intern=TRUE))
character(0)
> try(system("convert tmp/5989z1353346181.ps tmp/5989z1353346181.png",intern=TRUE))
character(0)
> try(system("convert tmp/6q03j1353346181.ps tmp/6q03j1353346181.png",intern=TRUE))
character(0)
> try(system("convert tmp/7dfyt1353346181.ps tmp/7dfyt1353346181.png",intern=TRUE))
character(0)
> try(system("convert tmp/8e4vq1353346181.ps tmp/8e4vq1353346181.png",intern=TRUE))
character(0)
> try(system("convert tmp/9zz5y1353346181.ps tmp/9zz5y1353346181.png",intern=TRUE))
character(0)
> try(system("convert tmp/10siuk1353346181.ps tmp/10siuk1353346181.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
7.233 1.118 8.400