- Code: Select all
library(RMark)
##Add data
data(dipper)
##make up start time and intervals (2 years, first year has 3 sessions, last has 4)
df.proc=process.data(dipper, model="RDPdLHuggins", groups="sex", begin.time=0001,time.intervals=c(0,0,1,0,0,0))
##Design Data
df.ddl=make.design.data(df.proc)
# Create function with parameter specifications to fit models
df.analysis=function()
{
# Create specifications for Phi, Lambda, p, and c
Phi.1=list(formula=~1)
Lambda.10=list(formula=~1)
p.1=list(formula=~1,share=TRUE) #set share=TRUE to constrain p=c (first capture and recapture probabilies are equal)
c.1=list(formula=~1)
# Create a list of combinations of parameter specifications for specific model;
cml=create.model.list("RDPdLHuggins")
# Call mark.wrapper;
mark.wrapper(cml,data=df.proc,ddl=df.ddl,output=FALSE)
}
##Step 4 invokes the function to fit the models and store the results in an object (dipper.results = dipper.analysis()).
##The object dipper.results is a list with class "marklist" that RMark creates and understands.
##The list contains the mark model object for each fitted model and the model selection table which is dipper.results$model.table
##for this set of models
df.results = df.analysis()
df.results
##to get results from just model x
summary(df.results[[1]]) # c and p not equal
#############
Real Parameter p
Session:1Group:sexFemale
1 2 3
0.0854767 0.0854767 0.0854767
Real Parameter c
Session:1Group:sexFemale
2 3
0.4043011 0.4043011
You help is much appreciated,
C Lamb
University of Alberta