encounter history with multiple groups

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

encounter history with multiple groups

Postby amandarg » Tue Apr 17, 2012 5:50 pm

Hi, I am trying to set up an encounter history for a CJS analysis on woodrats and plague which includes multiple groups. We are interested in whether there are differences in survival between ages (adult vs juvenile), sex (male vs female), and treatment (vaccine, dust, or control) and combinations of these different groups (ie adult/juv both sex vaccinated or dusted vs adult/juv both sexes control). I have never worked with more than one group at a time so I just want to make sure I am on the right track. Do I make a separate column for each combination (ie adult/male/vaccinated, adult/male/dust, adult/male/control, adult/female/vaccinated...and so on) or do I treat treatment as a covariate and for each combination of groups?

Thanks,
Amanda
amandarg
 
Posts: 24
Joined: Sun Nov 07, 2010 4:27 pm

Re: encounter history with multiple groups

Postby jlaake » Tue Apr 17, 2012 6:05 pm

Groups are used to define the various levels of a factor variable -- a variable that has a discrete typically small number of levels like those that you have identified. You always have the option of using either groups to define those variables or individual covariates but typically using groups is easiest because you will receive an estimate of each real parameter for each group level. Whereas if you use individual covariates you have to request real parameter values by specifying the values of the individual covariates. Also, when you use an individual covariate for a factor variable you have to specify k-1 dummy variables when the factor variable has k levels. For example for sex you would only have one dummy variable. You would choose one of the levels say Female to be the intercept and the individual covariate say Sex would be 0 for females and 1 for males. For something like your treatment, you would have 2 dummy variables because there are 3 levels to the factor. For a variable like age (adult/juvenile), you most definitely want to use these as grouping variables because juveniles will become adults over time and that is easiest to handle with PIMS otherwise you need a time-varying individual covariate.

It sound like you are a beginner at this so I would definitely start out by using groups for each of your factor variables and yes you need to create a group for each combination in your data as you have suggested. Once you become familiar with MARK you may want to consider using RMark as an alternative if you know R. It creates groups using a list of factor variables and allows you to easily create additive and interaction models with formula. There are folks at K State that use RMark.

Best of luck and hope this was useful. --jeff
jlaake
 
Posts: 1480
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: encounter history with multiple groups

Postby cooch » Tue Apr 17, 2012 6:11 pm

amandarg wrote:Hi, I am trying to set up an encounter history for a CJS analysis on woodrats and plague which includes multiple groups. We are interested in whether there are differences in survival between ages (adult vs juvenile), sex (male vs female), and treatment (vaccine, dust, or control) and combinations of these different groups (ie adult/juv both sex vaccinated or dusted vs adult/juv both sexes control). I have never worked with more than one group at a time so I just want to make sure I am on the right track. Do I make a separate column for each combination (ie adult/male/vaccinated, adult/male/dust, adult/male/control, adult/female/vaccinated...and so on) or do I treat treatment as a covariate and for each combination of groups?

Thanks,
Amanda


Chapter 2, section 2.1.1.
cooch
 
Posts: 1654
Joined: Thu May 15, 2003 4:11 pm
Location: Cornell University

Re: encounter history with multiple groups

Postby amandarg » Mon Apr 23, 2012 11:43 am

Jeff,
Thanks so much. Yeah, I've been using RMark for a while but I just wanted to make sure I was on the right track as I have worked with only sex as a group in the past.

Amanda
amandarg
 
Posts: 24
Joined: Sun Nov 07, 2010 4:27 pm

Re: encounter history with multiple groups

Postby jlaake » Mon Apr 23, 2012 2:11 pm

If you provide multiple factor variables in your group definition, RMark will create a group for each combination that is in your data.

--jeff
jlaake
 
Posts: 1480
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: encounter history with multiple groups

Postby amandarg » Mon Apr 30, 2012 5:30 pm

Jeff,
I think this is where I am confused. I have been trying to follow the muli-group example in the manual and it doesn't seem to be working. Because my rats sometimes stay a juvenile over more than one trapping period and sometimes not, I am not using an age structured model. Rather, I am removing them once they change to adults and adding them in as a new individual adult. I am attaching the code that I was trying to use to inport my inp file. My groups should look like: FAC FAD FAV FJC FJD FJV MAC MAD MAV MJC MJD MJV

Code: Select all
multigroup=convert.inp("C:/Documents and Settings/Amanda Goldberg/My Documents/
Plaguestudy_2012/2011_FtCollins/fcwood_2011a.inp",
group.df=data.frame(sex=c(rep("Female",6),rep("Male",6)),
Trt=rep(c("c","d","v",4))
Age=rep(c("adult","juvenile"),6)))


Thanks for you help


amanda
amandarg
 
Posts: 24
Joined: Sun Nov 07, 2010 4:27 pm

Re: encounter history with multiple groups

Postby jlaake » Mon Apr 30, 2012 6:30 pm

Code: Select all
multigroup=convert.inp("C:/Documents and Settings/Amanda Goldberg/My Documents/
Plaguestudy_2012/2011_FtCollins/fcwood_2011a.inp",
group.df=data.frame(sex=c(rep("Female",6),rep("Male",6)),
Trt=rep(c("c","d","v"),4)
Age=rep(c("adult","juvenile"),6)))


So other than the misplaced paren in Trt what you showed seems fine. You may want to name Age something like Ageclass so it doesn't interfere with default design data Age which would be time since first marking.

I'm not sure where your confusion is but it sounds to me that you should be using a multistate analysis where Adult and juvenile are states.

--jeff
jlaake
 
Posts: 1480
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: encounter history with multiple groups

Postby amandarg » Tue May 01, 2012 4:43 pm

Jeff,
Ah, thanks for finding that mistake. However, I'm still getting an error message:
Code: Select all
Error: unexpected symbol in:
"Trt=rep(c("c","d","v"),4)
Ageclass"
>

Yeah, I originally wanted to do a multi-state, however, my boss is worried about too many parameters as we don't have the largest sample sizes. I may end up running it both ways to show him so that we can choose how we want to deal with our data for our new study with the same treatments.

Amanda
amandarg
 
Posts: 24
Joined: Sun Nov 07, 2010 4:27 pm

Re: encounter history with multiple groups

Postby jlaake » Tue May 01, 2012 5:15 pm

I don't have the data to run this so I couldn't test it. We are both missing a comma between Trt and Age variables.

Code: Select all
multigroup=convert.inp("C:/Documents and Settings/Amanda Goldberg/My Documents/
Plaguestudy_2012/2011_FtCollins/fcwood_2011a.inp",
group.df=data.frame(sex=c(rep("Female",6),rep("Male",6)),
Trt=rep(c("c","d","v"),4),
Age=rep(c("adult","juvenile"),6)))
jlaake
 
Posts: 1480
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: encounter history with multiple groups

Postby amandarg » Thu May 03, 2012 4:46 pm

Thanks so much, that one comma fixed the problem

Amanda
amandarg
 
Posts: 24
Joined: Sun Nov 07, 2010 4:27 pm

Next

Return to RMark

Who is online

Users browsing this forum: Bing [Bot] and 3 guests