Setting variables in RMark to zero

posts related to the RMark library, which may not be of general interest to users of 'classic' MARK

Setting variables in RMark to zero

Postby berg1546 » Wed Aug 22, 2012 11:49 pm

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.
berg1546
 
Posts: 6
Joined: Mon Aug 20, 2012 12:19 pm

Re: Setting variables in RMark to zero

Postby jlaake » Thu Aug 23, 2012 12:01 pm

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
jlaake
 
Posts: 1479
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: Setting variables in RMark to zero

Postby egc » Thu Aug 23, 2012 12:08 pm

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.
egc
Site Admin
 
Posts: 201
Joined: Thu May 15, 2003 3:25 pm

Re: Setting variables in RMark to zero

Postby berg1546 » Thu Aug 23, 2012 3:05 pm

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))
}
*************************************
berg1546
 
Posts: 6
Joined: Mon Aug 20, 2012 12:19 pm

Re: Setting variables in RMark to zero

Postby berg1546 » Thu Aug 23, 2012 4:06 pm

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.
berg1546
 
Posts: 6
Joined: Mon Aug 20, 2012 12:19 pm


Return to RMark

Who is online

Users browsing this forum: No registered users and 2 guests

cron