Survival Packageの条件付きロジスティック回帰の例を見てみましょう
そして、次のコマンドを使用して
library(survival)
data(logan)
resp <- levels(logan$occupation)
n <- nrow(logan)
indx <- rep(1:n, length(resp))
logan2 <- data.frame(logan[indx,],
id = indx,
tocc = factor(rep(resp, each=n)))
logan2$case <- (logan2$occupation == logan2$tocc)
B <- clogit(case ~ tocc + tocc:education + strata(id), logan2)
これで回帰パラメータを生成できますが、具体的toccfarm
には -1.896 の値が必要だとしましょう。
これだけを出力したり、x
save this として保存したりするにはどうすればよいでしょうか。
使用する場合
B$coefficients
すべての回帰係数を取得します。
私は次のようなことを試しました
B$coefficients[1,]
B$coefficients(term=1)
B$coefficients("toccfarm")
しかし、どれも機能していません