Home » date » 2010 » Dec » 21 »

workshop 10

*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 20:08:40 +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/t12929620114peamzqadsoxh0q.htm/, Retrieved Tue, 21 Dec 2010 21:06:51 +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/t12929620114peamzqadsoxh0q.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 time13 seconds
R Server'Sir Ronald Aylmer Fisher' @ 193.190.124.24


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


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.02586206896552-1.02586206896552
1289481.307692307692312.6923076923077
1294221974.71111111111-1552.71111111111
13001.02586206896552-1.02586206896552
13134188.25-154.25
13215581974.71111111111-416.711111111111
13301.02586206896552-1.02586206896552
134431974.71111111111-1931.71111111111
135645210.518518518519434.481481481482
136316210.518518518519105.481481481481
137115648.731707317073-533.731707317073
138575.5555555555556-70.5555555555556
139897210.518518518519686.481481481482
14001.02586206896552-1.02586206896552
141389648.731707317073-259.731707317073
14201.02586206896552-1.02586206896552
1431002462.708333333333539.291666666667
14436210.518518518519-174.518518518519
145460648.731707317073-188.731707317073
146309188.25120.75
14701.02586206896552-1.02586206896552
148981.3076923076923-72.3076923076923
14927175.5555555555556195.444444444444
150141.0258620689655212.9741379310345
151520462.70833333333357.2916666666667
15217662895.42857142857-1129.42857142857
1530210.518518518519-210.518518518519
154458462.708333333333-4.70833333333331
1552075.5555555555556-55.5555555555556
15601.02586206896552-1.02586206896552
15701.02586206896552-1.02586206896552
1589875.555555555555622.4444444444444
159405210.518518518519194.481481481481
16001.02586206896552-1.02586206896552
16101.02586206896552-1.02586206896552
16201.02586206896552-1.02586206896552
16301.02586206896552-1.02586206896552
164483462.70833333333320.2916666666667
1654541974.71111111111-1520.71111111111
1664775.5555555555556-28.5555555555556
16701.02586206896552-1.02586206896552
168757648.731707317073108.268292682927
16946552895.428571428571759.57142857143
17001.02586206896552-1.02586206896552
17101.02586206896552-1.02586206896552
17236210.518518518519-174.518518518519
17301.02586206896552-1.02586206896552
17420381.3076923076923121.692307692308
17501.02586206896552-1.02586206896552
17612681.307692307692344.6923076923077
1774006579.875-6179.875
178711.0258620689655269.9741379310345
17901.02586206896552-1.02586206896552
18001.02586206896552-1.02586206896552
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.02586206896552-1.02586206896552
191275648.731707317073-373.731707317073
19201.02586206896552-1.02586206896552
19314181.307692307692359.6923076923077
19401.02586206896552-1.02586206896552
19528210.518518518519-182.518518518519
19601.02586206896552-1.02586206896552
19749806579.875-1599.875
19801.02586206896552-1.02586206896552
19901.02586206896552-1.02586206896552
2004721221.28571428571-749.285714285714
20101.02586206896552-1.02586206896552
20201.02586206896552-1.02586206896552
20301.02586206896552-1.02586206896552
204203462.708333333333-259.708333333333
205496648.731707317073-152.731707317073
20610210.518518518519-200.518518518519
2076375.5555555555556-12.5555555555556
20801.02586206896552-1.02586206896552
20911361974.71111111111-838.711111111111
210265210.51851851851954.4814814814815
21101.02586206896552-1.02586206896552
21201.02586206896552-1.02586206896552
213267648.731707317073-381.731707317073
2144741221.28571428571-747.285714285714
215534210.518518518519323.481481481482
216075.5555555555556-75.5555555555556
2171581.3076923076923-66.3076923076923
218397188.25208.75
219075.5555555555556-75.5555555555556
22018661974.71111111111-108.711111111111
221288210.51851851851977.4814814814815
22201.02586206896552-1.02586206896552
223375.5555555555556-72.5555555555556
2244681974.71111111111-1506.71111111111
2252075.5555555555556-55.5555555555556
2262781974.71111111111-1696.71111111111
2276181.3076923076923-20.3076923076923
22801.02586206896552-1.02586206896552
22919275.5555555555556116.444444444444
23001.02586206896552-1.02586206896552
231317462.708333333333-145.708333333333
232738648.73170731707389.2682926829268
23301.02586206896552-1.02586206896552
234368462.708333333333-94.7083333333333
23501.02586206896552-1.02586206896552
23621.025862068965520.974137931034483
23701.02586206896552-1.02586206896552
23853188.25-135.25
23901.02586206896552-1.02586206896552
24001.02586206896552-1.02586206896552
24101.02586206896552-1.02586206896552
24294210.518518518519-116.518518518519
24301.02586206896552-1.02586206896552
24424188.25-164.25
2452332984.4285714285711347.57142857143
24601.02586206896552-1.02586206896552
24701.02586206896552-1.02586206896552
248131462.708333333333-331.708333333333
24901.02586206896552-1.02586206896552
25001.02586206896552-1.02586206896552
251206462.708333333333-256.708333333333
25201.02586206896552-1.02586206896552
25316775.555555555555691.4444444444444
2546222895.42857142857-2273.42857142857
25523286579.875-4251.875
25601.02586206896552-1.02586206896552
257365462.708333333333-97.7083333333333
2583641974.71111111111-1610.71111111111
25901.02586206896552-1.02586206896552
26001.02586206896552-1.02586206896552
26101.02586206896552-1.02586206896552
26201.02586206896552-1.02586206896552
263226648.731707317073-422.731707317073
264307648.731707317073-341.731707317073
26501.02586206896552-1.02586206896552
26601.02586206896552-1.02586206896552
26701.02586206896552-1.02586206896552
268188648.731707317073-460.731707317073
26901.02586206896552-1.02586206896552
2701381974.71111111111-1836.71111111111
27101.02586206896552-1.02586206896552
27201.02586206896552-1.02586206896552
27301.02586206896552-1.02586206896552
27412581.307692307692343.6923076923077
27501.02586206896552-1.02586206896552
276282648.731707317073-366.731707317073
2773351974.71111111111-1639.71111111111
27801.02586206896552-1.02586206896552
27913241974.71111111111-650.711111111111
280176334.142857142857-158.142857142857
28101.02586206896552-1.02586206896552
28201.02586206896552-1.02586206896552
2832491974.71111111111-1725.71111111111
28401.02586206896552-1.02586206896552
285333648.731707317073-315.731707317073
28601.02586206896552-1.02586206896552
287601210.518518518519390.481481481482
28830210.518518518519-180.518518518519
28901.02586206896552-1.02586206896552
290249462.708333333333-213.708333333333
29101.02586206896552-1.02586206896552
292165648.731707317073-483.731707317073
293453648.731707317073-195.731707317073
29401.02586206896552-1.02586206896552
29553462.708333333333-409.708333333333
296382648.731707317073-266.731707317073
29701.02586206896552-1.02586206896552
29801.02586206896552-1.02586206896552
29901.02586206896552-1.02586206896552
300081.3076923076923-81.3076923076923
30130210.518518518519-180.518518518519
30229075.5555555555556214.444444444444
303075.5555555555556-75.5555555555556
30401.02586206896552-1.02586206896552
305366648.731707317073-282.731707317073
306281.3076923076923-79.3076923076923
30701.02586206896552-1.02586206896552
308209334.142857142857-125.142857142857
309384188.25195.75
31001.02586206896552-1.02586206896552
31101.02586206896552-1.02586206896552
3123652895.42857142857-2530.42857142857
31301.02586206896552-1.02586206896552
31449648.731707317073-599.731707317073
315381.3076923076923-78.3076923076923
316133984.428571428571-851.428571428571
317321.0258620689655230.9741379310345
3183681974.71111111111-1606.71111111111
3191210.518518518519-209.518518518519
32001.02586206896552-1.02586206896552
32101.02586206896552-1.02586206896552
32201.02586206896552-1.02586206896552
32301.02586206896552-1.02586206896552
32401.02586206896552-1.02586206896552
32501.02586206896552-1.02586206896552
3262275.5555555555556-53.5555555555556
32701.02586206896552-1.02586206896552
32801.02586206896552-1.02586206896552
32901.02586206896552-1.02586206896552
33001.02586206896552-1.02586206896552
33101.02586206896552-1.02586206896552
33201.02586206896552-1.02586206896552
33301.02586206896552-1.02586206896552
33496210.518518518519-114.518518518519
335175.5555555555556-74.5555555555556
336314210.518518518519103.481481481481
3378441974.71111111111-1130.71111111111
33801.02586206896552-1.02586206896552
3392675.5555555555556-49.5555555555556
340125188.25-63.25
341304462.708333333333-158.708333333333
34201.02586206896552-1.02586206896552
34301.02586206896552-1.02586206896552
34401.02586206896552-1.02586206896552
345621462.708333333333158.291666666667
34601.02586206896552-1.02586206896552
347119210.518518518519-91.5185185185185
34801.02586206896552-1.02586206896552
34901.02586206896552-1.02586206896552
3501595648.731707317073946.268292682927
351312210.518518518519101.481481481481
3526081.3076923076923-21.3076923076923
353587648.731707317073-61.7317073170732
35413575.555555555555659.4444444444444
35501.02586206896552-1.02586206896552
35601.02586206896552-1.02586206896552
357514648.731707317073-134.731707317073
35801.02586206896552-1.02586206896552
35901.02586206896552-1.02586206896552
36001.02586206896552-1.02586206896552
3611210.518518518519-209.518518518519
36201.02586206896552-1.02586206896552
36301.02586206896552-1.02586206896552
36417631974.71111111111-211.711111111111
365180188.25-8.25
36601.02586206896552-1.02586206896552
36701.02586206896552-1.02586206896552
36801.02586206896552-1.02586206896552
36901.02586206896552-1.02586206896552
37021881.3076923076923136.692307692308
37101.02586206896552-1.02586206896552
372448648.731707317073-200.731707317073
373227648.731707317073-421.731707317073
374174210.518518518519-36.5185185185185
37501.02586206896552-1.02586206896552
37601.02586206896552-1.02586206896552
377121462.708333333333-341.708333333333
378607648.731707317073-41.7317073170732
3792212648.7317073170731563.26829268293
38001.02586206896552-1.02586206896552
38101.02586206896552-1.02586206896552
382530334.142857142857195.857142857143
3835711221.28571428571-650.285714285714
38401.02586206896552-1.02586206896552
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/t12929620114peamzqadsoxh0q/2yob81292962104.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/21/t12929620114peamzqadsoxh0q/2yob81292962104.ps (open in new window)


http://www.freestatistics.org/blog/date/2010/Dec/21/t12929620114peamzqadsoxh0q/3yob81292962104.png (open in new window)
http://www.freestatistics.org/blog/date/2010/Dec/21/t12929620114peamzqadsoxh0q/3yob81292962104.ps (open in new window)


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


 
Parameters (Session):
par1 = 1 ; par2 = none ; par3 = 3 ; par4 = no ;
 
Parameters (R input):
par1 = 1 ; par2 = none ; par3 = 3 ; 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