Home » date » 2010 » Dec » 21 »

Workshop 7

*The author of this computation has been verified*
R Software Module: /rwasp_regression_trees1.wasp (opens new window with default values)
Title produced by software: Recursive Partitioning (Regression Trees)
Date of computation: Tue, 21 Dec 2010 13:25:42 +0000
 
Cite this page as follows:
Statistical Computations at FreeStatistics.org, Office for Research Development and Education, URL http://www.freestatistics.org/blog/date/2010/Dec/21/t1292937826cpn8izbstkfi4xd.htm/, Retrieved Tue, 21 Dec 2010 14:23:50 +0100
 
BibTeX entries for LaTeX users:
@Manual{KEY,
    author = {{YOUR NAME}},
    publisher = {Office for Research Development and Education},
    title = {Statistical Computations at FreeStatistics.org, URL http://www.freestatistics.org/blog/date/2010/Dec/21/t1292937826cpn8izbstkfi4xd.htm/},
    year = {2010},
}
@Manual{R,
    title = {R: A Language and Environment for Statistical Computing},
    author = {{R Development Core Team}},
    organization = {R Foundation for Statistical Computing},
    address = {Vienna, Austria},
    year = {2010},
    note = {{ISBN} 3-900051-07-0},
    url = {http://www.R-project.org},
}
 
Original text written by user:
 
IsPrivate?
No (this computation is public)
 
User-defined keywords:
 
Dataseries X:
» Textbox « » Textfile « » CSV «
162556 807 213118 6282154 29790 444 81767 4321023 87550 412 153198 4111912 84738 428 -26007 223193 54660 315 126942 1491348 42634 168 157214 1629616 40949 263 129352 1398893 45187 267 234817 1926517 37704 228 60448 983660 16275 129 47818 1443586 25830 104 245546 1073089 12679 122 48020 984885 18014 393 -1710 1405225 43556 190 32648 227132 24811 280 95350 929118 6575 63 151352 1071292 7123 102 288170 638830 21950 265 114337 856956 37597 234 37884 992426 17821 277 122844 444477 12988 73 82340 857217 22330 67 79801 711969 13326 103 165548 702380 16189 290 116384 358589 7146 83 134028 297978 15824 56 63838 585715 27664 236 74996 657954 11920 73 31080 209458 8568 34 32168 786690 14416 139 49857 439798 3369 26 87161 688779 11819 70 106113 574339 6984 40 80570 741409 4519 42 102129 597793 2220 12 301670 644190 18562 211 102313 377934 10327 74 88577 640273 5336 80 112477 697458 2365 83 191778 550608 4069 131 79804 207393 8636 203 128294 301607 13718 56 96448 345783 4525 89 93 etc...
 
Output produced by software:

Enter (or paste) a matrix (table) containing all data (time) series. Every column represents a different variable and must be delimited by a space or Tab. Every row represents a period in time (or category) and must be delimited by hard returns. The easiest way to enter data is to copy and paste a block of spreadsheet cells. Please, do not use commas or spaces to seperate groups of digits!


Summary of computational transaction
Raw Inputview raw input (R code)
Raw Outputview raw output of R engine
Computing time17 seconds
R Server'Gwilym Jenkins' @ 72.249.127.135


Goodness of Fit
Correlation0.8124
R-squared0.66
RMSE6884.0103


Actuals, Predictions, and Residuals
#ActualsForecastsResiduals
116255664785.285714285797770.7142857143
22979064785.2857142857-34995.2857142857
38755064785.285714285722764.7142857143
48473864785.285714285719952.7142857143
55466064785.2857142857-10125.2857142857
6426342782614808
7409492782613123
8451872782617361
937704278269878
101627515714.7142857143560.285714285714
112583015714.714285714310115.2857142857
121267915714.7142857143-3035.71428571429
131801464785.2857142857-46771.2857142857
14435562782615730
152481127826-3015
16657515714.7142857143-9139.71428571429
1771236579.875543.125
182195027826-5876
1937597278269771
201782127826-10005
211298815714.7142857143-2726.71428571429
222233015714.71428571436615.28571428571
231332615714.7142857143-2388.71428571429
241618964785.2857142857-48596.2857142857
2571466579.875566.125
26158246579.8759244.125
272766427826-162
28119206579.8755340.125
2985685195.714285714293372.28571428571
30144166579.8757836.125
3133691974.711111111111394.28888888889
32118196579.8755239.125
3369845195.714285714291788.28571428571
3445195195.71428571429-676.714285714285
3522201950.71428571429269.285714285714
361856227826-9264
37103276579.8753747.125
3853366579.875-1243.875
3923656579.875-4214.875
4040696579.875-2510.875
41863627826-19190
42137186579.8757138.125
4345256579.875-2054.875
4468696579.875289.125
4546282895.428571428571732.57142857143
4636891974.711111111111714.28888888889
4748912895.428571428571995.57142857143
4874896579.875909.125
4949016579.875-1678.875
5022842895.42857142857-611.428571428572
5131606579.875-3419.875
5241506579.875-2429.875
5372856579.875705.125
5411346579.875-5445.875
5546586579.875-1921.875
5623846579.875-4195.875
5737481950.714285714291797.28571428571
5853715195.71428571429175.285714285715
5912852895.42857142857-1610.42857142857
6093276579.8752747.125
6155655195.71428571429369.285714285715
6215282895.42857142857-1367.42857142857
6331221974.711111111111147.28888888889
6475616579.875981.125
6526752895.42857142857-220.428571428572
661325327826-14573
678801221.28571428571-341.285714285714
6820535195.71428571429-3142.71428571429
6914246579.875-5155.875
7040366579.875-2543.875
7130452895.42857142857149.571428571428
7251192895.428571428572223.57142857143
7314312895.42857142857-1464.42857142857
74554648.731707317073-94.7317073170732
7519752895.42857142857-920.428571428572
7617651974.71111111111-209.711111111111
7710121974.71111111111-962.711111111111
788101221.28571428571-411.285714285714
7912802895.42857142857-1615.42857142857
80666648.73170731707317.2682926829268
8113801974.71111111111-594.711111111111
8246776579.875-1902.875
838762895.42857142857-2019.42857142857
84814462.708333333333351.291666666667
85514648.731707317073-134.731707317073
8656926579.875-887.875
8736426579.875-2937.875
88540648.731707317073-108.731707317073
8920992895.42857142857-796.428571428572
905671950.71428571429-1383.71428571429
9120012895.42857142857-894.428571428572
9229492895.4285714285753.5714285714284
9322536579.875-4326.875
9465331974.711111111114558.28888888889
9518892895.42857142857-1006.42857142857
9630551974.711111111111080.28888888889
972721950.71428571429-1678.71428571429
9814141974.71111111111-560.711111111111
9925641950.71428571429613.285714285714
1001383648.731707317073734.268292682927
10112611974.71111111111-713.711111111111
1029751221.28571428571-246.285714285714
10333662895.42857142857470.571428571428
104576334.142857142857241.857142857143
10516861974.71111111111-288.711111111111
1067461974.71111111111-1228.71111111111
10731922895.42857142857296.571428571428
10820451950.7142857142994.2857142857142
10957022895.428571428572806.57142857143
11019321974.71111111111-42.7111111111112
1119361974.71111111111-1038.71111111111
11234372895.42857142857541.571428571428
11351312895.428571428572235.57142857143
11423971221.285714285711175.71428571429
1151389648.731707317073740.268292682927
11615032895.42857142857-1392.42857142857
117402648.731707317073-246.731707317073
11822391950.71428571429288.285714285714
11922341221.285714285711012.71428571429
1208371974.71111111111-1137.71111111111
121105796579.8753999.125
122875648.731707317073226.268292682927
12315856579.875-4994.875
12416591974.71111111111-315.711111111111
1252647648.7317073170731998.26829268293
12632941974.711111111111319.28888888889
12701.03478260869565-1.03478260869565
1289481.307692307692312.6923076923077
1294221974.71111111111-1552.71111111111
13001.03478260869565-1.03478260869565
13134188.25-154.25
13215581974.71111111111-416.711111111111
133071.578947368421-71.578947368421
134431974.71111111111-1931.71111111111
135645210.518518518519434.481481481482
136316210.518518518519105.481481481481
137115648.731707317073-533.731707317073
138571.578947368421-66.578947368421
139897210.518518518519686.481481481482
14001.03478260869565-1.03478260869565
141389648.731707317073-259.731707317073
14201.03478260869565-1.03478260869565
1431002462.708333333333539.291666666667
14436210.518518518519-174.518518518519
145460648.731707317073-188.731707317073
146309188.25120.75
14701.03478260869565-1.03478260869565
148981.3076923076923-72.3076923076923
14927171.578947368421199.421052631579
150141.0347826086956512.9652173913043
151520462.70833333333357.2916666666667
15217662895.42857142857-1129.42857142857
1530210.518518518519-210.518518518519
154458462.708333333333-4.70833333333331
1552071.578947368421-51.5789473684211
15601.03478260869565-1.03478260869565
15701.03478260869565-1.03478260869565
1589871.57894736842126.4210526315789
159405210.518518518519194.481481481481
16001.03478260869565-1.03478260869565
16101.03478260869565-1.03478260869565
16201.03478260869565-1.03478260869565
16301.03478260869565-1.03478260869565
164483462.70833333333320.2916666666667
1654541974.71111111111-1520.71111111111
1664771.578947368421-24.5789473684211
16701.03478260869565-1.03478260869565
168757648.731707317073108.268292682927
16946552895.428571428571759.57142857143
17001.03478260869565-1.03478260869565
17101.03478260869565-1.03478260869565
17236210.518518518519-174.518518518519
17301.03478260869565-1.03478260869565
17420381.3076923076923121.692307692308
17501.03478260869565-1.03478260869565
17612681.307692307692344.6923076923077
1774006579.875-6179.875
178711.0347826086956569.9652173913043
17901.03478260869565-1.03478260869565
18001.03478260869565-1.03478260869565
181972648.731707317073323.268292682927
182531648.731707317073-117.731707317073
18324611974.71111111111486.288888888889
184378462.708333333333-84.7083333333333
18523210.518518518519-187.518518518519
186638648.731707317073-10.7317073170732
18723001974.71111111111325.288888888889
188149334.142857142857-185.142857142857
189226210.51851851851915.4814814814815
19001.03478260869565-1.03478260869565
191275648.731707317073-373.731707317073
19201.03478260869565-1.03478260869565
19314181.307692307692359.6923076923077
19401.03478260869565-1.03478260869565
19528210.518518518519-182.518518518519
19601.03478260869565-1.03478260869565
19749806579.875-1599.875
19801.03478260869565-1.03478260869565
19901.03478260869565-1.03478260869565
2004721221.28571428571-749.285714285714
20101.03478260869565-1.03478260869565
20201.03478260869565-1.03478260869565
20301.03478260869565-1.03478260869565
204203462.708333333333-259.708333333333
205496648.731707317073-152.731707317073
20610210.518518518519-200.518518518519
2076371.578947368421-8.57894736842105
20801.03478260869565-1.03478260869565
20911361974.71111111111-838.711111111111
210265210.51851851851954.4814814814815
21101.03478260869565-1.03478260869565
21201.03478260869565-1.03478260869565
213267648.731707317073-381.731707317073
2144741221.28571428571-747.285714285714
215534210.518518518519323.481481481482
216071.578947368421-71.578947368421
2171581.3076923076923-66.3076923076923
218397188.25208.75
219071.578947368421-71.578947368421
22018661974.71111111111-108.711111111111
221288210.51851851851977.4814814814815
22201.03478260869565-1.03478260869565
223371.578947368421-68.578947368421
2244681974.71111111111-1506.71111111111
2252071.578947368421-51.5789473684211
2262781974.71111111111-1696.71111111111
2276181.3076923076923-20.3076923076923
22801.03478260869565-1.03478260869565
22919271.578947368421120.421052631579
23001.03478260869565-1.03478260869565
231317462.708333333333-145.708333333333
232738648.73170731707389.2682926829268
23301.03478260869565-1.03478260869565
234368462.708333333333-94.7083333333333
23501.03478260869565-1.03478260869565
23621.034782608695650.965217391304348
23701.03478260869565-1.03478260869565
23853188.25-135.25
23901.03478260869565-1.03478260869565
24001.03478260869565-1.03478260869565
24101.03478260869565-1.03478260869565
24294210.518518518519-116.518518518519
24301.03478260869565-1.03478260869565
24424188.25-164.25
2452332984.4285714285711347.57142857143
24601.03478260869565-1.03478260869565
24701.03478260869565-1.03478260869565
248131462.708333333333-331.708333333333
24901.03478260869565-1.03478260869565
25001.03478260869565-1.03478260869565
251206462.708333333333-256.708333333333
25201.03478260869565-1.03478260869565
25316771.57894736842195.421052631579
2546222895.42857142857-2273.42857142857
25523286579.875-4251.875
25601.03478260869565-1.03478260869565
257365462.708333333333-97.7083333333333
2583641974.71111111111-1610.71111111111
25901.03478260869565-1.03478260869565
26001.03478260869565-1.03478260869565
26101.03478260869565-1.03478260869565
26201.03478260869565-1.03478260869565
263226648.731707317073-422.731707317073
264307648.731707317073-341.731707317073
26501.03478260869565-1.03478260869565
26601.03478260869565-1.03478260869565
26701.03478260869565-1.03478260869565
268188648.731707317073-460.731707317073
26901.03478260869565-1.03478260869565
2701381974.71111111111-1836.71111111111
27101.03478260869565-1.03478260869565
27201.03478260869565-1.03478260869565
27301.03478260869565-1.03478260869565
27412581.307692307692343.6923076923077
27501.03478260869565-1.03478260869565
276282648.731707317073-366.731707317073
2773351974.71111111111-1639.71111111111
27801.03478260869565-1.03478260869565
27913241974.71111111111-650.711111111111
280176334.142857142857-158.142857142857
28101.03478260869565-1.03478260869565
28201.03478260869565-1.03478260869565
2832491974.71111111111-1725.71111111111
28401.03478260869565-1.03478260869565
285333648.731707317073-315.731707317073
28601.03478260869565-1.03478260869565
287601210.518518518519390.481481481482
28830210.518518518519-180.518518518519
28901.03478260869565-1.03478260869565
290249462.708333333333-213.708333333333
29101.03478260869565-1.03478260869565
292165648.731707317073-483.731707317073
293453648.731707317073-195.731707317073
29401.03478260869565-1.03478260869565
29553462.708333333333-409.708333333333
296382648.731707317073-266.731707317073
29701.03478260869565-1.03478260869565
29801.03478260869565-1.03478260869565
29901.03478260869565-1.03478260869565
300081.3076923076923-81.3076923076923
30130210.518518518519-180.518518518519
30229071.578947368421218.421052631579
303071.578947368421-71.578947368421
30401.03478260869565-1.03478260869565
305366648.731707317073-282.731707317073
306281.3076923076923-79.3076923076923
30701.03478260869565-1.03478260869565
308209334.142857142857-125.142857142857
309384188.25195.75
31001.03478260869565-1.03478260869565
31101.03478260869565-1.03478260869565
3123652895.42857142857-2530.42857142857
31301.03478260869565-1.03478260869565
31449648.731707317073-599.731707317073
315381.3076923076923-78.3076923076923
316133984.428571428571-851.428571428571
317321.0347826086956530.9652173913043
3183681974.71111111111-1606.71111111111
3191210.518518518519-209.518518518519
32001.03478260869565-1.03478260869565
32101.03478260869565-1.03478260869565
32201.03478260869565-1.03478260869565
32301.03478260869565-1.03478260869565
32401.03478260869565-1.03478260869565
32501.03478260869565-1.03478260869565
3262271.578947368421-49.5789473684211
32701.03478260869565-1.03478260869565
32801.03478260869565-1.03478260869565
32901.03478260869565-1.03478260869565
33001.03478260869565-1.03478260869565
33101.03478260869565-1.03478260869565
33201.03478260869565-1.03478260869565
33301.03478260869565-1.03478260869565
33496210.518518518519-114.518518518519
335171.578947368421-70.578947368421
336314210.518518518519103.481481481481
3378441974.71111111111-1130.71111111111
33801.03478260869565-1.03478260869565
3392671.578947368421-45.5789473684211
340125188.25-63.25
341304462.708333333333-158.708333333333
34201.03478260869565-1.03478260869565
34301.03478260869565-1.03478260869565
34401.03478260869565-1.03478260869565
345621462.708333333333158.291666666667
34601.03478260869565-1.03478260869565
347119210.518518518519-91.5185185185185
34801.03478260869565-1.03478260869565
34901.03478260869565-1.03478260869565
3501595648.731707317073946.268292682927
351312210.518518518519101.481481481481
3526081.3076923076923-21.3076923076923
353587648.731707317073-61.7317073170732
35413571.57894736842163.421052631579
35501.03478260869565-1.03478260869565
35601.03478260869565-1.03478260869565
357514648.731707317073-134.731707317073
35801.03478260869565-1.03478260869565
35901.03478260869565-1.03478260869565
36001.03478260869565-1.03478260869565
3611210.518518518519-209.518518518519
36201.03478260869565-1.03478260869565
36301.03478260869565-1.03478260869565
36417631974.71111111111-211.711111111111
365180188.25-8.25
36601.03478260869565-1.03478260869565
36701.03478260869565-1.03478260869565
36801.03478260869565-1.03478260869565
36901.03478260869565-1.03478260869565
37021881.3076923076923136.692307692308
37101.03478260869565-1.03478260869565
372448648.731707317073-200.731707317073
373227648.731707317073-421.731707317073
374174210.518518518519-36.5185185185185
37501.03478260869565-1.03478260869565
37601.03478260869565-1.03478260869565
377121462.708333333333-341.708333333333
378607648.731707317073-41.7317073170732
3792212648.7317073170731563.26829268293
38001.03478260869565-1.03478260869565
38101.03478260869565-1.03478260869565
382530334.142857142857195.857142857143
3835711221.28571428571-650.285714285714
38401.03478260869565-1.03478260869565
38578334.142857142857-256.142857142857
38624891974.71111111111514.288888888889
387131210.518518518519-79.5185185185185
388923462.708333333333460.291666666667
38972210.518518518519-138.518518518519
390572462.708333333333109.291666666667
391397648.731707317073-251.731707317073
392450462.708333333333-12.7083333333333
3936221221.28571428571-599.285714285714
394694648.73170731707345.2682926829268
39534251221.285714285712203.71428571429
3965621221.28571428571-659.285714285714
39749171974.711111111112942.28888888889
398144227826-26384
399529462.70833333333366.2916666666667
40021262895.42857142857-769.428571428572
4011061984.42857142857176.5714285714286
402776648.731707317073127.268292682927
403611462.708333333333148.291666666667
40415261974.71111111111-448.711111111111
4055921221.28571428571-629.285714285714
4061182648.731707317073533.268292682927
407621334.142857142857286.857142857143
408989462.708333333333526.291666666667
409438462.708333333333-24.7083333333333
410726984.428571428571-258.428571428571
41113036579.875-5276.875
41274191974.711111111115444.28888888889
41311641221.28571428571-57.2857142857142
41433105195.71428571429-1885.71428571429
41519201221.28571428571698.714285714286
416965984.428571428571-19.4285714285714
41732561974.711111111111281.28888888889
41811351974.71111111111-839.711111111111
41912701974.71111111111-704.711111111111
420661984.428571428571-323.428571428571
4211013984.42857142857128.5714285714286
42228446579.875-3735.875
423115286579.8754948.125
42465261974.711111111114551.28888888889
42522641974.71111111111289.288888888889
42651096579.875-1470.875
42739991974.711111111112024.28888888889
42835624278267798
42992522895.428571428576356.57142857143
430152366579.8758656.125
431180736579.87511493.125
 
Charts produced by software:
http://www.freestatistics.org/blog/date/2010/Dec/21/t1292937826cpn8izbstkfi4xd/2r03r1292937924.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/21/t1292937826cpn8izbstkfi4xd/2r03r1292937924.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/21/t1292937826cpn8izbstkfi4xd/32slu1292937924.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/21/t1292937826cpn8izbstkfi4xd/32slu1292937924.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/21/t1292937826cpn8izbstkfi4xd/4uj2f1292937924.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/21/t1292937826cpn8izbstkfi4xd/4uj2f1292937924.ps (open in new window)


 
Parameters (Session):
par1 = 5 ; par2 = quantiles ; par3 = 2 ; par4 = yes ;
 
Parameters (R input):
par1 = 1 ; par2 = none ; par3 = 2 ; par4 = no ;
 
R code (references can be found in the software module):
library(party)
library(Hmisc)
par1 <- as.numeric(par1)
par3 <- as.numeric(par3)
x <- data.frame(t(y))
is.data.frame(x)
x <- x[!is.na(x[,par1]),]
k <- length(x[1,])
n <- length(x[,1])
colnames(x)[par1]
x[,par1]
if (par2 == 'kmeans') {
cl <- kmeans(x[,par1], par3)
print(cl)
clm <- matrix(cbind(cl$centers,1:par3),ncol=2)
clm <- clm[sort.list(clm[,1]),]
for (i in 1:par3) {
cl$cluster[cl$cluster==clm[i,2]] <- paste('C',i,sep='')
}
cl$cluster <- as.factor(cl$cluster)
print(cl$cluster)
x[,par1] <- cl$cluster
}
if (par2 == 'quantiles') {
x[,par1] <- cut2(x[,par1],g=par3)
}
if (par2 == 'hclust') {
hc <- hclust(dist(x[,par1])^2, 'cen')
print(hc)
memb <- cutree(hc, k = par3)
dum <- c(mean(x[memb==1,par1]))
for (i in 2:par3) {
dum <- c(dum, mean(x[memb==i,par1]))
}
hcm <- matrix(cbind(dum,1:par3),ncol=2)
hcm <- hcm[sort.list(hcm[,1]),]
for (i in 1:par3) {
memb[memb==hcm[i,2]] <- paste('C',i,sep='')
}
memb <- as.factor(memb)
print(memb)
x[,par1] <- memb
}
if (par2=='equal') {
ed <- cut(as.numeric(x[,par1]),par3,labels=paste('C',1:par3,sep=''))
x[,par1] <- as.factor(ed)
}
table(x[,par1])
colnames(x)
colnames(x)[par1]
x[,par1]
if (par2 == 'none') {
m <- ctree(as.formula(paste(colnames(x)[par1],' ~ .',sep='')),data = x)
}
load(file='createtable')
if (par2 != 'none') {
m <- ctree(as.formula(paste('as.factor(',colnames(x)[par1],') ~ .',sep='')),data = x)
if (par4=='yes') {
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'10-Fold Cross Validation',3+2*par3,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'',1,TRUE)
a<-table.element(a,'Prediction (training)',par3+1,TRUE)
a<-table.element(a,'Prediction (testing)',par3+1,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Actual',1,TRUE)
for (jjj in 1:par3) a<-table.element(a,paste('C',jjj,sep=''),1,TRUE)
a<-table.element(a,'CV',1,TRUE)
for (jjj in 1:par3) a<-table.element(a,paste('C',jjj,sep=''),1,TRUE)
a<-table.element(a,'CV',1,TRUE)
a<-table.row.end(a)
for (i in 1:10) {
ind <- sample(2, nrow(x), replace=T, prob=c(0.9,0.1))
m.ct <- ctree(as.formula(paste('as.factor(',colnames(x)[par1],') ~ .',sep='')),data =x[ind==1,])
if (i==1) {
m.ct.i.pred <- predict(m.ct, newdata=x[ind==1,])
m.ct.i.actu <- x[ind==1,par1]
m.ct.x.pred <- predict(m.ct, newdata=x[ind==2,])
m.ct.x.actu <- x[ind==2,par1]
} else {
m.ct.i.pred <- c(m.ct.i.pred,predict(m.ct, newdata=x[ind==1,]))
m.ct.i.actu <- c(m.ct.i.actu,x[ind==1,par1])
m.ct.x.pred <- c(m.ct.x.pred,predict(m.ct, newdata=x[ind==2,]))
m.ct.x.actu <- c(m.ct.x.actu,x[ind==2,par1])
}
}
print(m.ct.i.tab <- table(m.ct.i.actu,m.ct.i.pred))
numer <- 0
for (i in 1:par3) {
print(m.ct.i.tab[i,i] / sum(m.ct.i.tab[i,]))
numer <- numer + m.ct.i.tab[i,i]
}
print(m.ct.i.cp <- numer / sum(m.ct.i.tab))
print(m.ct.x.tab <- table(m.ct.x.actu,m.ct.x.pred))
numer <- 0
for (i in 1:par3) {
print(m.ct.x.tab[i,i] / sum(m.ct.x.tab[i,]))
numer <- numer + m.ct.x.tab[i,i]
}
print(m.ct.x.cp <- numer / sum(m.ct.x.tab))
for (i in 1:par3) {
a<-table.row.start(a)
a<-table.element(a,paste('C',i,sep=''),1,TRUE)
for (jjj in 1:par3) a<-table.element(a,m.ct.i.tab[i,jjj])
a<-table.element(a,round(m.ct.i.tab[i,i]/sum(m.ct.i.tab[i,]),4))
for (jjj in 1:par3) a<-table.element(a,m.ct.x.tab[i,jjj])
a<-table.element(a,round(m.ct.x.tab[i,i]/sum(m.ct.x.tab[i,]),4))
a<-table.row.end(a)
}
a<-table.row.start(a)
a<-table.element(a,'Overall',1,TRUE)
for (jjj in 1:par3) a<-table.element(a,'-')
a<-table.element(a,round(m.ct.i.cp,4))
for (jjj in 1:par3) a<-table.element(a,'-')
a<-table.element(a,round(m.ct.x.cp,4))
a<-table.row.end(a)
a<-table.end(a)
table.save(a,file='mytable3.tab')
}
}
m
bitmap(file='test1.png')
plot(m)
dev.off()
bitmap(file='test1a.png')
plot(x[,par1] ~ as.factor(where(m)),main='Response by Terminal Node',xlab='Terminal Node',ylab='Response')
dev.off()
if (par2 == 'none') {
forec <- predict(m)
result <- as.data.frame(cbind(x[,par1],forec,x[,par1]-forec))
colnames(result) <- c('Actuals','Forecasts','Residuals')
print(result)
}
if (par2 != 'none') {
print(cbind(as.factor(x[,par1]),predict(m)))
myt <- table(as.factor(x[,par1]),predict(m))
print(myt)
}
bitmap(file='test2.png')
if(par2=='none') {
op <- par(mfrow=c(2,2))
plot(density(result$Actuals),main='Kernel Density Plot of Actuals')
plot(density(result$Residuals),main='Kernel Density Plot of Residuals')
plot(result$Forecasts,result$Actuals,main='Actuals versus Predictions',xlab='Predictions',ylab='Actuals')
plot(density(result$Forecasts),main='Kernel Density Plot of Predictions')
par(op)
}
if(par2!='none') {
plot(myt,main='Confusion Matrix',xlab='Actual',ylab='Predicted')
}
dev.off()
if (par2 == 'none') {
detcoef <- cor(result$Forecasts,result$Actuals)
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Goodness of Fit',2,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'Correlation',1,TRUE)
a<-table.element(a,round(detcoef,4))
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'R-squared',1,TRUE)
a<-table.element(a,round(detcoef*detcoef,4))
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'RMSE',1,TRUE)
a<-table.element(a,round(sqrt(mean((result$Residuals)^2)),4))
a<-table.row.end(a)
a<-table.end(a)
table.save(a,file='mytable1.tab')
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Actuals, Predictions, and Residuals',4,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'#',header=TRUE)
a<-table.element(a,'Actuals',header=TRUE)
a<-table.element(a,'Forecasts',header=TRUE)
a<-table.element(a,'Residuals',header=TRUE)
a<-table.row.end(a)
for (i in 1:length(result$Actuals)) {
a<-table.row.start(a)
a<-table.element(a,i,header=TRUE)
a<-table.element(a,result$Actuals[i])
a<-table.element(a,result$Forecasts[i])
a<-table.element(a,result$Residuals[i])
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable.tab')
}
if (par2 != 'none') {
a<-table.start()
a<-table.row.start(a)
a<-table.element(a,'Confusion Matrix (predicted in columns / actuals in rows)',par3+1,TRUE)
a<-table.row.end(a)
a<-table.row.start(a)
a<-table.element(a,'',1,TRUE)
for (i in 1:par3) {
a<-table.element(a,paste('C',i,sep=''),1,TRUE)
}
a<-table.row.end(a)
for (i in 1:par3) {
a<-table.row.start(a)
a<-table.element(a,paste('C',i,sep=''),1,TRUE)
for (j in 1:par3) {
a<-table.element(a,myt[i,j])
}
a<-table.row.end(a)
}
a<-table.end(a)
table.save(a,file='mytable2.tab')
}
 





Copyright

Creative Commons License

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.

Software written by Ed van Stee & Patrick Wessa


Disclaimer

Information provided on this web site is provided "AS IS" without warranty of any kind, either express or implied, including, without limitation, warranties of merchantability, fitness for a particular purpose, and noninfringement. We use reasonable efforts to include accurate and timely information and periodically update the information, and software without notice. However, we make no warranties or representations as to the accuracy or completeness of such information (or software), and we assume no liability or responsibility for errors or omissions in the content of this web site, or any software bugs in online applications. Your use of this web site is AT YOUR OWN RISK. Under no circumstances and under no legal theory shall we be liable to you or any other person for any direct, indirect, special, incidental, exemplary, or consequential damages arising from your access to, or use of, this web site.


Privacy Policy

We may request personal information to be submitted to our servers in order to be able to:

  • personalize online software applications according to your needs
  • enforce strict security rules with respect to the data that you upload (e.g. statistical data)
  • manage user sessions of online applications
  • alert you about important changes or upgrades in resources or applications

We NEVER allow other companies to directly offer registered users information about their products and services. Banner references and hyperlinks of third parties NEVER contain any personal data of the visitor.

We do NOT sell, nor transmit by any means, personal information, nor statistical data series uploaded by you to third parties.

We carefully protect your data from loss, misuse, alteration, and destruction. However, at any time, and under any circumstance you are solely responsible for managing your passwords, and keeping them secret.

We store a unique ANONYMOUS USER ID in the form of a small 'Cookie' on your computer. This allows us to track your progress when using this website which is necessary to create state-dependent features. The cookie is used for NO OTHER PURPOSE. At any time you may opt to disallow cookies from this website - this will not affect other features of this website.

We examine cookies that are used by third-parties (banner and online ads) very closely: abuse from third-parties automatically results in termination of the advertising contract without refund. We have very good reason to believe that the cookies that are produced by third parties (banner ads) do NOT cause any privacy or security risk.

FreeStatistics.org is safe. There is no need to download any software to use the applications and services contained in this website. Hence, your system's security is not compromised by their use, and your personal data - other than data you submit in the account application form, and the user-agent information that is transmitted by your browser - is never transmitted to our servers.

As a general rule, we do not log on-line behavior of individuals (other than normal logging of webserver 'hits'). However, in cases of abuse, hacking, unauthorized access, Denial of Service attacks, illegal copying, hotlinking, non-compliance with international webstandards (such as robots.txt), or any other harmful behavior, our system engineers are empowered to log, track, identify, publish, and ban misbehaving individuals - even if this leads to ban entire blocks of IP addresses, or disclosing user's identity.


FreeStatistics.org is powered by