problems with using age cohort for P

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

problems with using age cohort for P

Postby j.harv3y » Thu Jul 04, 2019 5:32 am

Hi,
I have the following error when I try to run any parameter for P that isnt time or a dot model (I'm running a MSORD.)
Code: Select all
> model.15=mark(rd, ddl=rd.ddl,
+               time.intervals=time.intervals,
+               model.parameters=list(S=S.a, pent=pent.time,
+                                     p=p.age, Psi=Psi.rand, Phi=Phi.a),output = FALSE,threads=2)
Error in make.mark.model(data.proc, title = title, parameters = model.parameters,  :
 
Error: Variable age used in formula is not defined in data

Error in mark(rd, ddl = rd.ddl, time.intervals = time.intervals, model.parameters = list(S = S.a,  :
  Misspecification of model or internal error in code


I think I understand what the issue is (I need to add 'age' to the design data). What is concerning me is that my other models where I use age run fine e.g using Phi.age, so why is it just throwing up this when I try to use it for P?

I've read the handbook and the section on design data for the rmark package in the rmark documents, and I'm struggling to add age or cohort within the design data for p. I want to see how p changes across the years 2012-1018. currently my design data looks like this;

Code: Select all
rd.ddl<-make.design.data(rd,
                         parameters=list(Psi=list(subtract.stratum=c("1","U"))))

which works fine for everything but p.
I tried this to add in cohorts
Code: Select all
rd.ddl<-add.design.data(rd,rd.ddl, parameter="p", type="cohort", bins = c(2012, 2013, 2014, 2015, 2016, 2017), name = "test")

but with no luck.

Any thoughts would be really appreciated, I'm sure it's very simple!!

Thank you so much!
j.harv3y
 
Posts: 45
Joined: Mon Oct 08, 2018 4:45 am

Re: problems with using age cohort for P

Postby jlaake » Sun Jul 07, 2019 11:15 pm

Not sure what you mean by no luck. When I created add.design.data, I was only supporting CJS models. The ORDMS model is a robust design and p is at the secondary sampling level. The default design data created depends on whether it is a primary or secondary. Age and cohort are only created for primary parameters. I wish I had not created add.design.data because it is too simplistic to be useful generally and it stops folks from considering alternatives. You can add any design data you want with R code. You just have to be a little creative to create what you want.
jlaake
 
Posts: 1417
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: problems with using age cohort for P

Postby j.harv3y » Mon Jul 08, 2019 8:11 am

Thanks so much for your reply and for explaining!

Could you advise how I might go about coding to look at P changing over primary periods/ looking at secondary periods changing across the primary periods?

At the moment I can only get it so that its showing me different secondary periods values for p but they are the same within each primary period- I'm not sure how to go about it so that I can look at different P's across time.

I really appreciate your help- I'm quite stuck on this! :oops:
Thanks so much,
j.harv3y
 
Posts: 45
Joined: Mon Oct 08, 2018 4:45 am

Re: problems with using age cohort for P

Postby jlaake » Mon Jul 08, 2019 10:00 am

Look at the robust example in the package ?robust. You want to use session as well as time. Hopefully that answers your question.
jlaake
 
Posts: 1417
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA


Return to RMark

Who is online

Users browsing this forum: No registered users and 8 guests