Hello,
I have been working through App C but just want to make sure I'm coding my BACI experimental design properly in RMark. Experimental design: 11 small mammal CMR sessions (4 pre-treatment, 7 post-treatment). 3 control/3 treatment plots. Equal capture effort across all plots. I have created a simple group for trt/control but was unsure how to code the before/after component of the BACI because I have individuals captured in sessions both before and after the treatment was applied. So far I've ran it using the dipper data flood example, creating a new field for each parameter called BACI and coding times 1-4 with a 0 (pre-treatment) and times 5-11 with a 1 (post-treatment). Then I'm simply modeling trt+BACI and trt*BACI along with the other candidate models. Does that seem right? Is it that simple? Any advice is appreciated. Thanks!! -Katie
Here's my code:
cr.proc=process.data(cr,model="Pradlambda",groups=c("trt"),time.intervals=c(1,1,1,1,1,1,1,1,1,1),nocc=11)
## create default design data
cr.ddl=make.design.data(cr.proc, parameters=list(Phi=list(pim.type="time"),p=list(pim.type="time"),Lambda=list(pim.type="time")))
cr.ddl$Phi$BACI=0
#fill in BACI data
cr.ddl$Phi$BACI[cr.ddl$Phi$time==5|cr.ddl$Phi$time==6|cr.ddl$Phi$time==7|cr.ddl$Phi$time==8|cr.ddl$Phi$time==9|cr.ddl$Phi$time==10|cr.ddl$Phi$time==11]=1
#make new field in p
cr.ddl$p$BACI=0
#fill in BACI data
cr.ddl$p$BACI[cr.ddl$p$time==5|cr.ddl$p$time==6|cr.ddl$p$time==7|cr.ddl$p$time==8|cr.ddl$p$time==9|cr.ddl$p$time==10|cr.ddl$p$time==11]=1
cr.ddl$Lambda$BACI=0
cr.ddl$Lambda$BACI[cr.ddl$Lambda$time==5|cr.ddl$Lambda$time==6|cr.ddl$Lambda$time==7|cr.ddl$Lambda$time==8|cr.ddl$Lambda$time==9|cr.ddl$Lambda$time==10|cr.ddl$Lambda$time==11]=1
###create function called initial.analysis to create initial set of models and find the best model for capture probabilty.
initial.analysis=function(){
Phi.time=list(formula=~time)
p.dot=list(formula=~1)
p.trt=list(formula=~trt)
p.time=list(formula=~time)
p.BACI=list(formula=~BACI)
p.trtplusBACI=list(formula=~BACI+trt)
p.trtxBACI=list(formula=~BACI*trt)
Lambda.time=list(formula=~time)
#use create.model.list to construct the models and store in object named cr.cml
cr.cml=create.model.list("Pradlambda")
#use mark.wrapper with model list cr.CML and the processed data and design data to fit each of the models in MARK
model.list=mark.wrapper(cr.cml,data=cr.proc,ddl=cr.ddl,output=F)
#results=mark.wrapper(cr.cml,data=cr.proc,ddl=cr.ddl,adjust=T,invisible=F)
#return the list of model results as the value of the fnction
return(model.list)
}