由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Statistics版 - [包子] R的结果里求AIC
相关主题
R 问题请教急问:请教一个muliticollinearity的面试问题,谢谢!
请问:R-square 可以用来评估GLM model得好坏吗I have a question about logistic regression model
R 再请教proc genmod 结果的问题
【包子】问个从R结果中取值的问题怎样比较hierarchical model
what is happening if I got Big negarive AIC/BIC? help~有没有 STATA 的大牛
R 如何自动保存结果到PDF里面?AIC for training data and hold-out data
问关于survival analysis的R codeMaximum Likelihood estimation
SAS base question还是MLE分布拟合问题
相关话题的讨论汇总
话题: aic话题: coef话题: hr0话题: loglik话题: extractaic
进入Statistics版参与讨论
1 (共1页)
S********a
发帖数: 359
1
有个conditional logistic regression,想看AIC,但是结果里并没有给出来,请教什么
code或者命令把AIC求出来。谢谢。
> result0<-clogit(case~hr0+strata(subjid), data=mydata)
> summary(result0)
Call:
coxph(formula = Surv(rep(1, 9704L), case) ~ hr0 + strata(subjid),
data = mydata, method = "exact")
n=8397 (1307 observations deleted due to missingness)
coef exp(coef) se(coef) z Pr(>|z|)
hr0 0 0.001158 1.001158 0.005376 0.215 0.83
exp(coef) exp(-coef) lower .95 upper .95
hr0 1.001 0.9988 0.9907 1.012
Rsquare= 0 (max possible= 0.459 )
Likelihood ratio test= 0.05 on 1 df, p=0.8296
Wald test = 0.05 on 1 df, p=0.8295
Score (logrank) test = 0.05 on 1 df, p=0.8295
t****a
发帖数: 1212
2
The definition of AIC is
AIC = 2k - 2ln(L)
where k is the number of parameters in the statistical model, and L is the
maximized value of the likelihood function for the estimated model.
In your case k=1 and L=x$loglik
so you can compute it by yourself.
point me out if I am wrong ....
S********a
发帖数: 359
3
包子已发,谢谢回复,回帖里L=x$loglik, x是什么?好像AIC本身就是一个函数,可
以求出结果,但是有如下错误信息,这意味着对clogit用R来处理,是不是不能求出AIC
呢? 另外extractAIC的结果可以当作AIC来用吗?谢谢
> AIC(result0)
Error in UseMethod("logLik") :
no applicable method for 'logLik' applied to an object of class "c('clogit
', 'coxph')"
> extractAIC(result0)
[1] 1.000 5166.643

【在 t****a 的大作中提到】
: The definition of AIC is
: AIC = 2k - 2ln(L)
: where k is the number of parameters in the statistical model, and L is the
: maximized value of the likelihood function for the estimated model.
: In your case k=1 and L=x$loglik
: so you can compute it by yourself.
: point me out if I am wrong ....

l*********s
发帖数: 5409
4
yes

AIC
clogit

【在 S********a 的大作中提到】
: 包子已发,谢谢回复,回帖里L=x$loglik, x是什么?好像AIC本身就是一个函数,可
: 以求出结果,但是有如下错误信息,这意味着对clogit用R来处理,是不是不能求出AIC
: 呢? 另外extractAIC的结果可以当作AIC来用吗?谢谢
: > AIC(result0)
: Error in UseMethod("logLik") :
: no applicable method for 'logLik' applied to an object of class "c('clogit
: ', 'coxph')"
: > extractAIC(result0)
: [1] 1.000 5166.643

t****a
发帖数: 1212
5
Thanks for your baozi and reply:)
I think you are right. extractAIC return 2 number: the degree of freedom and
AIC. In your case 5166.643 is AIC.
> x=clogit(case~spontaneous+induced+strata(stratum),data=infert)
> extractAIC(x)
[1] 2.0000 132.4045 # AIC = 132.4045
> x$loglik
[1] -90.77935 -64.20224 # -64.20224 is the loglik of the final fitted model,
see ?coxph.object
> 2*2-2*x$loglik[2] # try the formula AIC = 2*k - 2*ln(L)
[1] 132.4045 # the number equal to the result of extractAIC
Thanks for telling me extractAIC function.
S********a
发帖数: 359
6
I appreciate your help a lot!!!

and

【在 t****a 的大作中提到】
: Thanks for your baozi and reply:)
: I think you are right. extractAIC return 2 number: the degree of freedom and
: AIC. In your case 5166.643 is AIC.
: > x=clogit(case~spontaneous+induced+strata(stratum),data=infert)
: > extractAIC(x)
: [1] 2.0000 132.4045 # AIC = 132.4045
: > x$loglik
: [1] -90.77935 -64.20224 # -64.20224 is the loglik of the final fitted model,
: see ?coxph.object
: > 2*2-2*x$loglik[2] # try the formula AIC = 2*k - 2*ln(L)

1 (共1页)
进入Statistics版参与讨论
相关主题
还是MLE分布拟合问题what is happening if I got Big negarive AIC/BIC? help~
一个理论题R 如何自动保存结果到PDF里面?
用glimmix run logit model问关于survival analysis的R code
这个criterion结果如何解释和选择model啊SAS base question
R 问题请教急问:请教一个muliticollinearity的面试问题,谢谢!
请问:R-square 可以用来评估GLM model得好坏吗I have a question about logistic regression model
R 再请教proc genmod 结果的问题
【包子】问个从R结果中取值的问题怎样比较hierarchical model
相关话题的讨论汇总
话题: aic话题: coef话题: hr0话题: loglik话题: extractaic