I am having issues to run some robust design models using my data..but I am a pretty newborn using R studio. I have dolphin photo-ID data that was collected during 6 primary occasions (3 winters and 3 summers) and each season we ran 3 secondary occasions. So 18 secondary occasions in total. I tried to slowly learn how RMark is working and managed to make it work and finally ran few CJS models to test the program and I was also able to get some results from a model that I found and adapted the script to my data (RANDOM EMIGRATION model with constant survival, constant capture prob), and it worked.
First, for some reasons, I had to install conflicted package, because it seems that I have conflicts with other packages and I had to run this script (not sure why actually?)
- Code: Select all
# install.packages("devtools")
devtools::install_github("r-lib/conflicted")
library(conflicted)
library(dplyr)
filter(mtcars, cyl == 8)
dplyr::filter(mtcars, am & cyl == 8)
library(dplyr)
conflicts_prefer(dplyr::filter)
Then, I tried to import my .inp file with my capture histories without any covariates (such ages, sexe, etc..). So my .inp file with capture histories looks like 100010010011000110 1; for one of the 718 individuals I have in my dataset.
- Code: Select all
CMR_MOB_RD=convert.inp("/Users/dolphin/Documents/DISL/Data/R_file/CMR Data/MOB_CMR_D2.inp",use.comments=T)
Once properly imported, I tried to adapt this script to run RD models following this code for random movements:
- Code: Select all
#Create the design data
CMR_MOB_RD.ddl=make.design.data(CMR_MOB_RD.process)
#Create time bins for GammaPrime and GammaDoublePrime
CMR_MOB_RD.ddl=add.design.data(CMR_MOB_RD.process, CMR_MOB_RD.ddl,parameter="GammaPrime",type="time",bins=c(2,3,4,5,6), name="gammaconstrain",replace=TRUE)
CMR_MOB_RD.ddl=add.design.data(CMR_MOB_RD.process, CMR_MOB_RD.ddl,parameter="GammaDoublePrime",type="time",bins=c(1,2,3,4,5,6), name="gamma2constrain",replace=TRUE)
CMR_MOB_RD.random.models=function()
{
S.dot=list(formula=~1)
S.time=list(formula=~time)
p.dot=list(formula=~1+c,share=T)
p.time.session=list(formula=~-1+session:time+c,share=TRUE)
p.session=list(formula=~session+c,share=T)
GammaDoublePrime.GammaPrime.random=list(formula=~1,share=T)
GammaDoublePrime.GammaPrime.session.random=list(formula=~time,share=T)
N.session=list(formula=~session)
cml=create.model.list("Robust")
results=mark.wrapper(cml,data= CMR_MOB_RD.process,ddl= CMR_MOB_RD.ddl,adjust=FALSE)
return(results)
}
CMR_MOB_RD.random.results= CMR_MOB_RD.random.models()
I guess this is a pretty basic problem, but as I said I am completely new in using R studio and RMark. So, I would need assistance to go through the code and errors I have !
Thanks a lot..really appreciate your help!
Best,
Thibaut