dat <- structure(list(Response = c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
                                   1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 0L,
                                   0L, 0L), Temperature = c(29.33, 30.37, 29.52, 29.66, 29.57, 30.04,
                                                            30.58, 30.41, 29.61, 30.51, 30.91, 30.74, 29.91, 29.99, 29.99,
                                                            29.99, 29.99, 29.99, 29.99, 30.71, 29.56, 29.56, 29.56, 29.56,
                                                            29.56, 29.57, 29.51)), .Names = c("Response", "Temperature"),
                 class = "data.frame", row.names = c(NA, -27L))
dat

temperature.glm <- glm(Response ~ Temperature, data=dat, family=binomial)
summary(temperature.glm)
par(mfrow=c(1,1))

plot(dat$Temperature, dat$Response, xlab="Temperature",
     ylab="Probability of Response")
curve(predict(temperature.glm, data.frame(Temperature=x), type="resp"),
      add=TRUE, col="red")

library(MASS)
dose.p(temperature.glm,p=0.95)


library(DHARMa)
residh <- simulateResiduals(temperature.glm)
plot(residh)

Última modificación: martes, 30 de mayo de 2023, 18:00