JMP腳本產生建模後的累積值大家好
我是 JMP 新手,嘗試編寫一個腳本
我使用 JMP 18 標準進行遞歸分析。我使用的模型是對數線性 NHPP。我想在 10 萬、20 萬、30 萬、40 萬和 50 萬筆交易時產生具體的累積值。我看到 UI 中每個交易都有一個點擊選項(如附件所示)。但我想使用腳本自動執行此操作。以下是我嘗試的腳本:它在圖中產生了一個錯誤。請問您能幫我提供一下程式碼嗎?


// 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"] << Table Box;
// Get the 'Estimate' column values as a list.
// The order is consistently Lambda, then Beta.
estimates_list = estimates_table << 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 <= 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 );
);
自動化和腳本回覆:JMP腳本用於在建模後產生累積值您很可能希望在報告下標中包含表格框,而不是向其發送訊息
estimates_table = rec_report["Loglinear NHPP Report", "Estimates", Table Box(1)]
另外,我認為你的“估計值”應該是“參數估計值”(或使用?通配符)。以下是使用 JMP 樣本資料的範例。
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Reliability/Bladder Cancer.jmp");
ra = dt << 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")] << get;
回覆:JMP腳本用於在建模後產生累積值嗨, 給你。
現在可以使用了。非常感謝。
我不應該嘗試自己創建公式。在 JMP 中運行模型後,在「擬合遞歸模型」下有「特定強度和累積」選項。它可以產生帶有置信區間的累積值。我可以直接使用公式,而不必建立新公式。我嘗試讓公式在表格中產生新的結果,但失敗了。您能幫忙嗎?錯誤訊息在圖片中。再次感謝。

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 << Save Intensity Formula;
rec_report << 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" ) << Get Formula;
cumulative_formula = Column( dt_src, "Cumulative" ) << 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 << Recalculate;
dt_sic << Bring Window To Front;
回覆:JMP腳本用於在建模後產生累積值您的腳本非常像 AI 生成的...請注意,這些沒有記錄在腳本索引中(<<保存強度公式和<<保存累積公式),但您可以通過修改來“弄清楚”
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Reliability/Bladder Cancer.jmp");
ra = dt << 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")] << Get Scriptable Object;
intensity_col = fit << Save Intensity Formula;
cumul_col = fit << Save Cumulative Formula;
i_f = intensity_col << Get Formula;
c_f = cumul_col << 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 << New Column("Intensity", Numeric, Continuous, Formula(
Expr(NameExpr(i_f))
));
));
Eval(Eval Expr(
dt_s << New Column("Cumulative", Numeric, Continuous, Formula(
Expr(NameExpr(c_f))
));
));
Write();
@朱利安
回覆:JMP腳本用於在建模後產生累積值你好,jthi
謝謝,這有效。我所有的程式碼都是用AI產生的。我上週開始用JMP寫腳本。我自己幾乎寫不出一行程式碼。有沒有什麼地方可以學習JMP腳本?
謝謝。
回覆:JMP腳本用於在建模後產生累積值使用 JMP 中的增強日誌,了解 JMP 如何為您建立腳本的不同方法。此外,JMP 還提供腳本指南,您可以從 JMP 的「說明」功能表直接存取「腳本索引」。 JMP 社群也提供豐富的內容,例如JMP 腳本語言簡介、 JMP 腳本編寫者俱樂部和JSL 手冊。