Estimating recruitment with fixed Phi and p

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

Estimating recruitment with fixed Phi and p

Postby Rebekah Ry » Tue Jan 19, 2021 11:17 pm

Hello,

I have read many-a-posts on fixing parameters, and I don't think any of them address the issue I am currently having. I understand that the coding for fixing parameters has been updated and I can use "show.fixed=TRUE" in the summary function to view my fixed parameters and estimated real parameters:

http://www.phidot.org/forum/viewtopic.php?f=21&t=2887

However, once I try to use the model.average function, it's almost as if the fixed parameters are still being registered as NAs. I get an error: Error in deriv.real %*% model$results$beta.vcv : non-conformable arguments.

I have been trying to trouble-shoot what I have done wrong to mangle things up. Here is my code. I am wanting to estimate recruitment (f), and I want to fix Phi and p at each time interval because I have already estimated these parameters using a more robust data set in a previous CJS model:

Code: Select all
pradel.process <-process.data(Freeman.df,model="Pradrec",time.intervals=c(1,1,1,1),
                              begin.time=2015)
Freeman.ddl <- make.design.data(pradel.process)

#fixing Phi parameters to the estimates calculated by more robust CJS models#
Freeman.ddl$Phi$fix=NA
Freeman.ddl$Phi$fix[Freeman.ddl$Phi$time==2015]=0.295
Freeman.ddl$Phi$fix[Freeman.ddl$Phi$time==2016]=0.302
Freeman.ddl$Phi$fix[Freeman.ddl$Phi$time==2017]=0.288
Freeman.ddl$Phi$fix[Freeman.ddl$Phi$time==2018]=0.273

#fixing p parameters in the same fashion#
Freeman.ddl$p$fix=NA
Freeman.ddl$p$fix[Freeman.ddl$p$time==2015]=0.31
Freeman.ddl$p$fix[Freeman.ddl$p$time==2016]=0.32
Freeman.ddl$p$fix[Freeman.ddl$p$time==2017]=0.33
Freeman.ddl$p$fix[Freeman.ddl$p$time==2018]=0.34
Freeman.ddl$p$fix[Freeman.ddl$p$time==2019]=0.35

#include covariates for recruitment#
f.weather.covariate.df <- data.frame(time=c(2015,2016,2017,2018,2019),
                                     sum_extreme=scale(c(14,11,16,24,25)),
                                     win_extreme=scale(c(7,7,17,11,13)),
                                     total_precip=scale(c(49.3,49.7,40.3,44.2,22.0)),
                                     wint_precip=scale(c(4.19,8.52,5.3,9.08,3.58)),
                                     sum_precip=scale(c(3.28,9.08,15.05,9.38,3.85)),
                                     wint=scale(c(42.7,46.5,39.6,42.2,40.4)),
                                     summ=scale(c(94.7,94.3,96.3,97.6,96.3)))
Freeman.ddl$f <- merge_design.covariates(Freeman.ddl$f,f.weather.covariate.df)

#make sure fixed parameters are entered correctly#
summary(mark(pradel.process,Freeman.ddl,output=FALSE),show.fixed=TRUE)


Phi.dot=list(formula=~1)
p.dot=list(formula=~1)
f.dot=list(formula=~1)

f.t=list(formula=~time)

# for weather covariates #
f.sum_precip=list(formula=~sum_precip)
f.wint_precip=list(formula=~wint_precip)
f.total_precip=list(formula=~total_precip)
f.win_extreme=list(formula=~win_extreme)
f.sum_extreme=list(formula=~sum_extreme)

# I have even tried entering in fixed parameters this way, but not for this example #
#it still resulted in the same issue#
#Phi.fix=list(formula=~time,fixed=list(time=c(2015:2018),value=c(0.295,0.302,0.288,0.273)))
#p.fix=list(formula=~time,fixed=list(time=c(2015:2019),value=c(0.31,0.32,0.33,0.34,0.35)))

#models#
Phi.dot_p.dot_f.dot<-mark(pradel.process,Freeman.ddl,model.parameters=list(Phi=Phi.dot,p=p.dot,f=f.dot))
Phi.dot_p.dot_f.t<-mark(pradel.process,Freeman.ddl,model.parameters=list(Phi=Phi.dot,p=p.dot,f=f.t))

summary(Phi.dot_p.dot_f.t,show.fixed=TRUE) #once again checking that the fixed parameters are correct #

#models with covariates#
Phi.dot_p.dot_f.sum_extreme<-mark(pradel.process,Freeman.ddl,model.parameters=list(Phi=Phi.dot,p=p.dot,f=f.sum_extreme))
Phi.dot_p.dot_f.win_extreme<-mark(pradel.process,Freeman.ddl,model.parameters=list(Phi=Phi.dot,p=p.dot,f=f.win_extreme))
Phi.dot_p.dot_f.total_precip<-mark(pradel.process,Freeman.ddl,model.parameters=list(Phi=Phi.dot,p=p.dot,f=f.total_precip))
Phi.dot_p.dot_f.wint_precip<-mark(pradel.process,Freeman.ddl,model.parameters=list(Phi=Phi.dot,p=p.dot,f=f.wint_precip))
Phi.dot_p.dot_f.sum_precip<-mark(pradel.process,Freeman.ddl,model.parameters=list(Phi=Phi.dot,p=p.dot,f=f.sum_precip))

#put models into AICc table#
pradel.results<-collect.models(type="Pradrec")
pradel.results

#model average - this is the part that does not work#
mod.avg <- model.average(pradel.results,parameter="f",vcv=T)$estimates


I would love any and all feedback. I understand what I am trying to do, but somewhere in my code, I'm not feeding the model.average function what it needs to compute real estimates for recruitment.

Thank you so much,
Rebekah
Rebekah Ry
 
Posts: 13
Joined: Wed Jul 15, 2020 6:46 pm

Re: Estimating recruitment with fixed Phi and p

Postby jlaake » Mon Mar 01, 2021 8:44 pm

Rebekah

I completely missed this post in my email Can you send me the data and I'll look at the problem unless you resolved this?

--jeff
jlaake
 
Posts: 1417
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: Estimating recruitment with fixed Phi and p

Postby Rebekah Ry » Sat Mar 06, 2021 10:15 pm

Hey Jeff,

I think I resolved the issue by creating empty vcv matrices and filling them in with fixed parameters using loop code that I found online. Thank you for your willingness to help though!

I do, however, have a follow up question regarding some theory behind what I'm doing. Does it make sense to use Phi and p estimates I calculated using a more robust CJS as fixed parameters in a follow-up Pradrec analysis? Or, allow the Pradrec analysis to calculate it's own values for Phi and p (along with f and derived lambda)? I have to run separate CJS and Pradrec analyses because my time frames are different for each (didn't want to bias Pradrec f estimates because I added "effort" during certain time intervals). I explained this in more detail in the first post of this thread.

Any thoughts or opinions would be wonderful. Currently I ran my Pradrec analysis holding Phi and p as Phi(time) p(dot) and f varying by my different weather and habitat covariates. Does that even make sense? It did in my mind, but perhaps I'm loosing it :).

Thanks again!
- Rebekah
Rebekah Ry
 
Posts: 13
Joined: Wed Jul 15, 2020 6:46 pm

Re: Estimating recruitment with fixed Phi and p

Postby jlaake » Mon Mar 08, 2021 1:09 pm

Glad you resolved problem but what you are doing does not make sense to me and I didn't find any additional information as to why you needed to do separate analysis.
jlaake
 
Posts: 1417
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: Estimating recruitment with fixed Phi and p

Postby Rebekah Ry » Mon Mar 08, 2021 3:34 pm

Hey Jeff,

My apologies - I've sent a bunch of emails to colleagues trying to resolve this issue that it occurred to me that I didn't include more detail in this post. :shock: Anyway, here is where my logic is at:

I ran a CJS on data I had collected from 2013-2020 with two equal capture/resight periods each year (thus why time intervals = 0.5) to estimate breeding and non-breeding apparent survival of black-crested titmice. However, during that time period, I added nestboxes and expanded my site a couple of times (once during 2014 and another during 2018). Because of this, to estimate per capita recruitment, I slimmed down my time frame where I had consistent effort, consistent study site (2015-2018) as to not inflate my recruitment estimates. In addition, per capita recruitment for this species makes sense to calculate annually, so I also changed my time intervals to 1, 1, etc.

So I guess why I tried fixing my CJS Phi and p parameter estimates (breeding Phi*non-breeding Phi = annual Phi, etc) in my Pradrec analysis is because I figured my estimates for these parameters were more robust from the CJS and likely more accurate than the ones I would calculate from the smaller time-framed Pradrec. But I suppose that's not the right thing to do, and instead I should treat them as completely separate analyses and then compare my Phi and p estimates between the two models (a topic in my discussion, perhaps?).

Once again, thank you so much for your time. This is my first time working with anything Mark-RMark related, and it's been quite eye-opening wading through all of this without much outside assistance.

Sincerely,
Rebekah - a grateful PhD candidate :D
Rebekah Ry
 
Posts: 13
Joined: Wed Jul 15, 2020 6:46 pm

Re: Estimating recruitment with fixed Phi and p

Postby jlaake » Fri Mar 19, 2021 1:52 pm

Sorry for not getting back to this sooner. Had to mull it over in my head. You can certainly do what you suggest but I'll offer an alternative below. But first let me say that this is another example where the RMark forum isn't really the place for the post. I realize that you initially posted because of an error with some RMark code but you went down that path because of your decision to do a CJS analysis and then use those results in the Padrec model. It is hard to do but sometimes it is best to step back and look at the big picture and address that question. It may have been better to pose the following question on the General Analysis section.

I have some data in which I made changes to the design that would affect recruitment. How could I best handle this in an analysis with the Padrec model?


Now clearly you would want to provide more details like you did in the last post. But a question like that might have provided an answer for you. Unfortunately I believe questions like this get buried in the RMark subforum because there is the presumption that I will answer most if not all of them, so they are not read by many folks that could help. Get my drift?

Now that doesn't mean that you will get an answer but then if you don't you can set off with what you think is best.

Ok now for my solution. Whenever you split off data like this to address a question you should ask yourself the following question.

Can I do the same thing in the complete analysis by estimating separate parameters?


In other words you split off 2015-2018 into a separate analysis because you thought that it would provide the best estimate of recruitment but then was left with worrying that survival would not be well estimated. Why not analyze all of the data together and simply have pre-2015 recruitment rate(s), 2015-2018 recruitment rate(s) and post 2018 recruitment rate(s) and base your inference about recruitment on 2015-2018 recognizing that the others might be affected by the changes you made. Now all of your data is being used for survival and you don't have the pickle your were in with the contrived analysis. I'm not certain I understand your comment about changing to annual rates from half year rates. If there is no expected recruitment during certain half-years (non-breeding) then you can handle that in the design.

I'll give you some more advice since that is what you get best at when you get as old as me. Whenever you have run into a problem like this, backtrack on your decisions and see if you can change something to take a different route - the proverbial thinking out of the box you have put yourself in. I have been in that box before so don't feel bad. Just learn from it.
jlaake
 
Posts: 1417
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: Estimating recruitment with fixed Phi and p

Postby Rebekah Ry » Thu Mar 25, 2021 12:27 pm

Hey Jeff,

I really appreciate you taking the time to respond. You've given me a lot to chew on, and you're absolutely right that I managed to put myself "in a box" in this situation. I think because I am new to all of this, I often find an example that someone has posted with similar data and try to "fit" my own data to the code. When it doesn't work (because our study designs are different), I get frustrated and almost want to force it to work. Definitely a rookie move on my part, and I'm hoping as I get better at understanding these analyses and the code behind it I can rely less on other's examples and more on my own design.

I also apologize that this post became more theory-based than intended. I'll be more cognizant where I ask questions next time on this forum.

Much appreciation again for your advice on how to spilt up my time intervals to estimate recruitment. I'll attempt this feat in the coming days. Fingers crossed!

Thank you,
Rebekah
Rebekah Ry
 
Posts: 13
Joined: Wed Jul 15, 2020 6:46 pm


Return to RMark

Who is online

Users browsing this forum: No registered users and 6 guests