Page 1 of 1

Setting variables in RMark to zero

PostPosted: Wed Aug 22, 2012 11:49 pm
by berg1546
Hi,
I'm using a Robust design with Closed models for secondary periods with heterogeneity (RDHet) in R to look at survival in a mark-recapture study of rodents. I've figured out how to make the model variables be a function of the animal's sex, primary trapping session, or simply constant, but I'm curious if there's a way to set one of these variables to zero. In particular, I would like to impose the assumption that immigration=emigration=0, so I need to set GammaPrime and GammaDoublePrime to zero.

So something like this (which makes them constant):
##GammaPrime.dots=list(formula=~1,share=TRUE) #Immigration=emigration and is time-invariant

But that makes them equal to zero. I've tried (formula=~0) and (formula=0) but thus far with no luck.

Any input is much appreciated.

Re: Setting variables in RMark to zero

PostPosted: Thu Aug 23, 2012 12:01 pm
by jlaake
Please post questions about RMark in the RMark section.

You should read the section about fixing real parameters. Used fixed=0 in your model specification and it will set them all to 0.

--jeff

Re: Setting variables in RMark to zero

PostPosted: Thu Aug 23, 2012 12:08 pm
by egc
jlaake wrote:Please post questions about RMark in the RMark section.

You should read the section about fixing real parameters. Used fixed=0 in your model specification and it will set them all to 0.

--jeff


Agreed - I will move this thread to the RMark sub-forum after this post.

Re: Setting variables in RMark to zero

PostPosted: Thu Aug 23, 2012 3:05 pm
by berg1546
Sorry for the mislabeling and thanks for moving the thread.

So my code right now looks like this and it still isn't setting GammaPrime and GammaDoublePrime to zero - it makes them constant, but above zero.

**************************
CFC1_2005.model<-function() {
CFC1_2005 <- import.chdata("2005_CFC1.txt", header=TRUE)
CFC1_2005.envi.S <- as.data.frame(read.table("2005_CFC1_envi_S.txt",header=TRUE))
CFC1_2005.processed <- process.data(CFC1_2005,begin.time=1,model="RDHet",groups=c("treat","spec"),time.intervals=CFC1_2005.t.intervals)
CFC1_2005.ddl <- make.design.data(CFC1_2005.processed,parameters=list(S=list(pim.type="time")))

CFC1_2005.envi.S$time=CFC1_2005.ddl$S$time[1:6]
CFC1_2005.ddl$S=merge_design.covariates(CFC1_2005.ddl$S, df=CFC1_2005.envi.S, bygroup=F, bytime=T)

S.treat.spec.t.gap=list(formula=~treat*spec*t.gap)
p.treat.session=list(formula=~treat*session) #Survival as a function of treatment and T.interval
GammaPrime.zero=list(fixed=0,share=TRUE) #Immigration=emigration and is time-invariant

cml=create.model.list("RDHet")
return(mark.wrapper(cml,data=CFC1_2005.processed,ddl=CFC1_2005.ddl,adjust=T,realvcv=F,external=T))
}
*************************************

Re: Setting variables in RMark to zero

PostPosted: Thu Aug 23, 2012 4:06 pm
by berg1546
The solution was to include the 'formula=~1' portion to set it constant, and then 'fixed=0' to set it equal to zero:

GammaPrime.zero=list(formula=~1,fixed=0)
GammaDoublePrime.zero=list(formula=~1,fixed=0)

Thanks for the input, everybody.