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(7
+ ,3
+ ,2
+ ,3
+ ,7
+ ,6
+ ,7
+ ,5
+ ,6
+ ,0
+ ,7
+ ,7
+ ,6
+ ,6
+ ,6
+ ,0
+ ,8
+ ,8
+ ,6
+ ,6
+ ,6
+ ,6
+ ,9
+ ,8
+ ,8
+ ,7
+ ,8
+ ,5
+ ,5
+ ,9
+ ,8
+ ,3
+ ,1
+ ,0
+ ,7
+ ,8
+ ,8
+ ,2
+ ,9
+ ,8
+ ,8
+ ,8
+ ,5
+ ,4
+ ,4
+ ,0
+ ,7
+ ,7
+ ,4
+ ,7
+ ,7
+ ,0
+ ,8
+ ,7
+ ,9
+ ,4
+ ,4
+ ,9
+ ,8
+ ,4
+ ,6
+ ,6
+ ,6
+ ,6
+ ,6
+ ,6
+ ,6
+ ,6
+ ,5
+ ,6
+ ,4
+ ,7
+ ,5
+ ,7
+ ,7
+ ,5
+ ,8
+ ,5
+ ,6
+ ,4
+ ,5
+ ,4
+ ,8
+ ,8
+ ,2
+ ,6
+ ,6
+ ,0
+ ,7
+ ,5
+ ,4
+ ,5
+ ,5
+ ,0
+ ,9
+ ,4
+ ,2
+ ,0
+ ,2
+ ,2
+ ,2
+ ,9
+ ,6
+ ,9
+ ,9
+ ,6
+ ,8
+ ,8
+ ,7
+ ,4
+ ,4
+ ,0
+ ,8
+ ,4
+ ,8
+ ,2
+ ,4
+ ,4
+ ,4
+ ,6
+ ,5
+ ,2
+ ,5
+ ,5
+ ,5
+ ,6
+ ,7
+ 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onal Dummies'
> par1 = '1'
> 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
Schoolprestaties Sport GoingOut Relation Friends Job
1 7 3 2 3 7 6
2 7 5 6 0 7 7
3 6 6 6 0 8 8
4 6 6 6 6 9 8
5 8 7 8 5 5 9
6 8 3 1 0 7 8
7 8 2 9 8 8 8
8 5 4 4 0 7 7
9 4 7 7 0 8 7
10 9 4 4 9 8 4
11 6 6 6 6 6 6
12 6 6 5 6 4 7
13 5 7 7 5 8 5
14 6 4 5 4 8 8
15 2 6 6 0 7 5
16 4 5 5 0 9 4
17 2 0 2 2 2 9
18 6 9 9 6 8 8
19 7 4 4 0 8 4
20 8 2 4 4 4 6
21 5 2 5 5 5 6
22 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7 7 0 5 6
96 8 4 4 5 9 7
97 6 0 5 6 6 6
98 3 3 2 0 7 7
99 5 5 5 5 5 5
100 9 6 2 9 2 9
101 7 5 5 0 7 7
102 7 7 7 7 7 7
103 6 6 5 1 6 6
104 3 8 8 3 8 6
105 7 7 2 7 9 9
106 8 8 8 8 8 9
107 3 3 3 0 3 8
108 5 8 2 5 5 8
109 8 3 3 3 7 3
110 7 4 5 0 8 6
111 5 2 2 5 5 5
112 7 7 2 7 9 7
113 6 6 6 0 6 6
114 7 2 2 0 7 7
115 9 7 7 0 7 7
116 6 6 6 6 6 6
117 6 6 2 0 3 8
118 6 6 2 6 9 9
119 6 6 5 6 6 6
120 2 6 6 2 2 9
121 5 4 4 5 5 5
122 5 2 5 0 5 6
123 4 7 7 4 9 4
124 7 6 6 0 7 7
125 6 6 6 6 6 6
126 5 5 5 5 8 8
127 8 8 2 8 8 8
128 7 6 6 6 6 9
129 5 0 3 5 3 8
130 4 4 2 0 7 4
131 8 8 8 8 9 6
132 6 6 6 0 7 6
133 9 4 4 9 4 7
134 5 6 6 5 5 9
135 6 2 5 0 6 8
136 4 4 4 0 4 4
137 6 2 2 0 6 6
138 3 3 3 3 7 9
139 6 6 6 6 6 6
140 5 5 5 0 5 5
141 4 4 4 4 9 8
142 6 6 6 6 6 6
143 5 1 1 0 9 6
144 4 4 5 4 3 6
145 7 4 2 7 7 7
146 6 6 6 0 6 7
147 7 5 5 5 5 9
148 6 9 2 6 6 6
149 6 6 6 6 9 6
150 8 8 8 8 8 6
151 7 7 7 2 7 4
152 7 7 7 7 7 7
153 4 0 9 0 4 8
154 6 2 2 0 8 7
155 5 6 6 5 5 9
156 2 5 5 0 9 6
> k <- length(x[1,])
> df <- as.data.frame(x)
> (mylm <- lm(df))
Call:
lm(formula = df)
Coefficients:
(Intercept) Sport GoingOut Relation Friends Job
3.40800 0.04877 -0.02654 0.16906 0.12010 0.14835
> (mysum <- summary(mylm))
Call:
lm(formula = df)
Residuals:
Min 1Q Median 3Q Max
-4.0553 -0.8354 -0.0266 0.8554 3.7152
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.40800 0.74136 4.597 9.04e-06 ***
Sport 0.04877 0.07168 0.680 0.497279
GoingOut -0.02654 0.06481 -0.410 0.682722
Relation 0.16906 0.04329 3.905 0.000142 ***
Friends 0.12010 0.06875 1.747 0.082729 .
Job 0.14835 0.07739 1.917 0.057149 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 1.505 on 150 degrees of freedom
Multiple R-squared: 0.1527, Adjusted R-squared: 0.1244
F-statistic: 5.405 on 5 and 150 DF, p-value: 0.0001337
> 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.35612095 0.71224189 0.64387905
[2,] 0.40895758 0.81791515 0.59104242
[3,] 0.43066035 0.86132070 0.56933965
[4,] 0.45347725 0.90695451 0.54652275
[5,] 0.34489585 0.68979170 0.65510415
[6,] 0.30692854 0.61385708 0.69307146
[7,] 0.46009731 0.92019462 0.53990269
[8,] 0.36981078 0.73962156 0.63018922
[9,] 0.82434790 0.35130421 0.17565210
[10,] 0.79787822 0.40424355 0.20212178
[11,] 0.85543670 0.28912659 0.14456330
[12,] 0.91516899 0.16966202 0.08483101
[13,] 0.89516712 0.20966576 0.10483288
[14,] 0.85844794 0.28310413 0.14155206
[15,] 0.83780116 0.32439768 0.16219884
[16,] 0.80199678 0.39600645 0.19800322
[17,] 0.75104021 0.49791958 0.24895979
[18,] 0.69463337 0.61073325 0.30536663
[19,] 0.65101431 0.69797137 0.34898569
[20,] 0.64824686 0.70350628 0.35175314
[21,] 0.76006922 0.47986157 0.23993078
[22,] 0.74764030 0.50471940 0.25235970
[23,] 0.78196289 0.43607422 0.21803711
[24,] 0.74488088 0.51023823 0.25511912
[25,] 0.69461780 0.61076441 0.30538220
[26,] 0.65750493 0.68499013 0.34249507
[27,] 0.61644889 0.76710221 0.38355111
[28,] 0.65890751 0.68218498 0.34109249
[29,] 0.63329131 0.73341738 0.36670869
[30,] 0.58706683 0.82586633 0.41293317
[31,] 0.53360133 0.93279734 0.46639867
[32,] 0.50341062 0.99317876 0.49658938
[33,] 0.46838922 0.93677845 0.53161078
[34,] 0.47132606 0.94265212 0.52867394
[35,] 0.44229671 0.88459342 0.55770329
[36,] 0.43238867 0.86477733 0.56761133
[37,] 0.38035004 0.76070008 0.61964996
[38,] 0.33513102 0.67026204 0.66486898
[39,] 0.31451060 0.62902120 0.68548940
[40,] 0.31329932 0.62659864 0.68670068
[41,] 0.34938413 0.69876826 0.65061587
[42,] 0.30343914 0.60687828 0.69656086
[43,] 0.26840292 0.53680584 0.73159708
[44,] 0.22962405 0.45924811 0.77037595
[45,] 0.19534095 0.39068191 0.80465905
[46,] 0.18454259 0.36908519 0.81545741
[47,] 0.16795359 0.33590717 0.83204641
[48,] 0.14892052 0.29784103 0.85107948
[49,] 0.13593477 0.27186954 0.86406523
[50,] 0.15476261 0.30952523 0.84523739
[51,] 0.21347924 0.42695848 0.78652076
[52,] 0.19424231 0.38848463 0.80575769
[53,] 0.22656475 0.45312950 0.77343525
[54,] 0.19674946 0.39349892 0.80325054
[55,] 0.18325976 0.36651952 0.81674024
[56,] 0.15621775 0.31243550 0.84378225
[57,] 0.12896046 0.25792093 0.87103954
[58,] 0.10569226 0.21138453 0.89430774
[59,] 0.08870993 0.17741986 0.91129007
[60,] 0.07619602 0.15239204 0.92380398
[61,] 0.06113981 0.12227963 0.93886019
[62,] 0.05132144 0.10264288 0.94867856
[63,] 0.04324086 0.08648173 0.95675914
[64,] 0.03603650 0.07207301 0.96396350
[65,] 0.03559134 0.07118267 0.96440866
[66,] 0.02978849 0.05957698 0.97021151
[67,] 0.02270485 0.04540969 0.97729515
[68,] 0.08368694 0.16737389 0.91631306
[69,] 0.15647832 0.31295665 0.84352168
[70,] 0.13513978 0.27027956 0.86486022
[71,] 0.11315320 0.22630639 0.88684680
[72,] 0.10557439 0.21114878 0.89442561
[73,] 0.11392796 0.22785593 0.88607204
[74,] 0.09679983 0.19359965 0.90320017
[75,] 0.08461522 0.16923043 0.91538478
[76,] 0.07942757 0.15885515 0.92057243
[77,] 0.18119147 0.36238294 0.81880853
[78,] 0.16061498 0.32122997 0.83938502
[79,] 0.18379644 0.36759288 0.81620356
[80,] 0.22508517 0.45017033 0.77491483
[81,] 0.28698366 0.57396731 0.71301634
[82,] 0.35923177 0.71846355 0.64076823
[83,] 0.62211542 0.75576915 0.37788458
[84,] 0.57756417 0.84487166 0.42243583
[85,] 0.53017451 0.93965099 0.46982549
[86,] 0.48477043 0.96954085 0.51522957
[87,] 0.43656216 0.87312432 0.56343784
[88,] 0.44176271 0.88352541 0.55823729
[89,] 0.39471471 0.78942942 0.60528529
[90,] 0.45276472 0.90552944 0.54723528
[91,] 0.41997808 0.83995616 0.58002192
[92,] 0.49788811 0.99577622 0.50211189
[93,] 0.50755469 0.98489062 0.49244531
[94,] 0.46089297 0.92178594 0.53910703
[95,] 0.41997002 0.83994004 0.58002998
[96,] 0.58516777 0.82966446 0.41483223
[97,] 0.53791329 0.92417342 0.46208671
[98,] 0.50679745 0.98640510 0.49320255
[99,] 0.52596053 0.94807893 0.47403947
[100,] 0.50826356 0.98347288 0.49173644
[101,] 0.59765386 0.80469228 0.40234614
[102,] 0.60912184 0.78175632 0.39087816
[103,] 0.56283204 0.87433593 0.43716796
[104,] 0.50991458 0.98017083 0.49008542
[105,] 0.46842495 0.93684989 0.53157505
[106,] 0.51264965 0.97470070 0.48735035
[107,] 0.77554189 0.44891622 0.22445811
[108,] 0.73195328 0.53609344 0.26804672
[109,] 0.72731915 0.54536170 0.27268085
[110,] 0.68597877 0.62804246 0.31402123
[111,] 0.63434805 0.73130390 0.36565195
[112,] 0.81487080 0.37025839 0.18512920
[113,] 0.78729315 0.42541369 0.21270685
[114,] 0.74407424 0.51185152 0.25592576
[115,] 0.79196860 0.41606279 0.20803140
[116,] 0.83537664 0.32924671 0.16462336
[117,] 0.79877984 0.40244032 0.20122016
[118,] 0.77914220 0.44171559 0.22085780
[119,] 0.75604958 0.48790084 0.24395042
[120,] 0.72133114 0.55733773 0.27866886
[121,] 0.67781270 0.64437460 0.32218730
[122,] 0.64670404 0.70659193 0.35329596
[123,] 0.60298827 0.79402345 0.39701173
[124,] 0.58878154 0.82243693 0.41121846
[125,] 0.63835077 0.72329846 0.36164923
[126,] 0.57977806 0.84044388 0.42022194
[127,] 0.59657809 0.80684382 0.40342191
[128,] 0.57218736 0.85562529 0.42781264
[129,] 0.55696361 0.88607278 0.44303639
[130,] 0.61241952 0.77516097 0.38758048
[131,] 0.52816940 0.94366120 0.47183060
[132,] 0.43554301 0.87108603 0.56445699
[133,] 0.46927237 0.93854473 0.53072763
[134,] 0.37354846 0.74709692 0.62645154
[135,] 0.28160942 0.56321884 0.71839058
[136,] 0.36352939 0.72705878 0.63647061
[137,] 0.25594309 0.51188618 0.74405691
[138,] 0.36090940 0.72181881 0.63909060
[139,] 0.33532509 0.67065017 0.66467491
> postscript(file="/var/www/rcomp/tmp/11ha31324485973.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/24zzi1324485973.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/3ip6a1324485973.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/4r2q41324485973.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/5swnw1324485973.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 = 156
Frequency = 1
1 2 3 4 5 6
1.260808296 1.628252751 0.311032748 -0.823412893 1.681984888 2.444736863
7 8 9 10 11 12
1.233279081 -0.376058148 -1.562845373 2.427378625 -0.166422057 -0.101125638
13 14 15 16 17 18
-1.111432290 -0.294197973 -3.123814390 -1.193421708 -3.268398002 -0.770009608
19 20 21 22 23 24
1.948904204 2.553890986 -0.708721111 0.373841098 -0.770265906 -1.358101651
25 26 27 28 29 30
-0.166422057 -0.166422057 1.210893151 1.773819182 2.524681703 -1.614656307
31 32 33 34 35 36
-1.727329387 0.557517047 0.347299543 -0.393545686 1.096060797 -1.512028583
37 38 39 40 41 42
0.847928329 -0.706685212 0.519620600 1.149525769 0.877901335 2.124646930
43 44 45 46 47 48
1.322673265 -1.141894262 -0.139880502 -0.583551235 -0.812851433 -1.398288804
49 50 51 52 53 54
1.898416267 0.190937494 -0.077499430 0.127623965 0.138606776 -1.300031478
55 56 57 58 59 60
-1.111432290 -0.659185176 -1.224717711 2.086212240 2.634057574 1.062456789
61 62 63 64 65 66
-2.214509431 0.745241728 1.043017178 -0.370132702 0.081212767 -0.221678988
67 68 69 70 71 72
0.222120988 0.647074154 0.382164861 -0.639993242 -0.877268404 0.902735843
73 74 75 76 77 78
-1.199678753 -0.632874043 -0.121960743 3.715220553 2.990254241 -0.383671254
79 80 81 82 83 84
0.387449958 0.793390790 -1.673926102 0.333263405 -0.835082090 -1.151742819
85 86 87 88 89 90
-3.277803010 0.847928329 -1.927049308 2.320376126 2.288802092 -2.522175175
91 92 93 94 95 96
-4.055341328 0.351610441 0.105393308 0.370473524 -0.054207073 1.538459354
97 98 99 100 101 102
0.099669660 -2.380369046 -0.706685212 2.255559942 1.601711196 0.373841098
103 104 105 106 107 108
0.652328376 -2.943898687 -0.295762259 0.765751718 -2.021799007 -1.377684121
109 110 111 112 113 114
2.732407458 1.678740688 -0.639993242 0.000942812 0.847928329 1.668403166
115 116 117 118 119 120
3.557249882 -0.166422057 0.805342801 -1.077931649 -0.192963612 -3.454865053
121 122 123 124 125 126
-0.684454555 0.136570877 -1.914116612 1.579480539 -0.166422057 -1.512028583
127 128 129 130 131 132
0.754854921 0.388520337 -0.720774359 -0.984083652 1.090714070 0.727833074
133 134 135 136 137 138
2.462702038 -1.322326011 0.719770551 -0.570714777 0.936850956 -3.157707755
139 140 141 142 143 144
-0.166422057 0.138606776 -2.440834784 -0.166422057 -0.401204152 -1.397016628
145 146 147 148 149 150
0.387449958 0.699575794 0.699904646 -0.418904915 -0.526707822 1.210809324
151 152 153 154 155 156
1.664190693 0.373841098 -0.836328294 0.548307911 -1.322326011 -3.490126779
> postscript(file="/var/www/rcomp/tmp/6pt1l1324485973.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 = 156
Frequency = 1
lag(myerror, k = 1) myerror
0 1.260808296 NA
1 1.628252751 1.260808296
2 0.311032748 1.628252751
3 -0.823412893 0.311032748
4 1.681984888 -0.823412893
5 2.444736863 1.681984888
6 1.233279081 2.444736863
7 -0.376058148 1.233279081
8 -1.562845373 -0.376058148
9 2.427378625 -1.562845373
10 -0.166422057 2.427378625
11 -0.101125638 -0.166422057
12 -1.111432290 -0.101125638
13 -0.294197973 -1.111432290
14 -3.123814390 -0.294197973
15 -1.193421708 -3.123814390
16 -3.268398002 -1.193421708
17 -0.770009608 -3.268398002
18 1.948904204 -0.770009608
19 2.553890986 1.948904204
20 -0.708721111 2.553890986
21 0.373841098 -0.708721111
22 -0.770265906 0.373841098
23 -1.358101651 -0.770265906
24 -0.166422057 -1.358101651
25 -0.166422057 -0.166422057
26 1.210893151 -0.166422057
27 1.773819182 1.210893151
28 2.524681703 1.773819182
29 -1.614656307 2.524681703
30 -1.727329387 -1.614656307
31 0.557517047 -1.727329387
32 0.347299543 0.557517047
33 -0.393545686 0.347299543
34 1.096060797 -0.393545686
35 -1.512028583 1.096060797
36 0.847928329 -1.512028583
37 -0.706685212 0.847928329
38 0.519620600 -0.706685212
39 1.149525769 0.519620600
40 0.877901335 1.149525769
41 2.124646930 0.877901335
42 1.322673265 2.124646930
43 -1.141894262 1.322673265
44 -0.139880502 -1.141894262
45 -0.583551235 -0.139880502
46 -0.812851433 -0.583551235
47 -1.398288804 -0.812851433
48 1.898416267 -1.398288804
49 0.190937494 1.898416267
50 -0.077499430 0.190937494
51 0.127623965 -0.077499430
52 0.138606776 0.127623965
53 -1.300031478 0.138606776
54 -1.111432290 -1.300031478
55 -0.659185176 -1.111432290
56 -1.224717711 -0.659185176
57 2.086212240 -1.224717711
58 2.634057574 2.086212240
59 1.062456789 2.634057574
60 -2.214509431 1.062456789
61 0.745241728 -2.214509431
62 1.043017178 0.745241728
63 -0.370132702 1.043017178
64 0.081212767 -0.370132702
65 -0.221678988 0.081212767
66 0.222120988 -0.221678988
67 0.647074154 0.222120988
68 0.382164861 0.647074154
69 -0.639993242 0.382164861
70 -0.877268404 -0.639993242
71 0.902735843 -0.877268404
72 -1.199678753 0.902735843
73 -0.632874043 -1.199678753
74 -0.121960743 -0.632874043
75 3.715220553 -0.121960743
76 2.990254241 3.715220553
77 -0.383671254 2.990254241
78 0.387449958 -0.383671254
79 0.793390790 0.387449958
80 -1.673926102 0.793390790
81 0.333263405 -1.673926102
82 -0.835082090 0.333263405
83 -1.151742819 -0.835082090
84 -3.277803010 -1.151742819
85 0.847928329 -3.277803010
86 -1.927049308 0.847928329
87 2.320376126 -1.927049308
88 2.288802092 2.320376126
89 -2.522175175 2.288802092
90 -4.055341328 -2.522175175
91 0.351610441 -4.055341328
92 0.105393308 0.351610441
93 0.370473524 0.105393308
94 -0.054207073 0.370473524
95 1.538459354 -0.054207073
96 0.099669660 1.538459354
97 -2.380369046 0.099669660
98 -0.706685212 -2.380369046
99 2.255559942 -0.706685212
100 1.601711196 2.255559942
101 0.373841098 1.601711196
102 0.652328376 0.373841098
103 -2.943898687 0.652328376
104 -0.295762259 -2.943898687
105 0.765751718 -0.295762259
106 -2.021799007 0.765751718
107 -1.377684121 -2.021799007
108 2.732407458 -1.377684121
109 1.678740688 2.732407458
110 -0.639993242 1.678740688
111 0.000942812 -0.639993242
112 0.847928329 0.000942812
113 1.668403166 0.847928329
114 3.557249882 1.668403166
115 -0.166422057 3.557249882
116 0.805342801 -0.166422057
117 -1.077931649 0.805342801
118 -0.192963612 -1.077931649
119 -3.454865053 -0.192963612
120 -0.684454555 -3.454865053
121 0.136570877 -0.684454555
122 -1.914116612 0.136570877
123 1.579480539 -1.914116612
124 -0.166422057 1.579480539
125 -1.512028583 -0.166422057
126 0.754854921 -1.512028583
127 0.388520337 0.754854921
128 -0.720774359 0.388520337
129 -0.984083652 -0.720774359
130 1.090714070 -0.984083652
131 0.727833074 1.090714070
132 2.462702038 0.727833074
133 -1.322326011 2.462702038
134 0.719770551 -1.322326011
135 -0.570714777 0.719770551
136 0.936850956 -0.570714777
137 -3.157707755 0.936850956
138 -0.166422057 -3.157707755
139 0.138606776 -0.166422057
140 -2.440834784 0.138606776
141 -0.166422057 -2.440834784
142 -0.401204152 -0.166422057
143 -1.397016628 -0.401204152
144 0.387449958 -1.397016628
145 0.699575794 0.387449958
146 0.699904646 0.699575794
147 -0.418904915 0.699904646
148 -0.526707822 -0.418904915
149 1.210809324 -0.526707822
150 1.664190693 1.210809324
151 0.373841098 1.664190693
152 -0.836328294 0.373841098
153 0.548307911 -0.836328294
154 -1.322326011 0.548307911
155 -3.490126779 -1.322326011
156 NA -3.490126779
> dum1 <- dum[2:length(myerror),]
> dum1
lag(myerror, k = 1) myerror
[1,] 1.628252751 1.260808296
[2,] 0.311032748 1.628252751
[3,] -0.823412893 0.311032748
[4,] 1.681984888 -0.823412893
[5,] 2.444736863 1.681984888
[6,] 1.233279081 2.444736863
[7,] -0.376058148 1.233279081
[8,] -1.562845373 -0.376058148
[9,] 2.427378625 -1.562845373
[10,] -0.166422057 2.427378625
[11,] -0.101125638 -0.166422057
[12,] -1.111432290 -0.101125638
[13,] -0.294197973 -1.111432290
[14,] -3.123814390 -0.294197973
[15,] -1.193421708 -3.123814390
[16,] -3.268398002 -1.193421708
[17,] -0.770009608 -3.268398002
[18,] 1.948904204 -0.770009608
[19,] 2.553890986 1.948904204
[20,] -0.708721111 2.553890986
[21,] 0.373841098 -0.708721111
[22,] -0.770265906 0.373841098
[23,] -1.358101651 -0.770265906
[24,] -0.166422057 -1.358101651
[25,] -0.166422057 -0.166422057
[26,] 1.210893151 -0.166422057
[27,] 1.773819182 1.210893151
[28,] 2.524681703 1.773819182
[29,] -1.614656307 2.524681703
[30,] -1.727329387 -1.614656307
[31,] 0.557517047 -1.727329387
[32,] 0.347299543 0.557517047
[33,] -0.393545686 0.347299543
[34,] 1.096060797 -0.393545686
[35,] -1.512028583 1.096060797
[36,] 0.847928329 -1.512028583
[37,] -0.706685212 0.847928329
[38,] 0.519620600 -0.706685212
[39,] 1.149525769 0.519620600
[40,] 0.877901335 1.149525769
[41,] 2.124646930 0.877901335
[42,] 1.322673265 2.124646930
[43,] -1.141894262 1.322673265
[44,] -0.139880502 -1.141894262
[45,] -0.583551235 -0.139880502
[46,] -0.812851433 -0.583551235
[47,] -1.398288804 -0.812851433
[48,] 1.898416267 -1.398288804
[49,] 0.190937494 1.898416267
[50,] -0.077499430 0.190937494
[51,] 0.127623965 -0.077499430
[52,] 0.138606776 0.127623965
[53,] -1.300031478 0.138606776
[54,] -1.111432290 -1.300031478
[55,] -0.659185176 -1.111432290
[56,] -1.224717711 -0.659185176
[57,] 2.086212240 -1.224717711
[58,] 2.634057574 2.086212240
[59,] 1.062456789 2.634057574
[60,] -2.214509431 1.062456789
[61,] 0.745241728 -2.214509431
[62,] 1.043017178 0.745241728
[63,] -0.370132702 1.043017178
[64,] 0.081212767 -0.370132702
[65,] -0.221678988 0.081212767
[66,] 0.222120988 -0.221678988
[67,] 0.647074154 0.222120988
[68,] 0.382164861 0.647074154
[69,] -0.639993242 0.382164861
[70,] -0.877268404 -0.639993242
[71,] 0.902735843 -0.877268404
[72,] -1.199678753 0.902735843
[73,] -0.632874043 -1.199678753
[74,] -0.121960743 -0.632874043
[75,] 3.715220553 -0.121960743
[76,] 2.990254241 3.715220553
[77,] -0.383671254 2.990254241
[78,] 0.387449958 -0.383671254
[79,] 0.793390790 0.387449958
[80,] -1.673926102 0.793390790
[81,] 0.333263405 -1.673926102
[82,] -0.835082090 0.333263405
[83,] -1.151742819 -0.835082090
[84,] -3.277803010 -1.151742819
[85,] 0.847928329 -3.277803010
[86,] -1.927049308 0.847928329
[87,] 2.320376126 -1.927049308
[88,] 2.288802092 2.320376126
[89,] -2.522175175 2.288802092
[90,] -4.055341328 -2.522175175
[91,] 0.351610441 -4.055341328
[92,] 0.105393308 0.351610441
[93,] 0.370473524 0.105393308
[94,] -0.054207073 0.370473524
[95,] 1.538459354 -0.054207073
[96,] 0.099669660 1.538459354
[97,] -2.380369046 0.099669660
[98,] -0.706685212 -2.380369046
[99,] 2.255559942 -0.706685212
[100,] 1.601711196 2.255559942
[101,] 0.373841098 1.601711196
[102,] 0.652328376 0.373841098
[103,] -2.943898687 0.652328376
[104,] -0.295762259 -2.943898687
[105,] 0.765751718 -0.295762259
[106,] -2.021799007 0.765751718
[107,] -1.377684121 -2.021799007
[108,] 2.732407458 -1.377684121
[109,] 1.678740688 2.732407458
[110,] -0.639993242 1.678740688
[111,] 0.000942812 -0.639993242
[112,] 0.847928329 0.000942812
[113,] 1.668403166 0.847928329
[114,] 3.557249882 1.668403166
[115,] -0.166422057 3.557249882
[116,] 0.805342801 -0.166422057
[117,] -1.077931649 0.805342801
[118,] -0.192963612 -1.077931649
[119,] -3.454865053 -0.192963612
[120,] -0.684454555 -3.454865053
[121,] 0.136570877 -0.684454555
[122,] -1.914116612 0.136570877
[123,] 1.579480539 -1.914116612
[124,] -0.166422057 1.579480539
[125,] -1.512028583 -0.166422057
[126,] 0.754854921 -1.512028583
[127,] 0.388520337 0.754854921
[128,] -0.720774359 0.388520337
[129,] -0.984083652 -0.720774359
[130,] 1.090714070 -0.984083652
[131,] 0.727833074 1.090714070
[132,] 2.462702038 0.727833074
[133,] -1.322326011 2.462702038
[134,] 0.719770551 -1.322326011
[135,] -0.570714777 0.719770551
[136,] 0.936850956 -0.570714777
[137,] -3.157707755 0.936850956
[138,] -0.166422057 -3.157707755
[139,] 0.138606776 -0.166422057
[140,] -2.440834784 0.138606776
[141,] -0.166422057 -2.440834784
[142,] -0.401204152 -0.166422057
[143,] -1.397016628 -0.401204152
[144,] 0.387449958 -1.397016628
[145,] 0.699575794 0.387449958
[146,] 0.699904646 0.699575794
[147,] -0.418904915 0.699904646
[148,] -0.526707822 -0.418904915
[149,] 1.210809324 -0.526707822
[150,] 1.664190693 1.210809324
[151,] 0.373841098 1.664190693
[152,] -0.836328294 0.373841098
[153,] 0.548307911 -0.836328294
[154,] -1.322326011 0.548307911
[155,] -3.490126779 -1.322326011
> z <- as.data.frame(dum1)
> z
lag(myerror, k = 1) myerror
1 1.628252751 1.260808296
2 0.311032748 1.628252751
3 -0.823412893 0.311032748
4 1.681984888 -0.823412893
5 2.444736863 1.681984888
6 1.233279081 2.444736863
7 -0.376058148 1.233279081
8 -1.562845373 -0.376058148
9 2.427378625 -1.562845373
10 -0.166422057 2.427378625
11 -0.101125638 -0.166422057
12 -1.111432290 -0.101125638
13 -0.294197973 -1.111432290
14 -3.123814390 -0.294197973
15 -1.193421708 -3.123814390
16 -3.268398002 -1.193421708
17 -0.770009608 -3.268398002
18 1.948904204 -0.770009608
19 2.553890986 1.948904204
20 -0.708721111 2.553890986
21 0.373841098 -0.708721111
22 -0.770265906 0.373841098
23 -1.358101651 -0.770265906
24 -0.166422057 -1.358101651
25 -0.166422057 -0.166422057
26 1.210893151 -0.166422057
27 1.773819182 1.210893151
28 2.524681703 1.773819182
29 -1.614656307 2.524681703
30 -1.727329387 -1.614656307
31 0.557517047 -1.727329387
32 0.347299543 0.557517047
33 -0.393545686 0.347299543
34 1.096060797 -0.393545686
35 -1.512028583 1.096060797
36 0.847928329 -1.512028583
37 -0.706685212 0.847928329
38 0.519620600 -0.706685212
39 1.149525769 0.519620600
40 0.877901335 1.149525769
41 2.124646930 0.877901335
42 1.322673265 2.124646930
43 -1.141894262 1.322673265
44 -0.139880502 -1.141894262
45 -0.583551235 -0.139880502
46 -0.812851433 -0.583551235
47 -1.398288804 -0.812851433
48 1.898416267 -1.398288804
49 0.190937494 1.898416267
50 -0.077499430 0.190937494
51 0.127623965 -0.077499430
52 0.138606776 0.127623965
53 -1.300031478 0.138606776
54 -1.111432290 -1.300031478
55 -0.659185176 -1.111432290
56 -1.224717711 -0.659185176
57 2.086212240 -1.224717711
58 2.634057574 2.086212240
59 1.062456789 2.634057574
60 -2.214509431 1.062456789
61 0.745241728 -2.214509431
62 1.043017178 0.745241728
63 -0.370132702 1.043017178
64 0.081212767 -0.370132702
65 -0.221678988 0.081212767
66 0.222120988 -0.221678988
67 0.647074154 0.222120988
68 0.382164861 0.647074154
69 -0.639993242 0.382164861
70 -0.877268404 -0.639993242
71 0.902735843 -0.877268404
72 -1.199678753 0.902735843
73 -0.632874043 -1.199678753
74 -0.121960743 -0.632874043
75 3.715220553 -0.121960743
76 2.990254241 3.715220553
77 -0.383671254 2.990254241
78 0.387449958 -0.383671254
79 0.793390790 0.387449958
80 -1.673926102 0.793390790
81 0.333263405 -1.673926102
82 -0.835082090 0.333263405
83 -1.151742819 -0.835082090
84 -3.277803010 -1.151742819
85 0.847928329 -3.277803010
86 -1.927049308 0.847928329
87 2.320376126 -1.927049308
88 2.288802092 2.320376126
89 -2.522175175 2.288802092
90 -4.055341328 -2.522175175
91 0.351610441 -4.055341328
92 0.105393308 0.351610441
93 0.370473524 0.105393308
94 -0.054207073 0.370473524
95 1.538459354 -0.054207073
96 0.099669660 1.538459354
97 -2.380369046 0.099669660
98 -0.706685212 -2.380369046
99 2.255559942 -0.706685212
100 1.601711196 2.255559942
101 0.373841098 1.601711196
102 0.652328376 0.373841098
103 -2.943898687 0.652328376
104 -0.295762259 -2.943898687
105 0.765751718 -0.295762259
106 -2.021799007 0.765751718
107 -1.377684121 -2.021799007
108 2.732407458 -1.377684121
109 1.678740688 2.732407458
110 -0.639993242 1.678740688
111 0.000942812 -0.639993242
112 0.847928329 0.000942812
113 1.668403166 0.847928329
114 3.557249882 1.668403166
115 -0.166422057 3.557249882
116 0.805342801 -0.166422057
117 -1.077931649 0.805342801
118 -0.192963612 -1.077931649
119 -3.454865053 -0.192963612
120 -0.684454555 -3.454865053
121 0.136570877 -0.684454555
122 -1.914116612 0.136570877
123 1.579480539 -1.914116612
124 -0.166422057 1.579480539
125 -1.512028583 -0.166422057
126 0.754854921 -1.512028583
127 0.388520337 0.754854921
128 -0.720774359 0.388520337
129 -0.984083652 -0.720774359
130 1.090714070 -0.984083652
131 0.727833074 1.090714070
132 2.462702038 0.727833074
133 -1.322326011 2.462702038
134 0.719770551 -1.322326011
135 -0.570714777 0.719770551
136 0.936850956 -0.570714777
137 -3.157707755 0.936850956
138 -0.166422057 -3.157707755
139 0.138606776 -0.166422057
140 -2.440834784 0.138606776
141 -0.166422057 -2.440834784
142 -0.401204152 -0.166422057
143 -1.397016628 -0.401204152
144 0.387449958 -1.397016628
145 0.699575794 0.387449958
146 0.699904646 0.699575794
147 -0.418904915 0.699904646
148 -0.526707822 -0.418904915
149 1.210809324 -0.526707822
150 1.664190693 1.210809324
151 0.373841098 1.664190693
152 -0.836328294 0.373841098
153 0.548307911 -0.836328294
154 -1.322326011 0.548307911
155 -3.490126779 -1.322326011
> 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/74u271324485973.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/88csa1324485973.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/9t3ey1324485973.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/103dgm1324485973.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/112mwt1324485973.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/12pnyh1324485973.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/13jmd81324485973.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/14feuk1324485973.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/158xsh1324485973.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/169lr21324485973.tab")
+ }
>
> try(system("convert tmp/11ha31324485973.ps tmp/11ha31324485973.png",intern=TRUE))
character(0)
> try(system("convert tmp/24zzi1324485973.ps tmp/24zzi1324485973.png",intern=TRUE))
character(0)
> try(system("convert tmp/3ip6a1324485973.ps tmp/3ip6a1324485973.png",intern=TRUE))
character(0)
> try(system("convert tmp/4r2q41324485973.ps tmp/4r2q41324485973.png",intern=TRUE))
character(0)
> try(system("convert tmp/5swnw1324485973.ps tmp/5swnw1324485973.png",intern=TRUE))
character(0)
> try(system("convert tmp/6pt1l1324485973.ps tmp/6pt1l1324485973.png",intern=TRUE))
character(0)
> try(system("convert tmp/74u271324485973.ps tmp/74u271324485973.png",intern=TRUE))
character(0)
> try(system("convert tmp/88csa1324485973.ps tmp/88csa1324485973.png",intern=TRUE))
character(0)
> try(system("convert tmp/9t3ey1324485973.ps tmp/9t3ey1324485973.png",intern=TRUE))
character(0)
> try(system("convert tmp/103dgm1324485973.ps tmp/103dgm1324485973.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
4.420 0.240 4.633