//
//Regression  Tree command
//
//This command makes regression tree of continuous target variable 
//by cathgory or numeric explanation variable.
//

//Syntax
tree [target] by [explanations]/
target/continuous
[options]
;
//(caution) target variable must be continuous.

//Options
enforce/[variable]           //[variable] is divided forcibly at first tree branch.
test:0.xx                    //xx is test data share which is used for inspection of precision.
terminal:nn                  //nn is minimum records at terminal node(default 100).
[variable]:code              //if variable type is numeric code you have to define code.
[variable]:continuous        //if numeric type  you don't need to define explicitly.
[variable]:moji              //if character type  you don't need to define explicitly.
[variable]:


//
//Example 1
//
//Prediction of stop distance at car speed.
//This example is relationship with car speed and stop distance.
get cars.csv@;

//Half of data is used as validation and other half is used as making data. tree dist by speed/ target/continuous terminal:3 test:20 ;

//show performance of varidation get score@ana;

plot scat speed predict;

Performance of varidation

//Test the predict value by liner regression. get car.csv@; reg dist by speed; get freq@ana; over line reg by speed;

Performance of varidation with over write of regression line.

//Example 2 // //regression tree analysis with cathgory explanation data. //Prediction of PetalL value by SepalL SepalW and cathgory 'Species variable. get iris.csv@;

tree PetalL by SepalL SepalW Species/ target/continuous terminal=3 test=50 ;

get score@ana;

Show table of predict and explanation variable.

plot scat actual predict;

Show comprison whith actual to predict value. This plots are alomost on rectangle line.