RMark questions

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

RMark questions

Postby jlaake » Wed Oct 29, 2008 4:50 pm

I have been getting a fair number of questions about RMark sent to my individual email. I don't mind answering these questions, but I ask that you submit them to the listserver and I'll respond to them via the listserver. This provides several benefits: 1) it archives the questions and answers for people to search, 2)reading those postings may help provide better solutions, 3) someone other than me may know the answer. There should be very little delay as I get all postings sent to my email. If for some reason the exchange gets lengthy we can take it off list so as not to bother everyone.

Here is an interchange with Manuel that may be of interest to others.

Question:
> I am using RMark for occupancy models.
> If for example, the data below are the first 5 lines of a file, how can I pool species Didelphis and Dasyprocta to have the same p and psi?
> Thank you very much in advance.
> Best,
>
> Manuel
>
> ch freq especie
> 1 .01000000000 1 Didelphis
> 2 100001100001 1 Didelphis
> 3 .00.00000000 1 Dasyprocta 4 000101000000 1 Didelphis 5 00.00011.000 1 Conepatus


My response:

You have at least 3 options here. 1) If you always want them pooled you could always change the value of especie in your data so they had the same value like "Didelphis&Dasyprocta". 2) Or you could create another field in the data named especie2 which had them pooled and then in defining groups use groups=c("especie","especie2"). Then you could use either ~especie or ~especie2 for a formula.
3) Or if you don't want to redefine the data or add groupings, you can add design data for the species groupings as shown below with the data that you sent. Note that you need to define especie2 in both the Psi and p design data if you want to collapse them for both parameters. The one advantage of defining the factors in the data file, is that they are automatically created in all of the default design data.

> occ
ch freq especie
1 .01000000000 1 Didelphis
2 100001100001 1 Didelphis
3 .00.00000000 1 Dasyprocta
4 000101000000 1 Didelphis
5 00.00011.000 1 Conepatus
>

# import data
occ=import.chdata("occ.txt",header=T)
occ
# process data
occ.proc=process.data(occ,model="Occupancy",groups="especie")
# create default design data
occ.ddl=make.design.data(occ.proc)
# add new design data field especie2 that collapses some species occ.ddl$Psi$especie2=as.character(occ.ddl$Psi$especie)
occ.ddl$Psi$especie2[occ.ddl$Psi$especie=="Didelphis"]="Didelphis&Dasyprocta"
occ.ddl$Psi$especie2[occ.ddl$Psi$especie=="Dasyprocta"]="Didelphis&Dasyprocta"
occ.ddl$Psi$especie2=factor(occ.ddl$Psi$especie2)
occ.ddl$p$especie2=as.character(occ.ddl$p$especie)
occ.ddl$p$especie2[occ.ddl$p$especie=="Didelphis"]="Didelphis&Dasyprocta"
occ.ddl$p$especie2[occ.ddl$p$especie=="Dasyprocta"]="Didelphis&Dasyprocta"
occ.ddl$p$especie2=factor(occ.ddl$p$especie2)
# fit model with especie2
mymodel=mark(occ.proc,occ.ddl,model.parameters=list(Psi=list(formula=~especie2),p=list(formula=~especie2)))

Note that Occupancy models (and some others) with groups will not currently work with RMark and the October version of mark.exe. Gary and I will resolve this issue in the next couple of weeks.

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

Return to RMark

Who is online

Users browsing this forum: No registered users and 2 guests