Hi,
I have some experience using Program Mark, and I am finally moving on to using RMark for some more complex modeling. However, I have already hit a roadblock and I have spent way too much time already trying to solve it.
I have attempted to add time intervals to some more complex models with group variables, but from the real survival estimates, I can tell that the time intervals were not applied correctly. Therefore I simplified the models and removed the group effect to just try and figure out how to add time intervals correctly.
I used the information I found in the RMark conference notes, the Mark Book and on the phidot website, and put together this script:
## load the CH file
lfc <- convert.inp("All_years_river_reaches_short_no_group.inp")
## set up the basic model structure. Time intervals are kilometers (I am looking at survival through space rather than through time)
lfc.process <- process.data(lfc, model="CJS", begin.time=0, time.intervals=c(14.057, 11.176, 36.414, 34.502, 9.628, 22.531, 26.612, 37.367, 16.677, 83.101))
lfc.ddl <- make.design.data(lfc.process)
## set up the various model specifications. Null model
Phi.dot <- list(formula=~1)
p.dot <- list(formula=~1)
lfc.Phi.dot.p.dot <- mark(lfc.process, lfc.ddl, model.parameters=list(Phi=Phi.dot, p=p.dot))
# Phi and p time dependent
Phi.t <- list(formula= ~time)
p.t <- list(formula= ~time, fixed = list(index=11,value=0.77))
lfc.Phi.t.p.t <- mark(lfc.process, lfc.ddl, model.parameters=list(Phi=Phi.t,p=p.t))
--------------------------------------------------
When run, the null model seems to run fine, but the hiccup comes when RMark tries to run the time dependent model. The error message says:
Error in if (x4 > x2) { : argument is of length zero
********Following model failed to run : Phi(~time)p(~time) **********
Error in `row.names<-.data.frame`(`*tmp*`, value = c("Phi:(Intercept)", :
duplicate 'row.names' are not allowed
In addition: Warning message:
non-unique values when setting 'row.names': ‘Phi:time105.777’, ‘Phi:time154.92’, ‘Phi:time192.287’
---------------------------------------------------
I then tried to tweak the script in many different ways, and the closest I’ve come to it running correctly is by changing the time dependent model to run with continuous time (~Time) rather than time as a factor (~time). So, same script as above, with the only modification in the time dependent model:
Phi.t <- list(formula= ~Time)
p.t <- list(formula= ~Time, fixed = list(index=11,value=0.77))
This script actually runs without error, and gives me real survival estimates that seemed to be normalized for time, but are still off from the “correct” parameters I get running this in Mark itself. Plus, if I take RMark’s estimates and raise them to the power of the time intervals, they should equal the survival estimates using the default time intervals, but in this case, they don’t.
Could anyone give me any advice on what I am doing wrong? It seems like a super simple problem, but I can’t figure it out!
Thanks!!!