deleting a group in RMARK

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

deleting a group in RMARK

Postby roche042 » Sun Apr 03, 2011 3:24 pm

Hi,

I was wondering if there is any way to delete a 'group' within an RMARK model to prevent over-parameterization. For example, I know if I have four groups (e.g. LL, LS, SL, and SS), and I would like a beta parameter for each, I can delete the intercept by specifying [formula = ~-1 + group.name] for whatever the parameter of interest is. In most cases, this gets rid of the problem of over-parameterization that would occur if I was trying estimate a beta parameter for each group-class AND the intercept (which, is, of course, redundant). However, in cases where I am trying to build a model in which I'm enforcing, say, temporal parallelism [formula = -1 + group.name + t], I really only need intercepts for 3 of the four classes of my 'group' (e.g. LS, SL, and SS only) as the fourth will simply be the temporal estimates SANS a class-specific intercept. In MARK, I can manually delete one of the four intercepts, but in RMARK... I have not figured out how to do this. Is there a way to do this?

Thanks in advance!

erin
roche042
 
Posts: 18
Joined: Mon Jan 03, 2011 2:30 pm

Re: deleting a group in RMARK

Postby jlaake » Sun Apr 03, 2011 11:15 pm

Erin-

The ~-1 remvoves the intercept in the design matrix and not a group. When you use --1+factor where factor has 4 levels, it removes the intercept and creates 4 separate columns - one for each factor. There really is no reason for you to be using the ~-1 in the cases you gave. If you use ~group+t it will create the correct DM and it will not be overparameterized. If you have 4 groups and say 5 times, it will create a DM with an intercept, 3 columns for group and 4 for time. If you use the -1 youll just get yourself confused. The only reason to use the -1 is if you specify a model with all interactions using the : operator and you want to generate an idendity DM to use the sin link. Or if you want to specify model with interactions where the factors are not fully crossed. In some of these latter cases you may also want to add a factor variable as well, and for those situations I added the argument remove.intercept which if you set it to true, it will remove the intercept and you should not use that with the -1.

Hope this helps. The best way to see what is going on is to use the R function model.matrix with the design data and the formula you want to use.

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

Re: deleting a group in RMARK

Postby roche042 » Mon Apr 04, 2011 9:18 am

Hi Jeff,

Thanks for the advice! The only times I've used the -1 to remove the intercept have been in cases where I'm specifying the sorts of interactions (:) you suggest, don't worry :-)

However, I am still having this problem, of what appears to be over-parameterization. It is occurring when using a multi-strata model, and the problem is when I try to 'add' four groups to the stratum:tostraum model. So, the way I've parameterized the model looks something like this:

formula = -1 + group + straum:tostraum

In this case, I species a -1 because I read that in the RMark manual... but maybe I misunderstood it's usage. I don't think that all four groups need an intercept, and yet this is what RMark is doing. Curiously, if I specify a model like:

formula = -1 + age + stratum:tostraum

where age is two groups (hatch year and after hatch year), then RMark seems to do what you say and drops one of the intercepts. However, I cannot figure out how 'age' is parameterized differently than the four groups I've been struggling with.

erin
roche042
 
Posts: 18
Joined: Mon Jan 03, 2011 2:30 pm

Re: deleting a group in RMARK

Postby roche042 » Mon Apr 04, 2011 9:23 am

Hi Jeff,

One additional question... is what I'm describing, then, a situation in which I should use the remove.intercept command?

erin
roche042
 
Posts: 18
Joined: Mon Jan 03, 2011 2:30 pm

Re: deleting a group in RMARK

Postby jlaake » Mon Apr 04, 2011 10:04 am

What you are specifying is an example of the second situation that I listed in my post in which you are adding a factor variable to a formula with a limited interaction using the : operator. The -1 will not work in that case because as I described in the last post, if you use -1 with a factor variable it removes the intercept but creates a column for each of the k levels in the factor variable and yes it will be over-parameterized in that case because all you want is k-1 columns. To avoid this problem you would use:

Psi=list(formula = ~ group + stratum:tostratum, remove.intercept=TRUE)

It actually removes the first column of the DM. If you don't include the -1, then the first column of the DM is always the intercept. However, if you use the -1, you can't reliably delete the first column and have the model be specified properly, so don't use -1 with remove.intercept=T. It would be very helpful for you to try model.matrix with the design data and the formula and look at what it does. In some ways, RMark is simply a wrapper for model.matrix with all a lot of code to create the input for MARK and extract the output. There are several examples of -1 and remove.intercept in the workshop notes and Appendix C.

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

Re: deleting a group in RMARK

Postby roche042 » Mon Apr 04, 2011 10:22 am

Hi,

Thanks so much! I think I get it now, sorry for asking what was probably something that should have been self-explanatory :-)

erin
roche042
 
Posts: 18
Joined: Mon Jan 03, 2011 2:30 pm


Return to RMark

Who is online

Users browsing this forum: No registered users and 0 guests