change factor level represented by intercept

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

change factor level represented by intercept

Postby abreton » Tue Oct 18, 2011 5:14 pm

From the MARK book, Appendix C, page C-14:
The design matrix is created using the convention called treatment contrasts. That means the first level is used as the intercept and the parameters for the remaining levels are an additive amount relative to the intercept.


Given sparse data, I've found that it helps to specify a relatively data-rich level of a factor variable as the intercept. For example, consider year as a factor variable with seven levels, 2004-2010. In MARK I've specified the DM so that the intercept represents 2010, 2004-2009 are offsets. In contrast, RMARK (for reasons in quote above) defaults to the first group, 2004, to be represented by the intercept.

It is possible to change the factor level represented by intercept in RMARK? I considered sorting my MARK.inp file so 2010 was the first group in the data file, but it seems that at the process.data stage of RMARK the data are re-sorted ascending by groups (which would undo my ad hoc fix).

This flexibility would also allow me to more efficiently compare my results between RMARK and MARK...I suspect I'm not done making mistakes in RMARK just yet!!

Thanks for any input.

andre
abreton
 
Posts: 111
Joined: Tue Apr 25, 2006 8:18 pm
Location: Insight Database Design and Consulting

Re: change factor level represented by intercept

Postby jlaake » Tue Oct 18, 2011 5:19 pm

See the relevel function in R. It will let you set which factor level is considered first. See the examples on pg 6 and 59 of the RMark Workshop notes.

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

Re: change factor level represented by intercept

Postby abreton » Tue Oct 18, 2011 7:11 pm

A generous response given that the answer was on page 6 in plain English! I'll make better use of this document in the future, thanks Jeff...'relevel' did the trick. - andre
abreton
 
Posts: 111
Joined: Tue Apr 25, 2006 8:18 pm
Location: Insight Database Design and Consulting


Return to RMark

Who is online

Users browsing this forum: No registered users and 0 guests