My top model for American oystercatcher nest survival was predicted by age alone. I am trying to plot the daily survival rate estimates with their confidence intervals. I am having trouble calculating the confidence intervals.
I followed the above example with the formula DSR = exp(log-odds of DSR)/(1+exp(log-odds of DSR)) to calculate the daily survival rate of American oystercatchers across ages 0–35. What would the formula be if I wanted to hand calculate the confidence intervals associated with the daily survival rates? I recognize that I can pull the value of the standard error for the age term from my top model, after naming the top model, and plug this value into a typical standard error formula of lcl = dsr – 1.96*se, but I'm not sure if it makes sense to have a confidence interval that is a consistent amount across all ages so that the graph appears to have a single unchanging width representing the confidence interval.
My main question is if I am pulling the correct value for the standard error to use?
I have previously tried using the function covariate.predictions to get my daily survival rate estimates and confidence intervals in order to plot them, but was not able to successfully do this. However, the above formula for calculating the daily survival rate by hand worked to get my daily survival rate values. I am hoping to use a similar formula to manually calculate the confidence intervals surrounding my daily survival rates, in order to plot them.
Code is below.
Thanks in advance for the help.
- Code: Select all
m0 <- mark(NestSurvivalData, nocc = 115, model = "Nest", model.parameters = list(S=list(formula=~NestAge)))
m0
age <- c(rep(1:35)) #get ages
#make predictions
##betas
#intercept
#4.2755890
#age
#-0.0344769
#se of age
#0.0060471
#estimated log odds dsr
logodds = 4.2755890 +(-0.0344769*age)
#DSR = exp(log-odds of DSR)/(1+exp(log-odds of DSR))
dsr = exp(logodds)/(1+exp(logodds))
#calculate ci
#m0 says se of age= 0.0060471. probs need to do calculation, not use raw
lcl = dsr - (1.96*0.0060471)
ucl = dsr + (1.96*0.0060471)
ageplot <- cbind.data.frame(age, dsr, lcl, ucl)
library(ggplot2)
ggplot(ageplot, aes(x = age, y = dsr)) +
geom_line(size = 2) +
geom_ribbon(aes(ymin = lcl, ymax = ucl), alpha = 0.2)