I want to see if the male species affects the behavior of a female in response to male courtship. I am using a logistic regression because the response is a proportion of successes (female responded to male courtship) and failures (female did not respond to courtship):
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)
I would like to test my hypothesis with a permutation test in addition to the likelihood ratio test as I have a small dataset (46 females) with a few outliers that seem to be unduly influencing the results.
As far as I can tell, prr.test from the now archived glmperm() package is the only available function to do permutation test for generalized linear models.
When I call the function with my model:
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)
I repeatedly get the error:
Error in prr.test(cbind(female_response, courtship - female_response) ~ :var not a covariate in the formular
Why is glmperm archived? Is there some reason why people don’t do permutation tests for logistic regression? Is there a better R package?
Can anyone tell me where I went wrong? Does this function not work on proportion data?