All of my nest survival estimates =1 in Rmark

posts related to the RMark library, which may not be of general interest to users of 'classic' MARK

All of my nest survival estimates =1 in Rmark

Postby lbrow43 » Tue Feb 14, 2023 10:06 am

Hi,
Using the mallard example, I first created a code that ran successfully for nest survival estimates for a shorebird species. The nocc = 129. The sample size was 96 nests.
Then I wanted to look at cumulative chick survival from the time that nests were found until they fledged or failed. This used a subset of my nests including only those that hatched (n =). Nocc = 145 (from my season start date when we started monitoring nests on April 1 until the last nest check date on August 8.
However, when I run the equivalent of mallard.results, the daily survival rate estimate for every single day for the 145 days = 1. Not sure why this occurred? I'm using the same code structure as the previous with nest survival, and just changed the nocc.
Does this have to deal with such a lengthy nocc?

Code: Select all
 


```{r}
library(RMark)
library(dplyr)

setwd("C://Users//lbrow//Documents//Trent University//AMOY//Data Analysis//2022 Data Analysis//2022 nest survival analysis//2022 cumulative chick survival analysis")

NestSurvivalData = read.csv("2022 cumulative chick survival data.csv")
metadata = read.csv("2022 nest data c Jan 1 2023.csv")

#Add metadata columns to RMark data
NestSurvivalData$Island = metadata$Island[match(NestSurvivalData$NestID, metadata$NestID)]

#rename columns in RMark format
NestSurvivalData = NestSurvivalData %>%
  rename("ID" = "UniqueID",
         "LastPresent" = "ChickLastPresent",
         "LastChecked" = "ChickLastChecked",
         "Fate" = "FledgeFate")
         
#convert to numeric format
NestSurvivalData = NestSurvivalData %>%
  mutate(FirstFound = as.numeric(FirstFound)) %>%
  mutate(AgeFound = as.numeric(AgeFound)) %>%
  mutate(AgeDay1 = as.numeric(AgeDay1)) %>%
  mutate(LastPresent = as.numeric(LastPresent)) %>%
  mutate(LastChecked = as.numeric(LastChecked))

#convert to factor format
NestSurvivalData = NestSurvivalData %>%
  mutate(Island = as.factor(Island))
 
#check what levels exist in a factor variable
levels(NestSurvivalData$Island)

#Note: Quirks! RMark Does not like cells labeled as NA. It will automatically ignore cells with blank values. Thus it is best to leave the blank cells.DO NOT replace blank cells with NA values, otherwise get issues later on in the code.

summary(NestSurvivalData)
```


```{r}
#### Model Stage 1 - temporal predictor variables ####

#Specify parameters including the number of occasions, model type, grouping variables (factor variables)
amoy.process = process.data(NestSurvivalData, nocc = 225, model = "Nest", groups = "Island")

#this is where we start into RMark and making multiple models, so first we make the function
run.amoy=function()
{
  # model of constant daily survival rate (DSR) (ie intercept-only model)
  Null=list(formula=~1)
 
  # model checking if Nest Age affects DSR
  S.NestAge=list(formula=~NestAge)

 # model checking if Island affects DSR - treats islands as factors
 #  and the output provides S-hats for each habitat type
  S.Island=list(formula=~Island)
 
  #DSR varies with nest age & island
  S.NestAgeandIsland = list(formula = ~NestAge + Island)
 
  #DSR varies with nest age & island
  S.NestAgexIsland = list(formula = ~NestAge + Island + NestAge:Island)
 
# Return model table and list of models
 amoy.model.list = create.model.list("Nest")
 
 amoy.results = mark.wrapper(amoy.model.list,
                                data = amoy.process,
                                adjust = FALSE,delete=TRUE)
 }
 
amoy.results=run.amoy() #this can take a minute or two to run, just go with it
amoy.results #shows the AICc table of your models you made above
lbrow43
 
Posts: 1
Joined: Tue Feb 14, 2023 9:34 am

Re: All of my nest survival estimates =1 in Rmark

Postby Rotella » Tue Feb 14, 2023 12:33 pm

If you want to send me your code and data offline, I can take a look.
Jay
Rotella
 
Posts: 72
Joined: Mon Jun 09, 2003 11:32 am

Re: All of my nest survival estimates =1 in Rmark

Postby Rotella » Thu Feb 16, 2023 12:11 pm

The issue in this case has to do with errors in how the encounter histories were set up. Specifically, for failed nests the date entered for the dates for when nests were last checked and when their fate was determined were the same. As noted in the chapter on analyzing nest-survival data in the Gentle Introduction to MARK, such an encounter history is invalid because the information indicates that the nest was observed as both present and destroyed on the same day without time passing. In this case, when a model using the data was run, Program MARK did provide a warning about each encounter history that had an error in it. However, the user might not have seen those errors easily as the user was running a list of competing models inside a script that was run within an R markdown document. For those having having problems with models that that they don't understand, it might be useful to run a single model using a simple script and examine the output to see if it contains errors.
Rotella
 
Posts: 72
Joined: Mon Jun 09, 2003 11:32 am


Return to RMark

Who is online

Users browsing this forum: No registered users and 8 guests