Subscribe Bookmark RSS Feed

Logistic Regression - complicated situation

hrkg

Community Trekker

Joined:

Jun 3, 2012

Hi ,

Before, I describe my problem, I need to mention that I work with JMP7.

I have a table with 12 columns, the first 6 columns are descriptive parameters for each of the next 6 columns. The first 6 columns are all characters and last 6 columns are all numeric, binomial.

I need to run logistic regression for each of last 6 columns and use the first 6 columns as predictors to extract "Prob>ChiSq" value from "Pearson" test.

Now, I made the following script for one of the "Y,Response" columns :


dt = Current Data Table();


column_names = dt << Get Column Names(Character, String);



results = New Table("Results", Invisible,


                  New Column("Parameter", character),


                  New Column("GEN", numeric),


                  Add Rows(NItems(column_names))


                    );



for(i=1,i<=NItems(column_names),i++,


  colName = column_names;


  cmd = Expr(


    ow = dt << Contingency(


                Y( :GEN),


                X( :cName ),


                Contingency Table( 0 ),


                Mosaic Plot( 0 )


                );


                Wait(0.1);


   


    owr = ow<<report;


   


   


    pValueBox= owr[NumberColBox(6)];


    pValue = pValueBox[2];



    Column(results,1) = colName;


    Column(results,2) = pValue;


 


    ow << Close Window;


    );


    Substitute Into(cmd,Expr(cName),colName);


    Eval(cmd);


    );


results << journal;


Close(results);


When I run it, it works perfectly. Now, if I add next column to script as :


dt = Current Data Table();


column_names = dt << Get Column Names(Character, String);


results = New Table("Results", Invisible,


                  New Column("Parameter", character),


                  New Column("GEN", numeric),


                  New Column("Ne", numeric),


                  Add Rows(NItems(column_names))


                    );


for(i=1,i<=NItems(column_names),i++,


  colName = column_names;


  cmd = Expr(


    ow = dt << Contingency(


                Y( :GEN, :Ne),


                X( :cName ),


                Contingency Table( 0 ),


                Mosaic Plot( 0 )


                );


                Wait(0.1);


   


    owr = ow<<report;


   


   


    pValueBox= owr[NumberColBox(6)];


    pValue = pValueBox[2];



    pValueBox1= owr[NumberColBox(12)];


    pValue1 = pValueBox1[2];




    Column(results,1) = colName;


    Column(results,2) = pValue;


    Column(results,3) = pValue1; 



    ow << Close Window;


    );


    Substitute Into(cmd,Expr(cName),colName);


    Eval(cmd);


    );


results << journal;


Close(results);


The script stop working. I checked the tree structure and both NumberColBoxes are referring to right values but no journal is created and the script stops working.

Now, my questions :

1) How can I solve my situation when I have static multiple Y values ?

2) Is it possible to define dynamic Y value through a loop ? It becomes complicated for me to have two loops .

I appreciate for any suggestions.