【发布时间】:2018-06-14 14:35:49
【问题描述】:
我想看看雄性物种是否会影响雌性对雄性求爱的反应。我使用逻辑回归,因为响应是成功(女性对男性求爱有反应)和失败(女性对求爱没有反应)的比例:
behavior <- structure(
list(male = c("speciesB", "speciesB",
"speciesB", "speciesB","speciesB", "speciesB",
"speciesB", "speciesA", "speciesA", "speciesA"),
courtship = c(1, 1, 3, 6, 2, 2, 2, 23, 4, 1),
female_response = c(0,0, 3, 4, 0, 1, 0, 23, 2, 1)),
.Names = c("male", "courtship","female_response"),
row.names = c(1L, 2L, 3L, 4L, 5L, 6L, 7L,40L, 59L, 67L),
class = "data.frame")
model <- glm(cbind(female_response,courtship-female_response)~male,
family=binomial, data=behavior)
除了似然比检验之外,我还想用置换检验来检验我的假设,因为我有一个小数据集(46 位女性),其中有一些异常值似乎过度影响了结果。
据我所知,现在存档的 glmperm() 包中的 prr.test 是对广义线性模型进行置换测试的唯一可用函数。
当我用我的模型调用函数时:
packageurl <- "https://cran.r-project.org/src/contrib/Archive/glmperm//glmperm_1.0-5.tar.gz"
install.packages(packageurl, repos=NULL, type="source")
library(glmperm)
prr.test(cbind(female_response,courtship-female_response) ~ male, var="male" , family=binomial, data=behavior)
我反复收到错误:
Error in prr.test(cbind(female_response, courtship - female_response) ~ :var not a covariate in the formular
为什么 glmperm 被归档?人们为什么不对逻辑回归进行排列测试有什么原因吗?有没有更好的 R 包?
谁能告诉我哪里出错了?这个函数对比例数据不起作用吗?
【问题讨论】:
-
存档页面 cran.r-project.org/web/packages/glmperm/index.html > 显示“存档于 2014-12-07,维护者地址
已退回。”
标签: r permutation logistic-regression