cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Caozheng0115
Level III

recurrence analysis cumulative formula (was JSL coding)

Hi, all

I want to Save Cumulative Formula from a model for each Cause level in recurrence analysis model. Following is the code I have 

ra = Recurrence Analysis(
	Y( :age ),
	Label( :BOT ID ),
	Cost( :Censor ),
	Grouping( :Bot Series ),
	Event Plot( 0 ),
	Fit Model(
		Scale Effects( :Bot Series ),
		Shape Effects( :Bot Series ),
		Run Model,
		Model Type( "Proportional Intensity Poisson Process" )
	)
);
// Get fitted recurrence model object
fit = Report(ra)[OutlineBox("Fitted Recurrence Model")] << Get Scriptable Object;

// Save intensity and cumulative formulas from fit
intensity_col = fit << Save Intensity Formula;
cumul_col     = fit << Save Cumulative Formula (
	If( :Part Grouping2 == "Caster Assy-Left"",
            full_formula
        )
    );

I have Part Grouping2 as Cause and there are 13 levels in Part Grouping2, I want to generate fit value for each level in Part Grouping2. I tried some code but did not work. In the code Part Grouping2 == "Caster Assy-Left" . That is just trying to use the formular for one Part Grouping2 level Caster Assy-Left. There are 13 total levels and I want to automate this so I don't need to repeat 13 times.
Thanks.

 
3 REPLIES 3
jthi
Super User

Re: JSL codeing

What are you trying to extract or do in the end? Your script will create the formulas for you which seem to look something like this

jthi_0-1762581573217.png

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Reliability/Bladder Cancer.jmp");
ra = dt << Recurrence Analysis(
	Y(:Age),
	Cost(:Cost),
	Grouping(:Treatment Group),
	Label(:Patient Number),
	Fit Model(
		Scale Effects(:Treatment Group),
		Shape Effects(:Treatment Group),
		Run Model,
		Model Type("Proportional Intensity Poisson Process")
	)
);

fit = Report(ra)[Outline Box("Fitted Recurrence Model")] << Get Scriptable Object;
intensity_col = fit << Save Intensity Formula;
cumul_col = fit << Save Cumulative Formula;
-Jarmo
Caozheng0115
Level III

Re: JSL codeing

Hi,

Thanks for your reply.

I want to predict the cumulative values (number of repairs in this study) 90 days later for each machine. I figured it out.

I just need to use "fit = Report(ra)[OutlineBox("Fitted Recurrence Model Cause= Caster Assay-Left)] << Get Scriptable Object;". So the "Cause =" will generate the formular for the cause level I want. 

To automate this for 13 cause levels, I just created a list of cause and use a for loop to go through each level.

Thanks.

jthi
Super User

Re: JSL codeing

You are using By column? Most likely looping isn't necessary but that is a good option, just make sure you aren't overwriting any columns by accident

If you are using By column, broadcasting might also work if it does what you are looking for

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Reliability/Bladder Cancer.jmp");
ra = dt << Recurrence Analysis(
	Y(:Age),
	Cost(:Cost),
	Grouping(:Treatment Group),
	Label(:Patient Number),
	Fit Model(
		Scale Effects(:Treatment Group),
		Shape Effects(:Treatment Group),
		Run Model,
		Model Type("Proportional Intensity Poisson Process")
	),
	By(:Cause of Death)
);

fit = Report(ra[1])[Outline Box("Fitted Recurrence Model")] << Get Scriptable Object;
fit << Broadcast(Save Intensity Formula);
fit << Broadcast(Save Cumulative Formula);

jthi_0-1762891507569.png

 

 

-Jarmo

Recommended Articles