且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从glm对象获取Z值-统计信息?

更新时间:2023-11-09 23:53:04

我相信

coef(summary(fit))[,"Pr(>|z|)"]

将为您提供所需的东西. (summary.glm()返回一个具有coef()方法的对象,该方法返回系数表.)(顺便说一句,如果存在访问器方法,则***直接使用它们而不是直接访问拟合模型的组件,例如优于fit$coef.)

will get you what you want. (summary.glm() returns an object that has a coef() method that returns the coefficient table.) (By the way, if accessor methods exist it's better to use them than to directly access the components of the fitted model -- e.g. coef(fit) is better than fit$coef.)

提取p值和r线性回归求平方的结果给出了相似的答案.

我建议methods(class="summary.glm")来找到可用的访问器方法,但实际上要复杂一些,因为默认方法(在本例中为coef.default())也可能是相关的...

I would suggest methods(class="summary.glm") to find available accessor methods, but it's actually a little bit trickier than that because the default methods (in this case coef.default()) may also be relevant ...

PS (如果想要Z值,则coef(summary(fit))[,"z value"]应该这样做)(您的问题有点模棱两可:通常,当人们说"Z统计量"时,他们表示想要Z值)测试统计信息(而不是p值)

PS if you want the Z values, coef(summary(fit))[,"z value"] should do it (your question is a little bit ambiguous: usually when people say "Z statistic" they mean the want the value of the test statistic, rather than the p value)