p 値と信頼区間は、モデル オブジェクト自体の一部として保存されているようです。このsummary.elrm
関数は、その情報の一部を抽出してフォーマットするだけです。これを理解するために使用した手順を以下に示しますが、要約バージョンは、object$p.values
およびobject$coeffs.ci
それぞれのモデル オブジェクト自体にインデックスを付けることです。
#Example from help page
data(utiDat)
uti.elrm <- elrm(uti/n~age+current+dia+oc+pastyr+vi+vic+vicl+vis,
interest=~dia,r=4,iter=5000,burnIn=1000,dataset=utiDat)
#Look at summary
summary(uti.elrm)
#Let's examine the structure of the summary object to see what's in there, i.e.
#what can we extract?
str(summary(uti.elrm))
#Hmm, doesn't look like anything of interest. Let's look at the source code itself
summary.elrm
#Looks like the p.values are stored in the actual model object iself and the summary function
#just formats them for us. The relevant part of the summary code for the p-value is:
#-----
#inferences = as.data.frame(cbind(round(as.numeric(object$coeffs),5),
# round(as.numeric(object$p.values), 5),
# round(as.numeric(object$p.values.se),5),
# object$mc.size)
# )
#results = data.frame(row.names = names(object$coeffs), inferences)
#names(results) = c("estimate", "p-value", "p-value_se", "mc_size")
#So, it looks like we can grab the p.values directly from "object"
> uti.elrm$p.values
dia
0.02225
#And the confidence intervals are also in the object, located here in the summary code:
#-----
#cat(object$ci.level, "% Confidence Intervals for Parameters\n",
# sep = "")
#cat("\n")
#print(object$coeffs.ci)
#So we can extract them thusly:
> uti.elrm$coeffs.ci
lower upper
dia 0.1256211 Inf