R 如何从clmm输出摘要中提取z值
我正在使用R 如何从clmm输出摘要中提取z值,r,R,我正在使用clmm()函数(来自ordinal软件包)运行混合效应有序逻辑回归,需要为RMem变量提取B估计值的参数 otp <- summary(clmm(Rank ~ RMem + (1|sbj.ID), data = brands)) > otp Cumulative Link Mixed Model fitted with the Laplace approximation formula: as.factor(Rank) ~ RMem + (1 | sbj.ID) da
clmm()
函数(来自ordinal软件包)运行混合效应有序逻辑回归,需要为RMem
变量提取B估计值的参数
otp <- summary(clmm(Rank ~ RMem + (1|sbj.ID), data = brands))
> otp
Cumulative Link Mixed Model fitted with the Laplace approximation
formula: as.factor(Rank) ~ RMem + (1 | sbj.ID)
data: dataset
link threshold nobs logLik AIC niter max.grad cond.H
logit flexible 1921 -5433.43 10908.87 5152(10419) 1.02e-02 1.2e+03
Random effects:
Groups Name Variance Std.Dev.
sbj.ID (Intercept) 0.04227 0.2056
Number of groups: sbj.ID 107
Coefficients:
Estimate Std. Error z value Pr(>|z|)
RM -2.3087 0.1129 -20.46 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Threshold coefficients:
Estimate Std. Error z value
1|2 -4.43967 0.13667 -32.485
2|3 -3.63258 0.11504 -31.576
...
19|20 2.36590 0.11028 21.454
unlist()
函数也只显示估计值。您能告诉我如何提取RMem
变量的B估计值的z值
和p值
谢谢大家! 因此,我无法使用clmm调用完美地进行复制,因为这对我来说是新的,但summary函数似乎返回了相同类型的项,因此这应该可以与所需的某些替换一起使用:
##with the mtcars dataset
data(mtcars)
glm1<-summary(glm(mpg~cyl+disp+hp,data=mtcars))
glm1$coefficients[,'t value'] #change to z value
glm1$coefficients[,'Pr(>|t|)'] #this will return your t-values - you need to change "t" to "z"
##as a data.frame from a function##
getCoefs<-function(summaryModel){
sumResults<-data.frame(coefs=names(summaryModel$coefficients[,'t value']),
t=summaryModel$coefficients[,'t value'],
prT=summaryModel$coefficients[,'Pr(>|t|)'])
return(sumResults)
}
sumResults<-getCoefs(glm1)
使用mtcars数据集
数据(mtcars)
glm1因此,我无法使用clmm调用完美地进行复制,因为这对我来说是新的,但summary函数似乎返回了相同类型的项,因此这应该可以与所需的某些替换一起使用:
##with the mtcars dataset
data(mtcars)
glm1<-summary(glm(mpg~cyl+disp+hp,data=mtcars))
glm1$coefficients[,'t value'] #change to z value
glm1$coefficients[,'Pr(>|t|)'] #this will return your t-values - you need to change "t" to "z"
##as a data.frame from a function##
getCoefs<-function(summaryModel){
sumResults<-data.frame(coefs=names(summaryModel$coefficients[,'t value']),
t=summaryModel$coefficients[,'t value'],
prT=summaryModel$coefficients[,'Pr(>|t|)'])
return(sumResults)
}
sumResults<-getCoefs(glm1)
使用mtcars数据集
数据(mtcars)
glm1Trysummary(otp)$coverties[1,c(3,4)]
非常感谢您的快速回复!我不知道summary(otp)$Courters在最后一行包含RMem的z值和p值(在“系数”字段中报告)。请尝试summary(otp)$Courters[1,c(3,4)]
非常感谢您的快速响应!我不知道summary(otp)$coverties在最后一行中包含RMem的z值和p值(在“coverties”字段中报告)。