JMP 18.1.2 從「擬合 Y 與 X」分析中提取 R 方值執行分析 > 用 X 擬合 Y。對於我遺漏的內容有什麼想法嗎?
// Open Data Table
dt = Data Table( "Raw Data" );
// Run Fit Y by X Analysis with a By Variable
fitObj = dt << Fit Y by X( Y( :"Mean(VALUEABS)" ), X( :Mean ), By( :PARM_LABEL ) );
// Get the analysis report
rpt = fitObj << Get Report;
// Find all RSquare nodes in the report
rsquareNodes = rpt << Find All Matching Elements( "RSquare" );
Show( "Number of RSquare nodes found: " || Char( N Items( rsquareNodes ) ) );
// Initialize a list to store the by group and RSquare pairs
rsquareData = {};
// Loop over each RSquare node found
For( i = 1, i <= N Items( rsquareNodes ), i++,
{
// Extract the RSquare text and convert to numeric value
rsqText = rsquareNodes[i] << Get Text ; rsqVal = Num( rsqText ) ;
// Try to retrieve the by-group label.
parentObj = rsquareNodes[i] << Get Parent ; byLabel = "" ;
While( byLabel == "" & parentObj != {},
byLabel = parentObj << Get Text;
If( byLabel == "",
parentObj = parentObj << Get Parent
);
) ;
// Append the pair (by group label, RSquare value) to list.
Append( rsquareData, {byLabel, rsqVal} ) ; }
);
Show( rsquareData );
// Create a new data table to store the RSquare values by by-group.
rsqDT = New Table( "RSquare Values",
Add Columns(
Column( "By Group", Character, "Nominal" ),
Column( "RSquare", Numeric, "Continuous" )
)
);
// Populate the new data table with the extracted values
For( i = 1, i <= N Items( rsquareData ), i++,
{New Row( rsqDT ) ; rsqDT:("By Group")[Row()] = rsquareData[i][1] ; rsqDT:RSquare[
Row()] = rsquareData[i][2] ; }
);
// Display the new data table
Show( rsqDT );
(以上 JSL 從純文字顯示移至 JMP JSL 顯示格式) txnelson
自動化和腳本回覆:JMP 18.1.2 從擬合 Y 與 X 分析中提取 R 方值您正在尋找哪一個 RSquare?通常,您會在 JMP 中手動執行此操作,然後採用 JMP 為您建立的腳本(或使用工作流程並從中取得腳本)。因此在這種情況下:
1. 打開你的桌子
2. 運行分析

3. 根據需要對報告/分析進行修改(I適合線)

4.從表格製作成資料表

5. 取得腳本
// Open Data Table: Big Class.jmp
// → Data Table("Big Class")
Open("$SAMPLE_DATA/Big Class.jmp");
// Combine similar TableBoxes into a Data Table
// → Data Table("Untitled")
Local({obj},
obj = Data Table("Big Class") << Bivariate(
Y(:height),
X(:weight),
Fit Line({Line Color({230, 159, 0})}),
By(:age)
);
Report(obj[1])["Linear Fit", "Summary of Fit", Table Box(1)] <<
Make Combined Data Table;
obj[1] << Close Window;
);
然後你可以修改它,讓它變得更好一點,最終得到類似
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
biv = dt << Bivariate(
Y(:height),
X(:weight),
Fit Line({Line Color({230, 159, 0})}),
By(:age)
);
dt_result = Report(biv[1])["Linear Fit", "Summary of Fit", Table Box(1)] << Make Combined Data Table;
dt_result << Select Where(:Column 1 != "RSquare") << delete rows << clear select;回覆:JMP 18.1.2 從擬合 Y 與 X 分析中提取 R 方值您的語法存在多個問題。以下是我如何處理這個問題的一個例子
// Open Data Table
dt = Data Table( "Raw Data" );
// Run Fit Y by X Analysis with a By Variable
fitObj = dt << Fit Y by X( Y( :"Mean(VALUEABS)" ), X( :Mean ), By( :PARM_LABEL ) );
dt=current data table();
fitObj = dt << Bivariate(
Y( :height ),
X( :weight ),
Fit Line( {Line Color( {212, 73, 88} )} ),
By( :sex )
);
nrpts = nitems(fitObj);
report(fitobj[1])[OutlineBox(1)] << get title
// Find all RSquare nodes in the report
Show( "Number of RSquare nodes found: " || Char( nrpts ) );
rsquareData = {};
// Initialize a list to store the by group and RSquare pairs
For Each( {obj}, fitObj,
r2=report(obj);
rsq = (r2["Linear Fit","Summary of Fit",numbercolbox(1)]<<GET></GET>回覆:JMP 18.1.2 從擬合 Y 與 X 分析中提取 R 方值初始程式碼看起來確實像是人工智慧生成的,這可以解釋語法中的許多錯誤。
回覆:JMP 18.1.2 從擬合 Y 與 X 分析中提取 R 方值謝謝您的回覆。我正在尋找 R 方值。我已經運行了 Fit Y By X 分析並從日誌中獲取了程式碼。然後我添加了一條適合的線,但該操作未被記錄。已經有一段時間了,我已經忘記了右鍵單擊並製作成資料表的功能。感謝您對此的複習。
回覆:JMP 18.1.2 從擬合 Y 與 X 分析中提取 R 方值吉姆,謝謝你提供這個解決方案。我非常感激。
回覆:JMP 18.1.2 從擬合 Y 與 X 分析中提取 R 方值你說得對!正如我之前所說,我忘記了右鍵單擊“製作成資料表”選項,因此我求助於 ChatGPT。