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


R broom tidy.cch 整理 a(n) cch 對象

Tidy 總結了有關模型組件的信息。模型組件可能是回歸中的單個項、單個假設、聚類或類。 tidy 所認為的模型組件的確切含義因模型而異,但通常是不言而喻的。如果模型具有多種不同類型的組件,您將需要指定要返回哪些組件。

用法

# S3 method for cch
tidy(x, conf.level = 0.95, ...)

參數

x

survival::cch() 返回的 cch 對象。

conf.level

CI 的置信水平

...

附加參數。不曾用過。僅需要匹配通用簽名。注意:拚寫錯誤的參數將被吸收到 ... 中,並被忽略。如果拚寫錯誤的參數有默認值,則將使用默認值。例如,如果您傳遞 conf.lvel = 0.9 ,所有計算將使用 conf.level = 0.95 進行。這裏有兩個異常:

  • tidy() 方法在提供 exponentiate 參數時會發出警告(如果該參數將被忽略)。

  • augment() 方法在提供 newdata 參數時會發出警告(如果該參數將被忽略)。

帶有列的 tibble::tibble()

conf.high

估計置信區間的上限。

conf.low

估計置信區間的下限。

estimate

回歸項的估計值。

p.value

與觀察到的統計量相關的兩側 p 值。

statistic

在回歸項非零的假設中使用的 T-statistic 的值。

std.error

回歸項的標準誤差。

term

回歸項的名稱。

例子


# load libraries for models and data
library(survival)

# examples come from cch documentation
subcoh <- nwtco$in.subcohort
selccoh <- with(nwtco, rel == 1 | subcoh == 1)
ccoh.data <- nwtco[selccoh, ]
ccoh.data$subcohort <- subcoh[selccoh]

# central-lab histology
ccoh.data$histol <- factor(ccoh.data$histol, labels = c("FH", "UH"))

# tumour stage
ccoh.data$stage <- factor(ccoh.data$stage, labels = c("I", "II", "III", "IV"))
ccoh.data$age <- ccoh.data$age / 12 # age in years

# fit model
fit.ccP <- cch(Surv(edrel, rel) ~ stage + histol + age,
  data = ccoh.data,
  subcoh = ~subcohort, id = ~seqno, cohort.size = 4028
)

# summarize model fit with tidiers + visualization
tidy(fit.ccP)
#> # A tibble: 5 × 7
#>   term     estimate std.error statistic  p.value conf.low conf.high
#>   <chr>       <dbl>     <dbl>     <dbl>    <dbl>    <dbl>     <dbl>
#> 1 stageII    0.735     0.168       4.36 1.30e- 5  0.404      1.06  
#> 2 stageIII   0.597     0.173       3.44 5.77e- 4  0.257      0.937 
#> 3 stageIV    1.38      0.205       6.76 1.40e-11  0.983      1.79  
#> 4 histolUH   1.50      0.160       9.38 0         1.19       1.81  
#> 5 age        0.0433    0.0237      1.82 6.83e- 2 -0.00324    0.0898

# coefficient plot
library(ggplot2)

ggplot(tidy(fit.ccP), aes(x = estimate, y = term)) +
  geom_point() +
  geom_errorbarh(aes(xmin = conf.low, xmax = conf.high), height = 0) +
  geom_vline(xintercept = 0)

相關用法


注:本文由純淨天空篩選整理自大神的英文原創作品 Tidy a(n) cch object。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。