从R中的glm提取系数 [英] extract coefficients from glm in R

查看:101
本文介绍了从R中的glm提取系数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我执行了逻辑回归,结果如下:

I have performed a logistic regression with the following result:

ssi.logit.single.age["coefficients"]
# $coefficients
#  (Intercept)          age 
# -3.425062382  0.009916508 

我需要获取 age 的系数,目前我使用以下代码:

I need to pick up the coefficient for age, and currently I use the following code:

ssi.logit.single.age["coefficients"][[1]][2]

它可以工作,但是我不喜欢这里的密码,我可以使用系数的名称(即(拦截) age )

It works, but I don't like the cryptic code here, can I use the name of the coefficient (i.e. (Intercept) or age)

推荐答案

有一个称为 coef 的提取函数可以从模型中获取系数:

There is an extraction function called coef to get coefficients from models:

coef(ssi.logit.single.age)["age"]

这篇关于从R中的glm提取系数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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