當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


R probably cal_plot_regression 回歸校準圖

計算觀測值和預測值的散點圖,其中軸相同。當 smooth = TRUE 時,顯示廣義加性模型擬合。如果預測經過良好校準,擬合曲線應與對角線對齊。

用法

cal_plot_regression(.data, truth = NULL, estimate = NULL, smooth = TRUE, ...)

# S3 method for data.frame
cal_plot_regression(
  .data,
  truth = NULL,
  estimate = NULL,
  smooth = TRUE,
  ...,
  .by = NULL
)

# S3 method for tune_results
cal_plot_regression(.data, truth = NULL, estimate = NULL, smooth = TRUE, ...)

# S3 method for grouped_df
cal_plot_regression(.data, truth = NULL, estimate = NULL, smooth = TRUE, ...)

參數

.data

包含預測列的未分組 DataFrame 對象。

truth

真實結果的列標識符(數字)。這應該是一個不帶引號的列名。

estimate

預測的列標識符。這應該是一個不帶引號的列名

smooth

邏輯上:應該添加更平滑的曲線。

...

傳遞給 ggplot2::geom_point() 的其他參數。

.by

分組變量的列標識符。這應該是一個不帶引號的列名稱,用於選擇用於分組的定性變量。默認為 NULL 。當.by = NULL時,不會進行分組。

一個 ggplot 對象。

例子

cal_plot_regression(boosting_predictions_oob, outcome, .pred)


cal_plot_regression(boosting_predictions_oob, outcome, .pred,
                    alpha = 1 / 6, cex = 3, smooth = FALSE)


cal_plot_regression(boosting_predictions_oob, outcome, .pred, .by = id,
                    alpha = 1 / 6, cex = 3, smooth = FALSE)

相關用法


注:本文由純淨天空篩選整理自Max Kuhn等大神的英文原創作品 Regression calibration plots。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。