如何从glm对象获取Z值-统计信息? [英] How to get values of Z - statistic from glm object?

查看:154
本文介绍了如何从glm对象获取Z值-统计信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从glm对象获取Z-统计值作为矢量? 例如,我有

How can I get values of Z - statistics as a vector from glm object? For example, I have

fit <- glm(y ~ 0 + x,binomial)

如何使用以fit$coef获取系数估计值的方式访问Pr(>|z|)列?

How can I access the column Pr(>|z|) the same way I get estimates of coefficients with fit$coef?

推荐答案

我相信

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)

这篇关于如何从glm对象获取Z值-统计信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆