<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: JMP script to generate cumulative value after modeling in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/JMP-script-to-generate-cumulative-value-after-modeling/m-p/897910#M105788</link>
    <description>&lt;P&gt;Hi, jthi&lt;BR /&gt;Thanks, this works. All my code is generated by AI. I start to script in JMP last week. I can hardly wrote a single line of code by myself. Is there a place that I can learn JMP script?&lt;BR /&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 29 Aug 2025 18:29:05 GMT</pubDate>
    <dc:creator>Caozheng0115</dc:creator>
    <dc:date>2025-08-29T18:29:05Z</dc:date>
    <item>
      <title>JMP script to generate cumulative value after modeling</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-script-to-generate-cumulative-value-after-modeling/m-p/897496#M105760</link>
      <description>&lt;P&gt;Hi, all&lt;BR /&gt;I am new to JMP and tried to write a script&lt;BR /&gt;I use JMP 18 standard and perform recurrence analysis. The model I use is loglinear NHPP. I want to generate specific cumulative value at 100k, 200k, 300k, 400k and 500k transactions. I can see there is click option in the UI for each transaction (shown in the attachment). But I want to automate this using scripts. Following is the script I tried: It generate an error in the figure. Is there Could you help me with the code?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Caozheng0115_3-1756390218559.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/81441i08CAB7C7C58A2D50/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Caozheng0115_3-1756390218559.png" alt="Caozheng0115_3-1756390218559.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Caozheng0115_0-1756389953346.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/81438i0898C242FFEF917D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Caozheng0115_0-1756389953346.png" alt="Caozheng0115_0-1756389953346.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Run the analysis and capture the report
rec_report = Recurrence Analysis(
	Y( :Accumulated Transactions ),
	Label( :BOT ID ),
	Cost( :SAP Purchase Price ),
	Grouping( :Bot Series ),
	Event Plot( 0 ),
	MCF Confid Limits( 1 ),
	Fit Model(
		Scale Effects( :Bot Series ),
		Shape Effects( :Bot Series ),
		Run Model,
		Model Type( "Loglinear Nonhomogeneous Poisson Process" )
	)
);

// --- Extract Estimates ---
// Get the "Estimates" table directly from the report and convert it to a scriptable object
estimates_table = rec_report["Loglinear NHPP Report", "Estimates"] &amp;lt;&amp;lt; Table Box;

// Get the 'Estimate' column values as a list.
// The order is consistently Lambda, then Beta.
estimates_list = estimates_table &amp;lt;&amp;lt; Get Values( "Estimate" );

// Assign the parameter estimates from the list
lambda_hat = estimates_list[1]; // Lambda (λ) is the first estimate
beta_hat = estimates_list[2]; // Beta (β) is the second estimate

// Define the transactions for which to calculate values
transactions = {100000, 200000, 300000, 400000, 500000};

// Calculate and display intensity and cumulative values
For( i = 1, i &amp;lt;= N Items( transactions ), i++,
	transaction_time = transactions[i];

	// Cumulative Mean Function C(t) = λ * t^β
	cumulative = lambda_hat * (transaction_time ^ beta_hat);

	// Instantaneous Intensity λ(t) = λ * β * t^(β-1)
	intensity = lambda_hat * beta_hat * (transaction_time ^ (beta_hat - 1));

	// Print the results to the log
	Show( transaction_time, cumulative, intensity );
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 28 Aug 2025 14:11:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-script-to-generate-cumulative-value-after-modeling/m-p/897496#M105760</guid>
      <dc:creator>Caozheng0115</dc:creator>
      <dc:date>2025-08-28T14:11:17Z</dc:date>
    </item>
    <item>
      <title>Re: JMP script to generate cumulative value after modeling</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-script-to-generate-cumulative-value-after-modeling/m-p/897509#M105761</link>
      <description>&lt;P&gt;Most likely you wish to include Table Box inside your report subscript instead of sending a message to it&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;estimates_table = rec_report["Loglinear NHPP Report", "Estimates", Table Box(1)]&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also I think your "Estimates" should be "Parameter Estimates" (or use ? wildcard)'. Here is example until that point using JMP's sample data&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Reliability/Bladder Cancer.jmp");

ra = dt &amp;lt;&amp;lt; Recurrence Analysis(
	Y(:Age),
	Label(:Patient Number),
	Cost(:Cost),
	Grouping(:Treatment Group),
	Event Plot(1),
	Fit Model(
		Scale Effects(:Intensity),
		Shape Effects(:Intensity),
		Run Model,
		Model Type("Power Nonhomogeneous Poisson Process")
	)
);


tb = Report(ra)[OutlineBox("Fitted Recurrence Model"), OutlineBox("Parameter Estimates"), TableBox(1)];
estimates = tb[NumberColBox("Estimate")] &amp;lt;&amp;lt; get;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Aug 2025 14:30:08 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-script-to-generate-cumulative-value-after-modeling/m-p/897509#M105761</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-08-28T14:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: JMP script to generate cumulative value after modeling</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-script-to-generate-cumulative-value-after-modeling/m-p/897832#M105784</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;A class="trigger-hovercard" href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366" target="_blank"&gt;jthi&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;It works now. Thanks a lot.&lt;BR /&gt;I should not try to create my own formular. There is 'Specific Intensity and Cumulative' under 'Fitted Recurrence Model' after I run the model in JMP. It can generate the cumulative value with confidence interval. I can just use the formular instead of creating a new one. I tried to get the formular to generate new results in a table. But failed. Could you help? The error is in the image. Thanks again.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Caozheng0115_0-1756479195959.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/81572iFDAA6CC3F3780000/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Caozheng0115_0-1756479195959.png" alt="Caozheng0115_0-1756479195959.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

// --- Run the analysis ---
rec_report = Recurrence Analysis(
	Y( :Accumulated Transactions ),
	Label( :BOT ID ),
	Cost( :SAP Purchase Price ),
	Grouping( :Bot Series ),
	Event Plot( 0 ),
	MCF Confid Limits( 1 ),
	Fit Model(
		Scale Effects( :Bot Series ),
		Shape Effects( :Bot Series ),
		Run Model,
		Model Type( "Loglinear Nonhomogeneous Poisson Process" )
	)
);

// --- Save JMP’s own formulas into the source table ---
rec_report &amp;lt;&amp;lt; Save Intensity Formula;
rec_report &amp;lt;&amp;lt; Save Cumulative Formula;

// Grab those formulas so we can reuse them in a clean table
dt_src=Current Data Table();
intensity_formula  = Column( dt_src, "Intensity" )  &amp;lt;&amp;lt; Get Formula;
cumulative_formula = Column( dt_src, "Cumulative" ) &amp;lt;&amp;lt; Get Formula;

// --- Define the transaction times you care about ---
transactions = {100000, 200000, 300000, 400000, 500000};

// --- Build a results table with JMP-calculated fitted values ---
dt_sic = New Table( "Specific Intensity and Cumulative",
	New Column( "Accumulated Transactions", Numeric, "Continuous", Values( transactions ) ),
	New Column( "Intensity",  Numeric, Formula( intensity_formula ) ),
	New Column( "Cumulative", Numeric, Formula( cumulative_formula ) )
);

// Evaluate formulas and show the table
dt_sic &amp;lt;&amp;lt; Recalculate;
dt_sic &amp;lt;&amp;lt; Bring Window To Front;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Aug 2025 15:01:55 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-script-to-generate-cumulative-value-after-modeling/m-p/897832#M105784</guid>
      <dc:creator>Caozheng0115</dc:creator>
      <dc:date>2025-08-29T15:01:55Z</dc:date>
    </item>
    <item>
      <title>Re: JMP script to generate cumulative value after modeling</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-script-to-generate-cumulative-value-after-modeling/m-p/897840#M105787</link>
      <description>&lt;P&gt;Your script very strongly looks like AI generated... Note that these are not documented in Scripting Index (&amp;lt;&amp;lt; Save Intensity Formula and &amp;lt;&amp;lt; Save Cumulative Formula) but you can "figure it out" by tinkering around&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Reliability/Bladder Cancer.jmp");
ra = dt &amp;lt;&amp;lt; Recurrence Analysis(
	Y(:Age),
	Label(:Patient Number),
	Cost(:Cost),
	Grouping(:Treatment Group),
	Event Plot(1),
	Fit Model(
		Scale Effects(:Age),
		Run Model,
		Model Type("Proportional Intensity Poisson Process")
	)
);

fit = Report(ra)[OutlineBox("Fitted Recurrence Model")] &amp;lt;&amp;lt; Get Scriptable Object;

intensity_col = fit &amp;lt;&amp;lt; Save Intensity Formula;
cumul_col = fit &amp;lt;&amp;lt; Save Cumulative Formula;

i_f = intensity_col &amp;lt;&amp;lt; Get Formula;
c_f = cumul_col &amp;lt;&amp;lt; Get Formula;

transactions = {1, 2, 3, 4, 5};
dt_s = New Table("Specific Intensity and Cumulative",
	New Column("Age", Numeric, "Continuous", Values(transactions))
);

Eval(Eval Expr(
	dt_s &amp;lt;&amp;lt; New Column("Intensity", Numeric, Continuous, Formula(
		Expr(NameExpr(i_f))
	));
));

Eval(Eval Expr(
	dt_s &amp;lt;&amp;lt; New Column("Cumulative", Numeric, Continuous, Formula(
		Expr(NameExpr(c_f))
	));
));

Write();&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2026"&gt;@jules&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Aug 2025 17:15:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-script-to-generate-cumulative-value-after-modeling/m-p/897840#M105787</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-08-29T17:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: JMP script to generate cumulative value after modeling</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-script-to-generate-cumulative-value-after-modeling/m-p/897910#M105788</link>
      <description>&lt;P&gt;Hi, jthi&lt;BR /&gt;Thanks, this works. All my code is generated by AI. I start to script in JMP last week. I can hardly wrote a single line of code by myself. Is there a place that I can learn JMP script?&lt;BR /&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Aug 2025 18:29:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-script-to-generate-cumulative-value-after-modeling/m-p/897910#M105788</guid>
      <dc:creator>Caozheng0115</dc:creator>
      <dc:date>2025-08-29T18:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: JMP script to generate cumulative value after modeling</title>
      <link>https://community.jmp.com/t5/Discussions/JMP-script-to-generate-cumulative-value-after-modeling/m-p/897929#M105790</link>
      <description>&lt;P&gt;Use enhanced log in JMP and learn the different methods how JMP is able to create some of the scripts for you. There is also&amp;nbsp;&lt;A href="https://www.jmp.com/support/help/en/18.2/jmp/introduction-to-writing-jsl-scripts.shtml" target="_blank" rel="noopener"&gt;Scripting Guide&lt;/A&gt;&amp;nbsp;, you have direct access to Scripting Index from JMP's Help menu and JMP Community does have a lot of content like&amp;nbsp;&lt;A href="https://community.jmp.com/t5/Introduction-to-the-JMP/Introduction-to-the-JMP-Scripting-Language/ta-p/539562" target="_blank" rel="noopener"&gt; Introduction to the JMP Scripting Language&lt;/A&gt;&amp;nbsp;,&amp;nbsp;&lt;A href="https://community.jmp.com/t5/JMP-Scripters-Club/gh-p/scripting-jug" target="_blank" rel="noopener"&gt;JMP Scripters Club&lt;/A&gt;&amp;nbsp;and&amp;nbsp;&lt;A href="https://community.jmp.com/t5/JSL-Cookbook/tkb-p/jmp-scripting" target="_blank" rel="noopener"&gt;JSL Cookbook&lt;/A&gt;&amp;nbsp;.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Aug 2025 19:12:02 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/JMP-script-to-generate-cumulative-value-after-modeling/m-p/897929#M105790</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2025-08-29T19:12:02Z</dc:date>
    </item>
  </channel>
</rss>

