kaitlyngaynor / gorongosa-mesocarnivores

2 stars 0 forks source link

why is it ~year-1? #100

Closed klg-2016 closed 3 years ago

klg-2016 commented 3 years ago

https://github.com/kaitlyngaynor/gorongosa-mesocarnivores/blob/91d55f0948657549a9f2f77570bf1fb5a8165d79/scripts/multi-season%20model/multi-season-sample.Rmd#L112

OK I'm fine with the "~", but why do we have the -1?

klg-2016 commented 3 years ago

OK this is the answer to that question, not sure I fully understand it yet but I'll keep thinking on it:

By default in R, a factor such as year in this analysis, is a parameterized in terms of an intercept and effects representing differences. This would mean that the parameter for the first year is the intercept and the effects would denote the differences between the parameter values in all other years, relative to the parameter value in the first year, which serves as a reference level. This treatment or effects parameterization is useful for testing for differences. For simple presentation, a means parameterization is more practical. It can be specifi ed by adding a -1 to the formula for the time-dependent parameters.

this is saying: without the "-1", all time-dependent model results are reported relative to the first year, correct? so subtracting the one allows us to get a model report relative to the mean?

kaitlyngaynor commented 3 years ago

Yep, that's my understanding. I didn't realize that this was possible but it's neat! So instead of treating the first year as a baseline and then reporting the difference year-to-year, it will evaluate deviations from the mean in a given year, including the first.

I could actually see an argument for doing it the first way, though... we aren't looking at interannual variation so much as change over time? When it comes to it, I might experiment both ways to see what results look like. My guess is that it doesn't fundamentally change the model, but just the way that the coefficients are displayed/calculated.

Not 100% sure on all of the above, just my thoughts based on what's in this issue

klg-2016 commented 3 years ago

Got it, sounds good