MS model with interaction, trend and no intercept

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

MS model with interaction, trend and no intercept

Postby awan » Fri Aug 17, 2018 10:43 am

Dear all,

I have been fitting a rather large multi-state model with 5 states and one of the issues is the number of the parameters of the model. To reduce the number of parameters, instead of fitting a categorical variable of "time", I would like to instead fit a trend ("Time"). I would like the trend to vary by stratum, hence it is an interaction model of stratum:Time, however I model two seasons (summer/winter) hence it is actually stratum:season:Time.

A model specification of formula = ~stratum:season:Time works fine, but upon further reading I understand I should remove the intercept so that each parameter is independently estimated. However, a model specification of formula = -1 + stratum:season:Time returns the error of

"One or more formulae are invalid because the design matrix has all zero rows"

I receive the same error when attempting to fit this for transitions (with stratum:tostratum:season:Time)

I inspected the design matrix using the function model.matrix with the above formula specification, and indeed, the error relates to the first "Time" step of each stratum, when the value of Time is 0.0. Is this normal behaviour? As a temporary fix, I have created a variable called Time2 which is simply Time + 0.5, which is currently running but I'm not sure if this is the proper fix.

I would appreciate any advice. I am running RMark 2.2.2 on R3.4.1, and have also tried RMark 2.2.5 on R3.5.1.
awan
 
Posts: 5
Joined: Fri Feb 10, 2017 10:52 am

Re: MS model with interaction, trend and no intercept

Postby jlaake » Fri Aug 17, 2018 12:49 pm

You aren't making the connection between the formulas and what you are trying to do. First, your model only contains stratum and not tostratum which means that you are saying that movement only matters for the stratum you are in and not where you are moving to. In other words if your strata are A to E and assuming you used the default of staying in the stratum (A to A) to be computed by subtraction, then the model ~stratum means the movement AtoB=AtoC=AtoD=AtoE and the same for the other strata. If that is what you intend that is great because it only has 5 parameters but it rarely is the case. Typically what you want is ~-1+stratum:tostratum which would have 20 parameters. This is where you use -1 because for each stratum the tostratum differ so you need to have separate interactions estimated with no intercept.

Now the model you used ~stratum:season:Time is very strange and maybe what you meant was ~stratum:season + stratum:Time. I say it is strange because for each season, Time is changing. For example, if you started at time 0 and each interval/season was at 1/2 year, then Time would be 0,.5,1.1.5... which numerically would be adjusting for the different seasons but linearly. But if what you are saying is that you have a season + trend then you would want ~stratum:season + stratum:Time.

Now the problem you are having when you add -1 to stratum:season:Time. When you interact factor variables (eg stratum and season) with a numeric variable (Time), you get a slope for each combination of the factor variables. You have 5 strata and 2 seasons so you would get 10 trend lines. But those are only slopes. If you use ~stratum:season:Time you would have 10 lines all starting from the same intercept but with different slopes. Seems very unlikely. When you added the -1, you forced the intercept to be 0 and RMark won't let you do that because 99.9% of the time that is not what you intended and it is trying to stop you from fitting a dumb model.

So I suggest you start with ~-1+stratum:tostratum and compare that to ~stratum as a beginning to see if movement varies by stratum but is constant across the tostratum for each stratum. Then you might want to think about using season and Time as additive components but only do so in a way that makes biological sense for your system.

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

Re: MS model with interaction, trend and no intercept

Postby awan » Mon Aug 20, 2018 3:19 am

Hi Jeff,

Thanks for the reply. Sorry I may have caused some confusion when I gave my examples of stratum:season:Time. Here I was giving an example of a formula for Survival. I then went on to say that I receive the same error for Transitions. Naturally, I always include the interaction of stratum:tostratum when fitting the transitions.

In essence, I have a two season model (summer/winter) and five regions in which migration occurs (hence the 5 strata). Survival trends appear to vary among seasons (winter survival is lower than summer), and the trend in survival over time is different among states and seasons (say for example winter survival is decreasing in only some areas whilst summer is generally stable). So in the example of a survival model of stratum:season:Time, my intention is to have a total of 20 parameters for example survival, with an intercept for each stratum:season combination and a slope for each stratum:season combination. 20 parameters may sound like a lot, but a model of stratum:time has 90 parameters (18 time intervals of 0.5), and based on AICc a model of stratum:time is the best fit, hence my goal of simplifying the model where possible whilst maintaining biological insights in the system.

I will try your suggestion of an additive model instead (stratum:season + stratum:Time) and compare the estimated results to the model of stratum:time to determine whether the model behaves as I would expect.

Thanks again

Andy
awan
 
Posts: 5
Joined: Fri Feb 10, 2017 10:52 am

Re: MS model with interaction, trend and no intercept

Postby jlaake » Tue Aug 21, 2018 12:16 pm

You didn't actually say what parameter you were modelling and when you said you used -1 I presumed you were talking about Psi. For S you could use ~stratum*season*Time which would fit the full interaction model of

~stratum+season+stratum:season+stratum:Time+ season:Time + stratum:season:Time

or you could use

~stratum*season+stratum:season:Time

which should give the same model except that all of the slopes for Time are separate whereas in the full interaction model above they are relative to the baseline which is the first levels of the factor variables for stratum and season.

You should try using model.matrix with your design data and see how the models differ in structure so you understand this better. Also I suggest looking at LinearModels.pdf and section 6 of the Workshop notes at
http://www.phidot.org/software/mark/rmark/RMarkDocumentation.zip
jlaake
 
Posts: 1026
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 1 guest

cron