//
//Aic analysis command
//
//This command outputs ranking list of explanation variables ordered by sensitivity to target variable. 
//
//(Caoution) 
//If explanation variable type is numeric,variable is categorized aoutomatically.

//Syntax with no option
aic [target] by [explanations];  


//Syntax with option
aic [target] by [explanations]/
[options]
; 

//Options
method=aic                   //ranking by aic statistic value (default opeiton)
method=kai                   //ranking by kai square value
[variable]:code              //if variable type is numeric code,you have to appoint as code.
                             //Bcause this tool cannot decide numeric value or numeric 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]:zero              //if you appoint zero,number of zero value  can be counted.
[variable]:format=[filename] //if you use format file,list items is categorized by format.


//Example 1  Ranking explanation variable for distinguishing species of iris.
get irisR.csv@;

//Execute aic analysis for target variable 'Species' by iris propertys. aic Species by SepalL PetalL SepalW PetalW;

Iris properties are numeric. so their properties are be categorized automaticaly.

//Ploting rank no.1 and no.2 iris property shows difference by Species. plot scat PetalL PetalW by Species;

// //Example 2 aic analysis for risk status of credit customer property. // //Read credit customer data with risk status. get credit.csv@;

//Since jobcode is numeric as above, jobcode must be defined as code for aic analyis. //Otherwise not defined, 'jobcode' is categoraized automatically. aic status by sex old span a4 - 7 rate a9 a10 jobcode a12 a13 debt amount/ jobcode:code ;

'jobcode' is recognized as code in aic table.

//Test that 'jobcode' is strongly associated with status as follow procedure. //Get count by status and jobcode. count status jobcode/ jobcode:code ;

get freq@ana; //Divided output according to status. if(status == "+") { outrec statp; } else { outrec statm; } //Rename COUNT to avoid overwrite by merge command get statp; rename COUNT=count_p; put statp1; get statm; rename COUNT=count_m //merge count by jobcode. merge statp1 by jobcode;

//Jobcode=0 shows mutch different count according to status. plot bar count_m count_p by jobcode;