Missing Y Response Variable Fit Model Proportional HazardsI am trying to do some Survival analysis, where I am combining some analysis into one script. So what I am trying to do, is they enter the columns into the Survival Platform, then I take those columns and use them in the Proportional Hazards Platform. My script works great except for the Y, response, it will not find the Y response variable. If I change Y( As Column( Ycolname ) ), to something like Y("Time to Failure"), it works great. But when I try to use the variable, it does not work.
</CODE></P><P>I have two questions - why does my method work for Censor and the Xs, but not the Ys.</P><P>Second question, if they do not enter a by or frequency column, how do I tell the fit model that there is not a column to enter. If I use As Column (variable) it says it cannot find my column, which is right.</P><P> </P><P> </P><P> </P><PRE><CODE class=" language-jsl">Names Default To Here( 1 );
Clear Log();
dt = Current Data Table();
If( Not( Is Scriptable( dt ) ),
dtsel = Pick File( "Open File", {"JMP|jmp", "All files|*"} );
If( dtsel == "",
Stop(),
Try( dt = Open( dtsel ), Stop() )
);
);
dtname = Data Table( dt ) << Get Name;
validated = 0;
New Window( "Survival/Reliability",
<<MODAL></MODAL>
AnalyticsmacOSScriptingRe: Missing Y Response Variable Fit Model Proportional HazardsThanks for your guidance, you have been extremely helpful!
My problem was - if on the first screen there was no column put into frequency,
Freqname = Arg( survival[4], 1 );
This would would return as empty.
So if I tried to run the script:
Platform = dt << Fit Model(
Freq( Column( Freqname ) ),
By( Column( Byname ) ),
Y( Column( Ycolname ) ),
Censor( Column( Censorname ) ),
Effects( Column( Effectname ) ),
Personality( "Proportional Hazard" ),
Censor Code( "1" ),
Run Model( Likelihood Ratio Tests( 1 ), Likelihood Confidence Intervals( 1 ), Risk Ratios( 1 ) )
)
It would say there is not column for frequency, which was true.
So what I did was to put 8 nested if loops looking to see which columns were empty.
Not exactly the best way maybe, but it worked.
Re: Missing Y Response Variable Fit Model Proportional HazardsI am not sure that I understand the problem. Here is what I have tried and seen.
I first modify Rats.jmp to mock up a case so I can test your codes:

I added a column By and evenly split the data into two groups.
I modified the last piece of your codes to the following.
if (isempty(byname),
Platform = dt << Fit Model(
// Freq(),
// By(),
Y( Column( Ycolname ) ),
Censor( Column( Censorname ) ),
Effects( Column( Effectname ) ),
Personality( "Proportional Hazard" ),
Censor Code( "1" ),
Run Model( Likelihood Ratio Tests( 1 ), Likelihood Confidence Intervals( 1 ), Risk Ratios( 1 ) )
),
Platform = dt << Fit Model(
// Freq(),
By( column(byname) ),
Y( Column( Ycolname ) ),
Censor( Column( Censorname ) ),
Effects( Column( Effectname ) ),
Personality( "Proportional Hazard" ),
Censor Code( "1" ),
Run Model( Likelihood Ratio Tests( 1 ), Likelihood Confidence Intervals( 1 ), Risk Ratios( 1 ) )
)
);
I tried two paths to execute the codes:
First, run the code and enter roles as follows:

No "By". and the behavior of the codes is as what was before.
Second, run the code and enter roles as follows:

With "By", and I see an error message in the end:

I guess the intermediate results are different, and your codes have not handled the situation correctly.
Re: Missing Y Response Variable Fit Model Proportional HazardsDid you have any suggestions on my second question?
if they do not enter a by or frequency column, how do I tell the fit model that there is not a column to enter. If I use Column (variable) it says it cannot find my column, which is right.
Re: Missing Y Response Variable Fit Model Proportional HazardsI know I tried this and it did not work for me, but when I pasted your code it worked perfectly. I have no idea of why, but it works so THANK YOU!
Re: Missing Y Response Variable Fit Model Proportional HazardsI cannot reproduce the problem if I change As Column to Column. Here is the full codes that I run. I just changed the last three As Column to Column.
Names Default To Here( 1 );
Clear Log();
dt = Current Data Table();
If( Not( Is Scriptable( dt ) ),
dtsel = Pick File( "Open File", {"JMP|jmp", "All files|*"} );
If( dtsel == "",
Stop(),
Try( dt = Open( dtsel ), Stop() )
);
);
dtname = Data Table( dt ) << Get Name;
validated = 0;
New Window( "Survival/Reliability",
<<MODAL></MODAL>
Here are my steps and what I saw. I have checked JMP14, JMP15, and JMP16. I believe your version is not further back due to how your codes use new name literals.
- Open Rats.jmp
- Run the script
- Specify the dialog when it pops up, then click OK

- Some reports show up. And this is the Fit Model launch dialog looks like:

If you cannot see what I am seeing here, I can only suspect there is something that neither of us are aware of. If so, you may want to contact support@jmp.com to get some help.
Re: Missing Y Response Variable Fit Model Proportional HazardsI know, I got the same thing where the fit model did not come up, if I moved Eval(PH) to the bottom, which is why I moved it where I did. I also got the same error with Rats, but not this error with my files, not sure why. If I take out the Expression and just let it run like this, then the error goes away and I get the same problem as before, without Expr(PH) is pasted below the screen shot, the other columns come through, but not the Y. This script is correct and my most recent. If you have any ideas, please let me know! This is very frustrating for me and I have no idea of why!

Names Default To Here( 1 );
Clear Log();
dt = Current Data Table();
If( Not( Is Scriptable( dt ) ),
dtsel = Pick File( "Open File", {"JMP|jmp", "All files|*"} );
If( dtsel == "",
Stop(),
Try( dt = Open( dtsel ), Stop() )
);
);
dtname = Data Table( dt ) << Get Name;
validated = 0;
New Window( "Survival/Reliability",
<<MODAL></MODAL>Re: Missing Y Response Variable Fit Model Proportional HazardsWould you please double check your script? I don't see how to get to the dialog that you show here.
I got an error message:

If I move Eval(PH) to the bottom of your script, and change As Column to Column, then I don't see the Fit Model dialog at all.
BTW, I use Rats.jmp to test. "days" to Y, "Censor" to Censor, "Group" to Grouping.
Re: Missing Y Response Variable Fit Model Proportional HazardsColumn does the same thing as As Column, it fills in the information except for the Y:

Re: Missing Y Response Variable Fit Model Proportional HazardsIf you use Column, instead of As Column, do you get what you want? I don't actually see under what situation, one has to use As Column, rather than Column. Maybe, one of my colleagues who has more knowledge about this function can comment.